]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
add: Microblaze V5 exception handling
authorMichal Simek <monstr@monstr.eu>
Tue, 8 May 2007 12:52:52 +0000 (14:52 +0200)
committerMichal Simek <monstr@monstr.eu>
Tue, 8 May 2007 12:52:52 +0000 (14:52 +0200)
cpu/microblaze/exception.c
include/asm-microblaze/asm.h
include/configs/ml401.h

index b135acbad9ddbe60a3ef858dfec3212607be3639..87ecbeaa49abd53827fbb74d3ad868625a182719 100644 (file)
  */
 
 #include <common.h>
+#include <asm/asm.h>
 
 void _hw_exception_handler (void)
 {
        int address = 0;
        int state = 0;
        /* loading address of exception EAR */
-       __asm__ __volatile ("mfs %0,rear"::"r" (address):"memory");
+       MFSEAR(address);
        /* loading excetpion state register ESR */
-       __asm__ __volatile ("mfs %0,resr"::"r" (state):"memory");
+       MFSESR(state);
        printf ("Hardware exception at 0x%x address\n", address);
        switch (state & 0x1f) { /* mask on exception cause */
        case 0x1:
@@ -49,6 +50,11 @@ void _hw_exception_handler (void)
        case 0x5:
                puts ("Divide by zero exception\n");
                break;
+#ifdef MICROBLAZE_V5
+       case 0x1000:
+               puts ("Exception in delay slot\n");
+               break;
+#endif
        default:
                puts ("Undefined cause\n");
                break;
index 26e369119e102adb24ad6350bea159e6d925063d..8302ed8850785deff170c8491bc4005828b0660a 100755 (executable)
        __asm__ __volatile__ ("cput %0, rfsl" #fslnum ::"r" (val));
 
 /* CPU dependent */
+/* machine status register */
 #define MFS(val) \
        __asm__ __volatile__ ("mfs %0, rmsr":"=r" (val));
 
 #define MTS(val) \
        __asm__ __volatile__ ("mts rmsr, %0"::"r" (val));
 
+/* exception status register */
+#define MFSEAR(val) \
+       __asm__ __volatile ("mfs %0,rear":"=r" (val));
+
+#define MFSESR(val) \
+       __asm__ __volatile ("mfs %0,resr":"=r" (val));
+
 /* get return address from interrupt */
 #define R14(val) \
        __asm__ __volatile__ ("addi %0, r14, 0":"=r" (val));
index 327d31c103a99358e90410792bfb08c3dc5ed404..4cfe802c36a1d5b2d81f2303848680ca84f9e8ec 100644 (file)
@@ -28,6 +28,7 @@
 #include "../board/xilinx/ml401/xparameters.h"
 
 #define        CONFIG_MICROBLAZE       1       /* MicroBlaze CPU */
+#define        MICROBLAZE_V5           1
 #define        CONFIG_ML401            1       /* ML401 Board */
 
 /* uart */