changeset 1661:431860e2ee69

Improve Linux 'exec' to be sensitive to load failures
author gthomas
date Thu, 27 May 2004 13:22:05 +0000
parents eb74917a64e1
children feba8011053f
files packages/hal/arm/arch/current/ChangeLog packages/hal/arm/arch/current/src/redboot_linux_exec.c packages/hal/h8300/arch/current/ChangeLog packages/hal/h8300/arch/current/src/redboot_linux_exec.c packages/hal/mips/arch/current/ChangeLog packages/hal/mips/arch/current/src/redboot_linux_exec.c packages/hal/mn10300/am33/current/ChangeLog packages/hal/mn10300/am33/current/src/redboot_linux_exec.c packages/hal/powerpc/arch/current/ChangeLog packages/hal/powerpc/arch/current/src/redboot_linux_exec.c packages/hal/sh/arch/current/ChangeLog packages/hal/sh/arch/current/src/redboot_linux_exec.c
diffstat 12 files changed, 66 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/packages/hal/arm/arch/current/ChangeLog
+++ b/packages/hal/arm/arch/current/ChangeLog
@@ -1,3 +1,9 @@
+2004-05-27  Gary Thomas  <gary@mlbassoc.com>
+
+	* src/redboot_linux_exec.c (do_exec): Be sensitive to value in
+	"entry_address" as this can indicate if the image to be executed
+	is valid (the "load" functions set it to "NO_MEMORY" when invalid)
+
 2004-05-24   Ian Campbell <icampbell@arcom.com>
 
 	* src/hal_misc.c: __mem_fault_handler: Only do this if we have
--- a/packages/hal/arm/arch/current/src/redboot_linux_exec.c
+++ b/packages/hal/arm/arch/current/src/redboot_linux_exec.c
@@ -9,7 +9,7 @@
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
 // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
-// Copyright (C) 2003 Gary Thomas
+// Copyright (C) 2003, 2004 Gary Thomas
 //
 // eCos is free software; you can redistribute it and/or modify it under
 // the terms of the GNU General Public License as published by the Free
@@ -316,6 +316,10 @@ do_exec(int argc, char *argv[])
     {
         return;
     }
+    if (entry == (unsigned long)NO_MEMORY) {
+        diag_printf("Can't execute Linux - invalid entry address\n");
+        return;
+    }
 
     // Set up parameters to pass to kernel
 
--- a/packages/hal/h8300/arch/current/ChangeLog
+++ b/packages/hal/h8300/arch/current/ChangeLog
@@ -1,3 +1,9 @@
+2004-05-27  Gary Thomas  <gary@mlbassoc.com>
+
+	* src/redboot_linux_exec.c (do_exec): Be sensitive to value in
+	"entry_address" as this can indicate if the image to be executed
+	is valid (the "load" functions set it to "NO_MEMORY" when invalid)
+
 2004-04-22  Jani Monoses <jani@iv.ro>
 
 	 * cdl/hal_h8300.cdl :
--- a/packages/hal/h8300/arch/current/src/redboot_linux_exec.c
+++ b/packages/hal/h8300/arch/current/src/redboot_linux_exec.c
@@ -9,6 +9,7 @@
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+// Copyright (C) 2004 Gary Thomas
 //
 // eCos is free software; you can redistribute it and/or modify it under
 // the terms of the GNU General Public License as published by the Free
@@ -80,6 +81,10 @@ do_exec(int argc, char *argv[])
     if (!scan_opts(argc, argv, 1, opts, 2, (void *)&entry, 
                    OPTION_ARG_TYPE_NUM, "entry address"))
 	    return ;
+    if (entry == (unsigned long)NO_MEMORY) {
+        diag_printf("Can't execute Linux - invalid entry address\n");
+        return;
+    }
   
     diag_printf("Now booting linux kernel:\n");
     diag_printf(" Entry Address 0x%08x\n", entry);
--- a/packages/hal/mips/arch/current/ChangeLog
+++ b/packages/hal/mips/arch/current/ChangeLog
@@ -1,3 +1,9 @@
+2004-05-27  Gary Thomas  <gary@mlbassoc.com>
+
+	* src/redboot_linux_exec.c (do_exec): Be sensitive to value in
+	"entry_address" as this can indicate if the image to be executed
+	is valid (the "load" functions set it to "NO_MEMORY" when invalid)
+
 2004-05-16  Andrew Dyer  <adyer@righthandtech.com>
 
 	* include/hal_cache.h: Changed the calculation of _IWAY and _DWAY
--- a/packages/hal/mips/arch/current/src/redboot_linux_exec.c
+++ b/packages/hal/mips/arch/current/src/redboot_linux_exec.c
@@ -9,6 +9,7 @@
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
 // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
+// Copyright (C) 2004 Gary Thomas
 //
 // eCos is free software; you can redistribute it and/or modify it under
 // the terms of the GNU General Public License as published by the Free
@@ -114,6 +115,10 @@ do_exec(int argc, char *argv[])
     if (!scan_opts(argc, argv, 1, opts, 3, (void *)&entry, 
                    OPTION_ARG_TYPE_NUM, "entry address"))
         return;
+    if (entry == (unsigned long)NO_MEMORY) {
+        diag_printf("Can't execute Linux - invalid entry address\n");
+        return;
+    }
 
     linux = (void *)entry;
 
--- a/packages/hal/mn10300/am33/current/ChangeLog
+++ b/packages/hal/mn10300/am33/current/ChangeLog
@@ -1,3 +1,9 @@
+2004-05-27  Gary Thomas  <gary@mlbassoc.com>
+
+	* src/redboot_linux_exec.c (do_exec): Be sensitive to value in
+	"entry_address" as this can indicate if the image to be executed
+	is valid (the "load" functions set it to "NO_MEMORY" when invalid)
+
 2004-04-22  Jani Monoses <jani@iv.ro>
 
 	 * cdl/hal_mn10300_am33.cdl :
--- a/packages/hal/mn10300/am33/current/src/redboot_linux_exec.c
+++ b/packages/hal/mn10300/am33/current/src/redboot_linux_exec.c
@@ -9,6 +9,7 @@
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
 // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
+// Copyright (C) 2004 Gary Thomas
 //
 // eCos is free software; you can redistribute it and/or modify it under
 // the terms of the GNU General Public License as published by the Free
@@ -105,6 +106,10 @@ do_exec(int argc, char *argv[])
     {
         return;
     }
+    if (entry == (unsigned long)NO_MEMORY) {
+        diag_printf("Can't execute Linux - invalid entry address\n");
+        return;
+    }
     if (cmd_line_set) {
 	memcpy((char*)CYGHWR_REDBOOT_AM33_LINUX_CMD_ADDRESS,"cmdline:",8);
         strncpy((char*)CYGHWR_REDBOOT_AM33_LINUX_CMD_ADDRESS+8,cmd_line,256);
--- a/packages/hal/powerpc/arch/current/ChangeLog
+++ b/packages/hal/powerpc/arch/current/ChangeLog
@@ -1,3 +1,9 @@
+2004-05-27  Gary Thomas  <gary@mlbassoc.com>
+
+	* src/redboot_linux_exec.c (do_exec): Be sensitive to value in
+	"entry_address" as this can indicate if the image to be executed
+	is valid (the "load" functions set it to "NO_MEMORY" when invalid)
+
 2004-04-29  Jonathan Larmour  <jifl@eCosCentric.com>
 
 	* include/hal_arch.h (HAL_SET_GDB_FLOATING_POINT_REGISTERS): Make
--- a/packages/hal/powerpc/arch/current/src/redboot_linux_exec.c
+++ b/packages/hal/powerpc/arch/current/src/redboot_linux_exec.c
@@ -9,7 +9,7 @@
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
 // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
-// Copyright (C) 2002, 2003 Gary Thomas
+// Copyright (C) 2002, 2003, 2004 Gary Thomas
 //
 // eCos is free software; you can redistribute it and/or modify it under
 // the terms of the GNU General Public License as published by the Free
@@ -120,6 +120,10 @@ do_exec(int argc, char *argv[])
                    "[physical] starting address")) {
         return;
     }
+    if (entry == (unsigned long)NO_MEMORY) {
+        diag_printf("Can't execute Linux - invalid entry address\n");
+        return;
+    }
 
     // Determine baud rate on current console
     __chan = CYGACC_CALL_IF_CONSOLE_PROCS();
--- a/packages/hal/sh/arch/current/ChangeLog
+++ b/packages/hal/sh/arch/current/ChangeLog
@@ -1,3 +1,9 @@
+2004-05-27  Gary Thomas  <gary@mlbassoc.com>
+
+	* src/redboot_linux_exec.c (do_exec): Be sensitive to value in
+	"entry_address" as this can indicate if the image to be executed
+	is valid (the "load" functions set it to "NO_MEMORY" when invalid)
+
 2004-04-30  Yoshinori Sato  <ysato@users.sourceforge.jp>
 
 	* src/sh.ld: Add entry section for targets, like Dreamcast, that
--- a/packages/hal/sh/arch/current/src/redboot_linux_exec.c
+++ b/packages/hal/sh/arch/current/src/redboot_linux_exec.c
@@ -9,6 +9,7 @@
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
 // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
+// Copyright (C) 2004 Gary Thomas
 //
 // eCos is free software; you can redistribute it and/or modify it under
 // the terms of the GNU General Public License as published by the Free
@@ -123,6 +124,10 @@ do_exec(int argc, char *argv[])
     if (!scan_opts(argc, argv, 1, opts, 8, (void *)&entry, 
                    OPTION_ARG_TYPE_NUM, "entry address"))
         return;
+    if (entry == (unsigned long)NO_MEMORY) {
+        diag_printf("Can't execute Linux - invalid entry address\n");
+        return;
+    }
   
     diag_printf("Now booting linux kernel:\n");
     diag_printf(" Base address 0x%08x Entry 0x%08x\n", base_addr, entry);