]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg LoadLinuxLib: Convert X64/JumpToKernel.asm to NASM
authorJordan Justen <jordan.l.justen@intel.com>
Fri, 31 Oct 2014 20:54:31 +0000 (20:54 +0000)
committerjljusten <jljusten@Edk2>
Fri, 31 Oct 2014 20:54:31 +0000 (20:54 +0000)
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/JumpToKernel.asm to X64/JumpToKernel.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16288 6f19259b-4bc3-4df7-8a09-765794883524

OvmfPkg/Library/LoadLinuxLib/LoadLinuxLib.inf
OvmfPkg/Library/LoadLinuxLib/X64/JumpToKernel.S [deleted file]
OvmfPkg/Library/LoadLinuxLib/X64/JumpToKernel.asm [deleted file]
OvmfPkg/Library/LoadLinuxLib/X64/JumpToKernel.nasm [new file with mode: 0644]

index 0d98c26f0b59c75a23f00775ac411a87a5ce2659..12d2f4f08445375265d411715c999a0cb874b165 100644 (file)
@@ -34,8 +34,7 @@
   Ia32/JumpToKernel.nasm\r
 \r
 [Sources.X64]\r
-  X64/JumpToKernel.asm\r
-  X64/JumpToKernel.S\r
+  X64/JumpToKernel.nasm\r
 \r
 [Packages]\r
   MdePkg/MdePkg.dec\r
diff --git a/OvmfPkg/Library/LoadLinuxLib/X64/JumpToKernel.S b/OvmfPkg/Library/LoadLinuxLib/X64/JumpToKernel.S
deleted file mode 100644 (file)
index 056e3c0..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-#------------------------------------------------------------------------------\r
-#\r
-# Copyright (c) 2006 - 2013, 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
-\r
-ASM_GLOBAL ASM_PFX(JumpToKernel)\r
-ASM_GLOBAL ASM_PFX(JumpToUefiKernel)\r
-\r
-#------------------------------------------------------------------------------\r
-# VOID\r
-# EFIAPI\r
-# JumpToKernel (\r
-#   VOID *KernelStart,         // %rcx\r
-#   VOID *KernelBootParams     // %rdx\r
-#   );\r
-#------------------------------------------------------------------------------\r
-ASM_PFX(JumpToKernel):\r
-\r
-    // Set up for executing kernel. BP in %esi, entry point on the stack\r
-    // (64-bit when the 'ret' will use it as 32-bit, but we're little-endian)\r
-    movq    %rdx, %rsi\r
-    pushq   %rcx\r
-\r
-    // Jump into the compatibility mode CS\r
-    pushq   $0x10\r
-    leaq    1f(%rip), %rax\r
-    pushq   %rax\r
-    .byte   0x48, 0xcb                      // retfq\r
-\r
-1:  // Now in compatibility mode\r
-.code32\r
-    movl    $0x18, %eax\r
-    movl    %eax, %ds\r
-    movl    %eax, %es\r
-    movl    %eax, %fs\r
-    movl    %eax, %gs\r
-    movl    %eax, %ss\r
-\r
-    // Disable paging\r
-    movl    %cr0, %eax\r
-    btcl    $31, %eax\r
-    movl    %eax, %cr0\r
-\r
-    // Disable long mode in EFER\r
-    movl    $0x0c0000080, %ecx\r
-    rdmsr\r
-    btcl    $8, %eax\r
-    wrmsr\r
-\r
-    // Disable PAE\r
-    movl    %cr4, %eax\r
-    btcl    $5, %eax\r
-    movl    %eax, %cr4\r
-\r
-    // Zero registers and 'return' to kernel\r
-    xorl    %ebp, %ebp\r
-    xorl    %edi, %edi\r
-    xorl    %ebx, %ebx\r
-    ret\r
-.code64\r
-\r
-#------------------------------------------------------------------------------\r
-# VOID\r
-# EFIAPI\r
-# JumpToUefiKernel (\r
-#   EFI_HANDLE ImageHandle,        // rcx\r
-#   EFI_SYSTEM_TABLE *SystemTable, // rdx\r
-#   VOID *KernelBootParams,        // r8\r
-#   VOID *KernelStart              // r9\r
-#   );\r
-#------------------------------------------------------------------------------\r
-ASM_PFX(JumpToUefiKernel):\r
-    movq    %rcx, %rdi\r
-    movq    %rdx, %rsi\r
-    movq    %r8, %rdx\r
-    xor     %rax, %rax\r
-    movl    0x264(%r8), %eax\r
-    addq    %rax, %r9\r
-    addq    $0x200, %r9\r
-    callq   %r9\r
-    ret\r
-\r
diff --git a/OvmfPkg/Library/LoadLinuxLib/X64/JumpToKernel.asm b/OvmfPkg/Library/LoadLinuxLib/X64/JumpToKernel.asm
deleted file mode 100644 (file)
index fc07eab..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-;------------------------------------------------------------------------------\r
-;\r
-; Copyright (c) 2006 - 2013, 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
-\r
-  .code\r
-\r
-;------------------------------------------------------------------------------\r
-; VOID\r
-; EFIAPI\r
-; JumpToKernel (\r
-;   VOID *KernelStart,         // rcx\r
-;   VOID *KernelBootParams     // rdx\r
-;   );\r
-;------------------------------------------------------------------------------\r
-JumpToKernel PROC\r
-\r
-    ; Set up for executing kernel. BP in %esi, entry point on the stack\r
-    ; (64-bit when the 'ret' will use it as 32-bit, but we're little-endian)\r
-    mov    rsi, rdx\r
-    push   rcx\r
-\r
-    ; Jump into the compatibility mode CS\r
-    push    10h\r
-    lea     rax, @F\r
-    push    rax\r
-    DB 048h, 0cbh                      ; retfq\r
-\r
-@@:\r
-    ; Now in compatibility mode.\r
-\r
-    DB 0b8h, 018h, 000h, 000h, 000h    ; movl    $0x18, %eax\r
-    DB 08eh, 0d8h                      ; movl    %eax, %ds\r
-    DB 08eh, 0c0h                      ; movl    %eax, %es\r
-    DB 08eh, 0e0h                      ; movl    %eax, %fs\r
-    DB 08eh, 0e8h                      ; movl    %eax, %gs\r
-    DB 08eh, 0d0h                      ; movl    %eax, %ss\r
-\r
-    ; Disable paging\r
-    DB 00fh, 020h, 0c0h                ; movl    %cr0, %eax\r
-    DB 00fh, 0bah, 0f8h, 01fh          ; btcl    $31, %eax\r
-    DB 00fh, 022h, 0c0h                ; movl    %eax, %cr0\r
-\r
-    ; Disable long mode in EFER\r
-    DB 0b9h, 080h, 000h, 000h, 0c0h    ; movl    $0x0c0000080, %ecx\r
-    DB 00fh, 032h                      ; rdmsr\r
-    DB 00fh, 0bah, 0f8h, 008h          ; btcl    $8, %eax\r
-    DB 00fh, 030h                      ; wrmsr\r
-\r
-    ; Disable PAE\r
-    DB 00fh, 020h, 0e0h                ; movl    %cr4, %eax\r
-    DB 00fh, 0bah, 0f8h, 005h          ; btcl    $5, %eax\r
-    DB 00fh, 022h, 0e0h                ; movl    %eax, %cr4\r
-\r
-    DB 031h, 0edh                      ; xor     %ebp, %ebp\r
-    DB 031h, 0ffh                      ; xor     %edi, %edi\r
-    DB 031h, 0dbh                      ; xor     %ebx, %ebx\r
-    DB 0c3h                            ; ret\r
-\r
-JumpToKernel ENDP\r
-\r
-;------------------------------------------------------------------------------\r
-; VOID\r
-; EFIAPI\r
-; JumpToUefiKernel (\r
-;   EFI_HANDLE ImageHandle,        // rcx\r
-;   EFI_SYSTEM_TABLE *SystemTable, // rdx\r
-;   VOID *KernelBootParams         // r8\r
-;   VOID *KernelStart,             // r9\r
-;   );\r
-;------------------------------------------------------------------------------\r
-JumpToUefiKernel PROC\r
-\r
-    mov     rdi, rcx\r
-    mov     rsi, rdx\r
-    mov     rdx, r8\r
-    xor     rax, rax\r
-    mov     eax, [r8 + 264h]\r
-    add     r9, rax\r
-    add     r9, 200h\r
-    call    r9\r
-    ret\r
-\r
-JumpToUefiKernel ENDP\r
-\r
-END\r
diff --git a/OvmfPkg/Library/LoadLinuxLib/X64/JumpToKernel.nasm b/OvmfPkg/Library/LoadLinuxLib/X64/JumpToKernel.nasm
new file mode 100644 (file)
index 0000000..128dcef
--- /dev/null
@@ -0,0 +1,93 @@
+;------------------------------------------------------------------------------\r
+;\r
+; Copyright (c) 2006 - 2013, 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
+\r
+  DEFAULT REL\r
+  SECTION .text\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; JumpToKernel (\r
+;   VOID *KernelStart,         // rcx\r
+;   VOID *KernelBootParams     // rdx\r
+;   );\r
+;------------------------------------------------------------------------------\r
+global ASM_PFX(JumpToKernel)\r
+ASM_PFX(JumpToKernel):\r
+\r
+    ; Set up for executing kernel. BP in %esi, entry point on the stack\r
+    ; (64-bit when the 'ret' will use it as 32-bit, but we're little-endian)\r
+    mov    rsi, rdx\r
+    push   rcx\r
+\r
+    ; Jump into the compatibility mode CS\r
+    push    0x10\r
+    lea     rax, [.0]\r
+    push    rax\r
+    DB 0x48, 0xcb                      ; retfq\r
+\r
+.0:\r
+    ; Now in compatibility mode.\r
+\r
+    DB 0xb8, 0x18, 0x0, 0x0, 0x0    ; movl    $0x18, %eax\r
+    DB 0x8e, 0xd8                      ; movl    %eax, %ds\r
+    DB 0x8e, 0xc0                      ; movl    %eax, %es\r
+    DB 0x8e, 0xe0                      ; movl    %eax, %fs\r
+    DB 0x8e, 0xe8                      ; movl    %eax, %gs\r
+    DB 0x8e, 0xd0                      ; movl    %eax, %ss\r
+\r
+    ; Disable paging\r
+    DB 0xf, 0x20, 0xc0                ; movl    %cr0, %eax\r
+    DB 0xf, 0xba, 0xf8, 0x1f          ; btcl    $31, %eax\r
+    DB 0xf, 0x22, 0xc0                ; movl    %eax, %cr0\r
+\r
+    ; Disable long mode in EFER\r
+    DB 0xb9, 0x80, 0x0, 0x0, 0xc0    ; movl    $0x0c0000080, %ecx\r
+    DB 0xf, 0x32                      ; rdmsr\r
+    DB 0xf, 0xba, 0xf8, 0x8          ; btcl    $8, %eax\r
+    DB 0xf, 0x30                      ; wrmsr\r
+\r
+    ; Disable PAE\r
+    DB 0xf, 0x20, 0xe0                ; movl    %cr4, %eax\r
+    DB 0xf, 0xba, 0xf8, 0x5          ; btcl    $5, %eax\r
+    DB 0xf, 0x22, 0xe0                ; movl    %eax, %cr4\r
+\r
+    DB 0x31, 0xed                      ; xor     %ebp, %ebp\r
+    DB 0x31, 0xff                      ; xor     %edi, %edi\r
+    DB 0x31, 0xdb                      ; xor     %ebx, %ebx\r
+    DB 0xc3                            ; ret\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; JumpToUefiKernel (\r
+;   EFI_HANDLE ImageHandle,        // rcx\r
+;   EFI_SYSTEM_TABLE *SystemTable, // rdx\r
+;   VOID *KernelBootParams         // r8\r
+;   VOID *KernelStart,             // r9\r
+;   );\r
+;------------------------------------------------------------------------------\r
+global ASM_PFX(JumpToUefiKernel)\r
+ASM_PFX(JumpToUefiKernel):\r
+\r
+    mov     rdi, rcx\r
+    mov     rsi, rdx\r
+    mov     rdx, r8\r
+    xor     rax, rax\r
+    mov     eax, [r8 + 0x264]\r
+    add     r9, rax\r
+    add     r9, 0x200\r
+    call    r9\r
+    ret\r
+\r