diff options
author | Alexander Aring <alex.aring@gmail.com> | 2013-01-13 18:42:16 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-01-14 13:21:39 +0100 |
commit | 3f170cdd583efa055728441e451f4120c0a63a8f (patch) | |
tree | 52be427e042f336eaffa8b6035704a130904b329 /common | |
parent | ce50c0b2b19a4b339d848120f77811ffafdafdb1 (diff) | |
download | barebox-3f170cdd583efa055728441e451f4120c0a63a8f.tar.gz barebox-3f170cdd583efa055728441e451f4120c0a63a8f.tar.xz |
memory: fix size address calculation
Fix size address calculation.
Global variables from <asm/sections.h> which are defined
in linker script *.lds files for end addresses has already
a +1 calculation.
For example:
stext = 0x100 with a size about 0x50 will result a etext = 0x150.
In this case a correct size calculation is (etext - stext) = 0x50.
In function 'request_sdram_region' the end address will be
calculated with (start + size - 1) which result a correct
end address of 0x149 in this example.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r-- | common/memory.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/common/memory.c b/common/memory.c index 267400229a..7dd13849c6 100644 --- a/common/memory.c +++ b/common/memory.c @@ -74,11 +74,11 @@ static int mem_malloc_resource(void) request_sdram_region("barebox", (unsigned long)&_stext, (unsigned long)&_etext - - (unsigned long)&_stext + 1); + (unsigned long)&_stext); request_sdram_region("bss", (unsigned long)&__bss_start, (unsigned long)&__bss_stop - - (unsigned long)&__bss_start + 1); + (unsigned long)&__bss_start); #ifdef STACK_BASE request_sdram_region("stack", STACK_BASE, STACK_SIZE); #endif |