]>
Commit | Line | Data |
---|---|---|
ff443d3e | 1 | #------------------------------------------------------------------------------\r |
2 | #\r | |
53c76a64 | 3 | # Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r |
584d5652 | 4 | # This program and the accompanying materials\r |
ff443d3e | 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 | |
53c76a64 | 31 | \r |
32 | addq $-0x68, %rsp # reserve memory to store XMM registers and make address 16-byte alignment\r | |
33 | movdqa %xmm0, 0(%rsp) \r | |
34 | movdqa %xmm1, 0x10(%rsp)\r | |
35 | movdqa %xmm2, 0x20(%rsp)\r | |
36 | movdqa %xmm3, 0x30(%rsp)\r | |
37 | movdqa %xmm4, 0x40(%rsp)\r | |
38 | movdqa %xmm5, 0x50(%rsp)\r | |
39 | \r | |
ff443d3e | 40 | addq $-0x20, %rsp\r |
41 | call ASM_PFX(PageFaultHandler)\r | |
42 | addq $0x20, %rsp\r | |
53c76a64 | 43 | \r |
44 | movdqa 0(%rsp), %xmm0\r | |
45 | movdqa 0x10(%rsp), %xmm1\r | |
46 | movdqa 0x20(%rsp), %xmm2\r | |
47 | movdqa 0x30(%rsp), %xmm3\r | |
48 | movdqa 0x40(%rsp), %xmm4\r | |
49 | movdqa 0x50(%rsp), %xmm5\r | |
50 | addq $0x68, %rsp\r | |
51 | \r | |
52 | testb %al, %al # set ZF flag\r | |
ff443d3e | 53 | popq %r11\r |
54 | popq %r10\r | |
55 | popq %r9\r | |
56 | popq %r8\r | |
57 | popq %rdx\r | |
58 | popq %rcx\r | |
59 | popq %rax # restore all volatile registers\r | |
53c76a64 | 60 | jnz L1 # check ZF flag\r |
271d2c7f | 61 | #ifdef __APPLE__\r |
62 | int $3\r | |
63 | #else\r | |
6a60f8cb | 64 | jmpq *ASM_PFX(mOriginalHandler)\r |
271d2c7f | 65 | #endif\r |
ff443d3e | 66 | L1:\r |
67 | addq $0x08, %rsp # skip error code for PF\r | |
68 | iretq\r |