Skip to content

feat: Handle RISC-V MCAUSE interrupt causes (bit 31)#411

Merged
Jason2866 merged 2 commits into
new_exec_decoderfrom
copilot/sub-pr-410
Mar 1, 2026
Merged

feat: Handle RISC-V MCAUSE interrupt causes (bit 31)#411
Jason2866 merged 2 commits into
new_exec_decoderfrom
copilot/sub-pr-410

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 1, 2026

When an interrupt (not an exception) triggers a RISC-V panic, MCAUSE has bit 31 set. The previous code looked up the full value (e.g. 0x80000007) in RISCV_EXCEPTIONS, got None, and emitted no annotation — leaving MCAUSE silently unexplained in the monitor output.

Changes

  • RISCV_INTERRUPT_CAUSES — new immutable mapping of standard RISC-V M-mode interrupt cause numbers to names (software/timer/external × supervisor/machine)
  • get_riscv_exception() — now branches on MCAUSE bit 31:
    • Bit 31 = 0 → exception lookup (unchanged)
    • Bit 31 = 1 → interrupt lookup; named standard causes show "Interrupt: Machine timer interrupt", unknown/platform-specific (cause ≥ 16 on ESP32) show "Interrupt (cause N)"
# Before: no annotation for interrupt-triggered panics
MCAUSE  : 0x80000007

# After
MCAUSE  : 0x80000007 (Interrupt: Machine timer interrupt)
MCAUSE  : 0x80000010 (Interrupt (cause 16))

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: Jason2866 <24528715+Jason2866@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor stack decoding using GDB implementation feat: Handle RISC-V MCAUSE interrupt causes (bit 31) Mar 1, 2026
@Jason2866 Jason2866 marked this pull request as ready for review March 1, 2026 17:15
@Jason2866 Jason2866 merged commit b3365f9 into new_exec_decoder Mar 1, 2026
@Jason2866 Jason2866 deleted the copilot/sub-pr-410 branch March 1, 2026 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants