diff options
author | Ian Moffett <ian@osmora.org> | 2025-09-15 13:01:37 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-09-15 13:02:17 -0400 |
commit | 76b4d4408ec450d8f8a3aee7223b67da1ce0e2cb (patch) | |
tree | 11217d920d871127d21ec50ae9b64c976264d3b4 /src/sys/arch/amd64/boot | |
parent | 6bd92c969a6f4aefee258adc79a3ab0bde9443b2 (diff) |
kernel/amd64: Add task state segment logic
This commit implements the task state segment and splits up processor
initialization into two seperate stages. The cpu_conf() function is
apart of the first stage and sets up things that should be going by the
time the kernel is started / early init. The cpu_init() function runs
later functions that initialize further platform specific subsystems.
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src/sys/arch/amd64/boot')
-rw-r--r-- | src/sys/arch/amd64/boot/boot_chip.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/sys/arch/amd64/boot/boot_chip.c b/src/sys/arch/amd64/boot/boot_chip.c index 679a759..8cefdac 100644 --- a/src/sys/arch/amd64/boot/boot_chip.c +++ b/src/sys/arch/amd64/boot/boot_chip.c @@ -28,11 +28,15 @@ */ #include <sys/types.h> +#include <sys/panic.h> +#include <sys/cpuvar.h> #include <machine/uart.h> #include <machine/gdt.h> #include <machine/boot.h> #include <machine/i8259.h> #include <machine/ioapic.h> +#include <machine/tss.h> +#include <machine/gdt.h> #include <stdbool.h> static void @@ -48,12 +52,33 @@ chipset_init(void) ioapic_init(); } +/* + * Initialize and load the task state segment + */ +static void +init_tss(struct pcore *pcore) +{ + struct tss_desc *desc; + + desc = (struct tss_desc *)&g_gdt_data[GDT_TSS_INDEX]; + write_tss(pcore, desc); + tss_load(); +} + void platform_boot(void) { + struct pcore *core; + + /* Try to get the current core */ + if ((core = this_core()) == NULL) { + panic("platform_boot: could not get core\n"); + } + gdt_load(); - i8259_disable(); + init_tss(core); + i8259_disable(); chipset_init(); uart_init(); } |