mirror of https://github.com/acidanthera/audk.git
UefiCpuPkg: Update CpuExceptionHandlerLib pass XCODE5 tool chain
https://bugzilla.tianocore.org/show_bug.cgi?id=849 In V2, use mov rax, strict qword 0 to replace the hard code db. Use the dummy address as jmp destination, and add the logic to fix up the address to the absolute address at boot time. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Andrew Fish <afish@apple.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Michael Kinney <michael.d.kinney@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
This commit is contained in:
parent
62382925c9
commit
2db0ccc2d7
|
@ -1,5 +1,5 @@
|
||||||
;------------------------------------------------------------------------------ ;
|
;------------------------------------------------------------------------------ ;
|
||||||
; Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved.<BR>
|
; Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
; This program and the accompanying materials
|
; This program and the accompanying materials
|
||||||
; are licensed and made available under the terms and conditions of the BSD License
|
; are licensed and made available under the terms and conditions of the BSD License
|
||||||
; which accompanies this distribution. The full text of the license may be found at
|
; which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -40,7 +40,7 @@ AsmIdtVectorBegin:
|
||||||
db 0x6a ; push #VectorNum
|
db 0x6a ; push #VectorNum
|
||||||
db ($ - AsmIdtVectorBegin) / ((AsmIdtVectorEnd - AsmIdtVectorBegin) / 32) ; VectorNum
|
db ($ - AsmIdtVectorBegin) / ((AsmIdtVectorEnd - AsmIdtVectorBegin) / 32) ; VectorNum
|
||||||
push rax
|
push rax
|
||||||
mov rax, ASM_PFX(CommonInterruptEntry)
|
mov rax, strict qword 0 ; mov rax, ASM_PFX(CommonInterruptEntry)
|
||||||
jmp rax
|
jmp rax
|
||||||
%endrep
|
%endrep
|
||||||
AsmIdtVectorEnd:
|
AsmIdtVectorEnd:
|
||||||
|
@ -50,7 +50,8 @@ HookAfterStubHeaderBegin:
|
||||||
@VectorNum:
|
@VectorNum:
|
||||||
db 0 ; 0 will be fixed
|
db 0 ; 0 will be fixed
|
||||||
push rax
|
push rax
|
||||||
mov rax, HookAfterStubHeaderEnd
|
mov rax, strict qword 0 ; mov rax, HookAfterStubHeaderEnd
|
||||||
|
JmpAbsoluteAddress:
|
||||||
jmp rax
|
jmp rax
|
||||||
HookAfterStubHeaderEnd:
|
HookAfterStubHeaderEnd:
|
||||||
mov rax, rsp
|
mov rax, rsp
|
||||||
|
@ -260,8 +261,7 @@ HasErrorCode:
|
||||||
; and make sure RSP is 16-byte aligned
|
; and make sure RSP is 16-byte aligned
|
||||||
;
|
;
|
||||||
sub rsp, 4 * 8 + 8
|
sub rsp, 4 * 8 + 8
|
||||||
mov rax, ASM_PFX(CommonExceptionHandler)
|
call ASM_PFX(CommonExceptionHandler)
|
||||||
call rax
|
|
||||||
add rsp, 4 * 8 + 8
|
add rsp, 4 * 8 + 8
|
||||||
|
|
||||||
cli
|
cli
|
||||||
|
@ -369,11 +369,24 @@ DoIret:
|
||||||
; comments here for definition of address map
|
; comments here for definition of address map
|
||||||
global ASM_PFX(AsmGetTemplateAddressMap)
|
global ASM_PFX(AsmGetTemplateAddressMap)
|
||||||
ASM_PFX(AsmGetTemplateAddressMap):
|
ASM_PFX(AsmGetTemplateAddressMap):
|
||||||
mov rax, AsmIdtVectorBegin
|
lea rax, [AsmIdtVectorBegin]
|
||||||
mov qword [rcx], rax
|
mov qword [rcx], rax
|
||||||
mov qword [rcx + 0x8], (AsmIdtVectorEnd - AsmIdtVectorBegin) / 32
|
mov qword [rcx + 0x8], (AsmIdtVectorEnd - AsmIdtVectorBegin) / 32
|
||||||
mov rax, HookAfterStubHeaderBegin
|
lea rax, [HookAfterStubHeaderBegin]
|
||||||
mov qword [rcx + 0x10], rax
|
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
|
ret
|
||||||
|
|
||||||
;-------------------------------------------------------------------------------------
|
;-------------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue