]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EmbeddedPkg/Library/GdbDebugAgent/Arm/Processor.c
EmbeddedPkg: Rectify file modes
[mirror_edk2.git] / EmbeddedPkg / Library / GdbDebugAgent / Arm / Processor.c
old mode 100755 (executable)
new mode 100644 (file)
index f22a19d..61c6184
@@ -2,7 +2,7 @@
   Processor specific parts of the GDB stub\r
 \r
   Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>\r
-  \r
+\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
@@ -48,8 +48,8 @@ AsmCommonExceptionEntry (
 //\r
 EFI_EXCEPTION_TYPE_ENTRY gExceptionType[] = {\r
   { EXCEPT_ARM_SOFTWARE_INTERRUPT,    GDB_SIGTRAP },\r
-  { EXCEPT_ARM_UNDEFINED_INSTRUCTION, GDB_SIGTRAP },  \r
-  { EXCEPT_ARM_PREFETCH_ABORT,        GDB_SIGTRAP }, \r
+  { EXCEPT_ARM_UNDEFINED_INSTRUCTION, GDB_SIGTRAP },\r
+  { EXCEPT_ARM_PREFETCH_ABORT,        GDB_SIGTRAP },\r
   { EXCEPT_ARM_DATA_ABORT,            GDB_SIGTRAP },    // GDB_SIGEMT\r
   { EXCEPT_ARM_RESERVED,              GDB_SIGTRAP },    // GDB_SIGILL\r
   { EXCEPT_ARM_FIQ,                   GDB_SIGINT }      // Used for ctrl-c\r
@@ -113,8 +113,8 @@ UINTN gRegisterOffsets[] = {
 \r
 /**\r
  Return the number of entries in the gExceptionType[]\r
\r
- @retval  UINTN, the number of entries in the gExceptionType[] array.    \r
+\r
+ @retval  UINTN, the number of entries in the gExceptionType[] array.\r
  **/\r
 UINTN\r
 MaxEfiException (\r
@@ -128,10 +128,10 @@ MaxEfiException (
 \r
 \r
 /**\r
- Check to see if the ISA is supported. \r
+ Check to see if the ISA is supported.\r
  ISA = Instruction Set Architecture\r
 \r
- @retval TRUE if Isa is supported    \r
+ @retval TRUE if Isa is supported\r
 \r
 **/\r
 BOOLEAN\r
@@ -150,14 +150,14 @@ CheckIsa (
 /**\r
  This takes in the register number and the System Context, and returns a pointer to the RegNumber-th register in gdb ordering\r
  It is, by default, set to find the register pointer of the ARM member\r
- @param   SystemContext     Register content at time of the exception \r
+ @param   SystemContext     Register content at time of the exception\r
  @param   RegNumber       The register to which we want to find a pointer\r
  @retval  the pointer to the RegNumber-th pointer\r
- **/ \r
+ **/\r
 UINTN *\r
 FindPointerToRegister(\r
   IN  EFI_SYSTEM_CONTEXT      SystemContext,\r
-  IN  UINTN           RegNumber  \r
+  IN  UINTN           RegNumber\r
   )\r
 {\r
   UINT8 *TempPtr;\r
@@ -183,7 +183,7 @@ BasicReadRegister (
 {\r
   UINTN RegSize;\r
   CHAR8 Char;\r
-  \r
+\r
   if (gRegisterOffsets[RegNumber] > 0xF00) {\r
     AsciiSPrint(OutBufPtr, 9, "00000000");\r
     OutBufPtr += 8;\r
@@ -197,13 +197,13 @@ BasicReadRegister (
       Char = Char - 'A' + 'a';\r
     }\r
     *OutBufPtr++ = Char;\r
-    \r
+\r
     Char = mHexToStr[(UINT8)((*FindPointerToRegister(SystemContext, RegNumber) >> RegSize) & 0xf)];\r
     if ((Char >= 'A') && (Char <= 'F')) {\r
       Char = Char - 'A' + 'a';\r
     }\r
     *OutBufPtr++ = Char;\r
-    \r
+\r
     RegSize = RegSize + 8;\r
   }\r
   return OutBufPtr;\r
@@ -211,7 +211,7 @@ BasicReadRegister (
 \r
 \r
 /**\r
- Reads the n-th register's value into an output buffer and sends it as a packet \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
@@ -224,29 +224,29 @@ ReadNthRegister (
   UINTN RegNumber;\r
   CHAR8 OutBuffer[9]; // 1 reg=8 hex chars, and the end '\0' (escape seq)\r
   CHAR8 *OutBufPtr;   // pointer to the output buffer\r
-  \r
+\r
   RegNumber = AsciiStrHexToUintn (&InBuffer[1]);\r
-  \r
+\r
   if (RegNumber >= (sizeof (gRegisterOffsets)/sizeof (UINTN))) {\r
-    SendError (GDB_EINVALIDREGNUM); \r
+    SendError (GDB_EINVALIDREGNUM);\r
     return;\r
   }\r
-  \r
+\r
   OutBufPtr = OutBuffer;\r
   OutBufPtr = BasicReadRegister (SystemContext, RegNumber, OutBufPtr);\r
-  \r
+\r
   *OutBufPtr = '\0';  // the end of the buffer\r
   SendPacket(OutBuffer);\r
 }\r
 \r
 \r
 /**\r
- Reads the general registers into an output buffer  and sends it as a packet \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
 VOID\r
 EFIAPI\r
-ReadGeneralRegisters (  \r
+ReadGeneralRegisters (\r
   IN  EFI_SYSTEM_CONTEXT      SystemContext\r
   )\r
 {\r
@@ -254,13 +254,13 @@ ReadGeneralRegisters (
   // a UINT32 takes 8 ascii characters\r
   CHAR8   OutBuffer[(sizeof (gRegisterOffsets) * 2) + 1];\r
   CHAR8   *OutBufPtr;\r
-  \r
+\r
   // It is not safe to allocate pool here....\r
   OutBufPtr = OutBuffer;\r
   for (Index = 0; Index < (sizeof (gRegisterOffsets)/sizeof (UINTN)); Index++) {\r
     OutBufPtr = BasicReadRegister (SystemContext, Index, OutBufPtr);\r
   }\r
-  \r
+\r
   *OutBufPtr = '\0';\r
   SendPacket(OutBuffer);\r
 }\r
@@ -283,7 +283,7 @@ BasicWriteRegister (
   UINTN RegSize;\r
   UINTN TempValue; // the value transferred from a hex char\r
   UINT32 NewValue; // the new value of the RegNumber-th Register\r
-  \r
+\r
   if (gRegisterOffsets[RegNumber] > 0xF00) {\r
     return InBufPtr + 8;\r
   }\r
@@ -292,21 +292,21 @@ BasicWriteRegister (
   RegSize = 0;\r
   while (RegSize < 32) {\r
     TempValue = HexCharToInt(*InBufPtr++);\r
-    \r
+\r
     if ((INTN)TempValue < 0) {\r
-      SendError (GDB_EBADMEMDATA); \r
+      SendError (GDB_EBADMEMDATA);\r
       return NULL;\r
     }\r
-    \r
+\r
     NewValue += (TempValue << (RegSize+4));\r
     TempValue = HexCharToInt(*InBufPtr++);\r
-    \r
+\r
     if ((INTN)TempValue < 0) {\r
-      SendError (GDB_EBADMEMDATA); \r
+      SendError (GDB_EBADMEMDATA);\r
       return NULL;\r
     }\r
-    \r
-    NewValue += (TempValue << RegSize); \r
+\r
+    NewValue += (TempValue << RegSize);\r
     RegSize = RegSize + 8;\r
   }\r
   *(FindPointerToRegister(SystemContext, RegNumber)) = NewValue;\r
@@ -329,19 +329,19 @@ WriteNthRegister (
   CHAR8 RegNumBuffer[MAX_REG_NUM_BUF_SIZE];  // put the 'n..' part of the message into this array\r
   CHAR8 *RegNumBufPtr;\r
   CHAR8 *InBufPtr; // pointer to the input buffer\r
-  \r
+\r
   // find the register number to write\r
   InBufPtr = &InBuffer[1];\r
   RegNumBufPtr = RegNumBuffer;\r
   while (*InBufPtr != '=') {\r
     *RegNumBufPtr++ = *InBufPtr++;\r
-  } \r
+  }\r
   *RegNumBufPtr = '\0';\r
-  RegNumber = AsciiStrHexToUintn (RegNumBuffer); \r
-  \r
+  RegNumber = AsciiStrHexToUintn (RegNumBuffer);\r
+\r
   // check if this is a valid Register Number\r
   if (RegNumber >= (sizeof (gRegisterOffsets)/sizeof (UINTN))) {\r
-    SendError (GDB_EINVALIDREGNUM); \r
+    SendError (GDB_EINVALIDREGNUM);\r
     return;\r
   }\r
   InBufPtr++;  // skips the '=' character\r
@@ -369,21 +369,21 @@ WriteGeneralRegisters (
   UINTN  RegisterCount = (sizeof (gRegisterOffsets)/sizeof (UINTN));\r
 \r
   MinLength = (RegisterCount * 8) + 1;  // 'G' plus the registers in ASCII format\r
-  \r
+\r
   if (AsciiStrLen(InBuffer) < MinLength) {\r
-    //Bad message. Message is not the right length \r
-    SendError (GDB_EBADBUFSIZE); \r
+    //Bad message. Message is not the right length\r
+    SendError (GDB_EBADBUFSIZE);\r
     return;\r
   }\r
-  \r
+\r
   InBufPtr = &InBuffer[1];\r
-  \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
     InBufPtr = BasicWriteRegister (SystemContext, i, InBufPtr);\r
   }\r
-  \r
+\r
   SendSuccess ();\r
 }\r
 \r
@@ -391,10 +391,10 @@ WriteGeneralRegisters (
 \r
 \r
 /**\r
- Continue. addr is Address to resume. If addr is omitted, resume at current \r
+ Continue. addr is Address to resume. If addr is omitted, resume at current\r
  Address.\r
\r
- @param   SystemContext     Register content at time of the exception  \r
+\r
+ @param   SystemContext     Register content at time of the exception\r
  **/\r
 VOID\r
 EFIAPI\r
@@ -405,15 +405,15 @@ ContinueAtAddress (
 {\r
   if (PacketData[1] != '\0') {\r
     SystemContext.SystemContextArm->PC = AsciiStrHexToUintn(&PacketData[1]);\r
-  } \r
+  }\r
 }\r
 \r
 \r
 /** ‘s [addr ]’\r
- Single step. addr is the Address at which to resume. If addr is omitted, resume \r
+ Single step. addr is the Address at which to resume. If addr is omitted, resume\r
  at same Address.\r
\r
- @param   SystemContext     Register content at time of the exception  \r
+\r
+ @param   SystemContext     Register content at time of the exception\r
  **/\r
 VOID\r
 EFIAPI\r
@@ -448,9 +448,9 @@ RemoveBreakPoint (
 \r
 \r
 /**\r
- Send the T signal with the given exception type (in gdb order) and possibly \r
+ Send the T signal with the given exception type (in gdb order) and possibly\r
  with n:r pairs related to the watchpoints\r
\r
+\r
  @param  SystemContext        Register content at time of the exception\r
  @param  GdbExceptionType     GDB exception type\r
  **/\r
@@ -467,13 +467,13 @@ ProcessorSendTSignal (
 \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
+ 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  TRUE  We are in the GDB stub exception preamble\r
  @return  FALSE We are not in GDB stub code\r
  **/\r
 BOOLEAN\r
@@ -495,21 +495,21 @@ InFiqCrack (
 /**\r
  Check to see if this exception is related to ctrl-c handling.\r
 \r
- In this scheme we dedicate FIQ to the ctrl-c handler so it is \r
- independent of the rest of the system. \r
\r
- SaveAndSetDebugTimerInterrupt () can be used to \r
+ In this scheme we dedicate FIQ to the ctrl-c handler so it is\r
+ independent of the rest of the system.\r
+\r
+ SaveAndSetDebugTimerInterrupt () can be used to\r
 \r
  @param ExceptionType     Exception that is being processed\r
- @param SystemContext     Register content at time of the exception  \r
+ @param SystemContext     Register content at time of the exception\r
 \r
  @return  TRUE  This was a ctrl-c check that did not find a ctrl-c\r
  @return  FALSE This was not a ctrl-c check or some one hit ctrl-c\r
  **/\r
 BOOLEAN\r
-ProcessorControlC ( \r
-  IN  EFI_EXCEPTION_TYPE        ExceptionType, \r
-  IN OUT EFI_SYSTEM_CONTEXT     SystemContext \r
+ProcessorControlC (\r
+  IN  EFI_EXCEPTION_TYPE        ExceptionType,\r
+  IN OUT EFI_SYSTEM_CONTEXT     SystemContext\r
   )\r
 {\r
   CHAR8     Char;\r
@@ -534,7 +534,7 @@ ProcessorControlC (
       Return = TRUE;\r
       break;\r
     }\r
-    \r
+\r
     Char = GdbGetChar ();\r
     if (Char == 0x03) {\r
       //\r
@@ -622,7 +622,7 @@ InitializeDebugAgent (
   IN VOID                  *Context, OPTIONAL\r
   IN DEBUG_AGENT_CONTINUE  Function  OPTIONAL\r
   )\r
-{  \r
+{\r
   UINTN                Offset;\r
   UINTN                Length;\r
   BOOLEAN              IrqEnabled;\r
@@ -647,7 +647,7 @@ InitializeDebugAgent (
   VectorBase = (UINT32 *)(UINTN)PcdGet32 (PcdCpuVectorBaseAddress);\r
 \r
 \r
-  // Copy our assembly code into the page that contains the exception vectors. \r
+  // Copy our assembly code into the page that contains the exception vectors.\r
   CopyMem ((VOID *)VectorBase, (VOID *)ExceptionHandlersStart, Length);\r
 \r
   //\r