[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 12/23] hw/mips/bootloader: Propagate CPU env to bl_gen_load_ulong
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 12/23] hw/mips/bootloader: Propagate CPU env to bl_gen_load_ulong() |
Date: |
Mon, 13 Jan 2025 01:47:37 +0100 |
Propagate the target specific CPU env to the locally
declared bl_gen_load_ulong() function.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/mips/bootloader.c | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/hw/mips/bootloader.c b/hw/mips/bootloader.c
index 95ee59f33c9..e29eb5e92f3 100644
--- a/hw/mips/bootloader.c
+++ b/hw/mips/bootloader.c
@@ -238,19 +238,20 @@ static void bl_gen_dli(const CPUMIPSState *env, void **p,
bl_gen_ori(p, rt, rt, extract64(imm, 0, 16));
}
-static void bl_gen_load_ulong(void **p, bl_reg rt, target_ulong imm)
+static void bl_gen_load_ulong(const CPUMIPSState *env, void **p,
+ bl_reg rt, target_ulong imm)
{
- if (bootcpu_supports_isa(&MIPS_CPU(first_cpu)->env, ISA_MIPS3)) {
- bl_gen_dli(&MIPS_CPU(first_cpu)->env, p, rt, imm); /* 64bit */
+ if (bootcpu_supports_isa(env, ISA_MIPS3)) {
+ bl_gen_dli(env, p, rt, imm); /* 64bit */
} else {
- bl_gen_li(&MIPS_CPU(first_cpu)->env, p, rt, imm); /* 32bit */
+ bl_gen_li(env, p, rt, imm); /* 32bit */
}
}
/* Helpers */
void bl_gen_jump_to(void **p, target_ulong jump_addr)
{
- bl_gen_load_ulong(p, BL_REG_T9, jump_addr);
+ bl_gen_load_ulong(&MIPS_CPU(first_cpu)->env, p, BL_REG_T9, jump_addr);
bl_gen_jalr(&MIPS_CPU(first_cpu)->env, p, BL_REG_T9);
bl_gen_nop(&MIPS_CPU(first_cpu)->env, p); /* delay slot */
}
@@ -264,19 +265,19 @@ void bl_gen_jump_kernel(void **p,
target_ulong kernel_addr)
{
if (set_sp) {
- bl_gen_load_ulong(p, BL_REG_SP, sp);
+ bl_gen_load_ulong(&MIPS_CPU(first_cpu)->env, p, BL_REG_SP, sp);
}
if (set_a0) {
- bl_gen_load_ulong(p, BL_REG_A0, a0);
+ bl_gen_load_ulong(&MIPS_CPU(first_cpu)->env, p, BL_REG_A0, a0);
}
if (set_a1) {
- bl_gen_load_ulong(p, BL_REG_A1, a1);
+ bl_gen_load_ulong(&MIPS_CPU(first_cpu)->env, p, BL_REG_A1, a1);
}
if (set_a2) {
- bl_gen_load_ulong(p, BL_REG_A2, a2);
+ bl_gen_load_ulong(&MIPS_CPU(first_cpu)->env, p, BL_REG_A2, a2);
}
if (set_a3) {
- bl_gen_load_ulong(p, BL_REG_A3, a3);
+ bl_gen_load_ulong(&MIPS_CPU(first_cpu)->env, p, BL_REG_A3, a3);
}
bl_gen_jump_to(p, kernel_addr);
@@ -284,8 +285,8 @@ void bl_gen_jump_kernel(void **p,
void bl_gen_write_ulong(void **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_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);
} else {
@@ -296,13 +297,13 @@ void bl_gen_write_ulong(void **p, target_ulong addr,
target_ulong val)
void bl_gen_write_u32(void **p, target_ulong addr, uint32_t val)
{
bl_gen_li(&MIPS_CPU(first_cpu)->env, p, BL_REG_K0, val);
- bl_gen_load_ulong(p, BL_REG_K1, addr);
+ bl_gen_load_ulong(&MIPS_CPU(first_cpu)->env, p, BL_REG_K1, addr);
bl_gen_sw(&MIPS_CPU(first_cpu)->env, p, BL_REG_K0, BL_REG_K1, 0x0);
}
void bl_gen_write_u64(void **p, target_ulong addr, uint64_t val)
{
bl_gen_dli(&MIPS_CPU(first_cpu)->env, p, BL_REG_K0, val);
- bl_gen_load_ulong(p, BL_REG_K1, addr);
+ bl_gen_load_ulong(&MIPS_CPU(first_cpu)->env, p, BL_REG_K1, addr);
bl_gen_sd(&MIPS_CPU(first_cpu)->env, p, BL_REG_K0, BL_REG_K1, 0x0);
}
--
2.47.1
- [PATCH 03/23] hw/mips/boston: Replace bl_gen_write_ulong() -> bl_gen_write_u64(), (continued)
- [PATCH 03/23] hw/mips/boston: Replace bl_gen_write_ulong() -> bl_gen_write_u64(), Philippe Mathieu-Daudé, 2025/01/12
- [PATCH 02/23] hw/mips/malta: Check CPU index instead of using &first_cpu, Philippe Mathieu-Daudé, 2025/01/12
- [PATCH 04/23] hw/mips/bootloader: Propagate CPU env to bootcpu_supports_isa(), Philippe Mathieu-Daudé, 2025/01/12
- [PATCH 05/23] hw/mips/bootloader: Propagate CPU env to bl_gen_nop(), Philippe Mathieu-Daudé, 2025/01/12
- [PATCH 06/23] hw/mips/bootloader: Propagate CPU env to bl_gen_dsll(), Philippe Mathieu-Daudé, 2025/01/12
- [PATCH 08/23] hw/mips/bootloader: Propagate CPU env to bl_gen_sw(), Philippe Mathieu-Daudé, 2025/01/12
- [PATCH 09/23] hw/mips/bootloader: Propagate CPU env to bl_gen_sd(), Philippe Mathieu-Daudé, 2025/01/12
- [PATCH 07/23] hw/mips/bootloader: Propagate CPU env to bl_gen_jalr(), Philippe Mathieu-Daudé, 2025/01/12
- [PATCH 10/23] hw/mips/bootloader: Propagate CPU env to bl_gen_li(), Philippe Mathieu-Daudé, 2025/01/12
- [PATCH 11/23] hw/mips/bootloader: Propagate CPU env to bl_gen_dli(), Philippe Mathieu-Daudé, 2025/01/12
- [PATCH 12/23] hw/mips/bootloader: Propagate CPU env to bl_gen_load_ulong(),
Philippe Mathieu-Daudé <=
- [PATCH 13/23] hw/mips/bootloader: Propagate CPU to bl_gen_jump_to(), Philippe Mathieu-Daudé, 2025/01/12
- [PATCH 14/23] hw/mips/bootloader: Propagate CPU to bl_gen_jump_kernel(), Philippe Mathieu-Daudé, 2025/01/12
- [PATCH 15/23] hw/mips/bootloader: Propagate CPU to bl_gen_write_ulong(), Philippe Mathieu-Daudé, 2025/01/12
- [PATCH 16/23] hw/mips/bootloader: Propagate CPU to bl_gen_write_u32(), Philippe Mathieu-Daudé, 2025/01/12
- [PATCH 18/23] hw/mips/boston: Propagate CPU to gen_firmware(), Philippe Mathieu-Daudé, 2025/01/12
- [PATCH 17/23] hw/mips/bootloader: Propagate CPU to bl_gen_write_u64(), Philippe Mathieu-Daudé, 2025/01/12
- [PATCH 19/23] hw/mips/fuloong: Propagate CPU to write_bootloader(), Philippe Mathieu-Daudé, 2025/01/12
- [PATCH 20/23] hw/mips/malta: Keep reference of vCPUs in MaltaState, Philippe Mathieu-Daudé, 2025/01/12
- [PATCH 21/23] hw/mips/malta: Propagate MaltaState to write_bootloader(), Philippe Mathieu-Daudé, 2025/01/12
- [PATCH 22/23] hw/mips/malta: Propagate MaltaState to bl_setup_gt64120_jump_kernel(), Philippe Mathieu-Daudé, 2025/01/12