Exemple #1
0
VOID
KiIpiGenericCallTarget (
    IN PKIPI_CONTEXT SignalDone,
    IN PVOID BroadcastFunction,
    IN PVOID Context,
    IN PVOID Parameter3
    )

/*++

Routine Description:

    This function is the target jacket function to execute a broadcast
    function on a set of target processors. The broadcast packet address
    is obtained, the specified parameters are captured, the broadcast
    packet address is cleared to signal the source processor to continue,
    and the specified function is executed.

Arguments:

    SignalDone Supplies a pointer to a variable that is cleared when the
        requested operation has been performed.

    BroadcastFunction - Supplies the address of function that is executed
        on each of the target processors.

    Context - Supplies the value of the context parameter that is passed
        to each function.

    Parameter3 - Not used.

Return Value:

    None

--*/

{

    //
    // Execute the specified function.
    //

    ((PKIPI_BROADCAST_WORKER)(BroadcastFunction))((ULONG_PTR)Context);
    KiIpiSignalPacketDone(SignalDone);
    return;
}
Exemple #2
0
VOID
KiCalibratePerformanceCounterTarget (
    IN PULONG SignalDone,
    IN PVOID Count,
    IN PVOID Parameter2,
    IN PVOID Parameter3
    )

/*++

Routine Description:

    This is the target function for reseting the performance counter.

Arguments:

    SignalDone - Supplies a pointer to a variable that is cleared when the
        requested operation has been performed.

    Count - Supplies a pointer to the number of processors in the host
        configuration.

    Parameter2 - Parameter3 - Not used.

Return Value:

    None.

--*/

{

    //
    // Reset and synchronize the perfromance counter on the current processor
    // and clear the reset performance counter address to signal the source to
    // continue.
    //

#if !defined(NT_UP)

    HalCalibratePerformanceCounter((volatile PLONG)Count);
    KiIpiSignalPacketDone(SignalDone);

#endif

    return;
}
Exemple #3
0
VOID
KiFlushEntireTbTarget (
    IN PULONG SignalDone,
    IN PVOID Parameter1,
    IN PVOID Parameter2,
    IN PVOID Parameter3
    )

/*++

Routine Description:

    This is the target function for flushing the entire TB.

Arguments:

    SignalDone Supplies a pointer to a variable that is cleared when the
        requested operation has been performed.

    Parameter1 - Parameter3 - Not used.

Return Value:

    None.

--*/

{

#if !defined(NT_UP)

    //
    // Flush the entire TB on the current processor.
    //

    KiIpiSignalPacketDone(SignalDone);

    KeFlushCurrentTb();

#endif

    return;
}
Exemple #4
0
VOID
KiSetIoMap(
    IN PKIPI_CONTEXT SignalDone,
    IN PVOID MapSource,
    IN PVOID MapNumber,
    IN PVOID Parameter3
    )
/*++

Routine Description:

    copy the specified map into this processor's TSS.
    This procedure runs at IPI level.

Arguments:

    Argument - actually a pointer to a KIPI_SET_IOPM structure
    ReadyFlag - pointer to flag to set once setiopm has completed

Return Value:

    none

--*/

{

    PKPROCESS CurrentProcess;
    PKPRCB Prcb;
    PVOID pt;

    //
    // Copy the IOPM map and load the map for the current process.
    //

    Prcb = KeGetCurrentPrcb();
    pt = &(KiPcr()->TSS->IoMaps[((ULONG) MapNumber)-1].IoMap);
    RtlMoveMemory(pt, MapSource, IOPM_SIZE);
    CurrentProcess = Prcb->CurrentThread->ApcState.Process;
    KiPcr()->TSS->IoMapBase = CurrentProcess->IopmOffset;
    KiIpiSignalPacketDone(SignalDone);
    return;
}
Exemple #5
0
VOID
KiLoadIopmOffset(
    IN PKIPI_CONTEXT SignalDone,
    IN PVOID Parameter1,
    IN PVOID Parameter2,
    IN PVOID Parameter3
    )

/*++

Routine Description:

    Edit IopmBase of Tss to match that of currently running process.

Arguments:

    Argument - actually a pointer to a KIPI_LOAD_IOPM_OFFSET structure
    ReadyFlag - Pointer to flag to be set once we are done

Return Value:

    none

--*/

{

    PKPROCESS CurrentProcess;
    PKPRCB Prcb;

    //
    // Update IOPM field in TSS from current process
    //

    Prcb = KeGetCurrentPrcb();
    CurrentProcess = Prcb->CurrentThread->ApcState.Process;
    KiPcr()->TSS->IoMapBase = CurrentProcess->IopmOffset;
    KiIpiSignalPacketDone(SignalDone);
    return;
}
Exemple #6
0
VOID
KiSyncSessionTarget(
    IN PULONG SignalDone,
    IN PKPROCESS Process,
    IN PVOID Parameter1,
    IN PVOID Parameter2
    )
/*++

 Routine Description:

    This is the target function for synchronizing the new session 
    region id.  This routine is called when the session space is removed 
    and all the processors need to be notified.

 Arguments:

    SignalDone - Supplies a pointer to a variable that is cleared when the
        requested operation has been performed.

    Process - Supplies a KPROCESS pointer which needs to be sync'ed.

 Return Value:

    None.

 Environment:

    Kernel mode.

--*/
{
#if !defined(NT_UP)

    PKTHREAD Thread;
    ULONG NewRid;
 
    //
    // Flush the entire TB on the current processor.
    //

    Thread = KeGetCurrentThread();

    //
    // check to see if the current process is the process that needs to be 
    // sync'ed
    //

    if (Process == Thread->ApcState.Process) {
        
        KiAcquireSpinLock(&KiMasterRidLock);

        //
        // disable the session region.
        //

        KiSetRegionRegister((PVOID)MM_SESSION_SPACE_DEFAULT, 
                            KiMakeValidRegionRegister(Process->SessionMapInfo->RegionId, PAGE_SHIFT));

        KiReleaseSpinLock(&KiMasterRidLock);

        //
        // flush the entire tb.
        //

        KeFlushCurrentTb();
    }

    KiIpiSignalPacketDone(SignalDone);

#endif
    return;
}
Exemple #7
0
VOID
KiSyncNewRegionIdTarget (
    IN PULONG SignalDone,
    IN PVOID Parameter1,
    IN PVOID Parameter2,
    IN PVOID Parameter3
    )

/*++

Routine Description:

    This is the target function for synchronizing the region Ids

Arguments:

    SignalDone Supplies a pointer to a variable that is cleared when the
        requested operation has been performed.

    Parameter1 - Parameter3 - Not used.

Return Value:

    None.

--*/

{
#if !defined(NT_UP)

    PKTHREAD Thread;
    PKPROCESS Process;
    PREGION_MAP_INFO ProcessRegion;
    PREGION_MAP_INFO MappedSession;
    ULONG NewRid;
 
    //
    // Flush the entire TB on the current processor.
    //

    Thread = KeGetCurrentThread();
    Process = Thread->ApcState.Process;
    ProcessRegion = &Process->ProcessRegion;
    MappedSession = Process->SessionMapInfo;

    KiAcquireSpinLock(&KiMasterRidLock);

    if (ProcessRegion->SequenceNumber != KiMasterSequence) {
        
        KiMasterRid += 1;

        ProcessRegion->RegionId = KiMasterRid;
        ProcessRegion->SequenceNumber = KiMasterSequence;

        KiSetRegionRegister(MM_LOWEST_USER_ADDRESS,
            KiMakeValidRegionRegister(ProcessRegion->RegionId, PAGE_SHIFT));

    }

    if (MappedSession->SequenceNumber != KiMasterSequence) {

        KiMasterRid += 1;
        
        MappedSession->RegionId = KiMasterRid;
        MappedSession->SequenceNumber = KiMasterSequence;

        KiSetRegionRegister((PVOID)MM_SESSION_SPACE_DEFAULT,
            KiMakeValidRegionRegister(MappedSession->RegionId, PAGE_SHIFT));
    }


    KiReleaseSpinLock(&KiMasterRidLock);

    KiIpiSignalPacketDone(SignalDone);

    KeFlushCurrentTb();

#endif
    return;
}
Exemple #8
0
VOID
KiIpiGenericCallTarget (
    IN PKIPI_CONTEXT SignalDone,
    IN PVOID BroadcastFunction,
    IN PVOID Context,
    IN PVOID Count
    )

/*++

Routine Description:

    This function is the target jacket function to execute a broadcast
    function on a set of target processors. The broadcast packet address
    is obtained, the specified parameters are captured, the broadcast
    packet address is cleared to signal the source processor to continue,
    and the specified function is executed.

Arguments:

    SignalDone Supplies a pointer to a variable that is cleared when the
        requested operation has been performed.

    BroadcastFunction - Supplies the address of function that is executed
        on each of the target processors.

    Context - Supplies the value of the context parameter that is passed
        to each function.

    Count - Supplies the address of a down count synchronization variable.

Return Value:

    None

--*/

{

    //
    // Decrement the synchronization count variable and wait for the value
    // to go to zero.
    //

    InterlockedDecrement((volatile LONG *)Count);
    while ((*(volatile LONG *)Count) != 0) {
        
        //
        // Check for any other IPI such as the debugger
        // while we wait.  Note this routine does a YEILD.
        //

        KiPollFreezeExecution();
    }

    //
    // Execute the specified function.
    //

    ((PKIPI_BROADCAST_WORKER)(ULONG_PTR)(BroadcastFunction))((ULONG_PTR)Context);
    KiIpiSignalPacketDone(SignalDone);
    return;
}