master
E. Almqvist 3 years ago
parent 62ed275792
commit 41bfd1f899
  1. 4
      kernel/idt.c
  2. 2
      kernel/idt.h
  3. 2
      kernel/isr.asm
  4. 7
      kernel/kernel.c
  5. 5
      kernel/pic.c
  6. 1
      kernel/pic.h

@ -23,10 +23,10 @@ void exception_handler() {
char* buf;
print("[exc] ", INT_COLOR);
print("[exc] ", EXC_COLOR);
buf = itoa(debug, buf, 10);
println(buf, 0x0f);
println(buf, 0x0c);
__asm__ __volatile__("cli; hlt");
}

@ -1,7 +1,7 @@
#include "../lib/types.h"
#define IDT_MAX_DESCS 256
#define INT_COLOR 0x08
#define EXC_COLOR 0x08
__attribute__((noreturn))
void exception_handler();

@ -10,7 +10,7 @@ isr_stub_%+%1:
%macro isr_no_err_stub 1
isr_stub_%+%1:
mov [isr_debug_ptr], byte %1
;call exception_handler
call exception_handler
iret
%endmacro

@ -54,6 +54,7 @@ void print_kernel_stats() {
}
void kernel_init() {
pic_init(); // Init the PIC and remap it
idt_init(); // Enable interupts
vga_init(); // Initialize the screen
@ -61,11 +62,11 @@ void kernel_init() {
pm_malloc_range(VGA_ADDRESS, VGA_ADDRESS_MAX, true); // force alloc the VGA range
// ENABLE PAGING
// TODO: make this work
// enable_paging();
//enable_paging();
clear_screen();
print_kernel_motd();
print_kernel_stats();
//print_kernel_stats();
char* buf;
uint i = 0;
@ -77,4 +78,6 @@ void kernel_init() {
printalign(buf, 0x0f, MIDDLE);
++i;
}
while(true) { __asm__("hlt"); } // never escape this function
}

@ -38,6 +38,11 @@ void pic_disable() {
outb(PIC2_DATA, 0xff);
}
void pic_init() {
pic_remap(PIC1, PIC2);
}
// (un)set a specific irq
void irq(uint8 idx, bool t) {
uint16 port;

@ -37,6 +37,7 @@
void pic_send_eoi(uint8);
void pic_remap(uint, uint);
void pic_disable();
void pic_init();
// IRQs
void irq(uint8, bool);

Loading…
Cancel
Save