From 2a66650ee06ac97f42510526d52772dfccb16dcc Mon Sep 17 00:00:00 2001 From: mykola2312 <49044616+mykola2312@users.noreply.github.com> Date: Wed, 7 Aug 2024 18:00:01 +0300 Subject: [PATCH] fix bug when edx caused too big number for division --- src/mbr_test.s | 2 +- src/test_disk_read.s | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mbr_test.s b/src/mbr_test.s index 15b1fa2..72e3d79 100644 --- a/src/mbr_test.s +++ b/src/mbr_test.s @@ -36,7 +36,7 @@ entry: .bootloader: call serial_init - mov $2342424, %eax + mov $9999999, %eax call lba_to_chs .halt: jmp .halt diff --git a/src/test_disk_read.s b/src/test_disk_read.s index 9244808..7748bec 100644 --- a/src/test_disk_read.s +++ b/src/test_disk_read.s @@ -48,6 +48,7 @@ lba_to_chs: # chs->sector = (lba % conf->num_sectors + 1); mov -4(%bp), %eax # LBA movw disk_sectors, %bx + xor %dx, %dx div %ebx # dx - sector, but needs +1 inc %dx