1 ;------------------------------------------------------------------------------
3 ; Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>
4 ; This program and the accompanying materials
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
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.
14 ; PageFaultHandler.asm
18 ; Defines page fault handler used to hook SMM IDT
20 ;------------------------------------------------------------------------------
22 EXTERN mOriginalHandler:QWORD
23 EXTERN PageFaultHandler:PROC
27 PageFaultHandlerHook PROC
28 push rax ; save all volatile registers
36 add rsp, -10h * 6 - 8 ; reserve memory to store XMM registers and make address 16-byte alignment
38 movdqa [rsp + 10h], xmm1
39 movdqa [rsp + 20h], xmm2
40 movdqa [rsp + 30h], xmm3
41 movdqa [rsp + 40h], xmm4
42 movdqa [rsp + 50h], xmm5
49 movdqa xmm1, [rsp + 10h]
50 movdqa xmm2, [rsp + 20h]
51 movdqa xmm3, [rsp + 30h]
52 movdqa xmm4, [rsp + 40h]
53 movdqa xmm5, [rsp + 50h]
56 test al, al ; set ZF flag
63 pop rax ; restore all volatile registers
64 jnz @F ; check ZF flag
67 add rsp, 08h ; skip error code for PF
69 PageFaultHandlerHook ENDP