[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/2] hw/mips: bootloader: Fix write_ulong
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH 1/2] hw/mips: bootloader: Fix write_ulong |
Date: |
Tue, 30 Nov 2021 22:52:17 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 |
On 11/30/21 22:17, Jiaxun Yang wrote:
> bl_gen_write_ulong uses sd for both 32 and 64 bit CPU,
> while sd is illegal on 32 bit CPUs.
>
> Replace sd with sw on 32bit CPUs.
>
> Fixes: 3ebbf86 ("hw/mips: Add a bootloader helper")
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
> Should be backported to 6.0 onwards.
> ---
> hw/mips/bootloader.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/hw/mips/bootloader.c b/hw/mips/bootloader.c
> index 6ec8314490..99991f8b2b 100644
> --- a/hw/mips/bootloader.c
> +++ b/hw/mips/bootloader.c
> @@ -182,7 +182,11 @@ void bl_gen_write_ulong(uint32_t **p, target_ulong addr,
> target_ulong val)
> {
> bl_gen_load_ulong(p, BL_REG_K0, val);
> bl_gen_load_ulong(p, BL_REG_K1, addr);
> - bl_gen_sd(p, BL_REG_K0, BL_REG_K1, 0x0);
> + if (bootcpu_supports_isa(ISA_MIPS3)) {
> + bl_gen_sd(p, BL_REG_K0, BL_REG_K1, 0x0);
> + } else {
> + bl_gen_sw(p, BL_REG_K0, BL_REG_K1, 0x0);
> + }
We have bl_gen_load_ulong(); having bl_gen_store_ulong()
would make the API even. Mind sending a patch? Otherwise:
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> }
>
> void bl_gen_write_u32(uint32_t **p, target_ulong addr, uint32_t val)
>