ptos/amd64: Add task state segment

Signed-off-by: Chloe M <chloe@mensia.org>
This commit is contained in:
2026-07-13 23:27:01 -04:00
parent 4165241b6f
commit bb55a52b69
4 changed files with 258 additions and 0 deletions
+17
View File
@@ -12,6 +12,10 @@
#include <machine/trap.h>
#include <machine/msr.h>
#include <machine/lapic.h>
#include <machine/gdt.h>
/* Externs */
extern GDT_ENTRY g_GDT[GDT_ENTRY_COUNT];
/*
* Initialize interrupts for the current processor
@@ -66,9 +70,22 @@ HalKpcrP1Init(KPCR *Kpcr)
VOID
HalKpcrP2Init(KPCR *Kpcr)
{
TSS_DESCRIPTOR *TssDesc;
/* Initialize per-processor pools */
ExPoolRegionInit(&Kpcr->PoolRegion);
/* Initialize the Local APIC unit */
MdLapicInit(Kpcr);
/* Load the Task State Segment */
TssDesc = (TSS_DESCRIPTOR *)&g_GDT[GDT_TSS_INDEX];
MdTssInit(TssDesc);
ASMV(
"mov %0, %%ax\n"
"ltr %%ax\n"
:
: "i" (GDT_TSS)
: "memory"
);
}