xiaoxiang781216 commented on code in PR #6957:
URL: https://github.com/apache/incubator-nuttx/pull/6957#discussion_r957988820


##########
arch/risc-v/src/common/riscv_exception.c:
##########
@@ -73,15 +73,15 @@ int riscv_exception(int mcause, void *regs, void *args)
 {
   uintptr_t cause = mcause & RISCV_IRQ_MASK;
 
-  if (mcause > RISCV_MAX_EXCEPTION)
-    {
-      _alert("EXCEPTION: Unknown.  MCAUSE: %" PRIxREG "\n", cause);
-    }
-  else
-    {
-      _alert("EXCEPTION: %s. MCAUSE: %" PRIxREG "\n",
-             g_reasons_str[cause], cause);
-    }
+  _alert("EXCEPTION: %s. MCAUSE: %" PRIxREG ", MTVAL: %" PRIxREG "\n",
+         mcause > RISCV_MAX_EXCEPTION ? "Unknown" : g_reasons_str[cause],
+         cause,
+#ifdef CONFIG_ARCH_USE_S_MODE
+         READ_CSR(CSR_STVAL)

Review Comment:
   let's define a general macro in arch/risc-v/include/mode.h?



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