fdcavalcanti commented on code in PR #15815:
URL: https://github.com/apache/nuttx/pull/15815#discussion_r1956410518


##########
arch/risc-v/src/common/riscv_exception_common.S:
##########
@@ -207,25 +207,46 @@ handle_irq:
   .cfi_offset x2, 8               /* Toolchain not support macro, is REG_X2 * 
4 */
   .cfi_offset ra, 0               /* Toolchain not support macro, is REG_EPC * 
4 */
 
+  REGLOAD    ra, REG_EPC(sp)
+  REGLOAD    s0, REG_X8(sp)

Review Comment:
   So I tested this in some scenarios.
   Added only this change to master branch and also removed this change from 
this PR branch.
   Both cases give us bad results.
   
   Here's the master branch + this modification. We get the backtrace stuck in 
a loop printing the same content.
   ```
   sched_dumpstack: backtrace| 3: 0x800009cc 0x80000688 0x80000630 0x8000016a 
0x800009cc 0x80000688 0x80000630 0x8000016a
   [repeat indefinitely]
   ```
   Which is:
   ```
   $ ./tools/btdecode.sh riscv-none-elf-addr2line bt
   Backtrace for task 3:
   0x800009cc: irq_dispatch at irq_dispatch.c:160
   0x80000688: riscv_doirq at riscv_doirq.c:102
   0x80000630: riscv_dispatch_irq at qemu_rv_irq_dispatch.c:140
   0x8000016a: return_from_exception at riscv_exception_common.S:243
   0x800009cc: irq_dispatch at irq_dispatch.c:160
   0x80000688: riscv_doirq at riscv_doirq.c:102
   0x80000630: riscv_dispatch_irq at qemu_rv_irq_dispatch.c:140
   0x8000016a: return_from_exception at riscv_exception_common.S:243
   ```
   
   Now if I **remove** this section from this PR's branch, we get the same 
endless repeating loop.
   ```
   sched_dumpstack: backtrace| 3: 0x8001a374 0x8001a374 0x8001a374 0x8001a374 
0x8001a374 0x8001a374 0x8001a374 0x8001a374
   [repeat indefinetly]
   ```
   Which is:
   ```
   0x8001a374: assert_on_interrupt_handler at backtrace_qemu_main.c:112
   ```
   
   So we can't have this as a standalone patch, won't work. We need to keep 
this all together.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to