kern
annotate src/intr-asm.S @ 12:eaec918de072
- fixed the scrolling issue
- other minor crap
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Tue, 22 Feb 2011 18:51:44 +0200 |
parents | |
children | 9939a6d7a45a |
rev | line source |
---|---|
nuclear@11 | 1 .data |
nuclear@11 | 2 .align 4 |
nuclear@11 | 3 .short 0 |
nuclear@11 | 4 /* memory reserved for set_idt */ |
nuclear@11 | 5 lim:.short 0 |
nuclear@11 | 6 addr:.long 0 |
nuclear@11 | 7 |
nuclear@11 | 8 .text |
nuclear@11 | 9 /* set_idt(uint32_t addr, uint16_t limit) |
nuclear@11 | 10 * loads the IDTR with the new address and limit for the IDT */ |
nuclear@11 | 11 .globl set_idt |
nuclear@11 | 12 set_idt: |
nuclear@11 | 13 movl 4(%esp), %eax |
nuclear@11 | 14 movl %eax, (addr) |
nuclear@11 | 15 movw 8(%esp), %ax |
nuclear@11 | 16 movw %ax, (lim) |
nuclear@11 | 17 lidt (lim) |
nuclear@11 | 18 ret |
nuclear@11 | 19 |
nuclear@11 | 20 /* interrupt entry with error code macro |
nuclear@11 | 21 * this macro generates an interrupt entry point for the |
nuclear@11 | 22 * exceptions which include error codes in the stack frame |
nuclear@11 | 23 */ |
nuclear@11 | 24 .macro ientry_err n name |
nuclear@11 | 25 .globl intr_entry_\name |
nuclear@11 | 26 intr_entry_\name: |
nuclear@11 | 27 pushl $\n |
nuclear@11 | 28 jmp intr_entry_common |
nuclear@11 | 29 .endm |
nuclear@11 | 30 |
nuclear@11 | 31 /* interrupt entry without error code macro |
nuclear@11 | 32 * this macro generates an interrupt entry point for the interrupts |
nuclear@11 | 33 * and exceptions which do not include error codes in the stack frame |
nuclear@11 | 34 * it pushes a dummy error code (0), to make the stack frame identical |
nuclear@11 | 35 */ |
nuclear@11 | 36 .macro ientry_noerr n name |
nuclear@11 | 37 .globl intr_entry_\name |
nuclear@11 | 38 intr_entry_\name: |
nuclear@11 | 39 pushl $0 |
nuclear@11 | 40 pushl $\n |
nuclear@11 | 41 jmp intr_entry_common |
nuclear@11 | 42 .endm |
nuclear@11 | 43 |
nuclear@11 | 44 /* common code used by all entry points. calls dispatch_intr() |
nuclear@11 | 45 * defined in intr.c |
nuclear@11 | 46 */ |
nuclear@11 | 47 .extern dispatch_intr |
nuclear@11 | 48 intr_entry_common: |
nuclear@11 | 49 pusha |
nuclear@11 | 50 call dispatch_intr |
nuclear@11 | 51 popa |
nuclear@11 | 52 /* remove error code and intr num from stack */ |
nuclear@11 | 53 add $8, %esp |
nuclear@11 | 54 iret |
nuclear@11 | 55 |
nuclear@11 | 56 /* by including interrupts.h with ASM defined, the macros above |
nuclear@11 | 57 * are expanded to generate all required interrupt entry points |
nuclear@11 | 58 */ |
nuclear@11 | 59 #define ASM |
nuclear@11 | 60 #include <interrupts.h> |