From: Martin Galvan <martin.galvan@tallertechnologies.com>
To: Alistair Francis <alistair23@gmail.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
Peter Crosthwaite <peter.crosthwaite@xilinx.com>,
QEMU Developers <qemu-devel@nongnu.org>,
Konstanty Bialkowski <konstanty@ieee.org>
Subject: Re: [Qemu-devel] [Patch v4 6/8] target_arm: Change the reset values based on the ELF entry
Date: Tue, 7 Oct 2014 12:03:01 -0300 [thread overview]
Message-ID: <CAOKbPbb=m6tjrGWd-XebB2kBWDBJ9MMF77jE4QZXT1zOQfC97Q@mail.gmail.com> (raw)
In-Reply-To: <b801d759b6b882ce01d0117a3000d1f66946f609.1412690288.git.alistair23@gmail.com>
On Tue, Oct 7, 2014 at 11:13 AM, Alistair Francis <alistair23@gmail.com> wrote:
> The Netduino 2 machine won't run unless the reset_pc is based
> on the ELF entry point.
>
> Signed-off-by: Alistair Francis <alistair23@gmail.com>
> Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
> ---
> V2:
> - Malloc straight away, thanks to Peter C
>
> hw/arm/armv7m.c | 19 ++++++++++++++++---
> 1 file changed, 16 insertions(+), 3 deletions(-)
>
> diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c
> index 7169027..07b36e2 100644
> --- a/hw/arm/armv7m.c
> +++ b/hw/arm/armv7m.c
> @@ -155,11 +155,19 @@ static void armv7m_bitband_init(void)
>
> /* Board init. */
>
> +typedef struct ARMV7MResetArgs {
> + ARMCPU *cpu;
> + uint32_t reset_pc;
> +} ARMV7MResetArgs;
> +
> static void armv7m_reset(void *opaque)
> {
> - ARMCPU *cpu = opaque;
> + ARMV7MResetArgs *args = opaque;
> +
> + cpu_reset(CPU(args->cpu));
>
> - cpu_reset(CPU(cpu));
> + args->cpu->env.thumb = args->reset_pc & 1;
> + args->cpu->env.regs[15] = args->reset_pc & ~1;
> }
>
> /* Init CPU and memory for a v7-M based board.
> @@ -180,6 +188,7 @@ qemu_irq *armv7m_init(MemoryRegion *system_memory, int mem_size, int num_irq,
> int i;
> int big_endian;
> MemoryRegion *hack = g_new(MemoryRegion, 1);
> + ARMV7MResetArgs *reset_args = g_new0(ARMV7MResetArgs, 1);
>
> if (cpu_model == NULL) {
> cpu_model = "cortex-m3";
> @@ -234,7 +243,11 @@ qemu_irq *armv7m_init(MemoryRegion *system_memory, int mem_size, int num_irq,
> vmstate_register_ram_global(hack);
> memory_region_add_subregion(system_memory, 0xfffff000, hack);
>
> - qemu_register_reset(armv7m_reset, cpu);
> + *reset_args = (ARMV7MResetArgs) {
> + .cpu = cpu,
> + .reset_pc = entry,
> + };
> + qemu_register_reset(armv7m_reset, reset_args);
> return pic;
> }
How does this differ from what's being done in arm_cpu_reset for
ARMv7-M? What about the initial MSP?
--
Martín Galván
Software Engineer
Taller Technologies Argentina
San Lorenzo 47, 3rd Floor, Office 5
Córdoba, Argentina
Phone: 54 351 4217888 / +54 351 4218211
next prev parent reply other threads:[~2014-10-07 15:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-07 14:12 [Qemu-devel] [Patch v4 0/8] Netduino 2 Machine Model Alistair Francis
2014-10-07 14:12 ` [Qemu-devel] [Patch v4 1/8] stm32f205_timer: Add the stm32f205 Timer Alistair Francis
2014-10-07 14:12 ` [Qemu-devel] [Patch v4 2/8] stm32f205_USART: Add the stm32f205 USART Controller Alistair Francis
2014-10-07 14:12 ` [Qemu-devel] [Patch v4 3/8] stm32f205_SYSCFG: Add the stm32f205 SYSCFG Alistair Francis
2014-10-07 14:12 ` [Qemu-devel] [Patch v4 4/8] target_arm: Remove memory region init from armv7m_init Alistair Francis
2014-10-07 14:12 ` [Qemu-devel] [Patch v4 5/8] target_arm: Parameterise the irq lines for armv7m_init Alistair Francis
2014-10-07 14:13 ` [Qemu-devel] [Patch v4 6/8] target_arm: Change the reset values based on the ELF entry Alistair Francis
2014-10-07 15:03 ` Martin Galvan [this message]
2014-10-13 0:03 ` Alistair Francis
2014-10-07 14:13 ` [Qemu-devel] [Patch v4 7/8] stm32f205: Add the stm32f205 SoC Alistair Francis
2014-10-07 14:13 ` [Qemu-devel] [Patch v4 8/8] netduino2: Add the Netduino 2 Machine Alistair Francis
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='CAOKbPbb=m6tjrGWd-XebB2kBWDBJ9MMF77jE4QZXT1zOQfC97Q@mail.gmail.com' \
--to=martin.galvan@tallertechnologies.com \
--cc=alistair23@gmail.com \
--cc=konstanty@ieee.org \
--cc=peter.crosthwaite@xilinx.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).