# EFIAPI\r
# InternalX86DisablePaging64 (\r
# IN UINT16 Cs,\r
-# IN UINT64 EntryPoint,\r
-# IN UINT64 Context1, OPTIONAL\r
+# IN UINT32 EntryPoint,\r
+# IN UINT32 Context1, OPTIONAL\r
# IN UINT32 Context2, OPTIONAL\r
-# IN UINT64 NewStack\r
+# IN UINT32 NewStack\r
# );\r
#------------------------------------------------------------------------------\r
\r
ASM_GLOBAL ASM_PFX(InternalX86DisablePaging64)\r
ASM_PFX(InternalX86DisablePaging64):\r
cli \r
- shl $0x20,%rcx # rcx[32..47] <- Cs\r
- lea L1, %eax\r
+ lea L1(%rip), %r10\r
mov %r8d, %esi \r
- or %rax, %rcx # rcx[0..47] <- Cs:@F\r
mov %r9d, %edi \r
mov 0x28(%rsp), %eax # eax <- New Stack\r
- push %rcx\r
- ret # switch to compatibility mode\r
+ push %rcx # push Cs to stack\r
+ push %r10\r
+ .byte 0x48, 0xcb # retq: Use far return to load CS register from stack\r
+ # (Use raw byte code since some GNU assemblers generates incorrect code for "retq") \r
L1:\r
mov %eax,%esp # set up new stack\r
mov %cr0,%rax\r