1. Fix the bug that we should use rip relative addressing for x64 label to prevent GNU assembly generate incorrect code.

2. Sync the bug fix of MS assembly in r8455.
3. Correct the function prototype in comments.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8456 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qhuang8 2009-06-03 08:15:18 +00:00
parent 1a76fbef84
commit 2561f56540
1 changed files with 8 additions and 8 deletions

View File

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