当前位置: 首页>>代码示例>>C++>>正文


C++ KeGetCurrentPrcb函数代码示例

本文整理汇总了C++中KeGetCurrentPrcb函数的典型用法代码示例。如果您正苦于以下问题:C++ KeGetCurrentPrcb函数的具体用法?C++ KeGetCurrentPrcb怎么用?C++ KeGetCurrentPrcb使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了KeGetCurrentPrcb函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的KeGetCurrentPrcb函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。