]> git.proxmox.com Git - mirror_edk2.git/blob - 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
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 + 1], ebx
43 retf
44
45 BITS 16
46 .0:
47 mov ax, 0x30
48 o32 mov ds, eax
49 o32 mov es, eax
50 o32 mov fs, eax
51 o32 mov gs, eax
52 o32 mov ss, eax
53 mov eax, cr0 ; Get control register 0
54 and eax, 0x0fffffffe ; Clear PE bit (bit #0)
55 mov cr0, eax ; Activate real mode
56 @jmp_addr:
57 jmp 0x0:0x0
58
59 global ASM_PFX(AsmTransferControl32)
60 ASM_PFX(AsmTransferControl32):
61 jmp ASM_PFX(AsmTransferControl)
62
63 ; dummy
64 global ASM_PFX(AsmTransferControl16)
65 ASM_PFX(AsmTransferControl16):
66 ASM_PFX(AsmFixAddress16): DD 0
67 ASM_PFX(AsmJmpAddr32): DD 0
68