9
0
Fork 0

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>
This commit is contained in:
Sascha Hauer 2014-12-08 12:15:06 +01:00
parent a47c7d1ecb
commit 0160f83492
1 changed files with 26 additions and 0 deletions

View File

@ -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));