On Tue, May 6, 2014 at 4:08 PM, Edgar E. Iglesias <edgar.igles...@gmail.com> wrote: > From: "Edgar E. Iglesias" <edgar.igles...@xilinx.com> > > Signed-off-by: Edgar E. Iglesias <edgar.igles...@xilinx.com>
Reviewed-by: Peter Crosthwaite <peter.crosthwa...@xilinx.com> > --- > target-arm/op_helper.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/target-arm/op_helper.c b/target-arm/op_helper.c > index dd9e4fc..770c776 100644 > --- a/target-arm/op_helper.c > +++ b/target-arm/op_helper.c > @@ -389,6 +389,7 @@ void HELPER(exception_return)(CPUARMState *env) > unsigned int spsr_idx = arm64_banked_spsr_index(1); > uint32_t spsr = env->banked_spsr[spsr_idx]; > int new_el, i; > + int cur_el = arm_current_pl(env); > > if (env->pstate & PSTATE_SP) { > env->sp_el[1] = env->xregs[31]; > @@ -410,6 +411,10 @@ void HELPER(exception_return)(CPUARMState *env) > env->regs[15] = env->elr_el[ELR_EL_IDX(1)] & ~0x1; > } else { > new_el = extract32(spsr, 2, 2); > + if (new_el > cur_el) { > + /* Disallow returns to higher ELs than the current one. */ > + goto illegal_return; > + } > if (new_el > 1) { > /* Return to unimplemented EL */ > goto illegal_return; > -- > 1.8.3.2 > >