Nim OSDev

Nim OSDev

9 devlogs
11h 43m
Created by Segfault

An operating system written in Nim

Timeline

IDT and ISRs done! There isn't really a good way to show this, so here's some more of my code again.

Update attachment

I got the GDT working! There were struct fields that were mixed up, causing a GPF, then a double fault, then a triple fault, causing the OS to reset. Fixed now though!

Update attachment

I got the memory to work! PMM, VMM, and the higher half! Now for the GDT...

Update attachment

I've been working on virtual memory management, and in theory, it should work. Spoiler: it doesn't. According to Hackatime, three hours twenty minutes. And I have no idea why it doesn't work. On the plus side, I'm in the higher half!

Update attachment

That took a lot longer than whatever Hackatime is claiming, but I don't care, THE BUG IS FIXED! I wasn't calling NimMain() in my kernel, which is what initializes the runtime and stuff I was relying on. So instead of me getting something obvious, string interpolation with integers was messed up. Nothing else, just string interpolation with integers. Wow.

Below you can see a nice memory map table in the debug console though!

Update attachment

It finally loads my kernel! I nearly had a panic attack, as I took a one hour break, and when I came back, it was crashing. All fine now though, somehow my UEFI vars had been nuked (whoops), so I reset them, and now it works!!

Update attachment

Well, more standard UEFI bootup procedures. Probably the hardest was it resetting without an error, and I figured it out -- I wasn't hanging it, so it was just exiting normally, which it shouldn't do.

Update attachment

Hello world is finally working! This is still just in the UEFI bootloader, we aren't even in the kernel yet sadly :/

On the plus side, I have a good, Nim idiomatic API, and the echo keyword is working like in the base language.

Update attachment

I finally got Nim to cross compile to a UEFI executable! This is going to be great for my bootloader, the issue was, Nim was trying to use headers from my system folder to compile, and the headers were stdio.h and stdlib.h. Since these are not host-independent, I had to implement dummy headers that were placed in the include path instead that just prototyped the functions needed, even though they all have a dummy implementation.

Update attachment
Segfault Segfault 9 months ago

Yay, thank you! DMed you back

fluffy fluffy 9 months ago

I see you’re doing an os project as well! I was beginning to think no one else was, we should work together :3

Let me know if you need help or anything, i’ll message you on slack.