19 { EXCEPT_ARM_SOFTWARE_INTERRUPT, GDB_SIGTRAP }
26UINTN gRegisterOffsets[] = {
94 return sizeof (gRegisterOffsets) /
sizeof (
UINTN);
131 ASSERT (gRegisterOffsets[RegNumber] < 0xF00);
132 TempPtr = ((UINT8 *)SystemContext.SystemContextArm) + gRegisterOffsets[RegNumber];
133 return (UINT32 *)TempPtr;
153 if (gRegisterOffsets[RegNumber] > 0xF00) {
160 while (RegSize < 32) {
162 if ((Char >=
'A') && (Char <=
'F')) {
163 Char = Char -
'A' +
'a';
169 if ((Char >=
'A') && (Char <=
'F')) {
170 Char = Char -
'A' +
'a';
175 RegSize = RegSize + 8;
203 OutBufPtr = OutBuffer;
227 OutBufPtr = OutBuffer;
228 for (Index = 0; Index < RegisterCount; Index++) {
256 if (gRegisterOffsets[RegNumber] > 0xF00) {
262 while (RegSize < 32) {
265 if ((
INTN)TempValue < 0) {
270 NewValue += (TempValue << (RegSize+4));
273 if ((
INTN)TempValue < 0) {
278 NewValue += (TempValue << RegSize);
279 RegSize = RegSize + 8;
298 CHAR8 RegNumBuffer[MAX_REG_NUM_BUF_SIZE];
303 InBufPtr = &InBuffer[1];
304 RegNumBufPtr = RegNumBuffer;
305 while (*InBufPtr !=
'=') {
306 *RegNumBufPtr++ = *InBufPtr++;
309 *RegNumBufPtr =
'\0';
340 MinLength = (RegisterCount * 8) + 1;
348 InBufPtr = &InBuffer[1];
352 for (i = 0; i < RegisterCount; i++) {
361#define GDB_ARM_BKPT 0xefdbdbdb
363BOOLEAN mSingleStepActive =
FALSE;
365UINT32 mSingleStepData;
366UINTN mSingleStepDataSize;
375#define ARM_SOFTWARE_BREAKPOINT_SIGNATURE SIGNATURE_64('A', 'R', 'M', 'B', 'R', 'K', 'P', 'T')
376#define ARM_SOFTWARE_BREAKPOINT_FROM_LINK(a) CR(a, ARM_SOFTWARE_BREAKPOINT, Link, ARM_SOFTWARE_BREAKPOINT_SIGNATURE)
390 if (mSingleStepActive) {
395 mSingleStepActive =
TRUE;
397 mSingleStepPC = SystemContext.SystemContextArm->PC;
399 mSingleStepDataSize =
sizeof (UINT32);
400 mSingleStepData = (*(UINT32 *)mSingleStepPC);
401 *(UINT32 *)mSingleStepPC = GDB_ARM_BKPT;
402 if (*(UINT32 *)mSingleStepPC != GDB_ARM_BKPT) {
404 mSingleStepActive =
FALSE;
421 if (!mSingleStepActive) {
425 if (mSingleStepDataSize ==
sizeof (UINT16)) {
426 *(UINT16 *)mSingleStepPC = (UINT16)mSingleStepData;
429 *(UINT32 *)mSingleStepPC = mSingleStepData;
433 mSingleStepActive =
FALSE;
449 if (PacketData[1] !=
'\0') {
471GetBreakpointDataAddress (
480GetBreakpointDetected (
497SearchBreakpointList (
505 while (!
IsNull (&BreakpointList, Current)) {
506 Breakpoint = ARM_SOFTWARE_BREAKPOINT_FROM_LINK (Current);
508 if (Address == Breakpoint->Address) {
525 Breakpoint = SearchBreakpointList (Address);
527 if (Breakpoint !=
NULL) {
534 Breakpoint->Signature = ARM_SOFTWARE_BREAKPOINT_SIGNATURE;
535 Breakpoint->Address = Address;
536 Breakpoint->Instruction = *(UINT32 *)Address;
542 *(UINT32 *)Address = GDB_ARM_BKPT;
555 Breakpoint = SearchBreakpointList (Address);
557 if (Breakpoint ==
NULL) {
565 *(UINT32 *)Address = Breakpoint->Instruction;
596 DEBUG ((DEBUG_ERROR,
"Insert breakpoint default: %x\n", Type));
601 SetBreakpoint (Address);
634 ClearBreakpoint (Address);
653 if ((UINT32)Address < 0x80000000) {
666 UINT32 ExceptionAddress;
670 ExceptionAddress = SystemContext.SystemContextArm->PC -= 4;
671 Instruction = *(UINT32 *)ExceptionAddress;
672 if (Instruction != GDB_ARM_BKPT) {
679 SystemContext.SystemContextArm->PC = ExceptionAddress;
UINTN MaxEfiException(VOID)
VOID EFIAPI RemoveBreakPoint(IN EFI_SYSTEM_CONTEXT SystemContext, IN CHAR8 *PacketData)
UINTN MaxRegisterCount(VOID)
VOID EFIAPI WriteGeneralRegisters(IN EFI_SYSTEM_CONTEXT SystemContext, IN CHAR8 *InBuffer)
CHAR8 * BasicReadRegister(IN EFI_SYSTEM_CONTEXT SystemContext, IN UINTN RegNumber, IN CHAR8 *OutBufPtr)
VOID EFIAPI InsertBreakPoint(IN EFI_SYSTEM_CONTEXT SystemContext, IN CHAR8 *PacketData)
VOID ReadNthRegister(IN EFI_SYSTEM_CONTEXT SystemContext, IN CHAR8 *InBuffer)
CHAR8 * BasicWriteRegister(IN EFI_SYSTEM_CONTEXT SystemContext, IN UINTN RegNumber, IN CHAR8 *InBufPtr)
BOOLEAN CheckIsa(IN EFI_INSTRUCTION_SET_ARCHITECTURE Isa)
VOID EFIAPI ReadGeneralRegisters(IN EFI_SYSTEM_CONTEXT SystemContext)
VOID RemoveSingleStep(IN EFI_SYSTEM_CONTEXT SystemContext)
VOID AddSingleStep(IN EFI_SYSTEM_CONTEXT SystemContext)
VOID EFIAPI SingleStep(IN EFI_SYSTEM_CONTEXT SystemContext, IN CHAR8 *PacketData)
VOID WriteNthRegister(IN EFI_SYSTEM_CONTEXT SystemContext, IN CHAR8 *InBuffer)
UINTN * FindPointerToRegister(IN EFI_SYSTEM_CONTEXT SystemContext, IN UINTN RegNumber)
VOID EFIAPI ContinueAtAddress(IN EFI_SYSTEM_CONTEXT SystemContext, IN CHAR8 *PacketData)
VOID *EFIAPI InvalidateInstructionCacheRange(IN VOID *Address, IN UINTN Length)
BOOLEAN EFIAPI IsNull(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
LIST_ENTRY *EFIAPI GetNextNode(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
UINTN EFIAPI AsciiStrLen(IN CONST CHAR8 *String)
LIST_ENTRY *EFIAPI GetFirstNode(IN CONST LIST_ENTRY *List)
LIST_ENTRY *EFIAPI RemoveEntryList(IN CONST LIST_ENTRY *Entry)
LIST_ENTRY *EFIAPI InitializeListHead(IN OUT LIST_ENTRY *ListHead)
UINTN EFIAPI AsciiStrHexToUintn(IN CONST CHAR8 *String)
LIST_ENTRY *EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
VOID EFIAPI FreePool(IN VOID *Buffer)
UINTN ParseBreakpointPacket(IN CHAR8 *PacketData, OUT UINTN *Type, OUT UINTN *Address, OUT UINTN *Length)
VOID EFIAPI SendNotSupported(VOID)
UINTN SendPacket(IN CHAR8 *PacketData)
VOID EFIAPI SendSuccess(VOID)
INTN HexCharToInt(IN CHAR8 Char)
VOID EFIAPI SendError(IN UINT8 ErrorNum)
UINTN EFIAPI AsciiSPrint(OUT CHAR8 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR8 *FormatString,...)
#define OFFSET_OF(TYPE, Field)
#define DEBUG(Expression)
EFI_INSTRUCTION_SET_ARCHITECTURE
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)