blob: b45483b1b311f518ea2656a480ca035099fc2667 (
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
|
#pragma once
#include <AK/Types.h>
extern "C" void interrupt_common_asm_entry();
#define GENERATE_GENERIC_INTERRUPT_HANDLER_ASM_ENTRY(interrupt_vector, isr_number) \
extern "C" void interrupt_##interrupt_vector##_asm_entry(); \
asm(".globl interrupt_" #interrupt_vector "_asm_entry\n" \
"interrupt_" #interrupt_vector "_asm_entry:\n" \
" pushw $" #isr_number "\n" \
" pushw $0\n" \
" jmp interrupt_common_asm_entry\n");
asm(
".globl interrupt_common_asm_entry\n"
"interrupt_common_asm_entry: \n"
" pusha\n"
" pushl %ds\n"
" pushl %es\n"
" pushl %fs\n"
" pushl %gs\n"
" pushl %ss\n"
" mov $0x10, %ax\n"
" mov %ax, %ds\n"
" mov %ax, %es\n"
" cld\n"
" call handle_interrupt\n"
" add $0x4, %esp\n" // "popl %ss"
" popl %gs\n"
" popl %fs\n"
" popl %es\n"
" popl %ds\n"
" popa\n"
" add $0x4, %esp\n"
" iret\n");
|