f6ba6aa117
and the Makefile will take care of the rest.
51 lines
1.2 KiB
C
51 lines
1.2 KiB
C
//
|
|
// isr.c -- High level interrupt service routines and interrupt request handlers.
|
|
// Part of this code is modified from Bran's kernel development tutorials.
|
|
// Rewritten for JamesM's kernel development tutorials.
|
|
//
|
|
|
|
#include "headers/common.h"
|
|
#include "headers/isr.h"
|
|
#include "headers/screen.h"
|
|
#include <stdint.h>
|
|
|
|
isr_t interrupt_handlers[256];
|
|
|
|
|
|
// This gets called from our ASM interrupt handler stub.
|
|
void isr_handler(registers_t *regs)
|
|
{
|
|
//kprintf("recieved interrupt: %d\n",regs->int_no);
|
|
|
|
if(interrupt_handlers[regs->int_no] != 0)
|
|
{
|
|
isr_t handler = interrupt_handlers[regs->int_no];
|
|
handler(regs);
|
|
}
|
|
}
|
|
|
|
void irq_handler(registers_t *regs)
|
|
{
|
|
//kprintf("recieved irq: %d\n",regs->int_no);
|
|
// send an EOI signal to pics if this
|
|
// interrupt involved the slave
|
|
if(regs->int_no >= 40)
|
|
{
|
|
outb(0xA0,0x20);
|
|
}
|
|
// send reset siginal to master. (as well as slave, if neccessary).
|
|
outb(0x20,0x20);
|
|
|
|
if(interrupt_handlers[regs->int_no] != 0)
|
|
{
|
|
isr_t handler = interrupt_handlers[regs->int_no];
|
|
handler(regs);
|
|
}
|
|
}
|
|
|
|
|
|
void register_interrupt_handler(uint8_t n, isr_t handler)
|
|
{
|
|
interrupt_handlers[n] = handler;
|
|
}
|