aboutsummaryrefslogtreecommitdiff
path: root/common/cmd_boot.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2008-04-13 19:42:19 -0400
committerWolfgang Denk <wd@denx.de>2008-04-18 00:31:41 -0700
commita49864593e083a5d0779fb9ca98e5a0f2053183d (patch)
treecf69cd393e711b73115c743103ad88c9aba944cd /common/cmd_boot.c
parent017e9b7925f74878d0e9475388cca9bda5ef9482 (diff)
allow ports to override go behavior
Split the arch-specific logic out of the common go code and into a dedicated weak function called do_go_exec() that lives in cpu directories. This will need review from i386/nios people to make sure I didn't break them.
Diffstat (limited to 'common/cmd_boot.c')
-rw-r--r--common/cmd_boot.c33
1 files changed, 5 insertions, 28 deletions
diff --git a/common/cmd_boot.c b/common/cmd_boot.c
index 9d4f02659..d83f5af53 100644
--- a/common/cmd_boot.c
+++ b/common/cmd_boot.c
@@ -28,25 +28,11 @@
#include <command.h>
#include <net.h>
-#if defined(CONFIG_I386)
-DECLARE_GLOBAL_DATA_PTR;
-#endif
-
-static inline void go_setup(int argc, char *argv[])
+/* Allow ports to override the default behavior */
+__attribute__((weak))
+unsigned long do_go_exec (ulong (*entry)(int, char *[]), int argc, char *argv[])
{
-#if defined(CONFIG_I386)
- /*
- * x86 does not use a dedicated register to pass the pointer
- * to the global_data
- */
- argv[0] = (char *)gd;
-
-#elif defined(CONFIG_BLACKFIN)
- if (dcache_status ())
- dcache_disable ();
- if (icache_status ())
- icache_disable ();
-#endif
+ return entry (argc, argv);
}
int do_go (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
@@ -63,20 +49,11 @@ int do_go (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
printf ("## Starting application at 0x%08lX ...\n", addr);
- go_setup(argc, argv);
-
-#if defined(CONFIG_NIOS)
- /*
- * Nios function pointers are address >> 1
- */
- addr >>= 1;
-#endif
-
/*
* pass address parameter as argv[0] (aka command name),
* and all remaining args
*/
- rc = ((ulong (*)(int, char *[]))addr) (--argc, &argv[1]);
+ rc = do_go_exec ((void *)addr, argc - 1, argv + 1);
if (rc != 0) rcode = 1;
printf ("## Application terminated, rc = 0x%lX\n", rc);