TianoCore EDK2 master
Loading...
Searching...
No Matches
EdbCmdRegister.c
Go to the documentation of this file.
1
9#include "Edb.h"
10
23EFI_DEBUG_STATUS
25 IN CHAR16 *CommandArg,
26 IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
27 IN EFI_EXCEPTION_TYPE ExceptionType,
28 IN OUT EFI_SYSTEM_CONTEXT SystemContext
29 )
30{
31 CHAR16 *RegName;
32 CHAR16 *RegValStr;
33 UINT64 RegVal;
34
35 //
36 // Check Argument, NULL means print all register
37 //
38 if (CommandArg == 0) {
39 EDBPrint (
40 L" R0 - 0x%016lx, R1 - 0x%016lx\n",
41 SystemContext.SystemContextEbc->R0,
42 SystemContext.SystemContextEbc->R1
43 );
44 EDBPrint (
45 L" R2 - 0x%016lx, R3 - 0x%016lx\n",
46 SystemContext.SystemContextEbc->R2,
47 SystemContext.SystemContextEbc->R3
48 );
49 EDBPrint (
50 L" R4 - 0x%016lx, R5 - 0x%016lx\n",
51 SystemContext.SystemContextEbc->R4,
52 SystemContext.SystemContextEbc->R5
53 );
54 EDBPrint (
55 L" R6 - 0x%016lx, R7 - 0x%016lx\n",
56 SystemContext.SystemContextEbc->R6,
57 SystemContext.SystemContextEbc->R7
58 );
59 EDBPrint (
60 L" Flags - 0x%016lx, ControlFlags - 0x%016lx\n",
61 SystemContext.SystemContextEbc->Flags,
62 SystemContext.SystemContextEbc->ControlFlags
63 );
64 EDBPrint (
65 L" Ip - 0x%016lx\n",
66 SystemContext.SystemContextEbc->Ip
67 );
68 return EFI_DEBUG_CONTINUE;
69 }
70
71 //
72 // Get register name
73 //
74 RegName = CommandArg;
75 //
76 // Get register value
77 //
78 RegValStr = StrGetNextTokenLine (L" ");
79 if (RegValStr == NULL) {
80 EDBPrint (L"Invalid Register Value\n");
81 return EFI_DEBUG_CONTINUE;
82 }
83
84 RegVal = LXtoi (RegValStr);
85
86 //
87 // Assign register value
88 //
89 if (StriCmp (RegName, L"R0") == 0) {
90 SystemContext.SystemContextEbc->R0 = RegVal;
91 } else if (StriCmp (RegName, L"R1") == 0) {
92 SystemContext.SystemContextEbc->R1 = RegVal;
93 } else if (StriCmp (RegName, L"R2") == 0) {
94 SystemContext.SystemContextEbc->R2 = RegVal;
95 } else if (StriCmp (RegName, L"R3") == 0) {
96 SystemContext.SystemContextEbc->R3 = RegVal;
97 } else if (StriCmp (RegName, L"R4") == 0) {
98 SystemContext.SystemContextEbc->R4 = RegVal;
99 } else if (StriCmp (RegName, L"R5") == 0) {
100 SystemContext.SystemContextEbc->R5 = RegVal;
101 } else if (StriCmp (RegName, L"R6") == 0) {
102 SystemContext.SystemContextEbc->R6 = RegVal;
103 } else if (StriCmp (RegName, L"R7") == 0) {
104 SystemContext.SystemContextEbc->R7 = RegVal;
105 } else if (StriCmp (RegName, L"Flags") == 0) {
106 SystemContext.SystemContextEbc->Flags = RegVal;
107 } else if (StriCmp (RegName, L"ControlFlags") == 0) {
108 SystemContext.SystemContextEbc->ControlFlags = RegVal;
109 } else if (StriCmp (RegName, L"Ip") == 0) {
110 SystemContext.SystemContextEbc->Ip = RegVal;
111 } else {
112 EDBPrint (L"Invalid Register - %s\n", RegName);
113 }
114
115 //
116 // Done
117 //
118 return EFI_DEBUG_CONTINUE;
119}
EFI_DEBUG_STATUS DebuggerRegister(IN CHAR16 *CommandArg, IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate, IN EFI_EXCEPTION_TYPE ExceptionType, IN OUT EFI_SYSTEM_CONTEXT SystemContext)
CHAR16 *EFIAPI StrGetNextTokenLine(IN CHAR16 *CharSet)
UINT64 EFIAPI LXtoi(CHAR16 *Str)
UINTN EFIAPI EDBPrint(IN CONST CHAR16 *Format,...)
Definition: EdbSupportUI.c:683
INTN EFIAPI StriCmp(IN CHAR16 *String, IN CHAR16 *String2)
#define NULL
Definition: Base.h:319
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
INTN EFI_EXCEPTION_TYPE
Definition: DebugSupport.h:35