+;-------------------------------------------------------------------------------\r
+;\r
+; Copyright (c) 2007, Intel Corporation\r
+; All rights reserved. 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
+; Module Name:\r
+;\r
+; IdtVectorAsm.asm\r
+; \r
+; Abstract:\r
+; \r
+;\r
+;-------------------------------------------------------------------------------\r
+\r
+\r
+ .686p\r
+ .model flat,C\r
+ .code\r
+\r
+;\r
+;------------------------------------------------------------------------------\r
+; Generic IDT Vector Handlers for the Host. \r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ALIGN 8\r
+PUBLIC AsmGetVectorTemplatInfo\r
+PUBLIC AsmVectorFixup\r
+\r
+PUBLIC AsmVectorFixup\r
+\r
+@VectorTemplateBase:\r
+ push eax\r
+ db 6ah ; push #VectorNumber\r
+@VectorNum:\r
+ db 0\r
+ mov eax, CommonInterruptEntry\r
+ jmp eax\r
+@VectorTemplateEnd:\r
+\r
+\r
+AsmGetVectorTemplatInfo PROC\r
+ mov ecx, [esp + 4]\r
+ mov [ecx], @VectorTemplateBase\r
+ mov eax, (@VectorTemplateEnd - @VectorTemplateBase)\r
+ ret\r
+AsmGetVectorTemplatInfo ENDP\r
+\r
+\r
+AsmVectorFixup PROC\r
+ mov eax, dword ptr [esp + 8]\r
+ mov ecx, [esp + 4]\r
+ mov [ecx + (@VectorNum - @VectorTemplateBase)], al\r
+ ret\r
+AsmVectorFixup ENDP\r
+\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 PROC \r
+ cli\r
+ \r
+ jmp $\r
+CommonInterruptEntry ENDP\r
+\r
+END\r
+\r
+\r