#Astral

1 messages Β· Page 7 of 1

analog berry
#

it computes the offset within page

#

then adds it to the mapping

#

so we dont know the initial address after that

#

or well i guess u could round down to page size

grand shadow
#

yeah just round down to page size

#

I can probably make it a todo to add some more proper unaligned support in vmm_* or something

#

but it'd just do whatever you'll do but in the vmm code

analog berry
#

yeah that should work i think

analog berry
#

@grand shadow btw your memset is bugged

#

it mangles the dst pointer

grand shadow
#

wait wdym

analog berry
#

the x86_64 branch mangles the value of ptr

#

so its no longer correct to return it

grand shadow
#

oh bruh I thought input variables in inline asm wouldn't get modified?

#

yeah looking at the disassembly that is true

#

I guess its ub?

#

idk

#

but yeah just save it in a variable or something you can merge it with your pr

#

or wait

#

add rdi to clobber ig

#

doesnt seem to compile if you do so just make it a variable yeah

analog berry
#

ill fix it

#

also the vmm is bugged unfortunately

#

but uacpi makes it pretty far into init

#

uACPI almost alive on Astral

#

as u can see it page faults on an address it had mapped earlier and never unmapped

analog berry
grand shadow
#

ik, talking about the asm thing

grand shadow
analog berry
#
void *uacpi_kernel_map(uacpi_phys_addr physical, uacpi_size length) {
    uintmax_t pageoffset = (uintptr_t)physical % PAGE_SIZE;
    void *virt = vmm_map(NULL, ROUND_UP(length, PAGE_SIZE), VMM_FLAGS_PHYSICAL, ARCH_MMU_FLAGS_READ | ARCH_MMU_FLAGS_NOEXEC, (void*)ROUND_DOWN(physical, PAGE_SIZE));
    __assert(virt);
    printf("Mapped %lu as %p (%zu bytes)\n", ROUND_DOWN(physical, PAGE_SIZE), virt, ROUND_UP(length, PAGE_SIZE));
    return (void *)((uintptr_t)virt + pageoffset);
}

void uacpi_kernel_unmap(void *ptr, uacpi_size length) {
    uintptr_t addr = (uintptr_t)ptr;
    vmm_unmap((void*)ROUND_DOWN(addr, PAGE_SIZE), ROUND_UP(length, PAGE_SIZE), 0);
    printf("Unmapped %p (%zu bytes)\n", (void*)ROUND_DOWN(addr, PAGE_SIZE), ROUND_UP(length, PAGE_SIZE));
}
grand shadow
#

also it seems to be trying to write to it?

analog berry
#

yeah, the FACS table is writable

#

thats the point of it

grand shadow
#

you're missing the ARCH_MMU_FLAGS_WRITE there

analog berry
#

ohh yeah all of these should be R|W

#

lol

#

kernec

grand shadow
#

lmao

#

also wtf rip is 0

#

what were you trying to do

analog berry
#

i have no idea

#

ill have to see where it dies

#

during late init

#

in uacpi

#

but where idk

grand shadow
#

see if you can get a stack trace

#

rsp and rbp still seems valid

analog berry
#

how would i do that

grand shadow
#

how I usually do it when gdb doesnt do it for me with bt is just

#

x/2a ctx->rbp in gdb and follow that

#

but I'd hope rsp has the return address

#

so x/1a ctx->rsp might help

analog berry
#

lets see

#

0xffff80007fc8dbe8: 0xffffffff8002c874 <pci_read8+20>

#

oh

#

pci_init is called like

#

after everything

#

interesting placement but ok

grand shadow
#

you can probably put it before, I just never ran into an issue with it

analog berry
#

anyways uACPI on Astral is officially alive!

grand shadow
#

yippe

analog berry
#

can u believe Astral allocator is good enough that it has survived the uacpi stress test first try

grand shadow
#

if it survived building gcc, running llvmpipe and all the shit I've thrown at it I would imagine it'd survive uacpi

analog berry
#

lol fair

grand shadow
#

the obos and nyaux curse hasn't hit me.....

analog berry
#

anyways i still have tons to cleanup and reorganize, but for the most part it works great

#

so thats cool

#

so things that went wrong while porting:

  • broken memset (ill fix it in my PR)
  • SPINLOCK_INIT works on a value directly, even though the rest of *_INIT work on pointers
  • readonly mapping (my rartedness)
  • pci_init happening after like literally everything
#

also had to add a few utility api but thats mostly misc stuff

prime juniper
#

Based

analog berry
#

thanks

#

took basically about 2:30 hours to get it to work

prime juniper
#

And re the wine question: outside of wine specific patches, should workℒ️

prime juniper
analog berry
#

yeah astral has pretty much most primitives already available

#

plus i stole a bit of code from managarm and adapted it meme

prime juniper
#

Astral: powered by mlibc, Limine, uACPI and a tiny bit of Managarm (in random order)

analog berry
#

lmao

prime juniper
#

But nice work

analog berry
#

yeah i mean especially for a solo project astral is in a pretty good place

prime juniper
#

Absolutely

grand shadow
#

ty
only took me a shitty real mode bit os, a shitty protected mode os, and to rewrite the old version of astral

obsidian pivot
obsidian pivot
analog berry
#

Nah that was my bug

obsidian pivot
analog berry
#

The mapping should've been rw

obsidian pivot
#

the oberrow curse can hit anyone

#

if it's gotten to the likes of keyronex a couple weeks ago

grand shadow
#

and is still active I am pretty sure

analog berry
#

The rbtree bug

obsidian pivot
#

the oberrow curse has been with me since my 2nd kernel

analog berry
#

The skill issue curse πŸ’€

obsidian pivot
#

Yes.

#

I cannot even deny that.

analog berry
#

Lol

#

At least it made you learn kasan and implement it

obsidian pivot
grand shadow
#

jk

#

that'd be bad

wild marsh
#

i still don't think the bug is strictly in frg::slab_pool

obsidian pivot
#

now if you'll excuse me I have some debugging to do

grand shadow
wild marsh
grand shadow
#

it could be gcc corrupting something

#

or idk

#

it can reliably be reproduced it'd just be super annoying to debug

analog berry
#

Just sounds like a 10 hour printf debugging session followed by a one liner fix

#

I've done those before

#

Specifically for rb tree too

#

Id just dump the tree at every state change and then analyze the log

grand shadow
#

oh god

#

my setresuid permission checking might be a bit fucked

#

it was, indeed, borked

#

the fuck is it even trying to achieve here lol

#

guess the linux filesystem id stuff? no idea

#

guess I should make that a no-op then

obsidian pivot
#

why is opening /etc/sudoers failing with EINVAL

#

rather why would it

grand shadow
#

I think setresgid() is part of the function to open it

#

and thus it just passes the error down

#

well awkward!

grand shadow
#

lmao

grand shadow
#

its real

#

peep this

fleet osprey
#

I just imagine now

$ sudo touch grass
[sudo] password for user:
Sorry, try again.
[sudo] password for user:
Sorry, try again.
[sudo] password for user:
sudo: Wow, you really are terrible at this.
robust geyser
#

good shit

obsidian pivot
#

based

grand shadow
#

only needed me to like, fix some setresuid and setresgid stuff and then implement MSG_WAITALL for recvmsg()

grand shadow
#

and it works on the rootless xorg

#

soon you literally wont have to run as root anymore if you set up the image right (based)

fleet osprey
#

nice!

grand shadow
#

also I love how quake runs p smooth now that I unshittyfied the ringbuffer and (x86_64) memcpy impls

#

also gnu hello configure and make -j2 work with the user stuff

#

it errors make install when not sudoing

#

but works when sudoing

fleet osprey
#

genuinely great stuff

grand shadow
#

thats not on llvmpipe, thats on tyr-quakes renderer

#

but tyr-glquake isnt too far off

#

I'd need to try it out

fleet osprey
#

that's sw rendering? ah

grand shadow
#

idk if the graphical glitches are tyr-quake, llvmpipe or something else

fleet osprey
#

ah, so a little slower than I would expect from my experience, but then again, your machine isn't as fast as mine, so that kinda makes sense
regardless, it's not even that far off from what I would expect, so my comment still applies

wild marsh
#

quake uses long double for some math where it needs more precision

#

although idk if that's used by glquake or only the software renderer

grand shadow
robust geyser
#
usb_xhci_doorbell_write off 0x0000, val 0x00000000
usb_xhci_fetch_trb addr 0x0000000077e70000, CR_ENABLE_SLOT, p 0x0000000000000000, s 0x00000000, c 0x00002401
usb_xhci_slot_enable slotid 1
usb_xhci_queue_event v 0, idx 0, ER_COMMAND_COMPLETE, CC_SUCCESS, p 0x0000000077e70000, s 0x01000000, c 0x01008401
usb_xhci_fetch_trb addr 0x0000000077e70010, CR_ENABLE_SLOT, p 0x0000000000000000, s 0x00000000, c 0x00002401
usb_xhci_slot_enable slotid 2
usb_xhci_queue_event v 0, idx 1, ER_COMMAND_COMPLETE, CC_SUCCESS, p 0x0000000077e70010, s 0x01000000, c 0x02008401
usb_xhci_fetch_trb addr 0x0000000077e70020, TRB_RESERVED, p 0x0000000000000000, s 0x00000000, c 0x00000000```
woo
#

i can finally go sleep

fervent fjord
#

goodnight!

analog berry
#

Work on astral uacpi integration shall continue later today

#

The init order is kinda weird so I'll have to refactor that a bit

#

So pci is available earlier

#

Also ill have to throw out all astral table parsing which was x86 specific anyway

warped plinth
grand shadow
#

So that at least the keyboard or smth works

analog berry
#

Yeah its not like u have a choice on laptops

carmine swallow
#

ps2 is very annoying with its mixed user input and command responses (and also sometimes returning ack byte and selftest result in the other order or something stupid like that anyway)

grand shadow
#

The only places I saw it work on real hardware were my laptop (mouse too) and desktop (kb only)

#

Everywhere else it either locks up fails the selftest or doesnt have any input

flat copper
#

selftest is broken with most ps2 emulation

grand shadow
analog berry
#

Nah

#

I dont even think thats broken

grand shadow
#

I might just atp take a look at a more stablished kernel's ps2 driver and see what theyre doing

analog berry
#

I put a lot of effort into stabilizing it for my old kernel

#

It worked everywhere and pretty sure it didn't have any workarounds for broken self test

#

Its just that you have to be careful with racing with user data plus have good timeouts everywhere

grand shadow
neon crane
#

@grand shadow I have a test machine that returned a bitflipped config from the i8042 controller, to detect that you'd have to check if bits 3 and 7 are 1

analog berry
neon crane
#

PS/2 Controller Configuration Byte
Commands 0x20 and 0x60 let you read and write the PS/2 Controller Configuration Byte. This configuration byte has the following format:

Bit Meaning
0 First PS/2 port interrupt (1 = enabled, 0 = disabled)
1 Second PS/2 port interrupt (1 = enabled, 0 = disabled, only if 2 PS/2 ports supported)
2 System Flag (1 = system passed POST, 0 = your OS shouldn't be running)
3 Should be zero
4 First PS/2 port clock (1 = disabled, 0 = enabled)
5 Second PS/2 port clock (1 = disabled, 0 = enabled, only if 2 PS/2 ports supported)
6 First PS/2 port translation (1 = enabled, 0 = disabled)
7 Must be zero

neon crane
#

this might be the case on your end but I'm not sure

grand shadow
analog berry
neon crane
#

actually I'm slightly curious if it still happens on that machine

#

I still have it

analog berry
#

Like they have on thinkpads with that joystick and a trackpad + keyboard

neon crane
#

but I could have sworn it did

analog berry
#

Maybe it did due to a skill issue of some sort

neon crane
#

anyway that hack was carried over twice or thrice "by folklore" from the first ps/2 mouse driver I wrote

grand shadow
#

Wrt the setuid bit on a chown(), I might just follow what linux does and clear it every time a chown is done
Originally I was going to check if the process is privileged and keep it if it is, but meh

#

It gets simpler this way

obsidian pivot
#

out of curiosity, how much memory does astral when it is booted to a bash shell

grand shadow
#

Boots to fvwm on 128 mb and its pretty much a usable system for anytging that isnt like quake at 256 (aka I was able to build gnu hello lol)

grand shadow
#

Probs cuz of the background bmp or something

#

I really should implement stuff to make free work at some point in the future

obsidian pivot
#

I'm confused.

#

What?

grand shadow
#

I mean the free command LMAO

#

Not the function the function works just fine 😭

tawny oak
#

oh lmao

#

I was going to say its even more impressive you got this far without free()

grand shadow
#

I shouldve said free -h tbh it was amviguoous

#

Qmbiguous

#

That word

obsidian pivot
#

ambiguous

obsidian pivot
#

like let's be honest

#

my kernel can work perfectly fine without it /j

#

it only uses 10mib more memory

tawny oak
#

you should still free memory though

#

unless you are the bootloader, then just mark it as 'reclaimable' πŸ˜›

analog berry
#

I still try to free everything I can in my bootloader to keep the memory map cleaner

grand shadow
#

The only thing that reclaims limine memory is a reboot meme

analog berry
#

Even like page caches and stuff are freed on handover

tawny oak
analog berry
#

Thanks

craggy tide
#

Limine also does that for the record

#

which is why i am not sure it's even worth it to reclaim bootloader memory given it's a few K? something like that tops

craggy tide
grand shadow
#

I dont bother doing it

grand shadow
craggy tide
#

your bmp is quite heavy

grand shadow
#

Yeah

craggy tide
#

last i checked

#

with no wallpaper (and to minimise memory usage further, with graphics: no on BIOS) it boots down to iirc 8mb

#

nvm

#

#osdev-beginner-1 message

#

it's apparently 6mb with framebuffer and 1.5mb without

neon crane
#

this is the memory map dump while running my OS (it has 64 MB of memory available)

#

entries with 5 are bootloader reclaimable

#

in total 377 pages, or 1.5 MB are used by the bootloader

craggy tide
#

1.5mb counts as "a few K" in my book lol

#

remember it contains the page tables, GDT, and all of the responses and associated data

#

at the very least

neon crane
#

if I can simply reclaim bootloader memory then I should be good

#

like, move everything that limine gave me and that I use into other memory and free the bootloader reclaimable memory

craggy tide
#

you can, there is no reason why you couldn't

neon crane
#

indeed

#

i'm just saying it's not a big deal that it's still using 1.5mb

craggy tide
#

yeah

grand shadow
#

theres something really satisfying about glxgears

#

idk why its fun to stare for a minute at the gears

grand shadow
#

made nohup work, will be useful for launching stuff from /etc/rc eventually

inland cliff
#

9950X? Threadripper?

grand shadow
#

only missing the check for signal() now I think

#

@analog berry @robust geyser idk if yall were using vmm_changemmuflags but if you were be aware I changed the return value from a bool to an errno once you git pull

#

I will do that change to vmm_map once yall are done with your stuff

craggy tide
grand shadow
#

well shit the ssh port bitrotted on the server side

#

oops!

#

gonna look into that tomorrow

inland cliff
neon crane
#

that's what they said about the pentium 4!

fervent fjord
#

(and they were right)

lean kettle
#

Intel is not beating the space heater allegations

#

Actually no desktop chip that is high performance is gonna beat it, TDP >50W was a mistake halfmemeright

#

That's probably the hottest take I've ever dropped in this server

fervent fjord
#

if your CPU isnt pulling 500W are you even using your hardware

#

saying this from DDR4 at 12V, room smells like ozone

lean kettle
#

Only 12v? Real pros power DDR4 directly from AC

fervent fjord
#

the AC is already going thru my left foot into the PSU

#

dead man switch like a train but for PC

lean kettle
#

Try using a jumper cable to connect the DDR4 to the rectified DC voltage from the PSU, it should be close to 300V

neon crane
fervent fjord
lean kettle
#

Ah ok, yeah I can see how that's more important yea

fervent fjord
#

its actually a sick album

#

idk if I prefer vignette or midwest indigo

lean kettle
#

The only twenty one pilots songs I recently listened to were ride and heavymetalsoul and that was because YouTube mixes decided I should lol

#

I used to be a fan of them but tbh I've kinda stopped listening to them

fervent fjord
#

Ive followed them for a while

#

a new group to my library ive listened to lately is HEALTH

#

but its quite different in style

#

its like industrial rock

lean kettle
#

I don't really follow bands more than I like specific songs from many bands lol

#

Although I have listened to a lot of alestorm lol

fervent fjord
#

the life of the youtube playlister

#

I respect it

lean kettle
#

The only thing YouTube mixes are good for is background noise

#

And occasionally finding new songs

tawny oak
#

I did not expect you to be an alestorm fan

inland cliff
inland cliff
lean kettle
#

insert any modern high performance CPU/GPU company here is not beating the space heater allegations

inland cliff
#

The upside of Intel processors is that due to them crashing and eventually breaking, you can claim a lower average power consumption

grand shadow
#

For today I will be fixing the openssh port, implementing putgrent in mlibc and implementing the signal() check

#

After that I think all I can do about multiuser will be done?

craggy tide
carmine swallow
#

also undervolting helps a lot with temps

craggy tide
#

yes but it also helps with losing stability lol

#

i just run it with the default intel profile (performance) at PL1=PL2=253W and IccMAX=307A

#

and i run the DDR5 at JEDEC 4400 as per spec

carmine swallow
craggy tide
#

tbh if you're worried about power and temps just use a 65W SKU stock

#

i've been really impressed with my 12900

#

runs all core loads (past tau boost expiry) at around 70c

#

quiet as hell, cool

#

sure, obviously it's slower than a K part at 241W but you lose some, you gain some

carmine swallow
#

yeah that sounds nice, though I am pretty happy with my 13600k so I don't think I am going to change it any time soon

craggy tide
#

you can change the power/current limits to emulate a non K SKU anyways lol

carmine swallow
#

yeah ig

inland cliff
analog berry
craggy tide
grand shadow
#

oops it really really wants getsockopt to work and I have that stubbed

#

IP_OPTIONS in specific

analog berry
#

got rid of all astral manual ACPI table parsing + added a bunch of new things here and there + improved the glue code

#

shutdown from the power button now works from Astral as well

fleet osprey
#

πŸ”₯

#

if you want to send some patches (or a compiled build) I can test this out on some of my real hw

analog berry
#

we'll test it properly once its merged into astral

obsidian pivot
#

can astral load drivers by iterating the acpi namespace now

analog berry
#

Nah

#

Astral kernel is very basic for the most part

#

Also its very x86 specific

obsidian pivot
#

dam

grand shadow
analog berry
#

arch_apic_* πŸ’€

fleet osprey
#

if there's any chacne at seperating it from Limine I might try my hand at a PPC port

#

but I never even finished procfs
so no guarantees that I'll ever get anywhere w/ it

analog berry
#

And literally all of init happening in x86-64/main

obsidian pivot
grand shadow
analog berry
obsidian pivot
#

(oops)

grand shadow
obsidian pivot
#

when astral m68k port?

grand shadow
analog berry
#

Nah dont get me wrong its fine and it seems to work so

obsidian pivot
#

aww

#

you could've joined fadanoid, r4, and I

robust geyser
#

not so hot take, 32-bit sucks

obsidian pivot
#

yeah but the m68k doesn't suck

winged basin
#

nothing is very "64-bit specific"

obsidian pivot
#

I have summoned the fadanoid by saying "m68k"

winged basin
#

i didn't even try to be nonspecific with bits but it just worked

obsidian pivot
#

same (almost)

winged basin
#

endianness is also a paper tiger

robust geyser
#

cant really have a hhdm on 32-bit systems

winged basin
#

just reject >~1.5g or so

#

it will cover most actually existing hardware

obsidian pivot
#

have two page tables

#

one has one half of the hhdm

#

the other has the other half

#

(not actually)

fleet osprey
#

but what if I wanted to boot on a Pi 0 W

obsidian pivot
grand shadow
#

oooh damn openssh wants fucking fd passing in unix sockets cuz of privsep

#

before it didn't need it cuz it was just running as root

#

but I guess now I need to implement it?

#

shouldn't be too hardℒ️

grand shadow
#

I'd really just have to go and see

#

but before even trying for a 32 bit port I'd try a 64 bit one

robust geyser
#

aarch64

#

:^)

#

forget riscv64 its not even a real architecture

grand shadow
#

yeah I was probably just gonna try aarch64 some time in the future

#

I would have to learn how that works tho I have never even looked into it

inland cliff
#

Have fun with dtbs

fleet osprey
#

mhmm

#

they're honestly not too bad imo

obsidian pivot
#

cc @analog berry

analog berry
#

What

obsidian pivot
analog berry
#

Yeah lets not go there

fleet osprey
#

at least DTS's aren't, I've never actually parsed a compiled DTB, so ig I can't comment on that, maybe once compile they're actually terrible
but the source really isn't that bad, I've spent way too long staring at them for PowerPC

obsidian pivot
#

coulda sworn you had a rant about DTBs somewher ein this server

craggy tide
#

some virus is spreading around our circles where people find a sudden urge to love doing 32-bit stuff

#

maybe i should just start banning people spreading 32-bit propaganda

craggy tide
#

please stop saying stupid stuff

#

you're part of the problem

robust geyser
#

you can if you don't need to map all of the physical memory*

#

and dont mind wasting half of the virtual address space

craggy tide
grand shadow
craggy tide
robust geyser
#

true, but if you dont need an hhdm you could just map physical memory anywhere

craggy tide
#

well yes

robust geyser
#

im not tryna be defensive or anything btw

#

i still dont like 32 bit architectures lol

craggy tide
#

we're talking about hhdm in particular here, especially the notion that it can be "done" on 32-bit architectures

#

it can't

#

at least not in any way where it'd be a true hhdm

#

you have a higher half which isn't even half, it's usually 1gb

#

good luck mapping anything substantial in there

#

which is why 32-bit kernels can't (or at least shouldn't) have a hhdm

#

which is just one of the things that makes 64-bit handier

#

we literally spent like 5-6 years trying to get people to make 64-bit kernels as their first and accept that 32-bit is obsolete and should die out

#

and now, summer 2024, for some reason everyone wants 32-bit kernels

#

makes me wonder what is going on behind the scenes that i am missing

robust bobcat
craggy tide
obsidian pivot
#

in terms of how much memory you get

craggy tide
#

i think you're a big part of the problem

obsidian pivot
#

elaborate?

#

is it because of my hyper promotion

craggy tide
#

what? no

robust bobcat
#

doubly as difficult

craggy tide
#

sorry if you got "bored" of 64-bit architectures and actually avoiding a big set of issues with OS development

#

doesn't mean everyone should start to be pushy about doing 32-bit ports

obsidian pivot
#

the only reason my kernel remotely has 32-bit support is because the m68k

craggy tide
#

it would be understandable if it was a future feature that needed work to support

#

but every day 32-bit architectures die more and more

#

they are pretty much extinct outside of microcontrollers and other niches

obsidian pivot
#

true

craggy tide
#

at least for general computing

obsidian pivot
#

((maybe that was a bad idea))

#

(((anyway)))

grand shadow
#

fd passing is almost done, I'll finish it tomorrow

#

went to a work event today and that sucked all the energy out of me, even taking a fat nap in the evening didn't help too much

fleet osprey
craggy tide
#

i'd argue it's very much microcontroller

#

no one in their right mind uses rpi0 as a general purpose computer

#

i am just REALLY tired of all the 32-bit apologists in full swing lately

#

it really annoys me and it seems like i am not the only one that noticed the anomalous wave of this stuff

fleet osprey
#

you have to actually go out of your way to use it as a microcontroller, and not as a Linux machine

#

so I'd argue that it's very much closer to a general purpose computer than a microcontroller, even if it can technically be used as one

craggy tide
#

agree to disagree

inland cliff
inland cliff
inland cliff
neon crane
#

i disagree with beginners making 32-bit operating systems because the 64-bit x86 platform is genuinely easier than the legacy shit

#

but if you know what you're doing, imo, feel free

neon crane
#

frankly, I'm not

#

I want to port my OS to i386 class platforms at some point but that's well after I start writing the userspace for it

neon crane
errant zephyr
#

and also "everyone" is a stretch

neon crane
#

i mean sure but beginners in particular should not try to run before they can walk

errant zephyr
#

ofc

neon crane
#

also mint's general disdain of 32-bit platforms shouldn't degrade into a ban wave

#

let the people do what they want and brag about it

#

you can and should intervene if those people shill 32-bit as "easier"

tawny oak
obsidian pivot
#

I was going to elaborate on what I meant by that, guess I forgot to

split gazelle
#

ffs i really want to leave this server because of mint

#

mint this is not that serious

#

i just want to osdev in peace

#

i don't care what bits the os is made for

#

i don't care what cpu the os is made for

#

i just want to talk about all kinds of osdev

#

no matter if its 64, 32, or even 16 and 8 bit

#

now my trust with you mint has been broken thanks to your bullshit

tawny oak
#

ok lets not make this personal - if you want to leave no one is stopping you, but I think we should perhaps take this outside of mathewnd's progress thread.

crude agate
#

32 bit kernels are dumb child play and have been obselete for 27 years

#

if u look at old 32 bit windows NT you'll see that it's nothing more than a stupid kids' toy...

#

this is a huge problem in the osdev community, we need to stop the spread of 32 bit and get beginners into 64 bit projects which are 2 times better

errant zephyr
#

yeah and clearly the best way to do that is to ban all the people that say otherwise

#

it's well known that a discord mod must ban all opposing opinions asap

analog berry
#

i think dwl was memeing a bit

obsidian pivot
#

we must stop ALL 32-bit kernels

#

and BAN EVERYONE

errant zephyr
#

that is obviously how you raise the activity of your server

obsidian pivot
#

who fights back

split gazelle
#

people should be forcibly use 64-bit x86 and use only the limine bootloader

obsidian pivot
#

and BAN EVERYONE who has EVER written one, or has a port to any 32-bit arch in their kernel

split gazelle
#

if you use the shitty and obselete multiboot, you will be banned from osdeving

#

if you even dare to port your os to some random niche failed risc architecture from 1991, you will be executed on public and it will be livestreamed to the entirety of the osdev discord server

#

every architecture and bitness are banned except x86 and 64-bit

#

every bootloader and boot protocol are banned except limine

analog berry
split gazelle
#

you are forced to use limine and you will have to accept it

#

this is ingsoc, every os should be on 64-bit x86 and limine

#

otherwise, you will be publicly executed live on tv

#

praise our supreme leader mintsuki

crude agate
#

32 bit is killing the next generation

split gazelle
#

yeah

crude agate
#

why do u think none of the gen z can find jobs

split gazelle
#

we're serious

crude agate
#

they dont know 64 bit

split gazelle
#

we are hired by mint to spread this message

#

praise our supreme leader mintsuki

tawny oak
#

alright, lets take this out of the progress thread

#

im going to start muting (I understand that conversation happens naturally, but we are so far removed from astral at this point)

crude agate
tawny oak
#

#lounge-0

analog berry
#

Currently making some uacpi patches to make astral init code nicer lmao

tawny oak
#

nice - how many kernels have you ported uacpi to now?

analog berry
#

well me personally just managarm at this point (if we're not counting my very early ports to test uacpi on real hw)

#

hoping to eventually see it in reactos (there was some interest iirc)

crude agate
#

when is the linux port happening

analog berry
#

when u submit the patches for it ofc

crude agate
#

lol

spare sky
#

and people did

flat copper
#

go for windows or go home

spare sky
#

when machines had 4 MB of RAM

#

32-bit address space seemed as vast in the 70s as a 48-bit address space seems today

flat copper
#

you can support 32bit easily on machines that have very little memory (so you can do a higher half physmap) and low mmio

crude agate
#

i wonder if we'll ever actually need a full 64 bit address space

spare sky
#

I haven't even noticed a huge increase in 32-bit OSes

obsidian pivot
#

the only kernels I know of with a port to a 32-bit arch on this server are northport, keyronex, and my kernel

crude agate
#

Big 32 is waging a war on osdev

obsidian pivot
#

also maestro, but that was done out of not knowing that 64-bit is a better decision

split gazelle
#

mint are talking about nonsense

robust bobcat
#

mean

split gazelle
#

i love 32-bit

#

and niche architectures

spare sky
#

please be civil

grand shadow
split gazelle
#

i won't do that again

analog berry
#

glue init hooks

lean kettle
#

Also please don't use the astral thread for this (the weird 32 bit flame war I was too asleep to notice), it's clogging up a actually good progress report thread

grand shadow
#

Tbh at one point I should look into making that code better so I dont end up with an infinite number of *_init functions there

analog berry
#

@grand shadow whats the proper way to cleanly terminate a kernel thread remotely if i only have its handle

grand shadow
#

none currently meme

flat copper
#

and you'd need to avoid having locks held when the thread is deleted out of existance

grand shadow
#

^

analog berry
analog berry
#

also i guess astral doesnt have anything like a workqueue so i have to make an adhoc list or something like that

flat copper
#

what do you need this for

analog berry
#

scheduling work from an interrupt handler

flat copper
#

id just make your own list of entries, since you dont need any of the interaction that a real workqueue needs

analog berry
#

well it kind of lines up with what workqueues do perfectly, does it not?

#

u submit some work and u wake the thread

flat copper
#

but you have more than one workqueue threads with dynamic scaling etc

analog berry
#

yeah ill just make a list

#

does astral not have any list helpers?

flat copper
#

if they're all of mostly the same priority its the best way (so all low priority or also all super high priority)

analog berry
#

yea

analog berry
#

oh well

neon crane
analog berry
#

I dont think dcps are supposed to be sleeping or acquiring locks or take a lot of time

neon crane
#

what do you need to do that "takes a lot of time"?

analog berry
analog berry
grand shadow
#

aaaAAAAAAA this took longer than I wanted

analog berry
#

Thats insane

#

Gj

#

@grand shadow is there like a max column width u like

#

Or do u just not break lines ever

neon crane
#

wdym?

analog berry
#

E.g. I limit my lines at 80 chars

neon crane
#

oh source code line limit

analog berry
#

Yeah

grand shadow
#

when I remember to break them I do πŸ’€ usually if its tooooo big I add a line break

analog berry
#

I see

neon crane
#

mine's like

#

a soft 120 chr limit

#

but it may be overflown sometimes

analog berry
#

yay my astral work queue works

#

@grand shadow any objections to these?

#

idk how they were still missing

grand shadow
#

tbh idk too I was just too lazy lmao

analog berry
#

cool np

analog berry
#

i'll leave it to you to make a shutdown program, but acpi_poweroff and acpi_reboot helpers are already there

robust geyser
#

i really hated that i had to make a hashmap like the nvme driver lmao

analog berry
#

lol np

grand shadow
#

wait

#

.

#

WHY DID I NEVER THINK OF THAT

robust geyser
#

☠️

grand shadow
#

actually crying

robust geyser
#

that hashmap thing is criminal

#

it felt terrible copying that from the nvme driver

#

but i also couldnt think of anything better 😭

analog berry
#

lmaooo

grand shadow
#

I'll open a pr for some mlibc stuff and then I'll take a look at it

analog berry
#

yeye test it out as well

#

this should work now

#

and well real hw as well

robust geyser
#

power management stack coming soon?

analog berry
#

probably a lot more to do before we get into that

#

it needs to at least use the namespace to load drivers based on the devices present

#

etc etc

proper meteor
grand shadow
#

implemented putgrent in mlibc so useradd doesn't die when it creates the group

#

assertos is no more

robust geyser
#

based

#

i need to get back to working on the xhci driver + usb

grand shadow
#

xhci would be very epic

robust geyser
#

it would indeed but im very lazy

#

also i have no idea how to make the usb stack work with ehci/uhci so that will be very fun

neon crane
#

except i already did something better than it which is using an MDL (list of physical pages) instead of issuing several consecutive read requests

grand shadow
#

if you didnt do that anywhere else I can fix it when I merge

#

alloc() also returns zero'd data already (uacpi_kernel_calloc) so I will probably also remove the memset there

craggy tide
#

that said, all of what you said afterwards really came off as built up hatred towards me rather than just a reaction to 1 frustrated comment of mine

craggy tide
#

especially the part bringing up Limine for some reason (alongside @analog berry ) as if that is the reason i am frustrated at 32-bit stuff

#

i've never been frustrated at people using Hyper or BOOTBOOT or whatever else, even mb2, making 64-bit kernels

#

pointing at Limine over my frustration with an unrelated issue is frankly pretty gross

analog berry
#

I was memeing lol

craggy tide
#

you may have, but the other guy seemed genuinely mad

analog berry
#

He's 15 so

craggy tide
#

for the record i am pretty sure they were banned before as well

#

for unrelated reasons

craggy tide
#

if i ever did that, lukflug is unironically going to show up at my front door and beat me up

craggy tide
#

even with 1 MB of ram

#

MMIO ever since PCI has been a thing has always been near 3.5/4GB

neon crane
#

why not

craggy tide
#

while free memory has always, almost by rule, been lower down, towards 0

#

that already stretches almost the entire address space

neon crane
#

pee cee eye has not always been a thing

#

so on some systems you absolutely could

grand shadow
#

@analog berry also are uacpi events supposed to wake up only one thread?

craggy tide
analog berry
spare sky
#

on 386SX-class machines, everything definitely below 16 MiB

neon crane
#

exactly

craggy tide
#

i specified PCI for a reason

grand shadow
#

cuz there is an event thing already

#

thats why I was asking about the semaphores being used

lean kettle
#

this is the astral thread

neon crane
#

cant really have a hhdm on 32-bit systems
-czapek
you can
-fadanoid
you can't
-mint

lean kettle
#

just fyi

analog berry
#

Are they better than my handrolled thing

craggy tide
grand shadow
#

tho I think it depends on being able to target a specific cpu

analog berry
grand shadow
#

so idk if that can be used or should be used in uacpis case

#

ah

craggy tide
#

there

grand shadow
#

then semaphores should work just fine

neon crane
#

also you can simply segment it into PCI space and normal space, it wouldn't be a direct map but youd map all accessible memory

#

pci space cant be more than like 512 meg can it

craggy tide
#

well yes, but you said it yourself that it wouldn't be a direct map

neon crane
#

ye

craggy tide
#

but that's as long as you don't have too much memory, as well

analog berry
#

Or rather many producers potentially but one consumer

grand shadow
analog berry
#

What would be the response in that case

grand shadow
#

either assertosℒ️ or wake up all waiting threads with a special reason or something

#

probably assertos

#

atm

analog berry
#

Could we just do nothing and just consider this a spurious wake-up if there's a race?

#

Or does that break something

grand shadow
#

if you wake the threads up theres a very good chance the thread will release the semaphore when it finishes doing whatever its doing I imagine

#

talking about its use in general

#

but it doesn't nescessarily check for the semaphore value when it wakes up (since it assumes it can run)

analog berry
#

Probably

grand shadow
analog berry
#

Its a question of whether any pc does that

#

And that I dont know

#

Maybe error instead of assert is better

#

Event is generally not used that often in aml

#

Let alone resetting it

grand shadow
#

ah fuck it then I'll just assert

analog berry
#

U think so?

grand shadow
#

if I ever run into a machine that has the very specific conditions for this to happen I will get a lottery ticket and fix it

grand shadow
#

@analog berry also do you know how linux/other unices handle stuff like telling init that the power button was pressed?

#

maybe theres a signal or something

analog berry
#

Its the protocol they use

robust geyser
#

doesnt linux just send a sigterm?

#

or sigkill

#

to init

analog berry
#

Nono

#

Its an event

#

I forget what its called

#

Netlink?

#

Idk

wild marsh
#

god bless

robust geyser
#

thats possible

#

i wouldnt be surprised if it was done over nl

#

lol

analog berry
#

I think netlink yeah

wild marsh
#

that'd be the linux-specific way anyway

robust geyser
#

but i think i remember something something signals

#

well, shutdown i mean

#

not exactly power button

analog berry
#

So idk why u would need something as hard as a signal for that

wild marsh
#

you could just have a device file that you poll/blocking read from and it returns some data when the power button was pressed if you're not aiming for compat with other systems

robust geyser
#

astral linux compat arc

#

cant wait

analog berry
#

Lol

#

Astral can just make a file or something

#

Same way keyboard events work for example

grand shadow
#

yeah probably

wild marsh
#

i mean what i described is basically linux's /dev/input :^)

grand shadow
#

I guess I could have init polling on that for the button press and some named fifo for user commands like poweroff

#

or have a special acpi process in the background that calls into that fifo or something

analog berry
#

Ill take a look how Linux does it once I get back home

wild marsh
#

some cursory poking in sysfs reveals that the acpi power button is just also in /dev/input/?

analog berry
#

Oh yeah there u go

grand shadow
#

/dev/acpi it is then

robust geyser
#

dear lord

#

actually that makes sense

#

u can just broadcast all acpi events there

#

nice

analog berry
#

There's also lid besides the power button

wild marsh
grand shadow
#

/dev/keyboardX node only for acpi events meme

wild marsh
#

based

grand shadow
#

I'll take a small break and then build astral with the uacpi pr

analog berry
#

Ill update whatever we discussed in a bit

obsidian pivot
analog berry
#

Yes but thats not what hhdm is about

obsidian pivot
#

I replied to the wrong msg

obsidian pivot
#

*meant

lean kettle
#

again, astral thread

#

move this elsewhere

analog berry
#

Poor Matthew lmao

grand shadow
#

gonna try to compile limine

#

but first I need mtools and I'm too lazy to add the recipes sooo

#

mtools built it seems

craggy tide
#

seems like it failed to validate your toolchain

grand shadow
#

does it need x86_64-elf?

craggy tide
#

no it should build fine with your host compiler

#

it tries to compile a small object to test if the toolchain compiler actually works

#

something like ```sh
echo | gcc -x c -c - -o /dev/null

grand shadow
craggy tide
#

rip

grand shadow
#

seems like /dev/{null,zero,random,full} do accept seeks so time to change that

#

well that was disappointing

craggy tide
#

missing sysdep?

#

which one is it?

grand shadow
#

its some unimplemented thing in mlibc

#

__freadptr

craggy tide
#

interesting

wild marsh
#

god bless it's trying to poke at libc internals

craggy tide
#

slow but no hacks moment?

wild marsh
#

no because the existence of __freadptr gets rid of the gnulib impl :^)

grand shadow
#

first line too like damn didn't even give me the satisfcation of making it go a tiny bit into the build

wild marsh
#

who even added __freadptr

craggy tide
#

it did configure :^)

prime juniper
craggy tide
#

git blame time

wild marsh
#

could just make it return nullptr unconditionally

grand shadow
#

what does that function even do I wasn't able to find a man page

wild marsh
#

gives you a pointer into the internal FILE buffer

#

and the amount of data that's currently sitting there

prime juniper
#

ohhh spicy

#

added by none other than the man the myth the legend avdgrinten

grand shadow
wild marsh
#

that's what the gnulib SLOW_BUT_NO_HACKS impl does

analog berry
#

@grand shadow aight i think i fixed everything we have talked about

grand shadow
#

seems like so?

grand shadow
#

seems to actually be building

#

oop

#

forgot to build mtools with --disable-nls πŸ’€

#

wait no thats not nls

#

iconv_open on mformat

#

so it is not disable nls stuff lol

robust geyser
#

lmaooo

grand shadow
#

I just wont build uefi-cd then meme

craggy tide
#

lol

grand shadow
#

look at that

#

@craggy tide I did it

analog berry
#

niice

#

what if the law requires full warranty

craggy tide
#

did it before managarm

craggy tide
#

that's just what all licenses say

analog berry
#

yeah ik

#

just always wondered about that

grand shadow
#

wonder what more I really need to be able to slap a "self hosting" label on astral

craggy tide
#

nothing

analog berry
#

well u cant compile gcc yet right

grand shadow
craggy tide
#

i don't think you need to be able to build gcc to count as self hosting

analog berry
#

how do u host yourself if u cant build the compiler

wild marsh
#

i mean going by that logic you can't really self host ever because you can't run jinx?

robust geyser
#

whats the problem with building gcc on astral?

craggy tide
#

well in my personal definition of self hosting you only really need to be able to build the kernel and deploy it such that you can reboot into the new instance

analog berry
grand shadow
wild marsh
robust geyser
analog berry
#

ah

robust geyser
#

mint did say she might add a containerless mode tho

craggy tide
#

as a whole

grand shadow
#

unless I try limine's ext2

robust geyser
#

well but user ns is the main feature

craggy tide
#

even if you had linux user ns how do you expect to chroot into debian

robust geyser
#

true

craggy tide
#

if you don't support linux compat

craggy tide
wild marsh
#

just use a linux distro that uses mlibc then switch out libc.so etc for your kernel's version (assuming you use the linux abis) :^)

craggy tide
#

ah yes

analog berry
#

just implement every linux syscall

craggy tide
#

easy

robust geyser
#

astral linux binary compat!!!

#

i predicted it 2 hours ago

#

gg

grand shadow
#

isnt there like some linux emulators or something

wild marsh
#

port qemu and use qemu-x86_64

grand shadow
#

true

craggy tide
#

does that even work like that?

carmine swallow
craggy tide
#

^

wild marsh
#

i don't actually know if it just translates syscalls or emulates thm

carmine swallow
#

because as far as I understand it just translates them

craggy tide
#

i think it translates them

carmine swallow
#

but I haven't looked at the source so I can't say for sure

grand shadow
#

the biggest thing about the "swapping out the kernel" part is that while my root filesystem is on disk the kernel is loaded from the limine cd

craggy tide
#

why?

robust geyser
#

time to load it from the disk then

#

you have vim

grand shadow
#

it was just easier to make a disk like that

robust geyser
#

you can write a limine config on astral

regal stone
robust geyser
#

;)

regal stone
#

limine inside of limine

grand shadow
craggy tide
regal stone
robust geyser
#

port fdisk/parted so you can install from a live cd

regal stone
#

but technically

craggy tide
#

then technically i develop limine inside of limine since i boot linux with limine

robust geyser
#

download sysroot, format disk, unpack it, install limine

#

gg

regal stone
#

im curious

grand shadow
#

so it probably needs some weird linux api

regal stone
#

how long has this project been in development

robust geyser
grand shadow
#

this rewrite like a year and a few months

robust geyser
#

youd be surprised

grand shadow
#

oh huh

craggy tide
#

sgdisk > fdisk anyways

#

because it's actually portable

carmine swallow
#

also I think I am going to make the mlibc glibc binary compat thing I made a little less hacky so then you can try it on astral if you want meme though idk what you could run with it, for factorio you need X11, Xext, GL, Xinerama, Xrandr, Xcursor, alsa (audio devices don't need to be there, just the lib), pulseaudio (copying libs from host might work as a hacky workaround), xcb, Xrender, Xfixes, dbus, Xau, Xdmcp, libsndfile, libasyncns, libflac, libvorbis, libopus, libogg, libmpg123, libmp3lame

grand shadow
#

maybe

#

I just need the disk formatting tool

#

I'll try it some point in the future

#

right now I'm gonna get uacpi merged after I shower

grand shadow
prime juniper
grand shadow
#

@analog berry seems to be working here, was able to build and tell it to power off

#

is there anything is specific you need me to test? otherwise lgtm

#

all I have is some style stuff that I'll change once its merged but nice work ty

analog berry
obsidian pivot
#

are you going to start enumerating the acpi namespace for devices now that you have uACPI

#

it's really cool

analog berry
grand shadow
#

once I do that I will certainly use it

#

but for now I might play around and add a /dev/acpi device

obsidian pivot
#

I'll just make oDriverInterface ultrameme

grand shadow
#

oOsdev

analog berry
#

if shutdown worked via gui

obsidian pivot
robust geyser
#

you can poll on it

#

and figure out

#

if someone pressed the power button

#

or closed the lid

#

or whatever

#

i imagine for now it would only be the power button

grand shadow
#

and probably I'd have you be able to write some character into it or something to tell the computer to shutdown

analog berry
obsidian pivot
robust geyser
#

that would be a better idea

grand shadow
analog berry
#

ig

grand shadow
#

reboot(2) seems very linuxy and I want to be able to just

#

echo "1" > /dev/acpi

#

or something

analog berry
#

maybe an acpi directory would be nicer?

#

/dev/acpi/poweroff

grand shadow
#

hm

#

meh

#

idk

#

I'd need to think

robust geyser
#

i think /dev/acpi is fine

analog berry
#

keep in mind

#

u will need to expose e.g. battery devices

#

fan devices

#

etc

#

tons of stuff

#

to userspace

obsidian pivot
#

a directory would be better since acpi is a namespace

robust geyser
#

/sys

grand shadow
#

do you have any docs for uacpi

obsidian pivot
#

he has docs in header files

analog berry
#

if u port a gui for showing battery indicators that would be cool

obsidian pivot
#

in forms of comments

analog berry
#

it has like driver interace examples and stuff

obsidian pivot
#

now

analog berry
#

of course

obsidian pivot
#

because months ago you said my thing used private api

#

like before you had public api

analog berry
#

it used to be private probably

grand shadow
#

hm I think for now I will just have a very simple /dev/acpi and once I start enumerating devices (both pci and acpi) I will redo it

#

since it'd be super simple and work just for stuff like the power button

#

and other simple things

robust geyser
#

sync; sync; echo 5>/dev/acpi

#

goated

analog berry
#

For modern real hw u will also want an EC driver

#

since thats how power button is routed there

obsidian pivot
#

or you can be lazy like me and say TODO: Implement EC driver

#

(7 months todo by now)

grand shadow
#

sync();
sync();
write(acpifd, WHATEVER_I_CHOOSE, 1);

analog berry
#

why are two sync's needed?

grand shadow
#

its not

#

at least in astral

obsidian pivot
#

to sync the previous sync

#

duh

analog berry
#

lol

robust geyser
#

sync is not allowed to complete while any other sync is in progress

#

so thats why you usually double sync

analog berry
#

its async?

robust geyser
#

yeah

#

on linux

#

does sync block on astral?

analog berry
#

that kinda

#

negates the point of it

grand shadow
#

on astral sync() is blocking

robust geyser
#

nice

grand shadow
#

posix just leaves it at a The writing, although scheduled, is not necessarily complete upon return from sync().

#

and I decided that its just safer to wait until its done

analog berry
#

yeah it is

#

like async sync sounds like a very bad idea

grand shadow
#

tho I also need to implement kill(-1, signal) for it to make sense

robust geyser
#

VERSIONS
According to the standard specification (e.g., POSIX.1-2001), sync() schedules the writes, but may return before the actual writing is done. However
Linux waits for I/O completions, and thus sync() or syncfs() provide the same guarantees as fsync() called on every file in the system or filesystem re‐
spectively.

#

hmm

#

i always thought sync on linux was async

analog berry
#

i guess its just posix stupidity

robust geyser
#

i vividly remember that sync would just return immediately

#

while the 2nd one would block

grand shadow
#

probably shitBSD 0.01 didn't block and they decided to leave it at that

obsidian pivot
#

only one way to find out

obsidian pivot
#

isn't that dwl's os

analog berry
#

that was shitos4

#

shitos3 is saga i think

obsidian pivot
#

ah

#

whose is shitos5

analog berry
#

its up for grabs

obsidian pivot
#

@stark walrus do you want shitos5 instead of secureos