check gpt partition magic
This commit is contained in:
1 parent
1bad40143e
commit
f645368a06
1 file changed
+12
-3
@@ -46,7 +46,7 @@ bits 16
|
||||
mov di, 0x00
|
||||
mov ah, 0x08
|
||||
int 0x13
|
||||
jc panic
|
||||
jc .panic
|
||||
and cl, 0x3f ; sectors per track
|
||||
mov [bp + 1], cl
|
||||
movzx bx, dh
|
||||
@@ -70,7 +70,7 @@ bits 16
|
||||
mov bx, 0x7e00
|
||||
mov dl, [bp] ; drive number
|
||||
int 0x13
|
||||
jc panic
|
||||
jc .panic
|
||||
|
||||
; head = temp % number of heads
|
||||
; cylinder = temp / number of heads
|
||||
@@ -80,6 +80,12 @@ bits 16
|
||||
mov ax, 0x0003
|
||||
int 0x10
|
||||
|
||||
mov cx, 8
|
||||
mov si, .gpt_magic
|
||||
mov di, 0x7e00
|
||||
repe cmpsb
|
||||
jne .panic
|
||||
|
||||
; mov word fs:[0x0000], 0xc048
|
||||
; mov word fs:[0x0002], 0xc069
|
||||
mov al, [0x7e00]
|
||||
@@ -90,7 +96,7 @@ bits 16
|
||||
mov byte fs:[0x0004], al
|
||||
hlt
|
||||
|
||||
panic:
|
||||
.panic:
|
||||
mov ax, 0x0003
|
||||
int 0x10
|
||||
mov ax, 0xb800
|
||||
@@ -118,6 +124,9 @@ panic:
|
||||
; - Boot from UEFI
|
||||
; - Boot on non-GPT partitioned disk
|
||||
|
||||
.gpt_magic:
|
||||
db "EFI PART"
|
||||
|
||||
; MBR bootstrap field is 440 bytes long
|
||||
%if ($ - $$) > 440
|
||||
%error "exceeded mbr bootstrap field size"
|
||||
|
||||
Reference in new issue
Block a user