mirror of
https://xff.cz/git/u-boot/
synced 2025-09-01 16:52:14 +02:00
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.
This commit is contained in:
committed by
Wolfgang Denk
parent
017e9b7925
commit
a49864593e
@@ -28,25 +28,11 @@
|
|||||||
#include <command.h>
|
#include <command.h>
|
||||||
#include <net.h>
|
#include <net.h>
|
||||||
|
|
||||||
#if defined(CONFIG_I386)
|
/* Allow ports to override the default behavior */
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
__attribute__((weak))
|
||||||
#endif
|
unsigned long do_go_exec (ulong (*entry)(int, char *[]), int argc, char *argv[])
|
||||||
|
|
||||||
static inline void go_setup(int argc, char *argv[])
|
|
||||||
{
|
{
|
||||||
#if defined(CONFIG_I386)
|
return entry (argc, argv);
|
||||||
/*
|
|
||||||
* 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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int do_go (cmd_tbl_t *cmdtp, int flag, int argc, char *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);
|
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),
|
* pass address parameter as argv[0] (aka command name),
|
||||||
* and all remaining args
|
* 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;
|
if (rc != 0) rcode = 1;
|
||||||
|
|
||||||
printf ("## Application terminated, rc = 0x%lX\n", rc);
|
printf ("## Application terminated, rc = 0x%lX\n", rc);
|
||||||
|
@@ -421,3 +421,11 @@ void hang (void)
|
|||||||
puts ("### ERROR ### Please RESET the board ###\n");
|
puts ("### ERROR ### Please RESET the board ###\n");
|
||||||
for (;;);
|
for (;;);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned long do_go_exec (ulong (*entry)(int, char *[]), int argc, char *argv[])
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Nios function pointers are address >> 1
|
||||||
|
*/
|
||||||
|
return (entry >> 1) (argc, argv);
|
||||||
|
}
|
||||||
|
@@ -190,3 +190,13 @@ void hang (void)
|
|||||||
puts("### ERROR ### Please reset board ###\n");
|
puts("### ERROR ### Please reset board ###\n");
|
||||||
for (;;);
|
for (;;);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned long do_go_exec (ulong (*entry)(int, char *[]), int argc, char *argv[])
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* x86 does not use a dedicated register to pass the pointer
|
||||||
|
* to the global_data
|
||||||
|
*/
|
||||||
|
argv[-1] = (char *)gd;
|
||||||
|
return entry (argc, argv);
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user