summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorJordan Justen <jordan.l.justen@intel.com>2014-10-31 01:18:48 -0700
committerLiming Gao <liming.gao@intel.com>2016-06-28 09:51:55 +0800
commitd24f2876255efe763d637e6da9ab67f3888ecdbb (patch)
tree0fb2f3625f28191f618b92f72d3d1d6d6f133eb0 /MdeModulePkg
parentea3be8b66f2c2635f02f20525706db7ad2b02eac (diff)
downloadedk2-d24f2876255efe763d637e6da9ab67f3888ecdbb.tar.gz
edk2-d24f2876255efe763d637e6da9ab67f3888ecdbb.tar.bz2
edk2-d24f2876255efe763d637e6da9ab67f3888ecdbb.zip
MdeModulePkg DxeIplPeim: Convert Ia32/IdtVectorAsm.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert Ia32/IdtVectorAsm.asm to Ia32/IdtVectorAsm.nasm Note: Manually updated code storing @VectorTemplateBase address Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Cc: Feng Tian <feng.tian@intel.com> Cc: Star Zeng <star.zeng@intel.com>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf1
-rw-r--r--MdeModulePkg/Core/DxeIplPeim/Ia32/IdtVectorAsm.nasm77
2 files changed, 78 insertions, 0 deletions
diff --git a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf b/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
index 79f70d1a7c..6275ccebbd 100644
--- a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
+++ b/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
@@ -40,6 +40,7 @@
X64/VirtualMemory.h ||||gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode
X64/VirtualMemory.c ||||gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode
Ia32/DxeLoadFunc.c
+ Ia32/IdtVectorAsm.nasm||||gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode
Ia32/IdtVectorAsm.asm||||gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode
Ia32/IdtVectorAsm.S ||||gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode
diff --git a/MdeModulePkg/Core/DxeIplPeim/Ia32/IdtVectorAsm.nasm b/MdeModulePkg/Core/DxeIplPeim/Ia32/IdtVectorAsm.nasm
new file mode 100644
index 0000000000..99a0bbeea8
--- /dev/null
+++ b/MdeModulePkg/Core/DxeIplPeim/Ia32/IdtVectorAsm.nasm
@@ -0,0 +1,77 @@
+;/** @file
+;
+; IDT vector entry.
+;
+; Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
+; This program and the accompanying materials
+; are licensed and made available under the terms and conditions of the BSD License
+; which accompanies this distribution. The full text of the license may be found at
+; http://opensource.org/licenses/bsd-license.php
+;
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+;
+;**/
+
+ SECTION .text
+
+;
+;------------------------------------------------------------------------------
+; Generic IDT Vector Handlers for the Host.
+;
+;------------------------------------------------------------------------------
+
+ALIGN 8
+global ASM_PFX(AsmGetVectorTemplatInfo)
+global ASM_PFX(AsmVectorFixup)
+
+@VectorTemplateBase:
+ push eax
+ db 0x6a ; push #VectorNumber
+@VectorNum:
+ db 0
+ mov eax, CommonInterruptEntry
+ jmp eax
+@VectorTemplateEnd:
+
+global ASM_PFX(AsmGetVectorTemplatInfo)
+ASM_PFX(AsmGetVectorTemplatInfo):
+ mov ecx, [esp + 4]
+ mov dword [ecx], @VectorTemplateBase
+ mov eax, (@VectorTemplateEnd - @VectorTemplateBase)
+ ret
+
+global ASM_PFX(AsmVectorFixup)
+ASM_PFX(AsmVectorFixup):
+ mov eax, dword [esp + 8]
+ mov ecx, [esp + 4]
+ mov [ecx + (@VectorNum - @VectorTemplateBase)], al
+ ret
+
+;---------------------------------------;
+; CommonInterruptEntry ;
+;---------------------------------------;
+; The follow algorithm is used for the common interrupt routine.
+
+;
+; +---------------------+ <-- 16-byte aligned ensured by processor
+; + Old SS +
+; +---------------------+
+; + Old RSP +
+; +---------------------+
+; + RFlags +
+; +---------------------+
+; + CS +
+; +---------------------+
+; + RIP +
+; +---------------------+
+; + Error Code +
+; +---------------------+
+; + Vector Number +
+; +---------------------+
+
+CommonInterruptEntry:
+ cli
+
+ jmp $
+