#Nyaux
1 messages Β· Page 58 of 1
.
yea that
i canβt calculate it in my head rn, but you would need usable RAM spanning from the lowest to the highest physical address, in a single block. Thatβs just much wasted memory at best and not possible at worst?
are u talking about the hhdm
or what i was replying to
If you want to not-map any extra memory
if ur talking about the hhdm
i already have that in nyaux
and i prefer to keep it
didnt want you to remove it nor map it, a hhdm is good
ok so are u talking about the pfndb
ye
right
youβd have to search through every structure then
only takes 2mib
oh wait
no i dont?
true
π
yea yea sorry its too late
thats fair lol
yea thats fine, youβd only need the one freelist linkage pointer. if you have a common base you can just calc the offset for converting to physical address and index by pfn to get the freelist node
yea makes sense
no
thats wrong
say u have 244141 pages (thats a gb)
- 8
times 8
its gonna be 1953128
bytes
in mb thats
2mb
lol
because the pfndb is only gonna store a pointer
not the actual structure itself
it is basically an array of ptrs in this case
whats up
wait im stupid
funnies with pmm
yea its really too late for my mind
yea go to sleep lol
also marvin
its 3am for u
get ur ass to bed
what happened to i wake up everyday at 8am @supple robin π
you wanna bet?
mhm
nyaux < 1sec boot vs menix userland
Dufay userland obliterates yall
fake
tf is dufay
nah it's true
project by Ethan and I
what
.v
omg this repo is so insanely janky im ngl
sane
oh wow this is a cursed git tree lmao
its from test v file from vinix
π this tree is cooked im ngl
just random binaries hanging around
typical stuff
dont you have like a 30gb build directory
what happened
im sure @torn steppe would approve
too much work for me personally
what
i wonder why the linux kernel doesnt do that
oh ya
your gonna need a build system if u want some actual userland going
i just pray that whoever is building my thing has the right compilers installed and cmake .. && make
is this for the compiler targets
u will need a build system
this is for lit every user program
from bash to ncurses to nano
to the libc itself
they need to be compiled, patched, and packaged correctly and installed into a sysroot
dang i feel like just making a separate repo for that then
this is why build systems like jinx β’οΈ exist, because your not typing 1000 commands
yes thats a good idea
check how menix does it
i suppose i can do that and have scheduled nightly releases of binaries there and just pull those in π₯
what
u cannot just use binaries
you need to patch shit
therefore u need to compile from source
no no i mean i have a separate repo for userland stuff
and then i compile them with patches there
and i use ci/cd to release them as binaries
and then i wget those and build them into the main os repo
just one massive /usr/bin tarball 
thats not how it works
i could just tar all the userland programs tho
so instead of 100 individual wgets
i just wget the whole thing
sure wtv works for u man
alrighty well this will be fun i love cursed stuff with ci/cd
wasting microsofts time > using a sane solution
sure whatever jimbles your jimmys or wtv
now in the meantime
i have some more sleep to catch up on
um
yea thats portable
yea i can port this
nvm
aw darn
if u can find a repo thats decently okay to port ill port it later after im doing getting the new pmm code working
say mister rayan do you plan to cleanup ur git source tree
and also make other branches in the future
or will it stay this cursed quirky jank
i think this is quite cute
but also mildly inconvenient
it's cute with a colon three
crazy
variables bro, man, THE_REAL, guy, gotta be my favorites
ok but seriously tho i do not know why it commits clangd kernel/.cache
i genuinely gave up with readablity with nyaux a long time ago
shits like alien language only i can understand
and then i read the code a year later
and i do not understand it anymore
real
is THE_REAL something with memory bases
i do not know how to figure out what that is
my lsp gave up too
u might wanna do
cd kernel && make clean && bear -- make && cp compile_commands.json ../compile_commands.json && cd ..
are u unable to remember what THE_REAL is π
im pretty sure u left the compile commands file in the tree lol
ima find it
ik
x tree | grep compile_command.json
βββ compile_command.json
``` convenient
is there lore to the whimsical variable naming and coding style
like this cannot be easy to write
i would have such a hard time writing programs like this im ngl
for me its the easiest
wowza
because i can give no thought into variable names
talent
and just focus on the logic itself
i have trouble coming up with good names for shit
you have very very silly naming conventions
like sometimes i just giggle while reading the code
it's a joy to decipher
if its anyone we should thank, its def qwinci and monkuous
ive put those 2 thorugh my awful awful code
they have suffered
3-4
did it SuckMore before
rewrites
this is the most advanced kernel atm
awful
or did the quality remain consisten
oh deary
were you giving functions unreadble names
memory map function called orange_juice
oh deary me
now i still ignore SOME warnings with nyaux
like the unused shit
but mostly everything is fine with nyaux in terms of warnings
frigg
frigg π
There's one by ozkl the same person behind doomgeneric
anyways in order to make this work im gonna need to bubblesort this garbage
You could try that
what is it
quake2generic
That's from another person
Cake 2
oh i see
did you port doom for the meme or is this a game you actually intend to play when you boot the os on real hardware
looks reasonable
its three things
- a huge milestone for nyaux
- a meme
- something id actually wanna play
It's great for scheduler testing as well
dont you have gpu accel
how come
I gave a copy to a friend and he completed an entire game on it
how so?
it only creates 2 threads iirc
Just leave it running and see if it crashes after a while
real
honestly fair
And probably interact with it
also hows polaris
Keyboard ioctl
Nothing much really atm
Trying to figure out networking
holy shit thats based af
alsmot exactly 420 stars
yea networking is fucking pain
It's dwm
screenshot said dwm
yea fair
And also signals
Nope
will jinx and allat work just fine on macOS
Lmao
wtf
Nyaux has signals?
how tf does xorg even run
no
my cmake file was crashing out on macOS and i had to fix it for macos
Oh wait
You didn't port xorg yet
typical osdev
cooked
wait in polaris do you have like some kind of generic input abstraction interface in the kernel
None atm
cause im trying to think of how input would look in nyaux
I plan to
yes it does
okay so if im gonna need somethin like evdev one day
im just gonna do a funny and
just force ps2 this shit
until is time for evdev
evdev and drm and of course signals
i.e. create some keyboard device file that ps2 might create if ps2 is there
and have some kind of keyboard packet thing
π€·ββοΈ
astral has some keyboard packet thing
i think thats interesting
how long have u been working across nyaux counting all the rewrites and things
Yeah
3-4 years
Started in 2022?
is this like really far for 3-4 years or something
did u impl sockets tho
yea makes sense
Unix sockets, PTYs and Pipes are very similar
ptys sound like pain
dang wow u guys are like senior osdevers nice
Nope
o
implementing ptys is really just making write() calls to one terminal write into the input buffer of another
^
now we are just slightly more unaware β’οΈ
the rest is trivial if you already have regular terminals
whats with this slave master shit i keep hearing when i hear pty
master is the one controlling and slave is the one that uses the pty
what does it mean when ones "controlling"
master is the terminal that the terminal emulator uses
slave is the terminal that the applications use
The slave reads and writes like it's a normal tty
The master checks the reads and writes made by the slaves
my os is still in its infancy and i am wasting time writing tons of drivers for specifically the ThinkPad T400 since that is what i want to run it on
i only really spent the past 1-2 months actually working on it and have 2 filesystems and a half (ext2, fat12/16/32, iso9660), 3 disk drivers, scheduler, acpi (duh), and some generic virtual disk and filesystem interfaces
idk i feel like i am moving slowly π₯
right
Just think of it as 2 pipes
Yes
PTYs are simple to implement once you realise it's just 2 pipes
i think pipes arent that bad to implement either right
Nope
we got ipc before disk drivers
True /s
i cannot be fucked to do anything related to block io rn
Polaris needs a fs driver atm lmao
i got shit to work on
There's like NVMe
fair lmao
AHCI is super fun trust me bro it is not like every other "Advanced" Intel spec that is just tables that point to pointers to tables to lists to pointers
Yes
wait what lol interesting
aside from ext2, fat and iso9660 what other fs drivers should i make
id assume poloris uses tmpfs for its sysroot atm
i am almost done with my fs stuff
Yeah
makes sense
Runs off ramdisk atm
i thinks exFat is kinda worth? idk tho
not very unix of me to write another fat driver
i really gotta find a way to compress the initramfs because its always 400 fucking mbs
ext2 fat and iso9660 seems good enough for now
and get nyaux to decompress it
Polaris ramdisk is ~ 150mb
do u compile with -g
wait so do you literally pack this into the binary and load it at boot
Yeah
might be cooked then
That's userspace-base
no its a module
passed to limine
ohhh ya
which gives it off to the kernel
Shell, coreutils, the tty console and few programs
Xorg and all included it's like ~ 700mb
yea there might be something fucked with my recipes
and then that gets mapped into some part of memory and read and written i suppose
i mean limine maps that module for ya
neat
u just do ur shit with it
i'm looking at the nyaux ramdisk rn and uhh maybe you shouldn't compile gcc with -g
or at least strip it after building
honestly fair
30gb linux kernel compiled with -g and -O0 when
/usr/libexec/gcc alone is 150M
i have it in my jinx config atm where i compile everything with -g
i wonder how i can exclude it in a recipe somehow
mister rayan is program loading and patching and all that fancy userspace stuff fun
not rlly fun when ur depression
because i have been wasting time doing driver stuff
yea
W
nyaux doom on real hardware π₯
it works on real hw
π²
will do after making the pmm a bunch faster
which requires ps2 at LEAST
if you don't have any real drivers yet making it work on real hw is fairly easy
because the only "real hardware quirks" you have to deal with are those of the cpu, and those also show up with kvm
but no driver is less fun
the only thing u could really call a "driver" in nyaux is probs the fuckin fbdev shit
the only real difference between a kvm-based vm and bare metal for driverless os compat is that ram isn't zeroed on bare metal
i'm looking through all the drivers that the singular laptop i wanna get it to run on and i will slowly implement all of them π₯
and if you have your own bootloader you have to deal with firmware quirks ofc
Damn
damn
Biggest osdev issue
true
craazy
yes
drm pss easy
weston? done in 1 minute
pimples
lavendar face moisturizer is easy fix
The hardest challenge is finding a partner who loves you-
no rizz
oh god if dennis comes in here and just says that shit im cooked
Porting chromium nah that's easy
But finding a girl who likes you bro that's hard as fuck
real
most competent osdev rizz
LMAO
this is definitely absolutely not me trust
see the thing is i have had SEVEN straight women ask me out
trouble is
i dont swing that way
it is joever
isnt getting a boyfriend easier to be fair
shockingly not π you would think it would be
it ok tho
no partner = more time for osdev
nah for me im fucking dying in the dessert over here, ive had guys ask me out but i dont rlly swing like that
but women
holy shit
Nyaux hypervisor when
i cannot keep one
dying in the dessert
ts is not a purchasable item vro π₯
when managarm has a good impl of it @thorn bramble get to work
ill have that on the cards
Oh yeah actually
Managarm doesn't have a hypervisor yet?
nyaux running on bare metal running qemu/kvm running nyaux when
iretq is working on it
How would a hypervisor in a microkernel work even
soon real
it just does, cause iretq is big brain like that
Type 1??
the same way as in a monolithic kernel?
its the actual cpu extension so yea
I mean fair
but how would you do vmcalls?
Isn't that only restricted to ring 0
i do not know tbf
It would make sense in monolithic since your device is in ring 0
But in a microkernel wouldn't it be a userspace server?
the vmexit gets passed to userspace to deal with
vmcalls are just a special type of vmexit after all
Wait hold on how
the kernel collects info on the vmexit and notifies userspace of it?
Wait
Good night
gn
it's the same way cpu exception signals would work in a microkernel
I mean that I understand
the kernel collects info on the exception and notifies userspace of it, which uses that info to generate a signal
But the hypervisor can inform the running guest via an interrupt or something?
Tbf I've not looked into hypervisors alot other than hooking one
why would it need to notify the guest
No like see
A hypervisor could have multiple guests running and one of the guests make a vmcall so it has to inform that particular guest running?
for the most part vcpus can be treated just like any regular old user thread
i'm not sure what you mean by informing the particular guest
So wait how can the hypervisor pass the info to userspace?
Oh wait it can just inject an interrupt I guess
i would like to give everyone in this thread brain damage by making them see this masterpiece
β€οΈ CLICK HERE TO BECOME A CRANIACS MEMBER!! CLICK LINK
https://www.youtube.com/channel/UCJj91yPSruvqylY9WEsQCiw/join
TUNG TUNG TUNG SAHUR ATTACKS EDWARD FROM ARCADE CRANIACS AT 3AM!! (FULL MOVIE)
β€οΈHEY guys! Want to support the channel? Then please like this video and give it a thumbs up also if you are not subscribe then click that s...
i love tung tung tung tung tung tung tung tung sahur (i already have braindamage)
good
I have a super duper idea
print sixel image of tung tung tung tung tung tung tung tung sahur in .bashrc !!!
no
why π
I love italian brainrot
real
no work today as im too fuckin drained
bro needs a recharge
[ 0.000000][ TRACE ]: him address is 0xffff800000108000, him without virtual 0x108000
[ 0.000000][ TRACE ]: address returned 0x3fc75003
THOSE ARE VALID ADDRESSES
it pages faults with 0x8 as the cr2???

no idea what happened
happening when i return him->ptr?
wait
im stupid
LOL
still page faults 
STILL AT AT THAT LINE
i have no idea
[ 0.000000][ TRACE ]: him address is 0xffff800000107fd0, him without virtual 0x107fd0
[ 0.000000][ TRACE ]: address returned 0x7ec0000
[ 0.000000][ TRACE ]: him address is 0xffff800000107fe0, him without virtual 0x107fe0
[ 0.000000][ TRACE ]: address returned 0x7ed0000
[ 0.000000][ TRACE ]: him address is 0xffff800000107ff0, him without virtual 0x107ff0
[ 0.000000][ TRACE ]: address returned 0x7ee0000
[ 0.000000][ TRACE ]: him address is 0xffff800000108000, him without virtual 0x108000
[ 0.000000][ TRACE ]: address returned 0x3fc75003
why
this keeps happening
my code for initing the freelist
why am i modifying the memmap length
okay even fixing that
it still dies
fuck
same issue as before
and yes i add the hhdm offset in pmm alloc when returning
as my kernel expects
its the memset
im stupid
it still dies
fuck
okay looking at the log still the return value looks really really wrong
[ 0.000000][ TRACE ]: him address is 0xffff800000108000, him without virtual 0x108000
[ 0.000000][ TRACE ]: address returned without hhdm 0x3fc75003
no nvm its not
the memset isnt messing up the data
so its not the memset
bro is him
real
what allocator are you targeting
what
target deez
what allocator are you making*
freelist with a pfn database
why not buddy
i dont want to
simple
code is on github
still broke as shit
same issue
Any resources you're reading? I'm interested in doing something similar
@shut laurel and @brisk zenith explained it well enough for me to understand it
i suppose look at eariler messages in this thread
Hm alright
it's just a singly linked list
alloc -> remove the front
free -> add at front
you can also add a counter to significantly improve init-time performance
the concept is well explained in any major OS textbook essentially
the name PFN db comes from NT so you may want to read up on that
but there's also stuff on struct page for linux
since your here do u mind checking out pmm.c, as outlined eariler im experiencing a page fault for some odd reason with returning the address in pmm_alloc https://github.com/rayanmargham/NyauxKC/blob/master/kernel/src/mem/pmm.c
Sure I'll take a look
epic
Hm alright thank you!
Youβre increasing base but not decreasing length?
even changing that it still dies for the same reason all together
- When allocating the free list, you increase base without decreasing length, causing the free loop to free pages beyond the region.
- In the allocation loop in pmm_init, you unconditionally break out of the loop once you've allocated the pointer array, but this might happen before you've allocated the backing array.
- In the free loop, you set
ptrto(pnode*)entry->base + j- this is equivalent to(pnode*)(entry->base + j * sizeof(pnode)), which I don't think is intended. - Why do you sort the free list?
actually i do not know why i sort the freelist??
yes that solved it
thanks for the catch
Oh and when allocating pagedatabase you only allocate enough room for num_of_pages pointers, but this does not account for holes in the memory map
why is it that i always screw up one line
right
what should i do then
You need to allocate enough room for align_up(maximum_physical_address, PAGE_SIZE) / PAGE_SIZE pages
right so i need to change from using "num_of_pages" to getting the max phys addr and doing that?
Well no because the current num_of_pages is right for allocating the free list, you just have to add a separate variable
Yeah
bro whatπ
bubblesortfreelist
uint64_t max_phys_addr = 0;
for (size_t i = 0; i < response->entry_count; i++) {
struct limine_memmap_entry *entry = response->entries[i];
switch(entry->type) {
case LIMINE_MEMMAP_USABLE:
if (entry->base == 0x0) {
continue;
}
for (size_t j = 0; j < entry->length; j += 0x1000) {
num_of_pages++;
max_phys_addr = entry->base + j;
}
default:
break;
}
think this is fine for getting the shit
Yeah since limine guarantees the memory map's sorted that's fine
epic
actually no this doesn't include the last page in the last usable entry
oh
right okay thats better
you can change it to max_phys_addr = entry->base + entry->length
wiht appropriate align up/downs
not necessary, limine guarantees alignment for usable regions
whihc makes it easy for me real
true, but if you aren't doing only usable regions then u proabbly need it
also i would not rely on limine doing everything correctly
unless u want to spend the next 30 minutes debugging and filing and bug report instead of working on your kernel
okay cool
limine isn't that buggy lol
i trust the mint
i know
also, you might not want to rely on that assumption for other bootloaders
but nyaux ios probably not getting a mb2 port anyway so
who gives a crap
oh for other bootloader protocols definitely
yes
ios??
im ios???
for mb2 you can't even rely on the regions not overlapping eachother
cant you sparsely map it?
and the pmm is supposed to be generic but yeah
yeah but that's more complex than what I'm guessing nyaux is going for
ah
mhm
im too stupid to get that working lol
so we doing it the shrimple way β’οΈ
WHY IS TM NO LONGER PURPLE

it also massively increases complexity because now you can't use your allocator before you've switched to your own page tables so now you need a bootstrap allocator
yuh
it's fineee
i dont think i need the bubble sort
it's definitely worth it imo
but not doing it for simplicity's sake is fine
especially on x86, where the holes are tiny enough that you'll probably end up mapping the entire span anyway (except for the sub-4G ECAM region but that's tiny enough to not be an issue)
HOLY SHIT
the nyaux speedup
is fucking insane
1000x
HOLY
LIT TOOK LESS THEN 100ms to fucking init the vmm and pmm and arch x86 shit
i do that???
tf
ah great
nyaux isnt THAT simple
most of that 100ms is probably spent adding every individual page to the freelist
makes sense yea
and you could speed it up quite a bit by adding a counter to the free list entries
so you now only have to add 1 entry for every region
id rather not
actually surpingly the vmm takes the most time
not surpingly
wait
we ran out of memory
fuck
crazy
[ 0.000000][ OK ]: vmm(x86_64)(): Above 4Gib Mapped! Mapping Memory Map!
[ 0.000000][ FATAL ]: panic reached :c Function pmm_alloc Reasoning: no memory
i wonder why
nvm new bugs!!!
(new pmm broken???)
ofc it is
(nooo it can't be)
Oh btw what's the reason for the extra layer of indirection in pagedatabase, and for allocating the freelist separately? Wouldn't it be simpler to make pagedatabase pnode* with size max_physical_address / PAGE_SIZE * sizeof(pnode), with the free list pointing into this array?
wdym
instead of having pnode freelist[num_pages]; and pnode *pagedatabase[max_page_number], have pnode pagedatabase[max_page_number] and pnode *freelist
that way alloc is just c pnode *node = freelist; freelist = node->next; return (node - pagedatabase) * PAGE_SIZE + hhdm_offset; and free is just c pnode *node = pagedatabase + (ptr - hhdm_offset) / PAGE_SIZE; node->next = freelist; freelist = node;
bruhhhh
was able to get a stacktrace working
its happening in find_pte_and_allocate2mb
this line
uint64_t *guy =
(uint64_t *)((uint64_t)pmm_alloc() - hhdm_request.response->offset);
yea
im fuckin
cooked
what is the error code ?
of page fault
theres no page fault
i manually put it there
to get a stacktrace
its just running out of memory
so it seems like the freelist is broken
Inconsistency at line 11:
Previous -> alloc: 1, free: 32768
Current -> alloc: 2, free: 33021
alloc_diff = 1, free_diff = -253
i made a python scrip to detect an inconsisency in the logs
seems like something is fuckin cooked
we are somehow losing pages???
magically
use a electromagnet to scan for them /silly
real
sux
pmm free is not impl'd and will panic on call so this is weird as fuck
not only is this is wrong but
we are somehow having some weird ah shit
something happened in between free pages and pmm alloc
the slab allocator is causing this
lmao
the slab allocator after stealing all my pages
its not the slab allocator
its pmm alloc
something is causing pmm alloc to do something cringe
okay so
the line thats causing me to lose all these pages
is in pmm_alloc
head.next = (struct pnode *)him->next;
this one
this looks fucking normal?????
I have a hunch that making your allocator map starting at that address may collide with things that the bootloader maps?
idk I have my heap start much later in virtual address space to avoid that
it's at like 0xffffa.... instead of 0xffff8...
oh no thats a physical address with the hhdm added
why they doesnt page aligned π
maybe there's problem in your initializition ?
WAIT SERIOUSLY??
huhh
why isnt it page aligned
wait no that makes sense
num_of_pages += entry->length / 4096;
max_phys_addr = entry->base + entry->length;
do u think these 2 lines are wrong and causing this to happen @brisk zenith ?
no that looks right
i feel like the init code is the issue somewhere
as on first allocation we go from xxxxx pages to xxx pages
i.e. we lose a bunch of pages on first allocation
that shouldn't be possible given how your get_free_pages works
yea then weird???
what does your init code look like rn?
same on github as on local machien
wait really? that link is a commit from 2 weeks ago and the latest commit is from 3h ago with none of the fixes mentioned here implemented
wait
tf
wrong commit lol
real one here
yeah I was looking at that one but it seems outdated given it still has all the issues we discussed earlier
no ur right why is git not recongizing the changes
anyway what I think is the only thing that could cause this issue is the free list itself being on the free list
it doesnt seem so as ive printed every address and they dont overlap
okay @brisk zenith look at master again, i pushed the changes properly
if (entry->length >= align_up(max_phys_addr, 4096) / 4096) {
for (size_t j = 0; j < sizeof(pnode*) * num_of_pages; j += sizeof(pnode*)) {
pnode **new_ptr = (pnode**)(entry->base + j + hhdm_request.response->offset);
if (j == 0) {
pagedatabase = new_ptr;
}
*new_ptr = NULL;
}
entry->base += align_up(sizeof(pnode*) * num_of_pages, 4096);
entry->length -= align_up(sizeof(pnode*) *num_of_pages, 4096);
done_db_alloc = true;
if (done_db_alloc && done_freelist_allocation) {
goto finish;
}
}```
this seems wrong:
- when checking the length, you assume the pointer size is 1 byte
- you only initialize the first num_of_pages pointers instead of the max_phys_addr/4096 pointers it contains
- the number of bytes you remove from the region is based on num_of_pages instead of max_phys_addr/4096
where exactly do i assume the pointer size if 1 byte? also wdym by the second point? sorry my brain is a little cooked rn
you check if the length in bytes >= the number of pointers in the array
the 2nd point is just that the initialization for loop uses sizeof(pnode*) * num_of_pages instead of sizeof(pnode*) * (max_phys_addr/4096)
RIGHT, so i need to multiply bytes by the size of pnode
pnode* but yes
yea
also at the done label you should add start->next = NULL to ensure that the end of the freelist is actually marked as such
right now you assume the number of pages you free is the same as the number of pages you allocated for the list which isn't the case due to the pages you removed for the freelist and db
other than that it looks fine
wait which line for point number line, its the j for loop right?
yeah
I don't think so? it seems to use the right number
lets fucking go we gaming
yoo nice
its really fast too
like the speed up is fucking 10000x
this will make nyaux debugging fast as shit
as the kernel can just boot in 1-2 seconds
not incuding the time limine takes to load the initramfs into ram
the bios disk driver bottleneck is real
UEFI drivers probably aren't much better
yea
with uefi u can dma directly to high memory avoiding a bounce buffer
so its much faster
Also technically the int13 lba calls support specifying a 64 bit output buffer linear address
Yeah hence why I said technically
i had a laptop which reported support for that 3.0 thing
but it ignored the 64-bit field i think
was a long time ago idr
was this not happening prior π
no
how long was it taking
nice that it faster now
from kmain to userspace is 2-3 seconds
lets fucking go
not including the time it takes to unpack the initramfs + limine loading it
otherwise its like
4-5
ive encountered the funny waitpid page fault again
its more consisent
i get it to encounter every time now
fun
after executing doomgeneric twice
what seems to be happening is that the process um is getting unmapped before we can check it
like it could be that the process got unmapped before it could be removed from the list
waitpid tries to check it
and it dies
i am 99% sure this is whats going on
it is probs best to actually use the process lock
yo this is fucking crazy
it unmapped it BEFORE it even accesses the lock
so the lock is unmapped
therefore
death.
is there a way to prevent this
?
like even if i spam checks for the process everywhere
it SOMEHOW unmaps it
yes
it's called reference counting
also wdym "unmaps"
ik
but yeah, just don't access it lol
why do you keep around a reference to it after it's dead
whats happening basically is
reaper.c kfrees it
but syscall_waitpid still holds a reference to it in the while loop
basically
because timer interrupt fires and it switches to reaper.c while syscall is still in the while loop
i do
any other *nix
u can literally free it when a parent waitpid's it
or wait's it
i think you can just get rid of it after that
before it's wait(pid)'ed it's basically a zombie
meaning a dead process that still exists
the parent reaps it
yea but
i.e init system
im too lazy to change the code
do it
or deal with stupid bugs
lol
be correct or be wrong and pay the price twice
as a quick and dirty fix u can just disable interrupts around sys_waitpid
but dont rely on that
and go fix the underlying design issue asap
hydrogen has one
yeah but is hydrogen a *nix
yeah
all the regular *nix syscalls are implemented in kernel
which qualifies it as a *nix imo
and you need to have something that'll free it outside waitpid anyway because of SA_NOCLDWAIT
no that's posix
HOW
i assume linux wasn't posix compliant before 2.6 then 
EVEN THO I DISABLE INTERRUPTS
IT STILL COOKS ITSELF??
wait i forgot to save syscall.c
what phone u got
pixel 6a
nice
STILL
bro

ok genuinely how
atp
ok im gonna play factorio
and then ill gdb this shit after
is this fastish for a kernel (it gets to the point of setting up devices and modifying disk filesystems)
all in about 1.2B clock cycles
serial writing is the bottleneck here π‘
how so
idk it just looks like it's slowing it down because I remove that from printf and it is faster
probably because i wait for writes to finish
it's fine idc
I don't really try to make my kernel fast or the code slim I just write things and they turn out to be not terribly slow
turnaround time π₯
WTF IS GOING ON
okay on tcg it does this
on kvm it does the fault in syscall_waitpid
UB everywhere
its doing a bunch of random shit
help

typical sane, regular day in nyaux develompent
IT UNMAPPED ITS OWN CODE
AND STACK
I WANNA DIE
the issue has to be elsewhere
not matter what i uncomment in the reaper thread
it still fucking gets worse and worse by the minute
not exitting the thread of reaper thread and just doing a while true do ;;
causes the fault elsewhere
something tells me its exit_thread
nope its not exit thread
no more stream π’
@brisk zenith this bug is hugely weird, im kinda stuck and i do not understand whats going, a bunch of UB is happening (check thread above). please try and look at the project if you can https://github.com/rayanmargham/NyauxKC
okay so the bug pretended to be gone now
this shit is so fucking hard to figure out

yea monkuous good luck cause this shit is fucking inconsisent as hell, only thing i can say is look at reaper.c or syscall.c's waitpid or sched.c and cross fingers you find something broken
its also inconsisent between tcg and kvm
oh god a heisenbug
ill look at it later when i can actually test any changes i might make
okay
lmao
when are you gonna be able to test btw?
Not sure
Right now I'm dying from heat and I really don't want to turn on the space heater that is my PC
yea its quite hot pretty much everywhere
its hot in ireland too
climate change be like
Damn what all packages are you including
deps="base-files kernel bash ncurses readline doomgeneric nano ttytest binutils coreutils gcc fastfetch"
But weird
Since I include a few more packages such as zstd lua and gcon
And the ramdisk for that is ~ 150mb

base-files kernel drivers init bash coreutils lua nano ncurses readline tzdata xz zlib zstd gcon
is that all ur shit?
That's userspace base yes
right
