1 ;/** @file 2 ; 3 ; IDT vector entry. 4 ; 5 ; Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR> 6 ; This program and the accompanying materials 7 ; are licensed and made available under the terms and conditions of the BSD License 8 ; which accompanies this distribution. The full text of the license may be found at 9 ; http://opensource.org/licenses/bsd-license.php 10 ; 11 ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 ; 14 ;**/ 15 16 SECTION .text 17 18 ; 19 ;------------------------------------------------------------------------------ 20 ; Generic IDT Vector Handlers for the Host. 21 ; 22 ;------------------------------------------------------------------------------ 23 24 ALIGN 8 25 global ASM_PFX(AsmGetVectorTemplatInfo) 26 global ASM_PFX(AsmVectorFixup) 27 28 @VectorTemplateBase: 29 push eax 30 db 0x6a ; push #VectorNumber 31 @VectorNum: 32 db 0 33 mov eax, CommonInterruptEntry 34 jmp eax 35 @VectorTemplateEnd: 36 37 global ASM_PFX(AsmGetVectorTemplatInfo) 38 ASM_PFX(AsmGetVectorTemplatInfo): 39 mov ecx, [esp + 4] 40 mov dword [ecx], @VectorTemplateBase 41 mov eax, (@VectorTemplateEnd - @VectorTemplateBase) 42 ret 43 44 global ASM_PFX(AsmVectorFixup) 45 ASM_PFX(AsmVectorFixup): 46 mov eax, dword [esp + 8] 47 mov ecx, [esp + 4] 48 mov [ecx + (@VectorNum - @VectorTemplateBase)], al 49 ret 50 51 ;---------------------------------------; 52 ; CommonInterruptEntry ; 53 ;---------------------------------------; 54 ; The follow algorithm is used for the common interrupt routine. 55 56 ; 57 ; +---------------------+ <-- 16-byte aligned ensured by processor 58 ; + Old SS + 59 ; +---------------------+ 60 ; + Old RSP + 61 ; +---------------------+ 62 ; + RFlags + 63 ; +---------------------+ 64 ; + CS + 65 ; +---------------------+ 66 ; + RIP + 67 ; +---------------------+ 68 ; + Error Code + 69 ; +---------------------+ 70 ; + Vector Number + 71 ; +---------------------+ 72 73 CommonInterruptEntry: 74 cli 75 76 jmp $ 77 78