diff options
Diffstat (limited to 'bootmain.c')
-rw-r--r-- | bootmain.c | 57 |
1 files changed, 27 insertions, 30 deletions
@@ -1,34 +1,31 @@ #include "types.h" #include "elf.h" #include "x86.h" - -/********************************************************************** - * This a dirt simple boot loader, whose sole job is to boot - * an elf kernel image from the first IDE hard disk. - * - * DISK LAYOUT - * * This program(boot.S and main.c) is the bootloader. It should - * be stored in the first sector of the disk. - * - * * The 2nd sector onward holds the kernel image. - * - * * The kernel image must be in ELF format. - * - * BOOT UP STEPS - * * when the CPU boots it loads the BIOS into memory and executes it - * - * * the BIOS intializes devices, sets of the interrupt routines, and - * reads the first sector of the boot device(e.g., hard-drive) - * into memory and jumps to it. - * - * * Assuming this boot loader is stored in the first sector of the - * hard-drive, this code takes over... - * - * * control starts in bootloader.S -- which sets up protected mode, - * and a stack so C code then run, then calls cmain() - * - * * cmain() in this file takes over, reads in the kernel and jumps to it. - **********************************************************************/ +// This a dirt simple boot loader, whose sole job is to boot +// an elf kernel image from the first IDE hard disk. +// +// DISK LAYOUT +// * This program(boot.S and main.c) is the bootloader. It should +// be stored in the first sector of the disk. +// +// * The 2nd sector onward holds the kernel image. +// +// * The kernel image must be in ELF format. +// +// BOOT UP STEPS +// * when the CPU boots it loads the BIOS into memory and executes it +// +// * the BIOS intializes devices, sets of the interrupt routines, and +// reads the first sector of the boot device(e.g., hard-drive) +// into memory and jumps to it. +// +// * Assuming this boot loader is stored in the first sector of the +// hard-drive, this code takes over... +// +// * control starts in bootloader.S -- which sets up protected mode, +// and a stack so C code then run, then calls cmain() +// +// * cmain() in this file takes over, reads in the kernel and jumps to it. #define SECTSIZE 512 #define ELFHDR ((struct elfhdr*) 0x10000) // scratch space @@ -62,7 +59,7 @@ bad: outw(0x8A00, 0x8A00); outw(0x8A00, 0x8E00); while(1) - /* do nothing */; + ; } // Read 'count' bytes at 'offset' from kernel into virtual address 'va'. @@ -96,7 +93,7 @@ waitdisk(void) { // wait for disk reaady while((inb(0x1F7) & 0xC0) != 0x40) - /* do nothing */; + ; } void |