Browse Source

Fix `csrrw sentropy` when --log-commits is enabled

The logging calls get_csr(write=false, peek=true) which caused an
illegal instruction trap on every sentropy access.

The logged value will be useless, though, since it will fetch two more
bytes from /dev/urandom for the logged value reported. But it's not
clear that there's a more useful option.
pull/818/head
Scott Johnson 5 years ago
parent
commit
3083b125d6
No known key found for this signature in database GPG Key ID: 61C1F01D3D1410C9
  1. 2
      riscv/processor.cc

2
riscv/processor.cc

@ -1047,7 +1047,7 @@ reg_t processor_t::get_csr(int which, insn_t insn, bool write, bool peek)
if (!extension_enabled(EXT_ZKR))
break;
/* Read-only access disallowed due to wipe-on-read side effect */
if (!write)
if (!write && !peek)
break;
ret(es.get_sentropy());
case CSR_VCSR:

Loading…
Cancel
Save