bounds check gpt starting lba

This commit is contained in:
pantonshire committed 2024-07-04 09:54:17 +01:00
1 parent f645368a06
commit f86617e750
1 file changed
+16 -8
+16 -8
View File
@@ -86,14 +86,22 @@ bits 16
repe cmpsb repe cmpsb
jne .panic jne .panic
; mov word fs:[0x0000], 0xc048 ; Ensure the 8-byte starting LBA fits in 16 bits
; mov word fs:[0x0002], 0xc069 mov di, 0x7e00 ; the rep increments di so we need to reset it
mov al, [0x7e00] xor bx, bx
mov byte fs:[0x0000], al mov ax, [di + 0x4a]
mov al, [0x7e01] or bx, ax
mov byte fs:[0x0002], al mov ax, [di + 0x4c]
mov al, [0x7e02] or bx, ax
mov byte fs:[0x0004], al mov ax, [di + 0x4e]
or bx, ax
jnz .panic
mov ax, [di + 0x48]
mov word fs:[0x0000], 0xc048
mov word fs:[0x0002], 0xc069
hlt hlt
.panic: .panic: