]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/IA32/S3Asm.nasm
3687e644094f96d3e6669378dfb59ffd9deca152
[mirror_edk2.git] / MdeModulePkg / Universal / Acpi / BootScriptExecutorDxe / IA32 / S3Asm.nasm
1 ;; @file
2 ; This is the assembly code for transferring to control to OS S3 waking vector
3 ; for IA32 platform
4 ;
5 ; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
6 ;
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
11 ;
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.
14 ;
15 ;;
16 SECTION .text
17
18 global ASM_PFX(AsmFixAddress16)
19 global ASM_PFX(AsmJmpAddr32)
20
21 ;-----------------------------------------
22 ;VOID
23 ;AsmTransferControl (
24 ; IN UINT32 S3WakingVector,
25 ; IN UINT32 AcpiLowMemoryBase
26 ; );
27 ;-----------------------------------------
28
29 global ASM_PFX(AsmTransferControl)
30 ASM_PFX(AsmTransferControl):
31 ; S3WakingVector :DWORD
32 ; AcpiLowMemoryBase :DWORD
33 push ebp
34 mov ebp, esp
35 lea eax, [.0]
36 push 0x28 ; CS
37 push eax
38 mov ecx, [ebp + 8]
39 shrd ebx, ecx, 20
40 and ecx, 0xf
41 mov bx, cx
42 mov [@jmp_addr], ebx
43 retf
44 .0:
45 DB 0xb8, 0x30, 0 ; mov ax, 30h as selector
46 mov ds, ax
47 mov es, ax
48 mov fs, ax
49 mov gs, ax
50 mov ss, ax
51 mov eax, cr0 ; Get control register 0
52 DB 0x66
53 DB 0x83, 0xe0, 0xfe ; and eax, 0fffffffeh ; Clear PE bit (bit #0)
54 DB 0xf, 0x22, 0xc0 ; mov cr0, eax ; Activate real mode
55 DB 0xea ; jmp far @jmp_addr
56 @jmp_addr: DD 0
57
58 global ASM_PFX(AsmTransferControl32)
59 ASM_PFX(AsmTransferControl32):
60 jmp ASM_PFX(AsmTransferControl)
61
62 ; dummy
63 global ASM_PFX(AsmTransferControl16)
64 ASM_PFX(AsmTransferControl16):
65 ASM_PFX(AsmFixAddress16): DD 0
66 ASM_PFX(AsmJmpAddr32): DD 0
67