From 3c200891bfcffbf62ac572cd6841a09a0a69e247 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Fri, 16 Jun 2017 09:13:29 +0200 Subject: fixed loading of kernel in stage2 grossing 64k --- src/boot/stage2_check_magic.asm | 2 -- src/boot/stage2_real_functions.asm | 9 +++++++-- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src/boot') diff --git a/src/boot/stage2_check_magic.asm b/src/boot/stage2_check_magic.asm index 7339a89..479da26 100644 --- a/src/boot/stage2_check_magic.asm +++ b/src/boot/stage2_check_magic.asm @@ -20,7 +20,6 @@ check_magic: .ok: mov si, MAGIC_OK_MSG call pm_print_string - mov edx, esi call pm_print_hex call pm_print_newline xor eax, eax @@ -28,7 +27,6 @@ check_magic: .mismatch: mov si, MAGIC_NOT_OK_MSG call pm_print_string - mov edx, esi call pm_print_hex call pm_print_newline xor eax, eax diff --git a/src/boot/stage2_real_functions.asm b/src/boot/stage2_real_functions.asm index 8b4b5af..3810963 100644 --- a/src/boot/stage2_real_functions.asm +++ b/src/boot/stage2_real_functions.asm @@ -88,9 +88,9 @@ probe_and_fix_disk_geometry: ; IN dl: drive to read from read_from_disk: - mov bx, 0 ; where to store the data + mov bx, 0x0880 ; where to store the data mov es, bx - mov bx, 0x8800 ; 3072 bytes after first sector + mov bx, 0x0 ; 3072 bytes after first sector .read_next_sector: @@ -108,6 +108,11 @@ read_from_disk: jmp .read_next_sector .next_head: + shr bx, 4 ; make it a segment offset.. + mov ax, es + add ax, bx + mov es, ax ; ..and add it to ES + mov bx, 0x0 ; we also reset bx and update es to avoid hitting the 64k wrap around point mov [CURRENT_SECTOR], BYTE 1 ; start from first sector again add [CURRENT_HEAD], BYTE 1 ; advance head mov ch, [NOF_HEADS] -- cgit v1.2.3-54-g00ecf