#Zinnia
1 messages Β· Page 20 of 1
It literally just sends the packets from all keyboards to the ringbuffer of this specific keyboard

is it really that easy?
Xorg is piss easy
π
i just need to implement fbdev and i guess i also need sockets
Menix Org
idk how sockets work even xd
black magic
these are sockets in french:
Socket Listen socket connect accept write read wirte read close
I only have socketpair and unix ones (on filesystem) iirc
Well bidirectional
SCM RIGHTS is the hard part
Some bsd even implements pipes using sockets
struct socket {
struct pipe a, b;
};
what's that?
We do not speak of the wicked ancillary data
Fd passing
Giving other processes your file descriptors
sounds nice
Including mmaped buffers, or literally anything
lace
Its the backbone of everything
sounds like microkernel capability passing
i should probably first do fbdev before going straight into drm
even if it's just simpledrm
If you're doing xorg then u can do that
Yeah that requires very little
They literally used to ship GPU drivers as part of xorg
In pre DRM days
yeah
what the
Yeah
Yeah lmao
Thats why xorg supports dynamic modules
dont they still? with the stuff like xf86-xorg-amd or whatever
nobody's using it at least
make your own bash and call it mash
or try fish
π
fish is rust
that needs a port of that first
first time that menix has survived running for longer than 1 minute
I'm trying to see how long it can stay alive
Run fastfetch in a loop
it might be killing itself at some point when it runs out of ram
it shouldn't tho
because i don't actually free any memory after process destruction
ah
at least for the page tables
why not, lol
effort
...
i will eventually lol
it's literaly a few lines of code
i mean i'd have to traverse the page tables
i have separate page tables per process
so do i
so i just have to loop into the process table to free them
tho i might need to find a faster way
the problem is
you need to either parse the tables
or record the list of physical pages in use for it
and you need to consider CoW
Bash has loops
i didn't do it yet
well i do CoW
so it's not as easy
wooo 15 minutes in
note that this is running with smp=4
so that also works pretty well
why errors on top?
didnt implement sysconf lol
oh noo
it's over
i did cat
and now i'm stuck forever
fym
the CoW object should know how many references to each page there are
yes bro
ok
that's what i mean bruh
why XD
when menix cancellable syscalls
after nvme
once that works i'm speedrunning x11
so some hardening + sockets + fbdev + evdev
do a fork bomb 
lol
okay without any sort of process freeing i can spawn 305 instances of fastfetch with 8 gigs of ram
well that would explain why none of my kernel changes seem to be taking effect
what's the context lol
lmfao
lol
not a worry
i think the best way to do it is 1 page table per process
period
now it might seem stupid to suggest a naive idea like that, but let's be honest, are you really going to clone page tables anyway
no, just fill those in at page fault time
"but where am i going to get my private anonymous mappings" from amaps that you create for those mappings
so instead of copying-on-write the page tables, create-them-on-write
now i realize im preaching something i dont practice, but thats only because i havent implemented fork yet
fair enough
i just need to figure out the best way of recording which pages are used
either i just traverse all levels manually
or save the pages in a vec
New fish is rust, real fish is C++
real
They're rewriting it in rust for no reason
Run the fireworks test
source?
it's in boron
But like unironically do try running it in the kernel
it will stress test your scheduler
in the kernel kernel or in userspace?
kernel
I guess you can run it in userspace if you have a way of creating threads
And mapping the framebuffer
not yet 
But the problem is it will most likely find bugs
Which is annoying
Like I've been debugging it for around a week but I fixed like 3 major bugs and now it runs fine without smp, just gotta figure out why it's dead locking for no reason on smp (it seems a thread at IPL DPC is being rescheduled???)
i'll see
my scheduler seems more robust recently (speculation)
ever since i fixed the irqlock shit
especially with smp
It's cool because it creates a shitton of threads and you can visually see them running
yeah
might do that too
neat!
going to replace your packages with slightly broken versions and you will have no way of knowing
π
i wanna port xorg
If it's not signed you can't xbps-install from it
yeah you need to rindex it
but i was just trying to see if it can fetch the packages from the repodata
unsigned rindex is not enough
you need a signed rindex
for http/https repositories
for xbps repos on the local fs it doesn't matter
implement drm
what a great way to learn
uh kinda
as long as your are using the unix ones I think that's basically it?
if you want to do networking though it becomes more complicated
i probably want to do that
networking is something for later
gotta send that ping and receive a pong
one of the goals is hosting its own website
yeah that would be neat
currently maestro doesn't have a website and that's an issue I'll have to fix
a friend of mine made one for me
it's a bit too flashy imo but I'm appreciative
The Menix Operating Systemundefined
nice embed
the website is total overkill
I'd rather have something like my own website
looks nice to me
yeah because your blog also looks like that

i started making a website myself for maestro (repo private for now) where I was using https://github.com/copy/v86 to make a demo
im a minimalist when it comes to design
well I like minimalism too, but I also like pretty stuff 
i like xfce, that should tell you how much i like pretty things
right
I use KDE plasma and my design model for Maestro is macOS
(the glassmorphism version, not the new liquid stuff)
i think the two biggest issues right now are input and output
on what?
menix
i dont know how to best handle input
sure i could use the evdev interface
if i don't then I'm likely losing libinput
and in turn most wayland stuff
I think I'll do that
or I'll bite the bullet and resort to xorg
maybe someone ends up making a modern x11 server
but you're linux compatible
I don't really want to do that unless i absolutely have to
that's also why I'm using drm over linux fbdev
to be more precise, I implement a subset of Linux.
Because I don't want (or can) support every single feature (some of which are legacy stuff anyways).
And if you want all of the Linux features, just use Linux directly 
yes but you're source compatible
i don't want to have to use linux headers for example
tbh I don't even know what I am doing at this point 
just use mlibc
oh yeah I do use those
like
I surely will try it at some point
yeah
Or a wayland xf86-input-keyboard/mouse equivalent
Idk how wayland works
you could just add your own input interface to an existing compositor
Me when I write nonportable software
the opposite kinda feels like:
i wonder how hard it is to make a simple wayland compositor
with wlroots it should be piss easy
I started writing a xorg server (in BLAZING FAST RUST πππ) long ago but I think I'll turn it into a wayland compositor instead
you can hack together something in less than 1000 lines
Yeah someone should make a wayland compositor thats as portable as xorg

write it in C
so it's actually portable

no u

uWayland
i mean
udrm failed because I'm lazy and it's much smarter to just support lil instead
|| je mΓ©chant ||
but something like libinput-ng isn't a terribly stupid idea
libinput just has a shitton of code
I wanna do network and graphics
oh god
i found a stupid pmm bug
first time in a while that this happened
apparently a zero sized allocation is trying to free pages on an already freed allocation
because you need to free at least one page
so i had two consecutive allocations, one size 0, one size 4096. freeing just one of them works, but coincidentally i wanted to free both right after each other
Why do you have a 0 sized alloc
and since the first free already removes the USED flag from the pfndb entry it ended up double freeing
I'm pretty sure i have to
proceeds not to tell me why
wtf do you mean why
I'm curious
i mean now i just panic on zero sized allocation
it's an oversight
rust doesn't allocate ZSTs i think
but this was a manual phys allocation
:D
yes
yay
and probably an ext2
Do you have that one yet?
no lol i don't have block drivers
when that works i can focus on running x11
after nvme first thing i'll do is drm and kms
You could probaby nab large parts of ext2 from BadgerOS since that's got a working Rust ext2 impl
license?
MIT
They're probably similar, though I'd expect the names for certain things to be slightly different
From what I know about your VFS it shouldβ’ fit together more or less, since you also do a VNodeOps-like thing
Well if anything you could always use it for reference
Full base ext2 read/write

Even checks compat flags
i'll 99% need vfs adjustments anyways
since tmpfs has this big exception on page caching
with no backing device
I should note that page caching happens on the backing device for my VFS
huh
I know, not modern or whatever, but it works
blkdevs have a page cache before them, and that's it.
oh well i have a per vnode page cache
vfs caches some superblock stuff too
and when you map a node it uses freebsd like pagers
I would suggest that if you do intend to take from my VFS, that you make similar block device APIs to mine
okay nice my nvme driver can now also write into the image again
Nice
alright nvme driver is merged
The neverminde driver
I saw this once, and after that couldn't really read it of any other way. NVM Express -> NeVer Mind Express
i'm still working on some speedup improvements
my block io interface is extremely primitive
current read speed is 300MB/s with a block size of 0x2000
today I'm finishing the rest of the broken ports
once those work i can try the drm modesetting example
ok nice, modesetting example built successfully
more mlibc fixes....
marvin@fw13 ~/r/m/s/menix (main)> tokei kernel/ drivers/
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Language Files Lines Code Comments Blanks
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
LD Script 2 219 161 15 43
TOML 6 91 74 2 15
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Rust 115 16470 13769 507 2194
|- Markdown 71 788 0 778 10
(Total) 17258 13769 1285 2204
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Total 123 17568 14004 1302 2262
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
damn
is that cloc but rewritten in BLAZINGLY FAST RUST π π π
yes
yay
i'm hacking together a few openrc scripts to replace whatever upstream provides
because those scripts kinda suck
fastfetch working again
(ignore the IP that's just a placeholder until mlibc makes getifaddrs work on !linux)
67
Lmaooo just noticed
the forbidden ipv4 address
I thought /23 was wierd, but /67? that feels more cursed than pandoras box
why is 23 weird
it's fairly common
i still kinda want to port an existing init system
openrc is weird, there's a shit ton of shell scripts
not sure if i like that
ideally i'd like to provide my own files
looking at this table right now
/etc/rc or sysvinit
what's /etc/rc
Super ancient way of doing init stuff
You just have init run the shell file /etc/rc
Ita what astral does
do you have like a astral-utils thing?
or wait you have the linux option you can just use that
Neither
But I do have some astral specific topls
Tools
I have considered proting sysvinit to astral
Especially as it outgrows the etc rc thing
why is it registering the namespace device after it discovers partitions
π
but that's still really cool progress
finally menix !dead project
it's registering the ns block device and that function scans for partitions before registering
Is this qemu run? Show me nvme options, please. I can't make nvme storage to appear (ufs too). Only host controller does.
yes it's qemu run
-device nvme,serial=FAKE_SERIAL_ID,drive=disk
Hm. That's all? Weird. I have the very same thing and doesn't show up. I guess it shouldn't matter what type of virtual disk one uses, right?
qemu: ovmf/ovmf-code-$(ARCH).fd build-$(ARCH)/menix.img
qemu-system-$(ARCH) $(QEMUFLAGS) \
-drive format=raw,file=build-$(ARCH)/menix.img,if=none,id=disk \
-device nvme,serial=FAKE_SERIAL_ID,drive=disk
this is the full one
cool
awesome
nice
niiiice
niceee
niiiiceee
based
when the build system is so shit that you need to patch it yourself
for auxvals? yes
elf auxv for mlibc yeah
wait wtf why am i on a thread on not on the misc channel
bruh
mb bro π
i mean my entire ELF implementation is only 580 lines (including the declarations)
damn does it support dynamically linked stuff as well
ofc
580 lines is pretty concise tbh
ty
okay i ported dinit now
was less annoying than i thought
but now it wants unix sockets π
not really but tbf he has constants in the file
does it need /proc and /sys
nice
the build system is shit though
it also wants to use sockets very early on
can't you just do make PREFIX=/usr? iirc the = operator only sets if the variable is unset
elf dynamic linking is incredibly easy on the loader side, all you do is load a second elf file if pt_interp specifies one and call that instead of the main binary (passing info about the main binary through auxv)
the actual library loading and relocation etc is the interpreter's job, the loader doesn't care about it
what's ?= for then?
I think that's the same for :=
no :)
:= evaluates and sets the var to the result whereas = sets the var to the expression and evaluates when it's used
it ignores it for some fucking reason
that's fucked
maybe because sub makes?
nah that doesn't make sense
dinit does that
i hate hand rolled makefiles
no thats ?=
= just sets the value regardless
lmao
whatever the fuck that means
oh bruh without signals and futexes it is not going to work, like at all
you will cringe at this
i didn't actually implement getdirents 
so to even run make i need to specify the file xdddd
I have signals but not futexes, rip
XD
idk how to even implement signals
i haven't found any good resources
besides "just look at the code bro"
man 7 signal good
look at the section Execution of signal handlers
it has the steps the kernel does to execute a signal handler
This paragraph in particular is important (to me):
From the kernel's point of view, execution of the signal handler code is exactly the same as the execution of any other user-space code. That is to
say, the kernel does not record any special state information indicating that the thread is currently executing inside a signal handler. All necesβ
sary state information is maintained in user-space registers and the user-space stack. The depth to which nested signal handlers may be invoked is
thus limited only by the user-space stack (and sensible software design!).
yeah, for signals you decide what to do based on the signal and the handling state
so for signals that terminate the process, terminate the process
and make that info available via waitpid
for signal handlers, push a signal frame to the stack and set up the rest of the state, set PC to the handler, go
etc.
sigreturn just takes the info on the user stack and restores the state according to it
futexes should be quite easy to get going, I can only recommend doing it
I have to understand how they work first
man 2 futex
yeah
although linux obv has a quite large API surface for it
for mlibc, wait and wake are enough
I have not switched but plan trying it at least
I like musl, but I haven't tested mlibc
wtf, you have bash but no readdir?
I am actually refactoring my getdents right now because I am simplifying filesystem implementations
yeah
the problem is that i'm stuck on the interface design
do i just return a Vec<uapi::dirent> from the VFS?
since i can't just let the kernel write to the buffer in unmapped memory
cc @late bramble
I am passing a closure to my filesystem implementation, which calls the closure for each entry.
The closure writes the entry in userspace memory and returns a boolean saying if we can continue or must stop
hmm this made me think
I could use std::generator
it looks nice :P
iirc the behaviour is undefined if the contents of the directory change between getdents calls
what worries me is the offset parameter
d_off?
yeah
is it used by anything?
no idea
it is whatever you want
you can use it as a cookie that you interpret the way you want in your filesystem implementation
iirc getdents uses the offset in the open file description to know where the last getdents call finished, so that it can resume at the right location. The offset can contain any value just like d_off
how stupid would it be to implement read() for dirfd
instead of having a separate syscall
that does not sound practical
but doable I guess?
i mean readdir already exists
and opendir
yeah but they use getdents underneath
the olden unices could do that
but iirc they would literally shit out the actual directory file data which blegh
yeah
okay scrapping that
then i don't need to care about the offset argument
that's not a thing on mlibc sys_ level

i have decided on a goal before 2026
i want to have signals, (unix) sockets and Weston working by the end of the year
bro do you have 48 hours in a day
yes
send method I need that too
weston can't be that hard
it's just drm + evdev
signals don't have to be complete
I'll just do the bare minimum for those
and unix sockets should be relatively okay
unless I'm underestimating things
i will have the PTO until next year so i have enough time to get shit done
I don't think you need signal support to make weston work
You need signal support for other things though (such as ctrl+q working)
oh nice then
i already started a half baked plainfb drm impl
so ig the biggest pain point will be sockets
because i only want weston to draw something this year
it doesn't have to work properly yet
how
sockets are easier than signals
and Xorg used signals
(well you can disable them)
wayland 
i've been working to split out some wayland linux APIs in mlibc so i can use libinput and libwayland too
namely epoll, signalfd and timerfd
@grave peak DRM commences today
letsgo
note to self for today:
move uapi to rust
write drm uapi bits
use the dumb drm impl instead of trying to make something fancy
uapi?
maybe linux userspace headers
also what do you mean by "dumb drm impl"?
dumbfb only or smth
yeah but what do you mean by that?
currently i generate the bits from C headers
if i wrote them in rust instead, i could e.g. derive extra macros
and it also seems like bindgen doesn't understand size_t, so those types are all wrong
i'd probably re-use @fair lintel's rust abi gen script
seems significant easier than maintaining out of band code
yeah that was my thought
I'd still have to maintain the bits manually
for annotations and integration with e.g. usercpy
i thought of copying linux/managarm drm stuff, but after seeing that Aero does exactly what i had thought of before, I'll just do that instead
i had thought to myself "no way that will work"
probably another certified overthinker moment β’
you can just impl traits as long as you're in the same module or crate
yeah but with bindgen that doesn't really work iirc
what does Aero do?
it just stores a bunch of fields in every mode objecr and then implements a ModeObject trait over it
also, you can use newtype patterns
if you want to impl extra stuff on your abi types
why is that "dumb"?
thats literally what its called in DRM
dumb framebuffer
no, dumb buffers in DRM are a specific thing
what Marvin is talking about is an implementation strategy
yes
unrelated to dumb buffers
ah
okay we're getting somewhere
the modsetting example that I'm using was able to detect a crtc
if i hook up the plane logic we can probably see some results very soon
cool stuff
bruh
wayland feels like a fucking waste of time
weston has os-compatibility.h, but puts linux specific stuff everywhere unconditionally
ur compiling linux specific source files and wonder why it dies?
bro
i should stay with x11
tbh
that's what i said
yeah
is this rage bait
no?
THEY UNCONDITIONALLY DEPEND ON THIS
how does freebsd "work" around this, for example?
i'm sure weston runs on non linux platforms
that is true
it does include the files unconditionally
(unless i am looking at the wrong thing)
it also uses the functions in the main code
i wasnt aware of that before you mentioned it though
it doesn't apparently
not a wayland issue
there is no weston in freshports
yes bro you're not the first to say this
but if EVERY single compositor uses linux specific shit
it might as well be
FreeBSD probably just has these headers
eh with a bunch of fixes i got it to build
probably won't work correctly though
ehhhh fuck it
x11 is going to be easier for now
i'll put this on a different branch

Oh my God Minix

rust my beloved
i have added more DRM functionality
the test app is trying to create a dumb buffer now
i also finally fixed getdents 
@hoary cave can u believe it
i finally locked tf in
sockets are half working
xorg is trying to do stuff
i need to read up on how x11 architecture actually works 
letsgo
i also tried doing ps2 with evdev
im writing a test application to do input
idk if i want to have kernel vt support
delegating everything to userspace seems easier
thank you rust-analyzer
more drm work happened today
if i get the time I'm sure i can get something drawn on the screen today
i need to mess a bit with mapping buffers and so on, but it shouldn't be a problem
nothing drawn yet
π
rn all it does is take over control over fbcon
will send pics when it does shit
but drm at least says it has a mode with the correct crtc
the clock is ticking lil vro
π°οΈ
chop chop
no pressure
no rush but u have 6 hours
copying this table was more aids than it should have been
that's got to be worth something anyway
the first run of xorg only reveals lots more stuff to work on and fix, in my experience anyway, so i expect the same for wayland
true
2026 year of the menix desktop
we're so close
Yoooo
based
Do you not support signalling usermode yet?

yoooooo menix is real
now it only has to be cleaned up and work with virtio gpu and so on
u should add virito gpu accel
we have virtio gpu as well, the problem was only accel
figured, i'm not doing accel for a long time
i think it should be solvable though
maybe i can transfer some knowledge to managarm
might have been some ABI meme, not sure
just for fun i tried just vibe coding a virtio-gpu driver and it turned out utterly useless as always
expected
i'm giving up on the virtio gpu shit
for now
it does do some interesting things
but no image 
You need to break that down to smaller tasks if you want to do it using AI
i already told him that at some point
no
i actually don't want to do it with ai 
i just did it for the lols
it did give me a good virtio impl though

drm without actual gem is much simpler than i thought
go go go
lock in
the ai did get modesetting working tho
i could change the resolution to 4k
shame there's no drm test application that uses PAGE_FLIP
i might start using ai for churn work tho
cursor is big overkill imo
Here's an idea
make the clanker write a drm example that uses ATOMIC and PAGE_FLIP
yeah ai shit is great at tiny test applications or scripts etc
yeah LLMs can be helpful for unit tests
personally I'd like to get os-test working at some point
it's a nice metric of accuracy
LLMs can also be good for actual features but you have to approach it differently than just "implement virtio gpu"
You have to write something like:
- We will now implement a virtio-gpu driver. The pci bindings that we'll need are in foo.rs. Look at the virtio spec at some.url to find the virtq layout. Implement a virtq data structure for non-unified layout. Ignore MSIs and unified layout. Ignore configuration change IRQs.
- Implement the 2d resource creation request for virtio-gpu. Set up the driver to such a point that this request can be tested in qemu
etc
That will (hopefully) cause the llm to produce something reasonable
Then you review what it did, test it, and iterate
mfw i already told u that u have to walk the llm through the process
i know
vro
i didn't forget about it
i just yolo'd it
cuz boredom
Gen z brain vro
xooked
absolute cinema
very nice
Very good

LFG
i need to go outside
lgtm
ai in 2021
man :( I've literally been reading managarm IRQ handling until like 6am today
i still don't completely get it π
well, i understand the gist of it, but not really the MSI handling
what's so different about msi handling
compared to normal irq handling
msis are regular irqs
the way they're allocated
they are allocated on demand
for example, the part where i got stumped:
nvme requests an MSI, but the kernel handler for that request bails out if there is no msi controller
but the controller is defined only for x86_64
does that mean nvmes don't work on riscv?
that means they won't use msis
i would think that msis are preferred
Β―_(γ)_/Β―
since they're faster and unique
anyway, thats just managarm
it hasn't been tested very well on like
99% of non-x86 hardware
and even 99% of x86 hardware

idk i can try but im retarded
two retards are better than one
interrupt is so simple you just crash on any interrupt and poll instead
hell dont even set up an idt, use triple faults to reschedule
so is my assessment correct that riscv and arm don't support msis yet?
iirc i added support for rv but maybe I never pushed that
okay thanks i was ripping my hair out trying to find the code π
i only saw imsic stuff
yeah seems that our imsic code isn't integrated into the pcie code yet
it uses MSIs only internally
okay then i finally completely understand managarms irq handling
this might come in handy for future drivers
but yeah, allocation should be simple (at least if you're only allocating one MSI at a time)
i wonder how i should best handle user memory page faults
do i terminate the process immediately, or do i return an error to the caller?
SIGSEGV or EFAULT/EIO/whatever caused the bad page fault in case of a syscall
so just return an error?
yeah
ight
working on an abstraction for consoles
I'll change it so instead of every console seeing the same output, everything has its own IO stream, and the stdout for kernel messages can be configured via cmdline
lol worth a try
who tf reacted π³οΈβπ to a message I sent a year ago
π
smh
usercopy is going well

(not)
this is super aids
do i really need to construct a stack frame to jump to???
yes
well, i had the interface for it
just not the impl
so i don't have to update the generic code
just the handling
yes
krill issue ngl
idk just never had an app crash π
(my kernel has a different krill issue, it literally cannot access a user pointer at all, without a view of the memory)
(that is because of kernel page table isolation and also because of SMAP)
i wonder what's the most efficient checked user memory access method
allow any thread not owned by the kernel to PF, and just kill the thread on fault 
hm
look at this 3am autism that i wrote
this is really cursed
(the page fault handler modifies rsi in place and jumps to the function again)
(((what could go wrong possibly)))
but tbh the better solution would be to just accept it and not have fancy closures
just read and write
should i copy user buffers into kernel memory before e.g. doing a write()
what if they're big
do you use asids
if not then kpti is probably a perf nuke
you could just write the actual memory copy in asm
thats what we do in managarm, then in the pf handler we just modify the saved rip to point to the fail label in the function
In my pf handler I set rip to this trampoline which is basically what the managarm people do but it lets use my C memcpy https://github.com/9xbt/bentobox/blob/rewrite/kernel%2Farch%2Fx86_64%2Fuser.asm#L54
What I did was make a table of "fallible instructions" that the exception handler will just skip over if an exception happens at that address.
So you have no overhead in your code if you don't fault.
This here lets me easily use inline assembly snippets of that form: https://github.com/badgeteam/BadgerOS-Kernel/blob/sched3/kernel/cpu/riscv/src/exception.rs#L149
Then my usercopy can do things like this: https://github.com/badgeteam/BadgerOS-Kernel/blob/sched3/kernel/cpu/riscv/src/usercopy.rs#L23
I use the facilities designed for C++ exception handling
Specifically, on an unhandled page fault, I unwind the stack until I get to a frame with a personality code that indicates it's a user copy function. This frame has an LSDA pointing to a structure that describes what kind of page faults it's expected to generate and where to return to. If it matches the fault, I restore the unwound registers and set the PC to the value given in the LSDA
i doubt that this is generally supported
i read some discussions about that on the gcc mailing list a few years ago and the consensus was that it isn't
what aspect of it isn't supported
also remember that i only use the facilities designed for c++ exception handling, i don't actually use c++ exception handling
functions that catch faults in this way are handwritten asm
do you compile with -fnon-call-exceptions?
ig if you write the fault handler in asm it's probably fine
- the fault generating code
that is only necessary if the fault can be triggered by C code, which it can't
yes
i had the unwind support anyway for backtraces so i decided to just use it for this as well
do u have that code available anywhere
not right now
new os project?
yeah
basically I think for C code, gcc does not promise that the eh info is complete for every possible IP value
even with -fnon-call-exceptions
but ofc that doesn't apply to hand written asm
-fno-call-exceptions also specifically mentions that you cannot just unwind from async signals
even if you pass it
only from synchronous faults
I do this
one thing i borrowed from NT which helps me with this is the concept of an MDL
so basically on every read/write it pins the pages backing the buffer into a structure called MDL which contains the byte offset within a page and references to all of the pages backing that buffer
for really big buffers this is efficient because you dont need to copy from user to kernel memory, just map the same pages into the kernel address space
and the upside is that the drivers dont care about whether the pages are unmapped or not
i have extracted the relevant parts of the code https://hst.sh/vehorapate.cpp
how do you avoid userspace overwriting the data in the buffer while in the kernel
why would you want to avoid that
I don't
Race conditions
that matters when you're interpreting the data
but read/write usually doesn't do that
Wait are you making an nt like kernel
no i just like the naming scheme and the separation
But in general you can't fully avoid this unless you copy all of it upfront so...
exactly
I don't think posix says the data must be written exactly as it was when the write call took place
The way I "deal" with it is to simply make an explicit distinction when I read something they could be user memory
what about ioctls
After that you have a copy of (part of) said user memory
In general if you are modifying buffers while you are doing a system call with those, you are asking for trouble
in fact the plan is to be ABI compatible with linux (and eventually, only once it works well with precompiled executables, add a separate native abi and start porting stuff)
well, syscall-abi-compatible, i have no plans to replicate procfs and sysfs
Linux compat is based
Why did you decide to go that route
i really don't like having to debug a kernel, a libc, and port quality at the same time
I thought this was mintia386 transpiled code for a sec
so i am only doing one at a time
I don't get why people like doing Linux compatibility so much
And when I say that I mean ABI
It's a well established interface
free programs
But userspace is still part of the OSDev journey
first debugging the kernel with precompiled libc and executables, then once that works debugging ports with glibc and a verified working kernel, then once that works debugging mlibc or a custom libc
People have different goals in osdev
For me its not a fun part, and I dont enjoy doing it
Porting random crap and building it for 10 hours
eh
I don't enjoy abiding by specifications (which is why it took a significant amount of pain to write my fork implementation, my partial munmap and overridable mmap, and soon my execve implementation)
You can roll your own userspace
Step 1) git clone https://github.com/managarm/bootstrap-managarm 
if your kernel is already capable of providing the sysdeps needed by mlibc or similar, most of the work necessary to provide linux syscall abi compat is already done
Kind of... but mlibc doesn't strictly require a unix-y file system structure
And by unix-y file system structure I mean devfs and procfs
oh yeah full linux abi compat including procfs/sysfs is a very different beast
but most programs either don't need procfs/sysfs or can make do with some manually created files/symlinks in /proc and /sys
I don't like depending on other projects
When I implement procfs and sysfs I'll do those with a separate driver
I ain't "contaminating" my kernel with that "crap"
how can you do sysfs as a driver
isn't the point that drivers can expose their stuff via sysfs
unless you have module dependencies or something
The beauty of doing your own OS is that you can ~lie~ and ~pretend~
sysfs is separate from drivers on Managarm as well
yes but on managarm there's a way to communicate between drivers
if you don't have that it's not possible
one possible approach is to just only have the generic stuff in sysfs
this would effectively make it appear to programs as if all devices in the system use unknown drivers
Wait what does sysfs have to do with drivers



