blob: 57a8a3f2fe352177fa8edefd629ea7ac57bfb5f7 [file] [log] [blame]
wdenk47d1a6e2002-11-03 00:01:44 +00001/*
2 * BedBug Functions
3 */
4
5#include <common.h>
Simon Glass18d66532014-04-10 20:01:25 -06006#include <cli.h>
wdenk47d1a6e2002-11-03 00:01:44 +00007#include <command.h>
8#include <linux/ctype.h>
9#include <net.h>
wdenk8bde7f72003-06-27 21:31:46 +000010#include <bedbug/type.h>
wdenk47d1a6e2002-11-03 00:01:44 +000011#include <bedbug/bedbug.h>
12#include <bedbug/regs.h>
13#include <bedbug/ppc.h>
wdenk47d1a6e2002-11-03 00:01:44 +000014
Wolfgang Denkd87080b2006-03-31 18:32:53 +020015DECLARE_GLOBAL_DATA_PTR;
16
Wolfgang Denkd87080b2006-03-31 18:32:53 +020017extern void show_regs __P ((struct pt_regs *));
18extern int run_command __P ((const char *, int));
wdenk47d1a6e2002-11-03 00:01:44 +000019
Wolfgang Denkd87080b2006-03-31 18:32:53 +020020ulong dis_last_addr = 0; /* Last address disassembled */
21ulong dis_last_len = 20; /* Default disassembler length */
22CPU_DEBUG_CTX bug_ctx; /* Bedbug context structure */
Simon Glasse1bf8242014-04-10 20:01:27 -060023
Wolfgang Denkd87080b2006-03-31 18:32:53 +020024
wdenk47d1a6e2002-11-03 00:01:44 +000025/* ======================================================================
26 * U-Boot's puts function does not append a newline, so the bedbug stuff
27 * will use this for the output of the dis/assembler.
28 * ====================================================================== */
29
Wolfgang Denkd87080b2006-03-31 18:32:53 +020030int bedbug_puts (const char *str)
wdenk47d1a6e2002-11-03 00:01:44 +000031{
Wolfgang Denkd87080b2006-03-31 18:32:53 +020032 /* -------------------------------------------------- */
wdenk47d1a6e2002-11-03 00:01:44 +000033
Wolfgang Denkd87080b2006-03-31 18:32:53 +020034 printf ("%s\r\n", str);
35 return 0;
36} /* bedbug_puts */
Simon Glasse1bf8242014-04-10 20:01:27 -060037
Wolfgang Denkd87080b2006-03-31 18:32:53 +020038
39
wdenk47d1a6e2002-11-03 00:01:44 +000040/* ======================================================================
41 * Initialize the bug_ctx structure used by the bedbug debugger. This is
42 * specific to the CPU since each has different debug registers and
43 * settings.
44 * ====================================================================== */
45
Wolfgang Denkd87080b2006-03-31 18:32:53 +020046void bedbug_init (void)
wdenk47d1a6e2002-11-03 00:01:44 +000047{
Wolfgang Denkd87080b2006-03-31 18:32:53 +020048 /* -------------------------------------------------- */
wdenk47d1a6e2002-11-03 00:01:44 +000049
50#if defined(CONFIG_4xx)
Wolfgang Denkd87080b2006-03-31 18:32:53 +020051 void bedbug405_init (void);
52
53 bedbug405_init ();
wdenkd126bfb2003-04-10 11:18:18 +000054#elif defined(CONFIG_8xx)
Wolfgang Denkd87080b2006-03-31 18:32:53 +020055 void bedbug860_init (void);
56
57 bedbug860_init ();
wdenk47d1a6e2002-11-03 00:01:44 +000058#endif
59
60#if defined(CONFIG_MPC824X) || defined(CONFIG_MPC8260)
Wolfgang Denkd87080b2006-03-31 18:32:53 +020061 /* Processors that are 603e core based */
62 void bedbug603e_init (void);
wdenk47d1a6e2002-11-03 00:01:44 +000063
Wolfgang Denkd87080b2006-03-31 18:32:53 +020064 bedbug603e_init ();
wdenk47d1a6e2002-11-03 00:01:44 +000065#endif
66
Wolfgang Denkd87080b2006-03-31 18:32:53 +020067 return;
68} /* bedbug_init */
Simon Glasse1bf8242014-04-10 20:01:27 -060069
Wolfgang Denkd87080b2006-03-31 18:32:53 +020070
71
wdenk47d1a6e2002-11-03 00:01:44 +000072/* ======================================================================
73 * Entry point from the interpreter to the disassembler. Repeated calls
74 * will resume from the last disassembled address.
75 * ====================================================================== */
Wolfgang Denk54841ab2010-06-28 22:00:46 +020076int do_bedbug_dis (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
wdenk47d1a6e2002-11-03 00:01:44 +000077{
Wolfgang Denkd87080b2006-03-31 18:32:53 +020078 ulong addr; /* Address to start disassembly from */
79 ulong len; /* # of instructions to disassemble */
wdenk47d1a6e2002-11-03 00:01:44 +000080
Wolfgang Denkd87080b2006-03-31 18:32:53 +020081 /* -------------------------------------------------- */
wdenk47d1a6e2002-11-03 00:01:44 +000082
Wolfgang Denkd87080b2006-03-31 18:32:53 +020083 /* Setup to go from the last address if none is given */
84 addr = dis_last_addr;
85 len = dis_last_len;
wdenk47d1a6e2002-11-03 00:01:44 +000086
Wolfgang Denk47e26b12010-07-17 01:06:04 +020087 if (argc < 2)
Simon Glass4c12eeb2011-12-10 08:44:01 +000088 return CMD_RET_USAGE;
wdenk47d1a6e2002-11-03 00:01:44 +000089
Wolfgang Denkd87080b2006-03-31 18:32:53 +020090 if ((flag & CMD_FLAG_REPEAT) == 0) {
91 /* New command */
92 addr = simple_strtoul (argv[1], NULL, 16);
wdenk47d1a6e2002-11-03 00:01:44 +000093
Wolfgang Denkd87080b2006-03-31 18:32:53 +020094 /* If an extra param is given then it is the length */
95 if (argc > 2)
96 len = simple_strtoul (argv[2], NULL, 16);
97 }
wdenk47d1a6e2002-11-03 00:01:44 +000098
Wolfgang Denkd87080b2006-03-31 18:32:53 +020099 /* Run the disassembler */
100 disppc ((unsigned char *) addr, 0, len, bedbug_puts, F_RADHEX);
101
102 dis_last_addr = addr + (len * 4);
103 dis_last_len = len;
104 return 0;
105} /* do_bedbug_dis */
106
107U_BOOT_CMD (ds, 3, 1, do_bedbug_dis,
Peter Tyser2fb26042009-01-27 18:03:12 -0600108 "disassemble memory",
Wolfgang Denka89c33d2009-05-24 17:06:54 +0200109 "ds <address> [# instructions]");
Simon Glasse1bf8242014-04-10 20:01:27 -0600110
wdenk47d1a6e2002-11-03 00:01:44 +0000111/* ======================================================================
112 * Entry point from the interpreter to the assembler. Assembles
113 * instructions in consecutive memory locations until a '.' (period) is
114 * entered on a line by itself.
115 * ====================================================================== */
Wolfgang Denk54841ab2010-06-28 22:00:46 +0200116int do_bedbug_asm (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
wdenk47d1a6e2002-11-03 00:01:44 +0000117{
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200118 long mem_addr; /* Address to assemble into */
119 unsigned long instr; /* Machine code for text */
120 char prompt[15]; /* Prompt string for user input */
121 int asm_err; /* Error code from the assembler */
wdenk47d1a6e2002-11-03 00:01:44 +0000122
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200123 /* -------------------------------------------------- */
124 int rcode = 0;
wdenk47d1a6e2002-11-03 00:01:44 +0000125
Wolfgang Denk47e26b12010-07-17 01:06:04 +0200126 if (argc < 2)
Simon Glass4c12eeb2011-12-10 08:44:01 +0000127 return CMD_RET_USAGE;
wdenk47d1a6e2002-11-03 00:01:44 +0000128
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200129 printf ("\nEnter '.' when done\n");
130 mem_addr = simple_strtoul (argv[1], NULL, 16);
wdenk47d1a6e2002-11-03 00:01:44 +0000131
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200132 while (1) {
133 putc ('\n');
134 disppc ((unsigned char *) mem_addr, 0, 1, bedbug_puts,
135 F_RADHEX);
wdenk47d1a6e2002-11-03 00:01:44 +0000136
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200137 sprintf (prompt, "%08lx: ", mem_addr);
Simon Glasse1bf8242014-04-10 20:01:27 -0600138 cli_readline(prompt);
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200139
140 if (console_buffer[0] && strcmp (console_buffer, ".")) {
141 if ((instr =
142 asmppc (mem_addr, console_buffer,
143 &asm_err)) != 0) {
144 *(unsigned long *) mem_addr = instr;
145 mem_addr += 4;
146 } else {
147 printf ("*** Error: %s ***\n",
148 asm_error_str (asm_err));
149 rcode = 1;
150 }
151 } else {
152 break;
153 }
154 }
155 return rcode;
156} /* do_bedbug_asm */
157
158U_BOOT_CMD (as, 2, 0, do_bedbug_asm,
Wolfgang Denka89c33d2009-05-24 17:06:54 +0200159 "assemble memory", "as <address>");
Simon Glasse1bf8242014-04-10 20:01:27 -0600160
wdenk47d1a6e2002-11-03 00:01:44 +0000161/* ======================================================================
162 * Used to set a break point from the interpreter. Simply calls into the
163 * CPU-specific break point set routine.
164 * ====================================================================== */
165
Wolfgang Denk54841ab2010-06-28 22:00:46 +0200166int do_bedbug_break (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
wdenk47d1a6e2002-11-03 00:01:44 +0000167{
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200168 /* -------------------------------------------------- */
169 if (bug_ctx.do_break)
170 (*bug_ctx.do_break) (cmdtp, flag, argc, argv);
171 return 0;
wdenk47d1a6e2002-11-03 00:01:44 +0000172
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200173} /* do_bedbug_break */
174
175U_BOOT_CMD (break, 3, 0, do_bedbug_break,
Peter Tyser2fb26042009-01-27 18:03:12 -0600176 "set or clear a breakpoint",
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200177 " - Set or clear a breakpoint\n"
178 "break <address> - Break at an address\n"
179 "break off <bp#> - Disable breakpoint.\n"
Wolfgang Denka89c33d2009-05-24 17:06:54 +0200180 "break show - List breakpoints.");
Simon Glasse1bf8242014-04-10 20:01:27 -0600181
wdenk47d1a6e2002-11-03 00:01:44 +0000182/* ======================================================================
183 * Called from the debug interrupt routine. Simply calls the CPU-specific
184 * breakpoint handling routine.
185 * ====================================================================== */
186
187void do_bedbug_breakpoint (struct pt_regs *regs)
188{
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200189 /* -------------------------------------------------- */
wdenk47d1a6e2002-11-03 00:01:44 +0000190
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200191 if (bug_ctx.break_isr)
192 (*bug_ctx.break_isr) (regs);
wdenk47d1a6e2002-11-03 00:01:44 +0000193
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200194 return;
195} /* do_bedbug_breakpoint */
Simon Glasse1bf8242014-04-10 20:01:27 -0600196
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200197
198
wdenk47d1a6e2002-11-03 00:01:44 +0000199/* ======================================================================
200 * Called from the CPU-specific breakpoint handling routine. Enter a
201 * mini main loop until the stopped flag is cleared from the breakpoint
202 * context.
203 *
204 * This handles the parts of the debugger that are common to all CPU's.
205 * ====================================================================== */
206
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200207void bedbug_main_loop (unsigned long addr, struct pt_regs *regs)
wdenk47d1a6e2002-11-03 00:01:44 +0000208{
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200209 int len; /* Length of command line */
210 int flag; /* Command flags */
211 int rc = 0; /* Result from run_command */
212 char prompt_str[20]; /* Prompt string */
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200213 static char lastcommand[CONFIG_SYS_CBSIZE] = { 0 }; /* previous command */
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200214 /* -------------------------------------------------- */
wdenk47d1a6e2002-11-03 00:01:44 +0000215
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200216 if (bug_ctx.clear)
217 (*bug_ctx.clear) (bug_ctx.current_bp);
wdenk47d1a6e2002-11-03 00:01:44 +0000218
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200219 printf ("Breakpoint %d: ", bug_ctx.current_bp);
220 disppc ((unsigned char *) addr, 0, 1, bedbug_puts, F_RADHEX);
wdenk47d1a6e2002-11-03 00:01:44 +0000221
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200222 bug_ctx.stopped = 1;
223 bug_ctx.regs = regs;
wdenk47d1a6e2002-11-03 00:01:44 +0000224
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200225 sprintf (prompt_str, "BEDBUG.%d =>", bug_ctx.current_bp);
wdenk47d1a6e2002-11-03 00:01:44 +0000226
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200227 /* A miniature main loop */
228 while (bug_ctx.stopped) {
Simon Glasse1bf8242014-04-10 20:01:27 -0600229 len = cli_readline(prompt_str);
wdenk47d1a6e2002-11-03 00:01:44 +0000230
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200231 flag = 0; /* assume no special flags for now */
wdenk47d1a6e2002-11-03 00:01:44 +0000232
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200233 if (len > 0)
234 strcpy (lastcommand, console_buffer);
235 else if (len == 0)
236 flag |= CMD_FLAG_REPEAT;
wdenk47d1a6e2002-11-03 00:01:44 +0000237
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200238 if (len == -1)
239 printf ("<INTERRUPT>\n");
240 else
Thomas Betker52715f82014-06-05 20:07:58 +0200241 rc = run_command_repeatable(lastcommand, flag);
wdenk47d1a6e2002-11-03 00:01:44 +0000242
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200243 if (rc <= 0) {
244 /* invalid command or not repeatable, forget it */
245 lastcommand[0] = 0;
246 }
247 }
wdenk47d1a6e2002-11-03 00:01:44 +0000248
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200249 bug_ctx.regs = NULL;
250 bug_ctx.current_bp = 0;
wdenk47d1a6e2002-11-03 00:01:44 +0000251
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200252 return;
253} /* bedbug_main_loop */
Simon Glasse1bf8242014-04-10 20:01:27 -0600254
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200255
256
wdenk47d1a6e2002-11-03 00:01:44 +0000257/* ======================================================================
258 * Interpreter command to continue from a breakpoint. Just clears the
259 * stopped flag in the context so that the breakpoint routine will
260 * return.
261 * ====================================================================== */
Wolfgang Denk54841ab2010-06-28 22:00:46 +0200262int do_bedbug_continue (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
wdenk47d1a6e2002-11-03 00:01:44 +0000263{
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200264 /* -------------------------------------------------- */
wdenk47d1a6e2002-11-03 00:01:44 +0000265
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200266 if (!bug_ctx.stopped) {
267 printf ("Not at a breakpoint\n");
268 return 1;
269 }
wdenk47d1a6e2002-11-03 00:01:44 +0000270
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200271 bug_ctx.stopped = 0;
272 return 0;
273} /* do_bedbug_continue */
274
275U_BOOT_CMD (continue, 1, 0, do_bedbug_continue,
Peter Tyser2fb26042009-01-27 18:03:12 -0600276 "continue from a breakpoint",
Wolfgang Denka89c33d2009-05-24 17:06:54 +0200277 "");
Simon Glasse1bf8242014-04-10 20:01:27 -0600278
wdenk47d1a6e2002-11-03 00:01:44 +0000279/* ======================================================================
280 * Interpreter command to continue to the next instruction, stepping into
281 * subroutines. Works by calling the find_next_addr() routine to compute
282 * the address passes control to the CPU-specific set breakpoint routine
283 * for the current breakpoint number.
284 * ====================================================================== */
Wolfgang Denk54841ab2010-06-28 22:00:46 +0200285int do_bedbug_step (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
wdenk47d1a6e2002-11-03 00:01:44 +0000286{
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200287 unsigned long addr; /* Address to stop at */
wdenk47d1a6e2002-11-03 00:01:44 +0000288
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200289 /* -------------------------------------------------- */
wdenk47d1a6e2002-11-03 00:01:44 +0000290
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200291 if (!bug_ctx.stopped) {
292 printf ("Not at a breakpoint\n");
293 return 1;
294 }
wdenk47d1a6e2002-11-03 00:01:44 +0000295
York Sun472d5462013-04-01 11:29:11 -0700296 if (!find_next_address((unsigned char *) &addr, false, bug_ctx.regs))
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200297 return 1;
wdenk47d1a6e2002-11-03 00:01:44 +0000298
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200299 if (bug_ctx.set)
300 (*bug_ctx.set) (bug_ctx.current_bp, addr);
301
302 bug_ctx.stopped = 0;
303 return 0;
304} /* do_bedbug_step */
305
306U_BOOT_CMD (step, 1, 1, do_bedbug_step,
Peter Tyser2fb26042009-01-27 18:03:12 -0600307 "single step execution.",
Wolfgang Denka89c33d2009-05-24 17:06:54 +0200308 "");
Simon Glasse1bf8242014-04-10 20:01:27 -0600309
wdenk47d1a6e2002-11-03 00:01:44 +0000310/* ======================================================================
311 * Interpreter command to continue to the next instruction, stepping over
312 * subroutines. Works by calling the find_next_addr() routine to compute
313 * the address passes control to the CPU-specific set breakpoint routine
314 * for the current breakpoint number.
315 * ====================================================================== */
Wolfgang Denk54841ab2010-06-28 22:00:46 +0200316int do_bedbug_next (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
wdenk47d1a6e2002-11-03 00:01:44 +0000317{
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200318 unsigned long addr; /* Address to stop at */
wdenk47d1a6e2002-11-03 00:01:44 +0000319
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200320 /* -------------------------------------------------- */
wdenk47d1a6e2002-11-03 00:01:44 +0000321
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200322 if (!bug_ctx.stopped) {
323 printf ("Not at a breakpoint\n");
324 return 1;
325 }
wdenk47d1a6e2002-11-03 00:01:44 +0000326
York Sun472d5462013-04-01 11:29:11 -0700327 if (!find_next_address((unsigned char *) &addr, true, bug_ctx.regs))
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200328 return 1;
wdenk47d1a6e2002-11-03 00:01:44 +0000329
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200330 if (bug_ctx.set)
331 (*bug_ctx.set) (bug_ctx.current_bp, addr);
332
333 bug_ctx.stopped = 0;
334 return 0;
335} /* do_bedbug_next */
336
337U_BOOT_CMD (next, 1, 1, do_bedbug_next,
Peter Tyser2fb26042009-01-27 18:03:12 -0600338 "single step execution, stepping over subroutines.",
Wolfgang Denka89c33d2009-05-24 17:06:54 +0200339 "");
Simon Glasse1bf8242014-04-10 20:01:27 -0600340
wdenk47d1a6e2002-11-03 00:01:44 +0000341/* ======================================================================
342 * Interpreter command to print the current stack. This assumes an EABI
343 * architecture, so it starts with GPR R1 and works back up the stack.
344 * ====================================================================== */
Wolfgang Denk54841ab2010-06-28 22:00:46 +0200345int do_bedbug_stack (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
wdenk47d1a6e2002-11-03 00:01:44 +0000346{
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200347 unsigned long sp; /* Stack pointer */
348 unsigned long func; /* LR from stack */
349 int depth; /* Stack iteration level */
350 int skip = 1; /* Flag to skip the first entry */
351 unsigned long top; /* Top of memory address */
wdenk47d1a6e2002-11-03 00:01:44 +0000352
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200353 /* -------------------------------------------------- */
wdenk47d1a6e2002-11-03 00:01:44 +0000354
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200355 if (!bug_ctx.stopped) {
356 printf ("Not at a breakpoint\n");
357 return 1;
358 }
wdenk47d1a6e2002-11-03 00:01:44 +0000359
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200360 top = gd->bd->bi_memstart + gd->bd->bi_memsize;
361 depth = 0;
wdenk47d1a6e2002-11-03 00:01:44 +0000362
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200363 printf ("Depth PC\n");
364 printf ("----- --------\n");
365 printf ("%5d %08lx\n", depth++, bug_ctx.regs->nip);
wdenk47d1a6e2002-11-03 00:01:44 +0000366
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200367 sp = bug_ctx.regs->gpr[1];
368 func = *(unsigned long *) (sp + 4);
wdenk47d1a6e2002-11-03 00:01:44 +0000369
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200370 while ((func < top) && (sp < top)) {
371 if (!skip)
372 printf ("%5d %08lx\n", depth++, func);
373 else
374 --skip;
wdenk47d1a6e2002-11-03 00:01:44 +0000375
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200376 sp = *(unsigned long *) sp;
377 func = *(unsigned long *) (sp + 4);
378 }
379 return 0;
380} /* do_bedbug_stack */
381
382U_BOOT_CMD (where, 1, 1, do_bedbug_stack,
Peter Tyser2fb26042009-01-27 18:03:12 -0600383 "Print the running stack.",
Wolfgang Denka89c33d2009-05-24 17:06:54 +0200384 "");
Simon Glasse1bf8242014-04-10 20:01:27 -0600385
wdenk47d1a6e2002-11-03 00:01:44 +0000386/* ======================================================================
387 * Interpreter command to dump the registers. Calls the CPU-specific
388 * show registers routine.
389 * ====================================================================== */
Wolfgang Denk54841ab2010-06-28 22:00:46 +0200390int do_bedbug_rdump (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
wdenk47d1a6e2002-11-03 00:01:44 +0000391{
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200392 /* -------------------------------------------------- */
wdenk47d1a6e2002-11-03 00:01:44 +0000393
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200394 if (!bug_ctx.stopped) {
395 printf ("Not at a breakpoint\n");
396 return 1;
397 }
wdenk47d1a6e2002-11-03 00:01:44 +0000398
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200399 show_regs (bug_ctx.regs);
400 return 0;
401} /* do_bedbug_rdump */
402
403U_BOOT_CMD (rdump, 1, 1, do_bedbug_rdump,
Wolfgang Denka89c33d2009-05-24 17:06:54 +0200404 "Show registers.", "");
wdenk47d1a6e2002-11-03 00:01:44 +0000405/* ====================================================================== */
wdenk47d1a6e2002-11-03 00:01:44 +0000406
407
408/*
409 * Copyright (c) 2001 William L. Pitts
410 * All rights reserved.
411 *
412 * Redistribution and use in source and binary forms are freely
413 * permitted provided that the above copyright notice and this
414 * paragraph and the following disclaimer are duplicated in all
415 * such forms.
416 *
417 * This software is provided "AS IS" and without any express or
418 * implied warranties, including, without limitation, the implied
419 * warranties of merchantability and fitness for a particular
420 * purpose.
421 */