Fixed Interrupts bug:
It was a problem about ports(cpu/ports.asm) functions.
This commit is contained in:
@@ -10,7 +10,7 @@ global outb ; Output from port
|
||||
global inb ; Input to port
|
||||
|
||||
outb:
|
||||
mov al, [esp + 3]
|
||||
mov al, [esp + 8]
|
||||
mov dx, [esp + 4]
|
||||
out dx, al
|
||||
ret
|
||||
|
||||
@@ -97,7 +97,7 @@ static void init_idt() {
|
||||
__asm__ __volatile__ ("sti");
|
||||
}
|
||||
|
||||
// Taken here: http://wiki.osdev.org/8259_PIC
|
||||
// Taken from: http://wiki.osdev.org/8259_PIC
|
||||
static void pic_remap(uint8_t offset1, uint8_t offset2) {
|
||||
uint8_t a1, a2;
|
||||
|
||||
|
||||
@@ -56,7 +56,8 @@ void isr_handler(registers_t regs) {
|
||||
isr_t handler = interrupt_handler[regs.int_num];
|
||||
handler(regs);
|
||||
} else {
|
||||
kprint_c((uint8_t*)"Received interrupt: ", 20, LIGHT_BROWN, BLACK);
|
||||
uint8_t *buf = (uint8_t*)"\nReceived interrupt: ";
|
||||
kprint_c((uint8_t*)buf,strlen(buf), LIGHT_BROWN, BLACK);
|
||||
kprint_c(interrupts_messages[(uint8_t)regs.int_num],
|
||||
strlen(interrupts_messages[(uint8_t)regs.int_num]),
|
||||
WHITE,
|
||||
|
||||
@@ -4,10 +4,17 @@
|
||||
#include "libc/stdio.h"
|
||||
|
||||
void kernel_main() {
|
||||
clear_prompt();
|
||||
init_prompt(); // Initialize frame buffer
|
||||
gdt_setup(); // Setup Global Descriptor Table
|
||||
idt_setup(); // Setup Interrupt Descriptor Table
|
||||
|
||||
clear_prompt();
|
||||
init_prompt(); // Initialize frame buffer
|
||||
puts("Hello World!");
|
||||
|
||||
/*
|
||||
// Testing some interrupts
|
||||
asm("int $0"); // Division by zero
|
||||
asm("int $4"); // Stack overflow
|
||||
asm("int $1"); // Page fault
|
||||
*/
|
||||
}
|
||||
Reference in New Issue
Block a user