#OBOS (not vibecoded)
1 messages · Page 9 of 1
called GetMemoryMap
yeah it is that bug im afraid
returned (some value)
try the second pc
called GetMemoryMap
BUFFER_TOO_SMALL is what it returns
[hangs]
will test now
inb4 same bug
the 2013 one doesnt have it for example
are they both same manufacturer or something?
yeah so how do u do the GetMemoryMap dance again
do u call it once then manage internally or
#3 is lenovo
and #3 boots fine?
And is the only that worked on uefi
2013
i guess its luck based which manufacturers bothered to backport fixes
Anyway, until you can workaround that bug, I will have to boot from csm
ill think of the best way to work around this
oh lol i see what limine does
it reads the memory map, allocates literally all free regions only leaving 64mib to firmware, then stores the memory map internally
so all allocations are done internally without uefi allocators
idk if thats necessarily good lol
ill come up with a better way
maybe allocate memory "normally" (i.e., without a special type) and register its type somewhere
yeah im thinking of just storing the type metadata aside in a tiny array
then, when making the map, you those memory blocks with special types and change it on the go
since its page aligned allocations i can use the bottom 9 bits to encode the type
so like an array where each allocation is represented by an 8 byte entry
*bottom 12
yeah 12 even
yeah this should be pretty trivial
and i can only record like special types, e.g. KERNEL or MODULE, and assume LOADER_RECLAIM if no entry in the array
that should bring down the array size to very very small
I assume you just never free memory
i do free
but only loader reclaim stuff
nothing that belongs to the proto
i have cleanup handlers that actually release quite a lot of memory
alll caches and stuff
to make the memory map cleaner
I might give you a proof of concept tomorrow
also
That you can use until I make a proper release
In the process atm
I have a huge table code refactor that makes it thread safe
Osi Interfaces are already thread safe
Its a gradual transition
Carefully inspect everything and either add atomics or mutexes and stuff
well good thing that by the time I get to porting uACPI, that'll probably be done
Lol
well more like by the time I get out of oberrow hell because of porting uACPI
it'll be done
Lmao
I want to implement the ability to have insane log traces in uacpi
If desired
For tracking down bugs like oberrow hell
Like entry to every function, every return code
Arguments
which no one but me will use because it seems as if I cannot write memory-safe code
I might make it compile time
Because otherwise feels like too much overhead
Even just if statements for checking log verbosity
Or like the strings compiled into the program
Where are you at with obos atm
How far
too much work
Bruh
all I really have rn is a context struct
constexpr if
with an rb tree
Is that really needed tho lol
Damn
A working rb tree is already a lot
it's freebsd's 
Lol
last time I was working on the vmm I left off at MmH_InitializeContext
also I have to code with a cast on
which is annoying af
because my arm is in a weird position to type
what kind
static or reinterpret
or const even?
lmao
Damn im sorry
i dont think i could happily live with one arm
turned out to be a fracture
literally all my hobbies involve me using two arms
and not just tissue damage
basically what happened is was playing football (or soccer in north american english)
went to slide tackle
my arm was kind of extended
and then I landed on it
probably causing it to hyper-extend
I had a pretty severe fracture for my left arm when I was a kid
it probs broke because of your body's weight on it
yeah this
Its not a pleasant experience
never had a fracture
but of course it's my non dominant arm
the worst i got is open heart surgery 
so my teachers can still make me work
on paper

well only < than a month left for school
I'll be mostly fine
i allocate all memory and then just pretend the EFI allocator doesn't exist
Yeah I saw that
I mean I guess that works, like I already do that for bios
I just dont like the 64mib firmware limit
and yeah it's not that slow, if it was slow i would do something else
And also the fact that the map can change technically
E.g. a pci device gets hotplugged and u dont get the bars in your limine map
They won't be mapped
As a result
yeah that's taken into account
How?
magic
after boot services are exited
What happensb
Or actually it will probably panic
Because your memory map key will be outdated
You won't be able to exit boot services?
Idk
That makes sense since firmware allocates memory left and right as well
yeah
So what happens at the end, does it re parse the entries?
yeah
If not then you won't map those
where is the firmware supposed to allocate a PCI BAR? unless you mean in some reserved region
then i guess you just won't get it
but it's not like it matters
Reserved yes
Limine doesn't really map or not reserved regions
The spec doesn't guarantee all reserved mapped?
not anymore
Oh ok
it's a deprecated thing
Yeah thats kinda idk
it's good, you're supposed to do it manually anyways
That means u cant technically access any devices before vmm init
you shouldn't gather any BAR info from the memory map
you can access those below 4GiB
Yeah but what if its above
remember that the first 4GiB are always unconditionally mapped
then you'll have to map it yourself
well good thing I wasn't planning to do that
also the framebuffer is always mapped because that's not a reserved type entry
Anyway if the spec doesn't guarantee it it doesn't matter
From a usability standpoint I dont really like that
i mean even if it did guarantee it it wouldn't matter
legacy BIOS is all over the place when it comes to device to memory map mappings
so it is never something reliable to begin with
save this convo so new osdevs who think that a bootloader is the way to go think otherwise
lol
Yeah its like
Some firmware is just insane
Oberrow bios devs decided to just zero out everything other than RGB, who gives a shit about X amirit
"if windows boots it, it's fine"
this is the reason i deprecated mapping reserved entries + the fact that sometimes there are HUGE reserved regions that no one really needs and they just bloat the size of the default page tables, especially on those machines without 1GiB page support
Huge reserved regions and 1g page support typically go hand in hand but yeah
typically... except on qemu where sometimes you get those with 2MiB pages only
On qemu there's a huge AMD hyper transport hole at the top
yeah
yeah something like that
it seems to be that phoneix bios company
because of the "AMD ATOMBIOS"
thing
or nvm
I think that computer might have an amd gpu
and I never knew it
Yeah outsourced to India to get to the state where windows boots for $2 an hour
Is my bet
why tf do these gpus have something similar to aml
Its less insane than aml ofc
kinda makes me want to write an interpreter for it
No recursively defined opcodes? Pretty weak
except my question is, where is the documentation
Soo what sort of commands exist there
wouldn't writing an interpreter for this be basically writing a gpu driver
I dont see any
If we see a list of commands
Meanwhile I've only cracked my skull twice 
Second time only reopened the first one xD
well it's in some table
in the rom
now what said commands are?
I have no idea
Same
I get how it works but I dont get which command is which table
it seems like there is a command header
which contains a list of supported commands I think
or maybe it's a table of commands, indexed by the command's value
which then has some opcodes that you can run
to execute said command
Yeah but what the hell is the value supposed to mean
I made the readme
I put instructions for how to build
and fixed a bug with the build system
I'm hoping that tomorrow I can get back to developing the vmm after I refresh my memory on the working-set
I think my 3rd kernel was cursed, but was really really good at hiding it
especially considering my spin lock was broken for nearly a year
something to do with cmpxchg
I've found the commit I made to obos exactly one year ago
this was the first commit ever https://github.com/oberrow/obos-archive/commit/8d06024343f2a4fcac71344e15c167bf494a19b0
https://github.com/oberrow/obos-archive/commit/53ec7c4e1d6d3e6995f30824fbb0116d33e81b97
second commit that made me use grub
I used to use a very good build system
called compile.sh
I also found the acpi shutdown code from the wiki
in my project
oh my god
this code is 💩
hows it going chat
you're finally back!
anyway
finally, after a couple of weeks
I can work on the vmm
bruh
school made me forget
all I read
over those couple days
but I ain't re-reading that
so I'll just try and remember
I think it's good to make the working set a dually linked list
and put the dually linked list in a context struct
typedef struct context
{
struct process* owner;
struct page_node_tree pageNodeTree;
page_node_list workingSet;
} context;```
pageNodeTree is an rb-tree
uhh
now what
I'll make a function to initialize the initial kernel ctx
it'll populate the rb tree
then, with that code in place, I'll find some way to populate the working set
using this algorithm
In a computer operating system that uses paging for virtual memory management, page replacement algorithms decide which memory pages to page out, sometimes called swap out, or write to disk, when a page of memory needs to be allocated. Page replacement happens when a requested page is not in memory (page fault) and a free page cannot be used to ...
after reading the part of the working set paper concerning the "use bits"
it makes sense
i would recommend using clock
currently trying to find out how to count memory references
for a page
for the aging algorithm
I know it has something to do with page faults
and the present bit
I think
on x86 you have the accessed bit you can scan to see if a page was accessed
and dirty to see if a page was written to
periodically scan accessed bits, if it's 1, you know a page was recently accessed, otherwise you know it was not touched since last time
and afterwards clear the bit back to 0
so would I just like
put it in some timer irq
but that wouldn't work
because irql > dispatch means the vmm won't work properly
you could just schedule some periodic work?
my timers can either carry out work immediaetly or (default) they wake a thread waiting on the timer
i don't do page aging yet (only two level fifo, which is similar in characteristics to clock or second chance) but that's how i will do it
ok time to rather:
design a timer interface (boring)
just hook up the vmm to the timer irq used by the scheduler (easier, but I probably shouldn't)
this will be boring, designing a timer interface 🫠
I don't even want to
for now it'll just be using one timer
for which the arch provides a driver for
and there will be timer objects
typedef struct timer {
union {
timer_tick deadline; // periodic=false
timer_tick interval; // periodic=true
} timing;
bool periodic;
timer_handler handler;
} timer;```
seems good enough
for the timer object
you mean to replace the periodic variable
yeah good idea
typedef enum {
TIMER_MODE_DEADLINE,
TIMER_MODE_INTERVAL,
} timer_mode;
typedef struct timer {
union {
timer_tick deadline;
timer_tick interval;
} timing;
timer_mode mode;
timer_handler handler;
} timer;```
yeah
I think the timer will run at 4000hz
Because that sounds fair, 1/4 of a ms
who could possibly need a smaller unit of mesurement than that?
I mean my kernel would shit itself with a higher frequency than that
because irq handling takes time
and if the timer runs too fast for the cpu to catch up
the kernel shits itself
ok.
sound.
im serious
sound callbacks are very timing sensitive
you can batch them, and poll
check current time, handle any expired timers, check current time again, repeat
if u dont fill the buffer in time u will hear garbage instaed of audio playing
to some extent, eventually you'd want to exit out of the handler ofc
I could just make some "timer ticks" global (atomic) variable that's incremented in the handler
and differ the work of checking for expired timers to another thread
I think I'll use the hpet for the timer on x86-64
and use the lapic for the scheduler timer only
i just do in the region of 1/50th of a second
You generally fill a few ms at a time tho...
I'm done the bulk of the timer interface
i.e., the dispatcher thread and some utility functions (one of which needed fixed point arithmetic)
I need to implement the HPET with IRQ support
So I'll need to also implement the I/O APIC (also known as ctrl+c ctrl+v from the previous kernel)
I'm done the madt parsing code for the IOAPIC-related entries
I'm done writing the IOAPIC code
I didn't even end up taking any code from my previous kernel
except for structs
so now, hpet code
I was making an organization for obos on github, because why not you know (could be useful in the future)
but conviniently, someone already made one /s
that just so happens to be completely empty
no one even owns it
maybe just oberrow_os
but that's too long
I'll just rename OBOS
name suggestions are welcome
I'll name it after a snake
because why not\
the taipan snake
because
taipan snakes are very venomous
just like the code in OBOS
note: this is not final
anyway I'm going to sleep
RewriteOS
ABOS (Allocator Bug OS)
@real pecan Can you compile hyper_install-win64.exe as release
and not debug
so it can work on school laptops without vs
well it says ucrtbased.dll doesn't was not found
on execution
and VCRUNTIME140D.dll was not found
so I'd assume it's compiled in debug
I'd be able to build obos on a school laptop otherwise
(don't ask how I got the entire toolchain)
(and a command prompt)
well the "command prompt" is really just a dumb script
that feels like cmd
as for the toolchain
I just extracted some files
I don't regret making obos buildable on windows
Lol
SCOS (slightly cursed OS)
Because snakes change skin?
Quote of OBOS
Lets hope its not in the allocator
nah it's going in the VMM
like every file
I have no idea what any of the functions in the VMM do anymore
well I know what they do
but how
hehehehhe
barely
Kernel Panic on CPU 0 in thread -1, owned by process -1. Reason: OBOS_PANIC_FATAL_ERROR. Information on the crash is below:
IRQL on call of the dispatcher is less than the IRQL of the vector reported by the architecture ("Core_GetIrql() < OBOS_IRQ_VECTOR_ID_TO_IRQL(frame->vector)").
This is being caused by gs_base being zero
but I conditionally swapgs
test qword [rsp+0xB8], 0x3 ; User code
je .no_swapgs1
mov rax, [Arch_KernelCR3]
mov cr3, rax
swapgs
.no_swapgs1:```
and the same thing is duplicated for the other side of the common stub
at this point I want to reset this commit
and start it from the beginning
it has waaaaaaaaay too many stuff in it
Am I smelling an imminent rewrite?
Bruh
not yet I don't think. I think he just means he is breaking up the commit
Yeah this
It has a lot of unrelated stuff
i feel its better to just rewrite a few files rather than the entire kernel, then you'd get it done lol
its like game engine development
but I guess this is a general program engine
Well I've ruled out swapgs happening
I made it access nullptr as a way to ASSERT the condition on swapgs
it turns out all CPUs have their gs_base cleared
well all CPUs also have their scheduler timer enabled
But it happens before any CPU gets the chance to get its timer IRQ called, as this panic is in the irq dispatcher
the per-thread gs_base is initialized
oops
I forgot to modify the offset of something that uses interrupt_frame in asm
after I changed it to include cr3
still doesn't fix anything
Well I didn't specify a full kernel rewrite...
I fixed the bug
pop rax
test qword [rsp+0xB8], 0x3 ; User code
was the bug (rsp should've point to a full interrupt context, but it didn't as a result of the pop)
for reference, this code was in the conditional swapgs code at the end of the isr handler
I was able to get the HPET working
In periodic mode with IRQs enabled (routed through the IOAPIC of course)
Now hopefully it doesn't take prioirity over the scheduler
maybe I should make timers run at a higher IRQL
I think they do (by a lot)
the timer can now only be called at IRQL 3
except now it hangs somewhere
after fixing some priority stuff, I get this:
Kernel Panic on CPU 3 in thread 6, owned by process 1. Reason: OBOS_PANIC_ASSERTION_FAILED. Information on the crash is below:
Assertion failed in function Core_Yield. File: C:/Code/obos/src/oboskrnl/scheduler/schedule.c, line 227. !(oldIrql & ~0xf)```
an invalid irql
in the yield function (only ever happens in thread 6 after the yield)
void Core_Yield()
{
irql oldIrql = Core_RaiseIrqlNoThread(IRQL_MASKED);
OBOS_ASSERT(!(oldIrql & ~0xf));
if (getCurrentThread)
{
CoreS_SaveRegisterContextAndYield(&getCurrentThread->context);
OBOS_ASSERT(!(oldIrql & ~0xf)); // <-- Here
Core_LowerIrqlNoThread(oldIrql);
return;
}
Core_Schedule();
OBOS_ASSERT(!(oldIrql & ~0xf));
Core_LowerIrqlNoThread(oldIrql);
}```
except there already is an assertion for that same condition after the irql raise
so the stack is corrupted somewhere it seems
Well, removing the print statement for the timer irq made this appear less
which indicates that the timer irq is happening too fast
After exactly 10000 timer ticks, the kernel hangs while trying to acquire a spinlock
ok I think I fixed it
the function for readying threads always assumed they were blocked/unreadied
but the timer irq was readying an already-readied thread
causing goofy stuff to happen
I was wondering why my code directory for obos was so large
then it turned out I had an 8gib qemu log
ik the message is very old but how did you implement the file path when handling an exception?
I don't remember
nice
It's such an old version of the kernel
is it still a feature in the newer versions of the kernel?
I could check the source code if so
Well I think it used the __FILE__ macro
The newest version of the kernel just does a reg dump on exception
Along with some more info
I will google it, ty
My scheduler is kind of bad regarding priorities. That's because the scheduler raises priorities a lot, which is good, except there are only 5 priorities, which means priorities are almost useless. So, my solution to this is to add 4 sub-priorities per prioritity
Basically, how this will work is:
typedef enum
{
THREAD_PRIORITY_INVALID = -1,
THREAD_PRIORITY_IDLE = 0,
THREAD_PRIORITY_LOW = 4,
THREAD_PRIORITY_NORMAL = 8,
THREAD_PRIORITY_HIGH = 12,
THREAD_PRIORITY_URGENT = 16,
THREAD_PRIORITY_MAX_VALUE = THREAD_PRIORITY_URGENT+4,
} thread_priority;```
and some other changes
This way, threads that are being starved won't have the same priority as ones that should be (a lot?) more important than them
I'll also make it so that threads' priorities can be raised, so long as they stay within their priority range
An example of my scheduler pretty much sucking is with the timer dispatcher thread
It's urgent, and is constantly being woken up
yet it barely runs
(it's overtaken by the idle thread)
TODO: Fix scheduler
is obos stable now
Hehe no
Stability is overrated, just reboot and try again
It is on qemu
Just on test subject 1 (#2 is awaiting the bug fixes to hyper), it panics
but only prints:
STOP
Ke```
so I have pretty much no idea what went wrong
all I know is that it was somewhere while handling the HPET irq
Well, except for the fact that the scheduler has priority inversion issues
(somewhere)
do you believe that increasing the number of priorities will make things better ?
how
let me think
I have no idea how I thought of this
ok I think I fixed it
offending lines:
if (++list->noStarvationQuantum < Core_ThreadPriorityToQuantum[THREAD_PRIORITY_MAX_VALUE - priority])
return;```
it was literally priority inversion lol
except wait
I interpreted what it meant too fast
except wait, now the problem is suddenly gone
the point between inverting the priority here is so that lower-priority threads have a higher chance of getting their priority raised than high-priority threads
When does a threads priority get raised?
every priority list has it's own "quantum"
for each yield, the scheduler goes through the priority lists
and the scheduler will raise the priority for a couple threads in all priority lists where their quantum < Core_ThreadPriorityToQuantum[THREAD_PRIORITY_MAX_VALUE - priority]
hopefully that makes sense
that wsan't the problem btw
It seemed to have been the fact the scheduler was starting to look for threads at the head of a list and not the tail when raising priorities
well I think it wasn't a bug with the scheduler causing weird stuff to happen with that thread
and more so the fact that the thread was just blocked and never unblocked at one point
Anyway, time to test the timer interface.
Cant you test with bios
no #2 is the one with the framebuffer issues
Didn't I give u an installer where thats fixed
well yes
Im out of town for the week so no releases
ok
Well it works*
*the timing is messed up though
hmm now the scheduler magically removes the timer dispatch thread after a bit
(only when there is a timer object registered)
I fix the timing
but now, the timer ticks variable is incrementing very, very, slowly
(it's supposed to increment on each timer irq)
(the timer irq runs at 1mhz)
surely you're joking
that's extreme
i have a timer tick every ~1/50th of a second
[ DEBUG ] HPET frequency: 100000000, configured HPET frequency: 100000000
says otherwise
oh wait
that's 100 mhz
the timer irq only does two things:
tells timer dispatcher to wake up
increment timer ticks variable
so having it run fast shouldn't be that big of a problem, right?
how fast is your CPU?
well it's running on qemu tcg
so idk how fast that is
but my cpu is reported to be 2ghz
getting yourself interrupted 100 million times a second will dominate or exceed the execution time on any CPU today
I mean the timer irq really just runs at the hpet frequency
consider that means that if the whole process takes 100 cycles on your CPU that will be your CPU spending half its time servicing timer interrupts
so I'll just change my frequency divisor to 1000
1000 hz is one ms
so then how would I get smaller timing events
I assume I would just use some timer counter
and poll
high res timers aren't too important generally, you can deal with them separately
1000 is still a lot
all of my previous kernels' timers have ran at 1000 hz
if you are keen to futureproof you could do dynamic ticks or something from the getgo
where you set a oneshot timer for the head of the timer queue's time of expiry, then when your timer interrupt happens you set up the next timer
would the scheduler be driven by a timer then?
thats quite smart
the hpet, i don't know anything about it other than that it stands for high performance entertaiment timer or something like that, and rumours i've heard that it has slowness issues
i dont know why i never thought of that
This is how I do it and its great
yeah, it's the modern style, and i think if you pair it with a speedy way to get the current time you can then subsume the traditional function of the tick where it does accounting
Tickless ftw
by instead reading the current time when you need to
rdtsc, that's quite speedy, a good candidate for this
yeah i talked with nooby about getting rid of ticks in my kernel
and it basically involved using rdtsc to figure out the current time when needed
i like that idea but i cant seem to get around to implementing it
i had a tickless kernel once upon a time but i went back to tickful when i lowered my ambitions a bit for original keyronex, some day i will tickless it again and let idle CPUs not tick at all
I leave the hpet running in the background and use it to keep track of the time, though that does lock astral to 64 bit hpets
if you have invariant tsc you can just use that to figure out the current time
Yeah I will likely use that, then fall back to hpet and if all else fails I will leave it running on a timer to increment a variable every 100 ms or something
100ms ☠️
Who needs precision
right
audio
ntp exists for a reason
I mean most of the things use the per cpu timers which have higher precision, this would be just for the timeekeper functions that handle dates and stuff
you probably should commit a bit more often
this was only one slight mistake where I got side tracked
well not slight
but most files changed only had one change,
#include <error.h>
This file has the timer interface
if anyone was wondering
for my own future reference: TODO: Fix timer irq on real hw
Anyway, time for the VMM
You working on the vmm tho?
Yes, but then I needed to get some sort of timer interface
And then it wasn't all about vmm 
which needed:
IOAPIC code
Timer code
and then there were also the new vmm context stuff
But the timer was for the page eviction?
I mean you could've added that at a later time
But since I figured I'd need a timer interface eventually, I might as well do it now

Instead of committing the changes I had for the VMM, I just continued on
causing this mess of a commit
oof
But I know how that is

I do it sometimes too often
Or I just implement everything in one commit
xD
sometimes I wonder, "skill issue or ADHD"
in case anyone was wondering the difference between adhd and laziness
it's that laziness is when you don't wanna do something
but adhd is when
noradrenaline and dopamine isn't released as much in the brain (or prefrontal cortex idk)
or is just broken
causing some random ahh proteins in the prefrontal cortex to go oof
and make you no focus
or something like that
wait
it isn't as sensitive
I think
If anyone studies neurobiology, an explanation would be nice
so basically this
oh and iirc from the article, the same thing happens when one is tired
Yes, my focus vanishes, and then I fail to be able to visually focus
I turn into sid at that point
I might get treatment for ADHD soon
see how it feels
because currently, my noradrenaline and dopamine are not noradrenalineing and dopamineing
Damn
sad am I right
anyway, back to osdev
ever look at code and wonder
how the fuck does this work
Just me focusing on some point with my left eye or something
And the right one is just gone xD
this picture looks like you haven't left your home for days
wdym O_O
idk

it's something
frick
Yours is 10.0.0.43 :>
anyway, enough joke ip doxxing before an actual dox happens
I feel like something's going to go wrong
I live somewhere in Norway gl finding me 😉
If I could find your full name
You aint gonna find my door tho xD
Ok I have this so far:
'Markus - -'
Oh wow, how could one find my first name I wonder 
@real pecan what's marca's full name
@vernal chasm https://github.com/MarcasRealAccount/ColorCharge/blob/d8c39500670bcede3c7023ff6f134a1e0f57598c/hs_err_pid55806.log#L912
What about it
Holy moly :>
Anyways I can tell you really quickly there are like 5 people with that name 🙂
Maybe even more
Yeah I second this, don't continue this here please.
Anyways idk why that java error log file was there...

Probably forgot to delete it before doing the full add . && git commit 
Well now it's privated 🙂
it is with pleasure to announce that, OBOS is stable
i.e., it finishes booting without crashing

Once in a lifetime event
scroll up in hotgarbage @vernal chasm
How far?
until my last messages
I wanna confirm idk why
@viscid nova

🤨
what
there's some guy with a similar hairstyle to this
probably not you though
Dafuq you on about 
Also I think a good few people have the same hairstyle that I have xD
It's like the most generic hairstyle

probably
and according to redacted sources, you don't own a car
and the guy was getting in a car
Wait I don't own a car?
Exactly 🙂
But yes I don't own a car
But I probably will have to get a license soon™️
But idk
I made a github org for obos
profile picture recommendations welcome
all repos on my github profile are useless now
because all projects there are dead
well now there are none except a very old obos repo
fact: when I started osdev, I didn't know how version control worked
and I don't think I knew what a build system was
or libc
or basically anything
(I'm going to be honest, I kind of learnt to code a lot of basic stuff on the way)
it's like the solar eclipse a couple months ago
it was rare and everyone was hyped
except only lasted a couple hours
I gotta actually plan what I'm gonna do with my kernel too
the kernel log is just a bunch of initialization
until it's finished initializing all components
I gotta actually set real goals instead of just some ideas of goals
but schools been fumbling me over for the past week (and this one too)
hopefully this is the last week tho 🤞
my kernel's goal is: don't crash and make something interesting
then worry about userspace
same, I want my kernel to be stable enough to run on my laptop, and then I want to be able to have some kind of IRC programs, and be able to write and compile programs
on the long run ofc
on the short run I need to learn more about osdeving in general
to know which steps I'll take exactly
well it's actually kind of simple, if @thick jolt could almost get bash
then basically anyone can
(no offence intended)
it seems like my kernel will triple in size (amount of shit I'll need to write)
if I do
well you certainly don't want to make your own
takes the fun out of osdev
getting bash to run will be pretty epic
"Ah yes, I would like to implement some boring functions in some old ass standard please"
especially when I saw how unix sockets worked, it seems boring as shit
I feel like if I do implement mlibc it's gonna be more serious of a kernel in a way, but it will be "just another one"
that made a posix like kernel with limine and mlibc
idk tho, might change my mind later on
later on I mean by next week
anyway gl
I feel like I'd gain some reputation for obos if I just stopped saying every little bug that pops up
and instead posted whenever I make new features or components of the kernel done
or have an idea related to a component
anyway, that's something for future me to deal with
(and by future me I mean me tomorrow)
I think I waste time describing bugs too
yeah same, but then I'd only post like 5 days in a month
I probably could've spent a lot less time fixing that one allocator bug
if I hadn't shared every small detail
but it's too late now
at least it got fixed
this the one fr
I have the 2nd most messages for a progress report thread on this server 
Hopefully
holy shit 8k messages
18k when 
he had lots of problems in his kernel iirc
everytime I accessed his thread it was a different problem atleast
so that might be why
it was
possibly the least stable os here
sometimes I have the urge to do userspace dev
is there a helpline I can call
if it goes on
the sdm
I can't wait to implement uacpi and watch as the kernel burns to the ground
ok ty 🙏
I'm probably gonna implement uacpi after I have more shit going on ngl
just checked mlibc repo again and I remembered I'll have to re-do big part of my VFS 😭
I'm implementing uACPI with the driver interface
and probably I'll re-do my scheduler, but that's not mlibc related, I just think having processes and threads is gonna be nicer than having tasks only
so I don't have to worry about it
for uhhh
let me make an estimate for the vmm
anywhere from 2 weeks to 5 years
shi u don't have a vmm yet?
no
if you knew what the working-set model was
you'd know why
(you probably just have a glorified page table manager)
nah I also have a VMA
but the biggest part of my VMM yeah it is the pt manager
still managing page tables in a glorified way
I mean I don't need much else than mapping and unmapping
this is a virtual memory manager
creating pms etc
more like managing the virtual memory I'd say
I'm implementing the working set model
you still do some page table magic cuz u map things
my definition and your definition of virtual memory is different
basically each process has a set of pages that should be loaded (i.e., not in swap) for it to run efficiently
many good kernels do this
I'm implementing the algorithm called "aging" hopefully
you can find an explanation online
indeed
the VMM will still have a "VMA" obvioiusly
now if you were wondering how I allocated memory before, I just had some simple allocator
wait so it's kinda like page cacheing?
at least they say that on wikipedia
havent looked at the os wiki yet
so its basically a list of pages that the process is gonna use, and then it changes during exec time?
yeah
the kernel figures out it's contents though
you can find a paper on it in the #virtual-memory pinned messages
when this week is over I'll need to take a look at a lot of virtual memory concepts again
like the tlb shootdown too
Me neither but I have seen kernels that use the one shot timer instead of a periodic timer
Tickless?
Yeah
Aren't all relevant kernels tickless nowadays
the interesting thing about "tickless kernel" is that in popular use it usually means "ticks, but doesn't on idle processors"
since a lot of kernels do still rely on ticking
from what I understand a tickless kernel doesn't rely on a continuously ticking timer but rather a programmable interval timer of some sort
that can fire interrupts when a tick counter reaches 0
on linux they still have ticks, they are just not given on idle cores
so "tickless" is really taken to be a power-saving optimisation in the popular use
Tickless just means optimized ticks yeah
It does tick but on demand and not continuously
And not on all CPUs
so technically my kernel is tickless
because there is only a timer on one cpu
(not including lapic timer)
If you do oneshot on demand ticks then yes
and it doesn't tick itself, it uses the hpet counter
oh nvm
A proper tickless would've just been a non preemtive scheduler tho, wouldn't it?
As in coroutines...
Or fibers
bruh I want to watch the euros games while doing osdev
meh. you basically ensure there's a maximum tick
like 1 or 10 seconds
But why tho...
If a thread wants to do work, they'll just have to wait in line for the other threads to yield 
Then that's called cooperative multitasking which is incompatible with modern kernel
There's no idle thread...
They'll just swap thread like every cpu clock O_O
I mean that is pretty much what a non preemtive scheduler would do...
It either waits for the thread to die or yield...
Tickless does not mean cooperative
It just means you aren't using a fixed tick rate to control timing
I said proper, not the way that others use it as

Also tickless would imply you don't have ticks.
Random tick rate doesn't mean tickless xD
it is a misleading term
Hence why I said proper...
Since there you don't have ticks at all, it's just "oh the current thread doesn't want to work now, guess I'll switch to the next thread"
you can still have timeslices on a kernel which has no tick-concept
You don't need to have a tick value that increases or something, just the point of something interrupting at some time could be thought of as a tick...
So setting a timer with a random time delta to reschedule after a different amount of time every time would still be a ticked system.
Or having it be an external interrupt that is signaled when you click a button or something would still be a ticked system...
At least that's how I see it
that's not a tick though
it's just a timer irq
ticks means periodic and regular (and tickless confusingly includes this with the proviso that on special occasions the ticks can stop for a while)
Tbf even what I said about a non preemtive scheduler could still be seen as a ticked system, since the death of the thread or the time it yields could be a tick...
if everything is a tick then nothing is a tick
A tick would be an event that happens at some time
What about ticks that people get?
They're not regular and periodic :>
why is my thread being spammed with this
anyway, I'm using the freebsd rb tree impl for the first time
hopefully nothing goes wrong
no pf
we good
it's very good
queue.h is too
Funnily enough cambridge's dictionary doesn't even have anything on a computer science "tick" word
strictly speaking their tree is a weak AVL tree now
int cmp_page_node(page_node* right, page_node* left)
{
return !(right == left);
}```
I'm trying to understand why I didn't use the address variable
but whatever
your comparator has to return negative, positive, or 0
it returns one when the two things are the same
*different
and zero otherwise
or is it like memcmp
tree.h requires to be able to establish ordering as well as mere nonequality
otherwise it won't know where the nodes should go
If I can't have duplicate nodes, can I just assert if two nodes are the same
it needs to be able to find identical nodes so you can look up by key
lookup is done by passing a variable of the same type as the node, with whatever the cmp function compares set to the value you hope to find a node matching
static inline intptr_t
ubc_window_cmp(ubc_window_t *x, ubc_window_t *y)
{
if (x->offset < y->offset)
return -1;
else if (x->offset > y->offset)
return 1;
else
return 0;
}
this is how the cmp function should tend to look
that's basically what I just changed it to
int cmp_page_node(page_node* right, page_node* left)
{
if (right->addr == left->addr)
return 0;
return right->addr < left->addr ? -1 : 1;
}```
If it needn't be exactly zero you can also just return right->addr - left->addr;
After a little bug fix
My kernel is using 200kib more memory
because it has every (virtual) page on the system saved in an rb-tree
(including the hhdm)
now I got a slight problem on my hands
how tf do I link memory allocations through "OBOS_BasicMM" to the VMM
ok I got it
nvm
😮
is your rb-tree not an intrusive data structure
it is
I am now going to implement the thing that counts the age and the part that pages in/out shit
idk what it's called
atm, swap will just be a chunk of mem reserved
until I can get a file/partition
one fun thing you could do is to run a compressor on the contents of pages you put there
just schedule the timer to fire at the end of the time slice
that gives me an idea
instead of having some random timer controlling this
I should have some event at each thread's end of time slice
wait nvm
the idea behind this was that the timer wouldn't be wasted for sleeping threads
but then I realized there is no time wasted except in the idle thread
Marca
Maybe
That's my guess
You have to build your muscles back up
Now it's stiff
Yeah
Ye
Doctor said I'll need to do physiotherapy
What happened?
How did you guys get in a cast?
Football (soccer)
Slide tackle
Land on arm by accident
Fracture and soft tissue injury
You said plural

