UefiCpuPkg: Using the "movabsq" instruction to read global variable mDoFarReturnFlag and mErrorCodeFlag to avoid page fault with big RAM sizes (> 2GB).

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14920 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Laszlo Ersek 2013-11-29 04:44:22 +00:00 committed by vanjeff
parent 8b7d84ca53
commit eac8082e1d
1 changed files with 10 additions and 4 deletions

View File

@ -273,7 +273,10 @@ ASM_PFX(HookAfterStubHeaderEnd):
andl $0x0fffffff0, %esp
pushq %rcx
movq 8(%rax), %rcx
bt %ecx, ASM_PFX(mErrorCodeFlag)
pushq %rax
movabsl ASM_PFX(mErrorCodeFlag), %eax
bt %ecx, %eax
popq %rax
jc NoErrorData
pushq (%rsp) # push additional rcx to make stack alignment
NoErrorData:
@ -301,8 +304,8 @@ ASM_PFX(CommonInterruptEntry):
cmp $32, %ecx # Intel reserved vector for exceptions?
jae NoErrorCode
pushq %rax
leaq ASM_PFX(mErrorCodeFlag)(%rip), %rax
bt %ecx, (%rax)
movabsl ASM_PFX(mErrorCodeFlag), %eax
bt %ecx, %eax
popq %rax
jc CommonInterruptEntry_al_0000
@ -549,7 +552,10 @@ ErrorCode:
jmp *-24(%rsp)
DoReturn:
cmpq $0, ASM_PFX(mDoFarReturnFlag) # Check if need to do far return instead of IRET
pushq %rax
movabsq ASM_PFX(mDoFarReturnFlag), %rax
cmpq $0, %rax # Check if need to do far return instead of IRET
popq %rax
jz DoIret
pushq %rax
movq %rsp, %rax # save old RSP to rax