Subject: [PATCH 3/6] arm64: Add support for hooks to handle undefined instructions

From: [email-masked] (Will Deacon)
Date: Wed, 27 Aug 2014 17:51:59 +0100

On Wed, Aug 27, 2014 at 05:47:14PM +0100, Catalin Marinas wrote:
> On Tue, Aug 26, 2014 at 03:30:11PM +0100, Will Deacon wrote:
> > On Tue, Aug 26, 2014 at 03:21:09PM +0100, Ard Biesheuvel wrote:
> > > You need this patch in order to be able to return from an undef
> > > exception taken in EL1:
> > > 
> > > --- a/arch/arm64/kernel/entry.S
> > > +++ b/arch/arm64/kernel/entry.S
> > > @@ -287,7 +287,9 @@ el1_undef:
> > >          */
> > >         enable_dbg
> > >         mov     x0, sp
> > > -       b       do_undefinstr
> > > +       bl      do_undefinstr
> > > +
> > > +       kernel_exit 1
> > >  el1_dbg:
> > >         /*
> > >          * Debug exception handling
> > 
> > Hmm, I'm surprised we don't already need something like this for KGDB...
> 
> We don't expect undef exceptions at EL1, so far they are fatal as we
> don't have any hooks for them. Doesn't KGDB use dedicated breakpoint
> instructions?

Ah yeah, we use magic immediates in the BRK instruction. I was getting
confused with arch/arm/, where we actually use an undefined encoding for
the same thing. That explains why things appear to be working!

Will