[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 09/28] trans_privileged.c.inc: set (m|s)tval on ebreak breakpoint
From: |
Alistair Francis |
Subject: |
[PULL 09/28] trans_privileged.c.inc: set (m|s)tval on ebreak breakpoint |
Date: |
Tue, 28 May 2024 12:43:09 +1000 |
From: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Privileged spec section 4.1.9 mentions:
"When a trap is taken into S-mode, stval is written with
exception-specific information to assist software in handling the trap.
(...)
If stval is written with a nonzero value when a breakpoint,
address-misaligned, access-fault, or page-fault exception occurs on an
instruction fetch, load, or store, then stval will contain the faulting
virtual address."
A similar text is found for mtval in section 3.1.16.
Setting mtval/stval in this scenario is optional, but some softwares read
these regs when handling ebreaks.
Write 'badaddr' in all ebreak breakpoints to write the appropriate
'tval' during riscv_do_cpu_interrrupt().
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20240416230437.1869024-3-dbarboza@ventanamicro.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
target/riscv/insn_trans/trans_privileged.c.inc | 2 ++
1 file changed, 2 insertions(+)
diff --git a/target/riscv/insn_trans/trans_privileged.c.inc
b/target/riscv/insn_trans/trans_privileged.c.inc
index 620ab54eb0..bc5263a4e0 100644
--- a/target/riscv/insn_trans/trans_privileged.c.inc
+++ b/target/riscv/insn_trans/trans_privileged.c.inc
@@ -62,6 +62,8 @@ static bool trans_ebreak(DisasContext *ctx, arg_ebreak *a)
if (pre == 0x01f01013 && ebreak == 0x00100073 && post == 0x40705013) {
generate_exception(ctx, RISCV_EXCP_SEMIHOST);
} else {
+ tcg_gen_st_tl(tcg_constant_tl(ebreak_addr), tcg_env,
+ offsetof(CPURISCVState, badaddr));
generate_exception(ctx, RISCV_EXCP_BREAKPOINT);
}
return true;
--
2.45.1
- [PULL 00/28] riscv-to-apply queue, Alistair Francis, 2024/05/27
- [PULL 01/28] hw/intc/riscv_aplic: APLICs should add child earlier than realize, Alistair Francis, 2024/05/27
- [PULL 02/28] target/riscv/kvm: Fix exposure of Zkr, Alistair Francis, 2024/05/27
- [PULL 03/28] target/riscv: Raise exceptions on wrs.nto, Alistair Francis, 2024/05/27
- [PULL 04/28] target/riscv/kvm: implement SBI debug console (DBCN) calls, Alistair Francis, 2024/05/27
- [PULL 05/28] hw/riscv/boot.c: Support 64-bit address for initrd, Alistair Francis, 2024/05/27
- [PULL 06/28] target/riscv: change RISCV_EXCP_SEMIHOST exception number to 63, Alistair Francis, 2024/05/27
- [PULL 07/28] target/riscv/kvm: tolerate KVM disable ext errors, Alistair Francis, 2024/05/27
- [PULL 08/28] target/riscv/debug: set tval=pc in breakpoint exceptions, Alistair Francis, 2024/05/27
- [PULL 09/28] trans_privileged.c.inc: set (m|s)tval on ebreak breakpoint,
Alistair Francis <=
- [PULL 11/28] target/riscv: Add support for Zve64x extension, Alistair Francis, 2024/05/27
- [PULL 12/28] target/riscv: Relax vector register check in RISCV gdbstub, Alistair Francis, 2024/05/27
- [PULL 13/28] target/riscv: Fix the element agnostic function problem, Alistair Francis, 2024/05/27
- [PULL 10/28] target/riscv: Add support for Zve32x extension, Alistair Francis, 2024/05/27
- [PULL 14/28] target/riscv/cpu.c: fix Zvkb extension config, Alistair Francis, 2024/05/27
- [PULL 15/28] target/riscv: Implement dynamic establishment of custom decoder, Alistair Francis, 2024/05/27
- [PULL 16/28] riscv: thead: Add th.sxstatus CSR emulation, Alistair Francis, 2024/05/27
- [PULL 17/28] target/riscv: rvv: Fix Zvfhmin checking for vfwcvt.f.f.v and vfncvt.f.f.w instructions, Alistair Francis, 2024/05/27
- [PULL 18/28] target/riscv: rvv: Check single width operator for vector fp widen instructions, Alistair Francis, 2024/05/27
- [PULL 19/28] target/riscv: rvv: Check single width operator for vfncvt.rod.f.f.w, Alistair Francis, 2024/05/27