kern
diff src/intr-asm.S @ 11:cccaa40f5432
forgot to add a load of stuff
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 19 Feb 2011 04:41:51 +0200 |
parents | |
children | 9939a6d7a45a |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/intr-asm.S Sat Feb 19 04:41:51 2011 +0200 1.3 @@ -0,0 +1,60 @@ 1.4 + .data 1.5 + .align 4 1.6 + .short 0 1.7 +/* memory reserved for set_idt */ 1.8 +lim:.short 0 1.9 +addr:.long 0 1.10 + 1.11 + .text 1.12 +/* set_idt(uint32_t addr, uint16_t limit) 1.13 + * loads the IDTR with the new address and limit for the IDT */ 1.14 + .globl set_idt 1.15 +set_idt: 1.16 + movl 4(%esp), %eax 1.17 + movl %eax, (addr) 1.18 + movw 8(%esp), %ax 1.19 + movw %ax, (lim) 1.20 + lidt (lim) 1.21 + ret 1.22 + 1.23 +/* interrupt entry with error code macro 1.24 + * this macro generates an interrupt entry point for the 1.25 + * exceptions which include error codes in the stack frame 1.26 + */ 1.27 + .macro ientry_err n name 1.28 + .globl intr_entry_\name 1.29 +intr_entry_\name: 1.30 + pushl $\n 1.31 + jmp intr_entry_common 1.32 + .endm 1.33 + 1.34 +/* interrupt entry without error code macro 1.35 + * this macro generates an interrupt entry point for the interrupts 1.36 + * and exceptions which do not include error codes in the stack frame 1.37 + * it pushes a dummy error code (0), to make the stack frame identical 1.38 + */ 1.39 + .macro ientry_noerr n name 1.40 + .globl intr_entry_\name 1.41 +intr_entry_\name: 1.42 + pushl $0 1.43 + pushl $\n 1.44 + jmp intr_entry_common 1.45 + .endm 1.46 + 1.47 +/* common code used by all entry points. calls dispatch_intr() 1.48 + * defined in intr.c 1.49 + */ 1.50 + .extern dispatch_intr 1.51 +intr_entry_common: 1.52 + pusha 1.53 + call dispatch_intr 1.54 + popa 1.55 + /* remove error code and intr num from stack */ 1.56 + add $8, %esp 1.57 + iret 1.58 + 1.59 +/* by including interrupts.h with ASM defined, the macros above 1.60 + * are expanded to generate all required interrupt entry points 1.61 + */ 1.62 +#define ASM 1.63 +#include <interrupts.h>