aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>2007-04-30 02:24:42 +0000
committerbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>2007-04-30 02:24:42 +0000
commit9d55199763d4067158d6c556e78312f7d007d914 (patch)
treee1ee7532b8bb77430321354484852fa6ea403eae
parentb00052e496395a9cd38b7efb558aa78855a1e179 (diff)
Account for machine with RAM which is not mapped at 0x0 in arm_boot.c.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2757 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r--hw/arm_boot.c19
-rw-r--r--hw/integratorcp.c2
-rw-r--r--hw/realview.c2
-rw-r--r--hw/spitz.c2
-rw-r--r--hw/versatilepb.c2
-rw-r--r--target-arm/cpu.h3
-rw-r--r--vl.h2
7 files changed, 17 insertions, 15 deletions
diff --git a/hw/arm_boot.c b/hw/arm_boot.c
index 095b0bb79f..ed3ec5830e 100644
--- a/hw/arm_boot.c
+++ b/hw/arm_boot.c
@@ -32,11 +32,12 @@ static void main_cpu_reset(void *opaque)
if (env->kernel_filename)
arm_load_kernel(env, env->ram_size, env->kernel_filename,
env->kernel_cmdline, env->initrd_filename,
- env->board_id);
+ env->board_id, env->loader_start);
}
static void set_kernel_args(uint32_t ram_size, int initrd_size,
- const char *kernel_cmdline)
+ const char *kernel_cmdline,
+ target_phys_addr_t loader_start)
{
uint32_t *p;
@@ -51,12 +52,12 @@ static void set_kernel_args(uint32_t ram_size, int initrd_size,
stl_raw(p++, 4);
stl_raw(p++, 0x54410002);
stl_raw(p++, ram_size);
- stl_raw(p++, 0);
+ stl_raw(p++, loader_start);
if (initrd_size) {
/* ATAG_INITRD2 */
stl_raw(p++, 4);
stl_raw(p++, 0x54420005);
- stl_raw(p++, INITRD_LOAD_ADDR);
+ stl_raw(p++, loader_start + INITRD_LOAD_ADDR);
stl_raw(p++, initrd_size);
}
if (kernel_cmdline && *kernel_cmdline) {
@@ -77,7 +78,7 @@ static void set_kernel_args(uint32_t ram_size, int initrd_size,
void arm_load_kernel(CPUState *env, int ram_size, const char *kernel_filename,
const char *kernel_cmdline, const char *initrd_filename,
- int board_id)
+ int board_id, target_phys_addr_t loader_start)
{
int kernel_size;
int initrd_size;
@@ -98,6 +99,7 @@ void arm_load_kernel(CPUState *env, int ram_size, const char *kernel_filename,
env->kernel_cmdline = kernel_cmdline;
env->initrd_filename = initrd_filename;
env->board_id = board_id;
+ env->loader_start = loader_start;
qemu_register_reset(main_cpu_reset, env);
}
/* Assume that raw images are linux kernels, and ELF images are not. */
@@ -109,7 +111,7 @@ void arm_load_kernel(CPUState *env, int ram_size, const char *kernel_filename,
if (kernel_size < 0) {
kernel_size = load_image(kernel_filename,
phys_ram_base + KERNEL_LOAD_ADDR);
- entry = KERNEL_LOAD_ADDR;
+ entry = loader_start + KERNEL_LOAD_ADDR;
is_linux = 1;
}
if (kernel_size < 0) {
@@ -134,11 +136,10 @@ void arm_load_kernel(CPUState *env, int ram_size, const char *kernel_filename,
}
bootloader[1] |= board_id & 0xff;
bootloader[2] |= (board_id >> 8) & 0xff;
- bootloader[5] = KERNEL_ARGS_ADDR;
+ bootloader[5] = loader_start + KERNEL_ARGS_ADDR;
bootloader[6] = entry;
for (n = 0; n < sizeof(bootloader) / 4; n++)
stl_raw(phys_ram_base + (n * 4), bootloader[n]);
- set_kernel_args(ram_size, initrd_size, kernel_cmdline);
+ set_kernel_args(ram_size, initrd_size, kernel_cmdline, loader_start);
}
}
-
diff --git a/hw/integratorcp.c b/hw/integratorcp.c
index 34c3b8112e..c9e1715f37 100644
--- a/hw/integratorcp.c
+++ b/hw/integratorcp.c
@@ -508,7 +508,7 @@ static void integratorcp_init(int ram_size, int vga_ram_size, int boot_device,
pl110_init(ds, 0xc0000000, pic[22], 0);
arm_load_kernel(env, ram_size, kernel_filename, kernel_cmdline,
- initrd_filename, 0x113);
+ initrd_filename, 0x113, 0x0);
}
QEMUMachine integratorcp_machine = {
diff --git a/hw/realview.c b/hw/realview.c
index c15c231528..4f4858990c 100644
--- a/hw/realview.c
+++ b/hw/realview.c
@@ -131,7 +131,7 @@ static void realview_init(int ram_size, int vga_ram_size, int boot_device,
/* 0x6c000000 PCI mem 2. */
arm_load_kernel(env, ram_size, kernel_filename, kernel_cmdline,
- initrd_filename, 0x33b);
+ initrd_filename, 0x33b, 0x0);
}
QEMUMachine realview_machine = {
diff --git a/hw/spitz.c b/hw/spitz.c
index 84cd30507b..3b17dfe7e3 100644
--- a/hw/spitz.c
+++ b/hw/spitz.c
@@ -1035,7 +1035,7 @@ static void spitz_common_init(int ram_size, int vga_ram_size,
cpu->env->regs[15] = PXA2XX_RAM_BASE;
arm_load_kernel(cpu->env, ram_size, kernel_filename, kernel_cmdline,
- initrd_filename, arm_id);
+ initrd_filename, arm_id, PXA2XX_RAM_BASE);
sl_bootparam_write(SL_PXA_PARAM_BASE - PXA2XX_RAM_BASE);
}
diff --git a/hw/versatilepb.c b/hw/versatilepb.c
index c0908161ae..5b1774a644 100644
--- a/hw/versatilepb.c
+++ b/hw/versatilepb.c
@@ -260,7 +260,7 @@ static void versatile_init(int ram_size, int vga_ram_size, int boot_device,
/* 0x101f4000 SSPI. */
arm_load_kernel(env, ram_size, kernel_filename, kernel_cmdline,
- initrd_filename, board_id);
+ initrd_filename, board_id, 0x0);
}
static void vpb_init(int ram_size, int vga_ram_size, int boot_device,
diff --git a/target-arm/cpu.h b/target-arm/cpu.h
index 7cb08ebaf6..09083b723a 100644
--- a/target-arm/cpu.h
+++ b/target-arm/cpu.h
@@ -144,12 +144,13 @@ typedef struct CPUARMState {
CPU_COMMON
- /* These fields after the common ones so thes are preserved on reset. */
+ /* These fields after the common ones so they are preserved on reset. */
int ram_size;
const char *kernel_filename;
const char *kernel_cmdline;
const char *initrd_filename;
int board_id;
+ target_phys_addr_t loader_start;
} CPUARMState;
CPUARMState *cpu_arm_init(void);
diff --git a/vl.h b/vl.h
index f904ff2693..49f5efff3d 100644
--- a/vl.h
+++ b/vl.h
@@ -1450,7 +1450,7 @@ qemu_irq *arm_gic_init(uint32_t base, qemu_irq parent_irq);
void arm_load_kernel(CPUState *env, int ram_size, const char *kernel_filename,
const char *kernel_cmdline, const char *initrd_filename,
- int board_id);
+ int board_id, target_phys_addr_t loader_start);
/* sh7750.c */
struct SH7750State;