summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <[email protected]>2025-03-15 14:25:37 +0000
committerTom Rini <[email protected]>2025-04-03 11:41:55 -0600
commitf5f1ed8ae7395dbffa611823457a3beeda462577 (patch)
tree00f50864f99f2334f021f1b38553c9cfcb721a9b
parent3c7ab12249a986267f0eb60dffaa85c1f254148e (diff)
x86: Disable paging before changing to long mode
This is required as part of the procedure. The existing code works because it changes the GDT at the same time, but this makes kvm unhappy. Update the algorithm to disable and then re-enable paging. Signed-off-by: Simon Glass <[email protected]>
-rw-r--r--arch/x86/cpu/i386/call64.S8
1 files changed, 7 insertions, 1 deletions
diff --git a/arch/x86/cpu/i386/call64.S b/arch/x86/cpu/i386/call64.S
index 424732fa3fa..f979f9e5f0e 100644
--- a/arch/x86/cpu/i386/call64.S
+++ b/arch/x86/cpu/i386/call64.S
@@ -25,6 +25,11 @@ cpu_call64:
push %edx /* arg1 = setup_base */
mov %eax, %ebx
+ # disable paging
+ movl %cr0, %eax
+ andl $~X86_CR0_PG, %eax
+ movl %eax, %cr0
+
/* Load new GDT with the 64bit segments using 32bit descriptor */
leal gdt, %eax
movl %eax, gdt+2
@@ -67,7 +72,8 @@ cpu_call64:
pushl %eax
/* Enter paged protected Mode, activating Long Mode */
- movl $(X86_CR0_PG | X86_CR0_PE), %eax
+ movl %cr0, %eax
+ orl $X86_CR0_PG, %eax
movl %eax, %cr0
/* Jump from 32bit compatibility mode into 64bit mode. */