;------------------------------------------------------------------------------ ;\r
-; Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved.<BR>\r
+; Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.<BR>\r
; This program and the accompanying materials\r
; are licensed and made available under the terms and conditions of the BSD License\r
; which accompanies this distribution. The full text of the license may be found at\r
db 0x6a ; push #VectorNum\r
db ($ - AsmIdtVectorBegin) / ((AsmIdtVectorEnd - AsmIdtVectorBegin) / 32) ; VectorNum\r
push rax\r
- mov rax, ASM_PFX(CommonInterruptEntry)\r
+ mov rax, strict qword 0 ; mov rax, ASM_PFX(CommonInterruptEntry)\r
jmp rax\r
%endrep\r
AsmIdtVectorEnd:\r
@VectorNum:\r
db 0 ; 0 will be fixed\r
push rax\r
- mov rax, HookAfterStubHeaderEnd\r
+ mov rax, strict qword 0 ; mov rax, HookAfterStubHeaderEnd\r
+JmpAbsoluteAddress:\r
jmp rax\r
HookAfterStubHeaderEnd:\r
mov rax, rsp\r
; and make sure RSP is 16-byte aligned\r
;\r
sub rsp, 4 * 8 + 8\r
- mov rax, ASM_PFX(CommonExceptionHandler)\r
- call rax\r
+ call ASM_PFX(CommonExceptionHandler)\r
add rsp, 4 * 8 + 8\r
\r
cli\r
; comments here for definition of address map\r
global ASM_PFX(AsmGetTemplateAddressMap)\r
ASM_PFX(AsmGetTemplateAddressMap):\r
- mov rax, AsmIdtVectorBegin\r
+ lea rax, [AsmIdtVectorBegin]\r
mov qword [rcx], rax\r
mov qword [rcx + 0x8], (AsmIdtVectorEnd - AsmIdtVectorBegin) / 32\r
- mov rax, HookAfterStubHeaderBegin\r
+ lea rax, [HookAfterStubHeaderBegin]\r
mov qword [rcx + 0x10], rax\r
+\r
+; Fix up CommonInterruptEntry address\r
+ lea rax, [ASM_PFX(CommonInterruptEntry)]\r
+ lea rcx, [AsmIdtVectorBegin]\r
+%rep 32\r
+ mov qword [rcx + (JmpAbsoluteAddress - 8 - HookAfterStubHeaderBegin)], rax\r
+ add rcx, (AsmIdtVectorEnd - AsmIdtVectorBegin) / 32\r
+%endrep\r
+; Fix up HookAfterStubHeaderEnd\r
+ lea rax, [HookAfterStubHeaderEnd]\r
+ lea rcx, [JmpAbsoluteAddress]\r
+ mov qword [rcx - 8], rax\r
+\r
ret\r
\r
;-------------------------------------------------------------------------------------\r