Merge branch 'linus' into core/generic-dma-coherent
[pandora-kernel.git] / arch / powerpc / kernel / head_booke.h
index f277fad..fce2df9 100644 (file)
 #define MCHECK_STACK_BASE      mcheckirq_ctx
 #define CRIT_STACK_BASE                critirq_ctx
 
-/* only on e200 for now */
+/* only on e500mc/e200 */
 #define DEBUG_STACK_BASE       dbgirq_ctx
+#ifdef CONFIG_PPC_E500MC
+#define DEBUG_SPRG             SPRN_SPRG9
+#else
 #define DEBUG_SPRG             SPRN_SPRG6W
+#endif
 
 #define EXC_LVL_FRAME_OVERHEAD (THREAD_SIZE - INT_FRAME_SIZE - EXC_LVL_SIZE)
 
@@ -240,7 +244,7 @@ label:
         * 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 CSRR1 value and clearing the debug status.           \
+        * 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@h;                                            \
@@ -278,7 +282,7 @@ label:
        RFDI;                                                                 \
        b       .;                                                            \
                                                                              \
-       /* continue normal handling for a critical exception... */            \
+       /* continue normal handling for a debug exception... */               \
 2:     mfspr   r4,SPRN_DBSR;                                                 \
        addi    r3,r1,STACK_FRAME_OVERHEAD;                                   \
        EXC_XFER_TEMPLATE(DebugException, 0x2008, (MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)), NOCOPY, debug_transfer_to_handler, ret_from_debug_exc)
@@ -336,6 +340,14 @@ label:
        addi    r3,r1,STACK_FRAME_OVERHEAD;                                   \
        EXC_XFER_TEMPLATE(DebugException, 0x2002, (MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)), NOCOPY, crit_transfer_to_handler, ret_from_crit_exc)
 
+#define DATA_STORAGE_EXCEPTION                                               \
+       START_EXCEPTION(DataStorage)                                          \
+       NORMAL_EXCEPTION_PROLOG;                                              \
+       mfspr   r5,SPRN_ESR;            /* Grab the ESR and save it */        \
+       stw     r5,_ESR(r11);                                                 \
+       mfspr   r4,SPRN_DEAR;           /* Grab the DEAR */                   \
+       EXC_XFER_EE_LITE(0x0300, handle_page_fault)
+
 #define INSTRUCTION_STORAGE_EXCEPTION                                        \
        START_EXCEPTION(InstructionStorage)                                   \
        NORMAL_EXCEPTION_PROLOG;                                              \
@@ -372,8 +384,10 @@ label:
 #define FP_UNAVAILABLE_EXCEPTION                                             \
        START_EXCEPTION(FloatingPointUnavailable)                             \
        NORMAL_EXCEPTION_PROLOG;                                              \
-       bne     load_up_fpu;            /* if from user, just load it up */   \
-       addi    r3,r1,STACK_FRAME_OVERHEAD;                                   \
+       beq     1f;                                                           \
+       bl      load_up_fpu;            /* if from user, just load it up */   \
+       b       fast_exception_return;                                        \
+1:     addi    r3,r1,STACK_FRAME_OVERHEAD;                                   \
        EXC_XFER_EE_LITE(0x800, kernel_fp_unavailable_exception)
 
 #ifndef __ASSEMBLY__