From 04b4c029420b010a906d0af3fb7b52108471c4bd Mon Sep 17 00:00:00 2001 From: dzwdz Date: Wed, 21 Jul 2021 18:02:53 +0200 Subject: create ISR stubs, which call a single main isr handler quick explaination of how this even works: The `call` in each stub pushes its own address onto the stack before calling stage2. We can substract the address of the 0th ISR to get the offset, which we then divide by the size of each stub to get the index. --- src/kernel/arch/i386/interrupts/isr_stub.s | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/kernel/arch/i386/interrupts/isr_stub.s (limited to 'src/kernel/arch/i386/interrupts/isr_stub.s') diff --git a/src/kernel/arch/i386/interrupts/isr_stub.s b/src/kernel/arch/i386/interrupts/isr_stub.s new file mode 100644 index 0000000..a8a97b3 --- /dev/null +++ b/src/kernel/arch/i386/interrupts/isr_stub.s @@ -0,0 +1,25 @@ +.section .text + +.global _isr_stubs +_isr_stubs: + +.rept 256 + .align 8 + pushal + call _isr_stage2 +.endr + +_isr_stage2: + cld + + // convert the return address into the vector nr + pop %eax + add $-_isr_stubs, %eax + shr $3, %eax + push %eax + + call isr_stage3 + add $4, %esp + + popal + iret -- cgit v1.2.3