target-arm: Make elr_el1 an array

No functional change.
Prepares for future additions of the EL2 and 3 versions of this reg.

Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Message-id: 1400980132-25949-7-git-send-email-edgar.iglesias@gmail.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Edgar E. Iglesias 2014-05-27 17:09:51 +01:00 committed by Peter Maydell
parent f79fbf39e2
commit 6947f05978
6 changed files with 11 additions and 10 deletions

View file

@ -162,7 +162,7 @@ typedef struct CPUARMState {
uint32_t condexec_bits; /* IT bits. cpsr[15:10,26:25]. */ uint32_t condexec_bits; /* IT bits. cpsr[15:10,26:25]. */
uint64_t daif; /* exception masks, in the bits they are in in PSTATE */ uint64_t daif; /* exception masks, in the bits they are in in PSTATE */
uint64_t elr_el1; /* AArch64 ELR_EL1 */ uint64_t elr_el[2]; /* AArch64 exception link regs */
uint64_t sp_el[2]; /* AArch64 banked stack pointers */ uint64_t sp_el[2]; /* AArch64 banked stack pointers */
/* System control coprocessor (cp15) */ /* System control coprocessor (cp15) */

View file

@ -491,13 +491,13 @@ void aarch64_cpu_do_interrupt(CPUState *cs)
env->banked_spsr[0] = pstate_read(env); env->banked_spsr[0] = pstate_read(env);
env->sp_el[arm_current_pl(env)] = env->xregs[31]; env->sp_el[arm_current_pl(env)] = env->xregs[31];
env->xregs[31] = env->sp_el[1]; env->xregs[31] = env->sp_el[1];
env->elr_el1 = env->pc; env->elr_el[1] = env->pc;
} else { } else {
env->banked_spsr[0] = cpsr_read(env); env->banked_spsr[0] = cpsr_read(env);
if (!env->thumb) { if (!env->thumb) {
env->cp15.esr_el1 |= 1 << 25; env->cp15.esr_el1 |= 1 << 25;
} }
env->elr_el1 = env->regs[15]; env->elr_el[1] = env->regs[15];
for (i = 0; i < 15; i++) { for (i = 0; i < 15; i++) {
env->xregs[i] = env->regs[i]; env->xregs[i] = env->regs[i];

View file

@ -2079,7 +2079,8 @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
{ .name = "ELR_EL1", .state = ARM_CP_STATE_AA64, { .name = "ELR_EL1", .state = ARM_CP_STATE_AA64,
.type = ARM_CP_NO_MIGRATE, .type = ARM_CP_NO_MIGRATE,
.opc0 = 3, .opc1 = 0, .crn = 4, .crm = 0, .opc2 = 1, .opc0 = 3, .opc1 = 0, .crn = 4, .crm = 0, .opc2 = 1,
.access = PL1_RW, .fieldoffset = offsetof(CPUARMState, elr_el1) }, .access = PL1_RW,
.fieldoffset = offsetof(CPUARMState, elr_el[1]) },
{ .name = "SPSR_EL1", .state = ARM_CP_STATE_AA64, { .name = "SPSR_EL1", .state = ARM_CP_STATE_AA64,
.type = ARM_CP_NO_MIGRATE, .type = ARM_CP_NO_MIGRATE,
.opc0 = 3, .opc1 = 0, .crn = 4, .crm = 0, .opc2 = 0, .opc0 = 3, .opc1 = 0, .crn = 4, .crm = 0, .opc2 = 0,

View file

@ -161,7 +161,7 @@ int kvm_arch_put_registers(CPUState *cs, int level)
} }
reg.id = AARCH64_CORE_REG(elr_el1); reg.id = AARCH64_CORE_REG(elr_el1);
reg.addr = (uintptr_t) &env->elr_el1; reg.addr = (uintptr_t) &env->elr_el[1];
ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, &reg); ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, &reg);
if (ret) { if (ret) {
return ret; return ret;
@ -241,7 +241,7 @@ int kvm_arch_get_registers(CPUState *cs)
} }
reg.id = AARCH64_CORE_REG(elr_el1); reg.id = AARCH64_CORE_REG(elr_el1);
reg.addr = (uintptr_t) &env->elr_el1; reg.addr = (uintptr_t) &env->elr_el[1];
ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, &reg); ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, &reg);
if (ret) { if (ret) {
return ret; return ret;

View file

@ -238,7 +238,7 @@ const VMStateDescription vmstate_arm_cpu = {
VMSTATE_UINT32_ARRAY(env.banked_r14, ARMCPU, 6), VMSTATE_UINT32_ARRAY(env.banked_r14, ARMCPU, 6),
VMSTATE_UINT32_ARRAY(env.usr_regs, ARMCPU, 5), VMSTATE_UINT32_ARRAY(env.usr_regs, ARMCPU, 5),
VMSTATE_UINT32_ARRAY(env.fiq_regs, ARMCPU, 5), VMSTATE_UINT32_ARRAY(env.fiq_regs, ARMCPU, 5),
VMSTATE_UINT64(env.elr_el1, ARMCPU), VMSTATE_UINT64(env.elr_el[1], ARMCPU),
VMSTATE_UINT64_ARRAY(env.sp_el, ARMCPU, 2), VMSTATE_UINT64_ARRAY(env.sp_el, ARMCPU, 2),
/* The length-check must come before the arrays to avoid /* The length-check must come before the arrays to avoid
* incoming data possibly overflowing the array. * incoming data possibly overflowing the array.

View file

@ -406,7 +406,7 @@ void HELPER(exception_return)(CPUARMState *env)
env->regs[i] = env->xregs[i]; env->regs[i] = env->xregs[i];
} }
env->regs[15] = env->elr_el1 & ~0x1; env->regs[15] = env->elr_el[1] & ~0x1;
} else { } else {
new_el = extract32(spsr, 2, 2); new_el = extract32(spsr, 2, 2);
if (new_el > 1) { if (new_el > 1) {
@ -424,7 +424,7 @@ void HELPER(exception_return)(CPUARMState *env)
env->aarch64 = 1; env->aarch64 = 1;
pstate_write(env, spsr); pstate_write(env, spsr);
env->xregs[31] = env->sp_el[new_el]; env->xregs[31] = env->sp_el[new_el];
env->pc = env->elr_el1; env->pc = env->elr_el[1];
} }
return; return;
@ -438,7 +438,7 @@ illegal_return:
* no change to exception level, execution state or stack pointer * no change to exception level, execution state or stack pointer
*/ */
env->pstate |= PSTATE_IL; env->pstate |= PSTATE_IL;
env->pc = env->elr_el1; env->pc = env->elr_el[1];
spsr &= PSTATE_NZCV | PSTATE_DAIF; spsr &= PSTATE_NZCV | PSTATE_DAIF;
spsr |= pstate_read(env) & ~(PSTATE_NZCV | PSTATE_DAIF); spsr |= pstate_read(env) & ~(PSTATE_NZCV | PSTATE_DAIF);
pstate_write(env, spsr); pstate_write(env, spsr);