[U-Boot-Users] [RFC] raw go command

Kumar Gala galak at kernel.crashing.org
Thu Feb 14 00:50:20 CET 2008


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 at address 'addr'\n"
+	"      passing 'arg' as arguments\n"
+);
+
 int do_go (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
 	ulong	addr, rc;




More information about the U-Boot mailing list