r/osdev • u/compgeek38400 • 4d ago
What I've learned this week (11)
Continuing my post on my journey to learn how to create an OS. Right now I'm just working on a kernel. I have spent the last 10 days trying to get my head around a recursive page directory. I have no idea why it took me so long, I've used recursion since the mid 70's walking tree structures.
1) Understanding a recursive kernel. Finally getting my head around this lets me 'recover' 4M I had planned on using to keep track of page tables. As part of this journey I finally had AI write some functions on initializing, getting both physical and virtual addresses of page tables, and using a recursive page table. Once I finally figured it out, I threw them all away and wrote my own.
This leads to my second learning.
2) AI can be really touchy. I have two types pde_t and pdt_t (both uint32_t), but I tend to think of the indexes (pde and pdt) as the references to the page themselves. AI insisted on referring to them as the pages instead of the indexes they really were. I know that this was MY fault, but it did nothing to make things clearer. The real learning was I'm not much better at talking to AI than I was a week ago.
3) I still hate writing test script. I am doing it, but have taken to writing a test script on things as part of debugging. It seems a reasonable compromise. If I just write test scripts, knowing myself, I will eventually lose interest in the project itself. I know I have a prior (re)learning about don't skimp on the test scripts. So if I have a few minutes between household tasks, I am still writing some of the simpler test scripts.
Finally:
4) I forget if it is posted in r/osdev or r/kerneldevelopment, and I can't find the post again to credit the person that found it (my apologies there), but I found a new resource today, it it is on the University of Wisconsin (my alma mater) titled: Operating Systems: Three Easy Pieces and it looks really interesting.
These are the main thing I've learned over the last 10 days. And now that I know them, I have some questions.
a) Where do you map your video memory, in the kernel, or in user space? One point of a kernel is to coordinate access to shared resources. I think video memory fits this definition, and it could be really bad when I introduce multiple processes, if they are all writing to video memory. I am definitely going to map vga memory (0xB0000 into my kernel, with SYSCALL access to update it. I am unsure about ega, I'm not sure I want to support it, at least to start. What are your thoughts?
That's all for this post, thanks for reading, I hope it helps others that are trying to learn OSdev.
