From ebc05296af4535862f6eb3fb7cdb7da4c2a3ff90 Mon Sep 17 00:00:00 2001 From: Braiden Vasco Date: Mon, 6 Nov 2017 11:09:52 +0000 Subject: [PATCH] Add functions "pic_enable_all" and "pic_disable_all" --- arch/pic.c | 16 ++++++++++++++++ arch/pic.h | 3 +++ arch/protected.c | 1 + 3 files changed, 20 insertions(+) diff --git a/arch/pic.c b/arch/pic.c index 99c16ee..5056f23 100644 --- a/arch/pic.c +++ b/arch/pic.c @@ -14,6 +14,22 @@ static unsigned char master_irq_start = 0; static unsigned char slave_irq_start = 8; +void pic_enable_all() +{ + logger_info_from("pic", "Enable all IRQs."); + + outportb(MASTER_DATA, 0); + outportb(SLAVE_DATA, 0); +} + +void pic_disable_all() +{ + logger_info_from("pic", "Disable all IRQs."); + + outportb(MASTER_DATA, 0xFF); + outportb(SLAVE_DATA, 0xFF); +} + void pic_remap(const unsigned char new_master_irq_start, const unsigned char new_slave_irq_start) { logger_info_from("pic", "Remap the IRQ table."); diff --git a/arch/pic.h b/arch/pic.h index 7560277..a2fdcb7 100644 --- a/arch/pic.h +++ b/arch/pic.h @@ -3,6 +3,9 @@ void pic_remap(unsigned char master_irq_start, unsigned char slave_irq_start); +void pic_enable_all(); +void pic_disable_all(); + unsigned char pic_end_of_interrupt(unsigned char irq); #endif diff --git a/arch/protected.c b/arch/protected.c index 33ae965..f0bb717 100644 --- a/arch/protected.c +++ b/arch/protected.c @@ -54,6 +54,7 @@ void idt_flush(const struct IdtPointer *pointer); void protected_initialize(const struct KernelMQ_Info *const kinfo) { pic_remap(32, 40); + pic_enable_all(); logger_info_from("protected", "Setup GDT.");