]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/IA32/S3Asm.nasm
MdeModulePkg: Replace BSD License with BSD+Patent License
[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 ; SPDX-License-Identifier: BSD-2-Clause-Patent
8 ;
9 ;;
10 SECTION .text
11
12 global ASM_PFX(AsmFixAddress16)
13 global ASM_PFX(AsmJmpAddr32)
14
15 ;-----------------------------------------
16 ;VOID
17 ;AsmTransferControl (
18 ; IN UINT32 S3WakingVector,
19 ; IN UINT32 AcpiLowMemoryBase
20 ; );
21 ;-----------------------------------------
22
23 global ASM_PFX(AsmTransferControl)
24 ASM_PFX(AsmTransferControl):
25 ; S3WakingVector :DWORD
26 ; AcpiLowMemoryBase :DWORD
27 push ebp
28 mov ebp, esp
29 lea eax, [.0]
30 push 0x28 ; CS
31 push eax
32 mov ecx, [ebp + 8]
33 shrd ebx, ecx, 20
34 and ecx, 0xf
35 mov bx, cx
36 mov [@jmp_addr + 1], ebx
37 retf
38
39 BITS 16
40 .0:
41 mov ax, 0x30
42 o32 mov ds, eax
43 o32 mov es, eax
44 o32 mov fs, eax
45 o32 mov gs, eax
46 o32 mov ss, eax
47 mov eax, cr0 ; Get control register 0
48 and eax, 0x0fffffffe ; Clear PE bit (bit #0)
49 mov cr0, eax ; Activate real mode
50 @jmp_addr:
51 jmp 0x0:0x0
52
53 global ASM_PFX(AsmTransferControl32)
54 ASM_PFX(AsmTransferControl32):
55 jmp ASM_PFX(AsmTransferControl)
56
57 ; dummy
58 global ASM_PFX(AsmTransferControl16)
59 ASM_PFX(AsmTransferControl16):
60 ASM_PFX(AsmFixAddress16): DD 0
61 ASM_PFX(AsmJmpAddr32): DD 0
62