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:
buxiasen 2024-11-19 17:40:10 +08:00 committed by Xiang Xiao
parent 9bdcc4dc4b
commit 7a0ea108f6
3 changed files with 42 additions and 0 deletions

View file

@ -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
*

View file

@ -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
*

View file

@ -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
*