@@ -150,10 +150,16 @@ static void armv7m_bitband_init(void)
static void armv7m_reset(void *opaque)
{
ARMCPU *cpu = opaque;
+ CPUARMState *env = &cpu->env;
+ const struct arm_boot_info *info = env->boot_info;
cpu_reset(CPU(cpu));
+ env->regs[15] = info->entry & 0xfffffffe;
+ env->thumb = info->entry & 1;
}
+static struct arm_boot_info armv7m_binfo;
+
/* Init CPU and memory for a v7-M based board.
flash_size and sram_size are in kb.
Returns the NVIC array. */
@@ -232,10 +238,16 @@ qemu_irq *armv7m_init(MemoryRegion *address_space_mem,
exit(1);
}
+ armv7m_binfo.ram_size = sram_size;
+ armv7m_binfo.kernel_filename = kernel_filename;
+ armv7m_binfo.kernel_cmdline = "";
+ env->boot_info = &armv7m_binfo;
+
image_size = load_elf(kernel_filename, NULL, NULL, &entry, &lowaddr,
NULL, big_endian, ELF_MACHINE, 1);
if (image_size < 0) {
image_size = load_image_targphys(kernel_filename, 0, flash_size);
+ entry = 0;
lowaddr = 0;
}
if (image_size < 0) {
@@ -243,6 +255,7 @@ qemu_irq *armv7m_init(MemoryRegion *address_space_mem,
kernel_filename);
exit(1);
}
+ armv7m_binfo.entry = entry;
/* Hack to map an additional page of ram at the top of the address
space. This stops qemu complaining about executing code outside RAM
The minimal amount of arm_boot_info has been setup to allow for machines based off of ARMv7-M processors to be loaded via the -kernel option. Signed-off-by: Meador Inge <meadori@codesourcery.com> --- hw/armv7m.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-)