]>
Commit | Line | Data |
---|---|---|
748edcd5 PB |
1 | /*++\r |
2 | \r | |
3 | Copyright (c) 2007, Intel Corporation\r | |
4 | All rights reserved. This program and the accompanying materials\r | |
5 | are licensed and made available under the terms and conditions of the BSD License\r | |
6 | which accompanies this distribution. The full text of the license may be found at\r | |
7 | http://opensource.org/licenses/bsd-license.php\r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
11 | \r | |
12 | Module Name:\r | |
13 | \r | |
14 | EdbCmdRegister.c\r | |
15 | \r | |
16 | Abstract:\r | |
17 | \r | |
18 | \r | |
19 | --*/\r | |
20 | \r | |
21 | #include "Edb.h"\r | |
22 | \r | |
23 | EFI_DEBUG_STATUS\r | |
24 | DebuggerRegister (\r | |
25 | IN CHAR16 *CommandArg,\r | |
26 | IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,\r | |
27 | IN EFI_EXCEPTION_TYPE ExceptionType,\r | |
28 | IN OUT EFI_SYSTEM_CONTEXT SystemContext\r | |
29 | )\r | |
30 | /*++\r | |
31 | \r | |
32 | Routine Description:\r | |
33 | \r | |
34 | DebuggerCommand - Register\r | |
35 | \r | |
36 | Arguments:\r | |
37 | \r | |
38 | CommandArg - The argument for this command\r | |
39 | DebuggerPrivate - EBC Debugger private data structure\r | |
40 | InterruptType - Interrupt type.\r | |
41 | SystemContext - EBC system context.\r | |
42 | \r | |
43 | Returns:\r | |
44 | \r | |
45 | EFI_DEBUG_CONTINUE - formal return value\r | |
46 | \r | |
47 | --*/\r | |
48 | {\r | |
49 | CHAR16 *RegName;\r | |
50 | CHAR16 *RegValStr;\r | |
51 | UINT64 RegVal;\r | |
52 | \r | |
53 | //\r | |
54 | // Check Argument, NULL means print all register\r | |
55 | //\r | |
56 | if (CommandArg == 0) {\r | |
57 | EDBPrint (\r | |
58 | L" R0 - 0x%016lx, R1 - 0x%016lx\n",\r | |
59 | SystemContext.SystemContextEbc->R0,\r | |
60 | SystemContext.SystemContextEbc->R1\r | |
61 | );\r | |
62 | EDBPrint (\r | |
63 | L" R2 - 0x%016lx, R3 - 0x%016lx\n",\r | |
64 | SystemContext.SystemContextEbc->R2,\r | |
65 | SystemContext.SystemContextEbc->R3\r | |
66 | );\r | |
67 | EDBPrint (\r | |
68 | L" R4 - 0x%016lx, R5 - 0x%016lx\n",\r | |
69 | SystemContext.SystemContextEbc->R4,\r | |
70 | SystemContext.SystemContextEbc->R5\r | |
71 | );\r | |
72 | EDBPrint (\r | |
73 | L" R6 - 0x%016lx, R7 - 0x%016lx\n",\r | |
74 | SystemContext.SystemContextEbc->R6,\r | |
75 | SystemContext.SystemContextEbc->R7\r | |
76 | );\r | |
77 | EDBPrint (\r | |
78 | L" Flags - 0x%016lx, ControlFlags - 0x%016lx\n",\r | |
79 | SystemContext.SystemContextEbc->Flags,\r | |
80 | SystemContext.SystemContextEbc->ControlFlags\r | |
81 | );\r | |
82 | EDBPrint (\r | |
83 | L" Ip - 0x%016lx\n",\r | |
84 | SystemContext.SystemContextEbc->Ip\r | |
85 | );\r | |
86 | return EFI_DEBUG_CONTINUE;\r | |
87 | }\r | |
88 | \r | |
89 | //\r | |
90 | // Get register name\r | |
91 | //\r | |
92 | RegName = CommandArg;\r | |
93 | //\r | |
94 | // Get register value\r | |
95 | //\r | |
96 | RegValStr = StrGetNextTokenLine (L" ");\r | |
97 | if (RegValStr == NULL) {\r | |
98 | EDBPrint (L"Invalid Register Value\n");\r | |
99 | return EFI_DEBUG_CONTINUE;\r | |
100 | }\r | |
101 | RegVal = LXtoi (RegValStr);\r | |
102 | \r | |
103 | //\r | |
104 | // Assign register value\r | |
105 | //\r | |
106 | if (StriCmp (RegName, L"R0") == 0) {\r | |
107 | SystemContext.SystemContextEbc->R0 = RegVal;\r | |
108 | } else if (StriCmp (RegName, L"R1") == 0) {\r | |
109 | SystemContext.SystemContextEbc->R1 = RegVal;\r | |
110 | } else if (StriCmp (RegName, L"R2") == 0) {\r | |
111 | SystemContext.SystemContextEbc->R2 = RegVal;\r | |
112 | } else if (StriCmp (RegName, L"R3") == 0) {\r | |
113 | SystemContext.SystemContextEbc->R3 = RegVal;\r | |
114 | } else if (StriCmp (RegName, L"R4") == 0) {\r | |
115 | SystemContext.SystemContextEbc->R4 = RegVal;\r | |
116 | } else if (StriCmp (RegName, L"R5") == 0) {\r | |
117 | SystemContext.SystemContextEbc->R5 = RegVal;\r | |
118 | } else if (StriCmp (RegName, L"R6") == 0) {\r | |
119 | SystemContext.SystemContextEbc->R6 = RegVal;\r | |
120 | } else if (StriCmp (RegName, L"R7") == 0) {\r | |
121 | SystemContext.SystemContextEbc->R7 = RegVal;\r | |
122 | } else if (StriCmp (RegName, L"Flags") == 0) {\r | |
123 | SystemContext.SystemContextEbc->Flags = RegVal;\r | |
124 | } else if (StriCmp (RegName, L"ControlFlags") == 0) {\r | |
125 | SystemContext.SystemContextEbc->ControlFlags = RegVal;\r | |
126 | } else if (StriCmp (RegName, L"Ip") == 0) {\r | |
127 | SystemContext.SystemContextEbc->Ip = RegVal;\r | |
128 | } else {\r | |
129 | EDBPrint (L"Invalid Register - %s\n", RegName);\r | |
130 | }\r | |
131 | \r | |
132 | //\r | |
133 | // Done\r | |
134 | //\r | |
135 | return EFI_DEBUG_CONTINUE;\r | |
136 | }\r |