Modestus Moon OS  R4
CS 450 project
interrupts.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void init_irq (void)
 
void init_pic (void)
 

Function Documentation

void init_irq ( void  )

Definition at line 68 of file interrupts.c.

References bounds(), breakpoint(), coprocessor(), coprocessor_segment(), debug(), device_not_available(), divide_error(), double_fault(), general_protection(), idt_set_gate(), invalid_op(), invalid_tss(), nmi(), overflow(), page_fault(), reserved(), rtc_isr(), segment_not_present(), stack_segment(), and sys_call_isr().

Referenced by kmain().

69 {
70  int i;
71 
72  // Necessary interrupt handlers for protected mode
73  u32int isrs[17] = {
75  (u32int)debug,
76  (u32int)nmi,
79  (u32int)bounds,
91  };
92 
93  // Install handlers; 0x08=sel, 0x8e=flags
94  for(i=0; i<32; i++){
95  if (i<17) idt_set_gate(i, isrs[i], 0x08, 0x8e);
96  else idt_set_gate(i, (u32int)reserved, 0x08, 0x8e);
97  }
98  // Ignore interrupts from the real time clock
99  idt_set_gate(0x08, (u32int)rtc_isr, 0x08, 0x8e);
100  idt_set_gate(60, (u32int)sys_call_isr, 0x08, 0x8e);
101 }
void divide_error()
void invalid_op()
void breakpoint()
void sys_call_isr()
void overflow()
void page_fault()
void stack_segment()
void general_protection()
void double_fault()
void segment_not_present()
void idt_set_gate(u8int idx, u32int base, u16int sel, u8int flags)
Definition: tables.c:27
void debug()
void coprocessor()
void bounds()
unsigned long u32int
Definition: system.h:27
void invalid_tss()
void rtc_isr()
void nmi()
void device_not_available()
void coprocessor_segment()
void reserved()
void init_pic ( void  )

Definition at line 109 of file interrupts.c.

References ICW1, ICW4, io_wait, outb, PIC1, and PIC2.

Referenced by kmain().

110 {
111  outb(PIC1,ICW1); //send initialization code words 1 to PIC1
112  io_wait();
113  outb(PIC2,ICW1); //send icw1 to PIC2
114  io_wait();
115  outb(PIC1+1,0x20); //icw2: remap irq0 to 32
116  io_wait();
117  outb(PIC2+1,0x28); //icw2: remap irq8 to 40
118  io_wait();
119  outb(PIC1+1,4); //icw3
120  io_wait();
121  outb(PIC2+1,2); //icw3
122  io_wait();
123  outb(PIC1+1,ICW4); //icw4: 80x86, automatic handling
124  io_wait();
125  outb(PIC2+1,ICW4); //icw4: 80x86, automatic handling
126  io_wait();
127  outb(PIC1+1,0xFF); //disable irqs for PIC1
128  io_wait();
129  outb(PIC2+1,0xFF); //disable irqs for PIC2
130 }
#define PIC1
Definition: interrupts.c:16
#define PIC2
Definition: interrupts.c:17
#define ICW1
Definition: interrupts.c:20
#define ICW4
Definition: interrupts.c:21
#define io_wait()
Definition: interrupts.c:28
#define outb(port, data)
Definition: io.h:8