From b1cf9e5dfbc8967bd7cb2a22ec1e5e521f4e0e6e Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Wed, 31 Jul 2024 13:36:53 -0400 Subject: add clock --- kernel/source/interrupts.asm | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'kernel/source/interrupts.asm') diff --git a/kernel/source/interrupts.asm b/kernel/source/interrupts.asm index e4912ee..df8e7ce 100644 --- a/kernel/source/interrupts.asm +++ b/kernel/source/interrupts.asm @@ -267,6 +267,22 @@ isr_end: ret +extern on_rtc_interrupt + +rtc_isr: + + call isr_start + + call on_rtc_interrupt + + mov al, 0x20 + out 0x20, al + out 0xa0, al + + call isr_end + + iretq + extern on_keyboard_interrupt keyboard_isr: @@ -343,7 +359,7 @@ load_gdt_and_idt: out 0x21, al mov al, 0x01 out 0x21, al - mov al, 0xf9 ;mask all but irq 1 and 2 + mov al, 0xf9 ;mask all but irqs 1 and 2 out 0x21, al mov al, 0x11 @@ -354,9 +370,15 @@ load_gdt_and_idt: out 0xa1, al mov al, 0x01 out 0xa1, al - mov al, 0xef ;mask all but irq 12 + mov al, 0xee ;mask all but irqs 8 and 12 out 0xa1, al + ;register rtc interrupt + + mov rdi, 0x28 + mov rsi, rtc_isr + call set_isr + ;register keyboard and mouse interrupts mov rdi, 0x21 -- cgit v1.2.3