mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-10 02:54:58 -06:00
target-arm: A64: Forbid ERET to higher or unimplemented ELs
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Message-id: 1400980132-25949-18-git-send-email-edgar.iglesias@gmail.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
81547d6630
commit
7ab6c10d00
1 changed files with 6 additions and 2 deletions
|
@ -389,6 +389,7 @@ void HELPER(exception_return)(CPUARMState *env)
|
||||||
unsigned int spsr_idx = aarch64_banked_spsr_index(1);
|
unsigned int spsr_idx = aarch64_banked_spsr_index(1);
|
||||||
uint32_t spsr = env->banked_spsr[spsr_idx];
|
uint32_t spsr = env->banked_spsr[spsr_idx];
|
||||||
int new_el, i;
|
int new_el, i;
|
||||||
|
int cur_el = arm_current_pl(env);
|
||||||
|
|
||||||
if (env->pstate & PSTATE_SP) {
|
if (env->pstate & PSTATE_SP) {
|
||||||
env->sp_el[1] = env->xregs[31];
|
env->sp_el[1] = env->xregs[31];
|
||||||
|
@ -410,8 +411,11 @@ void HELPER(exception_return)(CPUARMState *env)
|
||||||
env->regs[15] = env->elr_el[1] & ~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 > cur_el
|
||||||
/* Return to unimplemented EL */
|
|| (new_el == 2 && !arm_feature(env, ARM_FEATURE_EL2))) {
|
||||||
|
/* Disallow return to an EL which is unimplemented or higher
|
||||||
|
* than the current one.
|
||||||
|
*/
|
||||||
goto illegal_return;
|
goto illegal_return;
|
||||||
}
|
}
|
||||||
if (extract32(spsr, 1, 1)) {
|
if (extract32(spsr, 1, 1)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue