Alex Ionescu <ionucu@videotron.ca>

- Add KeGetCurrentPrcb function and use it where appropriate.
- Fix returning of values in ExGetCurrentProcessorCpuUsage and ExGetCurrentProcessorCounts.
- Move ExIsProcessorFeaturePresent from ex/init.c to ex/sysinfo.c.

svn path=/trunk/; revision=13965
This commit is contained in:
Filip Navara 2005-03-12 09:40:07 +00:00
parent 17f773cb7d
commit 466b206539
14 changed files with 2443 additions and 2429 deletions

File diff suppressed because it is too large Load diff

View file

@ -38,19 +38,6 @@ ExInit3 (VOID)
}
/*
* @implemented
*/
BOOLEAN STDCALL
ExIsProcessorFeaturePresent(IN ULONG ProcessorFeature)
{
if (ProcessorFeature >= PROCESSOR_FEATURE_MAX)
return(FALSE);
return(SharedUserData->ProcessorFeatures[ProcessorFeature]);
}
VOID STDCALL
ExPostSystemEvent (ULONG Unknown1,
ULONG Unknown2,

View file

@ -46,17 +46,18 @@ ExGetCurrentProcessorCpuUsage (
PULONG CpuUsage
)
{
PKPCR Pcr;
PKPRCB Prcb;
ULONG TotalTime;
ULONG PercentTime = 0;
ULONGLONG ScaledIdle;
Pcr = KeGetCurrentKPCR();
Prcb = KeGetCurrentPrcb();
ScaledIdle = Pcr->PrcbData.IdleThread->KernelTime * 100;
TotalTime = Pcr->PrcbData.KernelTime + Pcr->PrcbData.UserTime;
if (TotalTime) PercentTime = 100 - (ScaledIdle / TotalTime);
CpuUsage = &PercentTime;
ScaledIdle = Prcb->IdleThread->KernelTime * 100;
TotalTime = Prcb->KernelTime + Prcb->UserTime;
if (TotalTime != 0)
*CpuUsage = 100 - (ScaledIdle / TotalTime);
else
*CpuUsage = 0;
}
/*
@ -70,20 +71,27 @@ ExGetCurrentProcessorCounts (
PULONG ProcessorNumber
)
{
PKPCR Pcr;
ULONG TotalTime;
ULONG ThreadTime;
ULONG ProcNumber;
PKPRCB Prcb;
Pcr = KeGetCurrentKPCR();
Prcb = KeGetCurrentPrcb();
TotalTime = Pcr->PrcbData.KernelTime + Pcr->PrcbData.UserTime;
ThreadTime = Pcr->PrcbData.CurrentThread->KernelTime;
ProcNumber = Pcr->ProcessorNumber;
*ThreadKernelTime = Prcb->KernelTime + Prcb->UserTime;
*TotalCpuTime = Prcb->CurrentThread->KernelTime;
*ProcessorNumber = KeGetCurrentKPCR()->ProcessorNumber;
}
ThreadKernelTime = &ThreadTime;
TotalCpuTime = &TotalTime;
ProcessorNumber = &ProcNumber;
/*
* @implemented
*/
BOOLEAN
STDCALL
ExIsProcessorFeaturePresent(IN ULONG ProcessorFeature)
{
/* Quick check to see if it exists at all */
if (ProcessorFeature >= PROCESSOR_FEATURE_MAX) return(FALSE);
/* Return our support for it */
return(SharedUserData->ProcessorFeatures[ProcessorFeature]);
}
NTSTATUS STDCALL
@ -363,7 +371,7 @@ QSI_DEF(SystemProcessorInformation)
{
PSYSTEM_PROCESSOR_INFORMATION Spi
= (PSYSTEM_PROCESSOR_INFORMATION) Buffer;
PKPCR Pcr;
PKPRCB Prcb;
*ReqSize = sizeof (SYSTEM_PROCESSOR_INFORMATION);
/*
* Check user buffer's size
@ -372,12 +380,12 @@ QSI_DEF(SystemProcessorInformation)
{
return (STATUS_INFO_LENGTH_MISMATCH);
}
Pcr = KeGetCurrentKPCR();
Prcb = KeGetCurrentPrcb();
Spi->ProcessorArchitecture = 0; /* Intel Processor */
Spi->ProcessorLevel = Pcr->PrcbData.CpuType;
Spi->ProcessorRevision = Pcr->PrcbData.CpuStep;
Spi->ProcessorLevel = Prcb->CpuType;
Spi->ProcessorRevision = Prcb->CpuStep;
Spi->Unknown = 0;
Spi->FeatureBits = Pcr->PrcbData.FeatureBits;
Spi->FeatureBits = Prcb->FeatureBits;
DPRINT("Arch %d Level %d Rev 0x%x\n", Spi->ProcessorArchitecture,
Spi->ProcessorLevel, Spi->ProcessorRevision);
@ -713,7 +721,7 @@ QSI_DEF(SystemProcessorPerformanceInformation)
ULONG i;
LARGE_INTEGER CurrentTime;
PKPCR Pcr;
PKPRCB Prcb;
*ReqSize = KeNumberProcessors * sizeof (SYSTEM_PROCESSORTIME_INFO);
/*
@ -725,19 +733,17 @@ QSI_DEF(SystemProcessorPerformanceInformation)
}
CurrentTime.QuadPart = KeQueryInterruptTime();
Pcr = (PKPCR)KPCR_BASE;
Prcb = ((PKPCR)KPCR_BASE)->Prcb;
for (i = 0; i < KeNumberProcessors; i++)
{
Spi->TotalProcessorRunTime.QuadPart = (Pcr->PrcbData.IdleThread->KernelTime + Pcr->PrcbData.IdleThread->UserTime) * 100000LL; // IdleTime
Spi->TotalProcessorTime.QuadPart = Pcr->PrcbData.KernelTime * 100000LL; // KernelTime
Spi->TotalProcessorUserTime.QuadPart = Pcr->PrcbData.UserTime * 100000LL;
Spi->TotalDPCTime.QuadPart = Pcr->PrcbData.DpcTime * 100000LL;
Spi->TotalInterruptTime.QuadPart = Pcr->PrcbData.InterruptTime * 100000LL;
Spi->TotalInterrupts = Pcr->PrcbData.InterruptCount; // Interrupt Count
Spi->TotalProcessorRunTime.QuadPart = (Prcb->IdleThread->KernelTime + Prcb->IdleThread->UserTime) * 100000LL; // IdleTime
Spi->TotalProcessorTime.QuadPart = Prcb->KernelTime * 100000LL; // KernelTime
Spi->TotalProcessorUserTime.QuadPart = Prcb->UserTime * 100000LL;
Spi->TotalDPCTime.QuadPart = Prcb->DpcTime * 100000LL;
Spi->TotalInterruptTime.QuadPart = Prcb->InterruptTime * 100000LL;
Spi->TotalInterrupts = Prcb->InterruptCount; // Interrupt Count
Spi++;
// Pcr++;
Pcr = (PKPCR)((ULONG_PTR)Pcr + PAGE_SIZE);
Prcb = (PKPRCB)((ULONG_PTR)Prcb + PAGE_SIZE);
}
return (STATUS_SUCCESS);

View file

@ -217,7 +217,7 @@ typedef struct _KPCR_TIB {
typedef struct _KPCR {
KPCR_TIB Tib; /* 00 */
struct _KPCR *Self; /* 1C */
struct _KPRCB *PCRCB; /* 20 */
struct _KPRCB *Prcb; /* 20 */
KIRQL Irql; /* 24 */
ULONG IRR; /* 28 */
ULONG IrrActive; /* 2C */
@ -269,9 +269,28 @@ static inline PKPCR KeGetCurrentKPCR(VOID)
return((PKPCR)value);
}
static inline PKPRCB KeGetCurrentPrcb(VOID)
{
ULONG value;
#if defined(__GNUC__)
__asm__ __volatile__ ("movl %%fs:0x20, %0\n\t"
: "=r" (value)
: /* no inputs */
);
#elif defined(_MSC_VER)
__asm mov eax, fs:0x20;
__asm mov value, eax;
#else
#error Unknown compiler for inline assembler
#endif
return((PKPRCB)value);
}
#else
#define KeGetCurrentKPCR(X) ((PKPCR)KPCR_BASE)
#define KeGetCurrentPrcb() (((PKPCR)KPCR_BASE)->Prcb)
#endif

View file

@ -242,22 +242,22 @@ KeUpdateRunTime(
IN KIRQL Irql
)
{
PKPCR Pcr;
PKPRCB Prcb;
PKTHREAD CurrentThread;
PKPROCESS CurrentProcess;
#if 0
ULONG DpcLastCount;
#endif
Pcr = KeGetCurrentKPCR();
Prcb = KeGetCurrentPrcb();
/* Make sure we don't go further if we're in early boot phase. */
if (Pcr == NULL || Pcr->PrcbData.CurrentThread == NULL)
if (Prcb == NULL || Prcb->CurrentThread == NULL)
return;
DPRINT("KernelTime %u, UserTime %u \n", Pcr->PrcbData.KernelTime, Pcr->PrcbData.UserTime);
DPRINT("KernelTime %u, UserTime %u \n", Prcb->KernelTime, Prcb->UserTime);
CurrentThread = Pcr->PrcbData.CurrentThread;
CurrentThread = Prcb->CurrentThread;
CurrentProcess = CurrentThread->ApcState.Process;
/*
@ -269,36 +269,36 @@ KeUpdateRunTime(
{
InterlockedIncrementUL(&CurrentThread->UserTime);
InterlockedIncrementUL(&CurrentProcess->UserTime);
Pcr->PrcbData.UserTime++;
Prcb->UserTime++;
}
else
{
if (Irql > DISPATCH_LEVEL)
{
Pcr->PrcbData.InterruptTime++;
Prcb->InterruptTime++;
}
else if (Irql == DISPATCH_LEVEL)
{
Pcr->PrcbData.DpcTime++;
Prcb->DpcTime++;
}
else
{
InterlockedIncrementUL(&CurrentThread->KernelTime);
InterlockedIncrementUL(&CurrentProcess->KernelTime);
Pcr->PrcbData.KernelTime++;
Prcb->KernelTime++;
}
}
#if 0
DpcLastCount = Pcr->PrcbData.DpcLastCount;
Pcr->PrcbData.DpcLastCount = Pcr->PrcbData.DpcCount;
Pcr->PrcbData.DpcRequestRate = ((Pcr->PrcbData.DpcCount - DpcLastCount) +
Pcr->PrcbData.DpcRequestRate) / 2;
DpcLastCount = Prcb->DpcLastCount;
Prcb->DpcLastCount = Prcb->DpcCount;
Prcb->DpcRequestRate = ((Prcb->DpcCount - DpcLastCount) +
Prcb->DpcRequestRate) / 2;
#endif
if (Pcr->PrcbData.DpcData[0].DpcQueueDepth > 0 &&
Pcr->PrcbData.DpcRoutineActive == FALSE &&
Pcr->PrcbData.DpcInterruptRequested == FALSE)
if (Prcb->DpcData[0].DpcQueueDepth > 0 &&
Prcb->DpcRoutineActive == FALSE &&
Prcb->DpcInterruptRequested == FALSE)
{
HalRequestSoftwareInterrupt(DISPATCH_LEVEL);
}
@ -311,7 +311,7 @@ KeUpdateRunTime(
*/
if ((CurrentThread->Quantum -= 3) <= 0)
{
Pcr->PrcbData.QuantumEnd = TRUE;
Prcb->QuantumEnd = TRUE;
HalRequestSoftwareInterrupt(DISPATCH_LEVEL);
}
}

View file

@ -1,4 +1,4 @@
/* $Id:$
/* $Id$
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -228,7 +228,7 @@ KiCheckFPU(VOID)
unsigned short int status;
int cr0;
ULONG Flags;
PKPCR Pcr = KeGetCurrentKPCR();
PKPRCB Prcb = KeGetCurrentPrcb();
Ke386SaveFlags(Flags);
Ke386DisableInterrupts();
@ -275,7 +275,7 @@ KiCheckFPU(VOID)
HardwareMathSupport = 1;
/* check for and enable MMX/SSE support if possible */
if ((Pcr->PrcbData.FeatureBits & X86_FEATURE_FXSR) != 0)
if ((Prcb->FeatureBits & X86_FEATURE_FXSR) != 0)
{
BYTE DummyArea[sizeof(FX_SAVE_AREA) + 15];
PFX_SAVE_AREA FxSaveArea;
@ -300,7 +300,7 @@ KiCheckFPU(VOID)
}
}
/* FIXME: Check for SSE3 in Ke386CpuidFlags2! */
if (Pcr->PrcbData.FeatureBits & (X86_FEATURE_SSE | X86_FEATURE_SSE2))
if (Prcb->FeatureBits & (X86_FEATURE_SSE | X86_FEATURE_SSE2))
{
Ke386SetCr4(Ke386GetCr4() | X86_CR4_OSXMMEXCPT);
@ -401,7 +401,7 @@ KiHandleFpuFault(PKTRAP_FRAME Tf, ULONG ExceptionNr)
CurrentThread = KeGetCurrentThread();
#ifndef CONFIG_SMP
NpxThread = KeGetCurrentKPCR()->PrcbData.NpxThread;
NpxThread = KeGetCurrentPrcb()->NpxThread;
#endif
ASSERT(CurrentThread != NULL);
@ -414,7 +414,7 @@ KiHandleFpuFault(PKTRAP_FRAME Tf, ULONG ExceptionNr)
/* save the FPU state into the owner's save area */
if (NpxThread != NULL)
{
KeGetCurrentKPCR()->PrcbData.NpxThread = NULL;
KeGetCurrentPrcb()->NpxThread = NULL;
FxSaveArea = (PFX_SAVE_AREA)((char *)NpxThread->InitialStack - sizeof (FX_SAVE_AREA));
/* the fnsave might raise a delayed #MF exception */
if (FxsrSupport)
@ -463,7 +463,7 @@ KiHandleFpuFault(PKTRAP_FRAME Tf, ULONG ExceptionNr)
asm volatile("finit");
}
}
KeGetCurrentKPCR()->PrcbData.NpxThread = CurrentThread;
KeGetCurrentPrcb()->NpxThread = CurrentThread;
#ifndef CONFIG_SMP
}
#endif
@ -487,7 +487,7 @@ KiHandleFpuFault(PKTRAP_FRAME Tf, ULONG ExceptionNr)
KeRaiseIrql(DISPATCH_LEVEL, &oldIrql);
NpxThread = KeGetCurrentKPCR()->PrcbData.NpxThread;
NpxThread = KeGetCurrentPrcb()->NpxThread;
CurrentThread = KeGetCurrentThread();
if (NpxThread == NULL)
{

View file

@ -315,7 +315,7 @@ KiInterruptDispatch (ULONG vector, PKIRQ_TRAPFRAME Trapframe)
* the PIC.
*/
KeGetCurrentKPCR()->PrcbData.InterruptCount++;
KeGetCurrentPrcb()->InterruptCount++;
/*
* Notify the rest of the kernel of the raised irq level. For the

View file

@ -146,6 +146,7 @@ KePrepareForApplicationProcessorInit(ULONG Id)
Pcr->ProcessorNumber = Id;
Pcr->Tib.Self = &Pcr->Tib;
Pcr->Self = Pcr;
Pcr->Prcb = &Pcr->PrcbData;
Pcr->Irql = SYNCH_LEVEL;
Pcr->PrcbData.MHz = BootPcr->PrcbData.MHz;
@ -238,6 +239,7 @@ KeInit1(PCHAR CommandLine, PULONG LastKernelAddress)
KPCR = (PKPCR)KPCR_BASE;
memset(KPCR, 0, PAGE_SIZE);
KPCR->Self = KPCR;
KPCR->Prcb = &KPCR->PrcbData;
KPCR->Irql = SYNCH_LEVEL;
KPCR->Tib.Self = &KPCR->Tib;
KPCR->GDT = KiBootGdt;

View file

@ -32,7 +32,7 @@ KiIpiSendRequest(ULONG TargetSet, ULONG IpiRequest)
if (TargetSet & (1 << i))
{
Pcr = (PKPCR)(KPCR_BASE + i * PAGE_SIZE);
Ke386TestAndSetBit(IpiRequest, &Pcr->PrcbData.IpiFrozen);
Ke386TestAndSetBit(IpiRequest, &Pcr->Prcb->IpiFrozen);
HalRequestIpi(i);
}
}
@ -50,34 +50,34 @@ KiIpiServiceRoutine(IN PKTRAP_FRAME TrapFrame,
LARGE_INTEGER StartTime, CurrentTime, Frequency;
ULONG Count = 5;
#endif
PKPCR Pcr;
PKPRCB Prcb;
ASSERT(KeGetCurrentIrql() == IPI_LEVEL);
DPRINT("KiIpiServiceRoutine\n");
Pcr = KeGetCurrentKPCR();
Prcb = KeGetCurrentPrcb();
if (Ke386TestAndClearBit(IPI_REQUEST_APC, &Pcr->PrcbData.IpiFrozen))
if (Ke386TestAndClearBit(IPI_REQUEST_APC, &Prcb->IpiFrozen))
{
HalRequestSoftwareInterrupt(APC_LEVEL);
}
if (Ke386TestAndClearBit(IPI_REQUEST_DPC, &Pcr->PrcbData.IpiFrozen))
if (Ke386TestAndClearBit(IPI_REQUEST_DPC, &Prcb->IpiFrozen))
{
Pcr->PrcbData.DpcInterruptRequested = TRUE;
Prcb->DpcInterruptRequested = TRUE;
HalRequestSoftwareInterrupt(DISPATCH_LEVEL);
}
if (Ke386TestAndClearBit(IPI_REQUEST_FUNCTIONCALL, &Pcr->PrcbData.IpiFrozen))
if (Ke386TestAndClearBit(IPI_REQUEST_FUNCTIONCALL, &Prcb->IpiFrozen))
{
InterlockedDecrementUL(&Pcr->PrcbData.SignalDone->CurrentPacket[1]);
if (InterlockedCompareExchangeUL(&Pcr->PrcbData.SignalDone->CurrentPacket[2], 0, 0))
InterlockedDecrementUL(&Prcb->SignalDone->CurrentPacket[1]);
if (InterlockedCompareExchangeUL(&Prcb->SignalDone->CurrentPacket[2], 0, 0))
{
#ifdef DBG
StartTime = KeQueryPerformanceCounter(&Frequency);
#endif
while (0 != InterlockedCompareExchangeUL(&Pcr->PrcbData.SignalDone->CurrentPacket[1], 0, 0))
while (0 != InterlockedCompareExchangeUL(&Prcb->SignalDone->CurrentPacket[1], 0, 0))
{
#ifdef DBG
CurrentTime = KeQueryPerformanceCounter(NULL);
@ -89,14 +89,14 @@ KiIpiServiceRoutine(IN PKTRAP_FRAME TrapFrame,
#endif
}
}
((VOID STDCALL(*)(PVOID))(Pcr->PrcbData.SignalDone->WorkerRoutine))(Pcr->PrcbData.SignalDone->CurrentPacket[0]);
Ke386TestAndClearBit(KeGetCurrentProcessorNumber(), &Pcr->PrcbData.SignalDone->TargetSet);
if (InterlockedCompareExchangeUL(&Pcr->PrcbData.SignalDone->CurrentPacket[2], 0, 0))
((VOID STDCALL(*)(PVOID))(Prcb->SignalDone->WorkerRoutine))(Prcb->SignalDone->CurrentPacket[0]);
Ke386TestAndClearBit(KeGetCurrentProcessorNumber(), &Prcb->SignalDone->TargetSet);
if (InterlockedCompareExchangeUL(&Prcb->SignalDone->CurrentPacket[2], 0, 0))
{
#ifdef DBG
StartTime = KeQueryPerformanceCounter(&Frequency);
#endif
while (0 != InterlockedCompareExchangeUL(&Pcr->PrcbData.SignalDone->TargetSet, 0, 0))
while (0 != InterlockedCompareExchangeUL(&Prcb->SignalDone->TargetSet, 0, 0))
{
#ifdef DBG
CurrentTime = KeQueryPerformanceCounter(NULL);
@ -108,7 +108,7 @@ KiIpiServiceRoutine(IN PKTRAP_FRAME TrapFrame,
#endif
}
}
InterlockedExchangePointer(&Pcr->PrcbData.SignalDone, NULL);
InterlockedExchangePointer(&Prcb->SignalDone, NULL);
}
DPRINT("KiIpiServiceRoutine done\n");
return TRUE;
@ -119,18 +119,18 @@ STDCALL
KiIpiSendPacket(ULONG TargetSet, VOID STDCALL (*WorkerRoutine)(PVOID), PVOID Argument, ULONG Count, BOOLEAN Synchronize)
{
ULONG i, Processor, CurrentProcessor;
PKPCR Pcr, CurrentPcr;
PKPRCB Prcb, CurrentPrcb;
KIRQL oldIrql;
ASSERT(KeGetCurrentIrql() == SYNCH_LEVEL);
CurrentPcr = KeGetCurrentKPCR();
InterlockedExchangeUL(&CurrentPcr->PrcbData.TargetSet, TargetSet);
InterlockedExchangeUL(&CurrentPcr->PrcbData.WorkerRoutine, (ULONG_PTR)WorkerRoutine);
InterlockedExchangePointer(&CurrentPcr->PrcbData.CurrentPacket[0], Argument);
InterlockedExchangeUL(&CurrentPcr->PrcbData.CurrentPacket[1], Count);
InterlockedExchangeUL(&CurrentPcr->PrcbData.CurrentPacket[2], Synchronize ? 1 : 0);
CurrentPrcb = KeGetCurrentPrcb();
InterlockedExchangeUL(&CurrentPrcb->TargetSet, TargetSet);
InterlockedExchangeUL(&CurrentPrcb->WorkerRoutine, (ULONG_PTR)WorkerRoutine);
InterlockedExchangePointer(&CurrentPrcb->CurrentPacket[0], Argument);
InterlockedExchangeUL(&CurrentPrcb->CurrentPacket[1], Count);
InterlockedExchangeUL(&CurrentPrcb->CurrentPacket[2], Synchronize ? 1 : 0);
CurrentProcessor = 1 << KeGetCurrentProcessorNumber();
@ -138,9 +138,9 @@ KiIpiSendPacket(ULONG TargetSet, VOID STDCALL (*WorkerRoutine)(PVOID), PVOID Arg
{
if (TargetSet & Processor)
{
Pcr = (PKPCR)(KPCR_BASE + i * PAGE_SIZE);
while(0 != InterlockedCompareExchangeUL(&Pcr->PrcbData.SignalDone, (LONG)&CurrentPcr->PrcbData, 0));
Ke386TestAndSetBit(IPI_REQUEST_FUNCTIONCALL, &Pcr->PrcbData.IpiFrozen);
Prcb = ((PKPCR)(KPCR_BASE + i * PAGE_SIZE))->Prcb;
while(0 != InterlockedCompareExchangeUL(&Prcb->SignalDone, (LONG)CurrentPrcb, 0));
Ke386TestAndSetBit(IPI_REQUEST_FUNCTIONCALL, &Prcb->IpiFrozen);
if (Processor != CurrentProcessor)
{
HalRequestIpi(i);

View file

@ -67,9 +67,9 @@ NtContinue (
{
Thread->NpxState = NPX_STATE_VALID;
KeRaiseIrql(DISPATCH_LEVEL, &oldIrql);
if (KeGetCurrentKPCR()->PrcbData.NpxThread == Thread)
if (KeGetCurrentPrcb()->NpxThread == Thread)
{
KeGetCurrentKPCR()->PrcbData.NpxThread = NULL;
KeGetCurrentPrcb()->NpxThread = NULL;
Ke386SetCr0(Ke386GetCr0() | X86_CR0_TS);
}
else

View file

@ -1,4 +1,4 @@
/* $Id:$
/* $Id$
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -26,11 +26,11 @@ PsIdleThreadMain(PVOID Context)
{
KIRQL oldlvl;
PKPCR Pcr = KeGetCurrentKPCR();
PKPRCB Prcb = KeGetCurrentPrcb();
for(;;)
{
if (Pcr->PrcbData.DpcData[0].DpcQueueDepth > 0)
if (Prcb->DpcData[0].DpcQueueDepth > 0)
{
KeRaiseIrql(DISPATCH_LEVEL,&oldlvl);
KiDispatchInterrupt();
@ -80,7 +80,7 @@ PsInitIdleThread(VOID)
return;
}
NtClose(IdleThreadHandle);
KeGetCurrentKPCR()->PrcbData.IdleThread = &IdleThread->Tcb;
KeGetCurrentPrcb()->IdleThread = &IdleThread->Tcb;
KeSetPriorityThread(&IdleThread->Tcb, LOW_PRIORITY);
KeSetAffinityThread(&IdleThread->Tcb, 1 << 0);

View file

@ -151,7 +151,7 @@ PsTerminateCurrentThread(NTSTATUS ExitStatus)
/* If the ProcessoR Control Block's NpxThread points to the current thread
* unset it.
*/
InterlockedCompareExchangePointer(&KeGetCurrentKPCR()->PrcbData.NpxThread,
InterlockedCompareExchangePointer(&KeGetCurrentPrcb()->NpxThread,
NULL, ETHREAD_TO_KTHREAD(CurrentThread));
KeReleaseDispatcherDatabaseLock(oldIrql);

View file

@ -1769,7 +1769,7 @@ NtQueryInformationProcess(IN HANDLE ProcessHandle,
KeQuerySystemTime(&SystemTime);
Prcb = &KeGetCurrentKPCR()->PrcbData;
Prcb = KeGetCurrentPrcb();
NewCookie = Prcb->KeSystemCalls ^ Prcb->InterruptTime ^
SystemTime.u.LowPart ^ SystemTime.u.HighPart;

View file

@ -129,7 +129,7 @@ NtCallbackReturn (PVOID Result,
*/
KeRaiseIrql(HIGH_LEVEL, &oldIrql);
if ((Thread->Tcb.NpxState & NPX_STATE_VALID) &&
ETHREAD_TO_KTHREAD(Thread) != KeGetCurrentKPCR()->PrcbData.NpxThread)
ETHREAD_TO_KTHREAD(Thread) != KeGetCurrentPrcb()->NpxThread)
{
RtlCopyMemory((char*)InitialStack - sizeof(FX_SAVE_AREA),
(char*)Thread->Tcb.InitialStack - sizeof(FX_SAVE_AREA),
@ -317,7 +317,7 @@ NtW32Call (IN ULONG RoutineIndex,
SavedState.SavedCallbackStack = Thread->Tcb.CallbackStack;
SavedState.SavedExceptionStack = (PVOID)KeGetCurrentKPCR()->TSS->Esp0;
if ((Thread->Tcb.NpxState & NPX_STATE_VALID) &&
ETHREAD_TO_KTHREAD(Thread) != KeGetCurrentKPCR()->PrcbData.NpxThread)
ETHREAD_TO_KTHREAD(Thread) != KeGetCurrentPrcb()->NpxThread)
{
RtlCopyMemory((char*)NewStack + StackSize - sizeof(FX_SAVE_AREA),
(char*)SavedState.SavedInitialStack - sizeof(FX_SAVE_AREA),