diff options
author | dzwdz | 2021-07-21 18:02:53 +0200 |
---|---|---|
committer | dzwdz | 2021-07-21 18:02:53 +0200 |
commit | 04b4c029420b010a906d0af3fb7b52108471c4bd (patch) | |
tree | 48154dfd8de19f140c242fc1c21b89f780730adb /src/kernel/arch/i386/interrupts/isr_stub.s | |
parent | 1b9c86d59753e2ecaf9529386483aebbe25ba265 (diff) |
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.
Diffstat (limited to 'src/kernel/arch/i386/interrupts/isr_stub.s')
-rw-r--r-- | src/kernel/arch/i386/interrupts/isr_stub.s | 25 |
1 files changed, 25 insertions, 0 deletions
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 |