diff options
Diffstat (limited to 'src/arch/arm/isa.hh')
-rw-r--r-- | src/arch/arm/isa.hh | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/src/arch/arm/isa.hh b/src/arch/arm/isa.hh index e96de7922..2241be725 100644 --- a/src/arch/arm/isa.hh +++ b/src/arch/arm/isa.hh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2012-2016 ARM Limited + * Copyright (c) 2010, 2012-2017 ARM Limited * All rights reserved * * The license below extends only to copyright in the software and shall @@ -91,20 +91,32 @@ namespace ArmISA /** Register translation entry used in lookUpMiscReg */ struct MiscRegLUTEntry { - uint32_t lower; - uint32_t upper; + uint32_t lower; // Lower half mapped to this register + uint32_t upper; // Upper half mapped to this register }; - struct MiscRegInitializerEntry { - uint32_t index; - struct MiscRegLUTEntry entry; + /** Metadata table accessible via the value of the register */ + std::vector<struct MiscRegLUTEntry> lookUpMiscReg; + + class MiscRegLUTEntryInitializer { + struct MiscRegLUTEntry &entry; + typedef const MiscRegLUTEntryInitializer& chain; + public: + chain mapsTo(uint32_t l, uint32_t u = 0) const { + entry.lower = l; + entry.upper = u; + return *this; + } + MiscRegLUTEntryInitializer(struct MiscRegLUTEntry &e) + : entry(e) + {} }; - /** Register table noting all translations */ - static const struct MiscRegInitializerEntry MiscRegSwitch[]; + const MiscRegLUTEntryInitializer InitReg(uint32_t reg) { + return MiscRegLUTEntryInitializer(lookUpMiscReg[reg]); + } - /** Translation table accessible via the value of the register */ - std::vector<struct MiscRegLUTEntry> lookUpMiscReg; + void initializeMiscRegMetadata(); MiscReg miscRegs[NumMiscRegs]; const IntRegIndex *intRegMap; |