]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/IA32/S3Asm.nasm
MdeModulePkg BootScriptExecutorDxe: Convert IA32/S3Asm.asm to NASM
[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
7; This program and the accompanying materials\r
8; are licensed and made available under the terms and conditions of the BSD License\r
9; which accompanies this distribution. The full text of the license may be found at\r
10; http://opensource.org/licenses/bsd-license.php\r
11;\r
12; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
13; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
14;\r
15;;\r
16 SECTION .text\r
17\r
18global ASM_PFX(AsmFixAddress16)\r
19global ASM_PFX(AsmJmpAddr32)\r
20\r
21;-----------------------------------------\r
22;VOID\r
23;AsmTransferControl (\r
24; IN UINT32 S3WakingVector,\r
25; IN UINT32 AcpiLowMemoryBase\r
26; );\r
27;-----------------------------------------\r
28\r
29global ASM_PFX(AsmTransferControl)\r
30ASM_PFX(AsmTransferControl):\r
31 ; S3WakingVector :DWORD\r
32 ; AcpiLowMemoryBase :DWORD\r
33 push ebp\r
34 mov ebp, esp\r
35 lea eax, [.0]\r
36 push 0x28 ; CS\r
37 push eax\r
38 mov ecx, [ebp + 8]\r
39 shrd ebx, ecx, 20\r
40 and ecx, 0xf\r
41 mov bx, cx\r
9fa08ee4 42 mov [@jmp_addr + 1], ebx\r
0ed65cc2 43 retf\r
9fa08ee4
LG
44\r
45BITS 16\r
0ed65cc2 46.0:\r
9fa08ee4
LG
47 mov ax, 0x30\r
48o32 mov ds, eax\r
49o32 mov es, eax\r
50o32 mov fs, eax\r
51o32 mov gs, eax\r
52o32 mov ss, eax\r
0ed65cc2 53 mov eax, cr0 ; Get control register 0\r
9fa08ee4
LG
54 and eax, 0x0fffffffe ; Clear PE bit (bit #0)\r
55 mov cr0, eax ; Activate real mode\r
56@jmp_addr:\r
57 jmp 0x0:0x0\r
0ed65cc2
JJ
58\r
59global ASM_PFX(AsmTransferControl32)\r
60ASM_PFX(AsmTransferControl32):\r
61 jmp ASM_PFX(AsmTransferControl)\r
62\r
63; dummy\r
64global ASM_PFX(AsmTransferControl16)\r
65ASM_PFX(AsmTransferControl16):\r
66ASM_PFX(AsmFixAddress16): DD 0\r
67ASM_PFX(AsmJmpAddr32): DD 0\r
68\r