The most significant bit should be set based on interrupt or
exception. I assume in current RV64 implementation the bit should
be 63rd, rather than 31st. This causes interrupt handler to get
invalid cause code.
Minor bug is for the mpie is suppossed to be set to the value of
old mie.
The fix is verified in FS.
Jira Issue: https://gem5.atlassian.net/browse/GEM5-858
Change-Id: I1cc166c254b35f5c1acb3f5774c43149c61cc37a
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38755
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
tval = MISCREG_MTVAL;
status.mpp = pp;
- status.mpie = status.sie;
+ status.mpie = status.mie;
status.mie = 0;
break;
default:
}
// Set fault cause, privilege, and return PC
- tc->setMiscReg(cause,
- (isInterrupt() << (sizeof(uint64_t) * 4 - 1)) | _code);
+ // Interrupt is indicated on the MSB of cause (bit 63 in RV64)
+ uint64_t _cause = _code;
+ if (isInterrupt()) {
+ _cause |= (1L << 63);
+ }
+ tc->setMiscReg(cause, _cause);
tc->setMiscReg(epc, tc->instAddr());
tc->setMiscReg(tval, trap_value());
tc->setMiscReg(MISCREG_PRV, prv);