#Zinnia

1 messages Β· Page 20 of 1

marsh holly
#

It literally just sends the packets from all keyboards to the ringbuffer of this specific keyboard

near tartan
late bramble
#

is it really that easy?

near tartan
#

yeah

#

as long as you're doing fbdev

marsh holly
#

Xorg is piss easy

late bramble
#

πŸŽ‰

near tartan
#

i just need to implement fbdev and i guess i also need sockets

late bramble
#

MeniXorg

#

i have sockets, but no fbdev rn

rugged shard
#

Menix Org

near tartan
#

idk how sockets work even xd

rugged shard
#

black magic

late bramble
#

these are sockets in french:

marsh holly
near tartan
#

no on the kernel

#

is it just pipes with extra steps

marsh holly
#

Pretty much

#

At least stream ones

late bramble
#

I only have socketpair and unix ones (on filesystem) iirc

grave peak
#

SCM RIGHTS is the hard part

marsh holly
#

Some bsd even implements pipes using sockets

near tartan
#
struct socket {
    struct pipe a, b;
};
late bramble
marsh holly
#

We do not speak of the wicked ancillary data

marsh holly
grave peak
late bramble
#

sounds nice

grave peak
#

Including mmaped buffers, or literally anything

near tartan
#

lace

grave peak
#

Its the backbone of everything

near tartan
#

sounds like microkernel capability passing

grave peak
#

Thats why its called rights

#

Its basically capabilities

#

Another word for fd

marsh holly
#

Openssh uses it for privilege separation

#

Wine uses it for something

#

Not sure what

grave peak
#

Window managers use it for shared buffers

#

Etc

near tartan
#

i should probably first do fbdev before going straight into drm

#

even if it's just simpledrm

grave peak
#

If you're doing xorg then u can do that

near tartan
#

for the moment i'll be doing xorg

#

just makes everything easier

grave peak
#

Yeah that requires very little

#

They literally used to ship GPU drivers as part of xorg

#

In pre DRM days

near tartan
#

yeah

grave peak
#

Yeah

marsh holly
#

Yeah lmao

grave peak
#

Thats why xorg supports dynamic modules

storm bobcat
near tartan
#

nobody's using it at least

near tartan
#

i think i fixed this

#

but bash doesn't like me anymore

cyan nexus
#

or try fish

near tartan
#

πŸ’€

#

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

grave peak
#

Run fastfetch in a loop

near tartan
#

how

#

12mins in and so far no crash meme

cyan nexus
#

using a for loop

near tartan
#

it might be killing itself at some point when it runs out of ram

cyan nexus
#

it shouldn't tho

near tartan
#

because i don't actually free any memory after process destruction

cyan nexus
#

ah

near tartan
#

at least for the page tables

cyan nexus
#

why not, lol

near tartan
#

effort

cyan nexus
#

...

near tartan
#

i will eventually lol

cyan nexus
#

it's literaly a few lines of code

near tartan
#

i mean i'd have to traverse the page tables

cyan nexus
#

i have separate page tables per process

near tartan
#

so do i

cyan nexus
#

so i just have to loop into the process table to free them

#

tho i might need to find a faster way

near tartan
#

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

cyan nexus
#

huh?

#

oh

#

CoW

grave peak
cyan nexus
#

i didn't do it yet

near tartan
#

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

cyan nexus
#

why errors on top?

near tartan
#

didnt implement sysconf lol

#

oh noo

#

it's over

#

i did cat

#

and now i'm stuck forever

hoary cave
#

the CoW object should know how many references to each page there are

near tartan
#

yes bro

hoary cave
#

ok

near tartan
#

that's what i mean bruh

hoary cave
#

so then when it's dropped

#

you can just handle it there

cyan nexus
hoary cave
#

memory objects are behind Arc

#

no ^C

near tartan
#

what is syscall cancellation anyways

#

btw the fix for this is incredibly stupid.

hoary cave
#

when menix cancellable syscalls

near tartan
#

after nvme

#

once that works i'm speedrunning x11

#

so some hardening + sockets + fbdev + evdev

rugged shard
near tartan
#

okay without any sort of process freeing i can spawn 305 instances of fastfetch with 8 gigs of ram

vast lotus
#

well that would explain why none of my kernel changes seem to be taking effect

near tartan
#

what's the context lol

vast lotus
#

i'm only changing the actual disk image

#

but it's not booting off of that

near tartan
#

did you mix up threads?

vast lotus
#

oh

#

yes

near tartan
#

lmfao

grave peak
#

lol

modern hamlet
#

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

near tartan
#

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

storm bobcat
near tartan
#

real

storm bobcat
#

No like

#

For real

near tartan
#

i know

#

fish 4.0 is rust

storm bobcat
#

They're rewriting it in rust for no reason

near tartan
#

yeah

#

but whatever

#

not like rust is unportable

storm bobcat
near tartan
#

source?

storm bobcat
#

it's in boron

#

But like unironically do try running it in the kernel

#

it will stress test your scheduler

near tartan
#

in the kernel kernel or in userspace?

storm bobcat
#

kernel

near tartan
#

ah

#

yeah i'll try

storm bobcat
#

I guess you can run it in userspace if you have a way of creating threads

#

And mapping the framebuffer

near tartan
#

not yet meme

storm bobcat
#

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???)

near tartan
#

i'll see

#

my scheduler seems more robust recently (speculation)

#

ever since i fixed the irqlock shit

#

especially with smp

storm bobcat
#

It's cool because it creates a shitton of threads and you can visually see them running

near tartan
#

yeah

cyan nexus
#

might do that too

near tartan
#

good to see that my xbps repo is working

#

it's just not signed but those are details

spark surge
#

neat!

marsh holly
#

going to replace your packages with slightly broken versions and you will have no way of knowing

#

😈

near tartan
#

i wanna port xorg

marble salmon
#

If it's not signed you can't xbps-install from it

near tartan
#

yeah you need to rindex it

#

but i was just trying to see if it can fetch the packages from the repodata

marble salmon
#

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

late bramble
#

now

near tartan
#

i did

#

it just doesn't run yet because i want drm

late bramble
#

implement drm

near tartan
#

and I don't have sockets

#

i am going to

late bramble
#

implement sockets

#

i wanna see menix running MINECRAFT

near tartan
#

ive actually never used sockets in C directly

#

aren't they just bidirectional pipes

late bramble
#

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

near tartan
#

i probably want to do that

late bramble
#

yeah but networking isn't required for xorg as far as i am aware

#

only unix ones

near tartan
#

networking is something for later

late bramble
#

gotta send that ping and receive a pong

near tartan
#

one of the goals is hosting its own website

late bramble
#

yeah that would be neat

#

currently maestro doesn't have a website and that's an issue I'll have to fix

near tartan
#

a friend of mine made one for me

#

it's a bit too flashy imo but I'm appreciative

#

nice embed

#

the website is total overkill

#

I'd rather have something like my own website

late bramble
near tartan
#

yeah because your blog also looks like that KEKW KEKW

late bramble
near tartan
#

im a minimalist when it comes to design

late bramble
#

well I like minimalism too, but I also like pretty stuff halfmemeright

near tartan
#

i like xfce, that should tell you how much i like pretty things

late bramble
#

right

#

I use KDE plasma and my design model for Maestro is macOS halfmemeright (the glassmorphism version, not the new liquid stuff)

near tartan
#

i think the two biggest issues right now are input and output

near tartan
#

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

late bramble
near tartan
#

or I'll bite the bullet and resort to xorg

#

maybe someone ends up making a modern x11 server

near tartan
#

I don't really want to do that unless i absolutely have to

#

that's also why I'm using drm over linux fbdev

late bramble
# near tartan but you're linux compatible

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 halfmemeright

near tartan
#

yes but you're source compatible

#

i don't want to have to use linux headers for example

late bramble
near tartan
#

just use mlibc

late bramble
near tartan
#

like

late bramble
#

I surely will try it at some point

near tartan
#

"i want my own kernel but it depends on another Kernel's interface"

#

???

late bramble
#

yeah

near tartan
#

the more people use mlibc the better

#

because patches will help all sysdeps

marsh holly
#

Idk how wayland works

near tartan
#

wayland compositors depend on libinput

#

which is only really designed for evdev

marble salmon
#

you could just add your own input interface to an existing compositor

marsh holly
late bramble
near tartan
#

but that's kinda the point

#

if i made a linux compatible kernel I'd rather use linux

marble salmon
#

i wonder how hard it is to make a simple wayland compositor

near tartan
#

with wlroots it should be piss easy

late bramble
#

I started writing a xorg server (in BLAZING FAST RUST πŸš€πŸš€πŸš€) long ago but I think I'll turn it into a wayland compositor instead

near tartan
#

you can hack together something in less than 1000 lines

marsh holly
#

Yeah someone should make a wayland compositor thats as portable as xorg

near tartan
late bramble
near tartan
#

tbh just write a portable libinput

#

just one more layer of indirection

marsh holly
#

Lets crompromise, all of you write in v

near tartan
marble salmon
#

uWayland

near tartan
#

i mean

#

udrm failed because I'm lazy and it's much smarter to just support lil instead

late bramble
near tartan
#

but something like libinput-ng isn't a terribly stupid idea

#

libinput just has a shitton of code

late bramble
#

I wanna do network and graphics

near tartan
#

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

hybrid island
#

Why do you have a 0 sized alloc

near tartan
#

and since the first free already removes the USED flag from the pfndb entry it ended up double freeing

near tartan
hybrid island
#

proceeds not to tell me why

near tartan
#

wtf do you mean why

hybrid island
#

I'm curious

near tartan
#

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

near tartan
hybrid island
#

nice

#

Does that mean you'll have actual storage drivers soon then?

near tartan
#

yes

hybrid island
#

yay

near tartan
#

and probably an ext2

hybrid island
#

Do you have that one yet?

near tartan
#

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

hybrid island
#

You could probaby nab large parts of ext2 from BadgerOS since that's got a working Rust ext2 impl

near tartan
#

license?

hybrid island
#

MIT

near tartan
#

but idk if the interfaces are too similar

hybrid island
#

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

near tartan
#

i kinda follow linux naming

#

i have a superblock trait

#

which is an fs instance

hybrid island
#

Well if anything you could always use it for reference

near tartan
#

sure

#

do you also implement writing

hybrid island
#

Full base ext2 read/write

near tartan
hybrid island
#

Even checks compat flags

near tartan
#

i'll 99% need vfs adjustments anyways

#

since tmpfs has this big exception on page caching

#

with no backing device

hybrid island
#

I should note that page caching happens on the backing device for my VFS

near tartan
#

huh

hybrid island
#

I know, not modern or whatever, but it works

hybrid island
near tartan
#

oh well i have a per vnode page cache

hybrid island
#

vfs caches some superblock stuff too

near tartan
#

and when you map a node it uses freebsd like pagers

hybrid island
#

I would suggest that if you do intend to take from my VFS, that you make similar block device APIs to mine

near tartan
#

cc @fair lintel

near tartan
#

okay nice my nvme driver can now also write into the image again

near tartan
#

seems to work meme

near tartan
hybrid island
#

Nice

near tartan
#

alright nvme driver is merged

late bramble
#

The neverminde driver

knotty umbra
near tartan
#

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

near tartan
#

today I'm finishing the rest of the broken ports

#

once those work i can try the drm modesetting example

near tartan
#

ok nice, modesetting example built successfully

near tartan
#

more mlibc fixes....

near tartan
#
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

somber solar
#

is that cloc but rewritten in BLAZINGLY FAST RUST πŸš€ πŸš€ πŸš€

near tartan
#

yes

near tartan
#

i'm hacking together a few openrc scripts to replace whatever upstream provides

#

because those scripts kinda suck

near tartan
#

fastfetch working again

#

(ignore the IP that's just a placeholder until mlibc makes getifaddrs work on !linux)

marsh holly
#

67

somber solar
#

256 in u8 is impressive

#

:D

marsh holly
#

Lmaooo just noticed

near tartan
#

but yeah it's just a string in fastfetch

idle flower
full topaz
near tartan
#

why is 23 weird

full topaz
#

and it just feels wierd

near tartan
#

it's fairly common

near tartan
#

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

marsh holly
#

/etc/rc or sysvinit

near tartan
#

what's /etc/rc

marsh holly
#

You just have init run the shell file /etc/rc

#

Ita what astral does

near tartan
#

do you have like a astral-utils thing?

#

or wait you have the linux option you can just use that

marsh holly
#

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

near tartan
#

i was considering dinit

#

just something more modern

near tartan
#

we got partitions

#

hell yeah

hoary cave
#

πŸ’€

#

but that's still really cool progress

#

finally menix !dead project

near tartan
ionic lava
# near tartan hell yeah

Is this qemu run? Show me nvme options, please. I can't make nvme storage to appear (ufs too). Only host controller does.

near tartan
#

-device nvme,serial=FAKE_SERIAL_ID,drive=disk

ionic lava
#

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?

near tartan
#
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

near tartan
fiery marlin
#

cool

spark surge
#

awesome

somber solar
#

nice

hybrid island
potent hamlet
#

niceee

somber solar
#

niiiiceee

near tartan
#

next week i will add the drm subsystem (for real this time)

#

together with plainfb

grave peak
#

based

near tartan
#

when the build system is so shit that you need to patch it yourself

potent hamlet
#

which way is the auxv oriented

#

is the first thing at the top of the stack?

near tartan
#

no

#

the first thing you write is the terminator

#

this is what i do

potent hamlet
#

is that the entire thing?

#

can i just steal it

near tartan
#

for auxvals? yes

potent hamlet
#

wait wtf why am i on a thread on not on the misc channel

near tartan
#

bruh

potent hamlet
#

mb bro πŸ’€

near tartan
#

i mean my entire ELF implementation is only 580 lines (including the declarations)

potent hamlet
#

damn does it support dynamically linked stuff as well

near tartan
#

ofc

potent hamlet
#

580 lines is pretty concise tbh

near tartan
potent hamlet
#

ty

near tartan
#

okay i ported dinit now

#

was less annoying than i thought

#

but now it wants unix sockets 😭

storm bobcat
near tartan
#

the actual logic is just 200 lines

#

including stupid rust formatting

somber solar
near tartan
#

no

#

it didn't even need any patches

somber solar
#

nice

near tartan
#

the build system is shit though

near tartan
#

it also wants to use sockets very early on

vast lotus
vast lotus
#

the actual library loading and relocation etc is the interpreter's job, the loader doesn't care about it

vast lotus
#

I think that's the same for :=

vast lotus
#

:= evaluates and sets the var to the result whereas = sets the var to the expression and evaluates when it's used

near tartan
#

it ignores it for some fucking reason

vast lotus
#

that's fucked

near tartan
#

maybe because sub makes?

#

nah that doesn't make sense

#

dinit does that

#

i hate hand rolled makefiles

modern hamlet
#

= just sets the value regardless

near tartan
#

trying to run os-test is going great

fair lintel
#

lmao

near tartan
#

whatever the fuck that means

fair lintel
#

oh bruh without signals and futexes it is not going to work, like at all

near tartan
#

funni

#

also

near tartan
#

i didn't actually implement getdirents fast_eyes

#

so to even run make i need to specify the file xdddd

late bramble
cyan nexus
#

XD

near tartan
#

idk how to even implement signals

#

i haven't found any good resources

#

besides "just look at the code bro"

late bramble
#

man 7 signal good

near tartan
#

that's just the user api tho

#

idk how the kernel side is supposed to work

late bramble
#

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!).
fair lintel
#

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.

late bramble
#

sigreturn just takes the info on the user stack and restores the state according to it

fair lintel
late bramble
fair lintel
#

man 2 futex

late bramble
#

yeah

fair lintel
#

although linux obv has a quite large API surface for it

#

for mlibc, wait and wake are enough

somber solar
#

@late bramble have you switched to using mlibc?

#

or planning to

late bramble
#

I have not switched but plan trying it at least

#

I like musl, but I haven't tested mlibc

marble salmon
late bramble
#

I am actually refactoring my getdents right now because I am simplifying filesystem implementations

near tartan
#

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

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

somber solar
#

I could use std::generator

#

it looks nice :P

#

iirc the behaviour is undefined if the contents of the directory change between getdents calls

near tartan
#

what worries me is the offset parameter

somber solar
#

d_off?

near tartan
#

yeah

somber solar
#

is it used by anything?

near tartan
#

no idea

late bramble
#

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

near tartan
#

instead of having a separate syscall

late bramble
#

but doable I guess?

near tartan
#

and opendir

late bramble
#

yeah but they use getdents underneath

marsh holly
#

the olden unices could do that

#

but iirc they would literally shit out the actual directory file data which blegh

late bramble
#

yeah

near tartan
#

okay scrapping that

#

then i don't need to care about the offset argument

#

that's not a thing on mlibc sys_ level

near tartan
near tartan
#

i have decided on a goal before 2026

#

i want to have signals, (unix) sockets and Weston working by the end of the year

marsh holly
#

bro do you have 48 hours in a day

near tartan
#

yes

marsh holly
#

send method I need that too

near tartan
#

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

marble salmon
#

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)

near tartan
#

i already started a half baked plainfb drm impl

#

so ig the biggest pain point will be sockets

near tartan
#

because i only want weston to draw something this year

#

it doesn't have to work properly yet

late bramble
past leaf
#

and Xorg used signals

#

(well you can disable them)

near tartan
#

wayland MySincereReactionToYourMessage

near tartan
#

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

grave peak
#

letsgo

near tartan
#

drm update

#

today i did CRTC stuff

#

maybe we'll see some colors today???

near tartan
#

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

marble salmon
#

uapi?

grave peak
#

maybe linux userspace headers

marble salmon
#

also what do you mean by "dumb drm impl"?

grave peak
#

dumbfb only or smth

near tartan
#

technically it's user abi

marble salmon
#

yeah but what do you mean by that?

near tartan
#

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

marble salmon
#

i'd probably re-use @fair lintel's rust abi gen script

#

seems significant easier than maintaining out of band code

near tartan
#

yeah that was my thought

#

I'd still have to maintain the bits manually

#

for annotations and integration with e.g. usercpy

near tartan
#

i had thought to myself "no way that will work"

#

probably another certified overthinker moment β„’

marble salmon
near tartan
#

yeah but with bindgen that doesn't really work iirc

near tartan
#

it just stores a bunch of fields in every mode objecr and then implements a ModeObject trait over it

marble salmon
#

if you want to impl extra stuff on your abi types

near tartan
#

dumb as in simple

#

like dumbfb

#

ig it's a bad choice of words

grave peak
#

dumb framebuffer

marble salmon
#

no, dumb buffers in DRM are a specific thing

#

what Marvin is talking about is an implementation strategy

near tartan
#

yes

marble salmon
#

unrelated to dumb buffers

grave peak
#

ah

near tartan
#

i mean i also have to impl dumb buffers

#

anyways

#

time to start working

near tartan
#

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

hoary cave
#

cool stuff

near tartan
#

bruh

#

wayland feels like a fucking waste of time

#

weston has os-compatibility.h, but puts linux specific stuff everywhere unconditionally

hoary cave
#

ur compiling linux specific source files and wonder why it dies?

near tartan
#

i should stay with x11

#

tbh

hoary cave
#

lol

#

weak

modern hamlet
#

dont compile that file

hoary cave
#

that's what i said

modern hamlet
#

yeah

near tartan
#

is this rage bait

hoary cave
#

no?

near tartan
#

THEY UNCONDITIONALLY DEPEND ON THIS

hoary cave
#

how does freebsd "work" around this, for example?

#

i'm sure weston runs on non linux platforms

modern hamlet
#

that is true

#

it does include the files unconditionally

#

(unless i am looking at the wrong thing)

near tartan
#

it also uses the functions in the main code

modern hamlet
#

i wasnt aware of that before you mentioned it though

hoary cave
#

me neither

#

but it's a weston issue

near tartan
hoary cave
#

not a wayland issue

near tartan
#

there is no weston in freshports

near tartan
#

but if EVERY single compositor uses linux specific shit

#

it might as well be

marble salmon
#

FreeBSD probably just has these headers

near tartan
#

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

near tartan
radiant veldt
#

Oh my God Minix

near tartan
near tartan
#

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 skully

near tartan
#

@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 KEKW

grave peak
#

letsgo

near tartan
#

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

near tartan
#

thank you rust-analyzer

near tartan
#

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

near tartan
#

we have a mode?????

#

huge???

fair lintel
#

yooooooooo

#

pic

near tartan
#

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

marsh holly
#

πŸ•°οΈ

near tartan
#

πŸ’€ πŸ’€ πŸ’€ πŸ’€

#

not happening

hoary cave
#

chop chop

fair lintel
#

no pressure

hoary cave
#

totally no pressure

marsh holly
#

no rush but u have 6 hours

near tartan
#

im cooked wallahi

near tartan
near tartan
#

copying this table was more aids than it should have been

magic charm
#

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

near tartan
#

true

near tartan
#

2026 year of the menix desktop

near tartan
#

we're so close

marsh holly
#

Yoooo

hoary cave
#

based

hybrid island
near tartan
#

no

#

too annoying

marsh holly
#

if (!page_fault()) {
raise_signal_sync(SIGSEGV);
}

near tartan
near tartan
#

IT WORKS

#

@hoary cave

hoary cave
#

finally

#

now xeyes time

#

πŸ”₯

near tartan
#

the rendering is a bit messed up because sleep is a noop troll_severe

marsh holly
#

yoooooo menix is real

near tartan
#

now it only has to be cleaned up and work with virtio gpu and so on

marsh holly
#

u should add virito gpu accel

near tartan
#

πŸ’€

#

not even leo managed to get it working

#

i'll be happy if it can modeset

near tartan
#

ok virtio gpu is surprisingly not that bad

#

it doesn't work tho troll_severe

marble salmon
#

we have virtio gpu as well, the problem was only accel

near tartan
#

figured, i'm not doing accel for a long time

marble salmon
#

i think it should be solvable though

near tartan
#

maybe i can transfer some knowledge to managarm

marble salmon
#

might have been some ABI meme, not sure

near tartan
#

just for fun i tried just vibe coding a virtio-gpu driver and it turned out utterly useless as always

fair lintel
#

expected

near tartan
#

i'm giving up on the virtio gpu shit

#

for now

#

it does do some interesting things

#

but no image sadge

marble salmon
hoary cave
#

i already told him that at some point

near tartan
#

i actually don't want to do it with ai meme

#

i just did it for the lols

#

it did give me a good virtio impl though

near tartan
grave peak
#

damn this makes me wanna work on ultra again

#

gttnh consumed me entirely

near tartan
#

drm without actual gem is much simpler than i thought

hoary cave
near tartan
#

lock in

hoary cave
#

this guy gets it

near tartan
#

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

grave peak
#

damn menix is both vibecoded and is rust

#

full hype mode

near tartan
#

eh

#

iirc there isn't anything vibe coded commited yet

grave peak
#

i might use cursor for ultra as well

#

its not super useful but for some stuff ig

near tartan
#

nah

#

i just use vscode with the agent shit

hoary cave
#

copilot is goat

#

it's cheap and you probably have it for free :^)

near tartan
#

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

grave peak
#

yeah ai shit is great at tiny test applications or scripts etc

fair lintel
#

yeah LLMs can be helpful for unit tests

near tartan
#

personally I'd like to get os-test working at some point

#

it's a nice metric of accuracy

marble salmon
#

LLMs can also be good for actual features but you have to approach it differently than just "implement virtio gpu"

near tartan
#

ofc meme

#

(pretends that that's not literally what i did)

#

i just kept feeding it logs

marble salmon
#

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

near tartan
#

that seems logical

#

i might do that tbh

marble salmon
#

That will (hopefully) cause the llm to produce something reasonable

#

Then you review what it did, test it, and iterate

hoary cave
#

mfw i already told u that u have to walk the llm through the process

near tartan
#

i know

hoary cave
#

it seems that the llm has a bigger context than u

near tartan
#

vro

near tartan
#

i just yolo'd it

#

cuz boredom

marsh holly
near tartan
#

xooked

near tartan
#

@grave peak

median forge
marble salmon
#

very nice

hybrid island
#

Very good

marsh holly
grave peak
near tartan
#

next i want proper interrupt handling

#

then i can add evdev support

near tartan
#

i need to go outside

idle flower
#

lgtm

late bramble
#

&selg

mental tinsel
#

&nut sell

#

staic true is_busy(cost strut structure selg*);

near tartan
#

ai in 2021

near tartan
#

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

hoary cave
#

what's so different about msi handling

#

compared to normal irq handling

#

msis are regular irqs

near tartan
#

the way they're allocated

hoary cave
#

they are allocated on demand

near tartan
#

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?

hoary cave
#

that means they won't use msis

near tartan
hoary cave
#

i think platform irqs are generally preferred

#

but idk

near tartan
#

i would think that msis are preferred

hoary cave
#

Β―_(ツ)_/Β―

near tartan
#

since they're faster and unique

hoary cave
#

anyway, thats just managarm

near tartan
#

tru

#

wanna help me sort this out :3

hoary cave
#

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

near tartan
#

two retards are better than one

marsh holly
#

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

marble salmon
#

MSIs should be preferred even on Managarm

#

for devices where we support both

near tartan
#

so is my assessment correct that riscv and arm don't support msis yet?

marble salmon
#

iirc i added support for rv but maybe I never pushed that

near tartan
#

okay thanks i was ripping my hair out trying to find the code 😭

#

i only saw imsic stuff

marble salmon
#

yeah seems that our imsic code isn't integrated into the pcie code yet

#

it uses MSIs only internally

near tartan
#

okay then i finally completely understand managarms irq handling

#

this might come in handy for future drivers

marble salmon
#

but yeah, allocation should be simple (at least if you're only allocating one MSI at a time)

near tartan
#

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?

marsh holly
#

SIGSEGV or EFAULT/EIO/whatever caused the bad page fault in case of a syscall

near tartan
#

so just return an error?

marsh holly
#

yeah

near tartan
#

ight

near tartan
#

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

near tartan
#

lol worth a try

neon flicker
#

who tf reacted πŸ³οΈβ€πŸŒˆ to a message I sent a year ago

near tartan
#

πŸ’€

neon flicker
#

smh

near tartan
#

usercopy is going well

#

(not)

#

this is super aids

#

do i really need to construct a stack frame to jump to???

neon flicker
#

r u saying

#

that before u would blindly write into any pointer

#

the user gave you

near tartan
#

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

neon flicker
#

so like, EFAULT just plain

#

did not exist

near tartan
#

yes

neon flicker
#

krill issue ngl

near tartan
#

idk just never had an app crash πŸ’€

neon flicker
#

(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)

near tartan
#

i wonder what's the most efficient checked user memory access method

neon flicker
#

allow any thread not owned by the kernel to PF, and just kill the thread on fault trl

near tartan
#

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

storm bobcat
#

if not then kpti is probably a perf nuke

neon flicker
#

no (that is TODO)

#

(yes my userspace perf is shit)

storm bobcat
#

its probably not that bad but its not very good either

#

the overhead of kpti i mean

eternal wharf
#

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

rugged shard
hybrid island
#

So you have no overhead in your code if you don't fault.

vast lotus
#

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

marble salmon
#

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

vast lotus
#

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

marble salmon
#

do you compile with -fnon-call-exceptions?

#

ig if you write the fault handler in asm it's probably fine

#
  • the fault generating code
vast lotus
#

that is only necessary if the fault can be triggered by C code, which it can't

marble salmon
#

ah i see

#

so you're using eh tables but you're doing all the plumbing yourself?

vast lotus
#

yes

#

i had the unwind support anyway for backtraces so i decided to just use it for this as well

grave peak
#

do u have that code available anywhere

vast lotus
#

not right now

grave peak
#

new os project?

vast lotus
#

yeah

grave peak
#

damn

#

whats the idea of it?

marble salmon
#

even with -fnon-call-exceptions

#

but ofc that doesn't apply to hand written asm

vast lotus
#

it does if you pass -fexceptions afaict

#

(which is a valid flag even for C)

marble salmon
#

-fno-call-exceptions also specifically mentions that you cannot just unwind from async signals

#

even if you pass it

#

only from synchronous faults

modern hamlet
modern hamlet
#

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

vast lotus
near tartan
vast lotus
#

why would you want to avoid that

modern hamlet
#

I don't

hybrid island
#

Race conditions

modern hamlet
#

It's undefined behavior

#

The program is buggy

vast lotus
#

but read/write usually doesn't do that

grave peak
vast lotus
hybrid island
#

But in general you can't fully avoid this unless you copy all of it upfront so...

modern hamlet
#

exactly

#

I don't think posix says the data must be written exactly as it was when the write call took place

hybrid island
#

The way I "deal" with it is to simply make an explicit distinction when I read something they could be user memory

near tartan
hybrid island
#

After that you have a copy of (part of) said user memory

modern hamlet
#

In general if you are modifying buffers while you are doing a system call with those, you are asking for trouble

vast lotus
#

well, syscall-abi-compatible, i have no plans to replicate procfs and sysfs

grave peak
#

Why did you decide to go that route

vast lotus
#

i really don't like having to debug a kernel, a libc, and port quality at the same time

modern hamlet
vast lotus
#

so i am only doing one at a time

hybrid island
#

I don't get why people like doing Linux compatibility so much

#

And when I say that I mean ABI

modern hamlet
near tartan
#

free programs

hybrid island
#

But userspace is still part of the OSDev journey

vast lotus
# vast lotus so i am only doing one at a time

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

modern hamlet
grave peak
#

Porting random crap and building it for 10 hours

near tartan
#

eh

modern hamlet
#

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)

modern hamlet
marsh holly
vast lotus
modern hamlet
#

And by unix-y file system structure I mean devfs and procfs

vast lotus
#

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

near tartan
#

I don't like depending on other projects

modern hamlet
#

When I implement procfs and sysfs I'll do those with a separate driver

#

I ain't "contaminating" my kernel with that "crap"

near tartan
#

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

modern hamlet
#

The beauty of doing your own OS is that you can ~lie~ and ~pretend~

marble salmon
#

sysfs is separate from drivers on Managarm as well

near tartan
#

yes but on managarm there's a way to communicate between drivers

#

if you don't have that it's not possible

vast lotus
#

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

modern hamlet
#

Wait what does sysfs have to do with drivers