miscregs.hh revision 8549
12SN/A/* 21762SN/A * Copyright (c) 2010 ARM Limited 32SN/A * All rights reserved 42SN/A * 52SN/A * The license below extends only to copyright in the software and shall 62SN/A * not be construed as granting a license to any other intellectual 72SN/A * property including but not limited to intellectual property relating 82SN/A * to a hardware implementation of the functionality of the software 92SN/A * licensed hereunder. You may use the software subject to the license 102SN/A * terms below provided that you ensure that this notice is replicated 112SN/A * unmodified and in its entirety in all distributions of the software, 122SN/A * modified or unmodified, in source code or in binary form. 132SN/A * 142SN/A * Copyright (c) 2009 The Regents of The University of Michigan 152SN/A * All rights reserved. 162SN/A * 172SN/A * Redistribution and use in source and binary forms, with or without 182SN/A * modification, are permitted provided that the following conditions are 192SN/A * met: redistributions of source code must retain the above copyright 202SN/A * notice, this list of conditions and the following disclaimer; 212SN/A * redistributions in binary form must reproduce the above copyright 222SN/A * notice, this list of conditions and the following disclaimer in the 232SN/A * documentation and/or other materials provided with the distribution; 242SN/A * neither the name of the copyright holders nor the names of its 252SN/A * contributors may be used to endorse or promote products derived from 262SN/A * this software without specific prior written permission. 272665Ssaidi@eecs.umich.edu * 282665Ssaidi@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 292665Ssaidi@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 302SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 312SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 322SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 332SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 342SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 351984SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36857SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 375952Ssaidi@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 381984SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 396214Snate@binkert.org * 4010905Sandreas.sandberg@arm.com * Authors: Gabe Black 412SN/A */ 422SN/A#ifndef __ARCH_ARM_MISCREGS_HH__ 432SN/A#define __ARCH_ARM_MISCREGS_HH__ 441912SN/A 452130SN/A#include "base/bitunion.hh" 46857SN/A 472SN/Anamespace ArmISA 481912SN/A{ 492SN/A enum ConditionCode { 502SN/A COND_EQ = 0, 512SN/A COND_NE, // 1 521912SN/A COND_CS, // 2 531912SN/A COND_CC, // 3 541912SN/A COND_MI, // 4 551912SN/A COND_PL, // 5 561912SN/A COND_VS, // 6 571912SN/A COND_VC, // 7 581912SN/A COND_HI, // 8 591912SN/A COND_LS, // 9 601912SN/A COND_GE, // 10 611912SN/A COND_LT, // 11 621912SN/A COND_GT, // 12 631912SN/A COND_LE, // 13 641912SN/A COND_AL, // 14 651912SN/A COND_UC // 15 662SN/A }; 672SN/A 682SN/A enum MiscRegIndex { 692SN/A MISCREG_CPSR = 0, 702SN/A MISCREG_CPSR_Q, 711984SN/A MISCREG_SPSR, 722SN/A MISCREG_SPSR_FIQ, 732SN/A MISCREG_SPSR_IRQ, 742SN/A MISCREG_SPSR_SVC, 751912SN/A MISCREG_SPSR_MON, 761912SN/A MISCREG_SPSR_UND, 771912SN/A MISCREG_SPSR_ABT, 781912SN/A MISCREG_FPSR, 7910905Sandreas.sandberg@arm.com MISCREG_FPSID, 8010905Sandreas.sandberg@arm.com MISCREG_FPSCR, 811984SN/A MISCREG_FPSCR_QC, // Cumulative saturation flag 821984SN/A MISCREG_FPSCR_EXC, // Cumulative FP exception flags 831912SN/A MISCREG_FPEXC, 841912SN/A MISCREG_MVFR0, 851912SN/A MISCREG_MVFR1, 861912SN/A MISCREG_SCTLR_RST, 871912SN/A MISCREG_SEV_MAILBOX, 881912SN/A 891912SN/A // CP15 registers 901912SN/A MISCREG_CP15_START, 911912SN/A MISCREG_SCTLR = MISCREG_CP15_START, 921912SN/A MISCREG_DCCISW, 931912SN/A MISCREG_DCCIMVAC, 941912SN/A MISCREG_DCCMVAC, 951912SN/A MISCREG_CONTEXTIDR, 961912SN/A MISCREG_TPIDRURW, 971912SN/A MISCREG_TPIDRURO, 981912SN/A MISCREG_TPIDRPRW, 991912SN/A MISCREG_CP15ISB, 1001912SN/A MISCREG_CP15DSB, 1011912SN/A MISCREG_CP15DMB, 1021912SN/A MISCREG_CPACR, 1031912SN/A MISCREG_CLIDR, 1041912SN/A MISCREG_CCSIDR, 1051158SN/A MISCREG_CSSELR, 1061158SN/A MISCREG_ICIALLUIS, 1072982Sstever@eecs.umich.edu MISCREG_ICIALLU, 1082982Sstever@eecs.umich.edu MISCREG_ICIMVAU, 1092982Sstever@eecs.umich.edu MISCREG_BPIMVA, 1102982Sstever@eecs.umich.edu MISCREG_BPIALLIS, 1112982Sstever@eecs.umich.edu MISCREG_BPIALL, 1121158SN/A MISCREG_MIDR, 1131912SN/A MISCREG_TTBR0, 1141912SN/A MISCREG_TTBR1, 1151912SN/A MISCREG_TLBTR, 1161912SN/A MISCREG_DACR, 1171912SN/A MISCREG_TLBIALLIS, 1181912SN/A MISCREG_TLBIMVAIS, 1191912SN/A MISCREG_TLBIASIDIS, 1201912SN/A MISCREG_TLBIMVAAIS, 1211912SN/A MISCREG_ITLBIALL, 1221912SN/A MISCREG_ITLBIMVA, 1231912SN/A MISCREG_ITLBIASID, 1241912SN/A MISCREG_DTLBIALL, 1251912SN/A MISCREG_DTLBIMVA, 1261912SN/A MISCREG_DTLBIASID, 1271158SN/A MISCREG_TLBIALL, 1281158SN/A MISCREG_TLBIMVA, 1292982Sstever@eecs.umich.edu MISCREG_TLBIASID, 1301912SN/A MISCREG_TLBIMVAA, 1311912SN/A MISCREG_DFSR, 1321158SN/A MISCREG_IFSR, 1331912SN/A MISCREG_DFAR, 1341912SN/A MISCREG_IFAR, 1351912SN/A MISCREG_MPIDR, 1361912SN/A MISCREG_PRRR, 1371912SN/A MISCREG_NMRR, 1381912SN/A MISCREG_TTBCR, 1391912SN/A MISCREG_ID_PFR0, 1401912SN/A MISCREG_CTR, 1411158SN/A MISCREG_SCR, 1421158SN/A MISCREG_SDER, 1431158SN/A MISCREG_PAR, 1441912SN/A MISCREG_V2PCWPR, 1451912SN/A MISCREG_V2PCWPW, 1461912SN/A MISCREG_V2PCWUR, 1471912SN/A MISCREG_V2PCWUW, 1481912SN/A MISCREG_V2POWPR, 1491912SN/A MISCREG_V2POWPW, 1501912SN/A MISCREG_V2POWUR, 1511912SN/A MISCREG_V2POWUW, 1521912SN/A MISCREG_ID_MMFR0, 1531912SN/A MISCREG_ID_MMFR2, 1541912SN/A MISCREG_ID_MMFR3, 1551912SN/A MISCREG_ACTLR, 1561912SN/A MISCREG_PMCR, 1571912SN/A MISCREG_PMCCNTR, 1581912SN/A MISCREG_PMCNTENSET, 1591912SN/A MISCREG_PMCNTENCLR, 1601912SN/A MISCREG_PMOVSR, 1611912SN/A MISCREG_PMSWINC, 1621912SN/A MISCREG_PMSELR, 1631912SN/A MISCREG_PMCEID0, 1641912SN/A MISCREG_PMCEID1, 1651912SN/A MISCREG_PMC_OTHER, 1661912SN/A MISCREG_PMXEVCNTR, 1671912SN/A MISCREG_PMUSERENR, 1682SN/A MISCREG_PMINTENSET, 1692SN/A MISCREG_PMINTENCLR, 1701158SN/A MISCREG_ID_ISAR0, 1711158SN/A MISCREG_ID_ISAR1, 1721158SN/A MISCREG_ID_ISAR2, 1731158SN/A MISCREG_ID_ISAR3, 1741158SN/A MISCREG_ID_ISAR4, 1751158SN/A MISCREG_ID_ISAR5, 1762SN/A MISCREG_CPSR_MODE, 177 MISCREG_LOCKFLAG, 178 MISCREG_LOCKADDR, 179 MISCREG_ID_PFR1, 180 MISCREG_L2CTLR, 181 MISCREG_CP15_UNIMP_START, 182 MISCREG_TCMTR = MISCREG_CP15_UNIMP_START, 183 MISCREG_ID_DFR0, 184 MISCREG_ID_AFR0, 185 MISCREG_ID_MMFR1, 186 MISCREG_AIDR, 187 MISCREG_ADFSR, 188 MISCREG_AIFSR, 189 MISCREG_DCIMVAC, 190 MISCREG_DCISW, 191 MISCREG_MCCSW, 192 MISCREG_DCCMVAU, 193 MISCREG_NSACR, 194 MISCREG_VBAR, 195 MISCREG_MVBAR, 196 MISCREG_ISR, 197 MISCREG_FCEIDR, 198 MISCREG_L2LATENCY, 199 200 201 MISCREG_CP15_END, 202 203 // Dummy indices 204 MISCREG_NOP = MISCREG_CP15_END, 205 MISCREG_RAZ, 206 207 NUM_MISCREGS 208 }; 209 210 MiscRegIndex decodeCP15Reg(unsigned crn, unsigned opc1, 211 unsigned crm, unsigned opc2); 212 213 const char * const miscRegName[NUM_MISCREGS] = { 214 "cpsr", "cpsr_q", "spsr", "spsr_fiq", "spsr_irq", "spsr_svc", 215 "spsr_mon", "spsr_und", "spsr_abt", 216 "fpsr", "fpsid", "fpscr", "fpscr_qc", "fpscr_exc", "fpexc", 217 "mvfr0", "mvfr1", 218 "sctlr_rst", "sev_mailbox", 219 "sctlr", "dccisw", "dccimvac", "dccmvac", 220 "contextidr", "tpidrurw", "tpidruro", "tpidrprw", 221 "cp15isb", "cp15dsb", "cp15dmb", "cpacr", 222 "clidr", "ccsidr", "csselr", 223 "icialluis", "iciallu", "icimvau", 224 "bpimva", "bpiallis", "bpiall", 225 "midr", "ttbr0", "ttbr1", "tlbtr", "dacr", 226 "tlbiallis", "tlbimvais", "tlbiasidis", "tlbimvaais", 227 "itlbiall", "itlbimva", "itlbiasid", 228 "dtlbiall", "dtlbimva", "dtlbiasid", 229 "tlbiall", "tlbimva", "tlbiasid", "tlbimvaa", 230 "dfsr", "ifsr", "dfar", "ifar", "mpidr", 231 "prrr", "nmrr", "ttbcr", "id_pfr0", "ctr", 232 "scr", "sder", "par", 233 "v2pcwpr", "v2pcwpw", "v2pcwur", "v2pcwuw", 234 "v2powpr", "v2powpw", "v2powur", "v2powuw", 235 "id_mmfr0", "id_mmfr2", "id_mmfr3", "actlr", "pmcr", "pmccntr", 236 "pmcntenset", "pmcntenclr", "pmovsr", 237 "pmswinc", "pmselr", "pmceid0", 238 "pmceid1", "pmc_other", "pmxevcntr", 239 "pmuserenr", "pmintenset", "pmintenclr", 240 "id_isar0", "id_isar1", "id_isar2", "id_isar3", "id_isar4", "id_isar5", 241 "cpsr_mode", "lockflag", "lockaddr", "id_pfr1", 242 "l2ctlr", 243 // Unimplemented below 244 "tcmtr", 245 "id_dfr0", "id_afr0", 246 "id_mmfr1", 247 "aidr", "adfsr", "aifsr", 248 "dcimvac", "dcisw", "mccsw", 249 "dccmvau", 250 "nsacr", 251 "vbar", "mvbar", "isr", "fceidr", "l2latency", 252 "nop", "raz" 253 }; 254 255 BitUnion32(CPSR) 256 Bitfield<31,30> nz; 257 Bitfield<29> c; 258 Bitfield<28> v; 259 Bitfield<27> q; 260 Bitfield<26,25> it1; 261 Bitfield<24> j; 262 Bitfield<19, 16> ge; 263 Bitfield<15,10> it2; 264 Bitfield<9> e; 265 Bitfield<8> a; 266 Bitfield<7> i; 267 Bitfield<6> f; 268 Bitfield<5> t; 269 Bitfield<4, 0> mode; 270 EndBitUnion(CPSR) 271 272 // This mask selects bits of the CPSR that actually go in the CondCodes 273 // integer register to allow renaming. 274 static const uint32_t CondCodesMask = 0xF00F0000; 275 static const uint32_t CpsrMaskQ = 0x08000000; 276 277 BitUnion32(SCTLR) 278 Bitfield<31> ie; // Instruction endianness 279 Bitfield<30> te; // Thumb Exception Enable 280 Bitfield<29> afe; // Access flag enable 281 Bitfield<28> tre; // TEX Remap bit 282 Bitfield<27> nmfi;// Non-maskable fast interrupts enable 283 Bitfield<25> ee; // Exception Endianness bit 284 Bitfield<24> ve; // Interrupt vectors enable 285 Bitfield<23> xp; // Extended page table enable bit 286 Bitfield<22> u; // Alignment (now unused) 287 Bitfield<21> fi; // Fast interrupts configuration enable 288 Bitfield<19> dz; // Divide by Zero fault enable bit 289 Bitfield<18> rao2;// Read as one 290 Bitfield<17> br; // Background region bit 291 Bitfield<16> rao3;// Read as one 292 Bitfield<14> rr; // Round robin cache replacement 293 Bitfield<13> v; // Base address for exception vectors 294 Bitfield<12> i; // instruction cache enable 295 Bitfield<11> z; // branch prediction enable bit 296 Bitfield<10> sw; // Enable swp/swpb 297 Bitfield<9,8> rs; // deprecated protection bits 298 Bitfield<6,3> rao4;// Read as one 299 Bitfield<7> b; // Endianness support (unused) 300 Bitfield<2> c; // Cache enable bit 301 Bitfield<1> a; // Alignment fault checking 302 Bitfield<0> m; // MMU enable bit 303 EndBitUnion(SCTLR) 304 305 BitUnion32(CPACR) 306 Bitfield<1, 0> cp0; 307 Bitfield<3, 2> cp1; 308 Bitfield<5, 4> cp2; 309 Bitfield<7, 6> cp3; 310 Bitfield<9, 8> cp4; 311 Bitfield<11, 10> cp5; 312 Bitfield<13, 12> cp6; 313 Bitfield<15, 14> cp7; 314 Bitfield<17, 16> cp8; 315 Bitfield<19, 18> cp9; 316 Bitfield<21, 20> cp10; 317 Bitfield<23, 22> cp11; 318 Bitfield<25, 24> cp12; 319 Bitfield<27, 26> cp13; 320 Bitfield<29, 28> rsvd; 321 Bitfield<30> d32dis; 322 Bitfield<31> asedis; 323 EndBitUnion(CPACR) 324 325 BitUnion32(FSR) 326 Bitfield<3, 0> fsLow; 327 Bitfield<7, 4> domain; 328 Bitfield<10> fsHigh; 329 Bitfield<11> wnr; 330 Bitfield<12> ext; 331 EndBitUnion(FSR) 332 333 BitUnion32(FPSCR) 334 Bitfield<0> ioc; 335 Bitfield<1> dzc; 336 Bitfield<2> ofc; 337 Bitfield<3> ufc; 338 Bitfield<4> ixc; 339 Bitfield<7> idc; 340 Bitfield<8> ioe; 341 Bitfield<9> dze; 342 Bitfield<10> ofe; 343 Bitfield<11> ufe; 344 Bitfield<12> ixe; 345 Bitfield<15> ide; 346 Bitfield<18, 16> len; 347 Bitfield<21, 20> stride; 348 Bitfield<23, 22> rMode; 349 Bitfield<24> fz; 350 Bitfield<25> dn; 351 Bitfield<26> ahp; 352 Bitfield<27> qc; 353 Bitfield<28> v; 354 Bitfield<29> c; 355 Bitfield<30> z; 356 Bitfield<31> n; 357 EndBitUnion(FPSCR) 358 359 // This mask selects bits of the FPSCR that actually go in the FpCondCodes 360 // integer register to allow renaming. 361 static const uint32_t FpCondCodesMask = 0xF0000000; 362 // This mask selects the cumulative FP exception flags of the FPSCR. 363 static const uint32_t FpscrExcMask = 0x0000009F; 364 // This mask selects the cumulative saturation flag of the FPSCR. 365 static const uint32_t FpscrQcMask = 0x08000000; 366 367 BitUnion32(FPEXC) 368 Bitfield<31> ex; 369 Bitfield<30> en; 370 Bitfield<29, 0> subArchDefined; 371 EndBitUnion(FPEXC) 372 373 BitUnion32(MVFR0) 374 Bitfield<3, 0> advSimdRegisters; 375 Bitfield<7, 4> singlePrecision; 376 Bitfield<11, 8> doublePrecision; 377 Bitfield<15, 12> vfpExceptionTrapping; 378 Bitfield<19, 16> divide; 379 Bitfield<23, 20> squareRoot; 380 Bitfield<27, 24> shortVectors; 381 Bitfield<31, 28> roundingModes; 382 EndBitUnion(MVFR0) 383 384 BitUnion32(MVFR1) 385 Bitfield<3, 0> flushToZero; 386 Bitfield<7, 4> defaultNaN; 387 Bitfield<11, 8> advSimdLoadStore; 388 Bitfield<15, 12> advSimdInteger; 389 Bitfield<19, 16> advSimdSinglePrecision; 390 Bitfield<23, 20> advSimdHalfPrecision; 391 Bitfield<27, 24> vfpHalfPrecision; 392 Bitfield<31, 28> raz; 393 EndBitUnion(MVFR1) 394 395 BitUnion32(PRRR) 396 Bitfield<1,0> tr0; 397 Bitfield<3,2> tr1; 398 Bitfield<5,4> tr2; 399 Bitfield<7,6> tr3; 400 Bitfield<9,8> tr4; 401 Bitfield<11,10> tr5; 402 Bitfield<13,12> tr6; 403 Bitfield<15,14> tr7; 404 Bitfield<16> ds0; 405 Bitfield<17> ds1; 406 Bitfield<18> ns0; 407 Bitfield<19> ns1; 408 Bitfield<24> nos0; 409 Bitfield<25> nos1; 410 Bitfield<26> nos2; 411 Bitfield<27> nos3; 412 Bitfield<28> nos4; 413 Bitfield<29> nos5; 414 Bitfield<30> nos6; 415 Bitfield<31> nos7; 416 EndBitUnion(PRRR) 417 418 BitUnion32(NMRR) 419 Bitfield<1,0> ir0; 420 Bitfield<3,2> ir1; 421 Bitfield<5,4> ir2; 422 Bitfield<7,6> ir3; 423 Bitfield<9,8> ir4; 424 Bitfield<11,10> ir5; 425 Bitfield<13,12> ir6; 426 Bitfield<15,14> ir7; 427 Bitfield<17,16> or0; 428 Bitfield<19,18> or1; 429 Bitfield<21,20> or2; 430 Bitfield<23,22> or3; 431 Bitfield<25,24> or4; 432 Bitfield<27,26> or5; 433 Bitfield<29,28> or6; 434 Bitfield<31,30> or7; 435 EndBitUnion(NMRR) 436 437 BitUnion32(L2CTLR) 438 Bitfield<2,0> sataRAMLatency; 439 Bitfield<4,3> reserved_4_3; 440 Bitfield<5> dataRAMSetup; 441 Bitfield<8,6> tagRAMLatency; 442 Bitfield<9> tagRAMSetup; 443 Bitfield<11,10> dataRAMSlice; 444 Bitfield<12> tagRAMSlice; 445 Bitfield<20,13> reserved_20_13; 446 Bitfield<21> eccandParityEnable; 447 Bitfield<22> reserved_22; 448 Bitfield<23> interptCtrlPresent; 449 Bitfield<25,24> numCPUs; 450 Bitfield<30,26> reserved_30_26; 451 Bitfield<31> l2rstDISABLE_monitor; 452 EndBitUnion(L2CTLR) 453 454}; 455 456#endif // __ARCH_ARM_MISCREGS_HH__ 457