feat: added basic ACPI support using LAI

This commit is contained in:
2021-08-30 19:56:36 +02:00
parent 462dd90890
commit e37222c346
17 changed files with 729 additions and 44 deletions

View File

@@ -9,12 +9,9 @@
#include <myke/cpu/idt.h>
#include <myke/cpu/pic.h>
#include <myke/cpu/syscall_handler.h>
#include <myke/drivers/ports.h>
#include <myke/libk/libk.h>
#include <myke/tasks/task.h>
#define PIC_END_OF_INTERRUPT 0x20
isr_t interrupt_handlers[256];
void isr_install() {
@@ -52,8 +49,7 @@ void isr_install() {
set_idt_gate(31, (uint32_t) isr31);
// Remap the PIC
// todo make readable
pic_init();
pic_init(IRQ0);
// Install the IRQs
set_idt_gate(32, (uint32_t) irq0); // 0x20
@@ -73,6 +69,7 @@ void isr_install() {
set_idt_gate(46, (uint32_t) irq14);
set_idt_gate(47, (uint32_t) irq15);
// 0x80 SYSCALL
set_idt_gate(128, (uint32_t) isr128);
set_idt(); // Load with ASM
@@ -116,7 +113,7 @@ char *exception_messages[] = {
"Reserved"
};
void isr_handler(isr_registers_t r) {
void att_used isr_handler(isr_registers_t r) {
char msg[256];
if (r.int_no == 128) {
syscall_handle(&r);
@@ -131,11 +128,10 @@ void register_interrupt_handler(uint8_t n, isr_t handler) {
interrupt_handlers[n] = handler;
}
void irq_handler(isr_registers_t r) {
void att_used 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 */
port_byte_out(PORT_PIC_MASTER_COMMAND, PIC_END_OF_INTERRUPT); /* master */
pic_eoi(r.int_no >= IRQ8);
if (r.int_no >= IRQ0 && r.int_no < IRQ15) {
task_notify_irq(r.int_no - IRQ0);