summaryrefslogtreecommitdiff
path: root/libcpu
diff options
context:
space:
mode:
authorgeniusgogo <[email protected]>2023-11-08 19:11:10 +0800
committerGitHub <[email protected]>2023-11-08 06:11:10 -0500
commitdf0d8b4230394a04b97482a9ea546e26e46b72a8 (patch)
tree71bbd8b38669701be7a04d6121d8c81d9af31432 /libcpu
parentda55491608e19c53d5260309a4fb2ccad930cc51 (diff)
fix aarch64 backtrace print
Diffstat (limited to 'libcpu')
-rw-r--r--libcpu/aarch64/common/trap.c50
1 files changed, 13 insertions, 37 deletions
diff --git a/libcpu/aarch64/common/trap.c b/libcpu/aarch64/common/trap.c
index 325fe1e8ba..d408b64163 100644
--- a/libcpu/aarch64/common/trap.c
+++ b/libcpu/aarch64/common/trap.c
@@ -34,52 +34,29 @@ extern long list_thread(void);
static void _check_fault(struct rt_hw_exp_stack *regs, uint32_t pc_adj, char *info)
{
- uint32_t mode = regs->cpsr;
+ uint32_t is_user_fault;
+ rt_thread_t th;
- if ((mode & 0x1f) == 0x00)
+ is_user_fault = !(regs->cpsr & 0x1f);
+ if (is_user_fault)
{
rt_kprintf("%s! pc = 0x%x\n", info, regs->pc - pc_adj);
+ }
- /* user stack backtrace */
- #ifdef RT_USING_LWP
- {
- rt_thread_t th;
-
- th = rt_thread_self();
- if (th && th->lwp)
- {
- arch_backtrace_uthread(th);
- }
- }
- #endif
+ /* user stack backtrace */
+ th = rt_thread_self();
+ if (th && th->lwp)
+ {
+ arch_backtrace_uthread(th);
+ }
+ if (is_user_fault)
+ {
#ifdef LWP_USING_CORE_DUMP
lwp_core_dump(regs, pc_adj);
#endif
sys_exit_group(-1);
}
- else
- {
- /* user stack backtrace */
- #ifdef RT_USING_LWP
- {
- rt_thread_t th;
-
- th = rt_thread_self();
- if (th && th->lwp)
- {
- arch_backtrace_uthread(th);
- }
- }
- #endif
-
- /* kernel stack backtrace */
- struct rt_hw_backtrace_frame frame = {
- .fp = regs->x29,
- .pc = regs->pc
- };
- rt_backtrace_frame(&frame);
- }
}
rt_inline int _get_type(unsigned long esr)
@@ -383,7 +360,6 @@ void rt_hw_trap_exception(struct rt_hw_exp_stack *regs)
rt_hw_cpu_shutdown();
}
-
void rt_hw_trap_serror(struct rt_hw_exp_stack *regs)
{
rt_kprintf("SError\n");