summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2014-12-08 12:15:06 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2015-01-05 11:31:00 +0100
commit0160f834928a7b7c518c69bb4feb8750796caebc (patch)
treed96c038ae048a214520f8e68c0d9650aadc9a876 /arch
parenta47c7d1ecb6307e5e9f0cb8ddcfb2b8803d963a4 (diff)
downloadbarebox-0160f834928a7b7c518c69bb4feb8750796caebc.tar.gz
barebox-0160f834928a7b7c518c69bb4feb8750796caebc.tar.xz
ARM: Add get_sp() and get_lr() functions
In case it's needed for some early code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/include/asm/common.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/arch/arm/include/asm/common.h b/arch/arm/include/asm/common.h
index 133bb8e1f6..9ff3b19c7b 100644
--- a/arch/arm/include/asm/common.h
+++ b/arch/arm/include/asm/common.h
@@ -16,6 +16,32 @@ static inline unsigned long get_pc(void)
return pc;
}
+static inline unsigned long get_lr(void)
+{
+ unsigned long lr;
+
+ __asm__ __volatile__(
+ "mov %0, lr\n"
+ : "=r" (lr)
+ :
+ : "memory");
+
+ return lr;
+}
+
+static inline unsigned long get_sp(void)
+{
+ unsigned long sp;
+
+ __asm__ __volatile__(
+ "mov %0, sp\n"
+ : "=r" (sp)
+ :
+ : "memory");
+
+ return sp;
+}
+
static inline void arm_setup_stack(unsigned long top)
{
__asm__ __volatile__("mov sp, %0" : : "r"(top));