Minor refactor

master
E. Almqvist 3 years ago
parent 5c88ed65a2
commit 30d39222f3
  1. 7
      kernel/idt.c
  2. 4
      kernel/idt.h

@ -1,4 +1,7 @@
#include "idt.h" #include "idt.h"
// VGA stuff
extern void set_cursor_pos(uint, uint);
extern void print(char*, int);
typedef struct { typedef struct {
uint16 offset_1; // offset 0 to 15 bits uint16 offset_1; // offset 0 to 15 bits
@ -18,7 +21,7 @@ static idt_entry IDT[IDT_MAX_DESCS];
static idtr IDTR; static idtr IDTR;
void interupt_handler(uint interupt) { void interupt_handler(uint interupt) {
pic_send_eoi(interupt); pic_send_eoi(interupt); // ack int
char* buf; char* buf;
set_cursor_pos(0, 0); set_cursor_pos(0, 0);
@ -30,7 +33,7 @@ void interupt_handler(uint interupt) {
void idt_set_desc(uint8 idx, void* isr, uint8 flags) { void idt_set_desc(uint8 idx, void* isr, uint8 flags) {
idt_entry* desc = &IDT[idx]; // get descriptor idt_entry* desc = &IDT[idx]; // get descriptor
uint* gdt_code_ptr = 0xee88; uint* gdt_code_ptr = (uint*)0xee88;
uint8 gdt_code = *gdt_code_ptr; uint8 gdt_code = *gdt_code_ptr;
desc->offset_1 = (uint) isr & 0xffff; desc->offset_1 = (uint) isr & 0xffff;

@ -1,12 +1,12 @@
#include "../lib/types.h" #include "../lib/types.h"
#include "pic.h" #include "pic.h"
#include "../drivers/vga.h" //#include "../drivers/vga.h"
#include "../lib/conv.h" #include "../lib/conv.h"
#define IDT_MAX_DESCS 256 #define IDT_MAX_DESCS 256
#define EXC_COLOR 0x08 #define EXC_COLOR 0x08
__attribute__((noreturn)) //__attribute__((noreturn))
void interupt_handler(uint); void interupt_handler(uint);
void idt_set_desc(uint8, void*, uint8); void idt_set_desc(uint8, void*, uint8);

Loading…
Cancel
Save