From eac8082e1dc528b748ece73ac4880bee7e4a15f3 Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Fri, 29 Nov 2013 04:44:22 +0000 Subject: 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 Reviewed-by: Jeff Fan git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14920 6f19259b-4bc3-4df7-8a09-765794883524 --- .../CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.S | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'UefiCpuPkg/Library') diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.S b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.S index 7d5672f892..6e80d848fe 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.S +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.S @@ -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 -- cgit v1.2.3