]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Compatibility/SmmBaseHelper/X64/PageFaultHandler.asm
Use on-demand paging for CpuSaveStates read/write. It was measured about 200us for...
[mirror_edk2.git] / EdkCompatibilityPkg / Compatibility / SmmBaseHelper / X64 / PageFaultHandler.asm
1 ;------------------------------------------------------------------------------
2 ;
3 ; Copyright (c) 2010, Intel Corporation
4 ; All rights reserved. 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
8 ;
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.
11 ;
12 ; Module Name:
13 ;
14 ; PageFaultHandler.asm
15 ;
16 ; Abstract:
17 ;
18 ; Defines page fault handler used to hook SMM IDT
19 ;
20 ;------------------------------------------------------------------------------
21
22 mOriginalHandler PROTO
23 PageFaultHandler PROTO
24
25 .code
26
27 PageFaultHandlerHook PROC
28 push rax ; save all volatile registers
29 push rcx
30 push rdx
31 push r8
32 push r9
33 push r10
34 push r11
35 add rsp, -20h
36 call PageFaultHandler
37 add rsp, 20h
38 test rax, rax
39 pop r11
40 pop r10
41 pop r9
42 pop r8
43 pop rdx
44 pop rcx
45 pop rax ; restore all volatile registers
46 jnz @F
47 jmp mOriginalHandler
48 @@:
49 add rsp, 08h ; skip error code for PF
50 iretq
51 PageFaultHandlerHook ENDP
52 END