Start to Finish: Calling kmain
From XOmB wiki
|This page is part of a series on XBB From Start to Finish.
 Inside of kmain
Congratulations! You're finally free of all of that legacy crap and actually kmain is a little different than your usual main() function. Instead of argc and argv, you get the bootloader id and data points to a structure that the bootloader hands over. In our case, we're using GRUB, so in this specific instance, the id is a magic number. It should always be '0x2BADB002', which is defined in
 And They're Off!!!
Anyway, now you're home free! This is where we let off, and you start. You can code in D itself in kmain. However, you only have access to the kernel runtime, and so you can't do everything that you could with normal D. Most of it is there, however. With XBB, we just print to the screen and then loop into infinity. This is where all of the logic of your kernel will go. What you do with the rest of kmain is up to you.