Move GDT init into amd64/gdt.c
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m34s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m34s
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
#include <amd64/apic.h>
|
||||
#include <amd64/debug.h>
|
||||
#include <amd64/gdt.h>
|
||||
#include <amd64/hpet.h>
|
||||
#include <amd64/init.h>
|
||||
#include <amd64/intr.h>
|
||||
#include <amd64/intr_defs.h>
|
||||
#include <amd64/msr-index.h>
|
||||
#include <amd64/msr.h>
|
||||
@@ -39,7 +40,8 @@ void bootmain (void) {
|
||||
|
||||
struct cpu* bsp_cpu = cpu_make (mp->bsp_lapic_id, 0);
|
||||
|
||||
init_gdt_idt (bsp_cpu, false);
|
||||
gdt_init (bsp_cpu);
|
||||
intr_init ();
|
||||
syscall_init ();
|
||||
debug_init ();
|
||||
pmm_init ();
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
#include <amd64/gdt.h>
|
||||
#include <amd64/init.h>
|
||||
#include <amd64/intr.h>
|
||||
#include <amd64/smp.h>
|
||||
#include <aux/compiler.h>
|
||||
#include <libk/std.h>
|
||||
@@ -21,7 +19,7 @@ static void gdt_set (volatile struct gdt_entry* ent, uint32_t base, uint32_t lim
|
||||
}
|
||||
|
||||
/* Initialize GDT and TSS structures for a given CPU */
|
||||
static void gdt_init (struct cpu* cpu) {
|
||||
void gdt_init (struct cpu* cpu) {
|
||||
volatile struct tss* tss = &cpu->tss;
|
||||
volatile struct gdt_extended* gdt = &cpu->gdt;
|
||||
|
||||
@@ -73,17 +71,3 @@ static void gdt_init (struct cpu* cpu) {
|
||||
|
||||
__asm__ volatile ("ltr %0" ::"r"((uint16_t)GDT_TSS));
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize essentials (GDT, TSS, IDT) for a given CPU
|
||||
*
|
||||
* load_idt - Tell whether the IDT needs to be loaded. It only has to be loaded once on
|
||||
* the BSP
|
||||
*/
|
||||
void init_gdt_idt (struct cpu* cpu, bool load_idt) {
|
||||
gdt_init (cpu);
|
||||
if (load_idt)
|
||||
idt_load ();
|
||||
else
|
||||
intr_init ();
|
||||
}
|
||||
@@ -42,4 +42,6 @@ struct gdt_extended {
|
||||
struct gdt_entry tsshigh;
|
||||
} PACKED;
|
||||
|
||||
void gdt_init (struct cpu* cpu);
|
||||
|
||||
#endif // _KERNEL_AMD64_GDT_H
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
#ifndef _KERNEL_AMD64_INIT_H
|
||||
#define _KERNEL_AMD64_INIT_H
|
||||
|
||||
#include <amd64/smp.h>
|
||||
|
||||
void init_gdt_idt (struct cpu* cpu, bool load_idt);
|
||||
|
||||
#endif // _KERNEL_AMD64_INIT_H
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <amd64/apic.h>
|
||||
#include <amd64/init.h>
|
||||
#include <amd64/gdt.h>
|
||||
#include <amd64/intr.h>
|
||||
#include <amd64/intr_defs.h>
|
||||
#include <amd64/mm.h>
|
||||
#include <amd64/msr-index.h>
|
||||
@@ -79,7 +80,8 @@ static void smp_bootstrap (struct limine_mp_info* mp_info) {
|
||||
|
||||
struct cpu* cpu = cpu_make (mp_info->lapic_id, mp_info->processor_id);
|
||||
|
||||
init_gdt_idt (cpu, true); /* gdt + idt */
|
||||
gdt_init (cpu);
|
||||
idt_load ();
|
||||
syscall_init ();
|
||||
|
||||
lapic_init (1000);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
c += amd64/bootmain.c \
|
||||
amd64/init.c \
|
||||
amd64/io.c \
|
||||
amd64/debug.c \
|
||||
amd64/spin_lock.c \
|
||||
@@ -12,7 +11,8 @@ c += amd64/bootmain.c \
|
||||
amd64/smp.c \
|
||||
amd64/sched1.c \
|
||||
amd64/proc.c \
|
||||
amd64/syscall.c
|
||||
amd64/syscall.c \
|
||||
amd64/gdt.c
|
||||
|
||||
S += amd64/intr_stub.S \
|
||||
amd64/spin.S \
|
||||
@@ -20,7 +20,6 @@ S += amd64/intr_stub.S \
|
||||
amd64/syscallentry.S
|
||||
|
||||
o += amd64/bootmain.o \
|
||||
amd64/init.o \
|
||||
amd64/io.o \
|
||||
amd64/debug.o \
|
||||
amd64/spin_lock.o \
|
||||
@@ -37,4 +36,5 @@ o += amd64/bootmain.o \
|
||||
amd64/sched1.o \
|
||||
amd64/proc.o \
|
||||
amd64/syscall.o \
|
||||
amd64/syscallentry.o
|
||||
amd64/syscallentry.o \
|
||||
amd64/gdt.o
|
||||
|
||||
Reference in New Issue
Block a user