kernel: move irq setup later; put level control behind arg

This commit is contained in:
K. Lange 2018-12-06 17:19:09 +09:00
parent 90aa039ef8
commit 3d34370c80
2 changed files with 9 additions and 4 deletions

View File

@ -11,6 +11,7 @@
#include <kernel/logging.h> #include <kernel/logging.h>
#include <kernel/module.h> #include <kernel/module.h>
#include <kernel/printf.h> #include <kernel/printf.h>
#include <kernel/args.h>
/* Programmable interrupt controller */ /* Programmable interrupt controller */
#define PIC1 0x20 #define PIC1 0x20
@ -153,10 +154,13 @@ void irq_install(void) {
* they were set to level triggered in expectation * they were set to level triggered in expectation
* of an IO APIC taking over... * of an IO APIC taking over...
*/ */
if (!args_present("noelcr")) {
#if 0 #if 0
outportb(0x4D0, 0x00); outportb(0x4D0, 0x00);
#endif #endif
outportb(0x4D1, (1 << (10-8)) | (1 << (11-8))); uint8_t val = inportb(0x4D1);
outportb(0x4D1, val | (1 << (10-8)) | (1 << (11-8)));
}
} }
void irq_ack(size_t irq_no) { void irq_ack(size_t irq_no) {

View File

@ -94,8 +94,6 @@ int kmain(struct multiboot *mboot, uint32_t mboot_mag, uintptr_t esp) {
/* Initialize core modules */ /* Initialize core modules */
gdt_install(); /* Global descriptor table */ gdt_install(); /* Global descriptor table */
idt_install(); /* IDT */ idt_install(); /* IDT */
isrs_install(); /* Interrupt service requests */
irq_install(); /* Hardware interrupt requests */
uintptr_t last_mod = (uintptr_t)&end; uintptr_t last_mod = (uintptr_t)&end;
if (mboot_ptr->flags & MULTIBOOT_FLAG_MODS) { if (mboot_ptr->flags & MULTIBOOT_FLAG_MODS) {
@ -168,6 +166,9 @@ int kmain(struct multiboot *mboot, uint32_t mboot_mag, uintptr_t esp) {
args_parse(cmdline); args_parse(cmdline);
} }
isrs_install(); /* Interrupt service requests */
irq_install(); /* Hardware interrupt requests */
vfs_install(); vfs_install();
tasking_install(); /* Multi-tasking */ tasking_install(); /* Multi-tasking */
timer_install(); /* PIC driver */ timer_install(); /* PIC driver */