本文整理汇总了C++中KeGetCurrentPrcb函数的典型用法代码示例。如果您正苦于以下问题:C++ KeGetCurrentPrcb函数的具体用法?C++ KeGetCurrentPrcb怎么用?C++ KeGetCurrentPrcb使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了KeGetCurrentPrcb函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: KiSetProcessorType
VOID
NTAPI
INIT_FUNCTION
KiSetProcessorType(VOID)
{
ULONG EFlags, NewEFlags;
ULONG Reg, Dummy;
ULONG Stepping, Type;
/* Start by assuming no CPUID data */
KeGetCurrentPrcb()->CpuID = 0;
/* Save EFlags */
EFlags = __readeflags();
/* XOR out the ID bit and update EFlags */
NewEFlags = EFlags ^ EFLAGS_ID;
__writeeflags(NewEFlags);
/* Get them back and see if they were modified */
NewEFlags = __readeflags();
if (NewEFlags != EFlags)
{
/* The modification worked, so CPUID exists. Set the ID Bit again. */
EFlags |= EFLAGS_ID;
__writeeflags(EFlags);
/* Peform CPUID 0 to see if CPUID 1 is supported */
CPUID(0, &Reg, &Dummy, &Dummy, &Dummy);
if (Reg > 0)
{
/* Do CPUID 1 now */
CPUID(1, &Reg, &Dummy, &Dummy, &Dummy);
/*
* Get the Stepping and Type. The stepping contains both the
* Model and the Step, while the Type contains the returned Type.
* We ignore the family.
*
* For the stepping, we convert this: zzzzzzxy into this: x0y
*/
Stepping = Reg & 0xF0;
Stepping <<= 4;
Stepping += (Reg & 0xFF);
Stepping &= 0xF0F;
Type = Reg & 0xF00;
Type >>= 8;
/* Save them in the PRCB */
KeGetCurrentPrcb()->CpuID = TRUE;
KeGetCurrentPrcb()->CpuType = (UCHAR)Type;
KeGetCurrentPrcb()->CpuStep = (USHORT)Stepping;
}
开发者ID:killvxk,项目名称:NT_OS,代码行数:53,代码来源:cpu.c
示例2: KeIsExecutingDpc
/*
* @implemented
*/
BOOLEAN
NTAPI
KeIsExecutingDpc(VOID)
{
/* Return if the Dpc Routine is active */
return KeGetCurrentPrcb()->DpcRoutineActive;
}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:10,代码来源:dpc.c
示例3: KiUnexpectedInterruptTailHandler
VOID
FASTCALL
KiUnexpectedInterruptTailHandler(IN PKTRAP_FRAME TrapFrame)
{
KIRQL OldIrql;
/* Enter trap */
KiEnterInterruptTrap(TrapFrame);
/* Increase interrupt count */
KeGetCurrentPrcb()->InterruptCount++;
/* Start the interrupt */
if (HalBeginSystemInterrupt(HIGH_LEVEL, TrapFrame->ErrCode, &OldIrql))
{
/* Warn user */
DPRINT1("\n\x7\x7!!! Unexpected Interrupt 0x%02lx !!!\n", TrapFrame->ErrCode);
/* Now call the epilogue code */
KiExitInterrupt(TrapFrame, OldIrql, FALSE);
}
else
{
/* Now call the epilogue code */
KiExitInterrupt(TrapFrame, OldIrql, TRUE);
}
}
开发者ID:hackbunny,项目名称:reactos,代码行数:27,代码来源:irqobj.c
示例4: KiAdjustQuantumThread
VOID
KiAdjustQuantumThread (
IN PKTHREAD Thread
)
/*++
Routine Description:
If the current thread is not a time critical or realtime thread, then
adjust its quantum in accordance with the adjustment that would have
occured if the thread had actually waited.
Arguments:
Thread - Supplies a pointer to the current thread.
Return Value:
None.
--*/
{
PKPRCB Prcb;
PKPROCESS Process;
PKTHREAD NewThread;
SCHAR ThreadPriority;
if ((Thread->Priority < LOW_REALTIME_PRIORITY) &&
(Thread->BasePriority < TIME_CRITICAL_PRIORITY_BOUND)) {
Thread->Quantum -= WAIT_QUANTUM_DECREMENT;
if (Thread->Quantum <= 0) {
Process = Thread->ApcState.Process;
Thread->Quantum = Process->ThreadQuantum;
ThreadPriority = Thread->Priority - (Thread->PriorityDecrement + 1);
if (ThreadPriority < Thread->BasePriority) {
ThreadPriority = Thread->BasePriority;
}
Thread->PriorityDecrement = 0;
if (ThreadPriority != Thread->Priority) {
KiSetPriorityThread(Thread, ThreadPriority);
} else {
Prcb = KeGetCurrentPrcb();
if (Prcb->NextThread == NULL) {
NewThread = KiFindReadyThread(Thread->NextProcessor,
ThreadPriority);
if (NewThread != NULL) {
Prcb->NextThread = NewThread;
NewThread->State = Standby;
}
}
}
}
}
return;
}
开发者ID:conioh,项目名称:os-design,代码行数:60,代码来源:wait.c
示例5: KiInterruptDispatch
VOID
FASTCALL
KiInterruptDispatch(IN PKTRAP_FRAME TrapFrame,
IN PKINTERRUPT Interrupt)
{
KIRQL OldIrql;
/* Increase interrupt count */
KeGetCurrentPrcb()->InterruptCount++;
/* Begin the interrupt, making sure it's not spurious */
if (HalBeginSystemInterrupt(Interrupt->SynchronizeIrql,
Interrupt->Vector,
&OldIrql))
{
/* Acquire interrupt lock */
KxAcquireSpinLock(Interrupt->ActualLock);
/* Call the ISR */
Interrupt->ServiceRoutine(Interrupt, Interrupt->ServiceContext);
/* Release interrupt lock */
KxReleaseSpinLock(Interrupt->ActualLock);
/* Now call the epilogue code */
KiExitInterrupt(TrapFrame, OldIrql, FALSE);
}
else
{
/* Now call the epilogue code */
KiExitInterrupt(TrapFrame, OldIrql, TRUE);
}
}
开发者ID:hackbunny,项目名称:reactos,代码行数:33,代码来源:irqobj.c
示例6: KeGenericCallDpc
/*
* @implemented
*/
VOID
NTAPI
KeGenericCallDpc(IN PKDEFERRED_ROUTINE Routine,
IN PVOID Context)
{
ULONG Barrier = KeNumberProcessors;
KIRQL OldIrql;
DEFERRED_REVERSE_BARRIER ReverseBarrier;
ASSERT(KeGetCurrentIrql () < DISPATCH_LEVEL);
//
// The barrier is the number of processors, each processor will decrement it
// by one, so when all processors have run the DPC, the barrier reaches zero
//
ReverseBarrier.Barrier = Barrier;
ReverseBarrier.TotalProcessors = Barrier;
//
// But we don't need the barrier on UP, since we can simply call the routine
// directly while at DISPATCH_LEVEL and not worry about anything else
//
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
Routine(&KeGetCurrentPrcb()->CallDpc, Context, &Barrier, &ReverseBarrier);
KeLowerIrql(OldIrql);
}
开发者ID:Moteesh,项目名称:reactos,代码行数:28,代码来源:dpc.c
示例7: HalCalibratePerformanceCounter
VOID
HalCalibratePerformanceCounter (
IN volatile PLONG Number
)
/*++
Routine Description:
This routine resets the performance counter value for the current
processor to zero. The reset is done such that the resulting value
is closely synchronized with other processors in the configuration.
Arguments:
Number - Supplies a pointer to count of the number of processors in
the configuration.
Return Value:
None.
--*/
{
KSPIN_LOCK Lock;
KIRQL OldIrql;
PKPRCB Prcb;
//
// Raise IRQL to HIGH_LEVEL, decrement the number of processors, and
// wait until the number is zero.
//
KeInitializeSpinLock(&Lock);
KeRaiseIrql(HIGH_LEVEL, &OldIrql);
if (ExInterlockedDecrementLong(Number, &Lock) != RESULT_ZERO) {
do {
} while (*Number !=0);
}
//
// Write the compare register, clear the count register, and zero the
// performance counter for the current processor.
//
HalpWriteCompareRegisterAndClear(DEFAULT_PROFILE_COUNT);
Prcb = KeGetCurrentPrcb();
HalpPerformanceCounter[Prcb->Number].QuadPart = 0;
//
// Restore IRQL to its previous value and return.
//
KeLowerIrql(OldIrql);
return;
}
开发者ID:BillTheBest,项目名称:WinNT4,代码行数:59,代码来源:j4prof.c
示例8: KiRestoreProcessorState
VOID
KiRestoreProcessorState (
IN PKTRAP_FRAME TrapFrame,
IN PKEXCEPTION_FRAME ExceptionFrame
)
/*++
Routine Description:
This function moves processor register state from the current
processor context structure in the processor block to the
specified trap and exception frames.
Arguments:
TrapFrame - Supplies a pointer to a trap frame.
ExceptionFrame - Supplies a pointer to an exception frame.
Return Value:
None.
--*/
{
PKPRCB Prcb;
//
// Get the address of the current processor block and move the
// specified register state from the processor context structure
// to the specified trap and exception frames
//
Prcb = KeGetCurrentPrcb();
#if !defined(NT_UP)
KeContextToKframes(TrapFrame,
ExceptionFrame,
&Prcb->ProcessorState.ContextFrame,
CONTEXT_FULL,
KernelMode);
#endif
//
// Restore the current processor control state.
// Currently, the primary use is to allow the kernel
// debugger to set hardware debug registers. Still
// investigating whether this is required for MP systems.
//
KiRestoreProcessorControlState(&Prcb->ProcessorState);
return;
}
开发者ID:conioh,项目名称:os-design,代码行数:57,代码来源:ipi.c
示例9: HalStartProfileInterrupt
VOID
HalStartProfileInterrupt (
KPROFILE_SOURCE ProfileSource
)
/*++
Routine Description:
This routine computes the profile count value, writes the compare
register, clears the count register, and updates the performance
counter.
N.B. This routine must be called at PROFILE_LEVEL while holding the
profile lock.
Arguments:
Source - Supplies the profile source.
Return Value:
None.
--*/
{
PKPRCB Prcb;
ULONG PreviousCount;
LARGE_INTEGER TempValue;
//
// Compute the profile count from the current profile interval.
//
TempValue.QuadPart = Int32x32To64(HalpProfileCountRate,
HalpProfileInterval);
TempValue.QuadPart += ROUND_VALUE;
TempValue = RtlExtendedLargeIntegerDivide(TempValue, ONE_SECOND, NULL);
//
// Write the compare register and clear the count register.
//
PreviousCount = HalpWriteCompareRegisterAndClear(TempValue.LowPart);
//
// Update the performance counter by adding in the previous count value.
//
Prcb = KeGetCurrentPrcb();
HalpPerformanceCounter[Prcb->Number].QuadPart += PreviousCount;
return;
}
开发者ID:BillTheBest,项目名称:WinNT4,代码行数:56,代码来源:j4prof.c
示例10: KeReleaseQueuedSpinLock
/*
* @implemented
*/
VOID
KeReleaseQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber,
IN KIRQL OldIrql)
{
/* Release the lock */
KxReleaseSpinLock(KeGetCurrentPrcb()->LockQueue[LockNumber].Lock); // HACK
/* Lower IRQL back */
KeLowerIrql(OldIrql);
}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:13,代码来源:spinlock.c
示例11: HalpVerifyPrcbVersion
VOID
HalpVerifyPrcbVersion(
VOID
)
/*++
Routine Description:
This function verifies that the HAL matches the kernel. If there
is a mismatch the HAL bugchecks the system.
Arguments:
None.
Return Value:
None.
--*/
{
PKPRCB Prcb;
//
// Verify Prcb major version number, and build options are
// all conforming to this binary image
//
Prcb = KeGetCurrentPrcb();
#if DBG
if (!(Prcb->BuildType & PRCB_BUILD_DEBUG)) {
// This checked hal requires a checked kernel
KeBugCheckEx (MISMATCHED_HAL, 2, Prcb->BuildType, PRCB_BUILD_DEBUG, 0);
}
#else
if (Prcb->BuildType & PRCB_BUILD_DEBUG) {
// This free hal requires a free kernel
KeBugCheckEx (MISMATCHED_HAL, 2, Prcb->BuildType, 0, 0);
}
#endif
#ifndef NT_UP
if (Prcb->BuildType & PRCB_BUILD_UNIPROCESSOR) {
// This MP hal requires an MP kernel
KeBugCheckEx (MISMATCHED_HAL, 2, Prcb->BuildType, 0, 0);
}
#endif
if (Prcb->MajorVersion != PRCB_MAJOR_VERSION) {
KeBugCheckEx (MISMATCHED_HAL,
1, Prcb->MajorVersion, PRCB_MAJOR_VERSION, 0);
}
}
开发者ID:BillTheBest,项目名称:WinNT4,代码行数:55,代码来源:inithal.c
示例12: KeSwitchFrozenProcessor
KCONTINUE_STATUS
KeSwitchFrozenProcessor (
IN ULONG ProcessorNumber
)
{
#if !defined(NT_UP)
PKPRCB TargetPrcb, CurrentPrcb;
//
// If Processor number is out of range, reselect current processor
//
if (ProcessorNumber >= (ULONG) KeNumberProcessors) {
return ContinueProcessorReselected;
}
TargetPrcb = KiProcessorBlock[ProcessorNumber];
CurrentPrcb = KeGetCurrentPrcb();
//
// Move active flag to correct processor.
//
CurrentPrcb->IpiFrozen &= ~FREEZE_ACTIVE;
TargetPrcb->IpiFrozen |= FREEZE_ACTIVE;
//
// If this processor is frozen in KiFreezeTargetExecution, return to it
//
if (FrozenState(CurrentPrcb->IpiFrozen) == TARGET_FROZEN) {
return ContinueNextProcessor;
}
//
// This processor must be FREEZE_OWNER, wait to be reselected as the
// active processor
//
if (FrozenState(CurrentPrcb->IpiFrozen) != FREEZE_OWNER) {
return ContinueError;
}
while (!(CurrentPrcb->IpiFrozen & FREEZE_ACTIVE)) {
KeYieldProcessor();
}
#endif // !defined(NT_UP)
//
// Reselect this processor
//
return ContinueProcessorReselected;
}
开发者ID:conioh,项目名称:os-design,代码行数:55,代码来源:debug.c
示例13: KiSaveProcessorState
VOID
KiSaveProcessorState (
IN PKTRAP_FRAME TrapFrame,
IN PKEXCEPTION_FRAME ExceptionFrame
)
/*++
Routine Description:
This function saves the processor state from the specified exception
and trap frames, and saves the processor control state.
Arguments:
TrapFrame - Supplies a pointer to a trap frame.
ExceptionFrame - Supplies a pointer to an exception frame.
Return Value:
None.
--*/
{
#if !defined(NT_UP)
PKPRCB Prcb;
//
// Get the address of the current processor block, move the specified
// register state from specified trap and exception frames to the current
// processor context structure, and save the processor control state.
//
Prcb = KeGetCurrentPrcb();
Prcb->ProcessorState.ContextFrame.ContextFlags = CONTEXT_FULL;
KeContextFromKframes(TrapFrame,
ExceptionFrame,
&Prcb->ProcessorState.ContextFrame);
KiSaveProcessorControlState(&Prcb->ProcessorState);
#else
UNREFERENCED_PARAMETER(TrapFrame);
UNREFERENCED_PARAMETER(ExceptionFrame);
#endif
return;
}
开发者ID:BaoYu0721,项目名称:WRK-1.2,代码行数:54,代码来源:ipi.c
示例14: KeAcquireQueuedSpinLockRaiseToSynch
/*
* @implemented
*/
KIRQL
KeAcquireQueuedSpinLockRaiseToSynch(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber)
{
KIRQL OldIrql;
/* Raise to synch */
KeRaiseIrql(SYNCH_LEVEL, &OldIrql);
/* Acquire the lock */
KxAcquireSpinLock(KeGetCurrentPrcb()->LockQueue[LockNumber].Lock); // HACK
return OldIrql;
}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:15,代码来源:spinlock.c
示例15: HalEnableSystemInterrupt
BOOLEAN
NTAPI
HalEnableSystemInterrupt(
IN ULONG Vector,
IN KIRQL Irql,
IN KINTERRUPT_MODE InterruptMode)
{
IOAPIC_REDIRECTION_REGISTER ReDirReg;
PKPRCB Prcb = KeGetCurrentPrcb();
UCHAR Index;
ASSERT(Irql <= HIGH_LEVEL);
ASSERT((IrqlToTpr(Irql) & 0xF0) == (Vector & 0xF0));
/* Get the irq for this vector */
Index = HalpVectorToIndex[Vector];
/* Check if its valid */
if (Index == 0xff)
{
/* Interrupt is not in use */
return FALSE;
}
/* Read the redirection entry */
ReDirReg = ApicReadIORedirectionEntry(Index);
/* Check if the interrupt was unused */
if (ReDirReg.Vector != Vector)
{
ReDirReg.Vector = Vector;
ReDirReg.DeliveryMode = APIC_MT_LowestPriority;
ReDirReg.DestinationMode = APIC_DM_Logical;
ReDirReg.Destination = 0;
}
/* Check if the destination is logical */
if (ReDirReg.DestinationMode == APIC_DM_Logical)
{
/* Set the bit for this cpu */
ReDirReg.Destination |= ApicLogicalId(Prcb->Number);
}
/* Set the trigger mode */
ReDirReg.TriggerMode = 1 - InterruptMode;
/* Now unmask it */
ReDirReg.Mask = FALSE;
/* Write back the entry */
ApicWriteIORedirectionEntry(Index, ReDirReg);
return TRUE;
}
开发者ID:GYGit,项目名称:reactos,代码行数:53,代码来源:apic.c
示例16: KiSetProcessorType
VOID
NTAPI
KiSetProcessorType(VOID)
{
ULONG64 EFlags;
INT Reg[4];
ULONG Stepping, Type;
/* Start by assuming no CPUID data */
KeGetCurrentPrcb()->CpuID = 0;
/* Save EFlags */
EFlags = __readeflags();
/* Do CPUID 1 now */
__cpuid(Reg, 1);
/*
* Get the Stepping and Type. The stepping contains both the
* Model and the Step, while the Type contains the returned Type.
* We ignore the family.
*
* For the stepping, we convert this: zzzzzzxy into this: x0y
*/
Stepping = Reg[0] & 0xF0;
Stepping <<= 4;
Stepping += (Reg[0] & 0xFF);
Stepping &= 0xF0F;
Type = Reg[0] & 0xF00;
Type >>= 8;
/* Save them in the PRCB */
KeGetCurrentPrcb()->CpuID = TRUE;
KeGetCurrentPrcb()->CpuType = (UCHAR)Type;
KeGetCurrentPrcb()->CpuStep = (USHORT)Stepping;
/* Restore EFLAGS */
__writeeflags(EFlags);
}
开发者ID:RPG-7,项目名称:reactos,代码行数:39,代码来源:cpu.c
示例17: KeAcquireQueuedSpinLock
/*
* @implemented
*/
KIRQL
FASTCALL
KeAcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber)
{
KIRQL OldIrql;
/* Raise to dispatch */
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
/* Acquire the lock */
KxAcquireSpinLock(KeGetCurrentPrcb()->LockQueue[LockNumber].Lock); // HACK
return OldIrql;
}
开发者ID:RPG-7,项目名称:reactos,代码行数:16,代码来源:spinlock.c
示例18: ExInitPoolLookasidePointers
VOID
ExInitPoolLookasidePointers (
VOID
)
/*++
Routine Description:
This function initializes the PRCB lookaside pointers to temporary
values that will be updated during phase 1 initialization.
Arguments:
None.
Return Value:
None.
--*/
{
ULONG Index;
PGENERAL_LOOKASIDE Lookaside;
PKPRCB Prcb;
//
// Initialize the paged and nonpaged small pool lookaside list
// pointers in the PRCB to temporarily point to the global pool
// lookaside lists. During phase 1 initialization per processor
// lookaside lists are allocated and the pointer to these lists
// are established in the PRCB of each processor.
//
Prcb = KeGetCurrentPrcb();
for (Index = 0; Index < POOL_SMALL_LISTS; Index += 1) {
Lookaside = &ExpSmallNPagedPoolLookasideLists[Index];
ExInitializeSListHead(&Lookaside->ListHead);
Prcb->PPNPagedLookasideList[Index].P = Lookaside;
Prcb->PPNPagedLookasideList[Index].L = Lookaside;
Lookaside = &ExpSmallPagedPoolLookasideLists[Index];
ExInitializeSListHead(&Lookaside->ListHead);
Prcb->PPPagedLookasideList[Index].P = Lookaside;
Prcb->PPPagedLookasideList[Index].L = Lookaside;
}
return;
}
开发者ID:AlexiaChen,项目名称:wrk_study,代码行数:51,代码来源:exinit.c
示例19: KiSaveProcessorState
VOID
KiSaveProcessorState (
IN PKTRAP_FRAME TrapFrame,
IN PKEXCEPTION_FRAME ExceptionFrame
)
/*++
Routine Description:
This function moves processor register state from the specified trap
and exception frames to the processor context structure in the current
processor block.
Arguments:
TrapFrame - Supplies a pointer to a trap frame.
ExceptionFrame - Supplies a pointer to an exception frame.
Return Value:
None.
--*/
{
PKPRCB Prcb;
//
// Get the address of the current processor block and move the
// specified register state from specified trap and exception
// frames to the current processor context structure.
//
Prcb = KeGetCurrentPrcb();
Prcb->ProcessorState.ContextFrame.ContextFlags = CONTEXT_FULL |
CONTEXT_DEBUG_REGISTERS;
KeContextFromKframes(TrapFrame,
ExceptionFrame,
&Prcb->ProcessorState.ContextFrame);
//
// Save the current processor control state.
//
Prcb->ProcessorState.SpecialRegisters.KernelDr6 =
Prcb->ProcessorState.ContextFrame.Dr6;
KiSaveProcessorControlState(&Prcb->ProcessorState);
return;
}
开发者ID:conioh,项目名称:os-design,代码行数:51,代码来源:ipi.c
示例20: KiPollFreezeExecution
VOID
KiPollFreezeExecution(
VOID
)
/*++
Routine Description:
This routine is called from code that is spinning with interrupts
disabled, waiting for something to happen, when there is some
(possibly extremely small) chance that that thing will not happen
because a system freeze has been initiated.
N.B. Interrupts are disabled.
Arguments:
None.
Return Value:
None.
--*/
{
//
// Check to see if a freeze is pending for this processor.
//
PKPRCB Prcb = KeGetCurrentPrcb();
if ((Prcb->RequestSummary & IPI_FREEZE) != 0) {
//
// Clear the freeze request and freeze this processor.
//
InterlockedExchangeAdd((PLONG)&Prcb->RequestSummary, -(IPI_FREEZE));
KiFreezeTargetExecution(NULL, NULL);
} else {
//
// No freeze pending, assume this processor is spinning.
//
KeYieldProcessor();
}
}
开发者ID:conioh,项目名称:os-design,代码行数:51,代码来源:debug.c
注:本文中的KeGetCurrentPrcb函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论