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 are
8 # 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 ASM_GLOBAL ASM_PFX(AsmTransferControl)
18 ASM_PFX(AsmTransferControl):
19 # rcx S3WakingVector :DWORD
20 # rdx AcpiLowMemoryBase :DWORD
21 lea _AsmTransferControl_al_0000, %eax
22 movq $0x2800000000, %r8
30 _AsmTransferControl_al_0000:
31 .byte 0x0b8, 0x30, 0 # mov ax, 30h as selector
40 andl $0x7ffffffe, %eax
44 movl $0x0c0000080, %ecx
49 .byte 0x0ea # jmp far jmp_addr
53 ASM_GLOBAL ASM_PFX(AsmTransferControl32)
54 ASM_PFX(AsmTransferControl32):
55 # S3WakingVector :DWORD
56 # AcpiLowMemoryBase :DWORD
59 .byte 0x8d, 0x05 # lea eax, AsmTransferControl16
60 ASM_GLOBAL ASM_PFX(AsmFixAddress16)
61 ASM_PFX(AsmFixAddress16):
67 ASM_GLOBAL ASM_PFX(AsmTransferControl16)
68 ASM_PFX(AsmTransferControl16):
69 .byte 0xb8,0x30,0 # mov ax, 30h as selector
75 movq %cr0, %rax # Get control register 0
77 .byte 0x83,0xe0,0xfe # and eax, 0fffffffeh ; Clear PE bit (bit #0)
78 .byte 0xf,0x22,0xc0 # mov cr0, eax ; Activate real mode
79 .byte 0xea # jmp far AsmJmpAddr32
80 ASM_GLOBAL ASM_PFX(AsmJmpAddr32)
81 ASM_PFX(AsmJmpAddr32):
84 ASM_GLOBAL ASM_PFX(PageFaultHandlerHook)
85 ASM_PFX(PageFaultHandlerHook):
86 pushq %rax # save all volatile registers
93 # save volatile fp registers
96 movdqa %xmm0, 0x0(%rsp)
97 movdqa %xmm1, 0x10(%rsp)
98 movdqa %xmm2, 0x20(%rsp)
99 movdqa %xmm3, 0x30(%rsp)
100 movdqa %xmm4, 0x40(%rsp)
101 movdqa %xmm5, 0x50(%rsp)
104 call ASM_PFX(PageFaultHandler)
107 # load volatile fp registers
109 movdqa 0x0(%rsp), %xmm0
110 movdqa 0x10(%rsp), %xmm1
111 movdqa 0x20(%rsp), %xmm2
112 movdqa 0x30(%rsp), %xmm3
113 movdqa 0x40(%rsp), %xmm4
114 movdqa 0x50(%rsp), %xmm5
125 popq %rax # restore all volatile registers
127 jmpq *ASM_PFX(mOriginalHandler)
129 addq $0x08, %rsp # skip error code for PF