diff --git a/bootloader/main.asm b/bootloader/main.asm index a47cc0e..9a52906 100644 --- a/bootloader/main.asm +++ b/bootloader/main.asm @@ -3,7 +3,7 @@ DISK_ID EQU 0x80 KERNEL_START EQU 0x100000 ELF_START EQU 0x8000 -NUM_SECTORS EQU 21 +NUM_SECTORS EQU 65 org 0x7C00 bits 16 diff --git a/docs/bootloader.md b/docs/bootloader.md new file mode 100644 index 0000000..bb781f1 --- /dev/null +++ b/docs/bootloader.md @@ -0,0 +1,29 @@ +# RoBootloader + +## Low Memory + +| start | end | use | +|---------|---------|---------------------------| +| 0x00000 | 0x004ff | BIOS stuff, don't touch | +| 0x00500 | 0x06bff | _free space_ | +| 0x06c00 | 0x07bff | **Bootloader stack** | +| 0x07c00 | 0x07dff | Bootloader | +| 0x07e00 | 0x07fff | _free space_ | +| 0x08000 | 0x0ffff | **ELF file** (64 sectors) | +| 0x10000 | 0x7ffff | **kernel space** | +| 0x80000 | 0x9ffff | EDBA, partially usable | +| 0xa0000 | 0xfffff | unusable | + +## Drive layout + +The first 512 bytes are the bootloader, right after that the 32-bit kernel ELF-file, this kernel can be 32KiB big. In the future, this "kernel" can be replaced by a second stage of the bootloader. + +## Known issues + +### USB Boot + +It doesn't boot the kernel from USB, as BIOS does not recognize USB as valid hard drive for int 13, only hard drives and floppies. Thus it loads sectors 2-65 from the hard drive. If this is written on a hard drive, it could work if DRIVE_ID is set correctly. + +### Stack setup + +As I don't quite get how segments work in real mode, there are most likely errors in the way I set up my stack. I'm going on a _it works on my qemu_ approach currently.