9
0
Fork 0

add the possibility to have a arch specific 'go' command. Some

architectures need this (e.g. blackfin and i386)
This commit is contained in:
Sascha Hauer 2007-09-16 11:16:08 +02:00
parent 1ef73a95be
commit ca8ae5695a
3 changed files with 16 additions and 24 deletions

View File

@ -32,7 +32,7 @@
#include <init.h>
#include <environment.h>
#include <mem_malloc.h>
#include "blackfin_board.h"
#include <asm/cpu.h>
int blackfin_mem_malloc_init(void)
{
@ -43,8 +43,13 @@ int blackfin_mem_malloc_init(void)
core_initcall(blackfin_mem_malloc_init);
void reset_cpu(ulong ignored)
int arch_execute(unsigned long address, int argc, char *argv[])
{
printf("do not ave a reset function\n");
while (1);
int ret;
icache_disable();
ret = ((ulong (*)(int, char *[]))address) (argc, &argv[0]);
icache_enable();
return ret;
}

View File

@ -34,7 +34,7 @@ int do_go (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
int rcode = 0;
if (argc < 2) {
printf ("Usage:\n%s\n", cmdtp->usage);
u_boot_cmd_usage(cmdtp);
return 1;
}
@ -42,26 +42,11 @@ int do_go (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
printf ("## Starting application at 0x%08lX ...\n", addr);
/*
* pass address parameter as argv[0] (aka command name),
* and all remaining args
*/
#if defined(CONFIG_I386)
/*
* x86 does not use a dedicated register to pass the pointer
* to the global_data
*/
argv[0] = (char *)gd;
#endif
#if !defined(CONFIG_NIOS)
rc = ((ulong (*)(int, char *[]))addr) (--argc, &argv[1]);
#ifdef ARCH_HAS_EXECUTE
rc = arch_execute(addr, argc, &argv[1]);
#else
/*
* Nios function pointers are address >> 1
*/
rc = ((ulong (*)(int, char *[]))(addr>>1)) (--argc, &argv[1]);
rc = ((ulong (*)(int, char *[]))addr) (--argc, &argv[1]);
#endif
if (rc != 0) rcode = 1;
printf ("## Application terminated, rc = 0x%lX\n", rc);
return rcode;

View File

@ -164,6 +164,8 @@ int parse_area_spec(const char *str, ulong *start, ulong *size);
/* Just like simple_strtoul(), but this one honors a K/M/G suffix */
unsigned long strtoul_suffix(const char *str, char **endp, int base);
extern void start_uboot(void);
void start_uboot(void);
int arch_execute(unsigned long address, int argc, char *argv[]);
#endif /* __COMMON_H_ */