ptos/amd64: context: Only update TSS if PS_USER
Signed-off-by: Chloe M <chloe@mensia.org>
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user