Skip to content

Commit 4313d46

Browse files
committed
stage1/hdd: Fix stack imbalance in disk read routine
1 parent b377c09 commit 4313d46

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

stage1/hdd/disk.asm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ read_sectors:
3434
mov si, .drive_params
3535
mov word [si], 30 ; buf_size
3636
int 0x13
37-
jc .done
37+
pushf
3838
movzx ebp, word [si+24] ; bytes_per_sect
3939

4040
; ECX byte count to CX sector count
@@ -46,10 +46,12 @@ read_sectors:
4646
setnz cl
4747
add cx, ax
4848

49+
popf
4950
pop edx
5051
pop eax
5152

5253
pop si
54+
jc .done
5355

5456
; EBP:EAX address to DAP LBA sector
5557
push eax

0 commit comments

Comments
 (0)