#EvalynOS

1 messages · Page 24 of 1

gentle quest
#

Like its great for generating solutions to tiny limited scope problems, but anything requiring greater context is gg

hazy saddle
#

Yeah, that’s why I only ever really use the web panels and paste relavent shit in and then see what it shits out for me to fix / if it did the thing right

#

90% of the time it falls flat on its face 💀

#

But somtimes it makes something workable

gentle quest
#

Yep

urban mulch
#

With the non-reasoning models? By good question.

#

That said

#

I just tried claude opus (I think it was called that?) and if you gently steer it in the right direction it can really help you build faster

#

Doesn't work if you don't already know how to do the thing you're doing though

hazy saddle
urban mulch
#

yea so

#

the paid shit is actually good if you know how to use it

hazy saddle
#

Fair

#

Good thing I’m never paying for it

urban mulch
#

lol

hazy saddle
#

I’m only on it to be a freeloader to be lazy when not wanting to make 10 lines for a calloc function because I have malloc already

urban mulch
#

if in the distant future you can afford it though, I'd definitely say it's worth trying

hazy saddle
#

I’d rather still keep having fun programming on my projects tbh

signal plaza
#

I'd like my OS to be AI optimized but not by using ai trl

urban mulch
#

well point is you have it do the boring tedious gruntwork

signal plaza
urban mulch
#

lmao as if your hobby kernel is gonna have more than 0.05 external contributors on average

signal plaza
hushed oracle
soft snow
signal plaza
hazy saddle
#

well its now only ~0.01 to ~0.02 seconds slower than gunzip!

#

just gonna do a bit more tweakings

#

then get the docs made and release it

hazy saddle
#

library is done

#

I already have it implemented into the old kernel

#

I’m gonna clean that up a bit and push it since having it support it is nice

hazy saddle
#

There may be more that can be done

#

But for the tiny library it is, it’s pretty damn good

#

It compiles under C99 rn and C89 and K&R / unixv4? Support may be added later with the optimizations though unixv4 and K&R may have to be a seperate branch

neon karma
#

I'd use the one in limine

#

it's considerably faster than anything that's available

hazy saddle
neon karma
#

kamila wrote her own

hazy saddle
#

Ah

#

Well where is it trl

#

I know mine was approaching gunzip in userspace tests

neon karma
#

see the limine repo

#

it's in the readme iirc

hazy saddle
neon karma
#

bruh

hazy saddle
#

Nvm it’s in the decompressor folder

#

💀

neon karma
#

it's literally there

hazy saddle
#

But only on the noLLM branch

neon karma
hazy saddle
#

How tf did I miss that

neon karma
#

skrill tissue

signal plaza
#

Time to steal some paging code troll

hazy saddle
#

also im micro optimising the FRED path

#

By shamelessly stealing from the compiler codegen of course

#

What’s a movezx?

#

No fucking clue

#

But it works

haughty acorn
hazy saddle
#

Just looked it up lol

#

Makes sense

#

I don’t need that on the IDT path since it pushes a full word for the vector

#

Now this wont work if I use extended features of FRED

#

Like NMI source reporting etc

#

But this does work for now

hazy saddle
# haughty acorn move zero extend

I do wonder. Is zigs inline assembly powerful enough to properly align a function to a page and make another function at an exact offset from it?

haughty acorn
hazy saddle
hazy saddle
haughty acorn
hazy saddle
#

Oh yeah true

#

And then I can push things back into one unified frame?

#

And make FRED push a dummy vector

haughty acorn
#

yeah

#

and just you can switch on the flag for fred later to use the extra stuff in cs and ss or ignore it otherwise

#

thats legit what im doing

hazy saddle
#

Then if fred == on { decode the vector and fill it in on the stack and continue }

haughty acorn
#

yep

hazy saddle
#

Why didn’t I think of that

haughty acorn
#

(except im using inline asm in the fred thunk to do the decode and fill bit hopefully, its just a shr and a movzx)

hazy saddle
hazy saddle
haughty acorn
#

mhm

hazy saddle
#

Without a shr

#

It just grabs the byte directly

haughty acorn
#

oh true you can stack offset

hazy saddle
#

Since its aligned

haughty acorn
#

well the aligned doesnt matter

#

its a byte

#

well ig you mean bit aligned

#

yeah

hazy saddle
#

Yes bit aligned

#

Because they have a possibility for extentions to go beyond 256 vectors

#

So that may need a bit of extra decoding

haughty acorn
#

now the only annoying bit is detecting syscall stuff

#

since otherwise those are hitting vectors 1 and 2

hazy saddle
#

its just this

haughty acorn
#

mhm

#

oh wait thats bit aligned too huh

hazy saddle
#

Yes

#

The Intel engineers were pretty smart

#

Let me go do this rework

#

oh i can even push a diffrent value based if it was a CPL3 vs a CPL0 from fred

#

this is a mess

#

decoding it in the asm is prolly best

#

or with a C shim?

#

actually

#

this isnt too bad

#

Good use of Goto aswell?

haughty acorn
#

id just use an else block personally

#

but ig it works

hazy saddle
haughty acorn
#

yeah ig

hazy saddle
#

oh! this will also be nice

#

because in the non FRED path i can check if its from CPL3 and swapGS

neon karma
#

makes it easy to search for them later

hazy saddle
hazy saddle
haughty acorn
#

mhm

hazy saddle
#
  • it means its not a wasted push
hazy saddle
#

Paging is a very fundamental concept and is meant to be a barrier to entry for getting into this hobby

#

As it makes you understand alot of concepts

hazy saddle
#

That’s fucking insane

#

Once zig stabilizes I really should just try and get past it and learn

haughty acorn
#

did this and then bulk is a comptime string with the bulk of the handling

hazy saddle
#

Don’t waste a single byte

haughty acorn
#

maybe

hazy saddle
haughty acorn
#

oh and btw my offsets from rsp are computed by the compiler

hazy saddle
#

zamn

signal plaza
hazy saddle
#

Ahh

#

I hope my new paging code is nice for you to read

#

It does have some limits to keep in mind that I left in due to performance stuff

signal plaza
hazy saddle
#

Eg it’s a pain to do merging and splitting of pages

hazy saddle
#

(They haven’t been made yet)

haughty acorn
# hazy saddle zamn

the movl andl shrl andl blob might be wrong btw, the intent there is to put the fred vector in dx and (hold on i just found a mistake in there) the type field in bx, and then set bit 31 of the vector if its a syscall and put it in the vector field of the struct (and also leave in rdx for the dispatchy bit)

hazy saddle
#

Because then it also zeros the upper part of the register

#

And if you use the 16 bit reg it may not work

haughty acorn
hazy saddle
#

Ahh

#

I wonder if doing the decoding in zig would be better?

#

And let the compiler optimize it heavily

haughty acorn
#

probably

#

but i cant replace only prolog and epilog so itd need to be its own function

#

and the compiler i dont think can inline into inline asm

#

so it wouldnt be inlined which i kinda want here

hazy saddle
#

i get away with this

#

i dont know if you can fully inline all the dispatch?

hazy saddle
haughty acorn
#

is i have a vtable for the exception vectors

hazy saddle
#

I was also planning a function pointer and syscall table, but having things still be in C is nice

haughty acorn
#

mhm

#

imo for this it isnt too bad

#

its basically just

  • if bit 31 is set go to syscall entry
  • if its less than 31 go to the vtable
  • if its 0xDF go to the apic spurious handler
  • otherwise go to the main irq dispatcher
hazy saddle
#

My thinking is if you add syscalls and the other various things you get into the realm where a higher level language is nice & the compiler can still make perfect optimizations in that case minus the extra function call (or two in syscalls spot but that is very minimal compared to the rest of a syscall)

haughty acorn
#

mhm

hazy saddle
#

Btw thank you @haughty acorn for letting me know I could just push an extra thing trl

#

And not need the jmp garbage

haughty acorn
#

np lol

#

it makes it so much easier yeah

hazy saddle
#

i think this is validated enough

#

il be pushing later™

#

and prolly work on either slab shit or printf shit

haughty acorn
#

yeah that looks good to me

hazy saddle
#

Because if I have a custom printf I can also make custom formatters for certain objects

#

It will be another combo single header & non single header library

#

So it can be integrated however you need

#

Though for this one I can imagine it being non single header is nice since I make it very easy to add custom formats

#

Only downside is I don’t wana parse IEEE crap

haughty acorn
#

see for this I just use zig std format and it's great and works on its own lol

hazy saddle
#

And this library will be made with no AI help (I somtimes use it for random debugging or whatever rarely) and I CBA to learn IEEE floating point shit

haughty acorn
#

yeah no for osdev you can probably ignore ieee

hazy saddle
#

Exactly

#

Il still add the hooks for it though if somebody wants to talk cheap send patches

#

And the format parsing fortune X.Y part

haughty acorn
#

mhm

hazy saddle
#

machine check exceptions are so fucking dumb omg

#

so it basicaly sends it to all cores by default i guess?

#

and i need to add a flag that says "hey im processing an #MCE just return"

#

i think this right now is fine though? since the parsing wouldnt fuckup other cores

#

intel

#

why

#

well this dosnt matter

#

since im not running this on i686 rn

clear bison
hazy saddle
#

welp its good enough for non SMP at least

#

Il just add an extra SMP flag so if it is mid #MCE handling other cores will just return and let the core that’s handling it right now decide to panic & broadcast etc

clear bison
#

Btw if i get a C compiler running on my arch you might be able to make an port for it meme

hazy saddle
#

I will probably make a port for it after my loongarch64 one isn’t stub city 💀

hazy saddle
#

Meow

sterile plank
hazy saddle
#

This is working!

#

Well atleast good enough to not crash

#

Just by enabling it

#

Maybe I should add extra logging for stuff

hazy saddle
#

Welp it works on Intel and AMD

haughty acorn
#

well thats good

hazy saddle
#

I wonder if there is a way I can have this trigger an MCE on real hardware

tender mantle
#

as I said

hazy saddle
tender mantle
#

wiggle your ram a little

hazy saddle
#

I’m not wiggling my ram on this expensive of hardware

#

😭

#

Go wiggle your ram @tender mantle

tender mantle
#

I'll run it and unplug a ram stick from my old pc

#

I doubt it would mce

#

it's just funny

hazy saddle
#

Wiggle it first to try and get an MCE

#

Then yank it

tender mantle
#

wait

hazy saddle
tender mantle
#

ram is WAY to expensive to be doing this shit rn

hazy saddle
#

It’s already been done

#

Your doing ts now

#

It’s DDR2 or 3 or some shit

#

That’s still cheap

#

And prices have been going down

#

@tender mantle lmk when your done

hazy saddle
#

I am unable to make a #MCE generate on hardware

#

Even using a special AMD only MSR

#

That lets you make a watchdog timer for instructions taking longer than 31us

#

To trigger a #MCE

#

🥀

#

And @tender mantle yanked ram and wiggled it

#

Nothing

haughty acorn
#

do you enable MCE in cr4?

hazy saddle
#

im gonna try this to slow the cpu down so bad

#

the watchdog may trigger

haughty acorn
#

gl

hazy saddle
#

this crap is so cursed as its only on AMD

#

#define MSR_AMD_MCE_WATCHDOG 0xC0010074
the MSR btw

gentle quest
#

oh nice

#

why do u need the wathcdog?

hazy saddle
#

its the only way i can trigger an #MCE without hardware damage 💀

gentle quest
#

oh i thought u were doing more interesting things lmfao

hazy saddle
#

if an instuction takes longer than 31us to complete it should give an MCE

#

XD

#

i am also making some MCE handling stuff

gentle quest
#

usually a watchdog is used to detect hard lockups

hazy saddle
#

technicaly it is but on an instruction level basis

normal turret
#

what's an MCE?

hazy saddle
gentle quest
#

how can an instruction take longer than 31us?

hazy saddle
#

means your CPU is toast

gentle quest
#

nah

normal turret
#

ah KEKW

gentle quest
#

not necessarily

hazy saddle
#

well its somtimes recoverable

gentle quest
#

its not masked with cli

hazy saddle
gentle quest
hazy saddle
#

Hm?

gentle quest
#

its not tied to how long an instruction takes

#

its just a timeout after which the watchdoing is going to fire

#

and you're expected to prime it before it fires

hazy saddle
#

There is no prime MSR

#

💀

gentle quest
#

(if doing lockup detection)

gentle quest
hazy saddle
# hazy saddle

This and the other screenshot is all the docs in the AMD manual

gentle quest
#

its like a oneshot lapic timer

#

but you're supposed to reset it before it fires

#

and if you dont u consider yourself stuck

hazy saddle
#

So where do I need to write this mmLol

gentle quest
#

usually in the periodic interrupt for example

#

if it doesnt fire that means u have cli for too long

hazy saddle
#

thats not existing for this watchdog

gentle quest
#

am i really that bad at explaining

#
void timer_tick()
{
    touch_watchdog(); // rewrites the same value into the MSR
    sched_tick();
{
hazy saddle
#

no? this is a special watchdog. not with LAPIC oneshot. i know how that works

gentle quest
#

...

hazy saddle
#

What 😭

gentle quest
#

you have a periodic timer in the kernel right

#

for preempting threads

hazy saddle
#

This is my rewrite, I haven’t gotten yo that yet. I ended up on a side quest with machine check exceptions and I’m trying to test them on real hardware

gentle quest
#

yeah but you will have one right

#

eventually

hazy saddle
#

This is a special that can specifically generate a #MCE

#

Yes ofc

gentle quest
#

yes

#

just forget about the watchdog for now

#

so

#

you have a periodic timer

#

you can consider that timer a heartbeat of your kernel

#

but without a watchdog

#

if you skip a heartbeat

#

or flatline

#

there's nothing to catch that

hazy saddle
#

Yes

gentle quest
#

if you arm a watchdog, you're guaranteed that not generating a heartbeat (that does wrmsr(watchdog, fire_in_1ms)) will fire the watchdog MCE

#

and if that does get fired

#

you realise that a heartbeat was skipped

#

because no one rearmed the watchdog

#

so it expired and fired

#

does that make sense?

hazy saddle
#

Then why isn’t it triggering at all?

#

Yes it does make sense

gentle quest
hazy saddle
# hazy saddle

And for some reason this specialty is talking about instruction execution?

#

i do set a thing here

gentle quest
#

can u link that spec btw

hazy saddle
#

search for CPU Watchdog Timer

#

or PDF page 762

gentle quest
#

dont think they even use this

#

maybe it is specifically a hw debug msr, not the software watchdog

hazy saddle
#

Yeah it’s some really strange thing I found when trying to see what can generate an MCE

#

The Intel manual partly mentioned it but dosnt refer to the MSR at all

#

and it just #GPF's under KVM

#

as well it dosnt emulate it

gentle quest
#

@hazy saddle perf events seems to be the way to do NMIs on x86

#

and its how linux does a watchdog on x86

hazy saddle
#

ahh yeah true

#

but the main thing im trying to do is see what happens at all when i get an #MCE since they are so uncommon

haughty acorn
#

I mean nmis are easy since you can just set delivery mode on apic things, mce is harder

gentle quest
hazy saddle
#

maybe? but i dont think thats considered a "true" #MCE with stuff i can parse etc?

gentle quest
#

u want like literal hw bugs?

hazy saddle
#

yes lol

gentle quest
#

the easiest way is to get a broken mobo where half of pci transactions fail

#

lol

hazy saddle
#

i sadly dont have one

haughty acorn
#

what's the vector? cause iirc the apic won't trigger vectors 0-16 or something like that

hazy saddle
#

0x12

haughty acorn
#

ok so it's above 0x10 so apic can ipi that vector

gentle quest
#

what info do u currently parse on mce

hazy saddle
#

weather its fatal & to panic or to log it and move on

gentle quest
#

i hope your printf is reentrant lol

hazy saddle
#

it takes a lock on putc trl which is why i am gonna make a proper log buffer later™

gentle quest
#

make a log ring like all of us lol

hazy saddle
#

thats what i meant

gentle quest
#

ye

#

maybe simics has a way to generate mces

#

or bochs

hazy saddle
#

i can generate them in QEMU, and they work as expected

#

was just wanting to verify real hardware

#

but idk if i can for now atleast

gentle quest
hazy saddle
#

yup!

gentle quest
#

cool

hazy saddle
gentle quest
#

but yeah the easiest way is to get some throwaway hw i guess

#

and try pulling a pci device at runtime or something lol

hazy saddle
#

@tender mantle tried doing it with ram

#

but not pci

gentle quest
#

i doubt ram would generate an mce

#

btw does qemu allow u to specify fatal/non fatal?

hazy saddle
#

you set the flags register which says fatal/non

gentle quest
#

ah

hazy saddle
#

i do mce 0 0 0xB100000000000001 0x5 0 0 for a non fatal

#

and mce 0 0 0xB100000000000001 0x0 0 0 for fatal

gentle quest
#

but yeah, enable PCI MCEs, and read a pci device config space in a loop,

#

then just pull it out

#

that should produce a read timeout MCE

hazy saddle
#

iirc all MCEs are enabled by my code

gentle quest
#

then all u need is a testbed lol

hazy saddle
#

good thing luna has one

#

iirc this enables them all?

gentle quest
#

who knows

hazy saddle
#

welp its good enough mmLol

#

If I ever find hardware that wants to spit them out il enhance the handling

#

But this will atleast catch them and ignore non fatal one and behave good trl

gentle quest
#

yeah

pseudo wedge
hazy saddle
#

hey dragons arent too far off cats

#

rawr :3

pseudo wedge
#

Rawrrrr :3

hazy saddle
#

pushed

#

I think this code is good

#

I think I’m gonna add logging helpers macros next to cleanup some crap

#

And then maybe work on mm or printf ✨

hazy saddle
#

I’m probaly gonna have
LOG()
LOG_TAGGED(ansi code for the tag, “tag”, “text”)
LOG_TAGGED_PASS/FAIL to append a tag for passing and failing which should just be able to also call the LOG_TAGGED macro

hazy saddle
#

how do we all like this?

#

using this macro soup

#

eg
printf(ANSI_BYELLOW "[ARCH EARLY INIT]" ANSI_RESET " GDT INIT " ANSI_BGREEN "[OK]\n" ANSI_RESET);
becomes
LOG_TAGGED_OK("ARCH EARLY INIT", ANSI_BYELLOW, "GDT INIT")

hazy saddle
#

i think i got them into all the proper spots

restive spire
#

e.g. have you chosen a colour for a particular subsystem

hazy saddle
#

just randomly picked per section

#

The logging has always been like this

#

Just uhh

#

I manually fucking did all the ANSI and spacing shit

#

Without macros

#

Btw I do wonder, does retro rocket of any support for the machine check exception / architecture?

restive spire
#

you should change your font

#

just to make it different and unique

#

that way w hen someone sees a screenshot they can tell its EvalynOS not just generic VGA font OS

hazy saddle
#

My old font was an 8x8 and honestly borderline unreadable 💀

#

Once I get userspace I will probably have that load a .psf file for the non earlycon console

#

I do want to get microcode updates supported soonish tbh too

#

As aparently it’s not too bad

#

You just have to get the file loaded into memory and then do some MSR magic

#

Which limine can do for me (the file loading)

wanton grove
hazy saddle
#

No

hazy saddle
#

got KASLR working

hazy saddle
#

also fixed up the build system a bit so you can do KASLR=false make run and debugging builds where it waits for gdb always has KASLR off

#

Not doing this to be ulta secure but it’s easy enough to support it PSP1G_pspTrollar

#

And it makes me be not a dumbass and hard code values in my paging crap

quiet rose
#

wow when did you become a mod

hazy saddle
#

Today

#

Also you doesn’t have to post about it here lol

quiet rose
#

um did the admin just ramdonly asked you about becomming a mod? or did you apply or something

urban mulch
#

it is the mintocracy

#

their majesty personally chooses who gets to be court jester

hazy saddle
# quiet rose wdym

I mean you don’t have to come to this thread there was a bit of talk about it in lounge0 shrug

quiet rose
#

oh rly

hazy saddle
#

I turned 18 today

quiet rose
#

i just opened this thread and saw your name in red

hazy saddle
#

Ah lmao

#

Speaking of my kernel

haughty acorn
hazy saddle
#

I need to stop being lazy and make my allocator lol

quiet rose
hazy saddle
quiet rose
#

what allocator

#

how do you not have an allocator

hazy saddle
#

Memory allocator and virtual memory allocator

hazy saddle
#

I finished the new paging code recently

#

I lowkey burnt myself out a lot snd rushed too much

#

So it rewriting and not doing that

quiet rose
#

maybe you should implement some shiny userspace apps

hazy saddle
#

🥀

#

I still need heap and vmem

#

I had a bash port and doom etc before

quiet rose
#

i mean

#

something even fancier

#

like xorg

hazy saddle
#

I will

#

But like

#

I have a lot of stuff to do?

quiet rose
#

btw i have weston and other stuff running and dont evne have smp and a usb driver

hazy saddle
#

I need a memory allocator

#

😭

quiet rose
#

plus a lot of stuff that im probaly supposed to have

hazy saddle
#

I also want to have SMP in my kernel

#

Which is another reason for this

quiet rose
#

isnt smp easy with like limine

hazy saddle
#

And portability to other architectures

hazy saddle
#

Me with 7000 thread safety issues even in one core

quiet rose
#

luckly my new kernel is sort of designed for it

hazy saddle
#

The main thing is just to add it as soon as you can

#

Which I plan to do after I get the schedular and stuff up

quiet rose
#

well im not so sure, by that i mean just putting stuff on cpu specific things

hazy saddle
#

Yeah but

#

If your kernel already has a ton of stuff

#

It’s gonna be a pain

#

And it’s not just “make it CPU local”

quiet rose
#

pretty sure rust already protected me before hand with Send + Sync and mutexes

hazy saddle
#

And your done

#

Even fishix had issues

quiet rose
#

the only thing that ill have to worry about is prob race conditions

hazy saddle
#

And they use rust lol

quiet rose
#

isnt it in cpp

hazy saddle
#

No.

quiet rose
#

huh

hazy saddle
#

Wait?

#

No it was c++

#

They mentioned a rust require

#

Rewrite*

neon karma
hazy saddle
#

You may be fine then?

quiet rose
#

true

#

niceee

neon karma
#

if you want it to be good, that's another matter

quiet rose
#

tho the bootloader crate dont natively support smp, so maybe ill make it my self after 10 years

haughty acorn
#

I had smp before scheduler even lol

hazy saddle
#

I want my SMP to atleast be properly stable and for threads to migrate and stuff lol

quiet rose
#

or steal it from my original ai slop filled os

hazy saddle
#

I plan to have every core pick N buddy cores

#

And then only share with those

#

So it evens out naturally

#

And should work well with NUMA as I can make a seperate class of migrations

quiet rose
#

btw does C programmer usually make things them self, and only use libraries for huge things

#

like idk, ext4 driver?

hazy saddle
#

And not connect cross NUMA for standard buddy migrations

quiet rose
#

and code other stuffs like datatypes them self

hazy saddle
quiet rose
#

(becuase i usually just use crates everywhere)

hazy saddle
#

And I generally make my own data types etc

#

Crates are a bad practice in general lol

quiet rose
#

why 😭

hazy saddle
#

I wrote my own UART driver even and GDT IDT and all of that

quiet rose
#

ig it makes you learn less

hazy saddle
#

But i can say a few crates i have seen are just bad

#

Like the x86 one

quiet rose
#

x86_64?

hazy saddle
#

The x86 rust crate

quiet rose
#

never heard of it

#

and also my new kernel (the no ai one) actually uses the latest version of uart

hazy saddle
urban mulch
hazy saddle
#

This one atleast

urban mulch
#

You can get pretty close with just linters

hazy saddle
#

This is stuff you should make

#

This is straight up missing crap

urban mulch
#

The real reason I use Rust is because I like its type system

#

You use unsafe so often that the notion of safe rust becomes almost an oxymoron

hazy saddle
quiet rose
#

why would you use unsafe tho

urban mulch
quiet rose
#

yea but

urban mulch
#

It's either that or unsound

quiet rose
#

mostly

#

you dont

urban mulch
#

You are very very wrong

hazy saddle
#

You have to use unsafe for linked posts in rust right?

quiet rose
#

unless you hate your self or something

#

1sec lemme check howmany unsafes are in my code

urban mulch
#

IDK if you're writing in Rust but if you don't agree you need unsafe all over the place your kernel is full of unsoundness

hazy saddle
urban mulch
#

Ah

haughty acorn
urban mulch
#

So the AI has been making unsound code as usual

quiet rose
#

i mean my no-ai kernel lol

hazy saddle
#

Why would you use a crate

#

For something you can make yourself

urban mulch
#

Also

quiet rose
#

well because

hazy saddle
#

And you get way more functionality and it generally will be better

urban mulch
#

any driver is unsafe to construct at the very least

quiet rose
#

why would you make it your self

#

when you can use a crate

urban mulch
#

Because what if the device does DMA?

quiet rose
#

:/

quiet rose
hazy saddle
#

At that point

#

Just sit down

#

Use your brain

#

Read some docs

#

And make a full driver

#

The UART crate is really not that good lol

#

It enabled IRQs

#

But provided no way of using them

quiet rose
#

if it works, and it prints characters, and doesnt crash your whole system, and is reasonable fast

#

then im fine with it

hazy saddle
#

That’s not what UART is only for

#

It’s also an input device

#

And you may want a proper TTY layer over it

#

And it took a lot of iteration to even make my driver work and be stable enough for real machines

#

I can tell you now the versions of the rust UART crate would fail on lots of my hardware

#

It works in a VM sure

#

But you have E9 for that mmLol

#

Plus a lot of the fun in making a kernel is making the drivers yourself

#

You just add an ext4 crate

#

Your done

#

You learnt nothing

#

And didn’t go through any of the fun

#

Also it’s gonna be harder to integrate into other systems of the kernel potentially

quiet rose
#

i hate making drivers

hazy saddle
#

Then why are you making a kernel?

#

Like an overwhelming amount of Linux code is drivers

quiet rose
#

because its cool

hazy saddle
#

So you do it because it makes you look cool instead of doing it to learn and program low level things and hone your programming skills and stuff

quiet rose
#

basically yes

neon karma
#

drivers are one of the most boring parts tbh

#

it's just specs

quiet rose
#

i like shiny userspace apps

haughty acorn
#

kernels as a rule are either 90% drivers or theyre small and 50% of the code is to load drivers as external modules

hazy saddle
neon karma
#

true

#

kernel internals are the most interesting parts

quiet rose
hazy saddle
quiet rose
hazy saddle
#

Because you don’t end up designing a lot of the systems you would have to integrate it all together

hazy saddle
#

You’re just calling external code? That does all of it internally and exposes some public API

haughty acorn
#

my drivers are like 30-50% integration with the rest of the kernel

quiet rose
#

um

hazy saddle
#

Certainly a lot less flexible and you miss out on alot of it

quiet rose
#

what exaclty does "system" mean

#

do you mean like

#

scheduler

#

or something like that

hazy saddle
#

The kernel

quiet rose
#

or like memory allocator

hazy saddle
#

Like the kernel as a whole

#

All of the subsystems

#

And making it all work together

quiet rose
#

um

haughty acorn
#

yeah all of the above lol

quiet rose
#

i dont think theres any crate that will help you

#

make other crate work togeather

haughty acorn
#

exactly

hazy saddle
#

Maybe it’s a difference of opinion, but you still miss out on a chunk of the work and fun

#

Your given a clean public API for things

neon karma
#

kiss out

hazy saddle
#

?

neon karma
#

but you still kiss out on a chunk of the work and fun

hazy saddle
#

Crap

haughty acorn
#

lmao

quiet rose
#

lol

quiet rose
#

imo the fun of developing any software is to make subsystems work to geather

hazy saddle
#

I mean I get not wanting to make ACPI or ext4 drivers, but a lot of crates are really dumb lol

hazy saddle
#

My KGZ library does all the porting work for you and provides macros and a single function to use

#

If I had made this for my kernel specifically

#

It would have been way more integrated

hazy saddle
quiet rose
#

idk i feel like C developors just like making everything by them self

hazy saddle
#

Rust and zig people also do it too mmLol

haughty acorn
#

yeah

quiet rose
#

maybe zig but i dont think rust people does it

hazy saddle
#

@urban mulch

haughty acorn
#

theres a lot of rust people that do it all themself

#

not all maybe

quiet rose
#

definitely not as much as C people

haughty acorn
#

or even definitely not all

#

but a bunch

hazy saddle
#

I mean Emma certainly does it themselves

quiet rose
#

or zig people

hazy saddle
#

I’m pretty sure you ended up NIH more stuff than me @haughty acorn

neon karma
#

don't use uint64_max crates for a 100 loc project challenge: impossible

hazy saddle
#

I mean like I also use external deps in C projects

hazy saddle
#

But I like to keep it minimal

haughty acorn
#

c you also cant often take as many other libs easily because theyll depend on stdlib stuff that you dont have

neon karma
hazy saddle
#

Makes some things a little less annoying to reuse

haughty acorn
hazy saddle
#

uACPI is special because doing AML fucking sucks

haughty acorn
hazy saddle
#

What stuff am I gonna try and port into my kernel that needs that though

#

I’m taking random stackoverflow shit that wants like stroull or whatever BS

#

Etc etc

haughty acorn
#

my kernel has external deps on:

  • zig
  • an emulator to run it on
  • uACPI (fetched automatically by zig)
  • standalone/freestanding libc type headers for uACPI (autofetch)
  • dimmer to make the disk image (autofetch)
    • dimmer depends on a zig library called zig-args (autofetch)
    • dimmer depends on zfat (autofetch)
      • zfat depends on a standalone C fatfs impl (autofetch)
hazy saddle
haughty acorn
#

my only runtime dep is zig and uacpi tho lol

hazy saddle
#

(When I first did OSDev years ago that’s what I did)

#

Well I actually flashed it to a USB by manually copying files and using gparted to change the ESP flag

#

So it was even slower

#

😭

haughty acorn
#

OOF

hazy saddle
#

I think I got up to exiting UEFI boot services and getting some PS/2. input and then I quit

haughty acorn
#

yeah thatll do it lmao

hazy saddle
#

I don’t know how the fuck I did it with my ADHD

#

💀

haughty acorn
#

idk lol

hazy saddle
#

My old kernel actual originally was a remake of that old project

#

Since I was bored one day

haughty acorn
#

some part of my brain keeps going what if i made an acpi library in pure zig with full support and used that instead and then i squash that part of my brain because FUCK NO I AINT DOIN THAT

haughty acorn
#

someday lol

#

i havent had the ability to even do any dev work in over 10 days now because of irl shit i def dont have time to make an acpi library when uacpi exists

full fern
#

What if I reinvent the wheel but make it a sphere instead so it can go in all directions

haughty acorn
#

someone already did that twice

#

theres omni wheels and mecanum wheels

hazy saddle
urban mulch
#

That's not a language specific thing

#

Most programmers like reinventing the wheel

haughty acorn
#

yep lmao

hazy saddle
#

It’s fun too somtimes

kindred stirrup
hazy saddle
#

The interface

#

So it’s still a “16550” driver

kindred stirrup
clear bison
soft snow
hazy saddle
soft snow
#

You did a lot for this community

#

Btw how is your decompressing library?

#

Is it faster than miniz now

hazy saddle
#

It was mostly made for fun tbf

#

It is certainly fast enough to not make me upset though™

soft snow
#

🙏

#

Any new features in the kernel

hazy saddle
#

I’m working on a rewrite

soft snow
#

Again lol

hazy saddle
#

Gonna make the memory allocator stuff soon

#

No not again

#

First rewrite

soft snow
soft snow
#

Or was it rust?

hazy saddle
#

Oh after C++ I went back to the original project

#

I actually started anew her proper by myself

#

I should possibly update the post™

#

But it’s 2am and I’m going back to bed in a moment

soft snow
#

Feel free

#

Sorry for walking you up.

hazy saddle
#

Nah you didn’t wake me up lol

cyan bison
#

tmk the pc16550dn is the newer version that should actually be used

hazy saddle
#

It’s just always called the 16550 by most things

cyan bison
#

my thing uses the pc16550dn

hazy saddle
#

Did any models with the broken FIFO even end up in any PCs?

cyan bison
#

beats me

clear bison
restive spire
hazy saddle
#

Thank you ^^

hazy saddle
#

i think i have finished my early memory allocator

#

I may tweak it a bit more

#

But it’s good enough™ for now

#

After a bunch of work on it

#

And defer is working on clang22 nicely aswell

neon karma
#

my earliest allocator is bump meme

hazy saddle
#

I need this one to support free() for vmem stuff later

#

And I didn’t wana make statically allocated objects

#

This one is able to return memory to the PMM too so there is nothing wasted either mmLol

neon karma
#

my early allocator is for pfndb

hazy saddle
#

Ahh

#

No that’s probably fine

#

Though I use a freelist for that and I plan to just not free() anything before it’s setup so I can track things properly™

#

And I can flush out whatever is partially filled from the memory map into a more advanced PMM after pfndb init

hazy saddle
#

I have had like 3 people referring to my frankly garbage code in some cases

#

And I am very concerned

hazy saddle
#

While completely disregarding the license

#

After I get vmem and a proper slab allocator going though

#

Il work on SMP shit

#

Some timer crap

#

And try and get a mlibc port going for hello world

#

And then get the VFS squared away and /dev/fb0 /dev/ps2 and /dev/pcspkr crap so I can port doom and bad apple

#

But in a way more proper way

#

Then bash probably should work fine but I’d need to throw in fork()

#

Which should hopefully just work?

#

Oh yeah il also need the page table clone funcs and scheduler things

sterile plank
#

when will you get networking done

hazy saddle
#

But it should hopefully just work™ after I finish it

hazy saddle
sterile plank
#

good good

#

also get some browser ported

hazy saddle
#

I ain’t porting Firefox for a while

viral bison
#

lol

hazy saddle
#

Unless a png is acceptable

#

Wayland/DRM may also be fun?

#

Iirc zinnia did that

#

And that would be cool af

sterile plank
#

i want serchat on evalynos

hazy saddle
#

If you get a CLI client in C I will gladly have a port of it

sterile plank
#

boring

hazy saddle
#

Or atleast a light weight enough JS runtime

#

But I cannot run a full browser anytime soon 😭

sterile plank
#

why

#

nothing is impossible

hazy saddle
#

Yeah but

#

It’s really hard lol

sterile plank
#

meow

hazy saddle
#

Mrrp

tender mantle
#

Meow

tender mantle
hazy saddle
#

But that’s lame as shit

tender mantle
#

Boring

hazy saddle
#

Though if I get enough ports having some compat layer in userspace could be cool though

tender mantle
#

Do something interesting like nt binary compat trl

hazy saddle
#

😭

#

im pretty sure @full fern had to do a fuck ton of shit to make it work right

hushed oracle
hazy saddle
round kestrel
#

on llist_push

hazy saddle
#
typedef struct spalloc_page_header {
    llist_node_t llnode;
    uint64_t bmap[2];
} spalloc_page_header_t;
#

it just has the node in the header

#

and push just connects pointers

void llist_push_front(llist_t* llist, llist_node_t* node) {
    if(llist->head == nullptr) {
        llist_initial_node(llist, node);
        return;
    }

    llist_node_prepend(llist, llist->head, node);
}
round kestrel
#

ohh huh

#

thats cool

hazy saddle
#

And I use a macro to get the header from a node

#

With type checking and shit

round kestrel
#

damn thats nice

hazy saddle
#

Intrusive structures are quite nice

#

oh and push and pop are aliases

[[gnu::alias("llist_push_front")]] void llist_push(llist_t* llist, llist_node_t* node);
[[gnu::alias("llist_pop_front")]] llist_node_t* llist_pop(llist_t* llist);
hazy saddle
#

okay i think every bug is zapped

#

i also have more asserts here to catch bugs

#

i also am temp tracking the PMM pages to make sure its not leaking

#

and i think it all works now

#

and the clankers arent complaining so

#

i think ive got this all properly fixed

#

any issues should be from severe miss use of the allocator at the very least

#

which im not particularly interested in hardening beyond the basics

#

I’m gonna let this clanker test to run overnight

#

This should catch anything

#

Then I can fix any issues or whatever

#

And then have a finished nice allocator

#

To be clear I did not generate the allocator with AI

#

Just the tests because tests are fucking annoying to make

#

im having this run overnight on two computers*

#

@tender mantle is gonna run it too :3

#

ty btw

tender mantle
#

all good :3

hazy saddle
#

Looks like things worked over night

#

Though I had to change the test and code to return false on invalid configs

#

Because the test was of course dumb as shit 💀

jade olive
#

haiii :3
continuing the bad ram test chain from #when-your-os-goes-crazy

hazy saddle
#

Yup

#

I also may wana test managarm on this

#

Since I may work on some #MCE stuff for them

jade olive
#

well when i get a functional nonfunctional ram to boot you can throw anything you want at me :3

hazy saddle
#

🔥

jade olive
#

ok so limine got invalid opcode with perfectly fine ram as well
so i'm pulling out the "modern" server

hazy saddle
jade olive
#

i think the #UD handler is definitely part of the ILO
cuz i keep seeing that when trying random bs

hazy saddle
#

i do also hope we dont hit this deadlock 😭

jade olive
#

eh

#

surely not

hazy saddle
#

Printf would only touch the stack and the framebuffer

#

So it should trigger mid log for this

#

Shouldn’t*

#

oh also on panic you get a ralsei

jade olive
#

yooooooo

#

worth breaking my equipment just to get that art :3

hazy saddle
#

🔥

#

Hopefully the terminal emulator can render those right

#

Also my stuff shouldn’t break things mmLol

#

Well atleast not until I add microcode updates

#

Which I don’t wana do

#

Because AMD fucked it up SO FUCKING MUCH

#

To the point Linux just sha256s every single fucking ucode for AMD for a lot of CPUs

#

Atleast on Intel it seems mostly sane?

jade olive
#

no shot
this server actually boots up within 1 working day

hazy saddle
#

Yoooo

#

😭

jade olive
#

on the bright side this server actually has serial bios log and the adapter seems to work

#

i really don't want to pull up my pentium III laptop just for serial

#

okies
got link local IPv6
very relevant

hazy saddle
#

I paid 20 bucks for an overpriced cable just for an FTDI chip lol

#

Just because I couldn’t be added to have something not work

jade olive
#

well

#

you ain't gonna believe this

#

illegal opcode 😭

#

i'm not even joking

#

this has to be a limine thing

#

i'm doin grub-mkrescue
f this noise

#

or is it the limine protocol?

hazy saddle
#

What happens if you just make a custom limine install on a USB

#

Then add my conf and kernel binary

#

(Remove the initramfs from the conf)

#

And my kernel only boots off limine

jade olive
#

wanna see the error message up close?
like the faulting IP?

hazy saddle
#

What is the IP?

#

And sure

#

But idk why it shows 32 bit registers

#

💀

#

Because my kernel is very much x86-64 and supports VERY modern features

#

(Though not required)

#

If anything it should fault in my kernel its self?

jade olive
#

trying the limine usb thing now

#

kinda checking everything along the way

jade olive
hazy saddle
#

I know

#

lol

jade olive
#

also sry if not responding that often i literally cannot hear anything over the server lmao

hazy saddle
#

ITS FINE

hushed oracle
#

what did I miss?

jade olive
#

my server actually doing its job unfortunately for us

#

OMG FINALLY

hushed oracle
#

How do you even handle MCEs?

hazy saddle
jade olive
#

CMONNNNN

hazy saddle
#

Also maybe picocom will behave better?

jade olive
#

nahh
bustin out the pentium-II box
i5-1345U skill diff obv

hazy saddle
#

Is that pentium 2 32bit iirc?

jade olive
#

yep

clear bison
#

Does evalyn's kernel even support 32-bit?

hazy saddle
#

But that’s just for serial

jade olive
#

nonono
you misunderstood

#

yess

#

for the serial

clear bison
#

Ah

hazy saddle
#

If I ever do 32bit it will be a source compatible kernel with a very similar syscall interface mmLol

hushed oracle
clear bison
#

Idk you should just use parallel, it's a simpler protocol trl

hushed oracle
#

I wanted to port mlibc and gotten depressed

clear bison
hushed oracle
clear bison
#

i686 also has MCEs iirc

hushed oracle
hazy saddle
hushed oracle
#

But which server is failing?

hazy saddle
#

Though I support that too

hazy saddle
#

Limine was dying

hushed oracle
hazy saddle
#

Yes

hushed oracle
#

My kernel boots with hyper as well

hazy saddle
#

My kernel isn’t running on x86-32

hushed oracle
#

We can check hyper trl

hazy saddle
#

I don’t wana make a bootloader abstraction thing rn

hushed oracle
#

I mean I can give an image (though I don't handle MCEs)

hushed oracle
hazy saddle
#

Maybe later I will make functions that can grab things genericly

hazy saddle
clear bison
hushed oracle
#

I support 2 bootloaders, but it's not very abstracted

hazy saddle
hushed oracle
#

Idk, it all came from supporting RISC-V

hazy saddle
#

MCA lets you see if it’s non fatal

#

But it’s still a #MCE for both

hazy saddle
clear bison
hazy saddle
#

I was just saying that

clear bison
#

MCE exists since the pentium days iirc