* setting ID[i].zero to 0

* also adding louder prints to interrupt handler for now
This commit is contained in:
shockrahwow 2019-10-30 18:39:26 -07:00
parent 7eb8da29fc
commit e5c2553bf5

View File

@ -74,6 +74,7 @@ void setup_idt_entry(u32 t_idx, u32 base, u16 sel, u8 type_attrs) {
IDT[t_idx].offset_high = ((base >> 16) & 0xffff);
IDT[t_idx].type_attrs = type_attrs;
IDT[t_idx].zero = 0;
IDT[t_idx].selector = sel;
}
@ -90,12 +91,12 @@ void int_keyboard(struct cpu_reg_state* cpu) {
void interrupt_handler(struct cpu_reg_state cpu) {
// treating things on the stack like it were a cpu_reg_state
// NOTE: dummy stuff to stop gcc from complaining atm
printf("handled exception\n");
if(cpu.int_no < 32) {
printf("int response is:\n");
printf(err_msg[cpu.int_no]);
printf("handled exception\n");
}
else {
printf("Unhandled exception");
printf("Unimplemented exception");
}
return;
}
@ -103,9 +104,9 @@ void interrupt_handler(struct cpu_reg_state cpu) {
void init_idt() {
// setup special idt pointer
idt_ptr.address = (u32)(&IDT);
idt_ptr.limit = sizeof(struct IDT_Entry) * IDT_SIZE;
idt_ptr.limit = (sizeof(struct IDT_Entry) * IDT_SIZE) - 1;
// clear table
memset((u8*)IDT, 0x00, (sizeof(struct IDT_Entry) * IDT_SIZE) - 1);
memset((u8*)IDT, 0x00, (sizeof(struct IDT_Entry) * IDT_SIZE));
// add interrupt service routines here
setup_idt_entry(0,(u32)no_err_handler_1,0x08, 0x8e);
setup_idt_entry(1,(u32)no_err_handler_2,0x08, 0x8e);