#EvalynOS

1 messages · Page 22 of 1

viral bison
#

and it failed the build, oooof

#

i hate that it's not CLion compatible XD

hazy saddle
#

Damn

viral bison
#

so it can't really check the errors

hazy saddle
#

Do you have bear?

#

You can run the make command with that

#

And it will fix LSP

viral bison
#

btw, how do i make a patch after?

hazy saddle
#

Just give me the files it changed

#

My working tree is messy as FUCK

viral bison
#

well, progress

#

i have to go home now, so cya later

hazy saddle
#

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

viral bison
#

Ah

#

I just tried 1

#

After i'm home i'll try

hazy saddle
#

Kk

cyan bison
#

why r u printing \n if it is received

hazy saddle
cyan bison
#

yes

#

u dont do it unless echo is enabled in the termios

#

unless u of course do not have ttys

hazy saddle
#

yeah well i have no VFS or termios ot ttys

#

💀

#

im trying to fake it til i make it rn

wanton grove
#

you still can have termios because termios set and get is sysdeps

hazy saddle
hazy saddle
#

:p

hazy saddle
wanton grove
hazy saddle
#

its a byproduct of some other crap

#

ah no its this

cyan bison
#

tf

hazy saddle
wanton grove
cyan bison
#

local osdev has no tty and no vfs and expects bash to just go with the flow

hazy saddle
#

Hey hey

#

It kinda works

#

And I don’t expect bash to use FS stuff rn

#

That’s why I only do bultins

cyan bison
#

huh

#

well of course bash does fs stuff

#

everything does fs stuff

hazy saddle
#

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

cyan bison
#

yuh

#

well first get tty

hazy saddle
#

i dont have a VFS to work with TTYs

cyan bison
#

because bash sets termios to change the output and echo behavior

#

then get a goddamn vfs

hazy saddle
hazy saddle
cyan bison
#

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

hazy saddle
#

its on my todo list

cyan bison
#

put it first then

hazy saddle
#

im too far in deep with bash

cyan bison
#

not really

#

git stash

#

done

hazy saddle
#

im also not eating an onion

#

for not porting bash

#

end of week

cyan bison
#

riight

hazy saddle
#

i made bets

cyan bison
#

so if it runs and compiles just call it a day

#

there were no specific terms were there?

hazy saddle
#

it needs to like be somewhat stable obb

cyan bison
#

LGTM

hazy saddle
cyan bison
#

im a pro osdev i approve of this bash as ported

#

tty problem not bash

hazy saddle
#

True

cyan bison
#

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

hazy saddle
#

I just return ENOSYS when it writes to write termios

#

🥀

cyan bison
#

mhm

hazy saddle
#

Okay so

#

I need to make a fucking TTY

#

That accepts termios

#

And then it should work magically

#

What termios does bash want even?

cyan bison
#

bash just needs a raw shell iirc

#

at the least it needs to be able to disable echoing characters on input

hazy saddle
#

I’m giving it a canonical line buffered thing

cyan bison
#

I dont really remember what it needs u could check your host

hazy saddle
#

Because it didn’t echo etc

hazy saddle
cyan bison
#

your problem

#

your solution

hazy saddle
#

True

cyan bison
#

I just think strace bash is a lot easier than printing the termios syscalls

#

because then u have to recompile mlibc and all

hazy saddle
cyan bison
#

ok do that then

#

or dont

hazy saddle
#

Yeah

#

Sorry

cyan bison
#

its good

#

I need to go i have a train to catch

hazy saddle
#

Idk why bash restarts and shit tho?

#

Idk

cyan bison
#

points to a context switching bug

hazy saddle
#

Well not a restart restart

#

But it reprints it’s no job control complaints

cyan bison
#

gl

hazy saddle
#

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

cyan bison
# hazy saddle

btw the fact it recheck for bashrc probably means it is restarting

#

like from the entry point I mean

hazy saddle
#

But it dosnt trip mlibc sysdep madness

#

It would be printing a lot of other BS

#

If it was a full full restart

cyan bison
#

id investigate what sysdeps mlibc complains about

hazy saddle
#

Mostly VFS stuff

cyan bison
#

iirc bash might need the dup2 syscall

hazy saddle
#

That it returns ENOSYS on automatically

cyan bison
#

u really cant be doing this without a vfs

cyan bison
hazy saddle
#

Ahh

hazy saddle
#

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

cyan bison
#

gl

hazy saddle
#

What should the TTY thing do?

#

Like keep track of the cursor and shit?

cyan bison
#

no

#

not at all really

hazy saddle
#

I mean for when stuff gets printed to ir

#

And it echos

#

Or is that for the layer behind

#

Eg flanterm

cyan bison
#

man termios.3 and figure it out

#

should be easy™

#

I put my full trust in the manpage's judgment

hazy saddle
cyan bison
#

when it restarts

#

it literally does

hazy saddle
#

And that’s diffrent sysdep shit

#

It depends on command

#

🥀

cyan bison
#

least cursed bash port:

hazy saddle
#

If I just do where

#

Enter

#

It prints this

#

@viral bison if you manage to figure this out still lmk

true oak
soft snow
hazy saddle
#

🥀

#

@warped ermine

#

Yeah it works now lol

soft snow
#

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?

hazy saddle
#

Wait

#

Why are you making meson call jinx?

soft snow
#

Jinx is just for ports

#

not for kernel

hazy saddle
#

Jinx can build the kernel

#

Meson isn’t really designed for this like that

hazy saddle
#

Also I don’t even make jinx build it

#

Look at my root makefile

#

And follow the chain of commands

hazy saddle
hazy saddle
#

Just a bit more work

#

Before people can’t laugh at me for a kernel shell anymore

soft snow
hazy saddle
#

Also it’s not really a shell

#

Just for debug commands

#

🥀

#

Like it launches bash

#

And launches doom

soft snow
hazy saddle
#

You can’t even run help

#

Or do any shell like things

soft snow
hazy saddle
#

Nope

#

No fork

#

And no VFS

soft snow
hazy saddle
#

Yeah

#

Like

soft snow
#

crazyyy

hazy saddle
#

The only thing userspace can VFS kinda

soft snow
#

even my shitty os has it

hazy saddle
#

Is stuff from the tarfile

#

Stdin and out are hard coded to go through syscalls

soft snow
hazy saddle
#

Run help

viral bison
hazy saddle
viral bison
#

gg

#

what was the problem?

hazy saddle
#

Somthing with the sysdeps giving bad data to the kernel

viral bison
#

oh

#

lol

soft snow
#

i have US keyboard on the OS so yall can use it

#

but me myself use swedish keyboard

#

so writing shit is impossible.

hazy saddle
#

Damn

soft snow
#

and keyboard layouts

hazy saddle
#

evdev

#

And locale settings etc

soft snow
hazy saddle
#

I guess

wanton grove
#

evdev just sends ps2 scancodes for keyboard

warped ermine
#

_

hazy saddle
#

it works ;3

#

okay so

#

its VFS time

sterile plank
#

me ow

hazy saddle
#

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

sterile plank
#

dont overengineer it :v

hazy saddle
#

but fd's and the file table and the vnodes can just point directly after resolotuion

hazy saddle
#

the vnode should also track what things MMAP'd it

#

for the page cache i think

#

that way i can do reclaimage easy

true oak
round shoal
#

wait. there is even a WAITPID

hazy saddle
#

There is a time and a place for a bitmap

true oak
#

still happy

hazy saddle
#

I’m also gonna make mine fast

#

By using CPU intrinsics

kindred stirrup
#

@lzcunt mentioned

hazy saddle
#

💀

#

Also I may end up using the C23 built in or clz

#

Because it isn’t supported on older CPUs

#

3:

round shoal
#

lyneve os

hazy saddle
#

Considering doing a rewrite

#

One that has a little more thinking put into it

hazy saddle
#

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

hazy saddle
#

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

hazy saddle
#

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

hazy saddle
#

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

hazy saddle
sterile plank
#

meow

normal turret
#

Coolio sigmapepe

hazy saddle
hazy saddle
#

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

hazy saddle
hazy saddle
#

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

urban mulch
#

32bit is pain

hazy saddle
#

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

hazy saddle
#

Loongarch64 port is done

#

It’s on feature parity

true oak
hazy saddle
hazy saddle
#

It’s called a stack smashing protector

#

And of course it’s gonna be in the registers

hazy saddle
#

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

floral kettle
hazy saddle
#

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

hazy saddle
#

And I’m just filling them in with stubs

neon karma
#

re-read your message lmao

#

I was so confused

hazy saddle
#

😭

#

Fuck

#

I meant IDT

#

I’m too GDT INIT OK brained

marble ridge
hazy saddle
#

Do you like the loongarch64 port?

marble ridge
#

hell yeah

hazy saddle
#

Also thank you ^^

marble ridge
#

np!

hazy saddle
#

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

marble ridge
#

my condolences

hazy saddle
#

I have friends that will want me to do riscv wahhgone

#

Hopefully it’s portable enough

wanton grove
hazy saddle
#

I’m gonna properly take in all exceptions

#

And not get a fucking “unknown exception” and get screwed

neon karma
hazy saddle
#

and im using nasm

neon karma
#

yeah I don't think you can use ; for comments in gas

hazy saddle
#

is there a better way to do do this in C

neon karma
#

make an array in asm (with a macro loop)

hazy saddle
#

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

hazy saddle
#

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

pseudo wedge
hazy saddle
#

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

pseudo wedge
#

rippp i hope it will go smoothly :3

hazy saddle
#

it is

pseudo wedge
#

anyways did you make a custom bootloader for EvalynOS or did you use a mainstream one?

hazy saddle
#

i used to have one

#

but i replaced it with limine

pseudo wedge
#

kewl :3

hazy saddle
#

btw oh god that printf is cursed

#

but i must for ralsei

wanton grove
pseudo wedge
hazy saddle
pseudo wedge
#

Gah I should rlly work on my os project but im still at the bootloader stage…

hazy saddle
#

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

hazy saddle
pseudo wedge
#

atleast I finished it last week and I can go work on the kernel :3

hazy saddle
#

I would also support Limine

#

As an option

#

Just incase some hardware has issues your loader dosnt handle

pseudo wedge
hazy saddle
#

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

pseudo wedge
#

hm who is ubsan..

#

what**

hazy saddle
#

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

pseudo wedge
#

Nice :3

hazy saddle
neon karma
#

it doesn't always work

hazy saddle
#

It did make me have to do this

hazy saddle
pseudo wedge
#

Y’all know everything lol im such a newbie

hazy saddle
#

Given its free

pseudo wedge
#

not the heart reaction ._.

hazy saddle
#

This is what my kernel does

#

You don’t even need a .h file for it

pseudo wedge
#

But it’s not on the bootloader side, right?

hazy saddle
#

the bootloader and kernel could use it

#

You just have to compile the files into the binary

#

Then add these flags

pseudo wedge
#

Okay :3

#

thanks a lot

hazy saddle
#
    -fstack-protector-all \
    -fsanitize=undefined  \
neon karma
#

you can also just do -fsanitize-trap=all

hazy saddle
#

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

languid geyser
hazy saddle
languid geyser
#

and personally, I have had enough chicken and egg problems in my Mm to deal with more.

hazy saddle
#

and then move it over and reclaim

languid geyser
#

but you can.

languid geyser
hazy saddle
#

il do NUMA later

languid geyser
#

like one that allocates pages?

hazy saddle
#

yes

languid geyser
#

wow.

hazy saddle
#

just bump allocate off the MM for the page tables and pfndb

languid geyser
#

I just ended up only doing permanent allocations before the PfnDb and slub were online.

languid geyser
#

how do you handle mapping of the database?

rancid viper
#

lowk in my next design ill just thread a freelist intrusively and then after pfndb is setup ill rethread them into there

languid geyser
#

do you do zones or sparse mappings?

hazy saddle
#

And il have it being zeroed be the non initialized state

languid geyser
#

yeah I do the same.

languid geyser
hazy saddle
#

Then when the buddy comes arround to using them it can set them up as needed

languid geyser
#

like you zero init all the pages when booting?

hazy saddle
languid geyser
#

or what do you mean.

hazy saddle
#

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

languid geyser
#

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.

hazy saddle
#

Yes

rancid viper
#

where are you storing the linked list nodes for the buddy

#

then

hazy saddle
#

Then it will do thoes

#

I’m going to lazy init the pages

rancid viper
#

uh sure

hazy saddle
#

So if you have a large chunk o’ ram

rancid viper
#

but wouldnt you want to merge them all

#

asap

#

and balance out the buddy

hazy saddle
#

Same as I do with my old kernels free list

languid geyser
#

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.

languid geyser
hazy saddle
#

Maybe?

rancid viper
#

xd

hazy saddle
#

On my old freelist

#

I don’t add every node right away

languid geyser
#

like the bootstrap one?

hazy saddle
#

The full PMM

languid geyser
#

how does your pmm work?

rancid viper
#

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

languid geyser
#

is it a buddy freelist?

hazy saddle
#

My old kernel

#

Is a normal free list

hazy saddle
languid geyser
languid geyser
#

okie.

hazy saddle
#

The page fault will redirect to an error handler

rancid viper
#

oof

#

alright

hazy saddle
#

If it was from that safe function

#

So PDNdb misses can be detected

rancid viper
#

I suppose its rare enough where that isnt a perf issue at all

hazy saddle
#

Yeah it only happens if you try and free MMIO

#

Which is rare

languid geyser
#

how does a pfndb miss even happen?

rancid viper
#

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

languid geyser
#

shouldn't all valid pages have their entry ?

#

oh wait is that the thing you are doing?

languid geyser
#

demand creating pfn entries?

rancid viper
hazy saddle
hazy saddle
#

The page won’t get passed out

#

If it’s not in the buddy ever

languid geyser
#

ok i am completely lost gg.

rancid viper
#

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

hazy saddle
rancid viper
#

if its sparse it might not

hazy saddle
#

But then there is no backing physical memory

rancid viper
#

yes

#

exactly

hazy saddle
#

Eg it won’t be in the buddy

rancid viper
#

but how do u tell what is in the buddy

#

that is the issue

hazy saddle
#

When I parse the memory map

#

And add things into it?

#

And the allocator functions its self ?

#

The only time it would happen

rancid viper
#

lets say u have page 0x49000 and it wants to know whether to merge with its buddy at 0x48000

#

how do u tell

hazy saddle
#

Is if I valid values get passed

rancid viper
#

if that buddy is in the allocator

hazy saddle
rancid viper
#

no lets say its not

hazy saddle
#

Otherwise they wouldn’t get added

rancid viper
#

lets say the region starts at 0x49000

hazy saddle
#

Oh fuck

rancid viper
hazy saddle
#

Then I can just take a safe deref

rancid viper
#

I suppose yeah

hazy saddle
#

Because it’s not that often of a case

rancid viper
#

what I do is I poipulate a "max order" for all pages

hazy saddle
#

Call an assembly function to probe it

rancid viper
#

along with the order

#

and so that page would have a "max order" of zero

#

and so it would never attempt the merge

hazy saddle
#

Eg the max order is the order it was originally added as?

rancid viper
#

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

hazy saddle
#

True

rancid viper
#

the max order system consumes quite a bit of memory cuz for me at least its 3 bits per pages

hazy saddle
#

Il come to that when it’s time to start it up

rancid viper
#

and order is also 3 bits

#

for me

hazy saddle
#

I’m doing orders between 2mb and 4kb

languid geyser
#

i don't understand :(

hazy saddle
#

When cleaning up page tables etc

rancid viper
languid geyser
#

oh wait your pfa allocates multiple pages?

hazy saddle
#

If you happened to map some in there

#

Like say something MMAPd your frame buffer

languid geyser
#

yeah, so it's in userspace region.

hazy saddle
#

You may accidentally get some MMIO into your buddy if you don’t check

languid geyser
#

or you mean if the kernel maps it?

languid geyser
hazy saddle
#

The kernel maps the frame buffer into userspace offen

hazy saddle
languid geyser
#

the virtual address?

#

how would that happen.

hazy saddle
#

How would what happen?

languid geyser
#

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?

hazy saddle
#

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

languid geyser
#

you have Vads.

hazy saddle
#

And then you free the backing physical memory

languid geyser
#

to know what type of memory it is.

hazy saddle
languid geyser
#

ok i see.

hazy saddle
rancid viper
languid geyser
#

so you only track regions via page tables?

hazy saddle
languid geyser
#

Vads.

hazy saddle
#

You still have to walk the tables at some point

languid geyser
#

Maple tree.

rancid viper
languid geyser
#

💲

rancid viper
#

or maple sure

rancid viper
#

same shit

hazy saddle
languid geyser
#

why walk page tables?

#

you just walk the page tables to free the higher levels when destroying the address space.

hazy saddle
#

Less memory usage than storing all the physical regions describing the pages in an annon region or shared etc

languid geyser
#

you don't want to blindly free the pte's as they might be used by other processes.

hazy saddle
#

Which is why you check the pfndb

languid geyser
hazy saddle
#

Walking a page table isn’t horribly expensive

#

And I destroy processes asynchronously anyways

rancid viper
#

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

hazy saddle
#

The annon region maybe be large or oddly sized based on how userspace asks for memory

rancid viper
#

doesnt matter?

hazy saddle
#

Then it becomes “not free”?

rancid viper
#

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)

hazy saddle
#

What?

#

So your storing the anon rbtree node in the pfndb

#

???

rancid viper
#

yes

languid geyser
rancid viper
#

the rbtree that contains all of the phys pages

hazy saddle
languid geyser
#

and i don't get why you would want to do that.

hazy saddle
#

Which is why I would do the cheap cost of walking the page tables and a PFNdb resolve

languid geyser
#

what is the goal of all of this?

#

like what is the thing this brings you?

hazy saddle
#

In order to reclaim the memory?

languid geyser
#

ok.

#

i think I understand now.

#

and your system makes complete sense.

#

idk why I was so confused.

hazy saddle
#

So when reclaiming the memory I walk the page tables and check the pfndb and change ref count or free if needed etc

languid geyser
#

if I understand correctly you do the most normal thing ever.

hazy saddle
#

lol

hazy saddle
#

It’s all good

#

If you ever feel dumb

#

Look in #osdev-misc-0

round shoal
#

why bro is rewriting

hazy saddle
#

And I’m wanting to get a fresh clean state

#

And not make certain mistakes I had

viral bison
#

it should make mem operations way faster

#

or well, it did for me

hazy saddle
#

I already do rep movsb and rep stosb

viral bison
#

oh

#

lol

hazy saddle
#

I don’t even check for EMRS

viral bison
#

you should

#

it can be used to optimize

hazy saddle
#

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

#

💀

viral bison
#

ooof

hazy saddle
#

Like zen5 its worse

#

Zen3 it’s better

#

Zen1 it’s better

viral bison
#

HOW

hazy saddle
#

Etc etc

hazy saddle
#

😭

viral bison
#

XD

hazy saddle
#

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

viral bison
#

also, for some reason the uacpi performance is atrocious

#

idk why it's so bad

hazy saddle
#

Did you use TCG by accident?

viral bison
#

no

#

kvm

hazy saddle
#

What’s your allocator looking like

viral bison
#

tcg has a lot of problems with my map and allocation functions for some reason

hazy saddle
#

Oh also

hazy saddle
#

Mobsb is generally always better

#

Even on unaligned iirc

viral bison
#

it depends tho

#

i think with non ERMS

#

mvosq beats it

hazy saddle
#

Maybe?

hazy saddle
viral bison
#

idk

#

a second pair of eyes will help, lol

hazy saddle
#

i dont have ghidra installed rn to check a dissasembly

viral bison
#

you can disassembly with linux commands

#

using specific ranges

hazy saddle
#

yeah but its alot easier esp for mangled C++

viral bison
#

i might ask in general then

hazy saddle
#

maybe use a CPU local here instead of two+? function calles?

viral bison
#

wdym, put the kernel ctx in a local cpu thing?

hazy saddle
#

also generaly you can just use one context for the kernel necause its the same mappings

hazy saddle
hazy saddle
#

then why two function calls when you should be able to use the same instance and hard code the reference

viral bison
#

the calls just return the var in the kernel class

hazy saddle
#

im just saying calls & maybe virtual method calls can kill performance

#

in my old C++ kernel with a few friends UACPI had similar issues

viral bison
#

so maybe cache the ref?

hazy saddle
#

also maybe use a slab allocator

#

verses going to the VMA constantly

gentle quest
#

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

viral bison
hazy saddle
#

Maybe use the kvmclock?

hazy saddle
viral bison
#

i am

#

lol

#

anyway, caching the ctx ref did not help

#

i think the optimizer already took care of that

hazy saddle
#

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

neon karma
#

bruh you haven't commited until now?

hazy saddle
#

Nope

neon karma
#

that's not a recommended use of git

hazy saddle
#

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

hazy saddle
#

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

fiery tangle
hazy saddle
#

He is disappointed it crashes

true oak
hazy saddle
#

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

hazy saddle
#

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

hazy saddle
#

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

hazy saddle
#

Crap I need a readme

soft snow
round shoal
#

use a slab allocator, a dalloc or smthng

hazy saddle
#

Why are you necroing this just to clown a person

#

:p

round shoal
#

bro use dmalloc

#

or use a buddy alloc

clear bison
hazy saddle
#

you kinda have to at some point

#

we are so back

soft snow
hazy saddle
#

A bit is reused here and there with a bit of changes and fixes

soft snow
#

I see your adding aarch support

hazy saddle
#

Nope

#

Loongarch64

#

Hopefully that port isn’t left behind horrible

#

It will atleast make me have good abstractions

#

For later etc etc

full fern
hazy saddle
#

finished the PMM

#

gonna do paging tomorrow or in a day or two

hazy saddle
#

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

#

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

hazy saddle
# hazy saddle

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

gentle quest
hazy saddle
#

And QEMU dosnt accept AI code

gentle quest
#

Where did it say that?

hazy saddle
#

And the patches are fully vibe coded because nobody I know can work on the QEMU codebase good enough

gentle quest
#

Can you send a link

hazy saddle
#

Scroll down here

gentle quest
#

Thanks

hazy saddle
#

Np

soft snow
#

its fine

#

i steal half from astral and then vibe code the rest

hazy saddle
#

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

pseudo wedge
hazy saddle
#

yup

#

and now there is a decent emulator for it

#

atleast until QEMU makes a full implementation

#

these patches can atleast be a stopgap

pseudo wedge
#

oh i thought fred was somebody lol

hazy saddle
#

even if vibe coded trl

hazy saddle
#

:3

pseudo wedge
#

kewl

normal turret
pseudo wedge
#

god why did i go to osdev as a web developer lolllll
so complicated lmao

hazy saddle
#

sombody vibe coded up some qemu patches

hazy saddle
#

apply to qemu and compile

#

and it should work mmLol

normal turret
#

maybe I'll try adding support for it to my OS then trl

pseudo wedge
hazy saddle
#

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

slate meadow