summaryrefslogtreecommitdiffhomepage
path: root/Private/HALKit/AMD64/HalInterruptRouting.asm
blob: 9bc13f15c026c8b56d064846d2a25e301b1bd978 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
;; /*
;; *    ---------------------------------------------------
;; *
;; * 	Copyright Mahrouss Logic, all rights reserved.
;; *
;; *    File: HalInterruptRouting.asm
;; *    Purpose: Interrupt routing, redirect raw interrupts into their handlers.
;; *
;; *    ---------------------------------------------------
;; */

[bits 64]

%macro IntDecl 1
    dq HCoreInterrupt%1
%endmacro

%macro IntExp 1
HCoreInterrupt%1:
    push %1
    jmp ke_handle_irq
%endmacro

%macro IntNormal 1
HCoreInterrupt%1:
    push  0
    push  %1
    jmp ke_handle_irq
%endmacro

; This file handles the core interrupt table
; Last edited 31/01/24

extern rt_handle_interrupts
global rt_install_idt
global __EXEC_IVT

section .text

ke_handle_irq:
    cld

    push rax
    push rbx
    push rcx
    push rdx
    push rsi
    push rdi
    push rbp
    push r8
    push r9
    push r10
    push r11
    push r12
    push r13
    push r14
    push r15

    mov rdi, rsp
    call rt_handle_interrupts
    mov rsp, rax

    pop r15
    pop r14
    pop r13
    pop r12
    pop r11
    pop r10
    pop r9
    pop r8
    pop rbp
    pop rdi
    pop rsi
    pop rdx
    pop rcx
    pop rbx
    pop rax

    ret

section .data

    IntNormal 0
    IntNormal 1
    IntNormal 2
    IntNormal 3
    IntNormal 4
    IntNormal 5
    IntNormal 6
    IntNormal 7
    IntExp   8
    IntNormal 9
    IntExp   10
    IntExp   11
    IntExp   12
    IntExp   13
    IntExp   14
    IntNormal 15
    IntNormal 16
    IntExp 17
    IntNormal 18
    IntNormal 19
    IntNormal 20
    IntNormal 21
    IntNormal 22
    IntNormal 23
    IntNormal 24
    IntNormal 25
    IntNormal 26
    IntNormal 27
    IntNormal 28
    IntNormal 29
    IntExp   30
    IntNormal 31

    %assign i 32
    %rep 224
        IntNormal i
    %assign i i+1
    %endrep

__EXEC_IVT:
    %assign i 0
    %rep 256
        IntDecl i
    %assign i i+1
    %endrep