Skip to content

Commit

Permalink
fixup! feat: implement hypervisor extension
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmikhalevich committed Oct 15, 2023
1 parent 72c94d9 commit c287764
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/cartesi-machine-tests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ local riscv_tests = {
{ "access.bin", 97 },
{ "interrupts.bin", 8209 },
{ "mtime_interrupt.bin", 16404 },
{ "illegal_insn.bin", 972 },
{ "illegal_insn.bin", 968 },
{ "version_check.bin", 26 },
{ "translate_vaddr.bin", 343 },
{ "htif_invalid_ops.bin", 109 },
Expand Down
9 changes: 8 additions & 1 deletion src/interpret.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2174,7 +2174,7 @@ static NO_INLINE bool read_csr(STATE_ACCESS &a, uint64_t mcycle, CSR_address csr
break;
case CSR_address::satp:
val = read_csr_satp(a, &status);
if (!status) {
if (!status && a.read_iflags_VRT()) {
_cause = MCAUSE_VIRTUAL_INSTRUCTION;
}
break;
Expand Down Expand Up @@ -4406,6 +4406,9 @@ static execute_status execute_HLVX_WU(STATE_ACCESS &a, uint64_t &pc, uint64_t mc
template <typename STATE_ACCESS>
static execute_status execute_HLV_D(STATE_ACCESS &a, uint64_t &pc, uint64_t mcycle, uint32_t insn) {
dump_insn(a, pc, insn, "hlv.d");
if (insn_get_rs2(insn) != 0) {
return raise_illegal_insn_exception(a, pc, insn);
}
return execute_HLV<int64_t>(a, pc, mcycle, insn);
}

Expand Down Expand Up @@ -4747,6 +4750,10 @@ static inline execute_status execute_privileged_HLV_W(STATE_ACCESS &a, uint64_t

template <typename STATE_ACCESS>
static inline execute_status execute_privileged(STATE_ACCESS &a, uint64_t &pc, uint64_t &mcycle, uint32_t insn) {
if (insn_get_rd(insn) != 0) {
return raise_illegal_insn_exception(a, pc, insn);
}

switch (static_cast<insn_privileged_funct7>(insn_get_funct7(insn))) {
case insn_privileged_funct7::E:
return execute_privileged_E(a, pc, insn);
Expand Down

0 comments on commit c287764

Please sign in to comment.