[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 3/5] arm: Support thumb in set_pc routines
From: |
Peter Crosthwaite |
Subject: |
Re: [Qemu-devel] [PATCH 3/5] arm: Support thumb in set_pc routines |
Date: |
Mon, 15 Jun 2015 15:41:27 -0700 |
On Mon, Jun 15, 2015 at 12:36 AM, Peter Maydell
<address@hidden> wrote:
> On 15 June 2015 at 04:48, Peter Crosthwaite <address@hidden> wrote:
>> ARM program counters are always at least 16b aligned with the LSB
>> being only used the indicate thumb mode in exchange situations. Mask
>> this bit off in set_pc to ignore the exchange semantic (which must
>> still be managed by the caller).
>>
>> Signed-off-by: Peter Crosthwaite <address@hidden>
>> ---
>> ---
>> target-arm/cpu.c | 2 +-
>> target-arm/cpu64.c | 2 +-
>> 2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/target-arm/cpu.c b/target-arm/cpu.c
>> index 6181f28..5bb08a6 100644
>> --- a/target-arm/cpu.c
>> +++ b/target-arm/cpu.c
>> @@ -35,7 +35,7 @@ static void arm_cpu_set_pc(CPUState *cs, vaddr value)
>> {
>> ARMCPU *cpu = ARM_CPU(cs);
>>
>> - cpu->env.regs[15] = value;
>> + cpu->env.regs[15] = value & 0xfffffffe;
>> }
>
>
> This doesn't look right to me. There are two semantics that
> make sense for setting an ARM PC value:
>
> (1) interworking-aware, where we set the Thumb bit from the
> LS bit and r15 from everything else
> (2) interworking-unaware, where we just set r15 (and it's
> the caller's job to not pass us a misaligned value)
>
Actually I am just going to leave as-is and mask off in the caller.
What I am really trying to do is remove usage of r[15] from boot.c and
I can do that using strategy (2) still.
Regards,
Peter
> This seems to be an odd mix of both.
>
> -- PMM
>
- [Qemu-devel] [PATCH 0/5] qom-cpu: Wrap set_pc hook and use in bootloaders, Peter Crosthwaite, 2015/06/14
- [Qemu-devel] [PATCH 1/5] qom: cpu: Add wrapper to the set-pc hook, Peter Crosthwaite, 2015/06/14
- [Qemu-devel] [PATCH 2/5] gdbstub: Use cpu_set_pc helper, Peter Crosthwaite, 2015/06/14
- [Qemu-devel] [PATCH 4/5] arm: boot: Use cpu_set_pc, Peter Crosthwaite, 2015/06/14
- [Qemu-devel] [PATCH 3/5] arm: Support thumb in set_pc routines, Peter Crosthwaite, 2015/06/14
- [Qemu-devel] [PATCH 5/5] microblaze: boot: Use cpu_set_pc, Peter Crosthwaite, 2015/06/14