diff mbox series

[v20,17/24] target/rx: Move rx_load_image to rx-virt.

Message ID 20190616142836.10614-18-ysato@users.sourceforge.jp (mailing list archive)
State New, archived
Headers show
Series Add RX archtecture support | expand

Commit Message

Yoshinori Sato June 16, 2019, 2:28 p.m. UTC
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
---
 hw/rx/rx-virt.c | 22 ++++++++++++++++++++++
 target/rx/cpu.c | 22 ----------------------
 2 files changed, 22 insertions(+), 22 deletions(-)

Comments

Igor Mammedov June 16, 2019, 6:49 p.m. UTC | #1
On Sun, 16 Jun 2019 23:28:29 +0900
Yoshinori Sato <ysato@users.sourceforge.jp> wrote:

> Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
> ---
>  hw/rx/rx-virt.c | 22 ++++++++++++++++++++++
>  target/rx/cpu.c | 22 ----------------------
>  2 files changed, 22 insertions(+), 22 deletions(-)
> 
> diff --git a/hw/rx/rx-virt.c b/hw/rx/rx-virt.c
> index ed0a3a1da0..4cfe2e3123 100644
> --- a/hw/rx/rx-virt.c
> +++ b/hw/rx/rx-virt.c
> @@ -32,6 +32,28 @@
>  /* Same address of GDB integrated simulator */
>  #define SDRAM_BASE 0x01000000
>  
> +static void rx_load_image(RXCPU *cpu, const char *filename,
> +                          uint32_t start, uint32_t size)

function shouldn't be added to target/rx/cpu.c at all,
it should be introduced in 16/24 instead and this patch
shouldn't exist.

> +{
> +    static uint32_t extable[32];
> +    long kernel_size;
> +    int i;
> +
> +    kernel_size = load_image_targphys(filename, start, size);
> +    if (kernel_size < 0) {
> +        fprintf(stderr, "qemu: could not load kernel '%s'\n", filename);
> +        exit(1);
> +    }
> +    cpu->env.pc = start;
> +
> +    /* setup exception trap trampoline */
> +    /* linux kernel only works little-endian mode */
> +    for (i = 0; i < ARRAY_SIZE(extable); i++) {
> +        extable[i] = cpu_to_le32(0x10 + i * 4);
> +    }
> +    rom_add_blob_fixed("extable", extable, sizeof(extable), 0xffffff80);
> +}
> +
>  static void rxvirt_init(MachineState *machine)
>  {
>      RX62NState *s = g_new(RX62NState, 1);
> diff --git a/target/rx/cpu.c b/target/rx/cpu.c
> index e3d76af55d..ea38639f47 100644
> --- a/target/rx/cpu.c
> +++ b/target/rx/cpu.c
> @@ -215,25 +215,3 @@ static void rx_cpu_register_types(void)
>  }
>  
>  type_init(rx_cpu_register_types)
> -
> -void rx_load_image(RXCPU *cpu, const char *filename,
> -                   uint32_t start, uint32_t size)
> -{
> -    static uint32_t extable[32];
> -    long kernel_size;
> -    int i;
> -
> -    kernel_size = load_image_targphys(filename, start, size);
> -    if (kernel_size < 0) {
> -        fprintf(stderr, "qemu: could not load kernel '%s'\n", filename);
> -        exit(1);
> -    }
> -    cpu->env.pc = start;
> -
> -    /* setup exception trap trampoline */
> -    /* linux kernel only works little-endian mode */
> -    for (i = 0; i < ARRAY_SIZE(extable); i++) {
> -        extable[i] = cpu_to_le32(0x10 + i * 4);
> -    }
> -    rom_add_blob_fixed("extable", extable, sizeof(extable), 0xffffff80);
> -}
diff mbox series

Patch

diff --git a/hw/rx/rx-virt.c b/hw/rx/rx-virt.c
index ed0a3a1da0..4cfe2e3123 100644
--- a/hw/rx/rx-virt.c
+++ b/hw/rx/rx-virt.c
@@ -32,6 +32,28 @@ 
 /* Same address of GDB integrated simulator */
 #define SDRAM_BASE 0x01000000
 
+static void rx_load_image(RXCPU *cpu, const char *filename,
+                          uint32_t start, uint32_t size)
+{
+    static uint32_t extable[32];
+    long kernel_size;
+    int i;
+
+    kernel_size = load_image_targphys(filename, start, size);
+    if (kernel_size < 0) {
+        fprintf(stderr, "qemu: could not load kernel '%s'\n", filename);
+        exit(1);
+    }
+    cpu->env.pc = start;
+
+    /* setup exception trap trampoline */
+    /* linux kernel only works little-endian mode */
+    for (i = 0; i < ARRAY_SIZE(extable); i++) {
+        extable[i] = cpu_to_le32(0x10 + i * 4);
+    }
+    rom_add_blob_fixed("extable", extable, sizeof(extable), 0xffffff80);
+}
+
 static void rxvirt_init(MachineState *machine)
 {
     RX62NState *s = g_new(RX62NState, 1);
diff --git a/target/rx/cpu.c b/target/rx/cpu.c
index e3d76af55d..ea38639f47 100644
--- a/target/rx/cpu.c
+++ b/target/rx/cpu.c
@@ -215,25 +215,3 @@  static void rx_cpu_register_types(void)
 }
 
 type_init(rx_cpu_register_types)
-
-void rx_load_image(RXCPU *cpu, const char *filename,
-                   uint32_t start, uint32_t size)
-{
-    static uint32_t extable[32];
-    long kernel_size;
-    int i;
-
-    kernel_size = load_image_targphys(filename, start, size);
-    if (kernel_size < 0) {
-        fprintf(stderr, "qemu: could not load kernel '%s'\n", filename);
-        exit(1);
-    }
-    cpu->env.pc = start;
-
-    /* setup exception trap trampoline */
-    /* linux kernel only works little-endian mode */
-    for (i = 0; i < ARRAY_SIZE(extable); i++) {
-        extable[i] = cpu_to_le32(0x10 + i * 4);
-    }
-    rom_add_blob_fixed("extable", extable, sizeof(extable), 0xffffff80);
-}