summaryrefslogtreecommitdiff
path: root/Source/Kernel/SyscallManager/IDT.wtf.asm
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2009-08-22 21:44:32 +0200
committerAlexis211 <alexis211@gmail.com>2009-08-22 21:44:32 +0200
commit2582a11c37ccc22d64974b20b0793e5ba873fe1f (patch)
tree485565c0950f0355290690d3396bcb4c22774fd0 /Source/Kernel/SyscallManager/IDT.wtf.asm
parent74e721676ddd5d996ccf2e1d35da57320f658609 (diff)
downloadMelon-2582a11c37ccc22d64974b20b0793e5ba873fe1f.tar.gz
Melon-2582a11c37ccc22d64974b20b0793e5ba873fe1f.zip
Lots of stuff added : heap, timer, device managment, ...
Diffstat (limited to 'Source/Kernel/SyscallManager/IDT.wtf.asm')
-rw-r--r--Source/Kernel/SyscallManager/IDT.wtf.asm117
1 files changed, 117 insertions, 0 deletions
diff --git a/Source/Kernel/SyscallManager/IDT.wtf.asm b/Source/Kernel/SyscallManager/IDT.wtf.asm
new file mode 100644
index 0000000..b76d912
--- /dev/null
+++ b/Source/Kernel/SyscallManager/IDT.wtf.asm
@@ -0,0 +1,117 @@
+[GLOBAL idt_flush]
+
+idt_flush:
+ mov eax, [esp + 4]
+ lidt [eax]
+ ret
+
+; **********************************************************
+
+; stuff for handling interrupts
+[EXTERN interrupt_handler]
+
+%macro ISR_NOERRCODE 1
+ [GLOBAL isr%1]
+ isr%1:
+ cli
+ push byte 0
+ push byte %1
+ jmp interrupt_common_stub
+%endmacro
+
+%macro ISR_ERRCODE 1
+ [GLOBAL isr%1]
+ isr%1:
+ cli
+ push byte %1
+ jmp interrupt_common_stub
+%endmacro
+
+%macro IRQ 2
+ global irq%1
+ irq%1:
+ cli
+ push byte 0
+ push byte %2
+ jmp interrupt_common_stub
+%endmacro
+
+; ********************************************************************
+
+ISR_NOERRCODE 0
+ISR_NOERRCODE 1
+ISR_NOERRCODE 2
+ISR_NOERRCODE 3
+ISR_NOERRCODE 4
+ISR_NOERRCODE 5
+ISR_NOERRCODE 6
+ISR_NOERRCODE 7
+ISR_ERRCODE 8
+ISR_NOERRCODE 9
+ISR_ERRCODE 10
+ISR_ERRCODE 11
+ISR_ERRCODE 12
+ISR_ERRCODE 13
+ISR_ERRCODE 14
+ISR_NOERRCODE 15
+ISR_NOERRCODE 16
+ISR_NOERRCODE 17
+ISR_NOERRCODE 18
+ISR_NOERRCODE 19
+ISR_NOERRCODE 20
+ISR_NOERRCODE 21
+ISR_NOERRCODE 22
+ISR_NOERRCODE 23
+ISR_NOERRCODE 24
+ISR_NOERRCODE 25
+ISR_NOERRCODE 26
+ISR_NOERRCODE 27
+ISR_NOERRCODE 28
+ISR_NOERRCODE 29
+ISR_NOERRCODE 30
+ISR_NOERRCODE 31
+
+IRQ 0, 32
+IRQ 1, 33
+IRQ 2, 34
+IRQ 3, 35
+IRQ 4, 36
+IRQ 5, 37
+IRQ 6, 38
+IRQ 7, 39
+IRQ 8, 40
+IRQ 9, 41
+IRQ 10, 42
+IRQ 11, 43
+IRQ 12, 44
+IRQ 13, 45
+IRQ 14, 46
+IRQ 15, 47
+
+; ******************************************************************
+
+interrupt_common_stub:
+ pusha ; Pushes edi,esi,ebp,esp,ebx,edx,ecx,eax
+
+ mov ax, ds ; Lower 16-bits of eax = ds.
+ push eax ; save the data segment descriptor
+
+ mov ax, 0x10 ; load the kernel data segment descriptor
+ mov ds, ax
+ mov es, ax
+ mov fs, ax
+ mov gs, ax
+
+ call interrupt_handler
+
+ pop eax ; reload the original data segment descriptor
+ mov ds, ax
+ mov es, ax
+ mov fs, ax
+ mov gs, ax
+
+ popa ; Pops edi,esi,ebp...
+ add esp, 8 ; Cleans up the pushed error code and pushed ISR number
+ sti
+ iret
+