bootsect: Also handle if boot drive is above 0x8f and gracefully fail if that's the case

This commit is contained in:
mintsuki 2021-05-23 04:15:36 +02:00
parent 977b00f0b3
commit 3790d26194
1 changed files with 20 additions and 11 deletions

View File

@ -27,13 +27,11 @@ start:
; So if the value the BIOS passed is <0x80, just assume it has passed ; So if the value the BIOS passed is <0x80, just assume it has passed
; an incorrect value. ; an incorrect value.
cmp dl, 0x80 cmp dl, 0x80
jae .continue jb floppy_err
; Values above 0x8f are dubious so we assume we weren't booted properly
; Error out (BX zeroed out above) ; for those either
push 0xb800 cmp dl, 0x8f
pop es ja hdd_err
mov dword [es:bx], 'F ! '
jmp err
.continue: .continue:
; Make sure int 13h extensions are supported ; Make sure int 13h extensions are supported
@ -75,10 +73,6 @@ start:
jmp 0x08:vector jmp 0x08:vector
err:
hlt
jmp err
times 0xda-($-$$) db 0 times 0xda-($-$$) db 0
times 6 db 0 times 6 db 0
@ -87,6 +81,21 @@ times 6 db 0
%include 'disk.asm' %include 'disk.asm'
%include '../gdt.asm' %include '../gdt.asm'
err:
push 0xb800
pop es
mov dword [es:0], eax
.h: hlt
jmp .h
floppy_err:
mov eax, 'F ! '
jmp err
hdd_err:
mov eax, 'H ! '
jmp err
bits 32 bits 32
vector: vector:
mov eax, 0x10 mov eax, 0x10