]> 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
42 mov [@jmp_addr], ebx\r
43 retf\r
44.0:\r
45 DB 0xb8, 0x30, 0 ; mov ax, 30h as selector\r
46 mov ds, ax\r
47 mov es, ax\r
48 mov fs, ax\r
49 mov gs, ax\r
50 mov ss, ax\r
51 mov eax, cr0 ; Get control register 0\r
52 DB 0x66\r
53 DB 0x83, 0xe0, 0xfe ; and eax, 0fffffffeh ; Clear PE bit (bit #0)\r
54 DB 0xf, 0x22, 0xc0 ; mov cr0, eax ; Activate real mode\r
55 DB 0xea ; jmp far @jmp_addr\r
56@jmp_addr: DD 0\r
57\r
58global ASM_PFX(AsmTransferControl32)\r
59ASM_PFX(AsmTransferControl32):\r
60 jmp ASM_PFX(AsmTransferControl)\r
61\r
62; dummy\r
63global ASM_PFX(AsmTransferControl16)\r
64ASM_PFX(AsmTransferControl16):\r
65ASM_PFX(AsmFixAddress16): DD 0\r
66ASM_PFX(AsmJmpAddr32): DD 0\r
67\r