From 4d5a2dd0f3c39921ba20c1cb9a5c208bea94e5fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sat, 27 Apr 2019 17:57:49 +0200 Subject: [PATCH] [NTOS:KE] Use multi-processor-aware KeGetPcr() instead of the legacy PCR. --- ntoskrnl/ke/i386/traphdlr.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ntoskrnl/ke/i386/traphdlr.c b/ntoskrnl/ke/i386/traphdlr.c index e262bb85b92..6f26ac99a78 100644 --- a/ntoskrnl/ke/i386/traphdlr.c +++ b/ntoskrnl/ke/i386/traphdlr.c @@ -477,8 +477,8 @@ KiTrap02Handler(VOID) _disable(); /* Get the current TSS, thread, and process */ - Tss = PCR->TSS; - Thread = ((PKIPCR)PCR)->PrcbData.CurrentThread; + Tss = KeGetPcr()->TSS; + Thread = ((PKIPCR)KeGetPcr())->PrcbData.CurrentThread; Process = Thread->ApcState.Process; /* Save data usually not present in the TSS */ @@ -498,7 +498,7 @@ KiTrap02Handler(VOID) * Note that in reality, we are already on the NMI TSS -- we just * need to update the PCR to reflect this. */ - PCR->TSS = NmiTss; + KeGetPcr()->TSS = NmiTss; __writeeflags(__readeflags() &~ EFLAGS_NESTED_TASK); TssGdt->HighWord.Bits.Dpl = 0; TssGdt->HighWord.Bits.Pres = 1; @@ -523,7 +523,7 @@ KiTrap02Handler(VOID) TrapFrame.Esi = Tss->Esi; TrapFrame.Edi = Tss->Edi; TrapFrame.SegFs = Tss->Fs; - TrapFrame.ExceptionList = PCR->NtTib.ExceptionList; + TrapFrame.ExceptionList = KeGetPcr()->NtTib.ExceptionList; TrapFrame.PreviousPreviousMode = (ULONG)-1; TrapFrame.Eax = Tss->Eax; TrapFrame.Ecx = Tss->Ecx; @@ -547,10 +547,10 @@ KiTrap02Handler(VOID) * the normal APIs here as playing with the IRQL could change the system * state. */ - OldIrql = PCR->Irql; - PCR->Irql = HIGH_LEVEL; + OldIrql = KeGetPcr()->Irql; + KeGetPcr()->Irql = HIGH_LEVEL; HalHandleNMI(NULL); - PCR->Irql = OldIrql; + KeGetPcr()->Irql = OldIrql; } /* @@ -560,14 +560,14 @@ KiTrap02Handler(VOID) * We have to make sure we're still in our original NMI -- a nested NMI * will point back to the NMI TSS, and in that case we're hosed. */ - if (PCR->TSS->Backlink == KGDT_NMI_TSS) + if (KeGetPcr()->TSS->Backlink == KGDT_NMI_TSS) { /* Unhandled: crash the system */ KiSystemFatalException(EXCEPTION_NMI, NULL); } /* Restore original TSS */ - PCR->TSS = Tss; + KeGetPcr()->TSS = Tss; /* Set it back to busy */ TssGdt->HighWord.Bits.Dpl = 0;