[edk2-devel] [PATCH v3 3/3] UefiCpuPkg/CpuExceptionHandler: Revert CpuExceptionHandler binary patching
Lendacky, Thomas
thomas.lendacky at amd.com
Thu May 7 13:06:50 UTC 2020
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2340
Now that an XCODE5 specific CpuExceptionHandlerLib library is in place,
revert the changes made to the ExceptionHandlerAsm.nasm in commit
2db0ccc2d7fe ("UefiCpuPkg: Update CpuExceptionHandlerLib pass XCODE5 tool
chain") so that binary patching of flash code is not performed.
Cc: Eric Dong <eric.dong at intel.com>
Cc: Ray Ni <ray.ni at intel.com>
Cc: Laszlo Ersek <lersek at redhat.com>
Cc: Liming Gao <liming.gao at intel.com>
Acked-by: Bret Barkelew <bret.barkelew at microsoft.com>
Reviewed-by: Laszlo Ersek <lersek at redhat.com>
Signed-off-by: Tom Lendacky <thomas.lendacky at amd.com>
---
.../X64/ExceptionHandlerAsm.nasm | 25 +++++--------------
1 file changed, 6 insertions(+), 19 deletions(-)
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm
index 19198f273137..3814f9de3703 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm
@@ -34,7 +34,7 @@ AsmIdtVectorBegin:
db 0x6a ; push #VectorNum
db ($ - AsmIdtVectorBegin) / ((AsmIdtVectorEnd - AsmIdtVectorBegin) / 32) ; VectorNum
push rax
- mov rax, strict qword 0 ; mov rax, ASM_PFX(CommonInterruptEntry)
+ mov rax, ASM_PFX(CommonInterruptEntry)
jmp rax
%endrep
AsmIdtVectorEnd:
@@ -44,8 +44,7 @@ HookAfterStubHeaderBegin:
@VectorNum:
db 0 ; 0 will be fixed
push rax
- mov rax, strict qword 0 ; mov rax, HookAfterStubHeaderEnd
-JmpAbsoluteAddress:
+ mov rax, HookAfterStubHeaderEnd
jmp rax
HookAfterStubHeaderEnd:
mov rax, rsp
@@ -257,7 +256,8 @@ HasErrorCode:
; and make sure RSP is 16-byte aligned
;
sub rsp, 4 * 8 + 8
- call ASM_PFX(CommonExceptionHandler)
+ mov rax, ASM_PFX(CommonExceptionHandler)
+ call rax
add rsp, 4 * 8 + 8
cli
@@ -365,24 +365,11 @@ DoIret:
; comments here for definition of address map
global ASM_PFX(AsmGetTemplateAddressMap)
ASM_PFX(AsmGetTemplateAddressMap):
- lea rax, [AsmIdtVectorBegin]
+ mov rax, AsmIdtVectorBegin
mov qword [rcx], rax
mov qword [rcx + 0x8], (AsmIdtVectorEnd - AsmIdtVectorBegin) / 32
- lea rax, [HookAfterStubHeaderBegin]
+ mov rax, HookAfterStubHeaderBegin
mov qword [rcx + 0x10], rax
-
-; Fix up CommonInterruptEntry address
- lea rax, [ASM_PFX(CommonInterruptEntry)]
- lea rcx, [AsmIdtVectorBegin]
-%rep 32
- mov qword [rcx + (JmpAbsoluteAddress - 8 - HookAfterStubHeaderBegin)], rax
- add rcx, (AsmIdtVectorEnd - AsmIdtVectorBegin) / 32
-%endrep
-; Fix up HookAfterStubHeaderEnd
- lea rax, [HookAfterStubHeaderEnd]
- lea rcx, [JmpAbsoluteAddress]
- mov qword [rcx - 8], rax
-
ret
;-------------------------------------------------------------------------------------
--
2.17.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#58789): https://edk2.groups.io/g/devel/message/58789
Mute This Topic: https://groups.io/mt/74049689/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list