From: Andrew Lunn <andrew@lunn.ch>
To: John Clark <clarkjc@runbox.com>
Cc: ecos-devel@sourceware.org
Subject: Re: Redboot load command is crippled
Date: Mon, 20 Nov 2006 23:13:00 -0000 [thread overview]
Message-ID: <20061120231309.GB30460@lunn.ch> (raw)
In-Reply-To: <4560DFDC.5090804@runbox.com>
[-- Attachment #1: Type: text/plain, Size: 753 bytes --]
On Sun, Nov 19, 2006 at 05:51:08PM -0500, John Clark wrote:
> Hello Andrew,
>
> Your patch matches what I have already done to get it to work for me.
> Without that change, it would never write anything to memory through the
> addr pointer if the address was outside of the memory range known to
> Redboot on the PC platform (beyond the first 640K).
>
> My only concern now is that the "Allow the load-command write into
> Flash" (CYGBLD_REDBOOT_LOAD_INTO_FLASH) option requires that "Validate
> RAM addresses during load" (CYGSEM_REDBOOT_VALIDATE_USER_RAM_LOADS)
> option be enabled as well. Otherwise, the code assuming that an invalid
> RAM address is a flash address just won't work.
I see what you mean. How about this patch.
Andrew
[-- Attachment #2: redboot.diff --]
[-- Type: text/plain, Size: 2978 bytes --]
Index: redboot/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/ChangeLog,v
retrieving revision 1.249
diff -u -r1.249 ChangeLog
--- redboot/current/ChangeLog 6 Sep 2006 14:26:52 -0000 1.249
+++ redboot/current/ChangeLog 20 Nov 2006 23:11:49 -0000
@@ -1,3 +1,8 @@
+2006-11-19 Andrew Lunn <lunn@laptop.lunn.ch>
+
+ * src/load.c: Only call valid_address() if
+ CYGSEM_REDBOOT_VALIDATE_USER_RAM_LOADS is enabled.
+
2006-09-06 Andrew Lunn <andrew.lunn@ascom.ch>
* cdl/redboot.cdl: Fix description of CYGSEM_REDBOOT_DISK_IDE.
Index: redboot/current/cdl/redboot.cdl
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/cdl/redboot.cdl,v
retrieving revision 1.76
diff -u -r1.76 redboot.cdl
--- redboot/current/cdl/redboot.cdl 6 Sep 2006 14:26:53 -0000 1.76
+++ redboot/current/cdl/redboot.cdl 20 Nov 2006 23:11:51 -0000
@@ -240,10 +240,13 @@
cdl_option CYGBLD_REDBOOT_LOAD_INTO_FLASH {
display "Allow the load-command write into Flash."
default_value 0
- active_if CYGPKG_REDBOOT_FLASH
+ active_if CYGPKG_REDBOOT_FLASH
+ requires CYGSEM_REDBOOT_VALIDATE_USER_RAM_LOADS
compile flash_load.c
description "
- Write images direct to Flash via the load command."
+ Write images direct to Flash via the load command.
+ We assume anthing which is invalid RAM is flash, hence
+ the requires statement"
}
cdl_option CYGBLD_BUILD_REDBOOT_WITH_CKSUM {
display "Include POSIX checksum command"
Index: redboot/current/src/load.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/src/load.c,v
retrieving revision 1.47
diff -u -r1.47 load.c
--- redboot/current/src/load.c 20 Jul 2006 20:27:47 -0000 1.47
+++ redboot/current/src/load.c 20 Nov 2006 23:11:52 -0000
@@ -422,9 +422,11 @@
redboot_getc_terminate(true);
return 0;
}
- if (valid_address(addr)) {
+#ifdef CYGSEM_REDBOOT_VALIDATE_USER_RAM_LOADS
+ if (valid_address(addr))
+#endif
*addr++ = ch;
- }
+
#ifdef CYGBLD_REDBOOT_LOAD_INTO_FLASH
else {
flash_load_write(addr, ch);
@@ -567,9 +569,11 @@
offset += count;
while (count-- > 0) {
val = _hex2(getc, 1, &sum);
- if (valid_address(addr)) {
+#ifdef CYGSEM_REDBOOT_VALIDATE_USER_RAM_LOADS
+ if (valid_address(addr))
+#endif
*addr++ = val;
- }
+
#ifdef CYGBLD_REDBOOT_LOAD_INTO_FLASH
else {
flash_load_write(addr, val);
next prev parent reply other threads:[~2006-11-20 23:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-19 12:46 John Clark
2006-11-19 16:01 ` Andrew Lunn
2006-11-19 22:51 ` John Clark
2006-11-20 23:13 ` Andrew Lunn [this message]
2006-11-22 6:51 ` John Clark
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=20061120231309.GB30460@lunn.ch \
--to=andrew@lunn.ch \
--cc=clarkjc@runbox.com \
--cc=ecos-devel@sourceware.org \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).