]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg BootScriptExecutorDxe: Convert IA32/S3Asm.asm to NASM
authorJordan Justen <jordan.l.justen@intel.com>
Tue, 31 May 2016 01:52:18 +0000 (18:52 -0700)
committerLiming Gao <liming.gao@intel.com>
Tue, 28 Jun 2016 01:51:59 +0000 (09:51 +0800)
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
IA32/S3Asm.asm to IA32/S3Asm.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/IA32/S3Asm.nasm [new file with mode: 0644]

index a1bdee8e4dc8b35d82a7c6ec7ba37ce188035879..ad34650a793cd09fa575f4b664e6fbf399d4b7da 100644 (file)
@@ -43,6 +43,7 @@
   \r
 [Sources.Ia32]\r
   IA32/SetIdtEntry.c   \r
+  IA32/S3Asm.nasm\r
   IA32/S3Asm.asm\r
   IA32/S3Asm.S\r
 \r
diff --git a/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/IA32/S3Asm.nasm b/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/IA32/S3Asm.nasm
new file mode 100644 (file)
index 0000000..3687e64
--- /dev/null
@@ -0,0 +1,67 @@
+;; @file\r
+;   This is the assembly code for transferring to control to OS S3 waking vector\r
+;   for IA32 platform\r
+;\r
+; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>\r
+;\r
+; This program and the accompanying materials\r
+; are licensed and made available under the terms and conditions of the BSD License\r
+; which accompanies this distribution.  The full text of the license may be found at\r
+; http://opensource.org/licenses/bsd-license.php\r
+;\r
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+;\r
+;;\r
+    SECTION .text\r
+\r
+global ASM_PFX(AsmFixAddress16)\r
+global ASM_PFX(AsmJmpAddr32)\r
+\r
+;-----------------------------------------\r
+;VOID\r
+;AsmTransferControl (\r
+;  IN   UINT32           S3WakingVector,\r
+;  IN   UINT32           AcpiLowMemoryBase\r
+;  );\r
+;-----------------------------------------\r
+\r
+global ASM_PFX(AsmTransferControl)\r
+ASM_PFX(AsmTransferControl):\r
+    ; S3WakingVector    :DWORD\r
+    ; AcpiLowMemoryBase :DWORD\r
+    push  ebp\r
+    mov   ebp, esp\r
+    lea   eax, [.0]\r
+    push  0x28               ; CS\r
+    push  eax\r
+    mov   ecx, [ebp + 8]\r
+    shrd  ebx, ecx, 20\r
+    and   ecx, 0xf\r
+    mov   bx, cx\r
+    mov   [@jmp_addr], ebx\r
+    retf\r
+.0:\r
+    DB    0xb8, 0x30, 0      ; mov ax, 30h as selector\r
+    mov   ds, ax\r
+    mov   es, ax\r
+    mov   fs, ax\r
+    mov   gs, ax\r
+    mov   ss, ax\r
+    mov   eax, cr0          ; Get control register 0\r
+    DB    0x66\r
+    DB    0x83, 0xe0, 0xfe   ; and    eax, 0fffffffeh  ; Clear PE bit (bit #0)\r
+    DB    0xf, 0x22, 0xc0    ; mov    cr0, eax         ; Activate real mode\r
+    DB    0xea              ; jmp far @jmp_addr\r
+@jmp_addr: DD 0\r
+\r
+global ASM_PFX(AsmTransferControl32)\r
+ASM_PFX(AsmTransferControl32):\r
+  jmp ASM_PFX(AsmTransferControl)\r
+\r
+; dummy\r
+global ASM_PFX(AsmTransferControl16)\r
+ASM_PFX(AsmTransferControl16):\r
+ASM_PFX(AsmFixAddress16): DD 0\r
+ASM_PFX(AsmJmpAddr32): DD 0\r
+\r