]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdRegister.c
MdeModulePkg: Apply uncrustify changes
[mirror_edk2.git] / MdeModulePkg / Universal / EbcDxe / EbcDebugger / EdbCmdRegister.c
1 /** @file
2
3 Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
4 SPDX-License-Identifier: BSD-2-Clause-Patent
5
6
7 **/
8
9 #include "Edb.h"
10
11 /**
12
13 DebuggerCommand - Register.
14
15 @param CommandArg - The argument for this command
16 @param DebuggerPrivate - EBC Debugger private data structure
17 @param ExceptionType - Exception type.
18 @param SystemContext - EBC system context.
19
20 @retval EFI_DEBUG_CONTINUE - formal return value
21
22 **/
23 EFI_DEBUG_STATUS
24 DebuggerRegister (
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 }