[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH 1/4] target/riscv: Use xl instead of mxl for disassemble
From: |
Alistair Francis |
Subject: |
Re: [RFC PATCH 1/4] target/riscv: Use xl instead of mxl for disassemble |
Date: |
Mon, 29 Aug 2022 12:08:48 +0200 |
On Wed, Aug 24, 2022 at 5:43 PM LIU Zhiwei <zhiwei_liu@linux.alibaba.com> wrote:
>
> Disassemble function(plugin_disas, target_disas, monitor_disas) will
> always call set_disas_info before disassembling instructions.
>
> plugin_disas and target_disas will always be called under a TB, which
> has the same XLEN.
>
> We can't ensure that monitor_disas will always be called under a TB,
> but current XLEN will still be a better choice, thus we can ensure at
> least the disassemble of the nearest one TB is right.
>
> Signed-off-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
> target/riscv/cpu.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
> index ac6f82ebd0..a5f84f211d 100644
> --- a/target/riscv/cpu.c
> +++ b/target/riscv/cpu.c
> @@ -507,8 +507,9 @@ static void riscv_cpu_reset(DeviceState *dev)
> static void riscv_cpu_disas_set_info(CPUState *s, disassemble_info *info)
> {
> RISCVCPU *cpu = RISCV_CPU(s);
> + CPURISCVState *env = &cpu->env;
>
> - switch (riscv_cpu_mxl(&cpu->env)) {
> + switch (env->xl) {
> case MXL_RV32:
> info->print_insn = print_insn_riscv32;
> break;
> --
> 2.25.1
>
>