]> git.dujemihanovic.xyz Git - nameless-os.git/blobdiff - kernel/arch/x86/irq/sample_handler.c
Add Intel 8254 driver and print elapsed seconds
[nameless-os.git] / kernel / arch / x86 / irq / sample_handler.c
index c8bddfec63bf61b22ef239727e0d075accea5744..be6829871d68c1b0845f2832962302c4f637f259 100644 (file)
@@ -1,6 +1,10 @@
 #include <tty.h>
 #include <irq/i8259a.h>
+#include <io.h>
 #include <stdint.h>
+#include <time/i8254.h>
+
+unsigned int ticks = 0;
 
 typedef uint32_t uword_t;
 
@@ -17,14 +21,23 @@ void keyb_handler(struct interrupt_frame *frame)
 {
        pic_send_eoi(1);
        kprint("Got a keyboard interrupt!\n", 0);
+       inb(0x60);
 }
 
 
 __attribute__((interrupt))
 void double_fault(struct abort_frame *frame)
 {
-       *(volatile char *) (0xb8000) = ":";
-       *(volatile char *) (0xb8002) = "(";
+       *(volatile uint32_t *) (0xb8000) = 0xcf28cf3a;
+halt:
        asm volatile ("cli; hlt");
+       goto halt;
 }
 
+
+__attribute__((interrupt))
+void timer_tick(struct interrupt_frame *frame)
+{
+       pic_send_eoi(0);
+       ticks++;
+}