ARM: Begin implementing CP15
authorAli Saidi <Ali.Saidi@ARM.com>
Wed, 18 Nov 2009 00:02:09 +0000 (18:02 -0600)
committerAli Saidi <Ali.Saidi@ARM.com>
Wed, 18 Nov 2009 00:02:09 +0000 (18:02 -0600)
src/arch/arm/insts/static_inst.cc
src/arch/arm/isa/bitfields.isa
src/arch/arm/isa/decoder.isa
src/arch/arm/types.hh
src/arch/arm/utility.cc
src/arch/arm/utility.hh

index 5181041d03f7b4b3eacd8611c0d9824143949f7b..bf7a38c58236c524dce4afdb7cbe54a25c46a256 100644 (file)
@@ -27,6 +27,7 @@
  * Authors: Stephen Hines
  */
 
+#include "arch/arm/faults.hh"
 #include "arch/arm/insts/static_inst.hh"
 #include "base/condcodes.hh"
 #include "base/cprintf.hh"
index bd4cfc3203073458e94d07072213033e5fa86643..8ff819983db304082bd1ff56e203cc9d47f3ac39 100644 (file)
@@ -49,6 +49,7 @@ def bitfield OPCODE_18           opcode18;
 def bitfield OPCODE_15_12  opcode15_12;
 def bitfield OPCODE_15    opcode15;
 def bitfield MISC_OPCODE   miscOpcode;
+def bitfield OPC2          opc2; 
 def bitfield OPCODE_7      opcode7;
 def bitfield OPCODE_4      opcode4;
 
index 5a6e8773a830daf63b3e016c27d34a715b86f4dc..ff20c61075fced568e6c670e2b83e8834a8718b2 100644 (file)
@@ -493,10 +493,53 @@ format DataOp {
                         }
                     } // MEDIA_OPCODE (MISC_OPCODE 0x1)
                 } // MISC_OPCODE (CPNUM 0xA)
-                0xf: decode OPCODE_20 {
-                    0: WarnUnimpl::mcr_cp15();
-                    1: WarnUnimpl::mrc_cp15();
-                }   
+                0xf: decode RN {
+                    // Barrriers, Cache Maintence, NOPS
+                    7: decode OPCODE_23_21 {
+                        0: decode RM {
+                            0: decode OPC2 {
+                                4: decode OPCODE_20 {
+                                    0: PredOp::mcr_cp15_nop1({{ }}); // was wfi
+                                }
+                            }
+                            1: WarnUnimpl::cp15_cache_maint();
+                            4: WarnUnimpl::cp15_par();
+                            5: decode OPC2 {
+                                0,1: WarnUnimpl::cp15_cache_maint2();
+                                4: PredOp::cp15_isb({{ ; }}, IsMemBarrier, IsSerializeBefore);
+                                6,7: WarnUnimpl::cp15_bp_maint();
+                            }
+                            6: WarnUnimpl::cp15_cache_maint3();
+                            8: WarnUnimpl::cp15_va_to_pa();
+                            10: decode OPC2 {
+                                1,2: WarnUnimpl::cp15_cache_maint3();
+                                4: PredOp::cp15_dsb({{ ; }}, IsMemBarrier, IsSerializeBefore);
+                                5: PredOp::cp15_dmb({{ ; }}, IsMemBarrier, IsSerializeBefore);
+                            }
+                            11: WarnUnimpl::cp15_cache_maint4();
+                            13: decode OPC2 {
+                                1: decode OPCODE_20 {
+                                    0: PredOp::mcr_cp15_nop2({{ }}); // was prefetch
+                                }
+                            }
+                            14: WarnUnimpl::cp15_cache_maint5();
+                        } // RM
+                    } // OPCODE_23_21 CR
+                            
+                    // Thread ID and context ID registers
+                    // Thread ID register needs cheaper access than miscreg
+                    13: WarnUnimpl::mcr_mrc_cp15_c7(); 
+
+                    // All the rest
+                    default: decode OPCODE_20 {
+                        0: PredOp::mcr_cp15({{ 
+                               fault = setCp15Register(Rd, RN, OPCODE_23_21, RM, OPC2); 
+                        }});
+                        1: PredOp::mrc_cp15({{ 
+                               fault = readCp15Register(Rd, RN, OPCODE_23_21, RM, OPC2); 
+                        }});
+                    }
+                }  // RN 
             } // CPNUM  (OP4 == 1)
         } //OPCODE_4
 
index 07fa33ea1775bdcd9d09935fdb47c639707df901..e0b3951b993bd8c2e4ac5e96ecd82849f07e461d 100644 (file)
@@ -58,6 +58,7 @@ namespace ArmISA
         Bitfield<15, 12> opcode15_12;
         Bitfield<15>     opcode15;
         Bitfield<7,  4>  miscOpcode;
+        Bitfield<7,5>    opc2;
         Bitfield<7>      opcode7;
         Bitfield<4>      opcode4;
 
index afff97d3163684b7fc5a5985b81dae334d6e83a1..5ce32542bc83926a77a82306a1e43ec912b4bb01 100644 (file)
@@ -57,4 +57,20 @@ uint64_t getArgument(ThreadContext *tc, int number, bool fp) {
 #endif
 }
 
+Fault 
+setCp15Register(uint32_t &Rd, int CRn, int opc1, int CRm, int opc2)
+{
+   return new UnimpFault(csprintf("MCR CP15: CRn: %d opc1: %d CRm: %d opc1: %d\n", 
+               CRn, opc1, CRm, opc2));     
+}
+
+Fault 
+readCp15Register(uint32_t &Rd, int CRn, int opc1, int CRm, int opc2)
+{
+   return new UnimpFault(csprintf("MRC CP15: CRn: %d opc1: %d CRm: %d opc1: %d\n", 
+           CRn, opc1, CRm, opc2));
+
+}
+
+
 }
index 43e7b14ab04faa175b390d322230ce63113d8bc5..3ddfd12dd900b501cc700d95dc32b19419dc1d56 100644 (file)
@@ -135,6 +135,9 @@ namespace ArmISA {
     }
 
 uint64_t getArgument(ThreadContext *tc, int number, bool fp);
+    
+Fault setCp15Register(uint32_t &Rd, int CRn, int opc1, int CRm, int opc2);
+Fault readCp15Register(uint32_t &Rd, int CRn, int opc1, int CRm, int opc2);
 
 };