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 are
7 # 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 ASM_GLOBAL ASM_PFX(PageFaultHandlerHook)
17 ASM_PFX(PageFaultHandlerHook):
22 # pushq %rax # save all volatile registers
29 # save volatile fp registers
30 # 68h + 08h(for alignment)
33 movdqa %xmm0, 0x0(%rsp)
34 movdqa %xmm1, 0x10(%rsp)
35 movdqa %xmm2, 0x20(%rsp)
36 movdqa %xmm3, 0x30(%rsp)
37 movdqa %xmm4, 0x40(%rsp)
38 movdqa %xmm5, 0x50(%rsp)
41 call ASM_PFX(PageFaultHandler)
44 # load volatile fp registers
46 movdqa 0x0(%rsp), %xmm0
47 movdqa 0x10(%rsp), %xmm1
48 movdqa 0x20(%rsp), %xmm2
49 movdqa 0x30(%rsp), %xmm3
50 movdqa 0x40(%rsp), %xmm4
51 movdqa 0x50(%rsp), %xmm5
60 # popq %rax # restore all volatile registers
64 # rax returned from PageFaultHandler is NULL or OriginalHandler address
65 # NULL if the page fault is handled by PageFaultHandler
66 # OriginalHandler address if the page fault is not handled by PageFaultHandler
69 # save OriginalHandler address
70 movq %rax, -0x10(%rsp)
72 movq -0x08(%rsp), %rax
76 # jump to OriginalHandler
80 addq $0x08, %rsp # skip error code for PF