Skip to content

Commit 81a3489

Browse files
nivedita76Ingo Molnar
authored and
Ingo Molnar
committed
x86/boot: Use unsigned comparison for addresses
The load address is compared with LOAD_PHYSICAL_ADDR using a signed comparison currently (using jge instruction). When loading a 64-bit kernel using the new efi32_pe_entry() point added by: 97aa276 ("efi/x86: Add true mixed mode entry point into .compat section") using Qemu with -m 3072, the firmware actually loads us above 2Gb, resulting in a very early crash. Use the JAE instruction to perform a unsigned comparison instead, as physical addresses should be considered unsigned. Signed-off-by: Arvind Sankar <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected]
1 parent 8acf63e commit 81a3489

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

arch/x86/boot/compressed/head_32.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ SYM_FUNC_START(startup_32)
105105
notl %eax
106106
andl %eax, %ebx
107107
cmpl $LOAD_PHYSICAL_ADDR, %ebx
108-
jge 1f
108+
jae 1f
109109
#endif
110110
movl $LOAD_PHYSICAL_ADDR, %ebx
111111
1:

arch/x86/boot/compressed/head_64.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ SYM_FUNC_START(startup_32)
105105
notl %eax
106106
andl %eax, %ebx
107107
cmpl $LOAD_PHYSICAL_ADDR, %ebx
108-
jge 1f
108+
jae 1f
109109
#endif
110110
movl $LOAD_PHYSICAL_ADDR, %ebx
111111
1:
@@ -305,7 +305,7 @@ SYM_CODE_START(startup_64)
305305
notq %rax
306306
andq %rax, %rbp
307307
cmpq $LOAD_PHYSICAL_ADDR, %rbp
308-
jge 1f
308+
jae 1f
309309
#endif
310310
movq $LOAD_PHYSICAL_ADDR, %rbp
311311
1:

0 commit comments

Comments
 (0)