Rev 602 | Rev 608 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 602 | Rev 603 | ||
---|---|---|---|
Line 90... | Line 90... | ||
90 | .func = cmd_symaddr, |
90 | .func = cmd_symaddr, |
91 | .argc = 1, |
91 | .argc = 1, |
92 | .argv = &symaddr_argv |
92 | .argv = &symaddr_argv |
93 | }; |
93 | }; |
94 | 94 | ||
- | 95 | static char set_buf[MAX_CMDLINE+1]; |
|
- | 96 | static int cmd_set4(cmd_arg_t *argv); |
|
- | 97 | static cmd_arg_t set4_argv[] = { |
|
- | 98 | { |
|
- | 99 | .type = ARG_TYPE_STRING, |
|
- | 100 | .buffer = set_buf, |
|
- | 101 | .len = sizeof(set_buf) |
|
- | 102 | }, |
|
- | 103 | { |
|
- | 104 | .type = ARG_TYPE_INT |
|
- | 105 | } |
|
- | 106 | }; |
|
- | 107 | static cmd_info_t set4_info = { |
|
- | 108 | .name = "set4", |
|
- | 109 | .description = "set <dest_addr> <value> - 4byte version", |
|
- | 110 | .func = cmd_set4, |
|
- | 111 | .argc = 2, |
|
- | 112 | .argv = set4_argv |
|
- | 113 | }; |
|
- | 114 | ||
- | 115 | ||
95 | /** Data and methods for 'call0' command. */ |
116 | /** Data and methods for 'call0' command. */ |
96 | static char call0_buf[MAX_CMDLINE+1]; |
117 | static char call0_buf[MAX_CMDLINE+1]; |
97 | static char carg1_buf[MAX_CMDLINE+1]; |
118 | static char carg1_buf[MAX_CMDLINE+1]; |
98 | static char carg2_buf[MAX_CMDLINE+1]; |
119 | static char carg2_buf[MAX_CMDLINE+1]; |
99 | static char carg3_buf[MAX_CMDLINE+1]; |
120 | static char carg3_buf[MAX_CMDLINE+1]; |
Line 253... | Line 274... | ||
253 | panic("could not register command %s\n", call2_info.name); |
274 | panic("could not register command %s\n", call2_info.name); |
254 | 275 | ||
255 | cmd_initialize(&call3_info); |
276 | cmd_initialize(&call3_info); |
256 | if (!cmd_register(&call3_info)) |
277 | if (!cmd_register(&call3_info)) |
257 | panic("could not register command %s\n", call3_info.name); |
278 | panic("could not register command %s\n", call3_info.name); |
- | 279 | ||
- | 280 | cmd_initialize(&set4_info); |
|
- | 281 | if (!cmd_register(&set4_info)) |
|
- | 282 | panic("could not register command %s\n", set4_info.name); |
|
258 | 283 | ||
259 | cmd_initialize(&halt_info); |
284 | cmd_initialize(&halt_info); |
260 | if (!cmd_register(&halt_info)) |
285 | if (!cmd_register(&halt_info)) |
261 | panic("could not register command %s\n", halt_info.name); |
286 | panic("could not register command %s\n", halt_info.name); |
262 | 287 | ||
Line 469... | Line 494... | ||
469 | int cmd_ptlb(cmd_arg_t *argv) |
494 | int cmd_ptlb(cmd_arg_t *argv) |
470 | { |
495 | { |
471 | tlb_print(); |
496 | tlb_print(); |
472 | return 1; |
497 | return 1; |
473 | } |
498 | } |
- | 499 | ||
- | 500 | /** Write 4 byte value to address */ |
|
- | 501 | int cmd_set4(cmd_arg_t *argv) |
|
- | 502 | { |
|
- | 503 | char *symbol; |
|
- | 504 | __u32 *addr ; |
|
- | 505 | __u32 arg1 = argv[1].intval; |
|
- | 506 | bool pointer = false; |
|
- | 507 | ||
- | 508 | if (((char *)argv->buffer)[0] == '*') { |
|
- | 509 | addr = (__u32 *) get_symbol_addr(argv->buffer+1); |
|
- | 510 | pointer = true; |
|
- | 511 | } else if (((char *)argv->buffer)[0] >= '0' && |
|
- | 512 | ((char *)argv->buffer)[0] <= '9') |
|
- | 513 | addr = (__u32 *)atoi((char *)argv->buffer); |
|
- | 514 | else |
|
- | 515 | addr = (__u32 *)get_symbol_addr(argv->buffer); |
|
- | 516 | ||
- | 517 | if (!addr) |
|
- | 518 | printf("Symbol %s not found.\n", argv->buffer); |
|
- | 519 | else if (addr == (__u32 *) -1) { |
|
- | 520 | symtab_print_search(argv->buffer); |
|
- | 521 | printf("Duplicate symbol, be more specific.\n"); |
|
- | 522 | } else { |
|
- | 523 | if (pointer) |
|
- | 524 | addr = (__u32 *)*addr; |
|
- | 525 | printf("Writing 0x%x -> 0x%p\n", arg1, addr); |
|
- | 526 | *addr = arg1; |
|
- | 527 | ||
- | 528 | } |
|
- | 529 | ||
- | 530 | return 1; |
|
- | 531 | } |