Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faulting virtual address is written to mtval after ebreak instruction. #426

Closed
JaewonHur opened this issue Mar 20, 2020 · 1 comment
Closed

Comments

@JaewonHur
Copy link

While cross-checking Spike and Rocket chip, there was a mismatch between them.
When ebreak instruction is triggered, Spike writes the faulting virtual address to mtval register. However Rocket chip doesn't.

I also issued it to the Rocket chip git, and the answer was as follow.
chipsalliance/rocket-chip#2348
could you check this behavior?

Spike commit number: 157143b

Here's the test I used.
You can make binary executable file by typing make
and I ran spike -l test

test.zip

@aswaterman
Copy link
Collaborator

@JaewonHur, hello again, and thanks for your bug report. As I mentioned on the other ticket, the spec says that mtval should be written with 0 in this case, since a software ebreak is not one of the conditions in the following passage:

"When a hardware breakpoint is triggered, or an address-misaligned, access-fault, or page fault exception occurs on an instruction fetch, load, or store, mtval is written with the faulting virtual address. On an illegal instruction trap, [...]. For other traps, mtval is set to zero, but a future standard may redefine mtval's setting for other traps."

I'm going to fix this now, but I want to bring it to @timsifive's attention on the off chance this bug fix has knock-on effects on the debug side of things.

chihminchao pushed a commit to chihminchao/riscv-isa-sim that referenced this issue Apr 27, 2020
Resolves riscv-software-src#426

The relevant passage in the spec does not mention software breakpoints
as one of the cases that cause mtval to be set to a nonzero value:

https://github.com/riscv/riscv-isa-manual/blob/274893e2f0365f904829bbb60fd05cc01d2bfb11/src/machine.tex#L2202
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

No branches or pull requests

2 participants