Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If any of you naysayer arsehats (you know who you are) bothered reading to the bottom of his article, you'd have seen that he has a section where you (if you do indeed know about OS development) could help him by answering his questions. I pasted it below for reference:

-----------------------------------------------------------

My research

What I’ve found out so far:

Boot sequence: BIOS;

Master Boot Record (MBR);

Bootloader – the program that takes it over from MBR and loads your Kernel;

Kernel. How to write your own MBR and write it to Disk on windows.

I’ve written a small utility in Visual C++ that allows directly to read/write from disk (download here, source included for Visual Studio 2010 Express);

How to write bare bones C kernel entry point.

How to write “naked” functions on Windows in Visual Studio

Missing link - I still don’t know how to properly step from MBR to Bootloader to Kerlen, that is – write your own MBR code that would load bootloader, pass the execution to bootloader that would load and pass execution to bare bones C kernel:

What exactly is Global Descriptor Table (GDT) and Interrupt Descriptor Table (IDT), and how it looks in C and Assembly? How and when, and again how, if when is later (for example in Long Mode or Protected Mode) to set up all this GDT and IDT stuff. They say you have to set it up before the kernel. Then they say you can set it up with dummy values and set it up later in kernel. Then they say, that to set it up, you have to be in Real Mode, so your kernel (which might be way over 1Mb of real mode space), needs to switch between modes. And then if your kernel is over 1Mb, you can’t access memory locations after 1Mb, and so on… It’s confusing, but I’m going to find it out and post it here later on.

How to handle Interrupts in C? Will they perform as callbacks that await some return values or do I have to use inline assembly to process them correctly;

Is it possible to write MBR in C? I do understand that you still have to set ORG to 7c00h, and use some specific assembly instructions, but if they could be wrapped in C using inline assembly and C entry point can be glued with few lines of assembly code, why not?



Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: