diff options
author | Alec Roelke <alec.roelke@gmail.com> | 2019-03-03 15:13:51 -0500 |
---|---|---|
committer | Alec Roelke <alec.roelke@gmail.com> | 2019-05-04 04:37:19 +0000 |
commit | 53e74695ac28e02d10594af0ef6afff6536a0d35 (patch) | |
tree | 895fd105f7eac75b49c776cc89c5f6b430a0cf69 /src | |
parent | f75351acd7d518dddd1b2205bce529232cc9d43d (diff) | |
download | gem5-53e74695ac28e02d10594af0ef6afff6536a0d35.tar.xz |
arch-riscv: Implement MHARTID CSR
This patch implements the MHARTID CSR by intercepting attempts to access
it, similar to the way accesses to the performance counters are
intercepted, to return the thread's context ID.
Change-Id: Ie14a31036fbe0e49fb3347ac0c3c508d9427a10d
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/16988
Reviewed-by: Alec Roelke <alec.roelke@gmail.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Alec Roelke <alec.roelke@gmail.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/arch/riscv/isa.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/arch/riscv/isa.cc b/src/arch/riscv/isa.cc index 4e36d5596..cc86752ab 100644 --- a/src/arch/riscv/isa.cc +++ b/src/arch/riscv/isa.cc @@ -112,6 +112,8 @@ RegVal ISA::readMiscReg(int misc_reg, ThreadContext *tc) { switch (misc_reg) { + case MISCREG_HARTID: + return tc->contextId(); case MISCREG_CYCLE: if (hpmCounterEnabled(MISCREG_CYCLE)) { DPRINTF(RiscvMisc, "Cycle counter at: %llu.\n", |