axisdev88: Fix passing of kernel cmdline.

Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
This commit is contained in:
Edgar E. Iglesias 2010-05-21 16:09:10 +02:00
parent f6d20d0f4f
commit a9456998e9

View file

@ -240,13 +240,22 @@ static CPUWriteMemoryFunc * const gpio_write[] = {
#define INTMEM_SIZE (128 * 1024) #define INTMEM_SIZE (128 * 1024)
static uint32_t bootstrap_pc; static struct {
uint32_t bootstrap_pc;
uint32_t regs[16];
} loadargs;
static void main_cpu_reset(void *opaque) static void main_cpu_reset(void *opaque)
{ {
int i;
CPUState *env = opaque; CPUState *env = opaque;
cpu_reset(env); cpu_reset(env);
env->pc = bootstrap_pc; env->pc = loadargs.bootstrap_pc;
for (i = 0; i < 16; i++) {
env->regs[i] = loadargs.regs[i];
}
} }
static uint64_t translate_kernel_address(void *opaque, uint64_t addr) static uint64_t translate_kernel_address(void *opaque, uint64_t addr)
@ -352,15 +361,15 @@ void axisdev88_init (ram_addr_t ram_size,
devboard SDK. */ devboard SDK. */
kernel_size = load_elf(kernel_filename, translate_kernel_address, NULL, kernel_size = load_elf(kernel_filename, translate_kernel_address, NULL,
&entry, NULL, &high, 0, ELF_MACHINE, 0); &entry, NULL, &high, 0, ELF_MACHINE, 0);
bootstrap_pc = entry; loadargs.bootstrap_pc = entry;
if (kernel_size < 0) { if (kernel_size < 0) {
/* Takes a kimage from the axis devboard SDK. */ /* Takes a kimage from the axis devboard SDK. */
kernel_size = load_image_targphys(kernel_filename, 0x40004000, kernel_size = load_image_targphys(kernel_filename, 0x40004000,
ram_size); ram_size);
bootstrap_pc = 0x40004000; loadargs.bootstrap_pc = 0x40004000;
env->regs[9] = 0x40004000 + kernel_size; loadargs.regs[9] = 0x40004000 + kernel_size;
} }
env->regs[8] = 0x56902387; /* RAM init magic. */ loadargs.regs[8] = 0x56902387; /* RAM init magic. */
if (kernel_cmdline && (kcmdline_len = strlen(kernel_cmdline))) { if (kernel_cmdline && (kcmdline_len = strlen(kernel_cmdline))) {
if (kcmdline_len > 256) { if (kcmdline_len > 256) {
@ -368,15 +377,11 @@ void axisdev88_init (ram_addr_t ram_size,
exit(1); exit(1);
} }
/* Let the kernel know we are modifying the cmdline. */ /* Let the kernel know we are modifying the cmdline. */
env->regs[10] = 0x87109563; loadargs.regs[10] = 0x87109563;
env->regs[11] = 0x40000000; loadargs.regs[11] = 0x40000000;
pstrcpy_targphys("cmdline", env->regs[11], 256, kernel_cmdline); pstrcpy_targphys("cmdline", loadargs.regs[11], 256, kernel_cmdline);
} }
} }
env->pc = bootstrap_pc;
printf ("pc =%x\n", env->pc);
printf ("ram size =%ld\n", ram_size);
} }
static QEMUMachine axisdev88_machine = { static QEMUMachine axisdev88_machine = {