[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [Patch v1 6/8] target_arm: Change the reset values base
From: |
Alistair Francis |
Subject: |
Re: [Qemu-devel] [Patch v1 6/8] target_arm: Change the reset values based on the ELF entry |
Date: |
Tue, 16 Sep 2014 12:40:23 +1000 |
On Tue, Sep 16, 2014 at 1:27 AM, Peter Crosthwaite
<address@hidden> wrote:
> On Sun, Sep 14, 2014 at 6:19 PM, Alistair Francis <address@hidden> wrote:
>> The Netduino 2 machine won't run unless the reset_pc is based
>> on the ELF entry point.
>>
>> Signed-off-by: Alistair Francis <address@hidden>
>
> Looks based on one of my early attempts at same problem so:
>
> Signed-off-by: Peter Crosthwaite <address@hidden>
>
Sorry, I forgot about that
>> ---
>> hw/arm/armv7m.c | 24 +++++++++++++++++++-----
>> 1 file changed, 19 insertions(+), 5 deletions(-)
>>
>> diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c
>> index 5e684a0..816b651 100644
>> --- a/hw/arm/armv7m.c
>> +++ b/hw/arm/armv7m.c
>> @@ -155,11 +155,19 @@ static void armv7m_bitband_init(void)
>>
>> /* Board init. */
>>
>> -static void armv7m_reset(void *opaque)
>> -{
>> - ARMCPU *cpu = opaque;
>> +typedef struct ARMV7MResetArgs {
>> + ARMCPU *cpu;
>> + uint32_t reset_pc;
>> +} ARMV7MResetArgs;
>> +
>> + static void armv7m_reset(void *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.
>> @@ -181,6 +189,7 @@ qemu_irq *armv7m_init(MemoryRegion *system_memory,
>> int i;
>> int big_endian;
>> MemoryRegion *hack = g_new(MemoryRegion, 1);
>> + ARMV7MResetArgs reset_args;
> Malloc straight away rather than the gmemdup.
>
> ARMV7MResetArgs *reset_args = g_new0(ARMV7MResetArgs, 1);
>
Will fix
Thanks,
Alistair
>>
>> if (cpu_model == NULL) {
>> cpu_model = "cortex-m3";
>> @@ -247,7 +256,12 @@ qemu_irq *armv7m_init(MemoryRegion *system_memory,
>> 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,
>> + g_memdup(&reset_args, sizeof(reset_args)));
>
>
> Regards,
> Peter
>
>> return pic;
>> }
>>
>> --
>> 1.9.1
>>
>>
- [Qemu-devel] [Patch v1 3/8] stm32f205_SYSCFG: Add the stm32f205 SYSCFG, (continued)
- [Qemu-devel] [Patch v1 3/8] stm32f205_SYSCFG: Add the stm32f205 SYSCFG, Alistair Francis, 2014/09/14
- [Qemu-devel] [Patch v1 4/8] target_arm: Remove memory region init from armv7m_init, Alistair Francis, 2014/09/14
- [Qemu-devel] [Patch v1 5/8] target_arm: Parameterise the irq lines for armv7m_init, Alistair Francis, 2014/09/14
- [Qemu-devel] [Patch v1 6/8] target_arm: Change the reset values based on the ELF entry, Alistair Francis, 2014/09/14
- [Qemu-devel] [Patch v1 7/8] stm32f205: Add the stm32f205 SoC, Alistair Francis, 2014/09/14
- [Qemu-devel] [Patch v1 8/8] netduino2: Add the Netduino 2 Machine, Alistair Francis, 2014/09/14