#Astral
1 messages · Page 11 of 1
does it return like EINTR or something on error?
It returns the wakeup reason which can be SCHED_WAKEUP_REASON_INTERRUPTED or something like that
any reason why its an int and not an enum?
ah, ig I can add that (though idk what is actually the sensible thing to do there, should it just stop the whole audio stream?)
ig that would work
I completely forgot enums existed in c tbh it sounds like such a c++ thing
I just use a define
i see
i use enums extensively because its impossible to tell what that int might end up storing
Idk I see you loop there I think just clean up and leave?
Makes sense
if you do implement interruptible sleep uh send a new iso cuz its gonna take a little eternity to test all dsps
I'm still at dps1
I could also add the name thing so it would be a little easier to know which ones you want to test
eg. just printing them to the log for now
yeah true
would save some time
also @fleet osprey merged ty
Np, anytime
well actually ig I don't really need to do anything in there then? its just a write loop and close() waits for the data currently in the buffer to finish playing anyway
question
Ill try just returning EINTR and see how that goes
it depends on the app, possibly
rn I don't have that implemented tho
nor mmap for that matter
yeah that shouldn't take too long to implement
it doesn't look like I ever get SCHED_WAKEUP_REASON_INTERRUPTED tho
no matter how long I press ctrl c
also one thing which I forgot about was that sometimes its actually possible to route output to eg. mic inputs (this is from the controller that I have on my pc passed through to qemu)
and also it makes it far easier to see in debugger
@grand shadow here is a new iso with the names, I don't know how to make the intr stuff work
does it ever return from the sleep and if so what does it return
maybe it doesn't work with semaphores?
but I think waitpid uses a semaphore
I'll try it out
it does return after the sched_yield() and it always returns zero
maybe my signals are borked which is weird because it works everywhere else
lemme flash it to my usb and try it out
now I realized that a shorter file could have been a good idea lol
then it would return earlier
I mean ig you can find some random text file and cat that to there, though idk what they sound like
true
@carmine swallow I have a headphone connected to the back so I assume its one of the rear speakers?
Or rear line out?
could be line out yeah
also don't do it with text files, they don't seem to work very well
it just gets stuck with no sound at all
my phone ran out of battery shit damn
I'll try line out
I also have 2 hda controllers it seems like
could be for like gpu or whatever
lol
I actually jumped
what does it sound like
random noise
on one hand it does play sound
on the other I don't think this is what should come out of it
did you cat the wav into it
wrong format likely
would be quite cursed if it didnt support 48khz 16bit
wait is .wav just raw audio data???
pretty much, though there are some headers at the start that cause some audible clicks if you play them as the data
ah
yeah that's weird, can you do cat /proc/asound/card*/codec* > dump and send that?
I don't have linux on that card
not card
computer
.
I am tired
I noticed when you said it output sound to your mic 😅
ah
I think I should've output it into another dsp maybe?
idk
windows says my headphones are on a "speaker" and not on the "digital out"
but the again its windows
yeah ig its possible
also I should probably do something about the default volume
its on the green thing on the back
I think I should connect it to the one on the front
yeah, if I'm not mistaken:
- green - speaker / line out
- blue - line in
- pink - mic in
green should be good for heaphones, but iirc will be horrifyingly loud by default, unless set by software
yeah front headphone out still gives out the damn fucked up noise
I have no idea why that would be, unless its like playing some garbage that the allocated pages would initially have (assuming your page alloc doesn't zero them, I am not sure if it does)
the page alloc doesnt
and as for why that would happen no idea, it does have buffer underrun debug messages but they are only printed to e9
Does catting work on your laptop?
at least on the passed through desktop card it does, Ill test it on the laptop too
you can have it cat automatically on /etc/rc if the keyboard doesnt work
Btw how do you pass it through? Do u have a script for that?
yes I do, I bind all the devices that are in the same iommu group as the card to vfio and then use -device vfio-pci,host=00:1f.3
but the script isn't that portable because the devices/ids vary between systems
well originally it is but when you manually do ```bash
echo "0000:00:1f.3" > /sys/bus/pci/devices/0000:00:1f.3/driver/unbind
Oh I see
looks like it doesn't for some reason which is weird
Ill have to take a look at the widget dump for it again, maybe the first path (and the only one that I use in the astral driver) is some weird one
basically, it can do some post-processing and something related to voice recognition (ig it has some kind of more advanced processor)
though I think there are some limitations with the hda on that to eg. the sample rates it can support without uploading firmware to the card
So it is hda but with extensions?
yes
And they're fully backwards compatible?
at least as far as I have tested yes, though like I said afaik it needs firmware upload for some sample rates and formats to work
did it have the same issue as me?
I just didn't get any sound at all out of any of the dsp nodes which is weird considering that I have def got sound both from its internal speakers and headphone jack when playing sound to all possible paths
so yeah ig there are multiple issues to fix with it now
oh yeah I still need to try the new ISO on my Optiplex
I forgot about that
yeah I think mint was right the first time about it being an issue with it being an ISO
even with the latest limine (8.0.9), the ISO that's generated, directly flashed to a USB stick, does not boot on BIOS
welp, time to hack in a make img to generate a bootable USB/HDD image
progress has been made but my build env is kinda screwed somehow (git weirdness?), so doing a clean rebuild
gonna head out for a bit and hope it's done soon™️, then go try out the image
most of the image gen borrowed from the limine-c-template makefile, adjusted to be in a script, similar to your gendisk.sh, and called via the makefile
or ofc can be called directly
it works
ok that's actually kinda a lie
I've made the plumbing to
- make it gen the image
- be able to run the image, irrespective of the ISO
now I just need to fix it (doesn't seem to copy files "correctly", limine can't load the initrd
but that's a problem for future me (i.e. in 1 hour, after I take a shower)
but this is still huge
nvm, just realized my mistake and fixed it in 5s
real hardware test coming after I'm back though, USBs are slow
awesome!
hmmm, the optiplex does not like this USB for some reason
it at least.... tries to do something with it now, but it just ends up resetting back to the BIOS
I'm not entirely sure if this is a case of
- it's just too old (doubt, it's a Core 2 Duo)
- old USB stick crapping itself
- Limine bug
- something else?
I've booted Limine on this PC before, but not recently
going all the way back to Limine 5.x in fact
but at least I know it can't be an image problem, since it boots fine in QEMU
I can probably rule the USB stick out too just by swapping the image file in QEMU to the bdev of my USB stick, hang on
hmmm, it actually doesn't work there, interesting
rufus probably botched it then, I'm just gonna directly dd it from my laptop
🎉
Rip no PS2
ACPI works tho
@grand shadow so this is another machine that gives that error, despite the fact that I know it has PS2 emulation
it may not be good PS2 emulation, but it does exist and is enabled
also note that after the kernel started (and only after the kernel started, worked fine in the BIOS and Limine), the USB keyboard actually turned off
since I have fancy RGB on it, I can actually see that it's just off now, lol
also I'll chuck the bootable USB/HDD image creation code I slapped together to get this thing booting at all, in a PR, should be useful
#1061407633745125397 message
also, just tried these to no avail on the optiplex (verrified they work in QEMU)
one sec, will try on the thinkpad
Here's what it does repeatedly mashing (more than 4) keys
welp, that's enough debugging and programming for me for today, gonna call it
so what is the report wrt Limine working or not on some hardware (with up to date version)
- does not work if Rufus is used to flash an ISO to USB
- does not work if an ISO is dd'd to the USB, v7 or v8.
- does not work but differently, if Rufus is used to flash an HDD image to USB
- partially works if a v7 ISO is booted with Ventoy - breaks Limine loading the initrd?
- maybe works if a v8 ISO is booted with Ventoy (untested)
- maybe works with v7 if an HDD image is dd'd to USB (untested)
- does work with the latest version if an HDD version is dd'd
all are for BIOS
UEFI mostly just works no matter what
is that specific to that one machine or like, in general?
in general on all of my real hw I've tested
not sure if any of those would still apply in a VM
would be interesting to test, but not today
I wish i still had that Dell Latitude 5491, it was the one machine I was able to get to boot to actually boot the ISO dd'd to USB over BIOS
haven't had luck with any other machine, and I sold that one a bit ago
it would be interesting to know as well if you are generating the iso/hdd file using the C template's recipe or some other potentially broken system
I also haven't put the C template's ISO through the same tests
that would also be another good thing to try tomorrow
yeah
like those things you listed are a surprising amount of failures for what it should be
certainly the BIOS port of Limine has been somewhat neglected recently, but i doubt it was neglected to the point that it is half broken consistently on most systems
that would be pretty bad
unless it's an issue withh isohybrid and xorriso commands
nah it's not
the issue is primarily with the ISO
I've had nonstop issues with that
the HDD image seems mostly fine
the only HDD image failure I encountered is Rufus, and I bet is trying to inject it's own MBR there, and it's just exploding
given that it even fails on QEMU
rufus in non-dd mode is always annoying
not just rufus, but pretty much all these "boot image burners" or whatever that actually try to inject their own changes into the mix
instead of just copying the stream of bytes as-is
lovely
well yeah, I'm positive that Rufus is the issue, the exact cause of why it's the issue is unknown to me, and I don't have the energy to go investigate it
I just know that it works perfectly in every test case I've thrown at it so far if I just dd the HDD image across, and dies dramatically (it might actually be triple faulting, it fully halts QEMU) if I use Rufus
yeah alright
i'll be waiting for tomorrow to run the tests off of the vanilla C template, and in the meantime i'll go double check what xorriso commands grub2-mkrescue uses, because isohybrids are so damn annoying to deal with - or more in general, ISO is really annoying to deal with
fair
I've had nothing but issues with USB booting ISOs on BIOS, it seems to just suck in general, regardless of what is actually booting (Limine, GRUB, ISOLinux, hell even Windows Boot Manager has crapped out on me before)
it's really fragile
it is tempting to just say "screw it" and not support ISO altogether anymore
really reminds me of the Puppy Linux guy's post bashing the ISO format (for good reasons)
no one burns optical media anymore
although to be fair to modern devices, UEFI has pretty much "just worked" in every case, ISO or HDD
this seems to be all specific to booting ISOs, from non-optical media, specifically on legacy BIOS
i mean yeah UEFI is much less finnicky
that said ISO failed to work on the snapdragon laptop a friend of mine tried this stuff on
while HDD image worked fine
interesting
most stuff is just EDK2, which should support it no problem
the manufacturer must've either been using a REALLY old version, or somehow, intentionally or not, broken whatever code is responsible for loading in that manner
would love to know how that happened, but we'll probably never know
yeah, i am not sure about the details because i do not have such laptop myself
i should probably get one to be able to test an arm port of a future project of mine
but eh, it's expensive
a lot of old (and even some new) phones (unofficially) can run UEFI as well
you can go pick up a Google Pixel 3a or the like for cheap, and have a tiny ARM device with a built in screen and storage that can run EDK2
anyways, I really need to actually go to sleep now lol, I've put it off for long enough, and if I sit here for too much longer I'll wake up in my chair in 8 hours :P
the fuck
so it gets some interrupts but not all?
hello im the keyboard and i have a very important message
E
wonder what I will do today
@carmine swallow @robust geyser @analog berry anything yall need implemented/ported?
other than real hardware ps2 I cant even begin to debug that
well the oneshot event would be nice, though I think it could just be a variant of the signal method on a semaphore?
basically it would only increment the count if the count is zero to begin with so then multiple calls to it don't increment the count more
would my event.h stuff suffice?
its interruptible and actually returns EINTR (as its based on my poll stuff)
though it wakes up all threads waiting on the event
instead of the semaphore 1
even has a timeout if you need that
ah there is event already
I didn't see that, it probably would assuming it basically does what I said (so triggering it multiple times would only allow either the currently waiting threads to wake up or if there are no waiting threads then the next thread that tries to wait for it)
oh it doesnt do the next thread part
hm
I suppose I could add a semaphore_signal type of thing that can have a limit passed to it?
yeah that would probably work, the reason why it would be good for it to allow the next thread to proceed is that its triggered within the hda irq handler if the ringbuffer space is getting low so then even if there are no threads immediately waiting for it the next thread can proceed to write to there (though now that I think about it it should do that anyway because there is a check for how much space there is within the buffer)
so idk if its really needed
also btw the code that I have so far is in https://github.com/Qwinci/Astral if you are interested
yeah seems like it wouldn't be needed as you already check for the available space anyways
though you'd probably have to make sure the semaphore is only signaled if the buffer changed from enough to not enough?
idk how it works but you might get what I mean
Hmm no idea
I guess a port of wine would be nice
seems like you do
size_t avail;
while (true) {
bool irqstate = spinlock_acquireirqclear(&strm->bufferlock);
avail = RINGBUFFER_DATACOUNT(&strm->buffer);
spinlock_releaseirqrestore(&strm->bufferlock, irqstate);
if (avail <= path->oss.fragmentsize) {
break;
}
else {
int err = semaphore_wait(&strm->buffersem, true);
if (err == SCHED_WAKEUP_REASON_INTERRUPTED) {
return EINTR;
}
}
}
in hdaqueue
if two threads are running here at the same time it looks like they can both leave the loop even though there wouldn't be space for both of them
I'll look into that
add --with-insults to the ./configure of sudo build to get insulted when getting the password wrong
Nice
Iirc its easy for 64 bit, for 32 u need ldt syscalls
yeah for 64-bit you basically only need the syscall to set gsbase (and then signals and whatever else)
hopefully it runs better on astral than on managarm
Thats useful to have anyway
ah yeah it needs ucontext
I mean it will by default because no ipc
common microkernel L
Even ls on astral feels an order of magnitude faster
also another fun thing would be openjdk
Oh yeah
Thats probably quite a bit harder than wine
Can I finally play Minecraft on astral
in terms of stuff it uses idk, at least it works on managarm
and for the server it would need the proper tcp server stuff that I didn't figure out
wouldnt for the minecraft launcher you need a web browser anyways
you can launch minecraft without the launcher
astral has serverside tcp 
nice
(tcp tx is not really optimised tho)
how does one even do that
java -jar
yeah but what arguments
yeah that and then a lot of arguments
java -jar <jar file> -Xmx2G -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M
they are listed in the version json (if you want auth stuff)
Even just single player would be huge
I have zero willpower to touch the signal code but also openjdk and wine need siginfo and ucontext and it'd be very funny.....
Do it
tbh openjdk's template interpreter might work without ucontext, I am not completely sure tho (and even if it does work its a lot slower afaik)
because its an interpreter like the name says
qemu needs pthread
I have thread stuff since xorg needed it anyways
ah
unless theres some more things it needs from the kernel?
it needs some signal stuff (sigsuspend, sigaltstack)
qemu uses sigaltstack and siglongjmp to spawn a coroutine on a separate stack
I see
it sigsetjmps in the signal handler that's on an alternative stack, then returns, then siglongjmps back into it from outside the handler
seems like qemu only uses sig info in userspace emulation so I should be fine just implementing sigsuspend and trying qemu?
sigsuspend -> qemu -> siginfo + ucontext -> wine -> openjdk
yeah that should work i think
sigsuspend is a stupid easy system call anyways
its an atomic sigprocmask with a pause without timeout
iirc ucontext+siginfo was properly implemented in managarm after we had qemu portd
oh you'll also need sigwait
or signalfd
yeah ucontext was just passed as null before I did the wine stuff iirc
for mlibc you'll need sigtimedwait since sigwait is implemented using sigwaitinfo and that's implemented using sigtimedwait
don't think so
it's just using signalfd or it's own emulation to tie signals into the event loop ig
yes because we don't have thread groups
so each thread has it's own pid
signalfd/epoll interaction frightens me
they say when you read a signalfd, it always reads the current thread's signals
nope
It never actually gets any real keys it seems
I kept mashing for like, 5m after that
and nothing showed up
those (2x press and release, of the same key, if I remember my scancodes correctly?) appeared within the first few seonds of boot
when I had barely pressed any
then nothing at all after
conclusion: ps2 is haunted
guess I'll just make enough NIC drivers so that you'll only use astral through ssh on real hardware 
lol
I may try to help unfuck PS2
@analog berry did you have any luck w/ your attempt?
Nah I was working on uACPI so go ahead if you have the time
alright
alright so here's my plan to try to get the best of both worlds
PS2 Init Process
- try to test if it works by default
- yes? finish setup and hope it works (similar to my driver that works)
- no? go through the rest of the init process that normally goes on in the current driver
Why, just remove the old one, its bad
because it works fine for Mathewnd's machines
would rather not break that
because I have no idea if my old setup of "just pray it's good by default", that seems to be the only thing that works on my machines (maybe it's a Dell thing?), will work on his
Literally everything works on his machines tbh
Not hda 
Well it works 1/2
And yeah because theyre the only places I have to test so ofc theyll work 😭
The other old amd64 machine I have is broken
I didn't yet figure out the hda issue with my laptop either, it should work ™️ and I also tried to test astral on my desktop but it hang in the hda code when enumerating codecs which isn't good
Damn
I think this perfectly describes how awful this will be
I never tested the hda code on my laptop I should do it rn
yeah it would be nice, though based on all the current issues I kinda doubt that it will work
Out the headphones its the same weird noise
likely its the same issue then
wish i could try hda 😔
the bad thing is that I have no idea what can these be caused by, except for the issue that I have on my desktop I suspect that the irqs are not triggering at all so then it gets stuck waiting for some command
I mean I already found one bug related to selecting the connection between widgets but that didn't really affect anything (and idk how common that code path even is, it might be pretty rare)
and all that it could cause is that there would not be any sound at all
Through the headphones its a loud noise that sounds like something made to kill your ears but thru the main speaker it sounds just like static
my hacky PS2 init method works fine on QEMU :D
gonna try it out on my Optiplex and see if it's gonna like me now
oh also made a minor fix the Makefile, you may want to add -f to the rm command in the initrd target in the Makefile. It blows up if a previous build was interrupted for me
do you have linux on that machine? or is it windows too
though I kinda doubt that I could get anything out of the widgets anyway tbh
Both are windows
Id have linux in my laptop but my mom uses it from time to time so cant
though
I do think theres a linux install in one of the ssds in my main machine
actually lemme see this I might've forgotten that I had linux installed at all
I think windows killed it lol
I could boot up a live cd or something if itd be helpful @carmine swallow
Wait bruh this is fucking cursed lol
Windows boot manager is in the hdd but the install in the ssd
alright, testing now
I swear if this works... man PS/2 is weird, lol
there might also be a windows tool, Ill test if it works first
Yeah no for some reason only the hdd windows boot manager works and everywehre else drops into a grub rescue shell
Alrovht
Aleight
Bleh
Alright
so I tried booting Astral on another one of my machines
and it appears as if as soon as Limine executes the kernel, it triplefaults
wtf
wtf.... so on my optiplex, either the self test, or whatever ps2kbd_init() does, is causing the BIOS to just completely give up on trying to do USB -> PS2 emulation
all ps2kbd init does is
isr_t *isr = interrupt_allocate(kbdisr, arch_apic_eoi, IPL_KEYBOARD);
__assert(isr);
arch_ioapic_setirq(KEYBOARDIRQ, isr->id & 0xff, _cpu()->id, false);
kb = keyboard_new();
__assert(kb);
printf("ps2kbd: irq enabled with vector %u\n", isr->id & 0xff);
¯_(ツ)_/¯
well, one of the things in my shitty codepath is causing it to just entirely give up, and drop all power to the USB port
// XXX this is a terrible idea that really shouldn't need to be done,
// but a lot of stuff, especially USB-based PS/2 emulation via the BIOS, craps out
// if you try to do the full init process! Try to selftest immediately.
// If it works, immediately finalize and get out of here.
// If it doesn't, actually try to set it up.
printf("ps2kbd: trying method 1\n");
ps2_write_command(PS2_CTLR_CMD_READCFG);
uint8_t control = ps2_read_data();
int workingflag = 0;
bool dualport = control & PS2_CONFIG_CLOCKP2;
ps2_write_command(PS2_CTLR_CMD_P1SELFTEST);
uint8_t result = ps2_read_data();
if (result == 0)
workingflag |= 1;
if (dualport) {
ps2_write_command(PS2_CTLR_CMD_P2SELFTEST);
result = ps2_read_data();
if (result == 0)
workingflag |= 2;
}
// looking good!
if (workingflag != 0) {
ps2kbd_init();
printf("ps2kbd: method 1 success\n");
goto out;
}
does it have real ps2
hm
tbf, my init is even less than this, it doesn't even test it, or read the config
so maybe just self testing nukes it?
so there is https://people.canonical.com/~hwang4/rtdump/ but this utility is absolute garbage from realtek™️ and it only works like one time in a boot and if you run it many times and close it while its "busy" it causes a bsod (and you should tick the all pci devices option if you do try it)
it created an empty .txt bruh
didnt give anything 💀
oop
running it again worked
ok so wtf am I looking for here
I don't really know, it doesn't even look like it dumped the connections at all which isn't very useful
if you'd know the connection that's used on a working system and all the widget parameters from that path then they could be compared to the ones that they are configured to in astral
(though not with the image that I sent to you as it doesn't dump them)
actually no it did, it just didn't print the ones that the driver uses but the default configs
the lines with Wid=XX Codec=XXXXXXXX
if it helps (I think this is my headphone one, it says jack is plugged)
********** Wid=[0x19] **********
<VREF Hi-Z> <Input Disable><Output Enabled><H-Phn Enabled><Jack is plugged>
Output MUX select to index 0x00 <WID=0x0C>
Amplifier Gain :
Output Amplifier Gain :
<Gain Number of step=0, 0dB Offset=0, Step Size=0.00 dB,From 0.00dB to 0.00dB>
=> Index 00 <WID=0x0C> Mute L:0 R:0 , Gain L:0.00dB(0x00) R:0.00dB(0x00)
Input Amplifier Gain :
<Gain Number of step=3, 0dB Offset=0, Step Size=10.00 dB, From 0.00dB to 30.00dB>
=> Gain L:0.00dB(0x00) R:0.00dB(0x00)
Power State : [PS-Act : D0], [PS-Set : D0]
Wid=19 Codec=02A19050 Drv=02A19C50 Loc=00030200
********** Wid=[0x22] **********
Amplifier Gain :
Input Amplifier Gain :
<Gain Number of step=0, 0dB Offset=0, Step Size=0.00 dB,From 0.00dB to 0.00dB>
=> Index 00 <WID=0x18> Mute L:1 R:1 , Gain L:0.00dB(0x00) R:0.00dB(0x00)
=> Index 01 <WID=0x19> Mute L:1 R:1 , Gain L:0.00dB(0x00) R:0.00dB(0x00)
idk
I'm gonna try just infinite looping after each thing that PS2 init does 
I see no better way to see where it breaks
print "doing thing"
do thing
sleep idk 5 seconds
repeat for next thing
that's.... actually a much more sensible plan than this, wow
there's a reason I don't design things :P
I found at least one bug, I were subtracting the channel count two times when setting the converter format so there was a mismatch between the converter and the stream format (idk how much would that affect the audio tho)
(also again be careful because of the volume if you test this, I should really do something about that eg. by dividing it by two or smth)
btw @grand shadow i just remembered i added a debug allocator into mlibc
a while ago
if you want to try debugging the gcc issue
it uses mmap for each allocation, adds guard pages, places the allocation at the end of the mapped range so an overflow segfaults, and it never frees any addresses (it remaps as PROT_NONE so no actual memory should be used) so use-after-free should just immediately crash
you can enable it with -Ddebug_allocator=true when configuring mlibc
ill try using that and building gcc
../../../base_dir/sources/mlibc/options/glibc/generic/malloc.cpp: In function ‘size_t malloc_usable_size(void*)’:
../../../base_dir/sources/mlibc/options/glibc/generic/malloc.cpp:5:31: error: ‘struct MemoryAllocator’ has no member named ‘get_size’
5 | return getAllocator().get_size(p);
| ^~~~~~~~```
hmm
size_t MemoryAllocator::get_size(void *ptr) {
if constexpr (logAllocations)
mlibc::infoLogger() << "MemoryAllocator::get_size(" << ptr << ")" << frg::endlog;
uintptr_t page_addr = reinterpret_cast<uintptr_t>(ptr) & ~size_t{pageSize - 1};
AllocatorMeta *meta = reinterpret_cast<AllocatorMeta *>(page_addr - pageSize);
if (meta->magic != allocatorMagic)
mlibc::panicLogger() << "Invalid allocator metadata magic in MemoryAllocator::get_size" << frg::endlog;
return meta->allocatedSize;
}
does that matter?
well with it off an use-after-free doesn't crash
I'll try it
ok ill run with the option enabled
I tried that and grep was bugged for some reason
wtf are you in my head
yeah but mkfs.ext2 is slow as balls
i was about to say exactly this
hmm strange
well on managarm grep is a bit bugged even without it so
lmao what the fuck
still happens on my laptop
so I assume on the desktop it'll be fucked too
are PROT_NONE anon mappings still backed by pages?
I'll run it again and show the output
shit I think they are
I mean it makes sense
also it's not just remap, it's mmap that replaces the existing mapping with a new one
youre not unmapping just changing the prot
that one destroys the old pages it just does an atomic unmap() map()
if constexpr (neverReleaseVa) {
void *unused;
if (int e = mlibc::sys_vm_map(meta, meta->pagesSize + pageSize * 2, PROT_NONE, MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, -1, 0, &unused))
mlibc::panicLogger() << "sys_vm_map failed in MemoryAllocator::deallocate (errno " << e << ")" << frg::endlog;
} else {
if (int e = mlibc::sys_vm_unmap(meta, meta->pagesSize + pageSize * 2))
mlibc::panicLogger() << "sys_vm_unmap failed in MemoryAllocator::deallocate (errno " << e << ")" << frg::endlog;
}
i'd expect that the initial PROT_NONE mapping doesn't cause any pages to get allocated
until you mprotect as accessible and access them
I believe grep works fine on managarm? It triggered a memory leak a few years ago but we fixed that
i had it hang or crash once yesterday or so? when trying to use -i iirc
it doesnt yeah
so that should work then hmm
If you can repro, you should open an issue against bootstrap (or mlibc / Managarm if it can be traced to either of them)
i haven't investigated yet since i ran into it when investigating the egl issue
@carmine swallow
i was doing something | grep -i egl or so
Interesting
i think readelf -aW /usr/lib/something? but i don't remember
If I don’t forget I might try it tomorrow (just a simple grep -i on some meme in usr/include)
if you run it with system call logging it'll show the number of pages free
💀
plus, the vmm would be screaming and sending sigbuses everywhere lol
is anything wrong there
well I don't really know, it just shows the path and looking at that its a dac connected directly to the output
these kinds of things are hard to debug
why does typing in bash make free page count go down by 2 LMAO @grand shadow
syscall: pid 35 tid 36: mmap: hint 0000000002591000 length 8192 prot 3 flags 50 fd -1 offset 0 (468 cached pages, 1007775 free pages)
syscall return: pid 35 tid 36: 39391232 0 (468 cached pages, 1007775 free pages)
syscall: pid 35 tid 36: mmap: hint 0000000000000000 length 12288 prot 0 flags 34 fd -1 offset 0 (468 cached pages, 1007773 free pages)
syscall return: pid 35 tid 36: 39403520 0 (468 cached pages, 1007773 free pages)
syscall: pid 35 tid 36: mmap: hint 0000000002594000 length 8192 prot 3 flags 50 fd -1 offset 0 (468 cached pages, 1007773 free pages)
syscall return: pid 35 tid 36: 39403520 0 (468 cached pages, 1007773 free pages)
syscall: pid 35 tid 36: write: fd 2 buffer 00000000011C3FF8 size 4 (468 cached pages, 1007771 free pages)
syscall return: pid 35 tid 36: 4 0 (468 cached pages, 1007771 free pages)
syscall: pid 35 tid 36: mmap: hint 0000000000000000 length 12288 prot 0 flags 34 fd -1 offset 0 (468 cached pages, 1007771 free pages)
syscall return: pid 35 tid 36: 39415808 0 (468 cached pages, 1007771 free pages)
syscall: pid 35 tid 36: mmap: hint 0000000002597000 length 8192 prot 3 flags 50 fd -1 offset 0 (468 cached pages, 1007771 free pages)
syscall return: pid 35 tid 36: 39415808 0 (468 cached pages, 1007771 free pages)
syscall: pid 35 tid 36: ppoll: fds 0000000002598FF0 nfds 1 timeout 0000000000000000 sigmask 0000000010306020 (468 cached pages, 1007769 free pages)
syscall return: pid 35 tid 36: 1 0 (468 cached pages, 1007769 free pages)
syscall: pid 35 tid 36: mmap: hint 0000000002597000 length 12288 prot 0 flags 50 fd -1 offset 0 (468 cached pages, 1007769 free pages)
syscall return: pid 35 tid 36: 39415808 0 (468 cached pages, 1007771 free pages)
syscall: pid 35 tid 36: read: fd 0 buffer 00007FFFFFFFEBEF size 1 (468 cached pages, 1007771 free pages)
syscall return: pid 35 tid 36: 1 0 (468 cached pages, 1007771 free pages)
syscall: pid 35 tid 36: mmap: hint 0000000000000000 length 12288 prot 0 flags 34 fd -1 offset 0 (468 cached pages, 1007771 free pages)
syscall return: pid 35 tid 36: 39428096 0 (468 cached pages, 1007771 free pages)
syscall: pid 35 tid 36: mmap: hint 000000000259A000 length 8192 prot 3 flags 50 fd -1 offset 0 (468 cached pages, 1007771 free pages)
syscall return: pid 35 tid 36: 39428096 0 (468 cached pages, 1007771 free pages)
syscall: pid 35 tid 36: mmap: hint 0000000000000000 length 12288 prot 0 flags 34 fd -1 offset 0 (468 cached pages, 1007769 free pages)
syscall return: pid 35 tid 36: 39440384 0 (468 cached pages, 1007769 free pages)
syscall: pid 35 tid 36: mmap: hint 000000000259D000 length 8192 prot 3 flags 50 fd -1 offset 0 (468 cached pages, 1007769 free pages)
syscall return: pid 35 tid 36: 39440384 0 (468 cached pages, 1007769 free pages)
syscall: pid 35 tid 36: write: fd 2 buffer 00000000011C3FF8 size 4 (468 cached pages, 1007767 free pages)
syscall return: pid 35 tid 36: 4 0 (468 cached pages, 1007767 free pages)
syscall: pid 35 tid 36: mmap: hint 0000000000000000 length 12288 prot 0 flags 34 fd -1 offset 0 (468 cached pages, 1007767 free pages)
syscall return: pid 35 tid 36: 39452672 0 (468 cached pages, 1007767 free pages)
syscall: pid 35 tid 36: mmap: hint 00000000025A0000 length 8192 prot 3 flags 50 fd -1 offset 0 (468 cached pages, 1007767 free pages)
syscall return: pid 35 tid 36: 39452672 0 (468 cached pages, 1007767 free pages)
syscall: pid 35 tid 36: ppoll: fds 00000000025A1FF0 nfds 1 timeout 0000000000000000 sigmask 0000000010306020 (468 cached pages, 1007765 free pages)```
the minimum allocation is 2 pages
yeah but why would it allocate every time i type 😭
well its gonna take a while until it runs out of memory, theres still 998k pages remaining
but somehow, even with that much memory, sed says "memory exhausted"
maybe it just runs out of virtual memory?
there are 34359738368 pages in the lower half of the address space
well, thats a lot of virtual address space
idk why else would it give that error tho
I wouldnt think its running out of memory
since my vmm would start sending a sigbus to whoever tries to do page in
@fleet osprey did you get around to doing those tests?
well, i was sleeping
ah, timezone differences ig
3PM over here
i sleep regardless of the position of the sun anyways
btw @grand shadow you shouldn't have sched_sleep in the scheduler header if it doesn't really exist, lol
it threw me off, and got a linker error
oh god
I think thats there from before I realized a sched_sleep() the way I was gonna do would be a lost wakeup
use sched_sleepus
yeah I noticed and am adjusting my code
just wanted to make note of that
perfect, that works exactly like I need it to, time to try it
PS2 dies reading the config 
what.....
I wonder what happens if I just blindly assume it's a dual port
sending selftest also kills it.... ???
does sending any data to it at all just kill it?
I think it must
I wish I knew what DOS was doing to it behind the scenes
although actually I guess FreeDOS also works with it
I could go look at the source there
this is awful, nevermind
I give up trying to read all of that
@grand shadow so yeah that's the issue, it dies as soon as you send a single command to it
and that's why mine worked, because I didn't send anything to it, just blindly assume it's on IRQ1
yeah, dell memes ig
I guess the weird buffer issue isn't the only bug with it
I have no idea how many Dell machines that applies to, I only have 2 of them, an Optiplex 755 from 2007, and a Precision T1650 from 2012
if anyone else has a Dell desktop, I can chuck you an ISO or USB image that you can test, that way we can determine if it's actually worth fixing
if it's specific to old Dell desktops, it's probably not worth fixing tbh
but if it's an issue with any Dell desktop (or maybe even laptops?), then that may actually be worth looking into a workaround
i doubt tbh
just wait for me to figure this out ig
really? I don't see any other reason for it
why would it explode the second that you try to read the controller config
or do a self test
one possible reason is blindly assuming ps2 ports
u need acpi to get the actual port number
it could be different
oh? interesting
because the keyboard entirely turns off with just these 2 lines:
ps2_write_command(PS2_CTLR_CMD_READCFG);
uint8_t control = ps2_read_data();
turns off how?
as in, the entire USB keyboard just drops power
ah
well also like
linux and windows probably never even hit this codepath in firmware
because they force disable emulation
so its possible that its bugged
but it doesnt work on your laptop either right
it works fine with FreeDOS though
PS2 init works on my laptop
its also not 64 bits right
and my machine isn't supported by it
FreeDOS, or the optiplex?
anyway its possible that astral is doing something that makes the firmware expect a modern os
the Optiplex is a Core 2 Duo E8400, it's 64-bit
FreeDOS is a DOS, lol
it's 16-bit real mode
also
Elixir Cross Referencer - source file of Linux (version v6.10.8). Browsed file: /drivers/input/serio/i8042.c
yeah but it still sends a selftest
is that 32 bit only?
which is enough to knock the entire thing offline here
no
I haven't tried Linux w/o USB support to force PS/2 on here yet
entirely possible that not even Linux works on it 
Elixir Cross Referencer - source file of Linux (version v6.10.8). Browsed file: /drivers/input/serio/i8042-acpipnpio.h
here's the quirk table
my Optiplex isn't there
so yeah will try booting some Linux distro while blacklisting all USB
try to force PS/2
will report if it works, I doubt it
i wonder if ultra legacy ps/2 driver would work there
can u try booting this there
it actually dies with video stuff
what did it say?
Reading kernel from disk...
Preparing kernel environment...
Failed to set the video mode!
Press any key to reboot...
yeah the bootloader relies on finding some specific video mode or something idk, its a pretty crappy one
if u can thatd be great
k, one sec
lol wtf
I tried to unplug it and am in excrutiating pain
why is it so hot?
no idea
it was literally just driving a monitor
not even accelerated
was just idling at a terminal in Astral
lol
lol
well astral obviously doesnt do any thermal zone management
so it probably just kept working at that fan speed
yea
it's controlled by the firmware unless you do horrific hacks to talk to SMM
which astral does btw via aml
and it can even explicitly via control methods, but obv doesnt for now
acpi abstracts it away, u dont need to know the EC layout
u just execute a method of the FAN object
yeah you can read the RPM from ACPI iirc
but can't control it
it's i8k
Dell doesn't expose that feature
you just can't lol, trust me, I've tried
the only way is the SMM jank
ssdt that adds the control methods :^)
I don't know what it actually stands for
oh its dell smm interface
yes
that's the only fan control method for Dell machines
Desktop, Laptop, anything
bruh
it's the only way
a vendor without weird proprietary crap is a bad vendor
lol
he should really congratulate the guy on inventing such a beautiful new interface
the magic hex bytes in decimal are 13731 and 13475, and he says that the guy wanted the machine to boot in 13.475 seconds
so that just became an inside joke because it's stupidly precise goal
and now they use 13475 (and various variations of it in hex) whenever they're exposing something that they think is stupid
lol
anyways I've stalled for long enough, I bet the GPU has cooled down enough to pull it out now
btw 2007 is probably earliest AML uacpi has been tested with which is interesting
its from the more crazy days
does it have any errors or anything in the log?
in astral i mean
oh yeah probably
that's a ThinkPad T14 Gen 1 AMD
pretty recent
shocking it has issues
it's from at least 2020 iirc
your image just hangs
yeah this
black screen, everything locks up
yeah that's the T14
i wonder if its stuck in ps2 init 💀
well the kbd didn't turn off
meh its not really that big of an issue
any way u can do acpidump > dump.txt on it?
yeah
cool, I'm not an ACPI nerd, so I don't know what any of that means, lol
I recognize some of the table names from very early attempts at poking at it in my OS
and Hackintoshing as well, I had to poke at them
im mostly looking at the aml disassembly, u can see yourself
acpixtract -a dump.txt
iasl dsdt.dat
unfortunately no MSDM table
yeah just in case u were curious
whats dmar table
in acpi\
seems to have something to do with the iommu
or dma
the generated dsl file all just looks like gibberish to me, but I trust that it's actually useful somehow
never got far enough into my OS to really try doing ACPI stuff
would probably get more meaning out of it if I did
i think its a bug in uacpi
impossible
its harmless but yeah
Name (_S5, Package (0x04) // _S5_: S5 System State
{
0x07,
Zero,
Zero,
Zero
})```
how do I interpret this
(I'm doing fnuy things with ports)
what are the other 3 values for?
so this:
[040h 0064 4] PM1A Control Block Address : 00001804```
value two is SLP_TYPb if it exists
the rest are unused i think, they used to mean something
huh
interesting
yeah
ok
anyway there's a bug here that makes the iteration escape the scope in some case
ill debug tomorrow
it's a four byte write, right?
whatever the GAS structure says
Fadt also has a length field for it I think, which if u dont have gas basically is the access size
ok
Just scroll below
Anyway will have to get back to ps2 later
I dont see it in the quirks table so im assuming astral skill issue for now
Its basically the device tree of your pc, plus methods to interact with said devices or detect resources they're consuming and/or configure them
Btw if u can run Linux without USB drivers on it that would be nice
BITS 64
DEFAULT REL
extern iopl
global main
main:
mov rdi, 3
call iopl
mov dx, 0x1804
mov ax, (7<<10)|(1<<13)
out dx,ax
xor rax,rax
ret```
Ubuntu server doesn't seem to like me
great
let me try on Arch ig, hang on
hell, may need to just go compile a new kernel, I bet Arch's also has USB built in
yeah, Ubuntu's config just sucks 
CONFIG_USB_ARCH_HAS_HCD=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_HCD_PLATFORM=y
CONFIG_USB_OHCI_HCD=y
CONFIG_USB_OHCI_HCD_PCI=y
CONFIG_USB_OHCI_HCD_PLATFORM=y
CONFIG_USB_UHCI_HCD=y
CONFIG_USB_SL811_HCD_ISO=y
# CONFIG_USB_HCD_TEST_MODE is not set
CONFIG_USB_ISP1760_HCD=y
# CONFIG_USB_DUMMY_HCD is not set
damn even Arch does that
welp, time to go recompile Linux, so I can test if the Linux PS2 drivers works, so I can see if the issue is Dell's PS2 implementation, or Astral's driver being iffy
likely the latter
well Dell's implementation is known dogshit
I sent the description of the weird buffer issue before
iirc my dell computer duplicates chars on ps/2 emulation
mine is the opposite, lol
my desktop seems to do ps2 emulation perfectly, even emulates the mouse
guess I was lucky
or it just emulates it in a way astral's driver expects 
u could just replace all sort of display stuff with serial
instead of keyboard
use serial
instead of Xorg/bash
ssh over serial
atp write a nic driver and have ssh and all the other benefits of a working internet connection
oh lol, mine is not at all that
mine has the unfortunate issue of
- press key #1
- puts it in key buffer, and fires an IRQ
- OS pops char from buffer, buffer now empty
- press key #2
- puts it in buffer, does not fire an IRQ
- press key #3
- puts it in buffer, does fire an IRQ
- OS pops key #2 from buffer, buffer now has 1 dead char
- press key #4
- puts it in buffer, does not fire an IRQ
- press key #5
- puts it in buffer, does fire an IRQ
- OS pops key #3 from buffer, buffer now has 2 dead chars
and this repeats into in infinity
obvious solution is to just
have a thread polling the ps/2 statys thing
for data /j
it's bad enough that it breaks DOS
how does it even get past qa
works on linux™️
you think they have QA for legacy PS/2 emulation for USB keyboards on a 2007 Dell office PC?
lol
if they tested it at all (they probably didn't), they probably keysmashed and checked if anything at all appeared
gotta make sure it works for that one guy still running an ancient windows version
it's an OptiPlex
it's an office PC
it's meant to be used as a glorified typewritter
or to run excel
it's meant to have the drive imaged with the company's Windows XP install and then left to sit for 8 years until it's decomissioned
can't really confirm because no video, but the keyboard turned off
I bet it died
e1000
I also have another one that's also e1000 but different™️
iirc lspci shows different model, but still e1000 driver
Maybe it has some fucked up quirk
yeah the Precision has an 82579LM "Lewisville"
Optiplex has 82566DM-2
oh yeah I also have 3x R8169 devices
my laptop, primary desktop, and mini PC, are all Realtek 8169
What happened to video?
But you have more GPUs right
Yeah sure
why do i always get the weird issues mathew 😭
like does god hate me or smthin
no matter what language, C or rust i always get weird ah issues that take forever to deebug
its so annoying
also ps2 is weird
usually usb emulation is shitty
so if u dont get that shit working dont beat yourself up about it, not your fault rlly
The main point would be quirk tables for broken ps2 emulation
So that init is skipped in that case
yea honestly that would be cool
i think it would be really cool if u did somthin like that
but whatever works best for u, i think it'd help hobby oses a lot
usb is difficult
I would/could ship touchpad and multiplexed ps2 drivers
that would be cool also
Thanks, ill think about how I would design it
Well you most likely wouldn't be able to use it because rust 
nuh uh!
i can still write C
im not a total rust shill
im only writing in rust for nyaux cause build system lol
yet
The astral curse is ps2 never working
Id like to see the acpi dump of that ps2 emulation pc, whether it mentions ps2 devices in the dsdt
If it doesn't I can easily work around that in astral and skip init in that case
anyways
for today uh
I will implement sigtimedwait and port qemu
damn 90 syscalls already
wonder which web server would be easier to port
hmmmm
iirc it didn't even need any patches
pitust® lolttpd™
it performs like shit despite using epoll and whatnot
well dw you can provide kqueue instead
i support both
qemu time
hehehe
Tail wags Hello!
hey
new astral issue, btw
Dell Precision T1650, Xeon E3-1240 V2, only happens with UEFI boot
Possibly specific to Ventoy? Need to test it more
Oh, and my primary desktop in UEFI mode is also affected by this.
what iso is this I thought I had fixed this bug
and this is probably aml wanting to allocate a bigger memory size than the alloc() supports
yeah
I built it myself at most 2 days ago
I can pull and rebuild just in case if you want
ok I think I got it now:
say "m68k" to summon fadanoid
say "aml" to summon infy
yes
bruh
what commit are oyu at
a0a902e968ab8dcd6c6c8cc87f5c31fb27be7c12
hm
it looks like I'm missing your merge commit for my PR, and one other
something is overlapping in the same page when allocating space for the hhdm
if (e->type != LIMINE_MEMMAP_USABLE && e->type != LIMINE_MEMMAP_BOOTLOADER_RECLAIMABLE && e->type != LIMINE_MEMMAP_KERNEL_AND_MODULES && e->type != LIMINE_MEMMAP_FRAMEBUFFER)
its one of these
USABLE and RECLAIMABLE are guaranteed to be aligned iirc
just in case, rebuilding the ISO fully up to date with your gh
btw this probably counts as oberrow curse
its not a vmm corruption or anything its just real hardware being stupid 
so what am I printing here, the info from entry (e)? I haven't looked at the Astral vmm yet (and never actually got far enough to make one in my OS
) so I'm not necessarily an expert here
printf("base %p length %x type %d\n", e->base, e->length, e->type);
limine bug ig
limine is the one doing allocations
true, I wonder why it's not page aligned then, since the spec says it's garuanteed to be
@craggy tide any ideas?
welp I have to do a clean build
and once I'm done yall will have too
switching out mlibc's iconv and intl options to libiconv and libintl (from gettext)
eh, that's not that bad with DISTROTYPE=minimal
only takes ~15-20m on my machine, depending on outside system load
what limine version?
unless it was modified from my PR that bumped the version, (just checked, it wasn't) it's 8.0.9
it seems like it is carving the framebuffer entry out of bootloader reclaimable memory
but that is weird unless the firmware originally marked the framebuffer as usable memory
which was then allocated as bootloader reclaimable
it may very well be a Ventoy bug, since it does set the video mode
give me 2m here and I can test directly w/o ventoy
okay
yeah it totally doesn't do that when booting direct
only happens when booting from ventoy, specifically in UEFI mode on this machine
it may affect others, but none that I personally owen
you should specifically check if you're booting with ventoy and show a big fat warning that it's not supported
i mean unless its not a ventoy bug
yeah but the firmware is the one passing nonsensical memory maps
we havent seen it yet but yeah possible
like the only way this can happen really is if the framebuffer is marked as usable memory
which would be weird
i don't know
i am trying to think of another mechanism you could end up with that memory map
maybe u could add printf to limine to dump the memory map given to u
and we could run that
i mean yeah we can do tests
then we can at least submit a bug report
ah, that works
I was about to go write a tiny kernel that dumps the memory map to COM1
lol
if confirmed i would still like to work around the issue
the workaround would be to scan the bars manually and see if they fall into any usable entries?
I actually have code for this in my OS, I would just need to port it up to Limine v8, it's so old that it's still stuck on v5
if yall want I can spend a few minutes doing that and get the memory map
nono we need the original firmware map, not the limine map
oh 🤦
the limine map we already saw in astral
does Limine have some builtin way to dump that? I thought there used to be a console you could open or something, but don't see it in v8
yes
there is a function to dump the memory map
i am trying to figure out a good way to print the fb address, give me a sec
👍 will continue working on that compatibility spreasheet then
the what?
#lounge-0 message
expanded version of ^^^
im honestly astonished theres a difference
like these are tools to do the same thing
lol
one sec
it prints the memory map (as raw as possible) followed by the framebuffer address
bring back command line
I mean
limine shell
whatever
no
bring back the ntfs driver
i will if you maintain it, deal?
i will maintain it if its complete 
once*
true
i have 0 interest in doing it myself
Without ventoy
wheres the fb address?
that's not the full memmap
you have to press a key to continue
(it shows the rest)
nope
wait why did u do it like that lol
like what?
having to press the key to see the whole thing
ohh
i did not want it to scroll away too fast
its usually giant on real hw which is nice
holy shit
it's like, 20 screens, and the console doesn't fill the whole screen
hang on
now i see why 
Thankfully it fits 2 chunks at a time
each of those are 2 keypresses (1 screen) apart
that's one hell of a memory map
wtf
thats normal, u can compress it quite well

