--- /dev/null
+;/** @file\r
+;\r
+; IDT vector entry.\r
+;\r
+; Copyright (c) 2007 - 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
+ SECTION .text\r
+\r
+;\r
+;------------------------------------------------------------------------------\r
+; Generic IDT Vector Handlers for the Host.\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ALIGN 8\r
+global ASM_PFX(AsmGetVectorTemplatInfo)\r
+global ASM_PFX(AsmVectorFixup)\r
+\r
+@VectorTemplateBase:\r
+ push eax\r
+ db 0x6a ; push #VectorNumber\r
+@VectorNum:\r
+ db 0\r
+ mov eax, CommonInterruptEntry\r
+ jmp eax\r
+@VectorTemplateEnd:\r
+\r
+global ASM_PFX(AsmGetVectorTemplatInfo)\r
+ASM_PFX(AsmGetVectorTemplatInfo):\r
+ mov ecx, [esp + 4]\r
+ mov dword [ecx], @VectorTemplateBase\r
+ mov eax, (@VectorTemplateEnd - @VectorTemplateBase)\r
+ ret\r
+\r
+global ASM_PFX(AsmVectorFixup)\r
+ASM_PFX(AsmVectorFixup):\r
+ mov eax, dword [esp + 8]\r
+ mov ecx, [esp + 4]\r
+ mov [ecx + (@VectorNum - @VectorTemplateBase)], al\r
+ ret\r
+\r
+;---------------------------------------;\r
+; CommonInterruptEntry ;\r
+;---------------------------------------;\r
+; The follow algorithm is used for the common interrupt routine.\r
+\r
+;\r
+; +---------------------+ <-- 16-byte aligned ensured by processor\r
+; + Old SS +\r
+; +---------------------+\r
+; + Old RSP +\r
+; +---------------------+\r
+; + RFlags +\r
+; +---------------------+\r
+; + CS +\r
+; +---------------------+\r
+; + RIP +\r
+; +---------------------+\r
+; + Error Code +\r
+; +---------------------+\r
+; + Vector Number +\r
+; +---------------------+\r
+\r
+CommonInterruptEntry:\r
+ cli\r
+\r
+ jmp $\r
+\r