[PATCH] bookehv: Handle debug exception on guest exit

Kumar Gala galak at kernel.crashing.org
Fri Apr 12 04:33:28 EST 2013


On Apr 5, 2013, at 2:53 AM, Bhushan Bharat-R65777 wrote:

> Hi Kumar/Benh,
> 
> After further looking into the code I think that if we correct the vector range below in DebugDebug handler then we do not need the change I provided in this patch.
> 
> Here is the snapshot for 32 bit (head_booke.h, same will be true for 64 bit):
> 
> #define DEBUG_DEBUG_EXCEPTION                                                 \
>        START_EXCEPTION(DebugDebug);                                          \
>        DEBUG_EXCEPTION_PROLOG;                                               \
>                                                                              \
>        /*                                                                    \
>         * If there is a single step or branch-taken exception in an          \
>         * exception entry sequence, it was probably meant to apply to        \
>         * the code where the exception occurred (since exception entry       \
>         * doesn't turn off DE automatically).  We simulate the effect        \
>         * of turning off DE on entry to an exception handler by turning      \
>         * off DE in the DSRR1 value and clearing the debug status.           \
>         */                                                                   \
>        mfspr   r10,SPRN_DBSR;          /* check single-step/branch taken */  \
>        andis.  r10,r10,(DBSR_IC|DBSR_BT)@h;                                  \
>        beq+    2f;                                                           \
>                                                                              \
>        lis     r10,KERNELBASE at h;       /* check if exception in vectors */   \
>        ori     r10,r10,KERNELBASE at l;                                         \
>        cmplw   r12,r10;                                                      \
>        blt+    2f;                     /* addr below exception vectors */    \
>                                                                              \
>        lis     r10,DebugDebug at h;                                        \
>        ori     r10,r10,DebugDebug at l;                                            \
> 
> ^^^^
> 	Here we assume all exception vector ends at DebugDebug, which is not correct.
> 	We probably should get proper end by using some start_vector and end_vector lebels
> 	or at least use end at Ehvpriv (which is last defined in head_fsl_booke.S for PowerPC. Is that correct?
> 
> 	
>        cmplw   r12,r10;                                                      \
>        bgt+    2f;                     /* addr above exception vectors */    \
> 
> Thanks
> -Bharat

I talked to Stuart and this general approach is good.  Just make sure to update both head_44x.S and head_fsl_booke.S.  Plus do this for both DEBUG_CRIT_EXCEPTION & DEBUG_DEBUG_EXCEPTION

- k


More information about the Linuxppc-dev mailing list