arch/arm64: change up_saveusercontext to assembly code

minidump will backtrace failure when use C code to save user context,
because the stack push operation in C code can disrupt the stack information.

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
This commit is contained in:
zhangyuan21 2023-04-06 13:48:28 +08:00 committed by Xiang Xiao
parent 1e726a914a
commit 41f83a0271
3 changed files with 3 additions and 42 deletions

View File

@ -254,7 +254,6 @@ void arm64_secondary_start(void);
void arm64_fullcontextrestore(uint64_t *restoreregs) noreturn_function;
void arm64_switchcontext(uint64_t **saveregs, uint64_t *restoreregs);
void arm64_context_snapshot(void *savereg);
/* Signal handling **********************************************************/

View File

@ -44,44 +44,6 @@
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_saveusercontext
*
* Description:
* Save the current thread context. Full prototype is:
*
* int up_saveusercontext(void *saveregs);
*
* Returned Value:
* 0: Normal return
* 1: Context switch return
*
****************************************************************************/
#ifdef CONFIG_BUILD_FLAT
int up_saveusercontext(void *saveregs)
{
irqstate_t flags;
/* Take a snapshot of the thread context right now */
flags = enter_critical_section();
arm64_context_snapshot(saveregs);
leave_critical_section(flags);
return 0;
}
#else
int up_saveusercontext(void *saveregs)
{
return sys_call1(SYS_save_context, (uintptr_t)saveregs);
}
#endif
/****************************************************************************
* Name: arm64_fullcontextrestore
*

View File

@ -60,15 +60,15 @@
****************************************************************************/
/****************************************************************************
* Function: arm64_context_snapshot
* Function: up_saveusercontext
*
* Description:
* Take a snapshot of the thread GP registers context
* x0 --- pointer to struct regs_context
*
****************************************************************************/
GTEXT(arm64_context_snapshot)
SECTION_FUNC(text, arm64_context_snapshot)
GTEXT(up_saveusercontext)
SECTION_FUNC(text, up_saveusercontext)
str x0, [sp, #-16]!
stp x0, x1, [x0, #8 * REG_X0]