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

intsupc.c

Go to the documentation of this file.
00001 /*++ 00002 00003 Copyright (c) 1993 Microsoft Corporation 00004 Copyright (c) 1998 Intel Corporation 00005 00006 Module Name: 00007 00008 intsupc.c 00009 00010 Abstract: 00011 00012 This module implements ruotines for interrupt support. 00013 00014 Author: 00015 00016 Bernard Lint 5-May-1998 00017 00018 Environment: 00019 00020 Kernel mode only. 00021 00022 Revision History: 00023 00024 --*/ 00025 00026 #include "ki.h" 00027 00028 VOID 00029 KiLowerIrqlSpecial(KIRQL); 00030 00031 VOID 00032 KiDispatchSoftwareInterrupt ( 00033 KIRQL Irql 00034 ) 00035 00036 /*++ 00037 00038 Routine Description: 00039 00040 Dispatch pending software interrupt 00041 00042 Arguments: 00043 00044 Irql (a0) - Software interrupt to dispatch 00045 00046 Return Value: 00047 00048 None. 00049 00050 Notes: 00051 00052 Interrupts disabled on entry/return. 00053 The function is only called by KiCheckForSoftwareInterrupt that passes an 00054 Irql value of APC_LEVEL or DISPATCH_LEVEL. 00055 00056 00057 --*/ 00058 00059 { 00060 PKPRCB Prcb = KeGetCurrentPrcb(); 00061 00062 KiLowerIrqlSpecial(Irql); // set IRQL 00063 00064 if (Irql == APC_LEVEL) { 00065 00066 Prcb->ApcBypassCount += 1; 00067 PCR->ApcInterrupt = 0; 00068 00069 _enable(); 00070 00071 // 00072 // Dispatch APC Interrupt via direct call to KiDeliverApc 00073 // 00074 00075 KiDeliverApc(KernelMode,NULL,NULL); 00076 00077 _disable(); 00078 00079 } else { 00080 00081 Prcb->DpcBypassCount += 1; 00082 PCR->DispatchInterrupt = 0; 00083 00084 _enable(); 00085 00086 // 00087 // Dispatch DPC Interrupt 00088 // 00089 00090 KiDispatchInterrupt(); 00091 00092 _disable(); 00093 00094 } 00095 } 00096 00097 VOID 00098 KiCheckForSoftwareInterrupt ( 00099 KIRQL RequestIrql 00100 ) 00101 00102 /*++ 00103 00104 Routine Description: 00105 00106 Check for and dispatch pending software interrupts 00107 00108 Arguments: 00109 00110 Irql (a0) - New, lower IRQL 00111 00112 Return Value: 00113 00114 None. 00115 00116 Notes: 00117 00118 Caller must check IRQL has dropped below s/w IRQL level 00119 00120 --*/ 00121 00122 { 00123 BOOLEAN InterruptState; 00124 00125 InterruptState = KiDisableInterrupts(); 00126 00127 if (RequestIrql == APC_LEVEL) { 00128 00129 // 00130 // Dispatch only DPC requests 00131 // 00132 00133 while (PCR->DispatchInterrupt) { 00134 KiDispatchSoftwareInterrupt(DISPATCH_LEVEL); 00135 } 00136 00137 } else { 00138 00139 // 00140 // Dispatch either APC or DPC 00141 // 00142 00143 while (PCR->SoftwareInterruptPending) { 00144 KIRQL Irql; 00145 00146 if (PCR->DispatchInterrupt) { 00147 Irql = DISPATCH_LEVEL; 00148 } else if (PCR->ApcInterrupt) { 00149 Irql = APC_LEVEL; 00150 } 00151 KiDispatchSoftwareInterrupt(Irql); 00152 } 00153 } 00154 00155 KiRestoreInterrupts(InterruptState); 00156 } 00157 00158 VOID 00159 KiRequestSoftwareInterrupt ( 00160 KIRQL RequestIrql 00161 ) 00162 00163 /*++ 00164 00165 Routine Description: 00166 00167 This function requests a software interrupt at the specified IRQL 00168 level. 00169 00170 Arguments: 00171 00172 RequestIrql (a0) - Supplies the request IRQL value. 00173 00174 Return Value: 00175 00176 None. 00177 00178 --*/ 00179 00180 { 00181 #if DEBUG 00182 if ((RequestIrql < APC_LEVEL) || (RequestIrql > DISPATCH_LEVEL)) 00183 KeBugCheckEx(INVALID_SOFTWARE_INTERRUPT, RequestIrql, 0, 0, 0); 00184 #endif 00185 ((PUCHAR)&PCR->SoftwareInterruptPending)[RequestIrql-APC_LEVEL] = 1; 00186 }

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