arch/arm-m: add api getpsp, for exception direct case
For exception_direct causing unwind to read NULL and breaks thread backtrace. Signed-off-by: buxiasen <buxiasen@xiaomi.com>
This commit is contained in:
parent
9bdcc4dc4b
commit
7a0ea108f6
3 changed files with 42 additions and 0 deletions
|
@ -323,6 +323,20 @@ static always_inline_function void setcontrol(uint32_t control)
|
|||
: "memory");
|
||||
}
|
||||
|
||||
static always_inline_function uint32_t getpsp(void)
|
||||
{
|
||||
uint32_t psp;
|
||||
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"\tmrs %0, psp\n"
|
||||
: "=r" (psp)
|
||||
:
|
||||
: "memory");
|
||||
|
||||
return psp;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_cpu_index
|
||||
*
|
||||
|
|
|
@ -473,6 +473,20 @@ static always_inline_function void setcontrol(uint32_t control)
|
|||
: "memory");
|
||||
}
|
||||
|
||||
static always_inline_function uint32_t getpsp(void)
|
||||
{
|
||||
uint32_t psp;
|
||||
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"\tmrs %0, psp\n"
|
||||
: "=r" (psp)
|
||||
:
|
||||
: "memory");
|
||||
|
||||
return psp;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_cpu_index
|
||||
*
|
||||
|
|
|
@ -448,6 +448,20 @@ static always_inline_function void setcontrol(uint32_t control)
|
|||
: "memory");
|
||||
}
|
||||
|
||||
static always_inline_function uint32_t getpsp(void)
|
||||
{
|
||||
uint32_t psp;
|
||||
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"\tmrs %0, psp\n"
|
||||
: "=r" (psp)
|
||||
:
|
||||
: "memory");
|
||||
|
||||
return psp;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_cpu_index
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue