[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/3] target/avr: Fix $PC displayed address
From: |
Alex Bennée |
Subject: |
Re: [PATCH 2/3] target/avr: Fix $PC displayed address |
Date: |
Tue, 07 Jul 2020 09:33:22 +0100 |
User-agent: |
mu4e 1.5.4; emacs 28.0.50 |
Philippe Mathieu-Daudé <f4bug@amsat.org> writes:
> $PC is 16-bit wide. Other registers display addresses on a byte
> granularity.
> To have a coherent ouput, display $PC using byte granularity too.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> target/avr/cpu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target/avr/cpu.c b/target/avr/cpu.c
> index 50fb1c378b..9be464991f 100644
> --- a/target/avr/cpu.c
> +++ b/target/avr/cpu.c
> @@ -151,7 +151,7 @@ static void avr_cpu_dump_state(CPUState *cs, FILE *f, int
> flags)
> int i;
>
> qemu_fprintf(f, "\n");
> - qemu_fprintf(f, "PC: %06x\n", env->pc_w);
> + qemu_fprintf(f, "PC: %06x\n", env->pc_w * 2);
OK this was confusing until I grepped around the code and found the
comment in set pc:
cpu->env.pc_w = value / 2; /* internally PC points to words */
so it makes sense I guess but I didn't pick it up from the name. Maybe
worth adding the comment in CPUAVRstate?
Anyway:
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
> qemu_fprintf(f, "SP: %04x\n", env->sp);
> qemu_fprintf(f, "rampD: %02x\n", env->rampD >> 16);
> qemu_fprintf(f, "rampX: %02x\n", env->rampX >> 16);
--
Alex Bennée