scummvm random work
[patches.git] / u-boot-jump-cmd.patch
1 diff --git a/common/cmd_boot.c b/common/cmd_boot.c
2 index d83f5af..0c34572 100644
3 --- a/common/cmd_boot.c
4 +++ b/common/cmd_boot.c
5 @@ -34,8 +34,14 @@ unsigned long do_go_exec (ulong (*entry)(int, char *[]), int argc, char *argv[])
6 {
7 return entry (argc, argv);
8 }
9 +__attribute__((weak))
10 +unsigned long do_jump_exec (ulong (*entry)(int, char *[]), int argc, char *argv[])
11 +{
12 + return entry (argc, argv);
13 +}
14
15 -int do_go (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
16 +int do_it (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
17 + unsigned long (*exec_hook)(ulong (*entry)(int, char *[]), int argc, char *argv[]))
18 {
19 ulong addr, rc;
20 int rcode = 0;
21 @@ -53,13 +59,22 @@ int do_go (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
22 * pass address parameter as argv[0] (aka command name),
23 * and all remaining args
24 */
25 - rc = do_go_exec ((void *)addr, argc - 1, argv + 1);
26 + rc = exec_hook ((void *)addr, argc - 1, argv + 1);
27 if (rc != 0) rcode = 1;
28
29 printf ("## Application terminated, rc = 0x%lX\n", rc);
30 return rcode;
31 }
32
33 +int do_go (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
34 +{
35 + return do_it (cmdtp, flag, argc, argv, do_go_exec);
36 +}
37 +int do_jump (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
38 +{
39 + return do_it (cmdtp, flag, argc, argv, do_jump_exec);
40 +}
41 +
42 /* -------------------------------------------------------------------- */
43
44 U_BOOT_CMD(
45 @@ -69,6 +84,13 @@ U_BOOT_CMD(
46 " passing 'arg' as arguments\n"
47 );
48
49 +U_BOOT_CMD(
50 + jump, CFG_MAXARGS, 1, do_jump,
51 + "jump - start executing code at address 'addr' and never return\n",
52 + "addr [arg ...]\n - jump to address 'addr'\n"
53 + " passing 'arg' as arguments\n"
54 +);
55 +
56 extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
57
58 U_BOOT_CMD(