24cab443f2
Still no IRQ handler called
52 lines
1.2 KiB
C
52 lines
1.2 KiB
C
#include "exception.h"
|
|
#include "gdt.h"
|
|
#include "idt.h"
|
|
#include "interrupt.h"
|
|
#include "io.h"
|
|
#include "irq.h"
|
|
#include "pit.h"
|
|
#include "types.h"
|
|
#include "vga.h"
|
|
|
|
char getScancode()
|
|
{
|
|
char c = 0;
|
|
do {
|
|
if (inb(0x60) != c) {
|
|
c = inb(0x60);
|
|
if (c > 0)
|
|
return c;
|
|
}
|
|
} while (1);
|
|
}
|
|
|
|
void cpuid(int code, uint32_t *a, uint32_t *d)
|
|
{
|
|
asm volatile("cpuid" : "=a"(*a), "=d"(*d) : "0"(code) : "ebx", "ecx");
|
|
}
|
|
|
|
void kmain()
|
|
{
|
|
const short color = GREEN;
|
|
clearScreen(BLACK);
|
|
printString("Setting up IDT", color, BLACK, 0, 0);
|
|
gdtSetup();
|
|
idtSetup();
|
|
printString("Setting up IRQ", color, BLACK, 0, 1);
|
|
irqSetup();
|
|
initPit(100);
|
|
|
|
printString("Setting up IRQ handlers", color, BLACK, 0, 1);
|
|
irqSetRoutine(IRQ_KEYBOARD, keyboard_handler);
|
|
irqSetRoutine(IRQ_TIMER, timer_handler);
|
|
printString("Enabling HW interrupts", color, BLACK, 0, 2);
|
|
exceptionSetRoutine(EXCEPTION_DOUBLE_FAULT, print_handler);
|
|
// Enabling the HW interrupts
|
|
asm volatile("sti\n");
|
|
int count = 0;
|
|
while (1) {
|
|
printInt(count++, color, BLACK, 0, 6);
|
|
}
|
|
printString("exiting", color, BLACK, 0, 4);
|
|
}
|