kern

view src/intr-asm.S @ 46:b793b8fcba7d

apparently free_phys_page was never tested. the check for double-freeing a page was inverted.
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 28 Jul 2011 05:33:59 +0300
parents cccaa40f5432
children f65b348780e3
line source
1 .data
2 .align 4
3 .short 0
4 /* memory reserved for set_idt */
5 lim:.short 0
6 addr:.long 0
8 .text
9 /* set_idt(uint32_t addr, uint16_t limit)
10 * loads the IDTR with the new address and limit for the IDT */
11 .globl set_idt
12 set_idt:
13 movl 4(%esp), %eax
14 movl %eax, (addr)
15 movw 8(%esp), %ax
16 movw %ax, (lim)
17 lidt (lim)
18 ret
20 /* get_intr_state()
21 * returns 1 if interrutps are enabled, 0 if disabled */
22 .globl get_intr_state
23 get_intr_state:
24 pushf
25 popl %eax
26 shr $9, %eax /* bit 9 of eflags is IF */
27 andl $1, %eax
28 ret
30 /* set_intr_state(int state)
31 * enables interrupts if the argument is non-zero, disables them otherwise */
32 .globl set_intr_state
33 set_intr_state:
34 cmpl $0, 4(%esp)
35 jz 0f
36 sti
37 ret
38 0: cli
39 ret
42 /* interrupt entry with error code macro
43 * this macro generates an interrupt entry point for the
44 * exceptions which include error codes in the stack frame
45 */
46 .macro ientry_err n name
47 .globl intr_entry_\name
48 intr_entry_\name:
49 pushl $\n
50 jmp intr_entry_common
51 .endm
53 /* interrupt entry without error code macro
54 * this macro generates an interrupt entry point for the interrupts
55 * and exceptions which do not include error codes in the stack frame
56 * it pushes a dummy error code (0), to make the stack frame identical
57 */
58 .macro ientry_noerr n name
59 .globl intr_entry_\name
60 intr_entry_\name:
61 pushl $0
62 pushl $\n
63 jmp intr_entry_common
64 .endm
66 /* common code used by all entry points. calls dispatch_intr()
67 * defined in intr.c
68 */
69 .extern dispatch_intr
70 intr_entry_common:
71 pusha
72 call dispatch_intr
73 popa
74 /* remove error code and intr num from stack */
75 add $8, %esp
76 iret
78 /* by including interrupts.h with ASM defined, the macros above
79 * are expanded to generate all required interrupt entry points
80 */
81 #define ASM
82 #include <interrupts.h>