Moved load_idt to .s file
This commit is contained in:
parent
3f95c1ec8b
commit
a0752cba62
@ -12,10 +12,16 @@
|
||||
extern interrupt_handler
|
||||
extern cpu_reg_state
|
||||
extern stack_state
|
||||
extern idt_ptr
|
||||
|
||||
global load_idt
|
||||
load_idt:
|
||||
lidt [idt_ptr]
|
||||
ret
|
||||
|
||||
%macro no_err_handler 1
|
||||
global interrupt_handler_%1 ; defined in interrupts.h
|
||||
interrupt_handler_%1:
|
||||
global no_err_handler_%1 ; defined in interrupts.h
|
||||
no_err_handler_%1:
|
||||
push dword 0
|
||||
push dword %1
|
||||
jmp common_int_handler
|
||||
@ -23,8 +29,8 @@ interrupt_handler_%1:
|
||||
|
||||
; deals with the intterrupts that do give us an error code
|
||||
%macro err_code_handler 1
|
||||
global interrupt_handler_%1
|
||||
interrupt_handler_%1:
|
||||
global err_code_handler_%1
|
||||
err_code_handler_%1:
|
||||
push dword %1
|
||||
jmp common_int_handler
|
||||
%endmacro
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "mem.h"
|
||||
#include "types.h"
|
||||
|
||||
extern void load_idt();
|
||||
extern void no_err_handler_1();
|
||||
extern void no_err_handler_2();
|
||||
extern void no_err_handler_3();
|
||||
@ -51,14 +52,12 @@ void setup_idt_entry(u32 t_idx, u32 base, u16 sel, u8 type_attrs) {
|
||||
IDT[t_idx].selector = sel;
|
||||
}
|
||||
|
||||
void load_idt() {
|
||||
asm("lidt [idt_ptr]");
|
||||
return;
|
||||
}
|
||||
|
||||
// Generic interrupt handler to be used later on
|
||||
void interrupt_handler(struct cpu_reg_state cpu, struct stack_state stack, u32 interrupt_code) {
|
||||
// treating things on the stack like it were a cpu_reg_state
|
||||
// NOTE: dummy stuff to stop gcc from complaining atm
|
||||
cpu.eax += 1;
|
||||
stack.error_code += interrupt_code;
|
||||
}
|
||||
|
||||
void init_idt() {
|
||||
|
@ -51,7 +51,6 @@ struct IDT_PTR {
|
||||
struct IDT_Entry IDT[IDT_SIZE];
|
||||
struct IDT_PTR idt_ptr;
|
||||
|
||||
void load_idt();
|
||||
void init_idt();
|
||||
void setup_idt_entry(u32 t_idx, u32 base, u16 sel, u8 type_attrs);
|
||||
//void interrupt_handler(struct cpu_reg_state, struct stack_state, u32);
|
||||
|
Loading…
Reference in New Issue
Block a user