From: Daniel Henrique Barboza <[email protected]> Set 'version' to 1 if we're running Debug 1.0.
Signed-off-by: Daniel Henrique Barboza <[email protected]> Reviewed-by: Alistair Francis <[email protected]> Message-ID: <[email protected]> Signed-off-by: Alistair Francis <[email protected]> --- target/riscv/tcg/debug.h | 3 +++ target/riscv/tcg/debug.c | 11 ++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/target/riscv/tcg/debug.h b/target/riscv/tcg/debug.h index eb635bc277..fcd92b768c 100644 --- a/target/riscv/tcg/debug.h +++ b/target/riscv/tcg/debug.h @@ -45,6 +45,9 @@ typedef enum { TRIGGER_TYPE_NUM } trigger_type_t; +#define TINFO_VERSION_OFFSET 24 +#define TINFO_VERSION_LEN 8 + /* actions */ typedef enum { DBG_ACTION_NONE = -1, /* sentinel value */ diff --git a/target/riscv/tcg/debug.c b/target/riscv/tcg/debug.c index 9b2e5b19d8..148201f3cb 100644 --- a/target/riscv/tcg/debug.c +++ b/target/riscv/tcg/debug.c @@ -957,9 +957,14 @@ void tdata_csr_write(CPURISCVState *env, int tdata_index, target_ulong val) target_ulong tinfo_csr_read(CPURISCVState *env) { - /* assume all triggers support the same types of triggers */ - return BIT(TRIGGER_TYPE_AD_MATCH) | - BIT(TRIGGER_TYPE_AD_MATCH6); + target_ulong val = BIT(TRIGGER_TYPE_AD_MATCH) | + BIT(TRIGGER_TYPE_AD_MATCH6); + + if (debug_trigger_version_1_0(env)) { + val = deposit64(val, TINFO_VERSION_OFFSET, TINFO_VERSION_LEN, 1); + } + + return val; } void riscv_cpu_debug_excp_handler(CPUState *cs) -- 2.55.0
