day 12 of rewriting my OS 🥝
today i hit the first milestone of this project, i rewrote my physical memory manager. we can now manage up to an enormous 4 PB of memory and we can also allocate in log time.
i also wrote a blog post breaking down the memory manager (link in reply)
long time no see but i'm finally back to working on my osdev project,
i recently rewrote the virtual memory manager, scrapped the scheduler, and took some time to build a stack tracer and a tickless deferred work subsystem; planning to build a new scheduler on top of the latter.
day 39 of rewriting my OS 🥝
i took a bit of a break bcs i was busy with irl stuff, but my kernel now has a load balancing priority scheduler based around the chase-lev deque. it works on both single-core and multi-core setups and i'm planning to write a blog post about it soon.
day 29 of rewriting my OS 🥝
not so much to visually look at again, but in preparation for the scheduler and more to come, i made a reusable hashmap structure that i can use in the kernel. it abstracts away things like resizing, memory allocation/freeing, and so on.
day 24 of rewriting my OS 🥝
there's not much of a visual update this time, but we can now parse the kernel's command-line arguments. behind the scenes i've also implemented the chase-lev work-balancing algorithm, which will become the backbone of our multi-core scheduler.
day 23 of rewriting my OS 🥝
we can now detect and boot other CPU cores. for each one, we set up per-core info structures, and then we calibrate the local APIC timer to provide our primary timing source. this is going to become the system's main heartbeat for the scheduler.
day 22 of rewriting my OS 🥝
first steps towards multi-core support: we can now detect and boot up secondary CPUs. we also provide an architecture-agnostic sleep function (HPET only for now) that we will use to calibrate these cores' timers, so we can build up to a scheduler.
day 21 of rewriting my OS 🥝
building on the vmm, the kernel now has malloc(), free(), realloc(), etc. we can also list the ACPI tables, which means we're ready for the next step, which is setting up interrupts, a timer, and finding and starting other CPU cores.
day 20 of rewriting my OS 🥝
my virtual memory manager now works as expected and can allocate pages within a given range. it uses a "lazy" approach where it pre-allocates the metadata and stores it in the tree, only allocating the actual physical page when a page fault happens.
day 19 of rewriting my OS 🥝
built the structures for the virtual memory manager, where we're going to use an extent tree to track memory mappings efficiently. here, we've built the preliminary 3 nodes of the tree (the root node, the HHDM node, and the kernel's memory space.
day 18 of rewriting my OS 🥝
more groundwork laid out, i set up a new GDT and IDT so now we have the foundations we need to handle exceptions and eventually interrupts
day 17 of rewriting my OS 🥝
getting back on track, i wrote paging initialization code and built the kernel's page tables for the higher-half mappings, next up will be exception handling and using these to build up to the virtual memory manager
day 11 of rewriting my OS 🥝
the kernel can now output its log to the screen, and uses that to display the memory map. the obvious next step will be to feed in these memory ranges into the memory manager, which i'm quite looking forward to and have a draft blog post about
day 10 of rewriting my OS 🥝
i didn't really write any code today (it's important to remember to take breaks too), but i worked some more on the planned architecture of my memory manager and scheduler.
tomorrow i can lock in again and begin working on the kernel
day 9 of rewriting my OS 🥝
visually this is not as appealing as i would've hoped for, but we can now load the kernel (which is a 64-bit ELF binary) from the disk and run it.
this also means we've set up preliminary paging and 64-bit long mode. now the real fun part begins!