mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 3/4] ARM: Do not use last 64KiB of address space for barebox
Date: Fri,  1 Apr 2016 14:05:18 +0200	[thread overview]
Message-ID: <1459512319-32073-4-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1459512319-32073-1-git-send-email-s.hauer@pengutronix.de>

The last 64KiB of address space may be used for the vector table at
0xffff0000, so we cannot use it for barebox. The easiest way to archieve
this is to never use the last 64KiB of memory.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/cpu/entry.c               | 3 ++-
 arch/arm/include/asm/barebox-arm.h | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/arm/cpu/entry.c b/arch/arm/cpu/entry.c
index 3b74c6a..0cdcfec 100644
--- a/arch/arm/cpu/entry.c
+++ b/arch/arm/cpu/entry.c
@@ -1,6 +1,7 @@
 #include <types.h>
 
 #include <asm/cache.h>
+#include <asm/barebox-arm.h>
 
 #include "entry.h"
 
@@ -26,7 +27,7 @@
 void __naked __noreturn barebox_arm_entry(unsigned long membase,
 					  unsigned long memsize, void *boarddata)
 {
-	arm_setup_stack(membase + memsize - 16);
+	arm_setup_stack(arm_mem_stack(membase, membase + memsize) + STACK_SIZE - 16);
 	arm_early_mmu_cache_invalidate();
 
 	if (IS_ENABLED(CONFIG_PBL_MULTI_IMAGES))
diff --git a/arch/arm/include/asm/barebox-arm.h b/arch/arm/include/asm/barebox-arm.h
index 6713326..8e7b45c 100644
--- a/arch/arm/include/asm/barebox-arm.h
+++ b/arch/arm/include/asm/barebox-arm.h
@@ -97,7 +97,7 @@ void *barebox_arm_boot_dtb(void);
 static inline unsigned long arm_mem_stack(unsigned long membase,
 					  unsigned long endmem)
 {
-	return endmem - STACK_SIZE;
+	return endmem - SZ_64K - STACK_SIZE;
 }
 
 static inline unsigned long arm_mem_ttb(unsigned long membase,
-- 
2.7.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2016-04-01 12:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-01 12:05 [PATCH] ARM: Fix memory at end of address space Sascha Hauer
2016-04-01 12:05 ` [PATCH 1/4] ARM: pbl-multi: Fix SDRAM " Sascha Hauer
2016-04-01 12:05 ` [PATCH 2/4] ARM: start: Fix wrong format specifier Sascha Hauer
2016-04-01 12:05 ` Sascha Hauer [this message]
2016-04-01 12:05 ` [PATCH 4/4] ARM: Rework vector table setup 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=1459512319-32073-4-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.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