diff options
author | Raghuram Subramani <raghus2247@gmail.com> | 2025-05-25 18:08:43 +0530 |
---|---|---|
committer | Raghuram Subramani <raghus2247@gmail.com> | 2025-05-25 18:10:57 +0530 |
commit | 0276800c3fc3ec4b73f5b75a2dd075c8d731d070 (patch) | |
tree | 37264f36a32c1e8d721d65b103315cf359ddb7ad | |
parent | d19e377907ed6845b17abbaaa663a42bcaf46032 (diff) |
interrupts: rename idt namespace to interrupts
-rw-r--r-- | kernel/CMakeLists.txt | 6 | ||||
-rw-r--r-- | kernel/boot/interrupts/exceptions.cc (renamed from kernel/boot/idt/exceptions.cc) | 4 | ||||
-rw-r--r-- | kernel/boot/interrupts/idt.cc (renamed from kernel/boot/idt/idt.cc) | 6 | ||||
-rw-r--r-- | kernel/boot/interrupts/isr.s (renamed from kernel/boot/idt/isr.s) | 0 | ||||
-rw-r--r-- | kernel/include/boot/gdt.h | 3 | ||||
-rw-r--r-- | kernel/include/boot/interrupts.h (renamed from kernel/include/boot/idt.h) | 19 | ||||
-rw-r--r-- | kernel/kernel/kernel.cc | 4 |
7 files changed, 23 insertions, 19 deletions
diff --git a/kernel/CMakeLists.txt b/kernel/CMakeLists.txt index 998a2a8..196f0b9 100644 --- a/kernel/CMakeLists.txt +++ b/kernel/CMakeLists.txt @@ -6,9 +6,9 @@ set(SRC boot/gdt/gdt.cc boot/gdt/gdt.s - boot/idt/exceptions.cc - boot/idt/idt.cc - boot/idt/isr.s + boot/interrupts/exceptions.cc + boot/interrupts/idt.cc + boot/interrupts/isr.s boot/init/boot.s drivers/serial.cc diff --git a/kernel/boot/idt/exceptions.cc b/kernel/boot/interrupts/exceptions.cc index 79ffd68..d05bd77 100644 --- a/kernel/boot/idt/exceptions.cc +++ b/kernel/boot/interrupts/exceptions.cc @@ -16,13 +16,13 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <boot/idt.h> +#include <boot/interrupts.h> #include <common.h> #include <kernel/halt.h> #include <libk/stdio.h> #include <stdbool.h> -namespace IDT +namespace Interrupts { void diff --git a/kernel/boot/idt/idt.cc b/kernel/boot/interrupts/idt.cc index abce0d8..b6a6e07 100644 --- a/kernel/boot/idt/idt.cc +++ b/kernel/boot/interrupts/idt.cc @@ -16,11 +16,11 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <boot/idt.h> +#include <boot/interrupts.h> #include <kernel/io.h> #include <libk/stdio.h> -namespace IDT +namespace Interrupts { extern "C" void *isr_stub_table[]; @@ -29,7 +29,7 @@ entry_t l_entries[256]; descriptor_t descriptor = { sizeof(l_entries) - 1, l_entries }; void -load(void) +load_idt(void) { for (uint16_t i = 0; i < 256; i++) l_entries[i] = (entry_t) { 0 }; diff --git a/kernel/boot/idt/isr.s b/kernel/boot/interrupts/isr.s index 925bb27..925bb27 100644 --- a/kernel/boot/idt/isr.s +++ b/kernel/boot/interrupts/isr.s diff --git a/kernel/include/boot/gdt.h b/kernel/include/boot/gdt.h index 237628c..60baab8 100644 --- a/kernel/include/boot/gdt.h +++ b/kernel/include/boot/gdt.h @@ -86,6 +86,9 @@ ((base >> 24) & 0xff) /* base_high */ \ } +#define GDT_KERNEL_CODE_OFFSET 0x8 +#define GDT_KERNEL_DATA_OFFSET 0x10 + namespace GDT { diff --git a/kernel/include/boot/idt.h b/kernel/include/boot/interrupts.h index bb424e9..42a0ba9 100644 --- a/kernel/include/boot/idt.h +++ b/kernel/include/boot/interrupts.h @@ -16,22 +16,23 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef __boot_idt_h -#define __boot_idt_h +#ifndef __boot_interrupts_h +#define __boot_interrupts_h +#include <boot/gdt.h> #include <common.h> #include <stdint.h> #define IDT_ENTRY(isr, attributes) \ { \ - (isr & 0xffff), /* isr_low */ \ - 0x08, /* segment_selector */ \ - 0, /* reserved */ \ - attributes, /* attributes */ \ - (isr >> 16) /* isr_high */ \ + (isr & 0xffff), /* isr_low */ \ + GDT_KERNEL_CODE_OFFSET, /* segment_selector */ \ + 0, /* reserved */ \ + attributes, /* attributes */ \ + (isr >> 16) /* isr_high */ \ } -namespace IDT +namespace Interrupts { typedef struct { @@ -47,7 +48,7 @@ typedef struct { entry_t *ptr; /* Address of IDT */ } PACKED descriptor_t; -void load(void); +void load_idt(void); extern "C" NORETURN void exception_handler(void); } diff --git a/kernel/kernel/kernel.cc b/kernel/kernel/kernel.cc index 34a693b..14c59a5 100644 --- a/kernel/kernel/kernel.cc +++ b/kernel/kernel/kernel.cc @@ -17,7 +17,7 @@ */ #include <boot/gdt.h> -#include <boot/idt.h> +#include <boot/interrupts.h> #include <drivers/serial.h> #include <drivers/vga_text_buffer.h> #include <kernel/halt.h> @@ -45,7 +45,7 @@ kernel_main(uint32_t magic, multiboot_info_t *multiboot_info) MemoryMap::load(multiboot_info); PhysicalMM::initialize(); VirtualMM::initialize(); - IDT::load(); + Interrupts::load_idt(); printk("\nKernel", "Started."); |