summary refs log tree commit diff stats
path: root/hw/mips_r4k.c
diff options
context:
space:
mode:
authorpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2009-04-10 03:36:49 +0000
committerpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2009-04-10 03:36:49 +0000
commitd758525180e0efff8a59cfea11f5f8348014ff6a (patch)
tree2a6da1aeb63128e8f2837ba481cec8d1e8fd0a98 /hw/mips_r4k.c
parentb584726df971c1238a5249cc21121cf2ebbcaf55 (diff)
downloadfocaccia-qemu-d758525180e0efff8a59cfea11f5f8348014ff6a.tar.gz
focaccia-qemu-d758525180e0efff8a59cfea11f5f8348014ff6a.zip
More phys_ram_base elimination.
Signed-off-by: Paul Brook <paul@codesourcery.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7064 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/mips_r4k.c')
-rw-r--r--hw/mips_r4k.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/hw/mips_r4k.c b/hw/mips_r4k.c
index d7a31f5557..ba44037f15 100644
--- a/hw/mips_r4k.c
+++ b/hw/mips_r4k.c
@@ -80,6 +80,7 @@ static void load_kernel (CPUState *env)
     int64_t entry, kernel_low, kernel_high;
     long kernel_size, initrd_size;
     ram_addr_t initrd_offset;
+    int ret;
 
     kernel_size = load_elf(loaderparams.kernel_filename, VIRT_TO_PHYS_ADDEND,
                            (uint64_t *)&entry, (uint64_t *)&kernel_low,
@@ -120,21 +121,19 @@ static void load_kernel (CPUState *env)
 
     /* Store command line.  */
     if (initrd_size > 0) {
-        int ret;
-        ret = sprintf((char *)(phys_ram_base + (16 << 20) - 256),
-                      "rd_start=0x" TARGET_FMT_lx " rd_size=%li ",
-                      PHYS_TO_VIRT((uint32_t)initrd_offset),
-                      initrd_size);
-        strcpy ((char *)(phys_ram_base + (16 << 20) - 256 + ret),
-                loaderparams.kernel_cmdline);
-    }
-    else {
-        strcpy ((char *)(phys_ram_base + (16 << 20) - 256),
-                loaderparams.kernel_cmdline);
+        char buf[64];
+        ret = snprintf(buf, 64, "rd_start=0x" TARGET_FMT_lx " rd_size=%li ",
+                       PHYS_TO_VIRT((uint32_t)initrd_offset),
+                       initrd_size);
+        cpu_physical_memory_write((16 << 20) - 256, (void *)buf, 64);
+    } else {
+        ret = 0;
     }
+    pstrcpy_targphys((16 << 20) - 256 + ret, 256,
+                     loaderparams.kernel_cmdline);
 
-    *(int32_t *)(phys_ram_base + (16 << 20) - 260) = tswap32 (0x12345678);
-    *(int32_t *)(phys_ram_base + (16 << 20) - 264) = tswap32 (ram_size);
+    stl_phys((16 << 20) - 260, 0x12345678);
+    stl_phys((16 << 20) - 264, ram_size);
 }
 
 static void main_cpu_reset(void *opaque)