From: Alexander Aring <alex.aring@gmail.com>
To: barebox@lists.infradead.org
Cc: marc@cpdesign.com
Subject: [PATCH 2/9] memory: fix size address calculation
Date: Sun, 13 Jan 2013 18:42:16 +0100 [thread overview]
Message-ID: <1358098943-18928-3-git-send-email-alex.aring@gmail.com> (raw)
In-Reply-To: <1358098943-18928-1-git-send-email-alex.aring@gmail.com>
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>
---
common/memory.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/common/memory.c b/common/memory.c
index 2674002..7dd1384 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
--
1.8.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2013-01-13 17:42 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-13 17:42 [PATCH 0/9] reimplement memtest command Alexander Aring
2013-01-13 17:42 ` [PATCH 1/9] meminfo: fix missing include Alexander Aring
2013-01-13 17:42 ` Alexander Aring [this message]
2013-01-13 17:42 ` [PATCH 3/9] meminfo: fix display of allocated addresses Alexander Aring
2013-01-13 17:42 ` [PATCH 4/9] arm-mmu: remove semicolon in arm mmu.c Alexander Aring
2013-01-13 17:42 ` [PATCH 5/9] mmu: make remap_range global accessable Alexander Aring
2013-01-13 17:42 ` [PATCH 6/9] memory: add function address_in_sdram_regions Alexander Aring
2013-01-13 17:42 ` [PATCH 7/9] barebox-data: add barebox-data sections Alexander Aring
2013-01-14 9:51 ` Sascha Hauer
2013-01-14 10:39 ` Alexander Aring
2013-01-13 17:42 ` [PATCH 8/9] memtest: remove memtest command Alexander Aring
2013-01-13 17:42 ` [PATCH 9/9] memtest: add rewritten " Alexander Aring
2013-01-14 13:11 ` [PATCH 0/9] reimplement " Sascha Hauer
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=1358098943-18928-3-git-send-email-alex.aring@gmail.com \
--to=alex.aring@gmail.com \
--cc=barebox@lists.infradead.org \
--cc=marc@cpdesign.com \
/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