Skip to content

Commit 6718ef6

Browse files
committed
Cleanup style and convention issues
This commit cleans up several style and convention issues in DebuggerFeaturePkg.
1 parent 6296398 commit 6718ef6

7 files changed

Lines changed: 84 additions & 82 deletions

File tree

DebuggerFeaturePkg/Library/DebugAgent/AARCH64/DebugAarch64.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
77
**/
88

9-
#include <Library/UefiBootServicesTableLib.h>
10-
#include <Library/UefiLib.h>
119
#include <Library/DebugLib.h>
1210
#include <Library/BaseMemoryLib.h>
1311
#include <Library/WatchdogTimerLib.h>
@@ -54,10 +52,10 @@ typedef union _DBG_WCR {
5452
// Structures used by the arch-agnostic code.
5553
//
5654

57-
UINT8 ArchBreakpointInstruction[] = { 0x00, 0x00, 0x3E, 0xD4 };
58-
UINTN ArchBreakpointInstructionSize = sizeof (ArchBreakpointInstruction);
55+
UINT8 mArchBreakpointInstruction[] = { 0x00, 0x00, 0x3E, 0xD4 };
56+
UINTN mArchBreakpointInstructionSize = sizeof (mArchBreakpointInstruction);
5957

60-
UINT32 ArchExceptionTypes[] = {
58+
UINT32 mArchExceptionTypes[] = {
6159
EXCEPT_AARCH64_SYNCHRONOUS_EXCEPTIONS,
6260
MAX_UINT32 // End of list
6361
};
@@ -106,8 +104,8 @@ DEBUG_WATCHPOINT_REGISTERS DebugWatchpointRegisters[] = {
106104
VOID
107105
EFIAPI
108106
DebuggerExceptionHandler (
109-
EFI_EXCEPTION_TYPE InterruptType,
110-
EFI_SYSTEM_CONTEXT SystemContext
107+
IN EFI_EXCEPTION_TYPE InterruptType,
108+
IN EFI_SYSTEM_CONTEXT SystemContext
111109
)
112110
{
113111
EFI_SYSTEM_CONTEXT_AARCH64 *Context;
@@ -194,9 +192,9 @@ DebuggerExceptionHandler (
194192
//
195193

196194
if ((ExceptionType == 0x3c) &&
197-
(CompareMem ((UINT8 *)Context->ELR, &ArchBreakpointInstruction[0], ArchBreakpointInstructionSize) == 0))
195+
(CompareMem ((UINT8 *)Context->ELR, &mArchBreakpointInstruction[0], mArchBreakpointInstructionSize) == 0))
198196
{
199-
Context->ELR += ArchBreakpointInstructionSize;
197+
Context->ELR += mArchBreakpointInstructionSize;
200198
}
201199

202200
//

DebuggerFeaturePkg/Library/DebugAgent/Breakpoint.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ BREAKPOINT_REASON DebuggerBreakpointReason = BreakpointReasonNone;
3737
**/
3838
BOOLEAN
3939
AddSoftwareBreakpoint (
40-
UINTN Address
40+
IN UINTN Address
4141
)
4242
{
4343
UINTN i;
4444
BREAKPOINT_INFO *Entry;
4545

4646
// Make sure we don't overflow OriginalValue.
47-
ASSERT (ArchBreakpointInstructionSize <= MAX_BREAKPOINT_SIZE);
47+
ASSERT (mArchBreakpointInstructionSize <= MAX_BREAKPOINT_SIZE);
4848

4949
Entry = NULL;
5050
for (i = 0; i < MAX_BREAKPOINTS; i++) {
@@ -65,9 +65,9 @@ AddSoftwareBreakpoint (
6565

6666
Entry->Active = TRUE;
6767
Entry->Address = Address;
68-
DbgReadMemory (Address, &(Entry->OriginalValue[0]), ArchBreakpointInstructionSize);
69-
DbgWriteMemory (Address, ArchBreakpointInstruction, ArchBreakpointInstructionSize);
70-
InvalidateInstructionCacheRange ((VOID *)Address, ArchBreakpointInstructionSize);
68+
DbgReadMemory (Address, &(Entry->OriginalValue[0]), mArchBreakpointInstructionSize);
69+
DbgWriteMemory (Address, mArchBreakpointInstruction, mArchBreakpointInstructionSize);
70+
InvalidateInstructionCacheRange ((VOID *)Address, mArchBreakpointInstructionSize);
7171
return TRUE;
7272
}
7373

@@ -81,16 +81,16 @@ AddSoftwareBreakpoint (
8181
**/
8282
BOOLEAN
8383
RemoveSoftwareBreakpoint (
84-
UINTN Address
84+
IN UINTN Address
8585
)
8686
{
8787
UINTN i;
8888

8989
for (i = 0; i < MAX_BREAKPOINTS; i++) {
9090
if (mBreakpoints[i].Active && (mBreakpoints[i].Address == Address)) {
91-
DbgWriteMemory (Address, &(mBreakpoints[i].OriginalValue[0]), ArchBreakpointInstructionSize);
91+
DbgWriteMemory (Address, &(mBreakpoints[i].OriginalValue[0]), mArchBreakpointInstructionSize);
9292
mBreakpoints[i].Active = FALSE;
93-
InvalidateInstructionCacheRange ((VOID *)Address, ArchBreakpointInstructionSize);
93+
InvalidateInstructionCacheRange ((VOID *)Address, mArchBreakpointInstructionSize);
9494
return TRUE;
9595
}
9696
}
@@ -107,7 +107,7 @@ RemoveSoftwareBreakpoint (
107107
**/
108108
VOID
109109
DebuggerBreak (
110-
BREAKPOINT_REASON Reason
110+
IN BREAKPOINT_REASON Reason
111111
)
112112
{
113113
DebuggerBreakpointReason = Reason;

DebuggerFeaturePkg/Library/DebugAgent/DebugAgent.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ typedef struct _EXCEPTION_INFO {
6767
// Architecture specific definitions used by general debugger code.
6868
//
6969

70-
extern UINT8 ArchBreakpointInstruction[];
71-
extern UINTN ArchBreakpointInstructionSize;
72-
extern UINT32 ArchExceptionTypes[];
70+
extern UINT8 mArchBreakpointInstruction[];
71+
extern UINTN mArchBreakpointInstructionSize;
72+
extern UINT32 mArchExceptionTypes[];
7373

7474
//
7575
// Global used to track debugger invoked breakpoint.
@@ -93,8 +93,8 @@ extern CONST CHAR8 *gDebuggerInfo;
9393
VOID
9494
EFIAPI
9595
DebuggerExceptionHandler (
96-
EFI_EXCEPTION_TYPE InterruptType,
97-
EFI_SYSTEM_CONTEXT SystemContext
96+
IN EFI_EXCEPTION_TYPE InterruptType,
97+
IN EFI_SYSTEM_CONTEXT SystemContext
9898
);
9999

100100
EFI_STATUS
@@ -134,16 +134,16 @@ IsPageWritable (
134134

135135
BOOLEAN
136136
DbgReadMemory (
137-
UINTN Address,
138-
VOID *Data,
139-
UINTN Length
137+
IN UINTN Address,
138+
OUT VOID *Data,
139+
IN UINTN Length
140140
);
141141

142142
BOOLEAN
143143
DbgWriteMemory (
144-
UINTN Address,
145-
VOID *Data,
146-
UINTN Length
144+
IN UINTN Address,
145+
IN VOID *Data,
146+
IN UINTN Length
147147
);
148148

149149
//
@@ -163,7 +163,7 @@ DebuggerPollInput (
163163

164164
VOID
165165
DebuggerInitialBreakpoint (
166-
UINT64 Timeout
166+
IN UINT64 Timeout
167167
);
168168

169169
//
@@ -172,17 +172,17 @@ DebuggerInitialBreakpoint (
172172

173173
BOOLEAN
174174
AddSoftwareBreakpoint (
175-
UINTN Address
175+
IN UINTN Address
176176
);
177177

178178
BOOLEAN
179179
RemoveSoftwareBreakpoint (
180-
UINTN Address
180+
IN UINTN Address
181181
);
182182

183183
VOID
184184
DebuggerBreak (
185-
BREAKPOINT_REASON Reason
185+
IN BREAKPOINT_REASON Reason
186186
);
187187

188188
//

DebuggerFeaturePkg/Library/DebugAgent/DebugAgentDxe.c

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ OnLoadedImageNotification (
275275
CHAR8 *PdbPointer;
276276
CHAR8 Name[64];
277277
CHAR8 *NameEnd;
278-
UINTN i;
278+
UINTN Index;
279279

280280
BufferSize = sizeof (EFI_HANDLE);
281281

@@ -314,9 +314,9 @@ OnLoadedImageNotification (
314314
}
315315

316316
// Strip of the directories.
317-
for (i = AsciiStrLen (PdbPointer); i > 0; i--) {
318-
if ((PdbPointer[i - 1] == '\\') || (PdbPointer[i - 1] == '/')) {
319-
PdbPointer = &PdbPointer[i];
317+
for (Index = AsciiStrLen (PdbPointer); Index > 0; Index--) {
318+
if ((PdbPointer[Index - 1] == '\\') || (PdbPointer[Index - 1] == '/')) {
319+
PdbPointer = &PdbPointer[Index];
320320
break;
321321
}
322322
}
@@ -347,18 +347,18 @@ VOID
347347
DebugAgentExceptionDestroy (
348348
)
349349
{
350-
UINT8 i;
350+
UINT8 Index;
351351

352352
if (gCpu != NULL) {
353-
for (i = 0; ArchExceptionTypes[i] != MAX_UINT32; i += 1) {
353+
for (Index = 0; mArchExceptionTypes[Index] != MAX_UINT32; Index += 1) {
354354
if (gCpu != NULL) {
355355
gCpu->RegisterInterruptHandler (
356356
gCpu,
357-
ArchExceptionTypes[i],
357+
mArchExceptionTypes[Index],
358358
NULL
359359
);
360360
} else {
361-
RegisterCpuInterruptHandler (ArchExceptionTypes[i], NULL);
361+
RegisterCpuInterruptHandler (mArchExceptionTypes[Index], NULL);
362362
}
363363
}
364364
}
@@ -375,21 +375,21 @@ EFI_STATUS
375375
DebugAgentExceptionInitialize (
376376
)
377377
{
378-
UINT8 i;
378+
UINT8 Index;
379379
EFI_STATUS Status;
380380

381381
// First uninstall any handler that needs to be replaced.
382382
DebugAgentExceptionDestroy ();
383383

384-
for (i = 0; ArchExceptionTypes[i] != MAX_UINT32; i += 1) {
384+
for (Index = 0; mArchExceptionTypes[Index] != MAX_UINT32; Index += 1) {
385385
if (gCpu != NULL) {
386386
Status = gCpu->RegisterInterruptHandler (
387387
gCpu,
388-
ArchExceptionTypes[i],
388+
mArchExceptionTypes[Index],
389389
DebuggerExceptionHandler
390390
);
391391
} else {
392-
Status = RegisterCpuInterruptHandler (ArchExceptionTypes[i], DebuggerExceptionHandler);
392+
Status = RegisterCpuInterruptHandler (mArchExceptionTypes[Index], DebuggerExceptionHandler);
393393
}
394394

395395
if (EFI_ERROR (Status)) {
@@ -428,10 +428,10 @@ DebugReboot (
428428
**/
429429
BOOLEAN
430430
AccessMemory (
431-
UINTN Address,
432-
UINT8 *Data,
433-
UINTN Length,
434-
BOOLEAN Write
431+
IN UINTN Address,
432+
IN OUT UINT8 *Data,
433+
IN UINTN Length,
434+
IN BOOLEAN Write
435435
)
436436
{
437437
UINTN LengthInPage;
@@ -517,17 +517,17 @@ AccessMemory (
517517
Read system memory.
518518
519519
@param[in] Address The virtual address of the memory access.
520-
@param[in,out] Data The buffer to read memory into.
520+
@param[out] Data The buffer to read memory into.
521521
@param[in] Length The length of the memory range.
522522
523523
@retval TRUE Memory access was complete successfully.
524524
@retval FALSE Memory access failed, either completely or partially.
525525
**/
526526
BOOLEAN
527527
DbgReadMemory (
528-
UINTN Address,
529-
VOID *Data,
530-
UINTN Length
528+
IN UINTN Address,
529+
OUT VOID *Data,
530+
IN UINTN Length
531531
)
532532
{
533533
return AccessMemory (Address, Data, Length, FALSE);
@@ -537,17 +537,17 @@ DbgReadMemory (
537537
Write to system memory.
538538
539539
@param[in] Address The virtual address of the memory access.
540-
@param[in,out] Data The buffer of data to write.
540+
@param[in] Data The buffer of data to write.
541541
@param[in] Length The length of the memory range.
542542
543543
@retval TRUE Memory access was complete successfully.
544544
@retval FALSE Memory access failed, either completely or partially.
545545
**/
546546
BOOLEAN
547547
DbgWriteMemory (
548-
UINTN Address,
549-
VOID *Data,
550-
UINTN Length
548+
IN UINTN Address,
549+
IN VOID *Data,
550+
IN UINTN Length
551551
)
552552
{
553553
return AccessMemory (Address, Data, Length, TRUE);

0 commit comments

Comments
 (0)