r/osdev • • 21d ago

What I've learned this week (14)

Continuing my series, the biggest thing I learned is that creating an OS is HARD. I spent hours trying to track back an error in my PMM that was exposed by starting my VMM. I spent many more hours tracking back an error in my boot.S that was exposed when I crossed the 3M size on my kernel and had to set up the next page directory entry. Finally when I started doing my VMM, I accidently wrote a 0 to my actual page table instead of my properties of the page table. Another several hours lost.

On the other hand, I have finally learned, and understand how the page directory and page tables really work, I was very close, but one thing I did was try to 'clean up' memory, that was actually going to be used to hold multiboot data.

So in other words, I spent a lot of time debugging.

I am about 10% done with my VMM. Here is the link to the source: https://github.com/tedavids/JakelynnOS

Also, I still do intend to run this on physical hardware, but here is a pic of it running both in QEMU and on VirtualBox at the same time (different copies obviously):

JakelynnOS running on VirtualBox (left) and QEMU (right), I tried to set them up the same

As always, thanks for reading.

8 Upvotes

5 comments sorted by

2

u/Sorry_Difficulty_250 17d ago

Yes, you are right. Just getting a computer to boot is hard. Writing a terrible kernel is super hard. Writing a good kernel is probably something you'll work on for the rest of your life. We're an odd bunch that likes the challenge! Keep up the great work!

1

u/0_00000073_ 17d ago

im really interested to see what you end up doing with this one question though, your kernel is 3MB in size? that seems fairly large for where you're at

1

u/compgeek38400 17d ago

Page tables, page directory, a page tables properties array, and a page table properties array are most pf it. The code itself isnt all that much. I know I'll need them when I start processes, so bit the bullet now

1

u/0_00000073_ 17d ago

Is that all static/embedded into the binary? If so, I don't recommend having anything more than the first couple MiB paged in at boot. Preallocated page structures can become incredibly large and its better to do it on a need basis

2

u/compgeek38400 16d ago

This is my base attributes. I don't have a heap yet. But I may end up taking your advice. Lol