*TSignalPtr = '\0';
}
\r
+/**\r
+ FIQ state is only changed by FIQ exception. We don't want to take FIQ\r
+ ticks in the GDB stub. The stub disables FIQ on entry, but this is the \r
+ third instruction that executes in the execption handler. Thus we have\r
+ a crack we need to test for.\r
+\r
+ @param PC PC of execption\r
+\r
+ @return TRUE We are in the GDB stub exception preamble \r
+ @return FALSE We are not in GDB stub code\r
+ **/
+BOOLEAN
+InFiqCrack (
+ IN UINT32 PC
+ )
+{
+ UINT32 VectorBase = PcdGet32 (PcdCpuVectorBaseAddress);
+ UINT32 Length = (UINTN)ExceptionHandlersEnd - (UINTN)ExceptionHandlersStart;
+
+ if ((PC >= VectorBase) && (PC <= (VectorBase + Length))) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+\r
+\r
/**\r
Check to see if this exception is related to ctrl-c handling.\r
\r
IN OUT EFI_SYSTEM_CONTEXT SystemContext \r
)\r
{\r
+ CHAR8 Char;\r
BOOLEAN Return = TRUE;\r
\r
if (ExceptionType != EXCEPT_ARM_FIQ) {\r
return FALSE;\r
}\r
\r
+ if (InFiqCrack (SystemContext.SystemContextArm->PC)) {\r
+ // We are in our own interrupt preable, so skip this tick.\r
+ // We never want to let gdb see the debug stub running if we can help it\r
+ return FALSE;\r
+ }\r
+\r
while (TRUE) {
if (!GdbIsCharAvailable ()) {
//
break;
}
- if (GdbGetChar () == 0x03) {
+ Char = GdbGetChar ();
+ if (Char == 0x03) {
//
// We have a ctrl-c so exit and process exception for ctrl-c
//
\r
@param[in] EnableStatus Enable/Disable.\r
\r
- @return FALSE always.\r
+ @retval TRUE Debug timer interrupt were enabled on entry to this call.\r
+ @retval FALSE Debug timer interrupt were disabled on entry to this call.\r
\r
**/\r
BOOLEAN\r
FiqEnabled = ArmGetFiqState ();\r
\r
if (EnableStatus) {\r
- DebugAgentTimerSetPeriod (100);\r
+ DebugAgentTimerSetPeriod (PcdGet32 (PcdGdbTimerPeriodMilliseconds));\r
ArmEnableFiq ();\r
} else {\r
DebugAgentTimerSetPeriod (0);\r
return FiqEnabled;\r
}\r
\r
+\r
+\r
VOID\r
GdbFPutString (\r
IN CHAR8 *String\r
UINTN Offset;\r
UINTN Length;\r
BOOLEAN IrqEnabled;\r
- BOOLEAN FiqEnabled;\r
UINT32 *VectorBase;\r
\r
-
+
//\r
// Disable interrupts\r
//\r
IrqEnabled = ArmGetInterruptState ();\r
ArmDisableInterrupts ();\r
-\r
- //\r
- // EFI does not use the FIQ, but a debugger might so we must disable \r
- // as we take over the exception vectors. \r
- //\r
- FiqEnabled = ArmGetFiqState ();\r
ArmDisableFiq ();\r
\r
//\r
// Flush Caches since we updated executable stuff\r
InvalidateInstructionCacheRange ((VOID *)PcdGet32(PcdCpuVectorBaseAddress), Length);\r
\r
+ // setup a timer so gdb can break in via ctrl-c\r
DebugAgentTimerIntialize ();\r
\r
- if (FiqEnabled) {\r
- ArmEnableFiq ();\r
- }\r
-\r
if (IrqEnabled) {\r
ArmEnableInterrupts ();\r
}\r