aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/idt.s
blob: ead5b20b226273213eb049c343acf77e747692c7 (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
.set IRQ_BASE, 0x20

.section .text
.extern handle_interrput
.global irqign

.macro gen_irq_handler num
.global irqhdl\num\()
irqhdl\num\():
movb $\num + IRQ_BASE, (intrptno)
jmp _bot
.endm

gen_irq_handler 0x00
gen_irq_handler 0x01

_bot:
/* store current data */
push %ebp
push %edi
push %esi
push %edx
push %ecx
push %ebx
push %eax

/* call interrupt handler */
push %esp
push (intrptno)
call kernel_handle_interrupt
movl %eax, %esp

/* restore previous data */
pop %eax
pop %ebx
pop %ecx
pop %edx
pop %esi
pop %edi
pop %ebp

irqign:
/* continue */
iret

.data
intrptno: .byte 0