diff options
author | aqua <aqua@iserlohn-fortress.net> | 2022-11-01 21:18:17 +0200 |
---|---|---|
committer | aqua <aqua@iserlohn-fortress.net> | 2022-11-01 21:35:57 +0200 |
commit | 2f82430b488878d321276e6efb10c61042ca2930 (patch) | |
tree | 34455e48a90eb61f1d814ff2c18cb962c02f89a6 /i686 | |
parent | Add uppercase scancodes (diff) | |
download | kernel-2f82430b488878d321276e6efb10c61042ca2930.tar.xz |
Enable interrupts after enabling the PIC
Diffstat (limited to 'i686')
-rw-r--r-- | i686/Makefile | 2 | ||||
-rw-r--r-- | i686/init.s | 2 | ||||
-rw-r--r-- | i686/isr.c | 4 | ||||
-rw-r--r-- | i686/lidt.c | 7 | ||||
-rw-r--r-- | i686/sys/control.h | 12 |
5 files changed, 17 insertions, 10 deletions
diff --git a/i686/Makefile b/i686/Makefile index 431db77..a04e5d3 100644 --- a/i686/Makefile +++ b/i686/Makefile @@ -1,6 +1,6 @@ include ../Makefile.config -CCFLAGS += -I../grub/include -I../lib +CCFLAGS += -I../grub/include -I../lib -mgeneral-regs-only arch,SRCS = boot.S init.s \ gdt.c lgdt.c \ diff --git a/i686/init.s b/i686/init.s index d16de51..ad329bb 100644 --- a/i686/init.s +++ b/i686/init.s @@ -15,7 +15,6 @@ k_ptable0x300: .skip 1024 * 4 .section .text .global k_init .extern kmain -.extern pic_init .extern gdt_install .extern idt_install k_init: @@ -39,7 +38,6 @@ k_init: # hardware init call gdt_install # Global Descriptor Table call idt_install # Interrupt Descriptor Table - call pic_init # Programmable Interrupt Controller # jump into kernel call kmain @@ -23,12 +23,11 @@ syscall_handler(struct interrupt_frame *) abort(); } -extern void pic_clear(unsigned char irq); +void pic_clear(unsigned char irq); __attribute__((interrupt)) void irq0x00(struct interrupt_frame *) { - // printf("irq0x00\n"); pic_clear(0x00); } @@ -36,7 +35,6 @@ extern void ps2_keyboard_irq_handler(); __attribute__((interrupt)) void irq0x01(struct interrupt_frame *) { - // printf("irq0x01\n"); ps2_keyboard_irq_handler(); pic_clear(0x00); } diff --git a/i686/lidt.c b/i686/lidt.c index aa6185b..5cb66b6 100644 --- a/i686/lidt.c +++ b/i686/lidt.c @@ -39,16 +39,15 @@ idt_install() { // exceptions 0x00~0x13 for (int i = 0; i <= 0x13; ++i) Gate(&interrupt_table[i], &abort_handler, 0x10); + // irq 0x20~0x2f - // for (int i = 0; i < 16; ++i) irq_table[i] = NULL; - for (int i = 0x20; i <= 0x2f; ++i) Gate(&interrupt_table[i], &abort_handler, 0x10); Gate(&interrupt_table[0x20], &irq0x00, 0x10); Gate(&interrupt_table[0x21], &irq0x01, 0x10); + for (int i = 0x22; i <= 0x2f; ++i) Gate(&interrupt_table[i], &abort_handler, 0x10); + // syscall 0x80 Gate(&interrupt_table[0x80], &abort_handler, 0x10); const struct Pointer ptr = {.limit = sizeof(interrupt_table) - 1, .base = (unsigned)&interrupt_table}; asm volatile("lidt (%0)" : : "a"(&ptr)); - - asm volatile("sti"); } diff --git a/i686/sys/control.h b/i686/sys/control.h index a40a67f..0231236 100644 --- a/i686/sys/control.h +++ b/i686/sys/control.h @@ -7,3 +7,15 @@ abort() h: hlt jmp h)"); } + +static void +enable_interrupts() +{ + asm volatile("sti"); +} + +static void +disable_interrupts() +{ + asm volatile("cli"); +} |