ARM Packages: Fixed coding style and typos

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>



git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14179 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
oliviermartin
2013-03-12 00:45:29 +00:00
parent 8274521330
commit 6f711615ba
8 changed files with 276 additions and 279 deletions

View File

@@ -94,7 +94,7 @@ MaxEfiException (
VOID
)
{
return sizeof (gExceptionType)/sizeof (EFI_EXCEPTION_TYPE_ENTRY);
return sizeof (gExceptionType) / sizeof (EFI_EXCEPTION_TYPE_ENTRY);
}
@@ -108,7 +108,7 @@ MaxRegisterCount (
VOID
)
{
return sizeof (gRegisterOffsets)/sizeof (UINTN);
return sizeof (gRegisterOffsets) / sizeof (UINTN);
}
@@ -140,7 +140,7 @@ CheckIsa (
@retval the pointer to the RegNumber-th pointer
**/
UINTN *
FindPointerToRegister(
FindPointerToRegister (
IN EFI_SYSTEM_CONTEXT SystemContext,
IN UINTN RegNumber
)
@@ -170,20 +170,20 @@ BasicReadRegister (
CHAR8 Char;
if (gRegisterOffsets[RegNumber] > 0xF00) {
AsciiSPrint(OutBufPtr, 9, "00000000");
AsciiSPrint (OutBufPtr, 9, "00000000");
OutBufPtr += 8;
return OutBufPtr;
}
RegSize = 0;
while (RegSize < 32) {
Char = mHexToStr[(UINT8)((*FindPointerToRegister(SystemContext, RegNumber) >> (RegSize+4)) & 0xf)];
Char = mHexToStr[(UINT8)((*FindPointerToRegister (SystemContext, RegNumber) >> (RegSize+4)) & 0xf)];
if ((Char >= 'A') && (Char <= 'F')) {
Char = Char - 'A' + 'a';
}
*OutBufPtr++ = Char;
Char = mHexToStr[(UINT8)((*FindPointerToRegister(SystemContext, RegNumber) >> RegSize) & 0xf)];
Char = mHexToStr[(UINT8)((*FindPointerToRegister (SystemContext, RegNumber) >> RegSize) & 0xf)];
if ((Char >= 'A') && (Char <= 'F')) {
Char = Char - 'A' + 'a';
}
@@ -212,7 +212,7 @@ ReadNthRegister (
RegNumber = AsciiStrHexToUintn (&InBuffer[1]);
if (RegNumber >= MaxRegisterCount()) {
if (RegNumber >= MaxRegisterCount ()) {
SendError (GDB_EINVALIDREGNUM);
return;
}
@@ -221,7 +221,7 @@ ReadNthRegister (
OutBufPtr = BasicReadRegister (SystemContext, RegNumber, OutBufPtr);
*OutBufPtr = '\0'; // the end of the buffer
SendPacket(OutBuffer);
SendPacket (OutBuffer);
}
@@ -238,18 +238,18 @@ ReadGeneralRegisters (
UINTN Index;
CHAR8 *OutBuffer;
CHAR8 *OutBufPtr;
UINTN RegisterCount = MaxRegisterCount();
UINTN RegisterCount = MaxRegisterCount ();
// It is not safe to allocate pool here....
OutBuffer = AllocatePool((RegisterCount * 8) + 1); // 8 bytes per register in string format plus a null to terminate
OutBuffer = AllocatePool ((RegisterCount * 8) + 1); // 8 bytes per register in string format plus a null to terminate
OutBufPtr = OutBuffer;
for (Index = 0; Index < RegisterCount; Index++) {
OutBufPtr = BasicReadRegister (SystemContext, Index, OutBufPtr);
}
*OutBufPtr = '\0';
SendPacket(OutBuffer);
FreePool(OutBuffer);
SendPacket (OutBuffer);
FreePool (OutBuffer);
}
@@ -278,7 +278,7 @@ CHAR8
NewValue = 0;
RegSize = 0;
while (RegSize < 32) {
TempValue = HexCharToInt(*InBufPtr++);
TempValue = HexCharToInt (*InBufPtr++);
if ((INTN)TempValue < 0) {
SendError (GDB_EBADMEMDATA);
@@ -286,7 +286,7 @@ CHAR8
}
NewValue += (TempValue << (RegSize+4));
TempValue = HexCharToInt(*InBufPtr++);
TempValue = HexCharToInt (*InBufPtr++);
if ((INTN)TempValue < 0) {
SendError (GDB_EBADMEMDATA);
@@ -296,7 +296,7 @@ CHAR8
NewValue += (TempValue << RegSize);
RegSize = RegSize + 8;
}
*(FindPointerToRegister(SystemContext, RegNumber)) = NewValue;
*(FindPointerToRegister (SystemContext, RegNumber)) = NewValue;
return InBufPtr;
}
@@ -327,7 +327,7 @@ WriteNthRegister (
RegNumber = AsciiStrHexToUintn (RegNumBuffer);
// check if this is a valid Register Number
if (RegNumber >= MaxRegisterCount()) {
if (RegNumber >= MaxRegisterCount ()) {
SendError (GDB_EINVALIDREGNUM);
return;
}
@@ -353,11 +353,11 @@ WriteGeneralRegisters (
UINTN i;
CHAR8 *InBufPtr; /// pointer to the input buffer
UINTN MinLength;
UINTN RegisterCount = MaxRegisterCount();
UINTN RegisterCount = MaxRegisterCount ();
MinLength = (RegisterCount * 8) + 1; // 'G' plus the registers in ASCII format
if (AsciiStrLen(InBuffer) < MinLength) {
if (AsciiStrLen (InBuffer) < MinLength) {
//Bad message. Message is not the right length
SendError (GDB_EBADBUFSIZE);
return;
@@ -367,7 +367,7 @@ WriteGeneralRegisters (
// Read the new values for the registers from the input buffer to an array, NewValueArray.
// The values in the array are in the gdb ordering
for(i = 0; i < RegisterCount; i++) {
for (i = 0; i < RegisterCount; i++) {
InBufPtr = BasicWriteRegister (SystemContext, i, InBufPtr);
}
@@ -421,7 +421,7 @@ AddSingleStep (
mSingleStepActive = FALSE;
}
InvalidateInstructionCacheRange((VOID *)mSingleStepPC, mSingleStepDataSize);
InvalidateInstructionCacheRange ((VOID *)mSingleStepPC, mSingleStepDataSize);
//DEBUG((EFI_D_ERROR, "AddSingleStep at 0x%08x (was: 0x%08x is:0x%08x)\n", SystemContext.SystemContextArm->PC, mSingleStepData, *(UINT32 *)mSingleStepPC));
}
@@ -446,7 +446,7 @@ RemoveSingleStep (
//DEBUG((EFI_D_ERROR, "RemoveSingleStep at 0x%08x (was: 0x%08x is:0x%08x)\n", SystemContext.SystemContextArm->PC, *(UINT32 *)mSingleStepPC, mSingleStepData));
*(UINT32 *)mSingleStepPC = mSingleStepData;
}
InvalidateInstructionCacheRange((VOID *)mSingleStepPC, mSingleStepDataSize);
InvalidateInstructionCacheRange ((VOID *)mSingleStepPC, mSingleStepDataSize);
mSingleStepActive = FALSE;
}
@@ -466,7 +466,7 @@ ContinueAtAddress (
)
{
if (PacketData[1] != '\0') {
SystemContext.SystemContextArm->PC = AsciiStrHexToUintn(&PacketData[1]);
SystemContext.SystemContextArm->PC = AsciiStrHexToUintn (&PacketData[1]);
}
}
@@ -484,7 +484,7 @@ SingleStep (
IN CHAR8 *PacketData
)
{
SendNotSupported();
SendNotSupported ();
}
UINTN
@@ -521,15 +521,15 @@ SearchBreakpointList (
LIST_ENTRY *Current;
ARM_SOFTWARE_BREAKPOINT *Breakpoint;
Current = GetFirstNode(&BreakpointList);
while (!IsNull(&BreakpointList, Current)) {
Current = GetFirstNode (&BreakpointList);
while (!IsNull (&BreakpointList, Current)) {
Breakpoint = ARM_SOFTWARE_BREAKPOINT_FROM_LINK(Current);
if (Address == Breakpoint->Address) {
return Breakpoint;
}
Current = GetNextNode(&BreakpointList, Current);
Current = GetNextNode (&BreakpointList, Current);
}
return NULL;
@@ -542,25 +542,25 @@ SetBreakpoint (
{
ARM_SOFTWARE_BREAKPOINT *Breakpoint;
Breakpoint = SearchBreakpointList(Address);
Breakpoint = SearchBreakpointList (Address);
if (Breakpoint != NULL) {
return;
}
// create and fill breakpoint structure
Breakpoint = AllocatePool(sizeof(ARM_SOFTWARE_BREAKPOINT));
Breakpoint = AllocatePool (sizeof(ARM_SOFTWARE_BREAKPOINT));
Breakpoint->Signature = ARM_SOFTWARE_BREAKPOINT_SIGNATURE;
Breakpoint->Address = Address;
Breakpoint->Instruction = *(UINT32 *)Address;
// Add it to the list
InsertTailList(&BreakpointList, &Breakpoint->Link);
InsertTailList (&BreakpointList, &Breakpoint->Link);
// Insert the software breakpoint
*(UINT32 *)Address = GDB_ARM_BKPT;
InvalidateInstructionCacheRange((VOID *)Address, 4);
InvalidateInstructionCacheRange ((VOID *)Address, 4);
//DEBUG((EFI_D_ERROR, "SetBreakpoint at 0x%08x (was: 0x%08x is:0x%08x)\n", Address, Breakpoint->Instruction, *(UINT32 *)Address));
}
@@ -572,22 +572,22 @@ ClearBreakpoint (
{
ARM_SOFTWARE_BREAKPOINT *Breakpoint;
Breakpoint = SearchBreakpointList(Address);
Breakpoint = SearchBreakpointList (Address);
if (Breakpoint == NULL) {
return;
}
// Add it to the list
RemoveEntryList(&Breakpoint->Link);
RemoveEntryList (&Breakpoint->Link);
// Restore the original instruction
*(UINT32 *)Address = Breakpoint->Instruction;
InvalidateInstructionCacheRange((VOID *)Address, 4);
InvalidateInstructionCacheRange ((VOID *)Address, 4);
//DEBUG((EFI_D_ERROR, "ClearBreakpoint at 0x%08x (was: 0x%08x is:0x%08x)\n", Address, GDB_ARM_BKPT, *(UINT32 *)Address));
FreePool(Breakpoint);
FreePool (Breakpoint);
}
VOID
@@ -602,7 +602,7 @@ InsertBreakPoint (
UINTN Length;
UINTN ErrorCode;
ErrorCode = ParseBreakpointPacket(PacketData, &Type, &Address, &Length);
ErrorCode = ParseBreakpointPacket (PacketData, &Type, &Address, &Length);
if (ErrorCode > 0) {
SendError ((UINT8)ErrorCode);
return;
@@ -618,7 +618,7 @@ InsertBreakPoint (
return;
}
SetBreakpoint(Address);
SetBreakpoint (Address);
SendSuccess ();
}
@@ -651,7 +651,7 @@ RemoveBreakPoint (
return;
}
ClearBreakpoint(Address);
ClearBreakpoint (Address);
SendSuccess ();
}
@@ -662,7 +662,7 @@ InitializeProcessor (
)
{
// Initialize breakpoint list
InitializeListHead(&BreakpointList);
InitializeListHead (&BreakpointList);
}
BOOLEAN

View File

@@ -75,7 +75,6 @@ GdbStubEntry (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
EFI_DEBUG_SUPPORT_PROTOCOL *DebugSupport;
@@ -84,8 +83,7 @@ GdbStubEntry (
UINTN Index;
UINTN Processor;
BOOLEAN IsaSupported;
Status = EfiGetSystemConfigurationTable (&gEfiDebugImageInfoTableGuid, (VOID **)&gDebugImageTableHeader);
if (EFI_ERROR (Status)) {
gDebugImageTableHeader = NULL;
@@ -136,10 +134,9 @@ GdbStubEntry (
DEBUG ((EFI_D_INFO, "Debug Support Protocol Processor Index %d\n", gMaxProcessorIndex));
// Call processor-specific init routine
InitializeProcessor();
InitializeProcessor ();
for (Processor = 0; Processor <= gMaxProcessorIndex; Processor++) {
for (Index = 0; Index < MaxEfiException (); Index++) {
Status = DebugSupport->RegisterExceptionCallback (DebugSupport, Processor, GdbExceptionHandler, gExceptionType[Index].Exception);
ASSERT_EFI_ERROR (Status);
@@ -165,7 +162,7 @@ GdbStubEntry (
ASSERT_EFI_ERROR (Status);
//
// Register for protocol notifactions on this event
// Register for protocol notifications on this event
//
Status = gBS->RegisterProtocolNotify (
&gEfiLoadedImageProtocolGuid,
@@ -182,8 +179,6 @@ GdbStubEntry (
return EFI_SUCCESS;
}
/**
Transfer length bytes of input buffer, starting at Address, to memory.
@@ -485,12 +480,11 @@ EFIAPI
SendNotSupported (
VOID
)
{
{
SendPacket ("");
}
/**
Send the T signal with the given exception type (in gdb order) and possibly with n:r pairs related to the watchpoints
@@ -596,11 +590,11 @@ ConvertEFItoGDBtype (
IN EFI_EXCEPTION_TYPE EFIExceptionType
)
{
UINTN i;
UINTN Index;
for (i=0; i < MaxEfiException() ; i++) {
if (gExceptionType[i].Exception == EFIExceptionType) {
return gExceptionType[i].SignalNo;
for (Index = 0; Index < MaxEfiException () ; Index++) {
if (gExceptionType[Index].Exception == EFIExceptionType) {
return gExceptionType[Index].SignalNo;
}
}
return GDB_SIGTRAP; // this is a GDB trap
@@ -635,14 +629,14 @@ ReadFromMemory (
InBufPtr++; // this skips ',' in the buffer
/* Error checking */
if (AsciiStrLen(AddressBuffer) >= MAX_ADDR_SIZE) {
if (AsciiStrLen (AddressBuffer) >= MAX_ADDR_SIZE) {
Print((CHAR16 *)L"Address is too long\n");
SendError (GDB_EBADMEMADDRBUFSIZE);
return;
}
// 2 = 'm' + ','
if (AsciiStrLen(PacketData) - AsciiStrLen(AddressBuffer) - 2 >= MAX_LENGTH_SIZE) {
if (AsciiStrLen (PacketData) - AsciiStrLen (AddressBuffer) - 2 >= MAX_LENGTH_SIZE) {
Print((CHAR16 *)L"Length is too long\n");
SendError (GDB_EBADMEMLENGTH);
return;
@@ -699,14 +693,14 @@ WriteToMemory (
/* Error checking */
//Check if Address is not too long.
if (AsciiStrLen(AddressBuffer) >= MAX_ADDR_SIZE) {
if (AsciiStrLen (AddressBuffer) >= MAX_ADDR_SIZE) {
Print ((CHAR16 *)L"Address too long..\n");
SendError (GDB_EBADMEMADDRBUFSIZE);
return;
}
//Check if message length is not too long
if (AsciiStrLen(LengthBuffer) >= MAX_LENGTH_SIZE) {
if (AsciiStrLen (LengthBuffer) >= MAX_LENGTH_SIZE) {
Print ((CHAR16 *)L"Length too long..\n");
SendError (GDB_EBADMEMLENGBUFSIZE);
return;
@@ -714,7 +708,7 @@ WriteToMemory (
// Check if Message is not too long/short.
// 3 = 'M' + ',' + ':'
MessageLength = (AsciiStrLen(PacketData) - AsciiStrLen(AddressBuffer) - AsciiStrLen(LengthBuffer) - 3);
MessageLength = (AsciiStrLen (PacketData) - AsciiStrLen (AddressBuffer) - AsciiStrLen (LengthBuffer) - 3);
if (MessageLength != (2*Length)) {
//Message too long/short. New data is not the right size.
SendError (GDB_EBADMEMDATASIZE);
@@ -770,7 +764,7 @@ ParseBreakpointPacket (
*AddressBufferPtr = '\0';
//Check if Address is not too long.
if (AsciiStrLen(AddressBuffer) >= MAX_ADDR_SIZE) {
if (AsciiStrLen (AddressBuffer) >= MAX_ADDR_SIZE) {
Print ((CHAR16 *)L"Address too long..\n");
return 40; //EMSGSIZE: Message size too long.
}
@@ -801,7 +795,7 @@ gXferObjectReadResponse (
CHAR8 Char;
UINTN Count;
// responce starts with 'm' or 'l' if it is the end
// Response starts with 'm' or 'l' if it is the end
OutBufPtr = gOutBuffer;
*OutBufPtr++ = Type;
Count = 1;
@@ -989,12 +983,11 @@ PeCoffLoaderGetDebuggerInfo (
}
/**
Process "qXfer:object:read:annex:offset,length" request.
Returns an XML document that contains loaded libraries. In our case it is
infomration in the EFI Debug Inmage Table converted into an XML document.
information in the EFI Debug Image Table converted into an XML document.
GDB will call with an arbitrary length (it can't know the real length and
will reply with chunks of XML that are easy for us to deal with. Gdb will
@@ -1006,12 +999,12 @@ PeCoffLoaderGetDebuggerInfo (
<library name="/a/l/f/f.dll"><segment address="0x30000000"/></library>
</library-list>
Since we can not allocate memory in interupt context this module has
Since we can not allocate memory in interrupt context this module has
assumptions about how it will get called:
1) Length will generally be max remote packet size (big enough)
2) First Offset of an XML document read needs to be 0
3) This code will return back small chunks of the XML document on every read.
Each subseqent call will ask for the next availble part of the document.
Each subsequent call will ask for the next available part of the document.
Note: The only variable size element in the XML is:
" <library name=\"%s\"><segment address=\"%p\"/></library>\n" and it is
@@ -1039,6 +1032,7 @@ QxferLibrary (
// Force a retry from the beginning
gPacketqXferLibraryOffset = 0;
return;
}
@@ -1117,7 +1111,7 @@ GdbExceptionHandler (
CHAR8 *Ptr;
if (ValidateException(ExceptionType, SystemContext) == FALSE) {
if (ValidateException (ExceptionType, SystemContext) == FALSE) {
return;
}
@@ -1254,7 +1248,7 @@ GdbPeriodicCallBack (
if (gCtrlCBreakFlag) {
//
// Update the context to force a single step trap when we exit the GDB
// stub. This will trasfer control to GdbExceptionHandler () and let
// stub. This will transfer control to GdbExceptionHandler () and let
// us break into the program. We don't want to break into the GDB stub.
//
AddSingleStep (SystemContext);

View File

@@ -63,7 +63,7 @@ extern CONST CHAR8 mHexToStr[];
#define GDB_SIGTRAP 5 // Trace Trap (Breakpoint and SingleStep)
#define GDB_SIGEMT 7 // Emulator Trap
#define GDB_SIGFPE 8 // Floating point exception
#define GDB_SIGSEGV 11 // Setgment violation, page fault
#define GDB_SIGSEGV 11 // Segment violation, page fault
//

View File

@@ -147,7 +147,7 @@ CheckIsa (
@retval the pointer to the RegNumber-th pointer
**/
UINTN *
FindPointerToRegister(
FindPointerToRegister (
IN EFI_SYSTEM_CONTEXT SystemContext,
IN UINTN RegNumber
)
@@ -177,8 +177,8 @@ BasicReadRegister (
RegSize = 0;
while (RegSize < REG_SIZE) {
*OutBufPtr++ = mHexToStr[((*FindPointerToRegister(SystemContext, RegNumber) >> (RegSize+4)) & 0xf)];
*OutBufPtr++ = mHexToStr[((*FindPointerToRegister(SystemContext, RegNumber) >> RegSize) & 0xf)];
*OutBufPtr++ = mHexToStr[((*FindPointerToRegister (SystemContext, RegNumber) >> (RegSize+4)) & 0xf)];
*OutBufPtr++ = mHexToStr[((*FindPointerToRegister (SystemContext, RegNumber) >> RegSize) & 0xf)];
RegSize = RegSize + 8;
}
return OutBufPtr;
@@ -210,7 +210,7 @@ ReadNthRegister (
}
OutBufPtr = OutBuffer;
OutBufPtr = BasicReadRegister(SystemContext, RegNumber, OutBufPtr);
OutBufPtr = BasicReadRegister (SystemContext, RegNumber, OutBufPtr);
*OutBufPtr = '\0'; // the end of the buffer
SendPacket(OutBuffer);
@@ -233,8 +233,8 @@ ReadGeneralRegisters (
CHAR8 *OutBufPtr; // pointer to the output buffer
OutBufPtr = OutBuffer;
for(i = 0 ; i < MaxRegisterCount() ; i++) { // there are only 16 registers to read
OutBufPtr = BasicReadRegister(SystemContext, i, OutBufPtr);
for (i = 0 ; i < MaxRegisterCount() ; i++) { // there are only 16 registers to read
OutBufPtr = BasicReadRegister (SystemContext, i, OutBufPtr);
}
*OutBufPtr = '\0'; // the end of the buffer
@@ -282,7 +282,7 @@ BasicWriteRegister (
NewValue += (TempValue << RegSize);
RegSize = RegSize + 8;
}
*(FindPointerToRegister(SystemContext, RegNumber)) = NewValue;
*(FindPointerToRegister (SystemContext, RegNumber)) = NewValue;
return InBufPtr;
}
@@ -353,8 +353,8 @@ WriteGeneralRegisters (
// Read the new values for the registers from the input buffer to an array, NewValueArray.
// The values in the array are in the gdb ordering
for(i=0; i < MaxRegisterCount(); i++) { // there are only 16 registers to write
InBufPtr = BasicWriteRegister(SystemContext, i, InBufPtr);
for (i=0; i < MaxRegisterCount(); i++) { // there are only 16 registers to write
InBufPtr = BasicWriteRegister (SystemContext, i, InBufPtr);
}
SendSuccess();
@@ -867,7 +867,7 @@ InsertBreakPoint (
if (Status == EFI_UNSUPPORTED) {
Print ((CHAR16 *)L"Not supported\n");
SendNotSupported();
SendNotSupported ();
return;
}
@@ -946,7 +946,7 @@ RemoveBreakPoint (
if (Status == EFI_UNSUPPORTED) {
Print ((CHAR16 *)L"Not supported.\n");
SendNotSupported();
SendNotSupported ();
return;
}
@@ -956,7 +956,7 @@ RemoveBreakPoint (
}
//Remove breakpoint
Status = DisableDebugRegister(SystemContext, Register);
Status = DisableDebugRegister (SystemContext, Register);
if (EFI_ERROR(Status)) {
Print ((CHAR16 *)L"Invalid argument.\n");
SendError (GDB_EINVALIDARG);