fix off-by-one error in stage 2 prelude
This commit is contained in:
1 parent
9e5cbaf07b
commit
da529e8426
1 file changed
+11
-6
+11
-6
@@ -51,10 +51,10 @@ prelude:
|
||||
mov sp, bp
|
||||
|
||||
mov si, [REAL_GLOBALS + STAGE_2_GPT_ENTRY_ADDR]
|
||||
mov eax, [si + 0x20] ; Partition / boot1 start LBA lower
|
||||
mov ebx, [si + 0x24] ; Partition / boot1 start LBA upper
|
||||
mov eax, [si + 0x20] ; Partition / s2 start LBA lower
|
||||
mov ebx, [si + 0x24] ; Partition / s2 start LBA upper
|
||||
mov ecx, [si + 0x28] ; Partition end LBA lower
|
||||
mov edx, [si + 0x32] ; Partition LBA upper
|
||||
mov edx, [si + 0x32] ; Partition end LBA upper
|
||||
|
||||
; Panic if the partition / boot1 starting LBA overflows 16 bits.
|
||||
or ebx, ebx
|
||||
@@ -64,10 +64,15 @@ prelude:
|
||||
jnz panic_simple
|
||||
ror eax, 16
|
||||
|
||||
; Calculate the s2 end LBA and panic if it overflows 16 bits.
|
||||
; There must be at least one sector to load.
|
||||
mov bx, s2_bin_sectors
|
||||
or bx, bx
|
||||
jz panic_simple
|
||||
|
||||
; Calculate the s2 end LBA (inclusive) and panic if it overflows 16 bits.
|
||||
; n.b. ebx is zero before this so both bx and ebx can be used as the s2 end LBA.
|
||||
mov bx, ax
|
||||
add bx, s2_bin_sectors
|
||||
dec bx
|
||||
add bx, ax
|
||||
jc panic_simple
|
||||
|
||||
; Panic if the s2 end LBA is after the partition end LBA.
|
||||
|
||||
Reference in new issue
Block a user