G33K @ Work | Geeky stuff



OS Development Demo Code

A while ago, I wrote some demo code to demonstrate various things you need to do to write your own operating system.
In May 2010 I held a lecture and workshop about this code and the concepts at SigInt conference in Cologne, Germany.

I just thought that this code may be interesting to other people who did not attend this conference.

The demo code includes mainly x86 specific stuff and it is truly demo code, so don’t just copy it into another project. Even if it works at first sight, it it is highly likely to break sooner or later 😉

The code contains samples for:

  • A small „Hello World“ bootsector in realmode
  • A sample how to enable the A20 gate. This works at least in QEMU
  • Loading a barebone-kernel written in C by GRUB
  • Switching to protected mode and writing to the textmode framebuffer
  • Handling interrupts in protected mode using the old PIC
  • Configuring and using the old PIT (Timer)
  • Switching to longmode (64 Bit)
  • A multitasking demo how to do context switching

The first two samples are completely written in Assembly and are loaded directly by the BIOS from a floppy drive. All other samples are mainly written in C spiced with some Assembly and are loaded from a FAT formatted floppy disk by a GRUB bootloader.

For those of you who speak german, here are the slides of the conference:

If you do anything with this demo code, I would appreciate to hear about your project or experiences. Also, If there are specific questions or problems about/with this code which are not easily resolvable by Googling and using your brain, feel free to ask in the comments. 😉

RSS Feed

No comments yet.

Leave a comment!