feat: introduced tasking, added paging (no vm), moved malloc, added
syscalls, other stuff
This commit is contained in:
@@ -5,9 +5,11 @@
|
||||
#include "isr.h"
|
||||
|
||||
#include <cpu/idt.h>
|
||||
#include <cpu/syscall_handler.h>
|
||||
#include <libc/libc.h>
|
||||
#include <drivers/ports.h>
|
||||
#include <libc/kprintf.h>
|
||||
#include <libk.h>
|
||||
|
||||
#define PIC_END_OF_INTERRUPT 0x20
|
||||
|
||||
@@ -48,6 +50,7 @@ void isr_install() {
|
||||
set_idt_gate(31, (uint32_t) isr31);
|
||||
|
||||
// Remap the PIC
|
||||
// todo make readable
|
||||
port_byte_out(0x20, 0x11);
|
||||
port_byte_out(0xA0, 0x11);
|
||||
port_byte_out(0x21, 0x20);
|
||||
@@ -77,6 +80,8 @@ void isr_install() {
|
||||
set_idt_gate(46, (uint32_t) irq14);
|
||||
set_idt_gate(47, (uint32_t) irq15);
|
||||
|
||||
set_idt_gate(128, (uint32_t) isr128);
|
||||
|
||||
set_idt(); // Load with ASM
|
||||
}
|
||||
|
||||
@@ -118,15 +123,20 @@ char *exception_messages[] = {
|
||||
"Reserved"
|
||||
};
|
||||
|
||||
void isr_handler(registers_t r) {
|
||||
void isr_handler(isr_registers_t r) {
|
||||
if (r.int_no == 128) {
|
||||
syscall_handle(&r);
|
||||
return;
|
||||
}
|
||||
printf("Received interrupt: %d - %s\n", r.int_no, exception_messages[r.int_no]);
|
||||
k_panic();
|
||||
}
|
||||
|
||||
void register_interrupt_handler(uint8_t n, isr_t handler) {
|
||||
interrupt_handlers[n] = handler;
|
||||
}
|
||||
|
||||
void irq_handler(registers_t r) {
|
||||
void irq_handler(isr_registers_t r) {
|
||||
/* After every interrupt we need to send an EOI to the PICs
|
||||
* or they will not send another interrupt again */
|
||||
if (r.int_no >= 40) port_byte_out(PORT_PIC_SLAVE_COMMAND, PIC_END_OF_INTERRUPT); /* slave */
|
||||
@@ -135,6 +145,6 @@ void irq_handler(registers_t r) {
|
||||
/* Handle the interrupt in a more modular way */
|
||||
if (interrupt_handlers[r.int_no] != NULL) {
|
||||
isr_t handler = interrupt_handlers[r.int_no];
|
||||
handler(r);
|
||||
handler(&r);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user