adding structures to be used later in construction idt

This commit is contained in:
shockrah 2019-10-14 03:09:57 -07:00
parent a97affbe72
commit 7385ba7d7f
2 changed files with 28 additions and 2 deletions

View File

@ -1,5 +1,10 @@
#include "interrupts.h"
#include "types.h"
void interrupt_handler(struct cpu_reg_state cpu, struct stack_state stack, u32 interrupt_code) {
void load_idt() {
asm("lidt [idt_ptr]");
return;
}
//void interrupt_handler(struct cpu_reg_state cpu, struct stack_state stack, u32 interrupt_code) {
//}

View File

@ -30,5 +30,26 @@ struct stack_state {
u32 eflags;
};
struct IDT_Entry {
u16 offset_low; // offset bits 0..15
u16 selector; // code segment in either gdt or ldt
u8 zero; // not used always 0
/* 7 0
* +---+---+---+---+---+---+---+---+
* | P | DPL | S | GateType |
* +---+---+---+---+---+---+---+---+
*/
u8 type_attrs; // format specified above
u16 offset_high;// offset bits 16..31
}__attribute__((packed));
void interrupt_handler(struct cpu_reg_state, struct stack_state, u32);
struct IDT_PTR {
u16 limit;
u32 address;
}__attribute__((packed));
struct IDT_Entry IDT[255];
struct IDT_PTR idt_ptr;
//void interrupt_handler(struct cpu_reg_state, struct stack_state, u32);
void load_idt();