Remove use of __IWMMXT__.
[platform/upstream/binutils.git] / sim / arm / armcopro.c
index 8b04186..aa75243 100644 (file)
@@ -19,6 +19,7 @@
 #include "armos.h"
 #include "armemu.h"
 #include "ansidecl.h"
+#include "iwmmxt.h"
 
 /* Dummy Co-processors.  */
 
@@ -479,7 +480,14 @@ XScale_check_memacc (ARMul_State * state, ARMword * address, int store)
 
   /* Check alignment fault enable/disable.  */
   if ((read_cp15_reg (1, 0, 0) & ARMul_CP15_R1_ALIGN) && (* address & 3))
-    ARMul_Abort (state, ARMul_DataAbortV);
+    {
+      /* Set the FSR and FAR.
+        Do not use XScale_set_fsr_far as this checks the DCSR register.  */
+      write_cp15_reg (state, 5, 0, 0, ARMul_CP15_R5_MMU_EXCPT);
+      write_cp15_reg (state, 6, 0, 0, * address);
+
+      ARMul_Abort (state, ARMul_DataAbortV);
+    }
 
   if (XScale_debug_moe (state, -1))
     return;
@@ -1315,34 +1323,57 @@ ARMul_CoProInit (ARMul_State * state)
 
   /* Install CoPro Instruction handlers here.
      The format is:
-     ARMul_CoProAttach (state, CP Number,
-                        Init routine, Exit routine
-                        LDC routine, STC routine,
-                       MRC routine, MCR routine,
-                        CDP routine,
-                       Read Reg routine, Write Reg routine).  */
-  ARMul_CoProAttach (state, 4, NULL, NULL,
-                    ValLDC, ValSTC, ValMRC, ValMCR, ValCDP, NULL, NULL);
-
-  ARMul_CoProAttach (state, 5, NULL, NULL,
-                    NULL, NULL, ValMRC, ValMCR, IntCDP, NULL, NULL);
-
-  ARMul_CoProAttach (state, 15, MMUInit, NULL,
-                    NULL, NULL, MMUMRC, MMUMCR, NULL, MMURead, MMUWrite);
-
-  ARMul_CoProAttach (state, 13, XScale_cp13_init, NULL,
-                    XScale_cp13_LDC, XScale_cp13_STC, XScale_cp13_MRC,
-                    XScale_cp13_MCR, NULL, XScale_cp13_read_reg,
-                    XScale_cp13_write_reg);
-
-  ARMul_CoProAttach (state, 14, XScale_cp14_init, NULL,
-                    XScale_cp14_LDC, XScale_cp14_STC, XScale_cp14_MRC,
-                    XScale_cp14_MCR, NULL, XScale_cp14_read_reg,
-                    XScale_cp14_write_reg);
-
-  ARMul_CoProAttach (state, 15, XScale_cp15_init, NULL,
-                    NULL, NULL, XScale_cp15_MRC, XScale_cp15_MCR,
-                    NULL, XScale_cp15_read_reg, XScale_cp15_write_reg);
+     ARMul_CoProAttach (state, CP Number, Init routine, Exit routine
+                        LDC routine, STC routine, MRC routine, MCR routine,
+                        CDP routine, Read Reg routine, Write Reg routine).  */
+  if (state->is_ep9312)
+    {
+      ARMul_CoProAttach (state, 4, NULL, NULL, DSPLDC4, DSPSTC4,
+                        DSPMRC4, DSPMCR4, DSPCDP4, NULL, NULL);
+      ARMul_CoProAttach (state, 5, NULL, NULL, DSPLDC5, DSPSTC5,
+                        DSPMRC5, DSPMCR5, DSPCDP5, NULL, NULL);
+      ARMul_CoProAttach (state, 6, NULL, NULL, NULL, NULL,
+                        DSPMRC6, DSPMCR6, DSPCDP6, NULL, NULL);
+    }
+  else
+    {
+      ARMul_CoProAttach (state, 4, NULL, NULL, ValLDC, ValSTC,
+                        ValMRC, ValMCR, ValCDP, NULL, NULL);
+
+      ARMul_CoProAttach (state, 5, NULL, NULL, NULL, NULL,
+                        ValMRC, ValMCR, IntCDP, NULL, NULL);
+    }
+
+  if (state->is_XScale)
+    {
+      ARMul_CoProAttach (state, 13, XScale_cp13_init, NULL,
+                        XScale_cp13_LDC, XScale_cp13_STC, XScale_cp13_MRC,
+                        XScale_cp13_MCR, NULL, XScale_cp13_read_reg,
+                        XScale_cp13_write_reg);
+
+      ARMul_CoProAttach (state, 14, XScale_cp14_init, NULL,
+                        XScale_cp14_LDC, XScale_cp14_STC, XScale_cp14_MRC,
+                        XScale_cp14_MCR, NULL, XScale_cp14_read_reg,
+                        XScale_cp14_write_reg);
+
+      ARMul_CoProAttach (state, 15, XScale_cp15_init, NULL,
+                        NULL, NULL, XScale_cp15_MRC, XScale_cp15_MCR,
+                        NULL, XScale_cp15_read_reg, XScale_cp15_write_reg);
+    }
+  else
+    {
+      ARMul_CoProAttach (state, 15, MMUInit, NULL, NULL, NULL,
+                        MMUMRC, MMUMCR, NULL, MMURead, MMUWrite);
+    }
+
+  if (state->is_iWMMXt)
+    {
+      ARMul_CoProAttach (state, 0, NULL, NULL, IwmmxtLDC, IwmmxtSTC,
+                        NULL, NULL, IwmmxtCDP, NULL, NULL);
+
+      ARMul_CoProAttach (state, 1, NULL, NULL, NULL, NULL,
+                        IwmmxtMRC, IwmmxtMCR, IwmmxtCDP, NULL, NULL);
+    }
 
   /* No handlers below here.  */