summaryrefslogtreecommitdiff
path: root/asm/int.s
diff options
context:
space:
mode:
Diffstat (limited to 'asm/int.s')
-rw-r--r--asm/int.s135
1 files changed, 94 insertions, 41 deletions
diff --git a/asm/int.s b/asm/int.s
index f6cb9e8..156c266 100644
--- a/asm/int.s
+++ b/asm/int.s
@@ -17,11 +17,48 @@
.global int15
.global int128
+.global int129
+.global int255
+
+.global exc0
+.global exc1
+.global exc2
+.global exc3
+.global exc4
+.global exc5
+.global exc6
+.global exc7
+.global exc8
+.global exc9
+.global exc10
+.global exc11
+.global exc12
+.global exc13
+.global exc14
+.global exc15
+.global exc16
+.global exc17
+.global exc18
//temporary
.global asm_mouse_handler
.global asm_kb_handler
+asm_kb_handler:
+ push %eax
+ mov $0x0,%eax
+ in $0x60,%al
+ pop %eax
+ ret
+
+asm_mouse_handler:
+ push %eax
+ mov $0x0,%eax
+ in $0x60,%al
+ pop %eax
+ ret
+
+///////////////
// nothing to ack
.macro ack0
@@ -44,17 +81,9 @@
pop %eax // load original
.endm
-// ignore return value
-.macro ret0
- add $4,%esp
-.endm
-// put return value in %eax
-.macro ret1
- pop %eax
-.endm
-.macro intx ack retx num func
+.macro intx ack num func
/*
Once we arrived here the stack already contains 3x 32bit values,
@@ -81,6 +110,8 @@
push $0x666 //make room for potential C functions 'return value'.
//we use eax already for esp (so we can context switch)
+ push $0x0 //indicate if we want to return the value in ebx 0x0=NO
+
pusha //Push all standard registers 8 regs x 4bytes/32bit
push %ds //Push data segment
push %es //etc...
@@ -103,42 +134,64 @@
pop %ds
popa
- \retx // potentially set return value to eax to return to the caller
+ cmp $0x0,(%esp)
+ je skip\num
+ pop %ebx
+ pop %ebx
+ jmp ret\num
+ skip\num:
+ add $8,%esp // potentially set return value to eax to return to the caller
+ ret\num:
iret // pops the return instruction pointer, return code segment selector, and EFLAGS image from the stack
.endm
-int0: intx ack1 ret0 $0 interrupt_handler
-int1: intx ack1 ret0 $1 interrupt_handler
-int2: intx ack1 ret0 $2 interrupt_handler
-int3: intx ack1 ret0 $3 interrupt_handler
-int4: intx ack1 ret0 $4 interrupt_handler
-int5: intx ack1 ret0 $5 interrupt_handler
-int6: intx ack1 ret0 $6 interrupt_handler
-int7: intx ack1 ret0 $7 interrupt_handler
-
-int8: intx ack2 ret0 $8 interrupt_handler
-int9: intx ack2 ret0 $9 interrupt_handler
-int10: intx ack2 ret0 $10 interrupt_handler
-int11: intx ack2 ret0 $11 interrupt_handler
-int12: intx ack2 ret0 $12 interrupt_handler
-int13: intx ack2 ret0 $13 interrupt_handler
-int14: intx ack2 ret0 $14 interrupt_handler
-int15: intx ack2 ret0 $15 interrupt_handler
-
-int128: intx ack0 ret1 $128 interrupt_handler
+.macro excx func
+ call \func
+ jmp .
+.endm
-asm_kb_handler:
- push %eax
- mov $0x0,%eax
- in $0x60,%al
- pop %eax
- ret
+int0: intx ack1 $0 interrupt_handler
+int1: intx ack1 $1 interrupt_handler
+int2: intx ack1 $2 interrupt_handler
+int3: intx ack1 $3 interrupt_handler
+int4: intx ack1 $4 interrupt_handler
+int5: intx ack1 $5 interrupt_handler
+int6: intx ack1 $6 interrupt_handler
+int7: intx ack1 $7 interrupt_handler
+
+int8: intx ack2 $8 interrupt_handler
+int9: intx ack2 $9 interrupt_handler
+int10: intx ack2 $10 interrupt_handler
+int11: intx ack2 $11 interrupt_handler
+int12: intx ack2 $12 interrupt_handler
+int13: intx ack2 $13 interrupt_handler
+int14: intx ack2 $14 interrupt_handler
+int15: intx ack2 $15 interrupt_handler
+
+int128: intx ack0 $128 interrupt_handler
+int129: intx ack0 $129 interrupt_handler
+
+int255: intx ack0 $255 interrupt_handler
+
+exc0: excx exception_handle_0
+exc1: excx exception_handle_1
+exc2: excx exception_handle_2
+exc3: excx exception_handle_3
+exc4: excx exception_handle_4
+exc5: excx exception_handle_5
+exc6: excx exception_handle_6
+exc7: excx exception_handle_7
+exc8: excx exception_handle_8
+exc9: excx exception_handle_9
+exc10: excx exception_handle_10
+exc11: excx exception_handle_11
+exc12: excx exception_handle_12
+exc13: excx exception_handle_13
+exc14: excx exception_handle_14
+exc15: excx exception_handle_15
+exc16: excx exception_handle_16
+exc17: excx exception_handle_17
+exc18: excx exception_handle_18
-asm_mouse_handler:
- push %eax
- mov $0x0,%eax
- in $0x60,%al
- pop %eax
- ret