1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 05:37:43 +00:00

Kernel: Add support for interrupts on x86_64

This commit is contained in:
Gunnar Beutner 2021-06-26 14:57:13 +02:00 committed by Andreas Kling
parent 233ef26e4d
commit 065c6c307d
4 changed files with 98 additions and 19 deletions

View file

@ -100,8 +100,32 @@ static EntropySource s_entropy_source_interrupts { EntropySource::Static::Interr
asm( \
".globl " #title "_asm_entry\n" \
"" #title "_asm_entry: \n" \
" cli;hlt;\n" \
);
" pushq %r15\n" \
" pushq %r14\n" \
" pushq %r13\n" \
" pushq %r12\n" \
" pushq %r11\n" \
" pushq %r10\n" \
" pushq %r9\n" \
" pushq %r8\n" \
" pushq %rax\n" \
" pushq %rcx\n" \
" pushq %rdx\n" \
" pushq %rbx\n" \
" pushq %rsp\n" \
" pushq %rbp\n" \
" pushq %rsi\n" \
" pushq %rdi\n" \
" pushq %rsp \n" /* set TrapFrame::regs */ \
" subq $" __STRINGIFY(TRAP_FRAME_SIZE - 8) ", %rsp \n" \
" subq $0x8, %rsp\n" /* align stack */ \
" lea 0x8(%rsp), %rdi \n" \
" cld\n" \
" call enter_trap_no_irq \n" \
" lea 0x8(%rsp), %rdi \n" \
" call " #title "_handler\n" \
" addq $0x8, %rsp\n" /* undo alignment */\
" jmp common_trap_exit \n");
#define EH_ENTRY_NO_CODE(ec, title) \
extern "C" void title##_handler(TrapFrame*); \
@ -109,8 +133,33 @@ static EntropySource s_entropy_source_interrupts { EntropySource::Static::Interr
asm( \
".globl " #title "_asm_entry\n" \
"" #title "_asm_entry: \n" \
" cli;hlt;\n" \
);
" pushq $0x0\n" \
" pushq %r15\n" \
" pushq %r14\n" \
" pushq %r13\n" \
" pushq %r12\n" \
" pushq %r11\n" \
" pushq %r10\n" \
" pushq %r9\n" \
" pushq %r8\n" \
" pushq %rax\n" \
" pushq %rcx\n" \
" pushq %rdx\n" \
" pushq %rbx\n" \
" pushq %rsp\n" \
" pushq %rbp\n" \
" pushq %rsi\n" \
" pushq %rdi\n" \
" pushq %rsp \n" /* set TrapFrame::regs */ \
" subq $" __STRINGIFY(TRAP_FRAME_SIZE - 8) ", %rsp \n" \
" subq $0x8, %rsp\n" /* align stack */ \
" lea 0x8(%rsp), %rdi \n" \
" cld\n" \
" call enter_trap_no_irq \n" \
" lea 0x8(%rsp), %rdi \n" \
" call " #title "_handler\n" \
" addq $0x8, %rsp\n" /* undo alignment */\
" jmp common_trap_exit \n");
#endif
// clang-format on