On Fri, 26 Jul 2019, Volodymyr Babchuk wrote:
> Julien Grall writes:
> 
> > At the moment, _show_registers() is using a BUG_ON() to assert only
> > userspace will run 32-bit code in a 64-bit domain.
> >
> > Such extra precaution is not necessary and could be avoided by only
> > checking the CPU mode to decide whether show_registers_64() or
> > show_reigsters_32() should be called.
> >
> > This has also the nice advantage to avoid nested if in the code.
> >
> > Signed-off-by: Julien Grall <[email protected]>
> Reviewed-by: Volodymyr Babchuk <[email protected]>

Acked-by: Stefano Stabellini <[email protected]>


> > ---
> >  xen/arch/arm/traps.c | 16 +++-------------
> >  1 file changed, 3 insertions(+), 13 deletions(-)
> >
> > diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
> > index 54e66a86d0..132686ee0f 100644
> > --- a/xen/arch/arm/traps.c
> > +++ b/xen/arch/arm/traps.c
> > @@ -914,21 +914,11 @@ static void _show_registers(const struct 
> > cpu_user_regs *regs,
> >  
> >      if ( guest_mode )
> >      {
> > -        if ( is_32bit_domain(v->domain) )
> > +        if ( psr_mode_is_32bit(regs) )
> >              show_registers_32(regs, ctxt, guest_mode, v);
> >  #ifdef CONFIG_ARM_64
> > -        else if ( is_64bit_domain(v->domain) )
> > -        {
> > -            if ( psr_mode_is_32bit(regs) )
> > -            {
> > -                BUG_ON(!usr_mode(regs));
> > -                show_registers_32(regs, ctxt, guest_mode, v);
> > -            }
> > -            else
> > -            {
> > -                show_registers_64(regs, ctxt, guest_mode, v);
> > -            }
> > -        }
> > +        else
> > +            show_registers_64(regs, ctxt, guest_mode, v);
> >  #endif
> >      }
> >      else
> 
> 
> -- 
> Volodymyr Babchuk at EPAM

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to