From: Scott Beamer Date: Sat, 12 Sep 2015 01:04:37 +0000 (-0700) Subject: print out current privilege level (if commit log enabled) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=59ab3aadcaf5dc0f15bbd93abef3411208118d99;p=riscv-isa-sim.git print out current privilege level (if commit log enabled) --- diff --git a/riscv/execute.cc b/riscv/execute.cc index f64cbaa..42d59cb 100644 --- a/riscv/execute.cc +++ b/riscv/execute.cc @@ -7,16 +7,18 @@ static void commit_log(state_t* state, reg_t pc, insn_t insn) { #ifdef RISCV_ENABLE_COMMITLOG + int32_t priv = get_field(state->mstatus, MSTATUS_PRV); uint64_t mask = (insn.length() == 8 ? uint64_t(0) : (uint64_t(1) << (insn.length() * 8))) - 1; if (state->log_reg_write.addr) { - fprintf(stderr, "0x%016" PRIx64 " (0x%08" PRIx64 ") %c%2" PRIu64 " 0x%016" PRIx64 "\n", + fprintf(stderr, "%1d 0x%016" PRIx64 " (0x%08" PRIx64 ") %c%2" PRIu64 " 0x%016" PRIx64 "\n", + priv, pc, insn.bits() & mask, state->log_reg_write.addr & 1 ? 'f' : 'x', state->log_reg_write.addr >> 1, state->log_reg_write.data); } else { - fprintf(stderr, "0x%016" PRIx64 " (0x%08" PRIx64 ")\n", pc, insn.bits() & mask); + fprintf(stderr, "%1d 0x%016" PRIx64 " (0x%08" PRIx64 ")\n", priv, pc, insn.bits() & mask); } state->log_reg_write.addr = 0; #endif