#EvalynOS
1 messages · Page 22 of 1
Did this work after two hellos?
Because it beaks if you do
echo “whatever”
Then
echo “test”
If the second one is shorter
And help and then help breaks
I wonder how it patched the bashrc thing
Kk
why r u printing \n if it is received
for terminal echo?
yes
u dont do it unless echo is enabled in the termios
unless u of course do not have ttys
yeah well i have no VFS or termios ot ttys
💀
im trying to fake it til i make it rn
you still can have termios because termios set and get is sysdeps
sure. but i CBA when i can just set a sane default it wants
:p
i dont think this is a termios thing?
why are you return EACCESS
tf

worst open impl which i saw in my life
local osdev has no tty and no vfs and expects bash to just go with the flow
Hey hey
It kinda works

And I don’t expect bash to use FS stuff rn
That’s why I only do bultins
I don’t expect it do work*
I expect fucking echo to work
And help
And for it to not collapse in on its self
because bash sets termios to change the output and echo behavior
then get a goddamn vfs
after bash
idk what's up with this lasting joke about u procrastinating ur vfs
cuz it was funny like 3 weeks ago now ur just not making good decisions concerning ur kernel
put it first then
im too far in deep with bash
riight
i made bets
so if it runs and compiles just call it a day
there were no specific terms were there?
it needs to like be somewhat stable obb
LGTM
.
True
u dont have sufficient termios flags implemented (as in none at all)
so fixing that by the end of the week would force you to rush your vfs
mhm
Okay so
I need to make a fucking TTY
That accepts termios

And then it should work magically
What termios does bash want even?
bash just needs a raw shell iirc
at the least it needs to be able to disable echoing characters on input
I’m giving it a canonical line buffered thing
I dont really remember what it needs u could check your host
Because it didn’t echo etc
I could also just printf whatever shit it gives

True
I just think strace bash is a lot easier than printing the termios syscalls
because then u have to recompile mlibc and all
I mean il just implement it so my kernel gets the call and print there
points to a context switching bug
gl
Like
This looks strange
🥀
My context switching should be fine
Doom and shit runs fine
And stress tests
And it should crash way more crazily
btw the fact it recheck for bashrc probably means it is restarting
like from the entry point I mean
But it dosnt trip mlibc sysdep madness
It would be printing a lot of other BS
If it was a full full restart
id investigate what sysdeps mlibc complains about
Mostly VFS stuff
iirc bash might need the dup2 syscall
That it returns ENOSYS on automatically
u really cant be doing this without a vfs
i know how mlibc works dw about me
Ahh
Damn
Idk how it even got this far
Should I do a proper TTY layer this time
Then VFS
And I will just adhoc it in until the VFS is ready
gl
I mean for when stuff gets printed to ir
And it echos
Or is that for the layer behind
Eg flanterm
man termios.3 and figure it out
should be easy™
I put my full trust in the manpage's judgment
That command didn’t eork
what do u mean bash doesnt print the sysdep shit
when it restarts
it literally does
I was making a joke
And that’s diffrent sysdep shit
It depends on command
🥀
least cursed bash port:
If I just do where
Enter
It prints this
@viral bison if you manage to figure this out still lmk
thats not bash thats rash
I fixed it

what the
ohh shi leaked some discord servers
rip
well there you have the discord servers im in
@hazy saddle is there a way to actually see the build output and not just get loading when building with jinx?
or should i rephrase
do you see your building process when building with jinx without meson, or is that just a global thing with jinx?
Why not
Jinx is just for ports
not for kernel
true
Also I don’t even make jinx build it
Look at my root makefile
And follow the chain of commands
(Though it can)
hahaaahahaahahahahaha bro made a kernel shell 👈 😆
I will rend you apart
Also it’s not really a shell
Just for debug commands
🥀
Like it launches bash
And launches doom
"not" a shell
bash can do that right
wait rly
crazyyy
The only thing userspace can VFS kinda
even my shitty os has it
what is all bash builtin commands btw
Run help
fixed?
were going to make counter gave up after 5 min
i have US keyboard on the OS so yall can use it
but me myself use swedish keyboard
so writing shit is impossible.
Damn
do they have a keyboard layout file which holds the keyboard layout or what?
I guess
its done by xorg
evdev just sends ps2 scancodes for keyboard
me ow
well technicaly generic bitmap allocator time first :p
for FDs
then i need to archetcture a proper VFS
it should be FD which points to an FDR which points to a vnode

yeah id also want a dirent cache for open() etc
so i can traverse the FS etc
dont overengineer it :v
but fd's and the file table and the vnodes can just point directly after resolotuion
im doing the normal UNIX VFS :p
the vnode should also track what things MMAP'd it
for the page cache i think
that way i can do reclaimage easy
yay bitmap user
wait. there is even a WAITPID
still happy
@lzcunt mentioned
💀
Also I may end up using the C23 built in or clz
Because it isn’t supported on older CPUs
3:
lyneve os
It’s going to properly support SMP from the start
And gonna do proper hardware abstraction
So I can port to loongarch64
I’m possibly going to start with the PMM
and making a buddy allocator
A good one
And then making my paging code not be a mess
And making proper abstractions for it
Like paging_get_next_level(table, index)
And il have propped asserts for things and error handling
And il try and make a good kernel and take it slow
And not burn myself out
The first step will be to do a GDT Init OK
As is tradition
Tomorrow
Or this afternoon possibly
And I’m not going to use that fucksss font anymore
And possibly get better logging functions and systems to start
I will possibly reuse some things from this kernel
On the new project
Like the build system
Oh and il properly make it work on gcc and clang
Rewrite is going well so far
Getting the basic structure crap setup
With proper arch abstractions
I won’t fill them all in
But it should be enough
It’s now up enough to boot
I am considering a name change
So I will take ideas
Preferably RuneScape related
I’m gonna clean up a bunch of this
And get loongarch working
I also need to refine the panic thing I half assed to make UBSAN work
(To make it arch specific)
Then I’m gonna get CPU local working on both
And then gonna make the PMM and paging code later
Get a decent heap going
Then scheduling
Etc etc etc
I should then be able to bring up mlibc and userspace
Then il work on a real VFS
(This includes SMP)
meow
Coolio 
Meow
needs a few tweaks
but its lookin good
This is finalized I believe
I do hopefully hope to make sure panics won’t happen that much
Because il make things stable

Now I just need to make this support loongarch64
Good thing everything is arch abstracted
So it shouldn’t be that bad
I just need to save and restore interrupts for the spinlocks
Because flanterm has one from the start this time
Because I concern myself with thread safety
And then implement the assembly stub to push registers to the stack
I think I should add a proper RFLAGS parser to this
Mainly for the important bits atleast
also an i686 port or other 32bit architectures may not be off the table
But I will not be designing around that for now at least
32bit is pain
Exactly
If it ends up not being too big of a deal with my current abstractions sure later
and there isn’t really a point in it
Especially in satans year 2026
deafbeef 
That’s normal :p
today im gonna work on finishing up the first bit
and do the x86-64 IDT/GDT
and loongarch64 exceptions
exception handlers will be arch specific but will call hooks for things where needed to make things work
and il try and abstract IRQs as much as i can
then il work on the PMM
then paging
since im using a buddy allocator
well going to make one
to bootstrap things i will use a tiny bitmap allocator just to setup page tables and the pfndb
And I will make a generic bitmap thing so it can expand its size when it’s about to be empty
Eg pick largest memory region in the system to use for this
Take the first page and make it into a bitmap struct
Then when it needs more if ever it can allocate the past page and link it to the end
for that you could just bump allocate from the mmap

idk why water/wux said to use a bitmap
also
GDT INIT [OK]
This code is hella copied (from old kernel)
Except I abstracted it so non BSPs can allocate from the memory management and crap
Well they should be able to with this
You pass in the array and a pointer to the TSS to the functions
being this
For the IDT it will mostly be the same and it will jump to an arch specific common handler so it can dispatch to internal exceptions or generic driver code registered to an interrupt
And I will pre fill all 256 entries of the GDT IDT which may be annoying with how I do it but eh
Just 256 function calls

So I can catch any inerrupt
And I’m just filling them in with stubs
i love this
Do you like the loongarch64 port?
hell yeah
Also thank you ^^
np!
Il try and keep the loongarch64 port on parity where possible after getting things working on x86
and then once things look good il look into riscv
my condolences
do aarch64 and become arm developer haters
waow
I’m gonna properly take in all exceptions
And not get a fucking “unknown exception” and get screwed

do a loop
yeah I don't think you can use ; for comments in gas
make an array in asm (with a macro loop)
that is an array?
Or rather make the array in assembly?
Ahh yeah yeah
Lowkey I’m gonna support FRED again too
From the start
I have to lmfao XD
I will redesign some stuff around this
To make it work much nicer
FRED il do after i get loongarch64 interrupts
All that’s left for my first commit is gonna be to port my UART driver
Because I want UART lowkey
UART will be part of early arch unit for x86 too as it will do an initial setup for debugging
And then later set it up as a device for userspace and unhook the kernel logging
Aswell I am considering having a dedicated frame buffer thread that will take control of flanterm so things can print to it and not break even on slow frame buffers
And I can serialize things better like the cursor blinking by having separate qeues
And I can serialize entire lines as filling a buffer is way cheaper
Honestly
This rewrite isn’t going so bad
Who know knowing how to kernel dev
Makes it go by so fast

And I have code I can refer to and tweak for the new systems
Yup I can pickup every single exception right
I may also tweak some things
Later tho once I have the schedular
Where only exceptions save all registers
So it can panic with a full dump
But devices should only need me to save a few registers
Omg it looks so cool!!
ty :3
im working on my rewrite rn
so not alot of stuff is implemted rn

i had bash sorta ported before
just with a ton of hacks
so im doing a rewrite with stuff done proper
rippp i hope it will go smoothly :3
it is
anyways did you make a custom bootloader for EvalynOS or did you use a mainstream one?
kewl :3
i want to do this with spamton
Lmao it’s for the greater good dw

Gah I should rlly work on my os project but im still at the bootloader stage…
thats why you dont make a bootloader to start
I actually did work on my own sorta bootloader
Though it’s a MB2 shim
So you boot it with MB2
Then you put your kernel as a module
And it does higher half mapping and shit for you
Though I need to fix the protocol a little
Because I made some mistakes
It’s legit the same as making a kernel but even more annoying

Bleh
atleast I finished it last week and I can go work on the kernel :3
I would also support Limine
As an option
Just incase some hardware has issues your loader dosnt handle
https://github.com/TeamSHIRO/KURO/tree/elf-loading-alpha
if y’all are interested 
il take a look in a bit
Btw
You should support UBSAN

It will crash your kernel if you do any fucky wucky C code
And same for SSP
It’s basically free to add the runtime support
Undefined behavior sanitation
And stack smashing protector
The compiler adds checks to see if you do u defined behavior
And if it sees it it will run a function
That you can set to panic
Which can save your butt
Nice :3
it doesn't always work
It did make me have to do this
Good to have it than not
Y’all know everything lol im such a newbie
Given its free
not the heart reaction ._.
But it’s not on the bootloader side, right?
the bootloader and kernel could use it
You just have to compile the files into the binary
Then add these flags
-fstack-protector-all \
-fsanitize=undefined \
you can also just do -fsanitize-trap=all
Somtimes it’s nice to seperate them though
it works
I also statically allocate a 4kb stack for the BSP ISTs
And statically allocate the BSP IDT/GDT
Just so I can always have proper exception handling
Which will be very good when debugging other stuff
Lowkey
I could use a buddy allocator for my heap
But running ontop of the PMM buddy
To have smaller subdivisions
Which honestly

I’m fine with
Also I could maybe do NUMA awareness too
And spawn a separate buddy per NUMA node
And if one node is OOM it can goto other nodes
Just as a basic NUMA awareness implementation
you could but then you have to parse ACPI before you have a heap (or pfa per say as you want a NUMA aware one)
i could do a bootstrap allocator like i am for the buddy anyways
and personally, I have had enough chicken and egg problems in my Mm to deal with more.
and then move it over and reclaim
but you can.
you have a temp bootstrap allocator?
il do NUMA later
like one that allocates pages?
wow.
just bump allocate off the MM for the page tables and pfndb
I just ended up only doing permanent allocations before the PfnDb and slub were online.
yeah fair, so I guess the allocator becomes strictly illegal once you have the pfndb built?
how do you handle mapping of the database?
lowk in my next design ill just thread a freelist intrusively and then after pfndb is setup ill rethread them into there
do you do zones or sparse mappings?
Il do a virtually sparse for all pages
And il have it being zeroed be the non initialized state
yeah I do the same.
wait what?
Then when the buddy comes arround to using them it can set them up as needed
like you zero init all the pages when booting?
So I don’t have to fill in every pfndb entry?
or what do you mean.
Oh right nvm
😭
Wait no
When I allocate a physical page
I zero it
So when I’m backing the PFNdb
That state can be considered init
like your pfndb entry (pfn lets say) will be valid in a fully zero state? I might be super confused, I think I am not understanding what you are doing.
I am a little stupid.
Yes
When I setup the buddy
Then it will do thoes
I’m going to lazy init the pages
uh sure
So if you have a large chunk o’ ram
I mean as in. Il only register pages into it lazily into the 2mb section or whatever it fits
Same as I do with my old kernels free list
I think that's what I do as well? I just put all of them onto the free list and once I need them I zero the pages on demand... and if any zero'd pages are free I push them onto the zero'd list.
ok nvm i completely don't understand what you mean.
Maybe?
xd
like the bootstrap one?
The full PMM
how does your pmm work?
https://git.evalyngoemer.com/evalynOS/evalynOS/src/commit/e469e9581f5c0583e3618935ff4e936a88cdacd8/kernel/src/memory/pmm.c#L54
https://git.evalyngoemer.com/evalynOS/evalynOS/src/commit/e469e9581f5c0583e3618935ff4e936a88cdacd8/kernel/src/memory/pmm.c#L141
but so when you go to lookup a buddy in the pfn are u checking if it is 100% zero? and what happens when it falls outside of the sparse array
is it a buddy freelist?
Il use a safe dereference function to return an error if it’s outside
like one big freelist of all of the regions from the memmap?
how do you tell
okie.
If it page faults
The page fault will redirect to an error handler
I suppose its rare enough where that isnt a perf issue at all
how does a pfndb miss even happen?
well no it would happen if you look for a buddy that doesnt exist, I solved this by populating every page with a "max order" so they never attempt to
shouldn't all valid pages have their entry ?
oh wait is that the thing you are doing?
That never happens
demand creating pfn entries?
how
MMIO isn’t in pfndb
ok i am completely lost gg.
in a buddy you lookup buddies blindly
unless u have a regions list that u check against to see whether the buddy falls outside of the region
Sure. But that physical page will exist in the pfndb
if its sparse it might not
But then there is no backing physical memory
Eg it won’t be in the buddy
When I parse the memory map
And add things into it?
And the allocator functions its self ?
The only time it would happen
lets say u have page 0x49000 and it wants to know whether to merge with its buddy at 0x48000
how do u tell
Is if I valid values get passed
if that buddy is in the allocator
It’s valid physical memory so I check the pfndb
no lets say its not
Otherwise they wouldn’t get added
lets say the region starts at 0x49000
Oh fuck

I suppose yeah
Because it’s not that often of a case
what I do is I poipulate a "max order" for all pages
Call an assembly function to probe it
along with the order
and so that page would have a "max order" of zero
and so it would never attempt the merge
Eg the max order is the order it was originally added as?
its just calculated at init to figure out what is the max order it can be before it attempts to merge with non-usable memory
another thing u can do is have regions
and bounds check
True
the max order system consumes quite a bit of memory cuz for me at least its 3 bits per pages
I’m doing orders between 2mb and 4kb
yeah, but neither it is in the buddy, why would you try accessing the pfndb range in mmio regions...
i don't understand :(
If you try and free memory
When cleaning up page tables etc
so 4 bits for order
oh wait your pfa allocates multiple pages?
yeah, so it's in userspace region.
You may accidentally get some MMIO into your buddy if you don’t check
or you mean if the kernel maps it?
like you try to free it?
The kernel maps the frame buffer into userspace offen
Yes
How would what happen?
you allocate virtual address space and the pointer somehow turns into a physical one, then into a pfn index and make its way into the free function?
When you reclaim memory from a user process. You get back all physical memory you gave it
You walk its page tables to resolve the physical addresses
you have Vads.
And then you free the backing physical memory
to know what type of memory it is.
what...
Sure you can do that too
ok i see.
You can convert a virtual address into a physical address
thats not ideal
so you only track regions via page tables?
What do you propose
Vads.
You still have to walk the tables at some point
Maple tree.
for anon regions, store an rbtree or something with the pages in there
💲
or maple sure
maple.
same shit
Yeah I can do that. Then walk page tables for known regions
why walk page tables?
you just walk the page tables to free the higher levels when destroying the address space.
Less memory usage than storing all the physical regions describing the pages in an annon region or shared etc
you don't want to blindly free the pte's as they might be used by other processes.
are you sure that it's worth it and not a micro optimization?
Walking a page table isn’t horribly expensive
And I destroy processes asynchronously anyways
well at least in my impl its free
because once its in use its frees up the link node of the buddy
so I can use it for threading the pages into the anon one
holy misstypes
The annon region maybe be large or oddly sized based on how userspace asks for memory
doesnt matter?
Then it becomes “not free”?
why?
the pfndb has static size
fixed to the page count * sizeof the struct
and if u have to have a link node in the page struct for the buddy or freelist anyway
and u dont need it when the page is in use
it is free to union it for the rbtree or mapletree node as long as they are the same size
(any page in an anon region is in-use)
yes
i don't.
the rbtree that contains all of the phys pages
I store that in the address space object
and i don't get why you would want to do that.
Which is why I don’t want that to describe fragmented physical pages
Which is why I would do the cheap cost of walking the page tables and a PFNdb resolve
what do you mean by this, describe in what way?
what is the goal of all of this?
like what is the thing this brings you?
In order to reclaim the memory?
ok.
i think I understand now.
and your system makes complete sense.
idk why I was so confused.
So when reclaiming the memory I walk the page tables and check the pfndb and change ref count or free if needed etc
if I understand correctly you do the most normal thing ever.
lol
yeah.
my bad.
why bro is rewriting
Because my old code is kinda bad?
And I’m wanting to get a fresh clean state
And not make certain mistakes I had
@hazy saddle look at this
it should make mem operations way faster
or well, it did for me
I already do rep movsb and rep stosb
I don’t even check for EMRS
It’s still been faster than all naive C copies
And it’s beaten every other non SIMD method on my machines
😭
Me and mint and a few others did some benchmarks
My machines are just straight up built diffrent
💀
ooof
HOW
Etc etc
XD
Ofc relative
But like
Yeah XD
My kernel will just use it regardless
And it will use it regardless on the assembly failsafe version for userspace copies
Because it’s easier to implement
Did you use TCG by accident?
What’s your allocator looking like
tcg has a lot of problems with my map and allocation functions for some reason
Oh also
Maybe?
I wonder if it’s just slow memory allocation and C++’s hidden calls?
i dont have ghidra installed rn to check a dissasembly
yeah but its alot easier esp for mangled C++
i might ask in general then
maybe use a CPU local here instead of two+? function calles?
wdym, put the kernel ctx in a local cpu thing?
also generaly you can just use one context for the kernel necause its the same mappings
CPU local varribles? you know what that is right
i am
ye
then why two function calls when you should be able to use the same instance and hard code the reference
the calls just return the var in the kernel class
im just saying calls & maybe virtual method calls can kill performance
in my old C++ kernel with a few friends UACPI had similar issues
so maybe cache the ref?
are you sure your timer code is correct btw
because those numbers dont look valid
even for slowest impl on earth
under kvm it should be faster
yeah idk, a check may help XD
Maybe use the kvmclock?
Is this a challenge /silly
i am
lol
anyway, caching the ctx ref did not help
i think the optimizer already took care of that
I just need to finish up loongarch64
And make it have the early arch init callback

And then it’s all good for a good first commit
bruh you haven't commited until now?
that's not a recommended use of git
Yeahhh
welp loongarch64 is backkk
Why is it not working

Wait maybe I need to update Limine
On this laptops install
Because base revision 6
Let’s go
after code review it’s gonna be time for release
And then I’m gonna work on my PMM/Paging
I think for my VFS vnodes will contain pointers to the backend function implementations so for /dev/fb0 it will get routed to the /dev vnode cache and find /fb0 inside of it
And then that can contain its own MMAP implementation for that file
And for this kernel as soon as I have a basic userspace running and crapping out hello world and exiting and cleaning up etc
And on SMP
Il do my VFS
tf did u do to ralsei 😔
Ralsei powers my kernel
He is disappointed it crashes

stalin reborn as a ralsei plushie
I am going to rename the old repo to EvalynOS-old and make a new repo under the old name
And then get my code pushed
Then work on the bootstrap PMM & paging code when I stop feeling like dookie
My old repo is a mess
looking at you 20mb C header file of bad apple video data
Which is why I don’t think il make it a branch
Any other future rewrites will be on a branch

Because my git history won’t be a mess
i think the main branch il call /dev and then later il add the /main branch to squash dev and put onto main when things look good for releases
crap you reminded me i accidentaly rm -rfed mine outta existence
bro uses a vmm for malloc 💀
use a slab allocator, a dalloc or smthng
;-;
bro use dmalloc
or use a buddy alloc
That's how you usually do it...? It's just that you don't call it directly and instead use some intermediary allocator, like a slab one
i dont reccommend it btw
complete rewrite?
Mostly
A bit is reused here and there with a bit of changes and fixes
I see your adding aarch support
Nope
Loongarch64
Hopefully that port isn’t left behind horrible

It will atleast make me have good abstractions
For later etc etc
💀 we doing apples to oranges here
FRED is so back
Thanks to tomato and Claude there is now a set of patches that allow it to support FRED
These patches can be applied onto this commit
Signed-off-by: Peter Maydell [email protected]
They are vibe coded as fuck
But they work
And it runs faster than SIMICS
And it works on both without any changes so I somehow fixed it

But
This is pretty cool
New evalynOS will be getting FRED support soon ™
But I had to go back to the old project to test this and get this working
after a make install and a symlink it can be invoked like this
qemu-fred-system-x86_64 -cdrom ./evalynOS.iso -cpu max,fred=on,lkgs=on -M q35,accel=tcg -m 2G
Hopefully these patches can be cleaned up later and kept up to date with QEMU releases
But it will have to stay out of tree

Why
Where did it say that?
And the patches are fully vibe coded because nobody I know can work on the QEMU codebase good enough
Can you send a link
Scroll down here
Thanks
Np
freed
ehh i vibecode half my patches anyways
its fine
i steal half from astral and then vibe code the rest
well
i think cleaning this up for submission is not too feesible
so i am going to work on paging
i wonder though
Can I make paging so generic
That it’s arch agnostic
And just needs an architecture defined file to say the parameters
ehhh
i dont think its that worth it

hey fred
yup
and now there is a decent emulator for it
atleast until QEMU makes a full implementation

these patches can atleast be a stopgap
oh i thought fred was somebody lol
even if vibe coded 
nope its very very new CPU features my kernel supports
:3
kewl
ah really? Coolio 
god why did i go to osdev as a web developer lolllll
so complicated lmao
yes
sombody vibe coded up some qemu patches
maybe I'll try adding support for it to my OS then 
em vibe coders
its random patches to get emulation support for a feature
its hardly anything vital/critical
and SIMICS is the real deal emulator
its just thats much slower and annoying to work with for devekupment
so having a stopgap set of patches is useful
plus the QEMU codebase is not very easy to traverse by hand FWIW
The radix page tables part yes, definitely. The PTE I generate over two arch functions make_leaf/make_dir for those platforms



