Skip to content

Commit

Permalink
Machine: map ecall to ECALL_M for documented mcause code (M-mode only…
Browse files Browse the repository at this point in the history
… supported now)

Signed-off-by: Pavel Pisa <[email protected]>
  • Loading branch information
ppisa committed Dec 2, 2023
1 parent e891c5f commit bc1cf48
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/machine/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,8 @@ DecodeState Core::decode(const FetchInterstage &dt) {
if (flags & IMF_EBREAK) {
excause = EXCAUSE_BREAK;
} else if (flags & IMF_ECALL) {
excause = EXCAUSE_ECALL_ANY;
excause = EXCAUSE_ECALL_M;
// TODO: EXCAUSE_ECALL_S, EXCAUSE_ECALL_U
}
}
if (flags & IMF_FORCE_W_OP)
Expand Down
1 change: 1 addition & 0 deletions src/machine/csr/controlstate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ namespace machine { namespace CSR {
Q_UNUSED(act_privlev)

write_field(Field::mstatus::MIE, read_field(Field::mstatus::MPIE).as_u32());
write_field(Field::mstatus::MPIE, (uint64_t)1);

restored_privlev = static_cast<PrivilegeLevel>(read_field(Field::mstatus::MPP).as_u32());
write_field(Field::mstatus::MPP, (uint64_t)0);
Expand Down

0 comments on commit bc1cf48

Please sign in to comment.