Skip to content

Commit

Permalink
Fixed interrupt handler crashing on non-existent interruption
Browse files Browse the repository at this point in the history
  • Loading branch information
azertyfun committed Oct 15, 2016
1 parent ff63e85 commit d4db1d7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/kernel/interrupt_handler/interrupt_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ static void scheduler_kill_handler (u16 UNUSED (msg), u16 pid, u16 return_value,
static void scheduler_add_process_handler (u16 UNUSED (msg), u16 location, u16 name, u16 UNUSED (arg3));
static void scheduler_get_processes_list_handler (u16 UNUSED (msg), u16 raw_ptr1, u16 raw_ptr2, u16 raw_ptr3);

static u16 int_table_size;
u16 int_table_size;
static Int_handler *int_table;

Int_handler *int_handler_allocate (u16 nb_hardware) {
Expand Down
2 changes: 2 additions & 0 deletions src/kernel/interrupt_handler/interrupt_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ typedef enum {

typedef void (*Int_handler) (u16 message, u16 arg1, u16 arg2, u16 arg3);

extern u16 int_table_size;

Int_handler *int_handler_allocate (u16 nb_hardware);
void int_handler_activate ();
void interrupt (u16 message, u16 arg_1, u16 arg_2, u16 arg_3);
Expand Down
4 changes: 3 additions & 1 deletion src/kernel/interrupt_handler/interrupt_handler_asm.dasm
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
:interrupt_handler_asm
ife A, 0xFFFE
set PC, scheduler_switch
set PC, interrupt_handler
ifl A, int_table_size ; Protection against interrupts that don't exist
set PC, interrupt_handler
rfi 0

0 comments on commit d4db1d7

Please sign in to comment.