2 ; This is the assembly code for transferring to control to OS S3 waking vector
5 ; Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
7 ; This program and the accompanying materials
8 ; are licensed and made available under the terms and conditions of the BSD License
9 ; which accompanies this distribution. The full text of the license may be found at
10 ; http://opensource.org/licenses/bsd-license.php
12 ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 extern ASM_PFX(mOriginalHandler)
18 extern ASM_PFX(PageFaultHandler)
23 global ASM_PFX(AsmFixAddress16)
24 global ASM_PFX(AsmJmpAddr32)
26 global ASM_PFX(AsmTransferControl)
27 ASM_PFX(AsmTransferControl):
28 ; rcx S3WakingVector :DWORD
29 ; rdx AcpiLowMemoryBase :DWORD
37 mov [@jmp_addr + 1], ebx
49 and eax, ((~ 0x80000001) & 0xffffffff)
60 global ASM_PFX(AsmTransferControl32)
61 ASM_PFX(AsmTransferControl32):
63 ; S3WakingVector :DWORD
64 ; AcpiLowMemoryBase :DWORD
67 DB 0x8d, 0x5 ; lea eax, AsmTransferControl16
68 ASM_PFX(AsmFixAddress16): DD 0
73 global ASM_PFX(AsmTransferControl16)
74 ASM_PFX(AsmTransferControl16):
82 mov eax, cr0 ; Get control register 0
83 and eax, 0fffffffeh ; Clear PE bit (bit #0)
84 mov cr0, eax ; Activate real mode
85 DB 0xea ; jmp far AsmJmpAddr32
86 ASM_PFX(AsmJmpAddr32): DD 0
88 global ASM_PFX(PageFaultHandlerHook)
89 ASM_PFX(PageFaultHandlerHook):
91 push rax ; save all volatile registers
98 ; save volatile fp registers
101 movdqa [rsp + 0x0], xmm0
102 movdqa [rsp + 0x10], xmm1
103 movdqa [rsp + 0x20], xmm2
104 movdqa [rsp + 0x30], xmm3
105 movdqa [rsp + 0x40], xmm4
106 movdqa [rsp + 0x50], xmm5
109 call ASM_PFX(PageFaultHandler)
112 ; load volatile fp registers
114 movdqa xmm0, [rsp + 0x0]
115 movdqa xmm1, [rsp + 0x10]
116 movdqa xmm2, [rsp + 0x20]
117 movdqa xmm3, [rsp + 0x30]
118 movdqa xmm4, [rsp + 0x40]
119 movdqa xmm5, [rsp + 0x50]
130 pop rax ; restore all volatile registers
132 jmp qword [ASM_PFX(mOriginalHandler)]
134 add rsp, 0x8 ; skip error code for PF