test: ipi.c Source File

Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

# ipi.c

Go to the documentation of this file.

    00001 /*++
    00002
    00003 Copyright (c) 1993  Microsoft Corporation
    00004 Copyright (c) 1993  Digital Equipment Corporation
    00005
    00006 Module Name:
    00007
    00008     ipi.c
    00009
    00010 Abstract:
    00011
    00012     This module implement Alpha AXP - specific interprocessor interrupt
    00013     routines.
    00014
    00015 Author:
    00016
    00017     David N. Cutler 24-Apr-1993
    00018     Joe Notarangelo  29-Nov-1993
    00019
    00020 Environment:
    00021
    00022     Kernel mode only.
    00023
    00024 Revision History:
    00025
    00026 --*/
    00027
    00028 #include "ki.h"
    00029
    00030 VOID
    00031 KiRestoreProcessorState (
    00032     IN PKTRAP_FRAME TrapFrame,
    00033     IN PKEXCEPTION_FRAME ExceptionFrame
    00034     )
    00035
    00036 /*++
    00037
    00038 Routine Description:
    00039
    00040     This function moves processor register state from the current
    00041     processor context structure in the processor block to the
    00042     specified trap and exception frames.
    00043
    00044 Arguments:
    00045
    00046     TrapFrame - Supplies a pointer to a trap frame.
    00047
    00048     ExceptionFrame - Supplies a pointer to an exception frame.
    00049
    00050 Return Value:
    00051
    00052     None.
    00053
    00054 --*/
    00055
    00056 {
    00057
    00058     PKPRCB Prcb;
    00059
    00060     //
    00061     // Get the address of the current processor block and move the
    00062     // specified register state from the processor context structure
    00063     // to the specified trap and exception frames
    00064     //
    00065
    00066 #if !defined(NT_UP)
    00067
    00068     Prcb = KeGetCurrentPrcb();
    00069     KeContextToKframes(TrapFrame,
    00070                        ExceptionFrame,
    00071                        &Prcb->ProcessorState.ContextFrame,
    00072                        CONTEXT_FULL,
    00073                        KernelMode);
    00074
    00075 #endif
    00076
    00077     return;
    00078 }
    00079
    00080 VOID
    00081 KiSaveProcessorState (
    00082     IN PKTRAP_FRAME TrapFrame,
    00083     IN PKEXCEPTION_FRAME ExceptionFrame
    00084     )
    00085
    00086 /*++
    00087
    00088 Routine Description:
    00089
    00090     This function moves processor register state from the specified trap
    00091     and exception frames to the processor context structure in the current
    00092     processor block.
    00093
    00094 Arguments:
    00095
    00096     TrapFrame - Supplies a pointer to a trap frame.
    00097
    00098     ExceptionFrame - Supplies a pointer to an exception frame.
    00099
    00100 Return Value:
    00101
    00102     None.
    00103
    00104 --*/
    00105
    00106 {
    00107
    00108     PKPRCB Prcb;
    00109
    00110     //
    00111     // Get the address of the current processor block and move the
    00112     // specified register state from specified trap and exception
    00113     // frames to the current processor context structure.
    00114     //
    00115
    00116 #if !defined(NT_UP)
    00117
    00118     Prcb = KeGetCurrentPrcb();
    00119     Prcb->ProcessorState.ContextFrame.ContextFlags = CONTEXT_FULL;
    00120     KeContextFromKframes(TrapFrame,
    00121                          ExceptionFrame,
    00122                          &Prcb->ProcessorState.ContextFrame);
    00123
    00124 #endif
    00125
    00126     return;
    00127 }
    00128
    00129 BOOLEAN
    00130 KiIpiServiceRoutine (
    00131     IN PKTRAP_FRAME TrapFrame,
    00132     IN PKEXCEPTION_FRAME ExceptionFrame
    00133     )
    00134
    00135 /*++
    00136
    00137 Routine Description:
    00138
    00139
    00140     This function is called at IPI_LEVEL to process any outstanding
    00141     interprocess request for the current processor.
    00142
    00143 Arguments:
    00144
    00145     TrapFrame - Supplies a pointer to a trap frame.
    00146
    00147     ExceptionFrame - Supplies a pointer to an exception frame
    00148
    00149 Return Value:
    00150
    00151     A value of TRUE is returned, if one of more requests were service.
    00152     Otherwise, FALSE is returned.
    00153
    00154 --*/
    00155
    00156 {
    00157
    00158     ULONG RequestSummary;
    00159
    00160     //
    00161     // Process any outstanding interprocessor requests.
    00162     //
    00163
    00164     RequestSummary = KiIpiProcessRequests();
    00165
    00166     //
    00167     // If freeze is requested, then freeze target execution.
    00168     //
    00169
    00170     if ((RequestSummary & IPI_FREEZE) != 0) {
    00171         KiFreezeTargetExecution(TrapFrame, ExceptionFrame);
    00172     }
    00173
    00174     //
    00175     // Return whether any requests were processed.
    00176     //
    00177
    00178     return (RequestSummary & ~IPI_FREEZE) != 0;
    00179 }