diff mbox

[U-Boot,RFC,09/20] sandbox: Add bootm support

Message ID 1316278139-28635-10-git-send-email-sjg@chromium.org
State Superseded, archived
Headers show

Commit Message

Simon Glass Sept. 17, 2011, 4:48 p.m. UTC
This adds sandbox architecture support to bootm, although it is probably
not useful to load sandbox code into the address space and execute it.

These changes at least make the file build correctly on 64-bit machines.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 common/cmd_bootm.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

Comments

Mike Frysinger Sept. 18, 2011, 12:16 a.m. UTC | #1
On Saturday, September 17, 2011 12:48:48 Simon Glass wrote:
> --- a/common/cmd_bootm.c
> +++ b/common/cmd_bootm.c
>
> +#if BITS_PER_LONG == 32
>  	int   (*appl)(int, char * const []);
> +#endif
> 
> +#if BITS_PER_LONG == 32
>  	appl = (int (*)(int, char * const []))ntohl(images.ep);
>  	(*appl)(argc-1, &argv[1]);
> -
> +#endif

why do you need this ?  if it's because you're converting from a 32bit int to 
a pointer, then you could address this by putting an (unsigned long) cast 
between the pointer and the ntohl() call.
-mike
Simon Glass Sept. 23, 2011, 3:55 p.m. UTC | #2
On Sat, Sep 17, 2011 at 5:16 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Saturday, September 17, 2011 12:48:48 Simon Glass wrote:
>> --- a/common/cmd_bootm.c
>> +++ b/common/cmd_bootm.c
>>
>> +#if BITS_PER_LONG == 32
>>       int   (*appl)(int, char * const []);
>> +#endif
>>
>> +#if BITS_PER_LONG == 32
>>       appl = (int (*)(int, char * const []))ntohl(images.ep);
>>       (*appl)(argc-1, &argv[1]);
>> -
>> +#endif
>
> why do you need this ?  if it's because you're converting from a 32bit int to
> a pointer, then you could address this by putting an (unsigned long) cast
> between the pointer and the ntohl() call.

OK have done this.

> -mike
>
diff mbox

Patch

diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 8909ee7..b16e242 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -187,6 +187,8 @@  void arch_preboot_os(void) __attribute__((weak, alias("__arch_preboot_os")));
   #define IH_INITRD_ARCH IH_ARCH_SH
 #elif defined(__sparc__)
   #define IH_INITRD_ARCH IH_ARCH_SPARC
+#elif defined(CONFIG_SANDBOX_ARCH)
+  #define IH_INITRD_ARCH IH_ARCH_SANDBOX
 #else
 # error Unknown CPU type
 #endif
@@ -453,7 +455,9 @@  static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
 static int bootm_start_standalone(ulong iflag, int argc, char * const argv[])
 {
 	char  *s;
+#if BITS_PER_LONG == 32
 	int   (*appl)(int, char * const []);
+#endif
 
 	/* Don't start if "autostart" is set to "no" */
 	if (((s = getenv("autostart")) != NULL) && (strcmp(s, "no") == 0)) {
@@ -462,9 +466,10 @@  static int bootm_start_standalone(ulong iflag, int argc, char * const argv[])
 		setenv("filesize", buf);
 		return 0;
 	}
+#if BITS_PER_LONG == 32
 	appl = (int (*)(int, char * const []))ntohl(images.ep);
 	(*appl)(argc-1, &argv[1]);
-
+#endif
 	return 0;
 }
 
@@ -488,14 +493,14 @@  static cmd_tbl_t cmd_bootm_sub[] = {
 int do_bootm_subcommand (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	int ret = 0;
-	int state;
+	long state;
 	cmd_tbl_t *c;
 	boot_os_fn *boot_fn;
 
 	c = find_cmd_tbl(argv[1], &cmd_bootm_sub[0], ARRAY_SIZE(cmd_bootm_sub));
 
 	if (c) {
-		state = (int)c->cmd;
+		state = (long)c->cmd;
 
 		/* treat start special since it resets the state machine */
 		if (state == BOOTM_STATE_START) {