diff options
| author | Miguel <m.i@gmx.at> | 2018-09-14 23:10:16 +0200 |
|---|---|---|
| committer | Miguel <m.i@gmx.at> | 2018-09-14 23:10:16 +0200 |
| commit | c4b20a0ebbde1348e1e085e2ea3be35345d92b7c (patch) | |
| tree | 611b68c1d288cace070152c628bb0e0e211bb500 /asm/asm_int.s | |
| parent | fdf6100721870780319bc7cc766a0bb5b4789965 (diff) | |
tuining userspace and files
Diffstat (limited to 'asm/asm_int.s')
| -rw-r--r-- | asm/asm_int.s | 72 |
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 |
