]> git.proxmox.com Git - mirror_edk2.git/commitdiff
IntelFsp2Pkg SecFspSecPlatformLibNull: Convert Ia32/Flat32.asm to NASM
authorLiming Gao <liming.gao@intel.com>
Wed, 8 Jun 2016 09:02:21 +0000 (17:02 +0800)
committerLiming Gao <liming.gao@intel.com>
Tue, 28 Jun 2016 01:52:04 +0000 (09:52 +0800)
Manually convert Ia32/Flat32.asm to Ia32/Flat32.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/Flat32.nasm [new file with mode: 0644]
IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/SecFspSecPlatformLibNull.inf

diff --git a/IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/Flat32.nasm b/IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/Flat32.nasm
new file mode 100644 (file)
index 0000000..122eb9e
--- /dev/null
@@ -0,0 +1,127 @@
+;; @file\r
+;  This is the code that goes from real-mode to protected mode.\r
+;  It consumes the reset vector, configures the stack.\r
+;\r
+; Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>\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
+; Define assembler characteristics\r
+;\r
+\r
+extern   ASM_PFX(TempRamInitApi)\r
+\r
+SECTION .text\r
+\r
+%macro RET_ESI  0\r
+\r
+  movd    esi, mm7                      ; restore ESP from MM7\r
+  jmp     esi\r
+\r
+%endmacro\r
+\r
+;\r
+; Perform early platform initialization\r
+;\r
+global ASM_PFX(SecPlatformInit)\r
+ASM_PFX(SecPlatformInit):\r
+\r
+  RET_ESI\r
+\r
+;\r
+; Protected mode portion initializes stack, configures cache, and calls C entry point\r
+;\r
+\r
+;----------------------------------------------------------------------------\r
+;\r
+; Procedure:    ProtectedModeEntryPoint\r
+;\r
+; Input:        Executing in 32 Bit Protected (flat) mode\r
+;               cs: 0-4GB\r
+;               ds: 0-4GB\r
+;               es: 0-4GB\r
+;               fs: 0-4GB\r
+;               gs: 0-4GB\r
+;               ss: 0-4GB\r
+;\r
+; Output:       This function never returns\r
+;\r
+; Destroys:\r
+;               ecx\r
+;               edi\r
+;               esi\r
+;               esp\r
+;\r
+; Description:\r
+;               Perform any essential early platform initilaisation\r
+;               Setup a stack\r
+;\r
+;----------------------------------------------------------------------------\r
+global ASM_PFX(ProtectedModeEntryPoint)\r
+ASM_PFX(ProtectedModeEntryPoint):\r
+  ;\r
+  ; Dummy function. Consume 2 API to make sure they can be linked.\r
+  ;\r
+  mov  eax, ASM_PFX(TempRamInitApi)\r
+\r
+  ; Should never return\r
+  jmp  $\r
+\r
+;\r
+; ROM-based Global-Descriptor Table for the PEI Phase\r
+;\r
+align 16\r
+global  ASM_PFX(BootGdtTable)\r
+\r
+;\r
+; GDT[0]: 0x00: Null entry, never used.\r
+;\r
+NULL_SEL        equ     $ - GDT_BASE        ; Selector [0]\r
+GDT_BASE:\r
+ASM_PFX(BootGdtTable):    DD      0\r
+                          DD      0\r
+;\r
+; Linear code segment descriptor\r
+;\r
+LINEAR_CODE_SEL equ     $ - GDT_BASE        ; Selector [0x8]\r
+        DW      0FFFFh                      ; limit 0xFFFF\r
+        DW      0                           ; base 0\r
+        DB      0\r
+        DB      09Bh                        ; present, ring 0, data, expand-up, not-writable\r
+        DB      0CFh                        ; page-granular, 32-bit\r
+        DB      0\r
+;\r
+; System data segment descriptor\r
+;\r
+SYS_DATA_SEL    equ     $ - GDT_BASE        ; Selector [0x10]\r
+        DW      0FFFFh                      ; limit 0xFFFF\r
+        DW      0                           ; base 0\r
+        DB      0\r
+        DB      093h                        ; present, ring 0, data, expand-up, not-writable\r
+        DB      0CFh                        ; page-granular, 32-bit\r
+        DB      0\r
+\r
+GDT_SIZE        EQU     $ - GDT_BASE        ; Size, in bytes\r
+\r
+;\r
+; GDT Descriptor\r
+;\r
+GdtDesc:                                    ; GDT descriptor\r
+        DW      GDT_SIZE - 1                ; GDT limit\r
+        DD      GDT_BASE                    ; GDT base address\r
+\r
+global ASM_PFX(ProtectedModeEntryLinearAddress)\r
+global ASM_PFX(ProtectedModeEntryLinearOffset)\r
+\r
+ASM_PFX(ProtectedModeEntryLinearAddress):\r
+ASM_PFX(ProtectedModeEntryLinearOffset):\r
+  DD      ASM_PFX(ProtectedModeEntryPoint)  ; Offset of our 32 bit code\r
+  DW      LINEAR_CODE_SEL\r
+  \r
index 1c18a587c3db689f086419345d1dc363ebd88e64..2bc638c776794c5e9a82c82e6e57224e1600fa56 100644 (file)
 \r
 [Sources.IA32]\r
   Ia32/Flat32.asm\r
+  Ia32/Flat32.nasm\r
   Ia32/Flat32.s\r
   Ia32/SecCarInit.asm\r
   Ia32/SecCarInit.s\r
+  Ia32/SecCarInit.nasm\r
 \r
 ################################################################################\r
 #\r