ptos/amd64: context: Only update TSS if PS_USER

Signed-off-by: Chloe M <chloe@mensia.org>
This commit is contained in:
2026-07-15 05:25:10 -04:00
parent d8fed2d089
commit a1e15b03da
+2
View File
@@ -59,10 +59,12 @@ HalContextSwitch(TRAP_FRAME *Frame)
HalMmuWriteVas(&NextParent->Vas); HalMmuWriteVas(&NextParent->Vas);
/* Update the task state segment with kstack */ /* Update the task state segment with kstack */
if (ISSET(NextParent->Flags, PS_USER)) {
KStackTop = NextTcb->KStackBase + NextTcb->KStackLength; KStackTop = NextTcb->KStackBase + NextTcb->KStackLength;
Tss = Mcb->Tss; Tss = Mcb->Tss;
Tss->Rsp0Low = KStackTop & 0xFFFFFFFF; Tss->Rsp0Low = KStackTop & 0xFFFFFFFF;
Tss->Rsp0High = (KStackTop >> 32) & 0xFFFFFFFF; Tss->Rsp0High = (KStackTop >> 32) & 0xFFFFFFFF;
}
/* Context switch here */ /* Context switch here */
Kpcr->CurrentThread = NextThread; Kpcr->CurrentThread = NextThread;