From: Mike Frysinger <vapier@gentoo.org>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [patch] allow ports to override go behavior
Date: Fri, 1 Feb 2008 11:36:54 -0500 [thread overview]
Message-ID: <200802011136.55390.vapier@gentoo.org> (raw)
In-Reply-To: <200802011058.34891.vapier@gentoo.org>
blah, and without fail, i swapped nios/i386
---
This splits the arch-specific logic out of do_go() 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 didnt break them.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
diff --git a/common/cmd_boot.c b/common/cmd_boot.c
index e68f16f..82a5710 100644
--- a/common/cmd_boot.c
+++ b/common/cmd_boot.c
@@ -28,9 +28,11 @@
#include <command.h>
#include <net.h>
-#if defined(CONFIG_I386)
-DECLARE_GLOBAL_DATA_PTR;
-#endif
+__attribute__((weak))
+unsigned long do_go_exec (ulong (*entry)(int, char *[]), int argc, char *argv[])
+{
+ return entry (argc, argv);
+}
int do_go (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
@@ -50,21 +52,7 @@ int do_go (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
* 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]);
-#else
- /*
- * Nios function pointers are address >> 1
- */
- rc = ((ulong (*)(int, char *[]))(addr>>1)) (--argc, &argv[1]);
-#endif
+ rc = do_go_exec ((void *)addr, argv - 1, argv + 1);
if (rc != 0) rcode = 1;
printf ("## Application terminated, rc = 0x%lX\n", rc);
diff --git a/lib_i386/board.c b/lib_i386/board.c
index 47fbab4..36ab6a8 100644
--- a/lib_i386/board.c
+++ b/lib_i386/board.c
@@ -421,3 +421,13 @@ void hang (void)
puts ("### ERROR ### Please RESET the board ###\n");
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);
+}
diff --git a/lib_nios/board.c b/lib_nios/board.c
index 0a0d2e3..3a05e83 100644
--- a/lib_nios/board.c
+++ b/lib_nios/board.c
@@ -190,3 +190,11 @@ void hang (void)
puts("### ERROR ### Please reset board ###\n");
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);
+}
next prev parent reply other threads:[~2008-02-01 16:36 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-08 5:50 [U-Boot-Users] [Patch] Disable icache before call the first line of kernel in do_bootelf() Sonic Zhang
2007-08-08 6:50 ` Wolfgang Denk
2007-08-08 7:21 ` Michal Simek
2007-08-08 15:47 ` [U-Boot-Users] [Patch] Disable icache before call the firstline " Robin Getz
2007-08-08 15:54 ` Wolfgang Denk
2007-08-08 18:19 ` Stefan Roese
2007-08-08 7:33 ` [U-Boot-Users] [Patch] Disable icache before call the first line " Sonic Zhang
2007-08-08 15:41 ` Wolfgang Denk
2007-08-13 14:52 ` Mike Frysinger
2007-08-13 15:50 ` Wolfgang Denk
2007-08-13 16:21 ` Mike Frysinger
2008-01-29 2:14 ` Mike Frysinger
2008-01-29 22:35 ` Wolfgang Denk
2008-01-30 0:12 ` Mike Frysinger
2008-01-30 15:36 ` Johannes Stezenbach
2008-02-01 15:42 ` Mike Frysinger
2008-02-01 15:44 ` [U-Boot-Users] [patch] allow ports to override bootelf behavior Mike Frysinger
2008-04-13 22:01 ` Wolfgang Denk
2008-02-01 15:58 ` [U-Boot-Users] [patch] allow ports to override go behavior Mike Frysinger
2008-02-01 16:36 ` Mike Frysinger [this message]
2008-04-13 22:01 ` Wolfgang Denk
2008-04-13 22:01 ` Wolfgang Denk
-- strict thread matches above, loose matches on Subject: below --
2008-04-13 23:42 [U-Boot-Users] [PATCH] allow ports to override bootelf behavior Mike Frysinger
2008-04-13 23:42 ` [U-Boot-Users] [PATCH] allow ports to override go behavior Mike Frysinger
2008-04-18 7:54 ` Wolfgang Denk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200802011136.55390.vapier@gentoo.org \
--to=vapier@gentoo.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox