From: Meador Inge <meadori@codesourcery.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, paul@codesourcery.com
Subject: [Qemu-devel] [PATCH v1 1/4] hw: Add support for loading ARMv7-M applications via -kernel
Date: Mon, 27 Aug 2012 15:37:45 -0500 [thread overview]
Message-ID: <1346099868-7774-2-git-send-email-meadori@codesourcery.com> (raw)
In-Reply-To: <1346099868-7774-1-git-send-email-meadori@codesourcery.com>
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(-)
diff --git a/hw/armv7m.c b/hw/armv7m.c
index 9f66667..d11be09 100644
--- a/hw/armv7m.c
+++ b/hw/armv7m.c
@@ -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
--
1.7.7.6
next prev parent reply other threads:[~2012-08-27 20:37 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-27 20:37 [Qemu-devel] [PATCH v1 0/4] Improve ARMv7-M architecture emulation Meador Inge
2012-08-27 20:37 ` Meador Inge [this message]
2012-08-28 12:43 ` [Qemu-devel] [PATCH v1 1/4] hw: Add support for loading ARMv7-M applications via -kernel Peter Maydell
2012-08-27 20:37 ` [Qemu-devel] [PATCH v1 2/4] target-arm: Make SYS_HEAPINFO work for ARMv7-M Meador Inge
2012-08-28 12:47 ` Peter Maydell
2012-08-27 20:37 ` [Qemu-devel] [PATCH v1 3/4] hw: Deduce the default machine from the specified CPU model Meador Inge
2012-08-27 20:47 ` Peter Maydell
2012-08-28 12:58 ` Paul Brook
2012-08-28 13:10 ` Peter Maydell
2012-08-28 13:32 ` Paul Brook
2012-08-28 13:54 ` Peter Maydell
2012-08-27 20:37 ` [Qemu-devel] [PATCH v1 4/4] hw: Add support for a dummy ARMv7-M board Meador Inge
2012-08-28 12:48 ` Peter Maydell
2012-08-28 16:11 ` Meador Inge
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1346099868-7774-2-git-send-email-meadori@codesourcery.com \
--to=meadori@codesourcery.com \
--cc=paul@codesourcery.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).