/** @file\r
Processor specific parts of the GDB stub\r
\r
- Copyright (c) 2008-2009, Apple Inc. All rights reserved.\r
+ Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
\r
- All rights reserved. This program and the accompanying materials\r
+ This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
http://opensource.org/licenses/bsd-license.php\r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
-**/\r
-/** @file\r
- \r
- Copyright (c) 2008, Apple, Inc \r
- All rights reserved. This program and the accompanying materials \r
- are licensed and made available under the terms and conditions of the BSD License \r
- which accompanies this distribution. The full text of the license may be found at \r
- http://opensource.org/licenses/bsd-license.php \r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
-\r
**/\r
\r
#include <GdbStubInternal.h>\r
0x00000F72,\r
0x00000F73,\r
0x00000FFF, // fps\r
- 0x00000FFF, \r
- 0x00000FFF, \r
OFFSET_OF(EFI_SYSTEM_CONTEXT_ARM, CPSR)\r
};\r
\r
VOID\r
)\r
{\r
- return sizeof (gExceptionType)/sizeof (EFI_EXCEPTION_TYPE_ENTRY);\r
+ return sizeof (gExceptionType) / sizeof (EFI_EXCEPTION_TYPE_ENTRY);\r
}\r
\r
\r
VOID\r
)\r
{\r
- return sizeof (gRegisterOffsets)/sizeof (UINTN);\r
+ return sizeof (gRegisterOffsets) / sizeof (UINTN);\r
}\r
\r
\r
@retval the pointer to the RegNumber-th pointer\r
**/ \r
UINTN *\r
-FindPointerToRegister(\r
+FindPointerToRegister (\r
IN EFI_SYSTEM_CONTEXT SystemContext,\r
IN UINTN RegNumber \r
)\r
CHAR8 Char;\r
\r
if (gRegisterOffsets[RegNumber] > 0xF00) {\r
- AsciiSPrint(OutBufPtr, 9, "00000000");\r
+ AsciiSPrint (OutBufPtr, 9, "00000000");\r
OutBufPtr += 8;\r
return OutBufPtr;\r
}\r
\r
RegSize = 0;\r
while (RegSize < 32) {\r
- Char = mHexToStr[(UINT8)((*FindPointerToRegister(SystemContext, RegNumber) >> (RegSize+4)) & 0xf)];\r
+ Char = mHexToStr[(UINT8)((*FindPointerToRegister (SystemContext, RegNumber) >> (RegSize+4)) & 0xf)];\r
if ((Char >= 'A') && (Char <= 'F')) {\r
Char = Char - 'A' + 'a';\r
}\r
*OutBufPtr++ = Char;\r
\r
- Char = mHexToStr[(UINT8)((*FindPointerToRegister(SystemContext, RegNumber) >> RegSize) & 0xf)];\r
+ Char = mHexToStr[(UINT8)((*FindPointerToRegister (SystemContext, RegNumber) >> RegSize) & 0xf)];\r
if ((Char >= 'A') && (Char <= 'F')) {\r
Char = Char - 'A' + 'a';\r
}\r
}\r
\r
\r
-/** ‘p n’ \r
+/**\r
Reads the n-th register's value into an output buffer and sends it as a packet \r
@param SystemContext Register content at time of the exception\r
@param InBuffer Pointer to the input buffer received from gdb server\r
\r
RegNumber = AsciiStrHexToUintn (&InBuffer[1]);\r
\r
- if (RegNumber >= MaxRegisterCount()) {\r
+ if (RegNumber >= MaxRegisterCount ()) {\r
SendError (GDB_EINVALIDREGNUM); \r
return;\r
}\r
OutBufPtr = BasicReadRegister (SystemContext, RegNumber, OutBufPtr);\r
\r
*OutBufPtr = '\0'; // the end of the buffer\r
- SendPacket(OutBuffer);\r
+ SendPacket (OutBuffer);\r
}\r
\r
\r
-/** ‘g’ \r
+/**\r
Reads the general registers into an output buffer and sends it as a packet \r
@param SystemContext Register content at time of the exception\r
**/\r
UINTN Index;\r
CHAR8 *OutBuffer;\r
CHAR8 *OutBufPtr;\r
- UINTN RegisterCount = MaxRegisterCount();\r
+ UINTN RegisterCount = MaxRegisterCount ();\r
\r
// It is not safe to allocate pool here....\r
- OutBuffer = AllocatePool((RegisterCount * 8) + 1); // 8 bytes per register in string format plus a null to terminate\r
+ OutBuffer = AllocatePool ((RegisterCount * 8) + 1); // 8 bytes per register in string format plus a null to terminate\r
OutBufPtr = OutBuffer;\r
for (Index = 0; Index < RegisterCount; Index++) {\r
OutBufPtr = BasicReadRegister (SystemContext, Index, OutBufPtr);\r
}\r
\r
*OutBufPtr = '\0';\r
- SendPacket(OutBuffer);\r
- FreePool(OutBuffer);\r
+ SendPacket (OutBuffer);\r
+ FreePool (OutBuffer);\r
}\r
\r
\r
NewValue = 0;\r
RegSize = 0;\r
while (RegSize < 32) {\r
- TempValue = HexCharToInt(*InBufPtr++);\r
+ TempValue = HexCharToInt (*InBufPtr++);\r
\r
if ((INTN)TempValue < 0) {\r
SendError (GDB_EBADMEMDATA); \r
}\r
\r
NewValue += (TempValue << (RegSize+4));\r
- TempValue = HexCharToInt(*InBufPtr++);\r
+ TempValue = HexCharToInt (*InBufPtr++);\r
\r
if ((INTN)TempValue < 0) {\r
SendError (GDB_EBADMEMDATA); \r
NewValue += (TempValue << RegSize); \r
RegSize = RegSize + 8;\r
}\r
- *(FindPointerToRegister(SystemContext, RegNumber)) = NewValue;\r
+ *(FindPointerToRegister (SystemContext, RegNumber)) = NewValue;\r
return InBufPtr;\r
}\r
\r
RegNumber = AsciiStrHexToUintn (RegNumBuffer); \r
\r
// check if this is a valid Register Number\r
- if (RegNumber >= MaxRegisterCount()) {\r
+ if (RegNumber >= MaxRegisterCount ()) {\r
SendError (GDB_EINVALIDREGNUM); \r
return;\r
}\r
UINTN i;\r
CHAR8 *InBufPtr; /// pointer to the input buffer\r
UINTN MinLength;\r
- UINTN RegisterCount = MaxRegisterCount();\r
+ UINTN RegisterCount = MaxRegisterCount ();\r
\r
MinLength = (RegisterCount * 8) + 1; // 'G' plus the registers in ASCII format\r
\r
- if (AsciiStrLen(InBuffer) < MinLength) {\r
+ if (AsciiStrLen (InBuffer) < MinLength) {\r
//Bad message. Message is not the right length \r
SendError (GDB_EBADBUFSIZE); \r
return;\r
\r
// Read the new values for the registers from the input buffer to an array, NewValueArray.\r
// The values in the array are in the gdb ordering\r
- for(i = 0; i < RegisterCount; i++) {\r
+ for (i = 0; i < RegisterCount; i++) {\r
InBufPtr = BasicWriteRegister (SystemContext, i, InBufPtr);\r
}\r
\r
mSingleStepActive = FALSE;\r
}\r
\r
- InvalidateInstructionCacheRange((VOID *)mSingleStepPC, mSingleStepDataSize);\r
+ InvalidateInstructionCacheRange ((VOID *)mSingleStepPC, mSingleStepDataSize);\r
//DEBUG((EFI_D_ERROR, "AddSingleStep at 0x%08x (was: 0x%08x is:0x%08x)\n", SystemContext.SystemContextArm->PC, mSingleStepData, *(UINT32 *)mSingleStepPC));\r
}\r
\r
//DEBUG((EFI_D_ERROR, "RemoveSingleStep at 0x%08x (was: 0x%08x is:0x%08x)\n", SystemContext.SystemContextArm->PC, *(UINT32 *)mSingleStepPC, mSingleStepData));\r
*(UINT32 *)mSingleStepPC = mSingleStepData;\r
}\r
- InvalidateInstructionCacheRange((VOID *)mSingleStepPC, mSingleStepDataSize);\r
+ InvalidateInstructionCacheRange ((VOID *)mSingleStepPC, mSingleStepDataSize);\r
mSingleStepActive = FALSE;\r
}\r
\r
\r
\r
-/** ‘c [addr ]’ \r
+/**\r
Continue. addr is Address to resume. If addr is omitted, resume at current \r
Address.\r
\r
)\r
{\r
if (PacketData[1] != '\0') {\r
- SystemContext.SystemContextArm->PC = AsciiStrHexToUintn(&PacketData[1]);\r
+ SystemContext.SystemContextArm->PC = AsciiStrHexToUintn (&PacketData[1]);\r
} \r
}\r
\r
IN CHAR8 *PacketData\r
)\r
{\r
- SendNotSupported();\r
+ SendNotSupported ();\r
}\r
\r
UINTN\r
LIST_ENTRY *Current;\r
ARM_SOFTWARE_BREAKPOINT *Breakpoint;\r
\r
- Current = GetFirstNode(&BreakpointList);\r
- while (!IsNull(&BreakpointList, Current)) {\r
+ Current = GetFirstNode (&BreakpointList);\r
+ while (!IsNull (&BreakpointList, Current)) {\r
Breakpoint = ARM_SOFTWARE_BREAKPOINT_FROM_LINK(Current);\r
\r
if (Address == Breakpoint->Address) {\r
return Breakpoint;\r
}\r
\r
- Current = GetNextNode(&BreakpointList, Current);\r
+ Current = GetNextNode (&BreakpointList, Current);\r
}\r
\r
return NULL;\r
{\r
ARM_SOFTWARE_BREAKPOINT *Breakpoint;\r
\r
- Breakpoint = SearchBreakpointList(Address);\r
+ Breakpoint = SearchBreakpointList (Address);\r
\r
if (Breakpoint != NULL) {\r
return;\r
}\r
\r
// create and fill breakpoint structure\r
- Breakpoint = AllocatePool(sizeof(ARM_SOFTWARE_BREAKPOINT));\r
+ Breakpoint = AllocatePool (sizeof(ARM_SOFTWARE_BREAKPOINT));\r
\r
Breakpoint->Signature = ARM_SOFTWARE_BREAKPOINT_SIGNATURE;\r
Breakpoint->Address = Address;\r
Breakpoint->Instruction = *(UINT32 *)Address;\r
\r
// Add it to the list\r
- InsertTailList(&BreakpointList, &Breakpoint->Link);\r
+ InsertTailList (&BreakpointList, &Breakpoint->Link);\r
\r
// Insert the software breakpoint\r
*(UINT32 *)Address = GDB_ARM_BKPT;\r
- InvalidateInstructionCacheRange((VOID *)Address, 4);\r
+ InvalidateInstructionCacheRange ((VOID *)Address, 4);\r
\r
//DEBUG((EFI_D_ERROR, "SetBreakpoint at 0x%08x (was: 0x%08x is:0x%08x)\n", Address, Breakpoint->Instruction, *(UINT32 *)Address));\r
}\r
{\r
ARM_SOFTWARE_BREAKPOINT *Breakpoint;\r
\r
- Breakpoint = SearchBreakpointList(Address);\r
+ Breakpoint = SearchBreakpointList (Address);\r
\r
if (Breakpoint == NULL) {\r
return;\r
}\r
\r
// Add it to the list\r
- RemoveEntryList(&Breakpoint->Link);\r
+ RemoveEntryList (&Breakpoint->Link);\r
\r
// Restore the original instruction\r
*(UINT32 *)Address = Breakpoint->Instruction;\r
- InvalidateInstructionCacheRange((VOID *)Address, 4);\r
+ InvalidateInstructionCacheRange ((VOID *)Address, 4);\r
\r
//DEBUG((EFI_D_ERROR, "ClearBreakpoint at 0x%08x (was: 0x%08x is:0x%08x)\n", Address, GDB_ARM_BKPT, *(UINT32 *)Address));\r
\r
- FreePool(Breakpoint);\r
+ FreePool (Breakpoint);\r
}\r
\r
VOID\r
UINTN Length;\r
UINTN ErrorCode;\r
\r
- ErrorCode = ParseBreakpointPacket(PacketData, &Type, &Address, &Length);\r
+ ErrorCode = ParseBreakpointPacket (PacketData, &Type, &Address, &Length);\r
if (ErrorCode > 0) {\r
SendError ((UINT8)ErrorCode);\r
return;\r
return;\r
}\r
\r
- SetBreakpoint(Address);\r
+ SetBreakpoint (Address);\r
\r
SendSuccess ();\r
}\r
return;\r
}\r
\r
- ClearBreakpoint(Address);\r
+ ClearBreakpoint (Address);\r
\r
SendSuccess ();\r
}\r
)\r
{\r
// Initialize breakpoint list\r
- InitializeListHead(&BreakpointList);\r
+ InitializeListHead (&BreakpointList);\r
}\r
\r
BOOLEAN\r