Merge branch 'master' of gitlab.com:shockrah/jankos
This commit is contained in:
commit
847a4090b8
@ -59,6 +59,7 @@ common_int_handler:
|
||||
call eax ; preserve the eip register past this call
|
||||
|
||||
; segments
|
||||
pop eax
|
||||
pop gs
|
||||
pop fs
|
||||
pop es
|
||||
|
18
interrupts.c
18
interrupts.c
@ -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;
|
||||
}
|
||||
|
||||
@ -83,29 +84,26 @@ void int_keyboard(struct cpu_reg_state* cpu) {
|
||||
if((u8)code < 0x80 || (u8)code > 0x1f) {
|
||||
putch(code);
|
||||
}
|
||||
serial_pic_ack(cpu->int_no);
|
||||
}
|
||||
|
||||
// Generic interrupt handler to be used later on
|
||||
void interrupt_handler(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
|
||||
if(cpu.int_no < 32) {
|
||||
printf("int response is:\n");
|
||||
printf(err_msg[cpu.int_no]);
|
||||
}
|
||||
else {
|
||||
printf("Unhandled exception");
|
||||
printf("handled exception\n");
|
||||
if(cpu->int_no < 32) {
|
||||
printf(err_msg[cpu->int_no]);
|
||||
}
|
||||
serial_pic_ack(cpu->int_no);
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
|
@ -44,4 +44,4 @@ struct IDT_PTR idt_ptr;
|
||||
void init_idt();
|
||||
void setup_idt_entry(u32 t_idx, u32 base, u16 sel, u8 type_attrs);
|
||||
void int_keyboard(struct cpu_reg_state*);
|
||||
void interrupt_handler(struct cpu_reg_state);
|
||||
void interrupt_handler(struct cpu_reg_state*);
|
||||
|
2
kernel.c
2
kernel.c
@ -6,9 +6,7 @@
|
||||
#include "gdt.h"
|
||||
|
||||
void kinit() {
|
||||
printf("setting up gdt\n");
|
||||
gdt_configure();
|
||||
printf("setting idt\n");
|
||||
init_idt();
|
||||
test_dispatcher();
|
||||
}
|
||||
|
2
makefile
2
makefile
@ -7,7 +7,7 @@ OBJECTS=mem.o kernel.o gdt_seg.o gdt.o interrupts.o loader.o serial.o \
|
||||
framebuffer.o ports.o stlio.o tests.o interrupt_entry.o
|
||||
AFLAGS=-f elf32
|
||||
CFLAGS=-masm=intel -O2 -m32 -nostdlib -nostdinc -fno-builtin -fno-stack-protector -nostartfiles \
|
||||
-nodefaultlibs -Wall -Wextra -Werror -c
|
||||
-nodefaultlibs -Wall -Wextra -c #-Werror -c
|
||||
|
||||
all: kernel.elf
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user