]>
Commit | Line | Data |
---|---|---|
1 | #------------------------------------------------------------------------------\r | |
2 | #\r | |
3 | # Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r | |
4 | # This program and the accompanying materials\r | |
5 | # are licensed and made available under the terms and conditions of the BSD License\r | |
6 | # which accompanies this distribution. The full text of the license may be found at\r | |
7 | # http://opensource.org/licenses/bsd-license.php\r | |
8 | #\r | |
9 | # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
10 | # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
11 | #\r | |
12 | # Module Name:\r | |
13 | #\r | |
14 | # PageFaultHandler.S\r | |
15 | #\r | |
16 | # Abstract:\r | |
17 | #\r | |
18 | # Defines page fault handler used to hook SMM IDT\r | |
19 | #\r | |
20 | #------------------------------------------------------------------------------\r | |
21 | \r | |
22 | ASM_GLOBAL ASM_PFX(PageFaultHandlerHook)\r | |
23 | ASM_PFX(PageFaultHandlerHook):\r | |
24 | pushq %rax # save all volatile registers\r | |
25 | pushq %rcx\r | |
26 | pushq %rdx\r | |
27 | pushq %r8\r | |
28 | pushq %r9\r | |
29 | pushq %r10\r | |
30 | pushq %r11\r | |
31 | addq $-0x20, %rsp\r | |
32 | call ASM_PFX(PageFaultHandler)\r | |
33 | addq $0x20, %rsp\r | |
34 | test %rax, %rax\r | |
35 | popq %r11\r | |
36 | popq %r10\r | |
37 | popq %r9\r | |
38 | popq %r8\r | |
39 | popq %rdx\r | |
40 | popq %rcx\r | |
41 | popq %rax # restore all volatile registers\r | |
42 | jnz L1\r | |
43 | #ifdef __APPLE__\r | |
44 | int $3\r | |
45 | #else\r | |
46 | jmpq *ASM_PFX(mOriginalHandler)\r | |
47 | #endif\r | |
48 | L1:\r | |
49 | addq $0x08, %rsp # skip error code for PF\r | |
50 | iretq\r |