I have tried to boot Invaders, a small multiboot compliant kernel game, and found that it was not working(triple faults). After a lot of painful debugging, I found the bug in grub-core/loader/i386/multiboot_mbi.c. Here is the patch:
=== modified file 'grub-core/loader/i386/multiboot_mbi.c' --- grub-core/loader/i386/multiboot_mbi.c 2010-09-29 21:51:12 +0000 +++ grub-core/loader/i386/multiboot_mbi.c 2010-12-15 21:25:52 +0000 @@ -141,7 +141,7 @@
}
-- The bug is very simple, but tough to find. "(grub_uint32_t *) source + load_size" will give the resultant address as "source + 4 * load_size", since source is made 32-bit pointer. But it is wrong because load_size is the size in bytes. So "source" should also be treated in bytes, i.e. grub_uint8_t. Hence a single line fix will solve the problem. Pfa the patch file. I have read the multiboot specs from here. I have used grub_printf to debug. I would like to know if there is any better debugging technique for memory debugging.