diff options
Diffstat (limited to 'boot/arch/amd64/mbr/mbr.S')
| -rw-r--r-- | boot/arch/amd64/mbr/mbr.S | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/boot/arch/amd64/mbr/mbr.S b/boot/arch/amd64/mbr/mbr.S index 1ce1da1..5d876c2 100644 --- a/boot/arch/amd64/mbr/mbr.S +++ b/boot/arch/amd64/mbr/mbr.S @@ -56,12 +56,22 @@ reloc: /* Get stage2 */ call find_stage2 -1: cli - hlt - jmp 1b + + /* Obtain the data offset */ + mov $BOOT_SEG, %ax + mov %ax, %ds + add $40, %si + movw (%si), %ax + + /* Jump to stage 2 */ + pushw $BOOT_SEG + pushw %ax + lret /* * Locate stage2 on the disk + * + * Stage 2 data descriptor is returned in %SI */ find_stage2: push %ds @@ -98,12 +108,11 @@ find_stage2: rep cmpsb jne 1b + mov %dx, %si stc pop %es pop %ds jnc .not_found - - /* TODO: On found, return the offset to the data in %CX */ ret .not_found: pop %ds @@ -124,7 +133,6 @@ find_stage2: hlt jmp 1b - /* * Read sectors from the disk */ |
