[PATCH 12/15] Added print of the ESR

Ric Claus claus at slac.stanford.edu
Tue Nov 27 03:26:50 UTC 2012


---
 .../new-exceptions/bspsupport/ppc_exc_print.c      |   21 ++++++++++++++++---
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_print.c b/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_print.c
index e1bbf12..cd411a9 100644
--- a/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_print.c
+++ b/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_print.c
@@ -45,9 +45,9 @@ static uint32_t ppc_exc_get_DAR_dflt(void)
         break;
       case PPC_BOOKE_STD:
       case PPC_BOOKE_E500:
-        return PPC_SPECIAL_PURPOSE_REGISTER(DEAR_BOOKE);
+        return PPC_SPECIAL_PURPOSE_REGISTER(BOOKE_DEAR);
       case PPC_BOOKE_405:
-        return PPC_SPECIAL_PURPOSE_REGISTER(DEAR_405);
+        return PPC_SPECIAL_PURPOSE_REGISTER(PPC405_DEAR);
     }
   return 0xdeadbeef;
 }
@@ -157,11 +157,24 @@ void ppc_exc_print_frame_and_context(const BSP_Exception_frame *excPtr)
   /* Would be great to print DAR but unfortunately,
    * that is not portable across different CPUs.
    * AFAIK on classic PPC DAR is SPR 19, on the
-   * 405 we have DEAR = SPR 0x3d5 and booE says
+   * 405 we have DEAR = SPR 0x3d5 and bookE says
    * DEAR = SPR 61 :-(
    */
   if (ppc_exc_get_DAR != NULL) {
-    printk("  DAR = 0x%08x\n", ppc_exc_get_DAR());
+    char* reg = ppc_cpu_is_60x() ? " DAR" : "DEAR";
+    printk(" %s = 0x%08x\n", reg, ppc_exc_get_DAR());
+  }
+  if (ppc_cpu_is_bookE()) {
+    unsigned esr, mcsr;
+    if (ppc_cpu_is_bookE() == PPC_BOOKE_405) {
+      esr  = PPC_SPECIAL_PURPOSE_REGISTER(PPC405_ESR);
+      mcsr = PPC_SPECIAL_PURPOSE_REGISTER(PPC405_MCSR);
+    } else {
+      esr  = PPC_SPECIAL_PURPOSE_REGISTER(BOOKE_ESR);
+      mcsr = PPC_SPECIAL_PURPOSE_REGISTER(BOOKE_MCSR);
+    }
+    printk("  ESR = 0x%08x\n", esr);
+    printk(" MCSR = 0x%08x\n", mcsr);
   }
 
   if (executing != NULL) {
-- 
1.7.1




More information about the devel mailing list