]> git.proxmox.com Git - mirror_edk2.git/blame - 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
CommitLineData
0ed65cc2
JJ
1;; @file\r
2; This is the assembly code for transferring to control to OS S3 waking vector\r
3; for IA32 platform\r
4;\r
5; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>\r
6;\r
9d510e61 7; SPDX-License-Identifier: BSD-2-Clause-Patent\r
0ed65cc2
JJ
8;\r
9;;\r
10 SECTION .text\r
11\r
12global ASM_PFX(AsmFixAddress16)\r
13global ASM_PFX(AsmJmpAddr32)\r
14\r
15;-----------------------------------------\r
16;VOID\r
17;AsmTransferControl (\r
18; IN UINT32 S3WakingVector,\r
19; IN UINT32 AcpiLowMemoryBase\r
20; );\r
21;-----------------------------------------\r
22\r
23global ASM_PFX(AsmTransferControl)\r
24ASM_PFX(AsmTransferControl):\r
25 ; S3WakingVector :DWORD\r
26 ; AcpiLowMemoryBase :DWORD\r
27 push ebp\r
28 mov ebp, esp\r
29 lea eax, [.0]\r
30 push 0x28 ; CS\r
31 push eax\r
32 mov ecx, [ebp + 8]\r
33 shrd ebx, ecx, 20\r
34 and ecx, 0xf\r
35 mov bx, cx\r
9fa08ee4 36 mov [@jmp_addr + 1], ebx\r
0ed65cc2 37 retf\r
9fa08ee4
LG
38\r
39BITS 16\r
0ed65cc2 40.0:\r
9fa08ee4
LG
41 mov ax, 0x30\r
42o32 mov ds, eax\r
43o32 mov es, eax\r
44o32 mov fs, eax\r
45o32 mov gs, eax\r
46o32 mov ss, eax\r
0ed65cc2 47 mov eax, cr0 ; Get control register 0\r
9fa08ee4
LG
48 and eax, 0x0fffffffe ; Clear PE bit (bit #0)\r
49 mov cr0, eax ; Activate real mode\r
50@jmp_addr:\r
51 jmp 0x0:0x0\r
0ed65cc2
JJ
52\r
53global ASM_PFX(AsmTransferControl32)\r
54ASM_PFX(AsmTransferControl32):\r
55 jmp ASM_PFX(AsmTransferControl)\r
56\r
57; dummy\r
58global ASM_PFX(AsmTransferControl16)\r
59ASM_PFX(AsmTransferControl16):\r
60ASM_PFX(AsmFixAddress16): DD 0\r
61ASM_PFX(AsmJmpAddr32): DD 0\r
62\r