From 05b9ca73793047e795e46a2ae13db02c34b8a7c3 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Mon, 6 Mar 2017 02:52:05 +0100 Subject: idt: add interruption handling The Interruption Descriptor Table (IDT) is implemented in idt.{c,h} as part of the core, but the setup and activation of the IDT and the registration of specific interruption request handlers is part of arch.{c,h}. The request handlers are implemented in idt.s and delegate to kernel_handle_interrupt. --- arch/x86_64/arch.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'arch/x86_64/arch.c') diff --git a/arch/x86_64/arch.c b/arch/x86_64/arch.c index d7762c2..a8c1417 100644 --- a/arch/x86_64/arch.c +++ b/arch/x86_64/arch.c @@ -15,6 +15,16 @@ #include #include +void irqhdl0x00(void); +void irqhdl0x01(void); + +uint8_t irqnos[3] = { 0x20, 0x21, 0 }; +uint32_t irqhdls[3] = { + (uint32_t) &irqhdl0x00, + (uint32_t) &irqhdl0x01, + 0 +}; + void prtset8(const uint16_t port, const uint8_t val) { asm volatile("outb %0, %1" : : "a" (val), "Nd" (port)); @@ -79,3 +89,13 @@ void gdtset(struct gdtp gdtp) { asm volatile("lgdt %0" : : "m" (gdtp)); } + +void idtset(struct idtp idtp) +{ + asm volatile("lidt %0" : : "m" (idtp)); +} + +void idtact(void) +{ + asm("sti"); +} -- cgit v1.2.1