From d24f2876255efe763d637e6da9ab67f3888ecdbb Mon Sep 17 00:00:00 2001 From: Jordan Justen Date: Fri, 31 Oct 2014 01:18:48 -0700 Subject: [PATCH] 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 Cc: Feng Tian Cc: Star Zeng --- MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf | 1 + .../Core/DxeIplPeim/Ia32/IdtVectorAsm.nasm | 77 +++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 MdeModulePkg/Core/DxeIplPeim/Ia32/IdtVectorAsm.nasm 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.
+; 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 $ +