public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [patch] allow ports to override bootelf behavior
Date: Fri, 1 Feb 2008 10:44:59 -0500	[thread overview]
Message-ID: <200802011045.00200.vapier@gentoo.org> (raw)
In-Reply-To: <20070813155047.C419424041@gemini.denx.de>

This splits the dcache logic out of do_bootelf into a dedicated weak function
called do_bootelf_exec.  This way ports can control the behavior before
executing an ELF image however they like.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
diff --git a/common/cmd_elf.c b/common/cmd_elf.c
index 2eb7453..5689e2c 100644
--- a/common/cmd_elf.c
+++ b/common/cmd_elf.c
@@ -30,6 +30,31 @@ DECLARE_GLOBAL_DATA_PTR;
 int valid_elf_image (unsigned long addr);
 unsigned long load_elf_image (unsigned long addr);
 
+__attribute__((weak))
+unsigned long do_bootelf_exec (ulong (*entry)(int, char *[]), int argc, char *argv[])
+{
+	unsigned long ret;
+
+	/*
+	 * QNX images require the data cache is disabled.
+	 * Data cache is already flushed, so just turn it off.
+	 */
+	int dcache = dcache_status ();
+	if (dcache)
+		dcache_disable ();
+
+	/*
+	 * pass address parameter as argv[0] (aka command name),
+	 * and all remaining args
+	 */
+	ret = entry (argc, argv);
+
+	if (dcache)
+		dcache_enable ();
+
+	return ret;
+}
+
 /* ======================================================================
  * Interpreter command to boot an arbitrary ELF image from memory.
  * ====================================================================== */
@@ -53,18 +78,7 @@ int do_bootelf (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 
 	printf ("## Starting application at 0x%08lx ...\n", addr);
 
-	/*
-	 * QNX images require the data cache is disabled.
-	 * Data cache is already flushed, so just turn it off.
-	 */
-	if (dcache_status ())
-		dcache_disable ();
-
-	/*
-	 * pass address parameter as argv[0] (aka command name),
-	 * and all remaining args
-	 */
-	rc = ((ulong (*)(int, char *[])) addr) (--argc, &argv[1]);
+	rc = do_bootelf_exec ((void *)addr, argc - 1, argv + 1);
 	if (rc != 0)
 		rcode = 1;
 

  parent reply	other threads:[~2008-02-01 15:44 UTC|newest]

Thread overview: 25+ 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         ` Mike Frysinger [this message]
2008-04-13 22:01           ` [U-Boot-Users] [patch] allow ports to override bootelf behavior 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
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-18  7:54 ` Wolfgang Denk
2008-04-18 14:49   ` Stefan Roese

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=200802011045.00200.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