3 * Daniel Engström, Omicron Ceti AB, daniel@omicron.se.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25 #include <asm/interrupt.h>
34 } __attribute__ ((packed));
37 struct idt_entry idt[256];
40 asm (".globl irq_return\n"
46 void __attribute__ ((regparm(0))) default_isr(void);
47 asm ("default_isr: iret\n");
50 ".word 0x800\n" /* size of the table 8*256 bytes */
51 ".long idt\n" /* offset */
52 ".word 0x18\n");/* data segment */
54 void set_vector(u8 intnum, void *routine)
56 idt[intnum].base_high = (u16)((u32)(routine + gd->reloc_off) >> 16);
57 idt[intnum].base_low = (u16)((u32)(routine + gd->reloc_off) & 0xffff);
61 int cpu_init_interrupts(void)
72 idt[i].selector = 0x10;
73 set_vector(i, default_isr);
76 asm ("cs lidt idt_ptr\n");
78 /* It is now safe to enable interrupts */
84 void enable_interrupts(void)
89 int disable_interrupts(void)
93 asm volatile ("pushfl ; popl %0 ; cli\n" : "=g" (flags) : );
95 return (flags&0x200); /* IE flags is bit 9 */