From 27ef31a4b015e2b965a9ac7f0ea3e917d7ec0419 Mon Sep 17 00:00:00 2001 From: Braiden Vasco Date: Thu, 2 Nov 2017 16:36:28 +0000 Subject: [PATCH] Add function "protected_initialize" --- arch/main.c | 3 +-- arch/protected.c | 9 +++++++++ arch/protected.h | 3 +-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/arch/main.c b/arch/main.c index 5237ef9..9a72b9f 100644 --- a/arch/main.c +++ b/arch/main.c @@ -11,8 +11,7 @@ void main(struct KernelMQ_Multiboot_Info multiboot_info) logger_info("Kernel initialization started."); - gdt_initialize(); - idt_initialize(); + protected_initialize(); asm volatile ("int $0x3"); asm volatile ("int $0x4"); diff --git a/arch/protected.c b/arch/protected.c index 41fba9b..48cd007 100644 --- a/arch/protected.c +++ b/arch/protected.c @@ -40,6 +40,9 @@ static struct IdtPointer idt_pointer; static struct GdtEntry gdt_entries[GDT_SIZE]; static struct IdtEntry idt_entries[IDT_SIZE]; +static void gdt_initialize(); +static void idt_initialize(); + static void gdt_set_gate(int num, unsigned int base, unsigned int limit, unsigned char access, unsigned char gran); static void idt_set_gate(unsigned char num, unsigned int base, unsigned short sel, unsigned char flags); @@ -80,6 +83,12 @@ void isr29(); void isr30(); void isr31(); +void protected_initialize() +{ + gdt_initialize(); + idt_initialize(); +} + void gdt_initialize() { logger_info("Setup GDT."); diff --git a/arch/protected.h b/arch/protected.h index 3fe2ce9..e4d395f 100644 --- a/arch/protected.h +++ b/arch/protected.h @@ -1,7 +1,6 @@ #ifndef KERNELMQ_INCLUDED_PROTECTED #define KERNELMQ_INCLUDED_PROTECTED 1 -void gdt_initialize(); -void idt_initialize(); +void protected_initialize(); #endif