2 ; This is the assembly code for page fault handler hook.
4 ; Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
6 ; This program and the accompanying materials
7 ; are licensed and made available under the terms and conditions of the BSD License
8 ; which accompanies this distribution. The full text of the license may be found at
9 ; http://opensource.org/licenses/bsd-license.php
11 ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 extern ASM_PFX(PageFaultHandler)
21 global ASM_PFX(PageFaultHandlerHook)
22 ASM_PFX(PageFaultHandlerHook):
27 ;push rax ; save all volatile registers
34 ; save volatile fp registers
35 ; 68h + 08h(for alignment)
38 movdqa [rsp + 0x0], xmm0
39 movdqa [rsp + 0x10], xmm1
40 movdqa [rsp + 0x20], xmm2
41 movdqa [rsp + 0x30], xmm3
42 movdqa [rsp + 0x40], xmm4
43 movdqa [rsp + 0x50], xmm5
46 call ASM_PFX(PageFaultHandler)
49 ; load volatile fp registers
51 movdqa xmm0, [rsp + 0x0]
52 movdqa xmm1, [rsp + 0x10]
53 movdqa xmm2, [rsp + 0x20]
54 movdqa xmm3, [rsp + 0x30]
55 movdqa xmm4, [rsp + 0x40]
56 movdqa xmm5, [rsp + 0x50]
65 ;pop rax ; restore all volatile registers
69 ; rax returned from PageFaultHandler is NULL or OriginalHandler address
70 ; NULL if the page fault is handled by PageFaultHandler
71 ; OriginalHandler address if the page fault is not handled by PageFaultHandler
74 ; save OriginalHandler address
81 ; jump to OriginalHandler
82 jmp qword [rsp - 0x10]
85 add rsp, 0x8 ; skip error code for PF