changeset 1441:dbadab9b4441

Add macros for machine check exception
author gthomas
date Thu, 11 Dec 2003 15:17:04 +0000
parents 4367d4c65982
children b2f2e3f2a047
files packages/hal/powerpc/arch/current/ChangeLog packages/hal/powerpc/arch/current/include/hal_intr.h
diffstat 2 files changed, 40 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/packages/hal/powerpc/arch/current/ChangeLog
+++ b/packages/hal/powerpc/arch/current/ChangeLog
@@ -1,3 +1,8 @@
+2003-12-11  Gary Thomas  <gary@mlbassoc.com>
+
+	* include/hal_intr.h: Add macros to manipulate machine check enable
+	bit in the MSR.
+
 2003-12-08  Gary Thomas  <gary@mlbassoc.com>
 
 	* src/hal_misc.c (cyg_hal_exception_handler): Only declare __mem_fault_handler
--- a/packages/hal/powerpc/arch/current/include/hal_intr.h
+++ b/packages/hal/powerpc/arch/current/include/hal_intr.h
@@ -230,6 +230,41 @@ typedef cyg_uint32 CYG_INTERRUPT_STATE;
     CYG_MACRO_END
 
 //--------------------------------------------------------------------------
+// Machine check manipulation
+#define HAL_DISABLE_MACHINE_CHECK(_old_)                \
+    CYG_MACRO_START                                     \
+    cyg_uint32 tmp1, tmp2;                              \
+    asm volatile (                                      \
+        "mfmsr  %0;"                                    \
+        "mr     %2,%0;"                                 \
+        "li     %1,0;"                                  \
+        "rlwimi %2,%1,0,19,19;"                         \
+        "mtmsr  %2;"                                    \
+        : "=r"(_old_), "=r" (tmp1), "=r" (tmp2));       \
+    CYG_MACRO_END
+
+#define HAL_ENABLE_MACHINE_CHECK()      \
+    CYG_MACRO_START                     \
+    cyg_uint32 tmp1, tmp2;              \
+    asm volatile (                      \
+        "mfmsr  %0;"                    \
+        "lis    %1,%1,0x0001;"          \
+        "rlwimi %0,%1,0,19,19;"         \
+        "mtmsr  %0;"                    \
+        : "=r" (tmp1), "=r" (tmp2));    \
+    CYG_MACRO_END
+
+#define HAL_QUERY_MACHINE_CHECK(_old_)  \
+    CYG_MACRO_START                     \
+    cyg_uint32 tmp;                     \
+    asm volatile (                      \
+        "mfmsr  %0;"                    \
+        "lis    %1,0x0001;"             \
+        "and    %0,%0,%1;"              \
+        : "=&r"(_old_), "=r" (tmp));     \
+    CYG_MACRO_END
+
+//--------------------------------------------------------------------------
 // Vector translation.
 
 #ifndef HAL_TRANSLATE_VECTOR