UefiCpuPkg CpuDxe: Add nasm source file in CpuDxe.inf
authorLiming Gao <liming.gao@intel.com>
Tue, 14 Jun 2016 07:43:44 +0000 (15:43 +0800)
committerLiming Gao <liming.gao@intel.com>
Tue, 28 Jun 2016 01:52:06 +0000 (09:52 +0800)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
UefiCpuPkg/CpuDxe/CpuDxe.inf
UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm [new file with mode: 0644]

index 9db5303ae94af6a2f712b1f7dbbf000c2db00d68..bdff548cc2728306ee0e9d653287075fa8e4c7cb 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 #  Simple CPU driver installs CPU Architecture Protocol.\r
 #\r
-#  Copyright (c) 2008 - 2015, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2008 - 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
   CpuMp.h\r
 \r
 [Sources.IA32]\r
-  Ia32/CpuAsm.asm | MSFT\r
-  Ia32/CpuAsm.asm | INTEL\r
-  Ia32/CpuAsm.S   | GCC\r
-  Ia32/MpAsm.asm  | MSFT\r
-  Ia32/MpAsm.asm  | INTEL\r
-  Ia32/MpAsm.nasm | GCC\r
+  Ia32/CpuAsm.asm\r
+  Ia32/CpuAsm.nasm\r
+  Ia32/CpuAsm.S\r
+  Ia32/MpAsm.asm\r
+  Ia32/MpAsm.nasm\r
 \r
 [Sources.X64]\r
-  X64/CpuAsm.asm | MSFT\r
-  X64/CpuAsm.asm | INTEL\r
-  X64/CpuAsm.S   | GCC\r
-  X64/MpAsm.asm  | MSFT\r
-  X64/MpAsm.asm  | INTEL\r
-  X64/MpAsm.nasm | GCC\r
+  X64/CpuAsm.asm\r
+  X64/CpuAsm.nasm\r
+  X64/CpuAsm.S\r
+  X64/MpAsm.asm\r
+  X64/MpAsm.nasm\r
 \r
 [Protocols]\r
   gEfiCpuArchProtocolGuid                       ## PRODUCES\r
diff --git a/UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm b/UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm
new file mode 100644 (file)
index 0000000..77ecfb3
--- /dev/null
@@ -0,0 +1,52 @@
+;------------------------------------------------------------------------------\r
+;*\r
+;*   Copyright (c) 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
+;*    CpuAsm.nasm\r
+;*\r
+;*   Abstract:\r
+;*\r
+;------------------------------------------------------------------------------\r
+\r
+    DEFAULT REL\r
+    SECTION .text\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; SetCodeSelector (\r
+;   UINT16 Selector\r
+;   );\r
+;------------------------------------------------------------------------------\r
+global ASM_PFX(SetCodeSelector)\r
+ASM_PFX(SetCodeSelector):\r
+    sub     rsp, 0x10\r
+    lea     rax, [setCodeSelectorLongJump]\r
+    mov     [rsp], rax\r
+    mov     [rsp+4], cx\r
+    jmp     dword far [rsp]\r
+setCodeSelectorLongJump:\r
+    add     rsp, 0x10\r
+    ret\r
+\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; SetDataSelectors (\r
+;   UINT16 Selector\r
+;   );\r
+;------------------------------------------------------------------------------\r
+global ASM_PFX(SetDataSelectors)\r
+ASM_PFX(SetDataSelectors):\r
+o16 mov     ss, cx\r
+o16 mov     ds, cx\r
+o16 mov     es, cx\r
+o16 mov     fs, cx\r
+o16 mov     gs, cx\r
+    ret\r
+\r