This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 3c2b20328683d9a328d38f90290db272af3b792f
Author: wangmingrong1 <wangmingro...@xiaomi.com>
AuthorDate: Tue Jun 24 15:22:03 2025 +0800

    arm64->fetal: Support return to thread site
    
    The breakpoint of arm64 is fetal_handler, which needs to return to the scene
    
    Signed-off-by: wangmingrong1 <wangmingro...@xiaomi.com>
---
 arch/arm64/src/common/arm64_fatal.c   | 4 +++-
 arch/arm64/src/common/arm64_fatal.h   | 4 ++--
 arch/arm64/src/common/arm64_vectors.S | 4 +++-
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/src/common/arm64_fatal.c 
b/arch/arm64/src/common/arm64_fatal.c
index 7f25d0e44b..e9c23e2dee 100644
--- a/arch/arm64/src/common/arm64_fatal.c
+++ b/arch/arm64/src/common/arm64_fatal.c
@@ -548,7 +548,7 @@ static int arm64_exception_handler(uint64_t *regs)
  * Public Functions
  ****************************************************************************/
 
-void arm64_fatal_handler(uint64_t *regs)
+uint64_t *arm64_fatal_handler(uint64_t *regs)
 {
   struct tcb_s *tcb = this_task();
   int ret;
@@ -575,6 +575,8 @@ void arm64_fatal_handler(uint64_t *regs)
   /* Clear irq flag */
 
   write_sysreg((uintptr_t)tcb & ~1ul, tpidr_el1);
+
+  return regs;
 }
 
 void arm64_register_debug_hook(int nr, fatal_handle_func_t fn)
diff --git a/arch/arm64/src/common/arm64_fatal.h 
b/arch/arm64/src/common/arm64_fatal.h
index 1db3569dca..ea3039bc37 100644
--- a/arch/arm64/src/common/arm64_fatal.h
+++ b/arch/arm64/src/common/arm64_fatal.h
@@ -182,12 +182,12 @@ typedef int (*fatal_handle_func_t)(uint64_t *regs, 
uint64_t far,
  * Input Parameters:
  *   reg:    exception stack reg context
  *
- * Returned Value: None
+ * Returned Value: regs
  *   If the function return, the exception has been handled
  *
  ****************************************************************************/
 
-void arm64_fatal_handler(uint64_t *reg);
+uint64_t *arm64_fatal_handler(uint64_t *reg);
 
 /****************************************************************************
  * Name: arm64_register_debug_hook
diff --git a/arch/arm64/src/common/arm64_vectors.S 
b/arch/arm64/src/common/arm64_vectors.S
index a18e0a9838..bf913ef200 100644
--- a/arch/arm64/src/common/arm64_vectors.S
+++ b/arch/arm64/src/common/arm64_vectors.S
@@ -200,7 +200,9 @@ reserved_syscall:
     mov    x0, sp
     adrp   x5, arm64_fatal_handler
     add    x5, x5, #:lo12:arm64_fatal_handler
-    br     x5
+    blr    x5
+    mov    sp, x0
+    b      arm64_exit_exception
 
 /****************************************************************************
  * Name: arm64_irq_handler

Reply via email to