]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Core/DxeIplPeim/Ia32/IdtVectorAsm.nasm
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Core / DxeIplPeim / Ia32 / IdtVectorAsm.nasm
1 ;/** @file
2 ;
3 ; IDT vector entry.
4 ;
5 ; Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
6 ; SPDX-License-Identifier: BSD-2-Clause-Patent
7 ;
8 ;**/
9
10 SECTION .text
11
12 ;
13 ;------------------------------------------------------------------------------
14 ; Generic IDT Vector Handlers for the Host.
15 ;
16 ;------------------------------------------------------------------------------
17
18 ALIGN 8
19 global ASM_PFX(AsmGetVectorTemplatInfo)
20 global ASM_PFX(AsmVectorFixup)
21
22 @VectorTemplateBase:
23 push eax
24 db 0x6a ; push #VectorNumber
25 @VectorNum:
26 db 0
27 mov eax, CommonInterruptEntry
28 jmp eax
29 @VectorTemplateEnd:
30
31 global ASM_PFX(AsmGetVectorTemplatInfo)
32 ASM_PFX(AsmGetVectorTemplatInfo):
33 mov ecx, [esp + 4]
34 mov dword [ecx], @VectorTemplateBase
35 mov eax, (@VectorTemplateEnd - @VectorTemplateBase)
36 ret
37
38 global ASM_PFX(AsmVectorFixup)
39 ASM_PFX(AsmVectorFixup):
40 mov eax, dword [esp + 8]
41 mov ecx, [esp + 4]
42 mov [ecx + (@VectorNum - @VectorTemplateBase)], al
43 ret
44
45 ;---------------------------------------;
46 ; CommonInterruptEntry ;
47 ;---------------------------------------;
48 ; The follow algorithm is used for the common interrupt routine.
49
50 ;
51 ; +---------------------+ <-- 16-byte aligned ensured by processor
52 ; + Old SS +
53 ; +---------------------+
54 ; + Old RSP +
55 ; +---------------------+
56 ; + RFlags +
57 ; +---------------------+
58 ; + CS +
59 ; +---------------------+
60 ; + RIP +
61 ; +---------------------+
62 ; + Error Code +
63 ; +---------------------+
64 ; + Vector Number +
65 ; +---------------------+
66
67 CommonInterruptEntry:
68 cli
69
70 jmp $
71