#Astral
1 messages Β· Page 7 of 1
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
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
yeah that should work i think
wait wdym
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
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
its just incorrect as per the spec for memset
ik, talking about the asm thing
how'd you map the page
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));
}
also it seems to be trying to write to it?
you're missing the ARCH_MMU_FLAGS_WRITE there
i have no idea
ill have to see where it dies
during late init
in uacpi
but where idk
how would i do that
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
lets see
0xffff80007fc8dbe8: 0xffffffff8002c874 <pci_read8+20>
oh
pci_init is called like
after everything
interesting placement but ok
you can probably put it before, I just never ran into an issue with it
anyways uACPI on Astral is officially alive!
yippe
can u believe Astral allocator is good enough that it has survived the uacpi stress test first try
if it survived building gcc, running llvmpipe and all the shit I've thrown at it I would imagine it'd survive uacpi
lol fair
the obos and nyaux curse hasn't hit me.....
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
Based
And re the wine question: outside of wine specific patches, should workβ’οΈ
Damn that was a good base you were working with then yeah
yeah astral has pretty much most primitives already available
plus i stole a bit of code from managarm and adapted it 
Astral: powered by mlibc, Limine, uACPI and a tiny bit of Managarm (in random order)

lmao
But nice work
yeah i mean especially for a solo project astral is in a pretty good place
Absolutely
ty
only took me a shitty real mode bit os, a shitty protected mode os, and to rewrite the old version of astral
so obos more stable than astral 
oh nvm
Nah that was my bug
YET
The mapping should've been rw
the oberrow curse can hit anyone
if it's gotten to the likes of keyronex a couple weeks ago
it hit mlibc 
and is still active I am pretty sure
The rbtree bug
it can probably get to anyone
the oberrow curse has been with me since my 2nd kernel
The skill issue curse π
considering just making mlibc's malloc use astral's slabs cuz of it 
jk
that'd be bad
i still don't think the bug is strictly in frg::slab_pool
now if you'll excuse me I have some debugging to do
I have no idea how to even begin debugging that stuff its gonna sit in bug hell for quite a while
i wouldn't be surprised if the total amount of heap allocations (both in kernel and user space) was in the millions by the time mammogram gets to weston
That would be based
it could be gcc corrupting something
or idk
it can reliably be reproduced it'd just be super annoying to debug
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
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
I think setresgid() is part of the function to open it
and thus it just passes the error down
well awkward!
ah
wtf
you can have sudo insult you? that's hilarious
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.
based
only needed me to like, fix some setresuid and setresgid stuff and then implement MSG_WAITALL for recvmsg()
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)
nice!
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
have you tested how that stacks up to the same machine under Linux with llvmpipe? from the looks of it, you're pretty close
that honestly looks exactly like I how would expect llvmpipe to run if I was running it on my PC under Linux
genuinely great stuff
thats not on llvmpipe, thats on tyr-quakes renderer
but tyr-glquake isnt too far off
I'd need to try it out
that's sw rendering? ah
this is with llvmpipe
idk if the graphical glitches are tyr-quake, llvmpipe or something else
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
the graphical glitches might be due to the initial fpu state being wrong?
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
It only happens in glquake
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
goodnight!
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
interested in seeing this upstreamed, i rlly wanna run astral on my laptop, and the ps2 code kept killing it lol
Holy shit epic
Yeah you can just nuke that
I need to see what Im doing wrong regarding ps2 init
So that at least the keyboard or smth works
Yeah its not like u have a choice on laptops
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)
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
selftest is broken with most ps2 emulation
How do you even detect that, is it on that one acpi table
I might just atp take a look at a more stablished kernel's ps2 driver and see what theyre doing
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
Do you have the link so I can take a look at it
@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
UltraLegacy on my GitHub, but be careful cause it's c++
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
Oh wtf
this might be the case on your end but I'm not sure
I can read some c++ ty
Thats curious
Nice, it worked on at least 5 laptops and a few desktops
Oh also it supported multiplexing for up to 5 ps2 devices
Like they have on thinkpads with that joystick and a trackpad + keyboard
so it seems it doesnt happen
but I could have sworn it did
Maybe it did due to a skill issue of some sort
anyway that hack was carried over twice or thrice "by folklore" from the first ps/2 mouse driver I wrote
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
out of curiosity, how much memory does astral when it is booted to a bash shell
Last time I tried it needed like 50 mb allocated to boot but from counting the pages used since pmm init it seems like it was less, more like in the 30 mbs
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)
Because lower than 50 mb and limine ooms
Probs cuz of the background bmp or something
I really should implement stuff to make free work at some point in the future
ambiguous
who needs free?
like let's be honest
my kernel can work perfectly fine without it /j
it only uses 10mib more memory
you should still free memory though
unless you are the bootloader, then just mark it as 'reclaimable' π
I still try to free everything I can in my bootloader to keep the memory map cleaner
The only thing that reclaims limine memory is a reboot 
Even like page caches and stuff are freed on handover
respectable, that is the right way to do it.
Thanks
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
limine can definitely work with less than 50mb
I dont bother doing it
Its probably cuz of kernel and background
your bmp is quite heavy
Yeah
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
seems to be a few hundred pages while running boron
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
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
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
you can, there is no reason why you couldn't
yeah
theres something really satisfying about glxgears
idk why its fun to stare for a minute at the gears
made nohup work, will be useful for launching stuff from /etc/rc eventually
9950X? Threadripper?
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
13900KS
well shit the ssh port bitrotted on the server side
oops!
gonna look into that tomorrow
space heater
that's what they said about the pentium 4!
(and they were right)
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 
That's probably the hottest take I've ever dropped in this server
if your CPU isnt pulling 500W are you even using your hardware
saying this from DDR4 at 12V, room smells like ozone
Only 12v? Real pros power DDR4 directly from AC
the AC is already going thru my left foot into the PSU
dead man switch like a train but for PC
Try using a jumper cable to connect the DDR4 to the rectified DC voltage from the PSU, it should be close to 300V
(indeed)
ill do it when I get more cable, all of it is being used right now in a life sized statue of josh from twenty one pilots playing vignette from their newest album Clacy
Ah ok, yeah I can see how that's more important yea
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
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
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
The only thing YouTube mixes are good for is background noise
And occasionally finding new songs
I did not expect you to be an alestorm fan
Well my Vega 64 draws up to 370 W and it definitely heats up my space
wait that's going to distort the signaling!
insert any modern high performance CPU/GPU company here is not beating the space heater allegations
The upside of Intel processors is that due to them crashing and eventually breaking, you can claim a lower average power consumption
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?
nah, it's fine if you run it with actual power limits instead of without any power limits
also undervolting helps a lot with temps
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
well ig it depends on how much you do, I have been fine with my current undervolt at max load and temps stay below 90c
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
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
you can change the power/current limits to emulate a non K SKU anyways lol
yeah ig
isn't that the extreme profile?
Thats fine I can rebase on top of master, feel free to break this
on KS SKUs it's the performance profile
oops it really really wants getsockopt to work and I have that stubbed
IP_OPTIONS in specific
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
π₯
if you want to send some patches (or a compiled build) I can test this out on some of my real hw
we'll test it properly once its merged into astral
can astral load drivers by iterating the acpi namespace now
dam
I tried my best π
arch_apic_* π
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
And literally all of init happening in x86-64/main
that's what obos does too
thats only called from x86-64 tho
Im sure it will be way better after its ported to a diff arch
(oops)
I mean thats just for simplicity ig
when astral m68k port?
it is very 64 bit specific that wont happen
Nah dont get me wrong its fine and it seems to work so
not so hot take, 32-bit sucks
yeah but the m68k doesn't suck
nothing is very "64-bit specific"
I have summoned the fadanoid by saying "m68k"
i didn't even try to be nonspecific with bits but it just worked
same (almost)
endianness is also a paper tiger
cant really have a hhdm on 32-bit systems
you can
just reject >~1.5g or so
it will cover most actually existing hardware
have two page tables
one has one half of the hhdm
the other has the other half
(not actually)
but what if I wanted to boot on a Pi 0 W
((don't do that, that's a bad idea))
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β’οΈ
I think I assume 64 bit in a few places but idk
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
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
Have fun with dtbs
cc @analog berry
What
.
Yeah lets not go there
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
coulda sworn you had a rant about DTBs somewher ein this server
it's actually a hot take now apparently
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
you can't
please stop saying stupid stuff
you're part of the problem
you can if you don't need to map all of the physical memory*
and dont mind wasting half of the virtual address space
please not you too
I'm not even planning on porting it to any other architecture anytime soon let alone a 32 bit one
you kind of do, most mmio is around 3.5-4gb on x86 for example, while most usable memory is lower down towards 0, so unless you don't map a lot of the lower half or you don't map a lot of mmio, you can't do anything
true, but if you dont need an hhdm you could just map physical memory anywhere
well yes
im not tryna be defensive or anything btw
i still dont like 32 bit architectures lol
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
it's a conspiracy
it sure does feel like one
I think we've all gotten bored of how easy 64-bit archs are
in terms of how much memory you get
i think you're a big part of the problem
what? no
fake news, 64-bit is a bigger number which means it's more difficult
doubly as difficult
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
the only reason my kernel remotely has 32-bit support is because the m68k
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
true
the m68k is dead and i do not care how good it was
at least for general computing
(and the only reason I did that was to procrastinate the developement of my vfs)
((maybe that was a bad idea))
(((anyway)))
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
Raspberry Pi 0 is neither a microcontroller, nor a "niche" computer
it may not be common sure, but I wouldn't say it's niche either
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
I run Linux on it and use it for Linux things
I don't run a GUI on it ofc, but I do use as a general purpose Debian box
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
agree to disagree
fat naps r good tho
The worse part may be actually using them in your OS, yknow, in a useful way. Parsing data structures is fun and all (or maybe not) but you still need to do something with it
Time to work on 128 bit kernel
3D printing boards are commonly 32 bit ARM
osdev is a niche by itself
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
YOU are probably bored
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
i think the "wave of people who want 32-bit kernels" is a wave of misdirected people from other osdev spaces
such as the osdev.org forums
maybe people like not always taking the easiest path?
and also "everyone" is a stretch
i mean sure but beginners in particular should not try to run before they can walk
ofc
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"
I do agree with you here, but I think there's also something to be said for it being discussed frequently which leads to it becoming a normal topic, and so beginners think its a normal thing to do.
nah not really
I was going to elaborate on what I meant by that, guess I forgot to
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
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.
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
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
i think dwl was memeing a bit
yeah
that is obviously how you raise the activity of your server
who fights back
people should be forcibly use 64-bit x86 and use only the limine bootloader
and BAN EVERYONE who has EVER written one, or has a port to any 32-bit arch in their kernel
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
nah all architectures supported by limine are allowed
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
no im dead serious
32 bit is killing the next generation
yeah
why do u think none of the gen z can find jobs
we're serious
they dont know 64 bit
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)
to where
#lounge-0
Currently making some uacpi patches to make astral init code nicer lmao
nice - how many kernels have you ported uacpi to now?
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)
when is the linux port happening
when u submit the patches for it ofc
lol
go for windows or go home
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
you can support 32bit easily on machines that have very little memory (so you can do a higher half physmap) and low mmio
i wonder if we'll ever actually need a full 64 bit address space
are there people spreading 32-bit propaganda?
I haven't even noticed a huge increase in 32-bit OSes
the only kernels I know of with a port to a 32-bit arch on this server are northport, keyronex, and my kernel
Big 32 is waging a war on osdev
also maestro, but that was done out of not knowing that 64-bit is a better decision
^
mint are talking about nonsense
mean
please be civil
What do you plan on doing
this stuff basically #1217009725711847465 message
glue init hooks
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
Ohhh yeah makes sense
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
@grand shadow whats the proper way to cleanly terminate a kernel thread remotely if i only have its handle
none currently 
why do you need to do that
and you'd need to avoid having locks held when the thread is deleted out of existance
^
i kind of dont, but htere's a deinit hook so if wanted to implement that properly id need to terimate the threads
yeah the proper way would probably be to wait for the thread to kill itself and signal that its now done
also i guess astral doesnt have anything like a workqueue so i have to make an adhoc list or something like that
what do you need this for
scheduling work from an interrupt handler
id just make your own list of entries, since you dont need any of the interaction that a real workqueue needs
well it kind of lines up with what workqueues do perfectly, does it not?
u submit some work and u wake the thread
but you have more than one workqueue threads with dynamic scaling etc
if they're all of mostly the same priority its the best way (so all low priority or also all super high priority)
yea
astral has dpcs doesnt it
I dont think dcps are supposed to be sleeping or acquiring locks or take a lot of time
you should be able to at least acquire spinlocks
what do you need to do that "takes a lot of time"?
Execute aml?
Thats not what I need
aaaAAAAAAA this took longer than I wanted
Thats insane
Gj
@grand shadow is there like a max column width u like
Or do u just not break lines ever
wdym?
E.g. I limit my lines at 80 chars
oh source code line limit
Yeah
when I remember to break them I do π usually if its tooooo big I add a line break
I see
yay my astral work queue works
@grand shadow any objections to these?
idk how they were still missing
go ahead
tbh idk too I was just too lazy lmao
cool np
Okay uhhh i think its kinda ready: https://github.com/Mathewnd/Astral/pull/8
i'll leave it to you to make a shutdown program, but acpi_poweroff and acpi_reboot helpers are already there
lol np
β οΈ
actually crying
that hashmap thing is criminal
it felt terrible copying that from the nvme driver
but i also couldnt think of anything better π
lmaooo
I'll open a pr for some mlibc stuff and then I'll take a look at it
power management stack coming soon?
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
incredible
implemented putgrent in mlibc so useradd doesn't die when it creates the group
assertos is no more
xhci would be very epic
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
i'll sleep better at night thanks to knowing that i did something better than the project i looked at for parts of my nvme driver 
except i already did something better than it which is using an MDL (list of physical pages) instead of issuing several consecutive read requests
@analog berry https://github.com/d-tatianin/Astral/blob/8936a774714745686d8c2e2232e07fe4f80f92ba/kernel-src/io/acpi/acpi.c#L57 when returning an errno I don't negate it
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
i think you took my frustration comments more literally than they were intended to be taken
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
Ohh
Will fix
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
I was memeing lol
you may have, but the other guy seemed genuinely mad
He's 15 so
for the record i am pretty sure they were banned before as well
for unrelated reasons
but no just to spell it clearly: not 100% of what i say, especially when i am frustrated, is meant literally. did anyone get banned for making 32-bit OSes? no, obviously not
if i ever did that, lukflug is unironically going to show up at my front door and beat me up
no you can't
even with 1 MB of ram
MMIO ever since PCI has been a thing has always been near 3.5/4GB
why not
while free memory has always, almost by rule, been lower down, towards 0
that already stretches almost the entire address space
@analog berry also are uacpi events supposed to wake up only one thread?
yeah of course, sure on legacy ISA only systems it's doable
One work type wakes up one thread
on 386SX-class machines, everything definitely below 16 MiB
exactly
i specified PCI for a reason
ah
cuz there is an event thing already
thats why I was asking about the semaphores being used
this is the astral thread
cant really have a hhdm on 32-bit systems
-czapek
you can
-fadanoid
you can't
-mint
just fyi
Ah maybe I missed them
Are they better than my handrolled thing
i am replying to things people raised in here
they wake up all threads and have a built in timeout
tho I think it depends on being able to target a specific cpu
I guess I don't really need that
you can't*
*on any 32-bit system that has MMIO significantly high up in memory like literally every PCI capable system
there
then semaphores should work just fine
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
well yes, but you said it yourself that it wouldn't be a direct map
ye
but that's as long as you don't have too much memory, as well
I think the current thing should work yeah, because it needs very simple logic with one producer one consumer
Or rather many producers potentially but one consumer
and also, is semaphore_reset expected to be called with any threads waiting on it?
Good question, probably not but at the same time we should probably guard against that?
What would be the response in that case
either assertosβ’οΈ or wake up all waiting threads with a special reason or something
probably assertos
atm
Could we just do nothing and just consider this a spurious wake-up if there's a race?
Or does that break something
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)
Probably
is there any way this can happen or is it just a maybe
AML is allowed to do anything lol
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
ah fuck it then I'll just assert
U think so?
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
Lol
Ill add it to my pr then
@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
Yeah I do
Its the protocol they use
god bless
I think netlink yeah
that'd be the linux-specific way anyway
but i think i remember something something signals
well, shutdown i mean
not exactly power button
I mean usually the response is to bring up a logout gui
So idk why u would need something as hard as a signal for that
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
Lol
Astral can just make a file or something
Same way keyboard events work for example
yeah probably
i mean what i described is basically linux's /dev/input :^)
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
Ill take a look how Linux does it once I get back home
some cursory poking in sysfs reveals that the acpi power button is just also in /dev/input/?
Oh yeah there u go
/dev/acpi it is then
dear lord
actually that makes sense
u can just broadcast all acpi events there
nice
There's also lid besides the power button
qookie@selenium ~ Ξ» cat /sys/devices/platform/PNP0C0C\:00/firmware_node/input/input0/event0/dev
13:64
qookie@selenium ~ Ξ» ls -lh /dev/input/
total 0
...
crw-rw---- 1 root input 13, 64 Sep 1 14:43 event0
...
/dev/keyboardX node only for acpi events 
based
I'll take a small break and then build astral with the uacpi pr
Ill update whatever we discussed in a bit
Tbh though, you should be remapping your mmio elsewhere
Yes but thats not what hhdm is about
I replied to the wrong msg
menat to respond to this
*meant
Poor Matthew lmao
gonna try to compile limine
but first I need mtools and I'm too lazy to add the recipes sooo
mtools built it seems
what
seems like it failed to validate your toolchain
does it need x86_64-elf?
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
OH
rip
seems like /dev/{null,zero,random,full} do accept seeks so time to change that
well that was disappointing
interesting
god bless it's trying to poke at libc internals
slow but no hacks moment?
no because the existence of __freadptr gets rid of the gnulib impl :^)
first line too like damn didn't even give me the satisfcation of making it go a tiny bit into the build
who even added __freadptr
it did configure :^)
me likely?
git blame time
could just make it return nullptr unconditionally
what does that function even do I wasn't able to find a man page
gives you a pointer into the internal FILE buffer
and the amount of data that's currently sitting there
I'll see if doing that makes it work
that's what the gnulib SLOW_BUT_NO_HACKS impl does
@grand shadow aight i think i fixed everything we have talked about
seems like so?
I'll take a peek in a sec
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
tf
lmaooo
I just wont build uefi-cd then 
lol
honestly not sure
that's just what all licenses say
wonder what more I really need to be able to slap a "self hosting" label on astral
nothing
well u cant compile gcc yet right
yeah true
i don't think you need to be able to build gcc to count as self hosting
how do u host yourself if u cant build the compiler
i mean going by that logic you can't really self host ever because you can't run jinx?
whats the problem with building gcc on astral?
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
wdym?
mlibc bug
it segfaults deep in mlibc phd code
jinx runs stuff in an arch linux (or debian?) container
jinx wants linux user ns
ah
mint did say she might add a containerless mode tho
well then I better go add fat fs support
unless I try limine's ext2
well but user ns is the main feature
even if you had linux user ns how do you expect to chroot into debian
true
if you don't support linux compat
should work [no guarantees made]
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) :^)
ah yes
just implement every linux syscall
easy
isnt there like some linux emulators or something
port qemu and use qemu-x86_64
true
does that even work like that?
doesn't that require a host linux tho?
^
i don't actually know if it just translates syscalls or emulates thm
because as far as I understand it just translates them
i think it translates them
but I haven't looked at the source so I can't say for sure
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
why?
it was just easier to make a disk like that
you can write a limine config on astral
holy shit
;)
limine inside of limine
true
inside of astral*
ik
port fdisk/parted so you can install from a live cd
but technically
then technically i develop limine inside of limine since i boot linux with limine
im curious
I wanted to port fdisk but thats util linux
so it probably needs some weird linux api
how long has this project been in development
not really
this rewrite like a year and a few months
youd be surprised
oh huh
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
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
honestly that could work
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
dear lord I only have like half of that
can you develop on your own OS? tools can be shipped from the outside but you need to be able to code, compile and run (either run the entire thing in qemu or reboot into new kernel). If yes, that's self-hosting
@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
well not really unless u wanna give real hw a test
are you going to start enumerating the acpi namespace for devices now that you have uACPI
it's really cool
thanks! i can change stuf myself if u want
soon I'll have to write an actual decent driver interface as to not fill the main function with 100 different init calls
once I do that I will certainly use it
but for now I might play around and add a /dev/acpi device
I'll just make oDriverInterface 
oOsdev
oh yeah that would be cool
if shutdown worked via gui
what would it do though
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
and probably I'd have you be able to write some character into it or something to tell the computer to shutdown
u dont want like a shutdown(2)?
if I do ever do that, it would support dynamically loaded elf files
that would be a better idea
nothing stops me from making sys_reboot in mlibc just open /dev/acpi on x86 or something
ig
reboot(2) seems very linuxy and I want to be able to just
echo "1" > /dev/acpi
or something
i think /dev/acpi is fine
keep in mind
u will need to expose e.g. battery devices
fan devices
etc
tons of stuff
to userspace
a directory would be better since acpi is a namespace
/sys
do you have any docs for uacpi
he has docs in header files
if u port a gui for showing battery indicators that would be cool
in forms of comments
headers are all documented + osdev wiki has tons of stuff
it has like driver interace examples and stuff
btw is uacpi_namespace_for_each_node_depth_first public api
now
of course
because months ago you said my thing used private api
like before you had public api
it used to be private probably
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
For modern real hw u will also want an EC driver
since thats how power button is routed there
or you can be lazy like me and say TODO: Implement EC driver
(7 months todo by now)
urinonically what I will do in init lmao
sync();
sync();
write(acpifd, WHATEVER_I_CHOOSE, 1);
why are two sync's needed?
lol
sync is not allowed to complete while any other sync is in progress
so thats why you usually double sync
its async?
on astral sync() is blocking
nice
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
tho I also need to implement kill(-1, signal) for it to make sense
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
i guess its just posix stupidity
i vividly remember that sync would just return immediately
while the 2nd one would block
probably shitBSD 0.01 didn't block and they decided to leave it at that
only one way to find out
u mean ShitOS3
isn't that dwl's os
its up for grabs
@stark walrus do you want shitos5 instead of secureos