summaryrefslogtreecommitdiff
path: root/asm/asm_int.s
diff options
context:
space:
mode:
Diffstat (limited to 'asm/asm_int.s')
-rw-r--r--asm/asm_int.s72
1 files changed, 51 insertions, 21 deletions
diff --git a/asm/asm_int.s b/asm/asm_int.s
index ec81885..8d5ac9a 100644
--- a/asm/asm_int.s
+++ b/asm/asm_int.s
@@ -67,6 +67,13 @@
pop %eax // load original
.endm
+.macro err0
+.endm
+
+.macro err1
+ add $4,%esp
+.endm
+
.macro intx ack num func
/*
@@ -131,35 +138,58 @@
.endm
-.macro excx num func
+.macro excx num err func
+ cli // exception does not prevent from rescheduling?
mov %esp,%eax // remember THIS stack position
and $-16,%esp // padding to align stack on 16byte boundary before CALL
sub $8,%esp // ...
push \num // pass in this interrupt number
push %eax // pass in original %esp (saved just few lines before)
call \func // call aligned
- jmp .
+ mov %eax,%esp // use the %esp we got from c function
+
+ pop %gs // pop everything back...
+ pop %fs // ...
+ pop %es
+ pop %ds
+ popa
+
+ cmp $0x0,(%esp)
+ je skipEx\num
+ pop %ebx
+ pop %ebx
+ jmp retEx\num
+ skipEx\num:
+ add $8,%esp // potentially set return value to eax to return to the caller
+ retEx\num:
+ sti
+
+ iret // pops the return instruction pointer, return code segment selector, and EFLAGS image from the stack
+// pop %esp
+ // \err
+ //iret
+
.endm
-exc0: excx $0 exception_handle
-exc1: excx $1 exception_handle
-exc2: excx $2 exception_handle
-exc3: excx $3 exception_handle
-exc4: excx $4 exception_handle
-exc5: excx $5 exception_handle
-exc6: excx $6 exception_handle
-exc7: excx $7 exception_handle
-exc8: excx $8 exception_handle
-exc9: excx $9 exception_handle
-exc10: excx $10 exception_handle
-exc11: excx $11 exception_handle
-exc12: excx $12 exception_handle
-exc13: excx $13 exception_handle
-exc14: excx $14 exception_handle
-exc15: excx $15 exception_handle
-exc16: excx $16 exception_handle
-exc17: excx $17 exception_handle
-exc18: excx $18 exception_handle
+exc0: excx $0 err0 exception_handle
+exc1: excx $1 err0 exception_handle
+exc2: excx $2 err0 exception_handle
+exc3: excx $3 err0 exception_handle
+exc4: excx $4 err0 exception_handle
+exc5: excx $5 err0 exception_handle
+exc6: excx $6 err0 exception_handle
+exc7: excx $7 err0 exception_handle
+exc8: excx $8 err1 exception_handle
+exc9: excx $9 err0 exception_handle
+exc10: excx $10 err1 exception_handle
+exc11: excx $11 err1 exception_handle
+exc12: excx $12 err1 exception_handle
+exc13: excx $13 err1 exception_handle
+exc14: excx $14 err1 exception_handle
+exc15: excx $15 err0 exception_handle
+exc16: excx $16 err0 exception_handle
+exc17: excx $17 err1 exception_handle
+exc18: excx $18 err0 exception_handle
int0: intx ack0 $0 interrupt_handler
int1: intx ack0 $1 interrupt_handler