#EvalynOS
1 messages · Page 12 of 1
where is my disk based swap

understandable
I swap all my memory to disk
I have 10 pages of phys mem
I swap them in and out of disk like ram banks
Honestly it would be cool to make a kernel that does it like this
And tries to use the least amount of physical memory possible
I also need to buy a raspberry pi 4b to start on a aarch64 port
well point is u will be having a page cache and write back stuff which isnt so different
like
ig its just 1k loc away from having swapping already 

- 1 page for user code
- 1 page for kernel code (int handler blah blah blah)
- 1 page for kernel stack
- 1 page for kernel stack (user)
- 1 page for user stack
- 2 pages for nvme queues
heap where
Would prolly have to be x86-32
hm
Wait nvme
7 pages
How you gonna fit the driver in there
I'm prob missing ALOT
nvme is pretty damn simple
but I'mma say you need like
1k pages
comfortably
you swap that in and out of disk
the worlds slowest os
100% disk usage idling
The i-RAM was a PCI card-mounted, battery-backed RAM disk that behaved and was marketed as a solid-state storage device. It was produced by Gigabyte and released in June 2005, at a time when genuine solid-state storage solutions were generally still less affordable than an i-RAM product with superficially similar capabilities. The i-RAM utilised...
well u would probably need much more than that just to detect the nvme disk itself
acpi then pci stuff
yeah perhaps kernels use up the memory they use for a reason 
segmentation my beloved
you kinda need pages
fuck segmentation
to trap them
hows project going
and swap them
hi catflare
gonna do heap next
eyyy
and then let things actualy free memory
and not leak
because user tasks cannot be stopped/unleaked

good point
honestly fuck the users
they dont deserve any of this
Real hardware is a go
This laptop has 8gb ram
7700mb/8000mb is pretty good
That reserved includes my PFNdb
And shit
It runs on a VM with 96MB
oh lmao
And runs doom or bad apple before OOMing
Because not enough for both
Boot times are WAY better now tho
1GB lost on deck
But IIRC it by default reserves a chunk for vram?
May be that
@rotund furnace Once I do RB tree VMM il split it into paging setup and then VMM setup

To be proper
And then VMM setup will be after heap
It handles a large amount of memory on my 32gb ram system
I like it
That's also cool
kinda sucks but :P
cool
but
the wording is a bit cooked
Though I would move those magic numbers away
yeah 💀
like 0x1, 0x2, etc etc
I know you're checking bits but still
it'd be nice y'know
mines just dead ass
and make them 1 << n instead of numbers like that
int page_protection_violation = ((frame->error & 0b00000001) > 0);
int write_access = ((frame->error & 0b00000010) > 0);
int user_mode = ((frame->error & 0b00000100) > 0);
int reserved_bit = ((frame->error & 0b00001000) > 0);
int instruction_fetch = ((frame->error & 0b00010000) > 0);
int protection_key = ((frame->error & 0b00100000) > 0);
int shadow_stack = ((frame->error & 0b01000000) > 0);
int sgx = ((frame->error & 0b0100000000000000) > 0);
printf("Page fault @ 0x%016llx [ppv=%d, write=%d, ring3=%d, resv=%d, fetch=%d, pk=%d, ss=%d, sgx=%d, wp=%d, smap=%d]", __read_cr2(), page_protection_violation, write_access, user_mode, reserved_bit, instruction_fetch, protection_key, shadow_stack, sgx, arch_get_wp(), arch_get_uap());
```
why not just do: (value & bitmask) == bitmask?
again
both work
okay okay we all have coding styles 🙏
though isnt that technicaly more CPU work 
the compiler will const fold it
oh well
"write and accesed" 😭
oh and
if it's an if
"Kernel process instruction fetch accesed a non-present page"
why not like
"[User Process|Kernel] tried to [read|write|execute] a [non present|read only|no execute] page"

though the kernel has process's
whats the error bit for NX?
User Process|Kernel Task|Kernel
the wiki is arse then
UNHANDLED EXCEPTION [code]
Running in [kernel|user] mode
[Exception name]
(While accessing [address]
[No memory at this location|Memory at this location: [permission flags]])
then i also check if its not others
I jkust like
if(reserved_bit) {
printf("Reserved bit in page table entry\n");
} if(protection_key) {
printf("Protection key violation\n");
} else {
const char* who = user_mode ? "User Process" : "Kernel";
const char* access = write_access ? "write" : "read";
if(instruction_fetch) {
access = "execute";
}
const char* reason = page_protection_violation ? "non-writeable" : "non-present";
if(instruction_fetch) {
reason = "non-executable";
}
printf("%s tried to %s a %s page\n", who, access, reason);
}```
there you go
also @viral bison @rotund furnace i finnaly finexed the nanoprintf stuff
ya happy

gg
Why do I feel like I am not cut out for this at all
I am looking at a bunch of the methods for IPC but I keep running into walls
I was looking into this but then how could a process talk to any other one abratrarily
Like for a VFS server
I guess I can implement the abstract namespace?
is this a microkernel?
I’m looking into such as it seems like a good idea
maybe try shared memory
Thing are still atleast somewhat meldable at the very least for me to change course
im no microkernel expert
I’ve looked into that but they also want a filesystem atleast for POSIX ones
/dev/shm or something
My original plan was a hybrid kernel but if I could go micro it could be nice
Not sure how @rotund furnace Is handling it though
We were talking about IPC
But if I were to do it in a proper POSIX way I’m not sure
if u havent done a monolithic kernel before i probably wouldnt do a microkernel

True
But I have some free time to do some research
I should just do sockets and shared memory
And pipes
Not too hard
tmk managarm doesnt actually follow posix in the kernel, but has a posix server
so maybe dont look at posix for IPC for a microkernel
What

I don’t think POSIX was made for such?
yeh
So managarm has a POSIX server to call for POSIX things and other things use the managarm spesific IPC methods
This makes a lot more sense on why I was banging my head on the wall and getting nothing
💀
Then said server translates some methods or something?
something like that yeah
This makes a lot more sense
Hybrid kernel it is then for now 100%
I want to do POSIX and not bang my head on the wall
oki
Thank you @cyan bison
np
so by this, do you mean monolithic kernel + kernel modules
or just have some drivers in userspace
hybrid kernel is an iffy term imo
interesting
Or audio drivers userspace
i call my shit a hybrid kernel because it has kernel module loading
But like serial or PS/2 would be kernel
Because it’s dead simple
IPC would be more kernel space and VFS stuff would be kernel space because although more complex it’s faster or somthing
And easier to implement
How hard is usb?
God damn
I feel like I have imposter syndrome idk 
My friends tell me I’m smart
But I feel like a total fucking dumbass
u r tht's y
as in
u r smart
whenever i feel dumb i look at stupid questions asked in this server and think to myself "ok nvm"
Do I ask stupid questions?
no
Okay yeah
😭
Maybe I am a little smarter
Than I think
May also be because this server is filled with really smart people
I don’t think a dumbass could get a kernel in this kind of working state. I just have some gaps I need to fill
Nah I don’t think I could ever abandon it

I’m too addicted to coding it
it took me 5 rewrites until i got to my state
Even if it hurts my physical and mental well being
Can I show you my first “kernel” from 2024
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
I made a bit of progress after that
But uhhhh

Thing was a pile of shit and I never used git
In 2025 I then started this one proper
Look at this shit though
This is where I started
And now I am here kinda
i've written worse code.
eggsactly
Learning takes times
indeed
Once I get this kernel to a decent state with x11 and other ports
I may start a new one
I HOPE to have it done end of year
i also would not depend on having your first or second or third revision of your kernel to run these
jokes on you it took me 5 full rewrites before i was able to get bash working

i thought i would get it to work on the third, for reference
indeed
ehmmm
bash doesnt technically need ipc
i mean if you want job control then yeah
Well pipes and shit right
Im on my third and still no bash 😭
i lost track of how many times i scrapped my kernels
fork, exec, pselect, and ttys
mainly
I think I can do this?
pselect might be difficult depending on how your I/O system works
not really without job control
Exec just replaces the current processes right
it should be pretty easy.
yes
im blind
exec replaces the current process indeed
fork makes a copy of the current thread/process
pselect waits for one or more FDs to have an event signaled
(i needed to redo my I/O system to get pselect to work btw)
My kernel is pretty clean in terms of code. So worst case WORST case. It should be okay with some minor reworking
What IO system 
I don’t have one
At all
if all your reads/write are synchronous
and you have no way to get them to not block
then you'll have to make some changes
OR
you could stub pselect
and that'll work until you port something that uses it properly
thank you for making me realize i'm not doing exec right
How would one achieve this
i added asynchronous I/O through IRPs
but what you could do is:
- have a
pollfunction that you can call to tell if a read/write would block - add a
nonblockinganddry_operationargument to the read/write function
so my exec just spawns a new thread in the current process and does some other stuff, and before i added pthreads that was fine because there were no other threads i needed to kill, but i realized that rn if a process has multiple threads and a thread execs the other threads will continue running
What’s an IRP
I/O request packet
although its an uncommon case because usually they fork so they're left with one running thread, its a possibility
And then the driver that handles it gets it?
I only have in ram filesystems
So I’m not sure how that would work?
just do this
Blocking means the process gets suspended right?
if a read/write is non-blocking that means it will never block, and return an error code like EWOULDBLOCK if the operation would block
the dry_operation means that the function shouldn't actually do a read or a write, just if the function would return an error
What does blocking mean exactly
if a syscall blocks it means that the thread will get suspended until something else wakes it (either because the syscall finished and the driver told it to wake up, or a signal interrupted it)
sched_yield 
Well I never do that on file IO

Actualy I’m not sure how I’d making somthing block
If I call that
I assume that it would return back to where it left off?
After running it
@hollow crater my FDs are actually so fucking jank btw
The FD contains a pointer to the file data
And I malloc a part for it
And then copy the entire file there

🗿
im reporting this to the Unix police 
what the fuck
well afaik a sleeping thread is supposed to be able to wait on some event
like u put it on a wait queue
and when that event signals completion
say a mutex, shared resource, driver event etc
the threads waiting for them are then put on ready queues for running
and they just get scheduled as normal (u restore the execution context and continue execution from there)
yeah
I just have a sys_wait syscall
and the thread will block until one of any handle(s) passed in recv some data
everything else returns SUCCESS or WOULD_BLOCK
I have nothing i just have some idea how the shit's supposed to work 
I was lazy 🥀
ehh waa
not even me i have such a stupid impl
or well mine is not even per proc and trash so maybe i shouldnt say anything lol
Mine is per proc 😭
you dont want to see my implementation
its the worst part of my whole OS
100%
How AM I meant to do file descriptors
They link to inodes or some shit
And then that’s part of the backing filesystem?
What if I also told you I could just give it to the pointer in the tarFS file
But I memcpy it instead

for my get initramfs syscall (I know stfu)
I just map it read only in the process
Yes but posix needs read() semantics proper
And apps want that
Or somthing like that
I could probably have it assign inodes to files
And then open() gives then to make a real FD
And then read and write gets managed in the back end there?
I just have a struct with all file descriptors and then when you open smth I assign proc->fds[next_fd()] = file. Then returns next fd to the user and whenever the user does any file op you just access the obj with proc->fds[fd]. Its prob a stupid solution but ye
I feel like that is the best approach for me.
The fd itself is just a number that responds to the place in the list
thats not POSIX compliant
FDs start at 0
How so?
Ohh those are easy
next_fd accounts for them
does it work correctly if you do this? ```c
int fd = open("/path/to/file", O_RDWR);
close(0);
close(1);
close(2);
dup(fd);
dup(fd);
dup(fd);
So when you open smth I will have a switch statement for them lol.
because this is a valid way to set stdout/in/err per posix
Ehmm
alternatively ```c
close(0);
open("/path/to/file", O_RDWR);
Okay might need to reconsider my approach then.
Maybe preallocate them from the start?
do FDs have to go into the lowest posible slot always?
yes
All processes start with 0, 1, 2 allocated, and then everything works as normal.
(i dont follow that)
whats a good way to keep track of this?
((but im sure it's fine))

if i knew, i would be doing it 
No idea I use a expensive for loop :D
Ehh optimizing is a prob for the future won't bother me rn.
future you will be strangling you and me
Ik
wait
also also, regarding fds, keep in mind you need two layers
cant you keep track of the lowest FD you last freed @soft snow ?
Good idea actually.
in the first example i sent, stdout and stderr are different file descriptors but they refer to the same file description (which then refers to the same vnode)
its FD -> file-> inode?
the file description contains things like the seek position
Okay, does that matter?
the descriptor has stuff like CLOEXEC flags etc
yes, consider my_program 2>&1 >log on the shell, if my_program writes to stdout and then stderr, if the seek position is per descriptor and not description the second write would corrupt the data written by the first
Like if my fds are just an array of structs duplicates shouldn't matter right
Ohh
but if you open the same vnode multiple times they have independent seek positions
so it can't be a part of the vnode
and it can't be a part of the file descriptor
so you need a layer in-between
whats the max size of said array
And how do you suggest implementing that?
is it a dynamic one?
Mine is garbage rn I think I keyslammed my keyboard so it's prob something random 734 maybe
i mean it's usually done by having the file descriptions be refcounted objects that are referenced by the file descriptors, and the FDs are what are stored in the array (or whatever DS you pick for it)
And that's global fds
I have to rework it tmrw
So file descriptors are indexes into tables that are per process that hold flags and permission caches or somthing? And they point to an actual descriptor of the file that’s still part of the thread which has seek positions and other things which then links to the backend inode and has function pointers to properly handle the kind of file?
file descriptions are not bound to a process
if i open and then fork, both processes point to the same file description
So would they be global? And newly created for open() calls?
Or rather duplicated per thread spawned by a program on fork()
yeah open et al produces a new one
So FD points to a FDR which points to inode or whatever other backing for it
FD has basic info
FDR has the seek and pos info etc
fork() duplicates FDs and FDRs
fork does not duplicate FDRs
consider a program that forks to execute a subprocess to do something (e.g. make)
And FDs just point there
if i run make >log i want the logs from both make and all the subprocesses to go into the file and for them to not clobber eachother
which requires the seek position be shared for all of them
yeah
And then I can ref count it based on FDs that point to it
And then free() it after
For inodes could I have a union type based on the diffrent backends it could have
Like if it’s to a tarFS or some such
Or if it’s a devFS like file
And then they implement an open() internally that gives the inode to make the FDR to make the FD
the common way to do it is to have a generic layer (commonly called vnodes) that has generic info, function pointers to the impl, and a pointer for impl-private data
That’s what I thought an inode was
inode refers to the on-disk part
So I would have vnodes that have those pointers and then a pointer to impl data that the impl can use which may be an inode
Or some other
although iirc linux has struct inode for vnodes so eh
the sun vfs paper (also linked in #curated-resources) is a nice reference https://www.cs.fsu.edu/~awang/courses/cop5611_s2024/vnode.pdf
Mmm good good
I think I get it now
And vnodes would store like file paths right
And other data needed
Maybe under implementation specific data or some such
no, i/v nodes do not know the file name or parent
because consider a hard link, a i/v node can exist under multiple names in a file system

What holds the name of it for like LSing etc
Well open() would dig its way back to the filesystem
And I guess so would ls()
So that’s irrelevant from the sense of i/v nodes
directory entries
which you read out of a node
(well not literally read, but readdir or whatever)
The inode carries that I presume and an inode can connect to a directory too
And that’s part of the filesystem
And tarfs afaik lacks that?
directories have inodes too
and yes tar does not make a distinction
i think the best way to use a tar for an initramfs is to unpack it into a tmpfs and discard the tar archive?
It may be good to make a tmpfs that gets filled in by a tar file to get proper
Yup yup
That way i could also use other things of archives potentially too
Or even gzipd ones
or rather, tar contains directories, but then directories do not link to children, but the files have paths
and you also get the fs to be writable without needing to mount an overlayfs or whatever (in linux terms)
I would probably use realloc for writing to a file when it seeks beyond it right?
But then i can implement a “real” filesystem
And then that can help me get proper things going
In terms of a VFS etc
well you probably want to track the underlying memory for file data in units of pages
for mmap etc
but yeah on write past the current storage you'd just tack on another data page to the node
Well I’d realloc in page sizes
I could probably use the buddy allocator for this directory too with powers of two
i mean realloc from kernel heap doesn't work
And then HHDM
since mmap maps the file backing store directly into the user's address space
Oh yeah
So I’d want to get from the PMM and then map into other virtual address space
It would be really really ducking bad to have kernel heap memory shoved into userspace?
oh shit 💀
my initrd driver does this
i mean can your kernel heap allocator guarantee the returned memory is page aligned
(but i think it's fine because page cache still acts as a layer on top of that)
Allocate more memory than needed then clamp it

WHUAT
no sorry
i have a uhhhh core 2 duo
i have an i7 but i dont wanna do any crap with it
do you want me to do a CD or USB or whatever
no iso9660??
Oh it uses that
ok im gonna go get my 2006 macbook to write the cd
The ISO file
oh
WHAT
Yes

I read from the initramFS
oh
Which is a tar file
limine does
limonr
lomine
@hazy saddle what hard drive mode do you want me to set IDE or SATA
i assume ide nobody does sata 
(or theres just no hard drive drivers at all)
no disk drivers
I have like a lot more important things to do
does the iso have the doom and bad apple combo
when I do vfs and nvme you can steal from me :P
Also blame @devout path for no disk drivers they promised sata and ext2 
who does it first tho is debatable
o my disc burned
I’m gonna be doing my systemcall rework tomorrow
nevermind the burn failed
And then probably VFS or heap
But the heap although from the other fellow
Isn’t so bad
So
Il leave it

I need a better VFS
never trust 2006 macbook
But yes it includes shareware doom and bad apple

k it says the burn went ok
never trust mac os
also if your fart does EFI boot i have another macbook i can test it on
its a sh-
That’s why I’m not adding any of that fluff shit
fair
Like this is what you have
It’s shit to test the kernel
Not pretending to be a shell even if it’s called that
And I renamed it in other places
set it to 1440 by 900
laptop resolution
ok its still alive
brb
i guillotined it for being too loud 
i also humbly apologize for breathing louder than a nuclear bomb

im gonna go run doom
i have doom video but its compressing
lel
Btw a full version of the game for the WAD is 4 bucks on steam
If you prove to me you own it i will just compile one with it in for you tho
no its 0 

poor keyboard
abuse
its the laptop keyboard somehow
its insanely good for no reason
oh also @hazy saddle
BUGS BUSG(OSIUFG S(OIUBUGSIOU BUGS GBUGS BUGSUG BUGSUGB
BUGS
BUGSSS
With what
That’s intended
what
If your monitor isn’t big enough

And all BIOS systems can’t properly set the resolutions
how big is my monitor SUPPOSED to be
ight
werks
can i do a shameless plug for my service 
nevermind im too ashamed to do a plug 
shameful plug 😔
shameful plug 😔
LETS GOOOOOOOOOOO 
anyway understandable
nice kernel
evalyn os best kernel with best vfs
I do think i need a code name for my kennel

Something cool
What about nova
That’s not taken right
That’s name name of one of my dogs
it has a very interesting backstory it it was an unholy abomination but then it became unholier abomination and now it sucks but it doesnt suck because it cant suck because it's 1984 and opinions are bad 
My VFS is so jankkkkk
But I’m gonna fix it

"i can fix her!!!"
-# AxeialOS evil laugh in the corner
-# msdos crapping itself life on TV
I actually thought about this once and I believe i was able to reach an efficient solution somehow
so
just for the fd numbers btw
and in order to still support arbitrary number of fds
I might do
a dynamic list of bitmaps x free range nodes™
one nice convenience of bitmaps is that u can always allocate the lower most set bit by bitwise tricks
similar to how kernighan's popcount works
bit field & bitfield - 1 zeros the lower most bit (allocates the lowest bit)
then __builtin_ctzl the original field value and get the index of that bit 
(u can also rely on better specialised instructions for bit scanning when possible anyway)
- width * field index and thats the index into the bitmap
all are cheap af™ operation so its so fastt
but we all know bitmaps are still expensive
like
for a cap of 10k fds (whichs pretty sane for real world installations, afaik)
u will have to have about 1/3rd of a page per process
enters the chaining part
so say bitmaps will be allocated as blocks of some arbitrary but fixed size
say
64 bytes
each block can start with an intrusive list node and some flag bit to indicate whether this is a range node or a bitmap node
a range node just has 2 fields for start and limit
and it describes a range of free fd numbers
since we are always allocating the lowest free index the range here can be arbitrarily set (and ig for most unixes put there thats actually the case o_O)
now for a process u can start with one bitmap node describing range from 0-511
then followed by a free range node describing 511-maxcap
when the bitmap gets full it can then carve out 512 fdns from the range node amd insert the new bitmap in between the used up bitmap node and the free range node
now as used up and freed up bitmap nodes accumilate they will sure make traversal slower
holy walls of nerdly text 🤓
but u can coalesce them
both totally used and totally free ones
since upper free nodes wont ever get used again until the lowermost free index is used this woukdnt incur much penalty
and but it might be a little more expensive freeing an fd index when its block was coalesced into a used range blob
so im not sure if coalescing contiguous used ranges is worth it (actually I think it is o_O, and u can minimize the extra overhead here by backing this by 2 object caches instead of one lel, one for free bitmap blocks (initialised to all 0), and another for full ones (initialised to 1s) so that its cheap to allocate for either cases, also obviously a third for the range nodes too maybe)
now checking if a bitmap is used up is relatively cheap
and u can always set up a flag for making it even cheaper
and the list wont get too long mostly due to fragmentation bc of the nature of fds (we always allocate lowermost bits, whichs also why i believe multiple specialised lists arent strictly necessary and might even be bad)
tho pathological patterns would still be there
but despite that
a 1kB overhead and 100 iterations as an upper boundary for handling 10k dispersed fdns doesnt seem that terrible as a worst case
for some other numbers like pids tho, just increment a u64 and call it a day 
yk I get very obviously autistic sometimes 💔 🥀
its actually very simple
and cheap too
i didnt read ur message its just a wall of text
wall of text = hard impl
u can always still use some general purpose allocator here still
cc vmem 
but I believe vmem would be an overkill for such scenario
oh one last note is that tbe list of nodes must be sorted ofc
but u will get that nearly for free in this case anyway
this shit is also very similar to my nalloc (naive allocator) thingy
it doesnt rely on bitmaps tho only specialised lists of range nodes
also just for fun I could also have a version where i can also allocate and search for contiguous sequences 
tho I could only have that without having an significant extra penalty by capping the maximum requested sequence to 64 :P
fdn allocators dont have to support that anyway but it was kinda fun thing to do
thats all for the number allocator tho
first time ever hearing about the multilayer thingy 💀
also nice convo on fds, vfs and memory mapped files overall ✨
so
til
Yeah I learnt a lot. I learn alot better via text discussion than papers tbh
But basicsly @hollow crater a linked list of bitmaps?
Honestly N is so low it’s not that bad tbh?
And you skip many many sections
Though using a similar allocator to vmalloc with an RBtrrr isn’t a bad idea 
yes plus to coalesce contigious blocks of completely used up/free bitmaps to accelerate the list traversal a little bit
and since we always allocate the lowest index it shouldnt be that bad to coalesce
mm except it should incur expensive memory footprint no?
u always allocate units of 1 per allocation
oh wait u mean the bitmap blocks thingy
if so then yea
although
say we have someone cap their fdns to 10k
then u have around 1kB maximum
which is about 20 nodes or so
so I think an rb tree there wouldnt be that much better than the proposed list 💀
due to the overhead of balancing etc when its just 20 nodes maximum
mind that a program usually uses MUUUUCH less than 10k fds
so i dont think an rbt is worth it here
True true
Also @hollow crater i wonder for my tmpfs if i should just make an ext2 driver in memory

Or make my own simpler filesystem
But one that uses like linked lists for blocks of files
So I don’t need contiguous memory
idk shit bout fs/vfs stuff
🥀
well just very little 


I think il make my own filesystem for that
Il call it llfs
Linked list filesystem

sounds cool
and on memory filesystems should be simpler afaik so
kewl
There is a linked list of all the files and directories and special files etc
And then they have a pointer to a linked list of all the blocks
And then the blocks store all the data

too much Ls, where r the W's 🥀
All Ls
This will be kinda shit

Wait where do I know where to store things and what blocks are free
I could do a free list but like then I can run out of space
Every block could have a header with info
And then I scan blocks for free ones?

@soft snow How did you do your tmpfs
mmm
maybe the blocks should instead be like radix tree-esque instead of an ll 
You see
I am lazy
Very fucking lazy
understandable 
And I must get away with the least effort possible
Why do you think I stole my friends VMM and PMM even though it was so shit

Look at the difference between my impl and the old one

I literally havent moved a cursor (similar to the "havent placed a pen" expression) in my codebase for few days even though I literally have nothing else to do 
peak laziness
😭
aight lemme open that on a larger screen here eh
I spent all day yesterday brain storming IPC and repairing this laptop
Oh and VFS stuff too
ts no smp friendly 
There really isn’t even any IPI for tlb shootdowns tho 
Lowkey I am gonna have to do a huge rewrite for SMP anyways partly too
Soooo
I’m putting that off until my bash port 
fairenuf
Bash port will be my beta1 milestone
And then disk drivers are beta2
And x11 is beta3 until it gets stable enough for a 1.0
well as someone who's decided to defer thinking about locking/concurrency stuff until i have threads i understand this decision 
ooooooo
idk i dont think ill ever do anything userspace related before i get smp and some fancy drivers running here :P
Each block in the VFS has a read, write, lookup, etc linked to the vfs. Then the tmpfs uses normal inode.
My doom and bad apple all run in userspace 
no usb? (xhci) o_O
That will be 2.0 prolly 
And I will be doing usb 2.0 and 3.0 controllers


With an mlibc port working fully
good luck with that lel
How do you handle files that need to expand more than one page
Wait couldn’t I have the fs spesific data for the vnode contain the linked list of blocks?
That way it’s seperate from the system and its easier?
Then I just append to that list
well thats actually pretty impressive
i like how i know more about kernel space than userspace stuff 
absolute cinema
Honestly same 
I don’t do much C userspace shit
Or rather stuff that uses the c standard library much
I did do a rv32i emulator in C

Anything touching the C standard library is a fucking mess that I used AI and made sure it worked because I’m fucking lazy as shit
And partly same for my uservice project

Like the actual core was a breeze
ive actually had very little experience doing userspace at all 
i did very little python and cpp
well some java for school too but eh
ive mostly read in embedded/systems dev more
not that any of this amounts to much anyway 
😭
I mean it works 🥀
And I like made sure it worked 🥀
And validated the code 🥀
AI is a tool and you gotta use it right

It was nice for a shit ton of boiler plate too
@soft snow Does this sound right?
and since its a tool i can have a choice to just not use it without it being forced on me
(a statement thats becoming less true every day nowadays
)
Exactly!
I do not use it unless I want to
That’s why I use Linux
And that shit stays in its own tab
And not in my fucking IDE
🤮
And I barely even open it tbh

@hollow crater what’s your opinion on this
I wana make sure I’m not being dumb when doing this

ig the interface for traversing whatever data structure u use to group blocks should be fs specific
sooooo
expose a function pointer and call it a day 
(assuming i understand the problem pointed to here correctly)
vnodes have function pointers and a pointer to filesystem spesific data
And in that fs specific data I could store said linked list about the blocks
And then I PMM allocate the blocks to get a fully aligned page
So I can MMAP them properly too
@hollow crater smart right 
i wanna use kate but it works in mysterious ways
In what ways may I ask
mmmm yea
but afaik shouldnt it instead point to the backing inode
i mean i could be dumb but like
i dont think pointing to the data directly is what a vfs node is supposed to do .-.
idk the lsp is doing funny things
There is only one minor annoyance I have but I work around it once
Clang LSP?
real
and rust analyzer
yeah that shits a bitch and you have to have a global config file for the LSP
And I have to swap it in and out
Idk what else I’m meant to do

i used Kate once upon a time it was interesting
pretty sure it has per project configs too
I mean for the LSP. I didn’t know how to give it a path to the config properly 😭
oh
i wanna get quick at using helix/vim but it has such a high learning curve for advanced shit
The inode is part of the backing filesystem
The vnode file system spesific data may be info for the file system to get the inode
The vnode is the kernels inode for the VFS
And my tmpfs may just not have the concept of an inode for this and handle it a bit differently
Like a hard link may just make two vnodes point to the same FSspesific data
Though I don’t need hard links or symlinks for this rn prolly
ohhhhhhh
i think i get it :P
FD points to an FDR which has the seen data which points to a vnode
The vnode has the function pointers and a payload of data for the VFS etc
This way many FDs can point to the same file and work properly
And the FD handles information like if it was opened as RO etc
ye i get that part
i was confused about the role of vnodes overall and how it interfaces with the underlying interfaces (fs/devices/sockets etc etc)
Also wait this system is so much fucking smarter
Because I don’t need to O(N) search though everything
It’s o(1) with this
Because they all know the node they point to after opening etc
never open it, forget about it and be happy frfr
True
But I like making myself fucking pissed off and wasting my time

use microslop copilot 
STACK OVERFLOW

actually no there its just "possible repeat of ..."
r/osdev 
a
boooooooom
got me "bomboozled"
I swear to got that place has some of the most insane projects/people
reddit users are talented asf
and have 180IQ
finnaly time to get back to work
i do wonder for the VFS how i should route open() calls
i could have filesystems have a registered prefix?
and if the prefix matches it goes there
ans then chroot could be as simple as moving/swapping prefixes
openat
and then open just calls openat with NULL
to signal root
or cwd
but what if you want /dev or /mnt/usb or somthing
open("/dev/tty0") works fine
openat("/dev/", "tty0") also works fine
i mean for many filesystem types mounted on the system
my devfs may not be the same as tarfs
or procfs
my fs just has a link to the fs specific func
so close("/dev/tty0") will do node_tty0->close();
but open() needs to get the node
yea
and all fs nodes will still need to register with the main fs.
or vfs
so devfs could register under /dev
then open("/dev/ps2/kbd") will goto devfs->open()
that way they manage thier nodes under thier belt
if you solve it like that ig that could work
i didnt do it like that
i mean all filesystems could register all files to the one registry
that way open() knows where to go
and not need that extra inderecrtion?
thats what i do rn anyways with a linked list
some VFS stuff i see
Yes because Devfs and Procfs are Pseudo Filesystems
rn is syscall rework but that has some CFS stuff
this is super not POSIX

im just gonna organize these
so the swicth case just calls a function
why a nop inst?
because my IDE was complaining about not having c23 and label crap
and a NOP works
but i forgot about blocks 
{}
what, i use C11
my rv32i emulator just uses blocks instead of stupid add nops
i see
so i just slapped a bandaid to make my IDE stfu
i mostly do "disable squiggles" for that file if it's complaining alot
or just restart intellisense 
i mean it is technicaly an issue 
Just do label:;
fair that makes more sense for vars defined in a switch case
i am 100% gonna need a /dev/fb to MMAP on later
i wonder how id implement that through VFS?
because these can 100% become MMAP and an IOCTL later
just do case x: {} ??
