(no title)
Dessesaf | 2 years ago
Then you compile this with GCC flags that tell GCC to not include a standard library (e.g. compile for bare metal).
Then you link with a very simple linker script that tells ld to put the multiboot header before your actual program.
Then, if you want to run on your own hardware, you change the GRUB config file to load your binary and reboot. Or if you want to run in QEMU, you just load the binary with QEMU. Using QEMU is probably simpler, since you're less likely to run into hardware weirdness at the beginning.
Then, you'd start with just writing to a text buffer, which has a hardcoded address on old architectures (it makes sense to start with an architecture where that's the case). That way, you can print stuff to the screen. That's enough to do a lot of very cool stuff already. After that, you configure interrupts, which you do by hard-coding some function pointers in a table using assembly. Then you use some special instructions to load these interrupt handler tables on startup. Now you can do all kinds of interactive things.
No comments yet.