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 00005 Module Name: 00006 00007 xxmpipi.c 00008 00009 Abstract: 00010 00011 This module implements PowerPC specific MP routine. 00012 00013 Author: 00014 00015 Pat Carr 15-Aug-1994 00016 00017 Based on MIPS version authored by: 00018 00019 David N. Cutler 24-Apr-1993 00020 00021 Environment: 00022 00023 Kernel mode only. 00024 00025 Revision History: 00026 00027 --*/ 00028 00029 #include "ki.h" 00030 00031 // 00032 // Define forward reference function prototypes. 00033 // 00034 00035 VOID 00036 KiRestoreProcessorControlState ( 00037 IN PKPROCESSOR_STATE ProcessorState 00038 ); 00039 00040 VOID 00041 KiSaveProcessorControlState ( 00042 IN PKPROCESSOR_STATE ProcessorState 00043 ); 00044 00045 VOID 00046 KiRestoreProcessorState ( 00047 IN PKTRAP_FRAME TrapFrame, 00048 IN PKEXCEPTION_FRAME ExceptionFrame 00049 ) 00050 00051 /*++ 00052 00053 Routine Description: 00054 00055 This function moves processor register state from the current 00056 processor context structure in the processor block to the 00057 specified trap and exception frames. 00058 00059 Arguments: 00060 00061 TrapFrame - Supplies a pointer to a trap frame. 00062 00063 ExceptionFrame - Supplies a pointer to an exception frame. 00064 00065 Return Value: 00066 00067 None. 00068 00069 --*/ 00070 00071 { 00072 00073 PKPRCB Prcb; 00074 00075 // 00076 // Get the address of the current processor block and move the 00077 // specified register state from the processor context structure 00078 // to the specified trap and exception frames 00079 // 00080 Prcb = KeGetCurrentPrcb(); 00081 00082 #if !defined(NT_UP) 00083 00084 KeContextToKframes(TrapFrame, 00085 ExceptionFrame, 00086 &Prcb->ProcessorState.ContextFrame, 00087 CONTEXT_FULL, 00088 KernelMode); 00089 00090 #endif 00091 00092 // 00093 // Restore the current processor control state. 00094 // Currently, the primary use is to allow the kernel 00095 // debugger to set hardware debug registers. Still 00096 // investigating whether this is required for MP systems. 00097 // 00098 00099 KiRestoreProcessorControlState(&Prcb->ProcessorState); 00100 return; 00101 } 00102 00103 VOID 00104 KiSaveProcessorState ( 00105 IN PKTRAP_FRAME TrapFrame, 00106 IN PKEXCEPTION_FRAME ExceptionFrame 00107 ) 00108 00109 /*++ 00110 00111 Routine Description: 00112 00113 This function moves processor register state from the specified trap 00114 and exception frames to the processor context structure in the current 00115 processor block. 00116 00117 Arguments: 00118 00119 TrapFrame - Supplies a pointer to a trap frame. 00120 00121 ExceptionFrame - Supplies a pointer to an exception frame. 00122 00123 Return Value: 00124 00125 None. 00126 00127 --*/ 00128 00129 { 00130 00131 PKPRCB Prcb; 00132 00133 // 00134 // Get the address of the current processor block and move the 00135 // specified register state from specified trap and exception 00136 // frames to the current processor context structure. 00137 // 00138 00139 Prcb = KeGetCurrentPrcb(); 00140 Prcb->ProcessorState.ContextFrame.ContextFlags = CONTEXT_FULL | 00141 CONTEXT_DEBUG_REGISTERS; 00142 KeContextFromKframes(TrapFrame, 00143 ExceptionFrame, 00144 &Prcb->ProcessorState.ContextFrame); 00145 00146 // 00147 // Save the current processor control state. 00148 // 00149 Prcb->ProcessorState.SpecialRegisters.KernelDr6 = 00150 Prcb->ProcessorState.ContextFrame.Dr6; 00151 KiSaveProcessorControlState(&Prcb->ProcessorState); 00152 return; 00153 } 00154 00155 BOOLEAN 00156 KiIpiServiceRoutine ( 00157 IN PKTRAP_FRAME TrapFrame, 00158 IN PKEXCEPTION_FRAME ExceptionFrame 00159 ) 00160 00161 /*++ 00162 00163 Routine Description: 00164 00165 00166 This function is called at IPI_LEVEL to process any outstanding 00167 interprocess request for the current processor. 00168 00169 Arguments: 00170 00171 TrapFrame - Supplies a pointer to a trap frame. 00172 00173 ExceptionFrame - Supplies a pointer to an exception frame 00174 00175 Return Value: 00176 00177 A value of TRUE is returned, if one of more requests were service. 00178 Otherwise, FALSE is returned. 00179 00180 --*/ 00181 00182 { 00183 00184 ULONG RequestSummary; 00185 00186 // 00187 // Process any outstanding interprocessor requests. 00188 // 00189 00190 RequestSummary = KiIpiProcessRequests(); 00191 00192 // 00193 // If freeze is requested, then freeze target execution. 00194 // 00195 00196 if ((RequestSummary & IPI_FREEZE) != 0) { 00197 KiFreezeTargetExecution(TrapFrame, ExceptionFrame); 00198 } 00199 00200 // 00201 // Return whether any requests were processed. 00202 // 00203 00204 return (RequestSummary & ~IPI_FREEZE) != 0; 00205 }

Generated on Sat May 15 19:40:32 2004 for test by doxygen 1.3.7