UnnamedOS
isr.c File Reference
#include <common.h>
#include <interrupts/isr.h>
#include <interrupts/idt.h>
#include <interrupts/pic.h>
#include <interrupts/syscall.h>
#include <hardware/pit.h>
#include <hardware/io/ps2.h>
+ Include dependency graph for isr.c:

Go to the source code of this file.

Macros

#define IS_EXCEPTION(intr)   ((intr) <= 0x1F)
 whether the given interrupt vector is an exception
 
#define IS_IRQ(intr)    ((intr) >= 0x20 && intr <= 0x2F)
 whether the given interrupt vector is an IRQ
 
#define IS_SYSCALL(intr)    ((intr) == 0x30)
 whether the given interrupt vector is the syscall
 

Functions

uint8_t isr_enable_interrupts (uint8_t enable)
 Enables or disables interrupts. More...
 
uint8_t isr_get_interrupts ()
 Returns whether interrupts are enabled or disabled. More...
 
void isr_register_handler (size_t intr, isr_handler_t handler)
 Registers a handler to call whenever a given interrupt is fired. More...
 
void isr_register_syscall (size_t id, void *syscall)
 Registers a syscall handler to call whenever a specified syscall is requested. More...
 
cpu_state_tisr_handle_interrupt (cpu_state_t *cpu)
 Handles all interrupts. More...
 
void isr_dump_cpu (cpu_state_t *cpu)
 Dumps a CPU state. More...
 
static cpu_state_tisr_handle_syscall (cpu_state_t *cpu)
 Handles all syscalls. More...
 
void isr_init ()
 Initializes syscalls and enables interrupts.
 

Variables

static isr_handler_t handlers [IDT_ENTRIES] = {0}
 a table that associates interrupt vectors with handlers
 
static void * syscalls [SYSCALL_NUMBER] = {0}
 a table that associates syscall IDs with handlers