qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 13/23] hw/mips/bootloader: Propagate CPU to bl_gen_jump_to()


From: Philippe Mathieu-Daudé
Subject: [PATCH 13/23] hw/mips/bootloader: Propagate CPU to bl_gen_jump_to()
Date: Mon, 13 Jan 2025 01:47:38 +0100

Propagate the target agnostic CPU pointer to the publicly
declared bl_gen_jump_to() function.
Include "target/mips/cpu-qom.h" to get MIPSCPU typedef.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/mips/bootloader.h |  3 ++-
 hw/mips/bootloader.c         | 10 +++++-----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/include/hw/mips/bootloader.h b/include/hw/mips/bootloader.h
index c32f6c28356..daa2b92e249 100644
--- a/include/hw/mips/bootloader.h
+++ b/include/hw/mips/bootloader.h
@@ -10,8 +10,9 @@
 #define HW_MIPS_BOOTLOADER_H
 
 #include "exec/cpu-defs.h"
+#include "target/mips/cpu-qom.h"
 
-void bl_gen_jump_to(void **ptr, target_ulong jump_addr);
+void bl_gen_jump_to(const MIPSCPU *cpu, void **ptr, target_ulong jump_addr);
 void bl_gen_jump_kernel(void **ptr,
                         bool set_sp, target_ulong sp,
                         bool set_a0, target_ulong a0,
diff --git a/hw/mips/bootloader.c b/hw/mips/bootloader.c
index e29eb5e92f3..6f055228392 100644
--- a/hw/mips/bootloader.c
+++ b/hw/mips/bootloader.c
@@ -249,11 +249,11 @@ static void bl_gen_load_ulong(const CPUMIPSState *env, 
void **p,
 }
 
 /* Helpers */
-void bl_gen_jump_to(void **p, target_ulong jump_addr)
+void bl_gen_jump_to(const MIPSCPU *cpu, void **p, target_ulong 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 */
+    bl_gen_load_ulong(&cpu->env, p, BL_REG_T9, jump_addr);
+    bl_gen_jalr(&cpu->env, p, BL_REG_T9);
+    bl_gen_nop(&cpu->env, p); /* delay slot */
 }
 
 void bl_gen_jump_kernel(void **p,
@@ -280,7 +280,7 @@ void bl_gen_jump_kernel(void **p,
         bl_gen_load_ulong(&MIPS_CPU(first_cpu)->env, p, BL_REG_A3, a3);
     }
 
-    bl_gen_jump_to(p, kernel_addr);
+    bl_gen_jump_to(MIPS_CPU(first_cpu), p, kernel_addr);
 }
 
 void bl_gen_write_ulong(void **p, target_ulong addr, target_ulong val)
-- 
2.47.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]