]>
Commit | Line | Data |
---|---|---|
ff443d3e | 1 | ;------------------------------------------------------------------------------ |
2 | ; | |
584d5652 HT |
3 | ; Copyright (c) 2010, Intel Corporation. All rights reserved.<BR> |
4 | ; This program and the accompanying materials | |
ff443d3e | 5 | ; are licensed and made available under the terms and conditions of the BSD License |
6 | ; which accompanies this distribution. The full text of the license may be found at | |
7 | ; http://opensource.org/licenses/bsd-license.php | |
8 | ; | |
9 | ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, | |
10 | ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. | |
11 | ; | |
12 | ; Module Name: | |
13 | ; | |
14 | ; PageFaultHandler.asm | |
15 | ; | |
16 | ; Abstract: | |
17 | ; | |
18 | ; Defines page fault handler used to hook SMM IDT | |
19 | ; | |
20 | ;------------------------------------------------------------------------------ | |
21 | ||
6a60f8cb | 22 | EXTERN mOriginalHandler:QWORD |
23 | EXTERN PageFaultHandler:PROC | |
ff443d3e | 24 | |
25 | .code | |
26 | ||
27 | PageFaultHandlerHook PROC | |
28 | push rax ; save all volatile registers | |
29 | push rcx | |
30 | push rdx | |
31 | push r8 | |
32 | push r9 | |
33 | push r10 | |
34 | push r11 | |
35 | add rsp, -20h | |
36 | call PageFaultHandler | |
37 | add rsp, 20h | |
38 | test rax, rax | |
39 | pop r11 | |
40 | pop r10 | |
41 | pop r9 | |
42 | pop r8 | |
43 | pop rdx | |
44 | pop rcx | |
45 | pop rax ; restore all volatile registers | |
46 | jnz @F | |
47 | jmp mOriginalHandler | |
48 | @@: | |
49 | add rsp, 08h ; skip error code for PF | |
50 | iretq | |
51 | PageFaultHandlerHook ENDP | |
6a60f8cb | 52 | END |