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

kdlock.c File Reference

#include "kdp.h"

Go to the source code of this file.

Functions

VOID KdpPortLock (VOID)
VOID KdpPortUnlock (VOID)
BOOLEAN KdPollBreakIn (VOID)
BOOLEAN KdpPollBreakInWithPortLock (VOID)


Function Documentation

BOOLEAN KdPollBreakIn VOID   ) 
 

Definition at line 93 of file 4/kdlock.c.

References CP_GET_SUCCESS, FALSE, HIGH_LEVEL, KdDebuggerEnabled, KdpControlCPending, KdpControlCPressed, KdpDebuggerLock, KdPortPollByte(), KdpPortUnlock(), KeLowerIrql(), KeRaiseIrql(), KiDisableInterrupts(), KiRestoreInterrupts(), KiTryToAcquireSpinLock(), Status, and TRUE.

Referenced by KiInitializeKernel().

00099 : 00100 00101 This procedure raises IRQL to high_level, seizes the Debug port 00102 spinlock, and checks to see if a breakin packet is pending. 00103 If a packet is present, return TRUE, else FALSE. 00104 00105 A packet is present if: 00106 00107 There is a valid character which matches BREAK_CHAR. 00108 00109 N.B. Interrupts must be OFF around this call 00110 00111 Return Value: 00112 00113 TRUE if breakin sequence present, caller should execute int-3. 00114 FALSE if no breakin seen. 00115 00116 --*/ 00117 00118 { 00119 BOOLEAN BreakIn; 00120 BOOLEAN Enable; 00121 UCHAR Input; 00122 KIRQL OldIrql; 00123 ULONG Status; 00124 00125 // 00126 // If the debugger is enabled, see if a breakin by the kernel 00127 // debugger is pending. 00128 // 00129 00130 BreakIn = FALSE; 00131 if (KdDebuggerEnabled != FALSE) { 00132 Enable = KiDisableInterrupts(); 00133 #ifndef _X86_ 00134 KeRaiseIrql(HIGH_LEVEL, &OldIrql); 00135 #endif 00136 if (KdpControlCPending != FALSE) { 00137 KdpControlCPressed = TRUE; 00138 BreakIn = TRUE; 00139 KdpControlCPending = FALSE; 00140 00141 } else { 00142 if (KiTryToAcquireSpinLock(&KdpDebuggerLock) != FALSE) { 00143 Status = KdPortPollByte(&Input); 00144 if ((Status == CP_GET_SUCCESS) && 00145 (Input == BREAKIN_PACKET_BYTE)) { 00146 BreakIn = TRUE; 00147 KdpControlCPressed = TRUE; 00148 } 00149 00150 KdpPortUnlock(); 00151 } 00152 } 00153 00154 #ifndef _X86_ 00155 KeLowerIrql(OldIrql); 00156 #endif 00157 KiRestoreInterrupts(Enable); 00158 } 00159 00160 return BreakIn; 00161 }

BOOLEAN KdpPollBreakInWithPortLock VOID   ) 
 

Definition at line 165 of file 4/kdlock.c.

References CP_GET_SUCCESS, FALSE, KdDebuggerEnabled, KdpControlCPending, KdPortPollByte(), Status, and TRUE.

Referenced by KdpPrintString().

00171 : 00172 00173 This procedure same as KdPollBreakIn, but assumes the caller 00174 already holds the port lock. Returns TRUE if a breakin packet 00175 is pending. 00176 00177 A packet is present if: 00178 00179 There is a valid character which matches BREAK_CHAR. 00180 00181 N.B. Interrupts must be OFF around this call 00182 00183 Return Value: 00184 00185 TRUE if breakin sequence present, caller should execute int-3. 00186 FALSE if no breakin seen. 00187 00188 --*/ 00189 00190 { 00191 00192 BOOLEAN BreakIn; 00193 BOOLEAN Enable; 00194 UCHAR Input; 00195 ULONG Status; 00196 00197 // 00198 // If the debugger is enabled, see if a breakin by the kernel 00199 // debugger is pending. 00200 // 00201 00202 BreakIn = FALSE; 00203 if (KdDebuggerEnabled != FALSE) { 00204 if (KdpControlCPending != FALSE) { 00205 BreakIn = TRUE; 00206 KdpControlCPending = FALSE; 00207 00208 } else { 00209 Status = KdPortPollByte(&Input); 00210 if ((Status == CP_GET_SUCCESS) && 00211 (Input == BREAKIN_PACKET_BYTE)) { 00212 BreakIn = TRUE; 00213 } 00214 } 00215 } 00216 00217 return BreakIn; 00218 } }

VOID KdpPortLock VOID   ) 
 

Definition at line 26 of file 4/kdlock.c.

References KdpDebuggerLock.

Referenced by KdDisableDebugger(), and KdEnableDebugger().

00032 : 00033 00034 Acquire the spinlock for the debug port. 00035 00036 Note that user must call this explicitly, the get/put routines 00037 do NOT make any use of the lock. 00038 00039 CALLER MUST HAVE SET PROPER IRQL BEFORE CALLING US. 00040 00041 We use KiAcquireSpinLock and NOT Ke... because our IRQL may 00042 be above DISPATCH_LEVEL. 00043 00044 Arguments: 00045 00046 None. 00047 00048 Return value: 00049 00050 None. 00051 00052 --*/ 00053 00054 { 00055 KiAcquireSpinLock(&KdpDebuggerLock); 00056 }

VOID KdpPortUnlock VOID   ) 
 

Definition at line 60 of file 4/kdlock.c.

References KdpDebuggerLock.

Referenced by KdDisableDebugger(), KdEnableDebugger(), KdExitDebugger(), and KdPollBreakIn().

00066 : 00067 00068 Release the spinlock for the debug port. 00069 00070 Note that user must call this explicitly, the get/put routines 00071 do NOT make any use of the lock. 00072 00073 CALLER MUST HAVE SET PROPER IRQL BEFORE CALLING US. 00074 00075 We use KiReleaseSpinLock and NOT Ke... because our IRQL may 00076 be above DISPATCH_LEVEL. 00077 00078 Arguments: 00079 00080 None. 00081 00082 Return value: 00083 00084 None. 00085 00086 --*/ 00087 00088 { 00089 KiReleaseSpinLock(&KdpDebuggerLock); 00090 }


Generated on Sat May 15 19:44:26 2004 for test by doxygen 1.3.7