Skip to contentSkip to conversation

hw/rx/rx-gdbsim: Remove uses of &first_cpu

PATCH In review Philippe Mathieu-Daudé 2 participants 2 messages Jan 10, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/rx/rx-gdbsim: Remove uses of &first_cpu

rx_gdbsim_init() has access to the single CPU via:

  RxGdbSimMachineState {
    RX62NState {
      RXCPU cpu;
      ...
    } mcu;
  } s;

Directly use that instead of the &first_cpu global.

---
 hw/rx/rx-gdbsim.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/rx/rx-gdbsim.c +2 -2
index 02fdbdf824b..88c8f12c101 100644
@@ -127,7 +127,7 @@ static void rx_gdbsim_init(MachineState *machine)
          * the latter half of the SDRAM space.
          */
         kernel_offset = machine->ram_size / 2;
-        rx_load_image(RX_CPU(first_cpu), kernel_filename,
+        rx_load_image(&s->mcu.cpu, kernel_filename,
                       SDRAM_BASE + kernel_offset, kernel_offset);
         if (dtb_filename) {
             ram_addr_t dtb_offset;
@@ -153,7 +153,7 @@ static void rx_gdbsim_init(MachineState *machine)
             qemu_register_reset_nosnapshotload(qemu_fdt_randomize_seeds,
                                 rom_ptr(SDRAM_BASE + dtb_offset, dtb_size));
             /* Set dtb address to R1 */
-            RX_CPU(first_cpu)->env.regs[1] = SDRAM_BASE + dtb_offset;
+            s->mcu.cpu.env.regs[1] = SDRAM_BASE + dtb_offset;
         }
     }
 }
Signature · 1 line
2.47.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Philippe Mathieu-Daudé

rx_gdbsim_init() has access to the single CPU via:

   RxGdbSimMachineState {
     RX62NState {
       RXCPU cpu;
       ...
     } mcu;
   } s;
Quoted 3 lines

Directly use that instead of the &first_cpu global.

r~

Quoted 26 lines
---
  hw/rx/rx-gdbsim.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
hw/rx/rx-gdbsim.c +2 -2
index 02fdbdf824b..88c8f12c101 100644
@@ -127,7 +127,7 @@ static void rx_gdbsim_init(MachineState *machine)
           * the latter half of the SDRAM space.
           */
          kernel_offset = machine->ram_size / 2;
-        rx_load_image(RX_CPU(first_cpu), kernel_filename,
+        rx_load_image(&s->mcu.cpu, kernel_filename,
                        SDRAM_BASE + kernel_offset, kernel_offset);
          if (dtb_filename) {
              ram_addr_t dtb_offset;
@@ -153,7 +153,7 @@ static void rx_gdbsim_init(MachineState *machine)
              qemu_register_reset_nosnapshotload(qemu_fdt_randomize_seeds,
                                  rom_ptr(SDRAM_BASE + dtb_offset, dtb_size));
              /* Set dtb address to R1 */
-            RX_CPU(first_cpu)->env.regs[1] = SDRAM_BASE + dtb_offset;
+            s->mcu.cpu.env.regs[1] = SDRAM_BASE + dtb_offset;
          }
      }
  }