-
Notifications
You must be signed in to change notification settings - Fork 205
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
I-MISALIGN_JMP-01.S outdated use of mbadaddr
in trap handler?
#31
Comments
Agreed that I think the problem here is how you have interpreted the spec. I would interpret the following instruction-fetch-misaligned, load-address-misaligned, store-address-misaligned, Also there is no exception defined as: instruction-fetch-exception. In which case a Also you can find the same behaviour in spike and riscvOPVSim and also quite a few other implementations. |
Ah, that makes more sense! Thanks for your help! |
I missed this earlier, but in the paragraph above, the spec states: "When a trap is taken into M-mode, So the behavior desired by the test isn't actually required by spec. This seems like it would render several tests that use |
I think the ISA-compliance tests should be revised to permit either zero or the expected nonzero value. These tests will still be useful. Implementations will choose to write the expected nonzero value for exceptions that are meant to be resumable, and we still want to test that they produce the right value if they do produce a value. Platform-compliance tests should be responsible for checking whether mtval is populated with nonzero values for the exceptions that platform cares about (e.g., misaligned ld/st on platforms that emulate those operations; all page-fault exceptions on platforms that use virtual memory). |
The privileged compliance tests haven't really been written yet; but when
they are, the framework should be presented with the platform
configurations parameter as a platform specific function which returns the
value of MTVAL for specific faults. That is a ways away, though there are
hooks in the framework(s) to do this.
…On Mon, Jan 28, 2019 at 12:06 PM Andrew Waterman ***@***.***> wrote:
I think the ISA-compliance tests should be revised to permit either zero
or the expected nonzero value. These tests will still be useful.
Implementations will choose to write the expected nonzero value for
exceptions that are meant to be resumable, and we still want to test that
they produce the right value if they do produce a value.
Platform-compliance tests should be responsible for checking whether mtval
is populated with nonzero values for the exceptions that platform cares
about (e.g., misaligned ld/st on platforms that emulate those operations;
all page-fault exceptions on platforms that use virtual memory).
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#31 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/Ad96plCYMWOt7KgvFNwjRKnkupqww7I5ks5vH1hagaJpZM4aTkC5>
.
|
Note that the riscof framework will handle this correctly by dreclaring that MTVAL is unimplemented in the DUT YAML configuration file. The reference model will need to allow that kind of configuration (and many, many others) as well. |
So, I am unclear: is it possible to modify the test so it works for both MTVAL implemented or not? |
Changes in this pull-request: * restructuring the riscv-test-suite to indicate clearly what is deprecated, wip and usable tests. * based on the above fixed the directory structure for riscv-targets where-ever applicable. Only tested riscvOVPsim and spike. * fixed script bugs for spike as well * renamed rv32i/I-IO.S to rv32i/I-IO-01.S along with necessary changes to the reference files and Makefrag * renamed mbadaddr csr to mtval as raised in issue #31 * C.SWSP-01.S test updated to fix issue #37 Close: #8 , #31 , #30 , #32 , #33 , #37, #47 , #67 , #96
Changes in this pull-request: * restructuring the riscv-test-suite to indicate clearly what is deprecated, wip and usable tests. * based on the above fixed the directory structure for riscv-targets where-ever applicable. Only tested riscvOVPsim and spike. * fixed script bugs for spike as well * renamed rv32i/I-IO.S to rv32i/I-IO-01.S along with necessary changes to the reference files and Makefrag * renamed mbadaddr csr to mtval as raised in issue riscv-non-isa#31 * C.SWSP-01.S test updated to fix issue riscv-non-isa#37 Close: riscv-non-isa#8 , riscv-non-isa#31 , riscv-non-isa#30 , riscv-non-isa#32 , riscv-non-isa#33 , riscv-non-isa#37, riscv-non-isa#47 , riscv-non-isa#67 , riscv-non-isa#96
From line 280, the beginning of the trap handler has:
The privileged spec states, "The
mtval
register replaces thembadaddr
register in the previous specification."It also states, "When a hardware breakpoint is triggered, or an instruction-fetch, load, or store address-misaligned, access, or page-fault exception occurs,
mtval
is written with the faulting e�ffective address... For other exceptions,mtval
is set to zero..."So within the trap handler,
mtval
is used in place ofmbadaddr
, but the behavior of the two do not match up, since the spec does not actually definemtval
behavior during misaligned jumps.What I'm seeing is
mtvec
(i.e.mbadaddr
in the test) being set to0x0
as the spec says, so thenmepc
gets set to some large invalid address, which causesmret
to return back into the trap handler, and then gets stuck in a loop.The text was updated successfully, but these errors were encountered: