mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
CPU: Add 2 files with ISR stub macros
This commit is contained in:
parent
c51a57fb32
commit
71371d39b3
Notes:
sideshowbarker
2024-07-19 09:06:14 +09:00
Author: https://github.com/supercomputer7
Commit: 71371d39b3
Pull-request: https://github.com/SerenityOS/serenity/pull/1274
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/shannonbooth
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