public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] [RFC] raw go command
@ 2008-02-13 23:50 Kumar Gala
  2008-02-14  0:40 ` Wolfgang Denk
  2008-02-14  8:12 ` Haavard Skinnemoen
  0 siblings, 2 replies; 24+ messages in thread
From: Kumar Gala @ 2008-02-13 23:50 UTC (permalink / raw)
  To: u-boot

This patch is just a quick work up to see how to handle a particular
problem I've got.  The idea is that I want finer control over what happens
when I 'go' to piece of code.  The idea is it looks more like a native
function call than the current go which is more main() like.

The calling convention/num of args is specific to the PPC ABI.

I'm looking for suggestions, better names, etc.

thanks

- k

diff --git a/common/cmd_boot.c b/common/cmd_boot.c
index e68f16f..5b0bbe4 100644
--- a/common/cmd_boot.c
+++ b/common/cmd_boot.c
@@ -32,6 +32,42 @@
 DECLARE_GLOBAL_DATA_PTR;
 #endif

+int do_go_raw (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+	ulong	addr, i;
+	ulong	r[8] = { 0 };
+
+	void	(*img)(ulong, ulong, ulong, ulong,
+		       ulong, ulong, ulong, ulong);
+
+	if ((argc < 2) || (argc > 9)) {
+		printf ("Usage:\n%s\n", cmdtp->usage);
+		return 1;
+	}
+
+	addr = simple_strtoul(argv[1], NULL, 16);
+
+	img = (void (*)(ulong, ulong, ulong, ulong,
+			ulong, ulong, ulong, ulong)) addr;
+
+	for (i = 2; i < argc; i++)
+		r[i-2] = simple_strtoul(argv[i], NULL, 16);
+
+	(*img)(r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7]);
+	/* does not return */
+
+	return 0;
+}
+
+/* -------------------------------------------------------------------- */
+
+U_BOOT_CMD(
+	go_raw, CFG_MAXARGS, 1,	do_go_raw,
+	"go_raw  - start application at address 'addr'\n",
+	"addr [arg ...]\n    - start application@address 'addr'\n"
+	"      passing 'arg' as arguments\n"
+);
+
 int do_go (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
 	ulong	addr, rc;

^ permalink raw reply related	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2008-02-16  8:10 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-13 23:50 [U-Boot-Users] [RFC] raw go command Kumar Gala
2008-02-14  0:40 ` Wolfgang Denk
2008-02-14  0:57   ` Kumar Gala
2008-02-14  8:12 ` Haavard Skinnemoen
2008-02-14 14:24   ` Kumar Gala
2008-02-15  5:42     ` [U-Boot-Users] [PATCH] Add call command on PPC Kumar Gala
2008-02-15  5:54       ` Mike Frysinger
2008-02-15  6:00         ` Kumar Gala
2008-02-15  6:02           ` [U-Boot-Users] [PATCH v2] " Kumar Gala
2008-02-15  8:41             ` Wolfgang Denk
2008-02-16  8:03               ` Mike Frysinger
2008-02-15  6:32           ` [U-Boot-Users] [PATCH] " Mike Frysinger
2008-02-15  6:40             ` Kumar Gala
2008-02-15  7:08               ` Mike Frysinger
2008-02-15  7:21                 ` Haavard Skinnemoen
2008-02-15  7:29                   ` Mike Frysinger
2008-02-15  8:16                     ` Kumar Gala
2008-02-15  8:56                     ` Haavard Skinnemoen
2008-02-15  9:26                       ` Mike Frysinger
2008-02-15  8:14                   ` Kumar Gala
2008-02-15  8:43                     ` Wolfgang Denk
2008-02-15  8:30               ` Wolfgang Denk
2008-02-16  8:10               ` Mike Frysinger
2008-02-15  8:42       ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox