Revision d7585251 hw/mips_r4k.c

b/hw/mips_r4k.c
80 80
    int64_t entry, kernel_low, kernel_high;
81 81
    long kernel_size, initrd_size;
82 82
    ram_addr_t initrd_offset;
83
    int ret;
83 84

  
84 85
    kernel_size = load_elf(loaderparams.kernel_filename, VIRT_TO_PHYS_ADDEND,
85 86
                           (uint64_t *)&entry, (uint64_t *)&kernel_low,
......
120 121

  
121 122
    /* Store command line.  */
122 123
    if (initrd_size > 0) {
123
        int ret;
124
        ret = sprintf((char *)(phys_ram_base + (16 << 20) - 256),
125
                      "rd_start=0x" TARGET_FMT_lx " rd_size=%li ",
126
                      PHYS_TO_VIRT((uint32_t)initrd_offset),
127
                      initrd_size);
128
        strcpy ((char *)(phys_ram_base + (16 << 20) - 256 + ret),
129
                loaderparams.kernel_cmdline);
130
    }
131
    else {
132
        strcpy ((char *)(phys_ram_base + (16 << 20) - 256),
133
                loaderparams.kernel_cmdline);
124
        char buf[64];
125
        ret = snprintf(buf, 64, "rd_start=0x" TARGET_FMT_lx " rd_size=%li ",
126
                       PHYS_TO_VIRT((uint32_t)initrd_offset),
127
                       initrd_size);
128
        cpu_physical_memory_write((16 << 20) - 256, (void *)buf, 64);
129
    } else {
130
        ret = 0;
134 131
    }
132
    pstrcpy_targphys((16 << 20) - 256 + ret, 256,
133
                     loaderparams.kernel_cmdline);
135 134

  
136
    *(int32_t *)(phys_ram_base + (16 << 20) - 260) = tswap32 (0x12345678);
137
    *(int32_t *)(phys_ram_base + (16 << 20) - 264) = tswap32 (ram_size);
135
    stl_phys((16 << 20) - 260, 0x12345678);
136
    stl_phys((16 << 20) - 264, ram_size);
138 137
}
139 138

  
140 139
static void main_cpu_reset(void *opaque)

Also available in: Unified diff