@@ -20,7 +20,8 @@ void bl_gen_jump_kernel(const MIPSCPU *cpu, void **ptr,
bool set_a2, target_ulong a2,
bool set_a3, target_ulong a3,
target_ulong kernel_addr);
-void bl_gen_write_ulong(void **ptr, target_ulong addr, target_ulong val);
+void bl_gen_write_ulong(const MIPSCPU *cpu, void **ptr,
+ target_ulong addr, target_ulong val);
void bl_gen_write_u32(void **ptr, target_ulong addr, uint32_t val);
void bl_gen_write_u64(void **ptr, target_ulong addr, uint64_t val);
@@ -283,14 +283,15 @@ void bl_gen_jump_kernel(const MIPSCPU *cpu, void **p,
bl_gen_jump_to(cpu, p, kernel_addr);
}
-void bl_gen_write_ulong(void **p, target_ulong addr, target_ulong val)
+void bl_gen_write_ulong(const MIPSCPU *cpu, void **p,
+ target_ulong addr, target_ulong val)
{
- bl_gen_load_ulong(&MIPS_CPU(first_cpu)->env, p, BL_REG_K0, val);
- bl_gen_load_ulong(&MIPS_CPU(first_cpu)->env, p, BL_REG_K1, addr);
- if (bootcpu_supports_isa(&MIPS_CPU(first_cpu)->env, ISA_MIPS3)) {
- bl_gen_sd(&MIPS_CPU(first_cpu)->env, p, BL_REG_K0, BL_REG_K1, 0x0);
+ bl_gen_load_ulong(&cpu->env, p, BL_REG_K0, val);
+ bl_gen_load_ulong(&cpu->env, p, BL_REG_K1, addr);
+ if (bootcpu_supports_isa(&cpu->env, ISA_MIPS3)) {
+ bl_gen_sd(&cpu->env, p, BL_REG_K0, BL_REG_K1, 0x0);
} else {
- bl_gen_sw(&MIPS_CPU(first_cpu)->env, p, BL_REG_K0, BL_REG_K1, 0x0);
+ bl_gen_sw(&cpu->env, p, BL_REG_K0, BL_REG_K1, 0x0);
}
}
Propagate the target agnostic CPU pointer to the publicly declared bl_gen_write_ulong() function. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- include/hw/mips/bootloader.h | 3 ++- hw/mips/bootloader.c | 13 +++++++------ 2 files changed, 9 insertions(+), 7 deletions(-)