mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 03:57:43 +00:00
CPU: Add 2 files with ISR stub macros
This commit is contained in:
parent
c51a57fb32
commit
71371d39b3
2 changed files with 296 additions and 0 deletions
36
Kernel/Arch/i386/Interrupts.h
Normal file
36
Kernel/Arch/i386/Interrupts.h
Normal file
|
@ -0,0 +1,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");
|
Loading…
Add table
Add a link
Reference in a new issue