armv7m: R14 should reset to 0xffffffff

For M profile (unlike A profile) the reset value of R14 is specified
as 0xffffffff. (The rationale is that this is an illegal exception
return value, so if guest code tries to return to it it will result
in a helpful exception.)

Registers r0 to r12 and the flags are architecturally UNKNOWN on
reset, so we leave those at zero.

Backports commit 056f43df9168413f304500b69c33158d66efb7cf from qemu
This commit is contained in:
Peter Maydell 2018-03-02 13:56:32 -05:00 committed by Lioncash
parent f42f22ec02
commit bb5819cbbc
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -192,6 +192,9 @@ static void arm_cpu_reset(CPUState *s)
* it dependent on CPU model. * it dependent on CPU model.
*/ */
env->v7m.ccr = R_V7M_CCR_STKALIGN_MASK; env->v7m.ccr = R_V7M_CCR_STKALIGN_MASK;
/* Unlike A/R profile, M profile defines the reset LR value */
env->regs[14] = 0xffffffff;
#if 0 #if 0
/* Load the initial SP and PC from the vector table at address 0 */ /* Load the initial SP and PC from the vector table at address 0 */
uint8_t *rom; uint8_t *rom;