isa.hh revision 13581
16313Sgblack@eecs.umich.edu/*
212529Sgiacomo.travaglini@arm.com * Copyright (c) 2010, 2012-2018 ARM Limited
37093Sgblack@eecs.umich.edu * All rights reserved
47093Sgblack@eecs.umich.edu *
57093Sgblack@eecs.umich.edu * The license below extends only to copyright in the software and shall
67093Sgblack@eecs.umich.edu * not be construed as granting a license to any other intellectual
77093Sgblack@eecs.umich.edu * property including but not limited to intellectual property relating
87093Sgblack@eecs.umich.edu * to a hardware implementation of the functionality of the software
97093Sgblack@eecs.umich.edu * licensed hereunder.  You may use the software subject to the license
107093Sgblack@eecs.umich.edu * terms below provided that you ensure that this notice is replicated
117093Sgblack@eecs.umich.edu * unmodified and in its entirety in all distributions of the software,
127093Sgblack@eecs.umich.edu * modified or unmodified, in source code or in binary form.
137093Sgblack@eecs.umich.edu *
146313Sgblack@eecs.umich.edu * Copyright (c) 2009 The Regents of The University of Michigan
156313Sgblack@eecs.umich.edu * All rights reserved.
166313Sgblack@eecs.umich.edu *
176313Sgblack@eecs.umich.edu * Redistribution and use in source and binary forms, with or without
186313Sgblack@eecs.umich.edu * modification, are permitted provided that the following conditions are
196313Sgblack@eecs.umich.edu * met: redistributions of source code must retain the above copyright
206313Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer;
216313Sgblack@eecs.umich.edu * redistributions in binary form must reproduce the above copyright
226313Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the
236313Sgblack@eecs.umich.edu * documentation and/or other materials provided with the distribution;
246313Sgblack@eecs.umich.edu * neither the name of the copyright holders nor the names of its
256313Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from
266313Sgblack@eecs.umich.edu * this software without specific prior written permission.
276313Sgblack@eecs.umich.edu *
286313Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
296313Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
306313Sgblack@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
316313Sgblack@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
326313Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
336313Sgblack@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
346313Sgblack@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
356313Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
366313Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
376313Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
386313Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
396313Sgblack@eecs.umich.edu *
406313Sgblack@eecs.umich.edu * Authors: Gabe Black
416313Sgblack@eecs.umich.edu */
426313Sgblack@eecs.umich.edu
436313Sgblack@eecs.umich.edu#ifndef __ARCH_ARM_ISA_HH__
447404SAli.Saidi@ARM.com#define __ARCH_ARM_ISA_HH__
456313Sgblack@eecs.umich.edu
4610461SAndreas.Sandberg@ARM.com#include "arch/arm/isa_device.hh"
4712479SCurtis.Dunham@arm.com#include "arch/arm/miscregs.hh"
486333Sgblack@eecs.umich.edu#include "arch/arm/registers.hh"
4910037SARM gem5 Developers#include "arch/arm/system.hh"
507404SAli.Saidi@ARM.com#include "arch/arm/tlb.hh"
516313Sgblack@eecs.umich.edu#include "arch/arm/types.hh"
5212109SRekai.GonzalezAlberquilla@arm.com#include "arch/generic/traits.hh"
538232Snate@binkert.org#include "debug/Checkpoint.hh"
5412109SRekai.GonzalezAlberquilla@arm.com#include "enums/VecRegRenameMode.hh"
559384SAndreas.Sandberg@arm.com#include "sim/sim_object.hh"
5611165SRekai.GonzalezAlberquilla@arm.com#include "enums/DecoderFlavour.hh"
576313Sgblack@eecs.umich.edu
589384SAndreas.Sandberg@arm.comstruct ArmISAParams;
5910461SAndreas.Sandberg@ARM.comstruct DummyArmISADeviceParams;
606333Sgblack@eecs.umich.educlass ThreadContext;
616313Sgblack@eecs.umich.educlass Checkpoint;
626313Sgblack@eecs.umich.educlass EventManager;
636313Sgblack@eecs.umich.edu
646313Sgblack@eecs.umich.edunamespace ArmISA
656313Sgblack@eecs.umich.edu{
669384SAndreas.Sandberg@arm.com    class ISA : public SimObject
676313Sgblack@eecs.umich.edu    {
686313Sgblack@eecs.umich.edu      protected:
6910037SARM gem5 Developers        // Parent system
7010037SARM gem5 Developers        ArmSystem *system;
7110037SARM gem5 Developers
7211165SRekai.GonzalezAlberquilla@arm.com        // Micro Architecture
7311165SRekai.GonzalezAlberquilla@arm.com        const Enums::DecoderFlavour _decoderFlavour;
7412109SRekai.GonzalezAlberquilla@arm.com        const Enums::VecRegRenameMode _vecRegRenameMode;
7511165SRekai.GonzalezAlberquilla@arm.com
7610461SAndreas.Sandberg@ARM.com        /** Dummy device for to handle non-existing ISA devices */
7710461SAndreas.Sandberg@ARM.com        DummyISADevice dummyDevice;
7810461SAndreas.Sandberg@ARM.com
7910461SAndreas.Sandberg@ARM.com        // PMU belonging to this ISA
8010461SAndreas.Sandberg@ARM.com        BaseISADevice *pmu;
8110461SAndreas.Sandberg@ARM.com
8210844Sandreas.sandberg@arm.com        // Generic timer interface belonging to this ISA
8310844Sandreas.sandberg@arm.com        std::unique_ptr<BaseISADevice> timer;
8410844Sandreas.sandberg@arm.com
8513531Sjairo.balart@metempsy.com        // GICv3 CPU interface belonging to this ISA
8613531Sjairo.balart@metempsy.com        std::unique_ptr<BaseISADevice> gicv3CpuInterface;
8713531Sjairo.balart@metempsy.com
8810037SARM gem5 Developers        // Cached copies of system-level properties
8911771SCurtis.Dunham@arm.com        bool highestELIs64;
9010037SARM gem5 Developers        bool haveSecurity;
9110037SARM gem5 Developers        bool haveLPAE;
9210037SARM gem5 Developers        bool haveVirtualization;
9313173Sgiacomo.travaglini@arm.com        bool haveCrypto;
9410037SARM gem5 Developers        bool haveLargeAsid64;
9513531Sjairo.balart@metempsy.com        bool haveGICv3CPUInterface;
9613114Sgiacomo.travaglini@arm.com        uint8_t physAddrRange;
9710037SARM gem5 Developers
9812714Sgiacomo.travaglini@arm.com        /**
9912714Sgiacomo.travaglini@arm.com         * If true, accesses to IMPLEMENTATION DEFINED registers are treated
10012714Sgiacomo.travaglini@arm.com         * as NOP hence not causing UNDEFINED INSTRUCTION.
10112714Sgiacomo.travaglini@arm.com         */
10212714Sgiacomo.travaglini@arm.com        bool impdefAsNop;
10312714Sgiacomo.travaglini@arm.com
10412478SCurtis.Dunham@arm.com        /** MiscReg metadata **/
10510037SARM gem5 Developers        struct MiscRegLUTEntry {
10612477SCurtis.Dunham@arm.com            uint32_t lower;  // Lower half mapped to this register
10712477SCurtis.Dunham@arm.com            uint32_t upper;  // Upper half mapped to this register
10812478SCurtis.Dunham@arm.com            uint64_t _reset; // value taken on reset (i.e. initialization)
10912478SCurtis.Dunham@arm.com            uint64_t _res0;  // reserved
11012478SCurtis.Dunham@arm.com            uint64_t _res1;  // reserved
11112478SCurtis.Dunham@arm.com            uint64_t _raz;   // read as zero (fixed at 0)
11212478SCurtis.Dunham@arm.com            uint64_t _rao;   // read as one (fixed at 1)
11312478SCurtis.Dunham@arm.com          public:
11412478SCurtis.Dunham@arm.com            MiscRegLUTEntry() :
11512478SCurtis.Dunham@arm.com              lower(0), upper(0),
11612478SCurtis.Dunham@arm.com              _reset(0), _res0(0), _res1(0), _raz(0), _rao(0) {}
11712478SCurtis.Dunham@arm.com            uint64_t reset() const { return _reset; }
11812478SCurtis.Dunham@arm.com            uint64_t res0()  const { return _res0; }
11912478SCurtis.Dunham@arm.com            uint64_t res1()  const { return _res1; }
12012478SCurtis.Dunham@arm.com            uint64_t raz()   const { return _raz; }
12112478SCurtis.Dunham@arm.com            uint64_t rao()   const { return _rao; }
12212478SCurtis.Dunham@arm.com            // raz/rao implies writes ignored
12312478SCurtis.Dunham@arm.com            uint64_t wi()    const { return _raz | _rao; }
12410037SARM gem5 Developers        };
12510037SARM gem5 Developers
12612477SCurtis.Dunham@arm.com        /** Metadata table accessible via the value of the register */
12712479SCurtis.Dunham@arm.com        static std::vector<struct MiscRegLUTEntry> lookUpMiscReg;
12812477SCurtis.Dunham@arm.com
12912477SCurtis.Dunham@arm.com        class MiscRegLUTEntryInitializer {
13012477SCurtis.Dunham@arm.com            struct MiscRegLUTEntry &entry;
13112479SCurtis.Dunham@arm.com            std::bitset<NUM_MISCREG_INFOS> &info;
13212477SCurtis.Dunham@arm.com            typedef const MiscRegLUTEntryInitializer& chain;
13312477SCurtis.Dunham@arm.com          public:
13412477SCurtis.Dunham@arm.com            chain mapsTo(uint32_t l, uint32_t u = 0) const {
13512477SCurtis.Dunham@arm.com                entry.lower = l;
13612477SCurtis.Dunham@arm.com                entry.upper = u;
13712477SCurtis.Dunham@arm.com                return *this;
13812477SCurtis.Dunham@arm.com            }
13912478SCurtis.Dunham@arm.com            chain res0(uint64_t mask) const {
14012478SCurtis.Dunham@arm.com                entry._res0 = mask;
14112478SCurtis.Dunham@arm.com                return *this;
14212478SCurtis.Dunham@arm.com            }
14312478SCurtis.Dunham@arm.com            chain res1(uint64_t mask) const {
14412478SCurtis.Dunham@arm.com                entry._res1 = mask;
14512478SCurtis.Dunham@arm.com                return *this;
14612478SCurtis.Dunham@arm.com            }
14712478SCurtis.Dunham@arm.com            chain raz(uint64_t mask) const {
14812478SCurtis.Dunham@arm.com                entry._raz  = mask;
14912478SCurtis.Dunham@arm.com                return *this;
15012478SCurtis.Dunham@arm.com            }
15112478SCurtis.Dunham@arm.com            chain rao(uint64_t mask) const {
15212478SCurtis.Dunham@arm.com                entry._rao  = mask;
15312478SCurtis.Dunham@arm.com                return *this;
15412478SCurtis.Dunham@arm.com            }
15512479SCurtis.Dunham@arm.com            chain implemented(bool v = true) const {
15612479SCurtis.Dunham@arm.com                info[MISCREG_IMPLEMENTED] = v;
15712479SCurtis.Dunham@arm.com                return *this;
15812479SCurtis.Dunham@arm.com            }
15912479SCurtis.Dunham@arm.com            chain unimplemented() const {
16012479SCurtis.Dunham@arm.com                return implemented(false);
16112479SCurtis.Dunham@arm.com            }
16212479SCurtis.Dunham@arm.com            chain unverifiable(bool v = true) const {
16312479SCurtis.Dunham@arm.com                info[MISCREG_UNVERIFIABLE] = v;
16412479SCurtis.Dunham@arm.com                return *this;
16512479SCurtis.Dunham@arm.com            }
16612479SCurtis.Dunham@arm.com            chain warnNotFail(bool v = true) const {
16712479SCurtis.Dunham@arm.com                info[MISCREG_WARN_NOT_FAIL] = v;
16812479SCurtis.Dunham@arm.com                return *this;
16912479SCurtis.Dunham@arm.com            }
17012479SCurtis.Dunham@arm.com            chain mutex(bool v = true) const {
17112479SCurtis.Dunham@arm.com                info[MISCREG_MUTEX] = v;
17212479SCurtis.Dunham@arm.com                return *this;
17312479SCurtis.Dunham@arm.com            }
17412479SCurtis.Dunham@arm.com            chain banked(bool v = true) const {
17512479SCurtis.Dunham@arm.com                info[MISCREG_BANKED] = v;
17612479SCurtis.Dunham@arm.com                return *this;
17712479SCurtis.Dunham@arm.com            }
17812479SCurtis.Dunham@arm.com            chain bankedChild(bool v = true) const {
17912479SCurtis.Dunham@arm.com                info[MISCREG_BANKED_CHILD] = v;
18012479SCurtis.Dunham@arm.com                return *this;
18112479SCurtis.Dunham@arm.com            }
18212479SCurtis.Dunham@arm.com            chain userNonSecureRead(bool v = true) const {
18312479SCurtis.Dunham@arm.com                info[MISCREG_USR_NS_RD] = v;
18412479SCurtis.Dunham@arm.com                return *this;
18512479SCurtis.Dunham@arm.com            }
18612479SCurtis.Dunham@arm.com            chain userNonSecureWrite(bool v = true) const {
18712479SCurtis.Dunham@arm.com                info[MISCREG_USR_NS_WR] = v;
18812479SCurtis.Dunham@arm.com                return *this;
18912479SCurtis.Dunham@arm.com            }
19012479SCurtis.Dunham@arm.com            chain userSecureRead(bool v = true) const {
19112479SCurtis.Dunham@arm.com                info[MISCREG_USR_S_RD] = v;
19212479SCurtis.Dunham@arm.com                return *this;
19312479SCurtis.Dunham@arm.com            }
19412479SCurtis.Dunham@arm.com            chain userSecureWrite(bool v = true) const {
19512479SCurtis.Dunham@arm.com                info[MISCREG_USR_S_WR] = v;
19612479SCurtis.Dunham@arm.com                return *this;
19712479SCurtis.Dunham@arm.com            }
19812479SCurtis.Dunham@arm.com            chain user(bool v = true) const {
19912479SCurtis.Dunham@arm.com                userNonSecureRead(v);
20012479SCurtis.Dunham@arm.com                userNonSecureWrite(v);
20112479SCurtis.Dunham@arm.com                userSecureRead(v);
20212479SCurtis.Dunham@arm.com                userSecureWrite(v);
20312479SCurtis.Dunham@arm.com                return *this;
20412479SCurtis.Dunham@arm.com            }
20512479SCurtis.Dunham@arm.com            chain privNonSecureRead(bool v = true) const {
20612479SCurtis.Dunham@arm.com                info[MISCREG_PRI_NS_RD] = v;
20712479SCurtis.Dunham@arm.com                return *this;
20812479SCurtis.Dunham@arm.com            }
20912479SCurtis.Dunham@arm.com            chain privNonSecureWrite(bool v = true) const {
21012479SCurtis.Dunham@arm.com                info[MISCREG_PRI_NS_WR] = v;
21112479SCurtis.Dunham@arm.com                return *this;
21212479SCurtis.Dunham@arm.com            }
21312668Sgiacomo.travaglini@arm.com            chain privNonSecure(bool v = true) const {
21412668Sgiacomo.travaglini@arm.com                privNonSecureRead(v);
21512668Sgiacomo.travaglini@arm.com                privNonSecureWrite(v);
21612668Sgiacomo.travaglini@arm.com                return *this;
21712668Sgiacomo.travaglini@arm.com            }
21812479SCurtis.Dunham@arm.com            chain privSecureRead(bool v = true) const {
21912479SCurtis.Dunham@arm.com                info[MISCREG_PRI_S_RD] = v;
22012479SCurtis.Dunham@arm.com                return *this;
22112479SCurtis.Dunham@arm.com            }
22212479SCurtis.Dunham@arm.com            chain privSecureWrite(bool v = true) const {
22312479SCurtis.Dunham@arm.com                info[MISCREG_PRI_S_WR] = v;
22412479SCurtis.Dunham@arm.com                return *this;
22512479SCurtis.Dunham@arm.com            }
22612479SCurtis.Dunham@arm.com            chain privSecure(bool v = true) const {
22712479SCurtis.Dunham@arm.com                privSecureRead(v);
22812479SCurtis.Dunham@arm.com                privSecureWrite(v);
22912479SCurtis.Dunham@arm.com                return *this;
23012479SCurtis.Dunham@arm.com            }
23112668Sgiacomo.travaglini@arm.com            chain priv(bool v = true) const {
23212668Sgiacomo.travaglini@arm.com                privSecure(v);
23312668Sgiacomo.travaglini@arm.com                privNonSecure(v);
23412668Sgiacomo.travaglini@arm.com                return *this;
23512668Sgiacomo.travaglini@arm.com            }
23613395Sgiacomo.travaglini@arm.com            chain privRead(bool v = true) const {
23713395Sgiacomo.travaglini@arm.com                privSecureRead(v);
23813395Sgiacomo.travaglini@arm.com                privNonSecureRead(v);
23913395Sgiacomo.travaglini@arm.com                return *this;
24013395Sgiacomo.travaglini@arm.com            }
24112479SCurtis.Dunham@arm.com            chain hypRead(bool v = true) const {
24212479SCurtis.Dunham@arm.com                info[MISCREG_HYP_RD] = v;
24312479SCurtis.Dunham@arm.com                return *this;
24412479SCurtis.Dunham@arm.com            }
24512479SCurtis.Dunham@arm.com            chain hypWrite(bool v = true) const {
24612479SCurtis.Dunham@arm.com                info[MISCREG_HYP_WR] = v;
24712479SCurtis.Dunham@arm.com                return *this;
24812479SCurtis.Dunham@arm.com            }
24912479SCurtis.Dunham@arm.com            chain hyp(bool v = true) const {
25012479SCurtis.Dunham@arm.com                hypRead(v);
25112479SCurtis.Dunham@arm.com                hypWrite(v);
25212479SCurtis.Dunham@arm.com                return *this;
25312479SCurtis.Dunham@arm.com            }
25412479SCurtis.Dunham@arm.com            chain monSecureRead(bool v = true) const {
25512479SCurtis.Dunham@arm.com                info[MISCREG_MON_NS0_RD] = v;
25612479SCurtis.Dunham@arm.com                return *this;
25712479SCurtis.Dunham@arm.com            }
25812479SCurtis.Dunham@arm.com            chain monSecureWrite(bool v = true) const {
25912479SCurtis.Dunham@arm.com                info[MISCREG_MON_NS0_WR] = v;
26012479SCurtis.Dunham@arm.com                return *this;
26112479SCurtis.Dunham@arm.com            }
26212479SCurtis.Dunham@arm.com            chain monNonSecureRead(bool v = true) const {
26312479SCurtis.Dunham@arm.com                info[MISCREG_MON_NS1_RD] = v;
26412479SCurtis.Dunham@arm.com                return *this;
26512479SCurtis.Dunham@arm.com            }
26612479SCurtis.Dunham@arm.com            chain monNonSecureWrite(bool v = true) const {
26712479SCurtis.Dunham@arm.com                info[MISCREG_MON_NS1_WR] = v;
26812479SCurtis.Dunham@arm.com                return *this;
26912479SCurtis.Dunham@arm.com            }
27012479SCurtis.Dunham@arm.com            chain mon(bool v = true) const {
27112479SCurtis.Dunham@arm.com                monSecureRead(v);
27212479SCurtis.Dunham@arm.com                monSecureWrite(v);
27312479SCurtis.Dunham@arm.com                monNonSecureRead(v);
27412479SCurtis.Dunham@arm.com                monNonSecureWrite(v);
27512479SCurtis.Dunham@arm.com                return *this;
27612479SCurtis.Dunham@arm.com            }
27712479SCurtis.Dunham@arm.com            chain monSecure(bool v = true) const {
27812479SCurtis.Dunham@arm.com                monSecureRead(v);
27912479SCurtis.Dunham@arm.com                monSecureWrite(v);
28012479SCurtis.Dunham@arm.com                return *this;
28112479SCurtis.Dunham@arm.com            }
28212479SCurtis.Dunham@arm.com            chain monNonSecure(bool v = true) const {
28312479SCurtis.Dunham@arm.com                monNonSecureRead(v);
28412479SCurtis.Dunham@arm.com                monNonSecureWrite(v);
28512479SCurtis.Dunham@arm.com                return *this;
28612479SCurtis.Dunham@arm.com            }
28712479SCurtis.Dunham@arm.com            chain allPrivileges(bool v = true) const {
28812479SCurtis.Dunham@arm.com                userNonSecureRead(v);
28912479SCurtis.Dunham@arm.com                userNonSecureWrite(v);
29012479SCurtis.Dunham@arm.com                userSecureRead(v);
29112479SCurtis.Dunham@arm.com                userSecureWrite(v);
29212479SCurtis.Dunham@arm.com                privNonSecureRead(v);
29312479SCurtis.Dunham@arm.com                privNonSecureWrite(v);
29412479SCurtis.Dunham@arm.com                privSecureRead(v);
29512479SCurtis.Dunham@arm.com                privSecureWrite(v);
29612479SCurtis.Dunham@arm.com                hypRead(v);
29712479SCurtis.Dunham@arm.com                hypWrite(v);
29812479SCurtis.Dunham@arm.com                monSecureRead(v);
29912479SCurtis.Dunham@arm.com                monSecureWrite(v);
30012479SCurtis.Dunham@arm.com                monNonSecureRead(v);
30112479SCurtis.Dunham@arm.com                monNonSecureWrite(v);
30212479SCurtis.Dunham@arm.com                return *this;
30312479SCurtis.Dunham@arm.com            }
30412479SCurtis.Dunham@arm.com            chain nonSecure(bool v = true) const {
30512479SCurtis.Dunham@arm.com                userNonSecureRead(v);
30612479SCurtis.Dunham@arm.com                userNonSecureWrite(v);
30712479SCurtis.Dunham@arm.com                privNonSecureRead(v);
30812479SCurtis.Dunham@arm.com                privNonSecureWrite(v);
30912479SCurtis.Dunham@arm.com                hypRead(v);
31012479SCurtis.Dunham@arm.com                hypWrite(v);
31112479SCurtis.Dunham@arm.com                monNonSecureRead(v);
31212479SCurtis.Dunham@arm.com                monNonSecureWrite(v);
31312479SCurtis.Dunham@arm.com                return *this;
31412479SCurtis.Dunham@arm.com            }
31512479SCurtis.Dunham@arm.com            chain secure(bool v = true) const {
31612479SCurtis.Dunham@arm.com                userSecureRead(v);
31712479SCurtis.Dunham@arm.com                userSecureWrite(v);
31812479SCurtis.Dunham@arm.com                privSecureRead(v);
31912479SCurtis.Dunham@arm.com                privSecureWrite(v);
32012479SCurtis.Dunham@arm.com                monSecureRead(v);
32112479SCurtis.Dunham@arm.com                monSecureWrite(v);
32212479SCurtis.Dunham@arm.com                return *this;
32312479SCurtis.Dunham@arm.com            }
32412479SCurtis.Dunham@arm.com            chain reads(bool v) const {
32512479SCurtis.Dunham@arm.com                userNonSecureRead(v);
32612479SCurtis.Dunham@arm.com                userSecureRead(v);
32712479SCurtis.Dunham@arm.com                privNonSecureRead(v);
32812479SCurtis.Dunham@arm.com                privSecureRead(v);
32912479SCurtis.Dunham@arm.com                hypRead(v);
33012479SCurtis.Dunham@arm.com                monSecureRead(v);
33112479SCurtis.Dunham@arm.com                monNonSecureRead(v);
33212479SCurtis.Dunham@arm.com                return *this;
33312479SCurtis.Dunham@arm.com            }
33412479SCurtis.Dunham@arm.com            chain writes(bool v) const {
33512479SCurtis.Dunham@arm.com                userNonSecureWrite(v);
33612479SCurtis.Dunham@arm.com                userSecureWrite(v);
33712479SCurtis.Dunham@arm.com                privNonSecureWrite(v);
33812479SCurtis.Dunham@arm.com                privSecureWrite(v);
33912479SCurtis.Dunham@arm.com                hypWrite(v);
34012479SCurtis.Dunham@arm.com                monSecureWrite(v);
34112479SCurtis.Dunham@arm.com                monNonSecureWrite(v);
34212479SCurtis.Dunham@arm.com                return *this;
34312479SCurtis.Dunham@arm.com            }
34412479SCurtis.Dunham@arm.com            chain exceptUserMode() const {
34512479SCurtis.Dunham@arm.com                user(0);
34612479SCurtis.Dunham@arm.com                return *this;
34712479SCurtis.Dunham@arm.com            }
34812479SCurtis.Dunham@arm.com            MiscRegLUTEntryInitializer(struct MiscRegLUTEntry &e,
34912479SCurtis.Dunham@arm.com                                       std::bitset<NUM_MISCREG_INFOS> &i)
35012479SCurtis.Dunham@arm.com              : entry(e),
35112479SCurtis.Dunham@arm.com                info(i)
35212479SCurtis.Dunham@arm.com            {
35312479SCurtis.Dunham@arm.com                // force unimplemented registers to be thusly declared
35412479SCurtis.Dunham@arm.com                implemented(1);
35512479SCurtis.Dunham@arm.com            }
35610037SARM gem5 Developers        };
35710037SARM gem5 Developers
35812477SCurtis.Dunham@arm.com        const MiscRegLUTEntryInitializer InitReg(uint32_t reg) {
35912479SCurtis.Dunham@arm.com            return MiscRegLUTEntryInitializer(lookUpMiscReg[reg],
36012479SCurtis.Dunham@arm.com                                              miscRegInfo[reg]);
36112477SCurtis.Dunham@arm.com        }
36210037SARM gem5 Developers
36312477SCurtis.Dunham@arm.com        void initializeMiscRegMetadata();
36410037SARM gem5 Developers
36513581Sgabeblack@google.com        RegVal miscRegs[NumMiscRegs];
3666718Sgblack@eecs.umich.edu        const IntRegIndex *intRegMap;
3676718Sgblack@eecs.umich.edu
3686718Sgblack@eecs.umich.edu        void
3696718Sgblack@eecs.umich.edu        updateRegMap(CPSR cpsr)
3706718Sgblack@eecs.umich.edu        {
37110037SARM gem5 Developers            if (cpsr.width == 0) {
37210037SARM gem5 Developers                intRegMap = IntReg64Map;
37310037SARM gem5 Developers            } else {
37410037SARM gem5 Developers                switch (cpsr.mode) {
37510037SARM gem5 Developers                  case MODE_USER:
37610037SARM gem5 Developers                  case MODE_SYSTEM:
37710037SARM gem5 Developers                    intRegMap = IntRegUsrMap;
37810037SARM gem5 Developers                    break;
37910037SARM gem5 Developers                  case MODE_FIQ:
38010037SARM gem5 Developers                    intRegMap = IntRegFiqMap;
38110037SARM gem5 Developers                    break;
38210037SARM gem5 Developers                  case MODE_IRQ:
38310037SARM gem5 Developers                    intRegMap = IntRegIrqMap;
38410037SARM gem5 Developers                    break;
38510037SARM gem5 Developers                  case MODE_SVC:
38610037SARM gem5 Developers                    intRegMap = IntRegSvcMap;
38710037SARM gem5 Developers                    break;
38810037SARM gem5 Developers                  case MODE_MON:
38910037SARM gem5 Developers                    intRegMap = IntRegMonMap;
39010037SARM gem5 Developers                    break;
39110037SARM gem5 Developers                  case MODE_ABORT:
39210037SARM gem5 Developers                    intRegMap = IntRegAbtMap;
39310037SARM gem5 Developers                    break;
39410037SARM gem5 Developers                  case MODE_HYP:
39510037SARM gem5 Developers                    intRegMap = IntRegHypMap;
39610037SARM gem5 Developers                    break;
39710037SARM gem5 Developers                  case MODE_UNDEFINED:
39810037SARM gem5 Developers                    intRegMap = IntRegUndMap;
39910037SARM gem5 Developers                    break;
40010037SARM gem5 Developers                  default:
40110037SARM gem5 Developers                    panic("Unrecognized mode setting in CPSR.\n");
40210037SARM gem5 Developers                }
4036718Sgblack@eecs.umich.edu            }
4046718Sgblack@eecs.umich.edu        }
4056313Sgblack@eecs.umich.edu
40610844Sandreas.sandberg@arm.com        BaseISADevice &getGenericTimer(ThreadContext *tc);
40713531Sjairo.balart@metempsy.com        BaseISADevice &getGICv3CPUInterface(ThreadContext *tc);
40810037SARM gem5 Developers
40910037SARM gem5 Developers
41010037SARM gem5 Developers      private:
41110037SARM gem5 Developers        inline void assert32(ThreadContext *tc) {
41210037SARM gem5 Developers            CPSR cpsr M5_VAR_USED = readMiscReg(MISCREG_CPSR, tc);
41310037SARM gem5 Developers            assert(cpsr.width);
41410037SARM gem5 Developers        }
41510037SARM gem5 Developers
41610037SARM gem5 Developers        inline void assert64(ThreadContext *tc) {
41710037SARM gem5 Developers            CPSR cpsr M5_VAR_USED = readMiscReg(MISCREG_CPSR, tc);
41810037SARM gem5 Developers            assert(!cpsr.width);
41910037SARM gem5 Developers        }
42010037SARM gem5 Developers
4216313Sgblack@eecs.umich.edu      public:
4227427Sgblack@eecs.umich.edu        void clear();
42313114Sgiacomo.travaglini@arm.com
42413114Sgiacomo.travaglini@arm.com      protected:
42513393Sgiacomo.travaglini@arm.com        void clear32(const ArmISAParams *p, const SCTLR &sctlr_rst);
42610037SARM gem5 Developers        void clear64(const ArmISAParams *p);
42713114Sgiacomo.travaglini@arm.com        void initID32(const ArmISAParams *p);
42813114Sgiacomo.travaglini@arm.com        void initID64(const ArmISAParams *p);
4296313Sgblack@eecs.umich.edu
43013114Sgiacomo.travaglini@arm.com      public:
43113581Sgabeblack@google.com        RegVal readMiscRegNoEffect(int misc_reg) const;
43213581Sgabeblack@google.com        RegVal readMiscReg(int misc_reg, ThreadContext *tc);
43313581Sgabeblack@google.com        void setMiscRegNoEffect(int misc_reg, const RegVal &val);
43413581Sgabeblack@google.com        void setMiscReg(int misc_reg, const RegVal &val, ThreadContext *tc);
4356313Sgblack@eecs.umich.edu
43612106SRekai.GonzalezAlberquilla@arm.com        RegId
43712106SRekai.GonzalezAlberquilla@arm.com        flattenRegId(const RegId& regId) const
43812106SRekai.GonzalezAlberquilla@arm.com        {
43912106SRekai.GonzalezAlberquilla@arm.com            switch (regId.classValue()) {
44012106SRekai.GonzalezAlberquilla@arm.com              case IntRegClass:
44112106SRekai.GonzalezAlberquilla@arm.com                return RegId(IntRegClass, flattenIntIndex(regId.index()));
44212106SRekai.GonzalezAlberquilla@arm.com              case FloatRegClass:
44312106SRekai.GonzalezAlberquilla@arm.com                return RegId(FloatRegClass, flattenFloatIndex(regId.index()));
44412109SRekai.GonzalezAlberquilla@arm.com              case VecRegClass:
44512109SRekai.GonzalezAlberquilla@arm.com                return RegId(VecRegClass, flattenVecIndex(regId.index()));
44612109SRekai.GonzalezAlberquilla@arm.com              case VecElemClass:
44713545Sgiacomo.travaglini@arm.com                return RegId(VecElemClass, flattenVecElemIndex(regId.index()),
44813545Sgiacomo.travaglini@arm.com                             regId.elemIndex());
44912106SRekai.GonzalezAlberquilla@arm.com              case CCRegClass:
45012106SRekai.GonzalezAlberquilla@arm.com                return RegId(CCRegClass, flattenCCIndex(regId.index()));
45112106SRekai.GonzalezAlberquilla@arm.com              case MiscRegClass:
45212106SRekai.GonzalezAlberquilla@arm.com                return RegId(MiscRegClass, flattenMiscIndex(regId.index()));
45312106SRekai.GonzalezAlberquilla@arm.com            }
45412106SRekai.GonzalezAlberquilla@arm.com            return RegId();
45512106SRekai.GonzalezAlberquilla@arm.com        }
45612106SRekai.GonzalezAlberquilla@arm.com
4576313Sgblack@eecs.umich.edu        int
45810035Sandreas.hansson@arm.com        flattenIntIndex(int reg) const
4596313Sgblack@eecs.umich.edu        {
4606718Sgblack@eecs.umich.edu            assert(reg >= 0);
4616718Sgblack@eecs.umich.edu            if (reg < NUM_ARCH_INTREGS) {
4626718Sgblack@eecs.umich.edu                return intRegMap[reg];
4636726Sgblack@eecs.umich.edu            } else if (reg < NUM_INTREGS) {
4646726Sgblack@eecs.umich.edu                return reg;
46510037SARM gem5 Developers            } else if (reg == INTREG_SPX) {
46610037SARM gem5 Developers                CPSR cpsr = miscRegs[MISCREG_CPSR];
46710037SARM gem5 Developers                ExceptionLevel el = opModeToEL(
46810037SARM gem5 Developers                    (OperatingMode) (uint8_t) cpsr.mode);
46910037SARM gem5 Developers                if (!cpsr.sp && el != EL0)
47010037SARM gem5 Developers                    return INTREG_SP0;
47110037SARM gem5 Developers                switch (el) {
47210037SARM gem5 Developers                  case EL3:
47310037SARM gem5 Developers                    return INTREG_SP3;
47411574SCurtis.Dunham@arm.com                  case EL2:
47511574SCurtis.Dunham@arm.com                    return INTREG_SP2;
47610037SARM gem5 Developers                  case EL1:
47710037SARM gem5 Developers                    return INTREG_SP1;
47810037SARM gem5 Developers                  case EL0:
47910037SARM gem5 Developers                    return INTREG_SP0;
48010037SARM gem5 Developers                  default:
48110037SARM gem5 Developers                    panic("Invalid exception level");
48213020Sshunhsingou@google.com                    return 0;  // Never happens.
48310037SARM gem5 Developers                }
4846718Sgblack@eecs.umich.edu            } else {
48510037SARM gem5 Developers                return flattenIntRegModeIndex(reg);
4866718Sgblack@eecs.umich.edu            }
4876313Sgblack@eecs.umich.edu        }
4886313Sgblack@eecs.umich.edu
4896313Sgblack@eecs.umich.edu        int
49010035Sandreas.hansson@arm.com        flattenFloatIndex(int reg) const
4916313Sgblack@eecs.umich.edu        {
49210338SCurtis.Dunham@arm.com            assert(reg >= 0);
4936313Sgblack@eecs.umich.edu            return reg;
4946313Sgblack@eecs.umich.edu        }
4956313Sgblack@eecs.umich.edu
4969920Syasuko.eckert@amd.com        int
49712109SRekai.GonzalezAlberquilla@arm.com        flattenVecIndex(int reg) const
49812109SRekai.GonzalezAlberquilla@arm.com        {
49912109SRekai.GonzalezAlberquilla@arm.com            assert(reg >= 0);
50012109SRekai.GonzalezAlberquilla@arm.com            return reg;
50112109SRekai.GonzalezAlberquilla@arm.com        }
50212109SRekai.GonzalezAlberquilla@arm.com
50312109SRekai.GonzalezAlberquilla@arm.com        int
50412109SRekai.GonzalezAlberquilla@arm.com        flattenVecElemIndex(int reg) const
50512109SRekai.GonzalezAlberquilla@arm.com        {
50612109SRekai.GonzalezAlberquilla@arm.com            assert(reg >= 0);
50712109SRekai.GonzalezAlberquilla@arm.com            return reg;
50812109SRekai.GonzalezAlberquilla@arm.com        }
50912109SRekai.GonzalezAlberquilla@arm.com
51012109SRekai.GonzalezAlberquilla@arm.com        int
51110035Sandreas.hansson@arm.com        flattenCCIndex(int reg) const
5129920Syasuko.eckert@amd.com        {
51310338SCurtis.Dunham@arm.com            assert(reg >= 0);
5149920Syasuko.eckert@amd.com            return reg;
5159920Syasuko.eckert@amd.com        }
5169920Syasuko.eckert@amd.com
5177614Sminkyu.jeong@arm.com        int
51810035Sandreas.hansson@arm.com        flattenMiscIndex(int reg) const
5197614Sminkyu.jeong@arm.com        {
52010338SCurtis.Dunham@arm.com            assert(reg >= 0);
52110037SARM gem5 Developers            int flat_idx = reg;
52210037SARM gem5 Developers
5237614Sminkyu.jeong@arm.com            if (reg == MISCREG_SPSR) {
5247614Sminkyu.jeong@arm.com                CPSR cpsr = miscRegs[MISCREG_CPSR];
5257614Sminkyu.jeong@arm.com                switch (cpsr.mode) {
52610037SARM gem5 Developers                  case MODE_EL0T:
52710037SARM gem5 Developers                    warn("User mode does not have SPSR\n");
52810037SARM gem5 Developers                    flat_idx = MISCREG_SPSR;
52910037SARM gem5 Developers                    break;
53010037SARM gem5 Developers                  case MODE_EL1T:
53110037SARM gem5 Developers                  case MODE_EL1H:
53210037SARM gem5 Developers                    flat_idx = MISCREG_SPSR_EL1;
53310037SARM gem5 Developers                    break;
53410037SARM gem5 Developers                  case MODE_EL2T:
53510037SARM gem5 Developers                  case MODE_EL2H:
53610037SARM gem5 Developers                    flat_idx = MISCREG_SPSR_EL2;
53710037SARM gem5 Developers                    break;
53810037SARM gem5 Developers                  case MODE_EL3T:
53910037SARM gem5 Developers                  case MODE_EL3H:
54010037SARM gem5 Developers                    flat_idx = MISCREG_SPSR_EL3;
54110037SARM gem5 Developers                    break;
5427614Sminkyu.jeong@arm.com                  case MODE_USER:
5437614Sminkyu.jeong@arm.com                    warn("User mode does not have SPSR\n");
54410037SARM gem5 Developers                    flat_idx = MISCREG_SPSR;
5457614Sminkyu.jeong@arm.com                    break;
5467614Sminkyu.jeong@arm.com                  case MODE_FIQ:
54710037SARM gem5 Developers                    flat_idx = MISCREG_SPSR_FIQ;
5487614Sminkyu.jeong@arm.com                    break;
5497614Sminkyu.jeong@arm.com                  case MODE_IRQ:
55010037SARM gem5 Developers                    flat_idx = MISCREG_SPSR_IRQ;
5517614Sminkyu.jeong@arm.com                    break;
5527614Sminkyu.jeong@arm.com                  case MODE_SVC:
55310037SARM gem5 Developers                    flat_idx = MISCREG_SPSR_SVC;
5547614Sminkyu.jeong@arm.com                    break;
5557614Sminkyu.jeong@arm.com                  case MODE_MON:
55610037SARM gem5 Developers                    flat_idx = MISCREG_SPSR_MON;
5577614Sminkyu.jeong@arm.com                    break;
5587614Sminkyu.jeong@arm.com                  case MODE_ABORT:
55910037SARM gem5 Developers                    flat_idx = MISCREG_SPSR_ABT;
56010037SARM gem5 Developers                    break;
56110037SARM gem5 Developers                  case MODE_HYP:
56210037SARM gem5 Developers                    flat_idx = MISCREG_SPSR_HYP;
5637614Sminkyu.jeong@arm.com                    break;
5647614Sminkyu.jeong@arm.com                  case MODE_UNDEFINED:
56510037SARM gem5 Developers                    flat_idx = MISCREG_SPSR_UND;
5667614Sminkyu.jeong@arm.com                    break;
5677614Sminkyu.jeong@arm.com                  default:
5687614Sminkyu.jeong@arm.com                    warn("Trying to access SPSR in an invalid mode: %d\n",
5697614Sminkyu.jeong@arm.com                         cpsr.mode);
57010037SARM gem5 Developers                    flat_idx = MISCREG_SPSR;
5717614Sminkyu.jeong@arm.com                    break;
5727614Sminkyu.jeong@arm.com                }
57310037SARM gem5 Developers            } else if (miscRegInfo[reg][MISCREG_MUTEX]) {
57410037SARM gem5 Developers                // Mutually exclusive CP15 register
57510037SARM gem5 Developers                switch (reg) {
57610037SARM gem5 Developers                  case MISCREG_PRRR_MAIR0:
57710037SARM gem5 Developers                  case MISCREG_PRRR_MAIR0_NS:
57810037SARM gem5 Developers                  case MISCREG_PRRR_MAIR0_S:
57910037SARM gem5 Developers                    {
58010037SARM gem5 Developers                        TTBCR ttbcr = readMiscRegNoEffect(MISCREG_TTBCR);
58110037SARM gem5 Developers                        // If the muxed reg has been flattened, work out the
58210037SARM gem5 Developers                        // offset and apply it to the unmuxed reg
58310037SARM gem5 Developers                        int idxOffset = reg - MISCREG_PRRR_MAIR0;
58410037SARM gem5 Developers                        if (ttbcr.eae)
58510037SARM gem5 Developers                            flat_idx = flattenMiscIndex(MISCREG_MAIR0 +
58610037SARM gem5 Developers                                                        idxOffset);
58710037SARM gem5 Developers                        else
58810037SARM gem5 Developers                            flat_idx = flattenMiscIndex(MISCREG_PRRR +
58910037SARM gem5 Developers                                                        idxOffset);
59010037SARM gem5 Developers                    }
59110037SARM gem5 Developers                    break;
59210037SARM gem5 Developers                  case MISCREG_NMRR_MAIR1:
59310037SARM gem5 Developers                  case MISCREG_NMRR_MAIR1_NS:
59410037SARM gem5 Developers                  case MISCREG_NMRR_MAIR1_S:
59510037SARM gem5 Developers                    {
59610037SARM gem5 Developers                        TTBCR ttbcr = readMiscRegNoEffect(MISCREG_TTBCR);
59710037SARM gem5 Developers                        // If the muxed reg has been flattened, work out the
59810037SARM gem5 Developers                        // offset and apply it to the unmuxed reg
59910037SARM gem5 Developers                        int idxOffset = reg - MISCREG_NMRR_MAIR1;
60010037SARM gem5 Developers                        if (ttbcr.eae)
60110037SARM gem5 Developers                            flat_idx = flattenMiscIndex(MISCREG_MAIR1 +
60210037SARM gem5 Developers                                                        idxOffset);
60310037SARM gem5 Developers                        else
60410037SARM gem5 Developers                            flat_idx = flattenMiscIndex(MISCREG_NMRR +
60510037SARM gem5 Developers                                                        idxOffset);
60610037SARM gem5 Developers                    }
60710037SARM gem5 Developers                    break;
60810037SARM gem5 Developers                  case MISCREG_PMXEVTYPER_PMCCFILTR:
60910037SARM gem5 Developers                    {
61010037SARM gem5 Developers                        PMSELR pmselr = miscRegs[MISCREG_PMSELR];
61110037SARM gem5 Developers                        if (pmselr.sel == 31)
61210037SARM gem5 Developers                            flat_idx = flattenMiscIndex(MISCREG_PMCCFILTR);
61310037SARM gem5 Developers                        else
61410037SARM gem5 Developers                            flat_idx = flattenMiscIndex(MISCREG_PMXEVTYPER);
61510037SARM gem5 Developers                    }
61610037SARM gem5 Developers                    break;
61710037SARM gem5 Developers                  default:
61810037SARM gem5 Developers                    panic("Unrecognized misc. register.\n");
61910037SARM gem5 Developers                    break;
62010037SARM gem5 Developers                }
62110037SARM gem5 Developers            } else {
62210037SARM gem5 Developers                if (miscRegInfo[reg][MISCREG_BANKED]) {
62311771SCurtis.Dunham@arm.com                    bool secureReg = haveSecurity && !highestELIs64 &&
62410037SARM gem5 Developers                                     inSecureState(miscRegs[MISCREG_SCR],
62510037SARM gem5 Developers                                                   miscRegs[MISCREG_CPSR]);
62610037SARM gem5 Developers                    flat_idx += secureReg ? 2 : 1;
62710037SARM gem5 Developers                }
6287614Sminkyu.jeong@arm.com            }
62910037SARM gem5 Developers            return flat_idx;
6307614Sminkyu.jeong@arm.com        }
6317614Sminkyu.jeong@arm.com
63211771SCurtis.Dunham@arm.com        std::pair<int,int> getMiscIndices(int misc_reg) const
63311771SCurtis.Dunham@arm.com        {
63411771SCurtis.Dunham@arm.com            // Note: indexes of AArch64 registers are left unchanged
63511771SCurtis.Dunham@arm.com            int flat_idx = flattenMiscIndex(misc_reg);
63611771SCurtis.Dunham@arm.com
63711771SCurtis.Dunham@arm.com            if (lookUpMiscReg[flat_idx].lower == 0) {
63811771SCurtis.Dunham@arm.com                return std::make_pair(flat_idx, 0);
63911771SCurtis.Dunham@arm.com            }
64011771SCurtis.Dunham@arm.com
64111771SCurtis.Dunham@arm.com            // do additional S/NS flattenings if mapped to NS while in S
64211771SCurtis.Dunham@arm.com            bool S = haveSecurity && !highestELIs64 &&
64311771SCurtis.Dunham@arm.com                     inSecureState(miscRegs[MISCREG_SCR],
64411771SCurtis.Dunham@arm.com                                   miscRegs[MISCREG_CPSR]);
64511771SCurtis.Dunham@arm.com            int lower = lookUpMiscReg[flat_idx].lower;
64611771SCurtis.Dunham@arm.com            int upper = lookUpMiscReg[flat_idx].upper;
64711771SCurtis.Dunham@arm.com            // upper == 0, which is CPSR, is not MISCREG_BANKED_CHILD (no-op)
64811771SCurtis.Dunham@arm.com            lower += S && miscRegInfo[lower][MISCREG_BANKED_CHILD];
64911771SCurtis.Dunham@arm.com            upper += S && miscRegInfo[upper][MISCREG_BANKED_CHILD];
65011771SCurtis.Dunham@arm.com            return std::make_pair(lower, upper);
65111771SCurtis.Dunham@arm.com        }
65211771SCurtis.Dunham@arm.com
65310905Sandreas.sandberg@arm.com        void serialize(CheckpointOut &cp) const
6547733SAli.Saidi@ARM.com        {
6557733SAli.Saidi@ARM.com            DPRINTF(Checkpoint, "Serializing Arm Misc Registers\n");
65612529Sgiacomo.travaglini@arm.com            SERIALIZE_ARRAY(miscRegs, NUM_PHYS_MISCREGS);
65710037SARM gem5 Developers
65811771SCurtis.Dunham@arm.com            SERIALIZE_SCALAR(highestELIs64);
65910037SARM gem5 Developers            SERIALIZE_SCALAR(haveSecurity);
66010037SARM gem5 Developers            SERIALIZE_SCALAR(haveLPAE);
66110037SARM gem5 Developers            SERIALIZE_SCALAR(haveVirtualization);
66210037SARM gem5 Developers            SERIALIZE_SCALAR(haveLargeAsid64);
66313114Sgiacomo.travaglini@arm.com            SERIALIZE_SCALAR(physAddrRange);
6647733SAli.Saidi@ARM.com        }
66510905Sandreas.sandberg@arm.com        void unserialize(CheckpointIn &cp)
6667733SAli.Saidi@ARM.com        {
6677733SAli.Saidi@ARM.com            DPRINTF(Checkpoint, "Unserializing Arm Misc Registers\n");
66812529Sgiacomo.travaglini@arm.com            UNSERIALIZE_ARRAY(miscRegs, NUM_PHYS_MISCREGS);
6697733SAli.Saidi@ARM.com            CPSR tmp_cpsr = miscRegs[MISCREG_CPSR];
6707733SAli.Saidi@ARM.com            updateRegMap(tmp_cpsr);
67110037SARM gem5 Developers
67211771SCurtis.Dunham@arm.com            UNSERIALIZE_SCALAR(highestELIs64);
67310037SARM gem5 Developers            UNSERIALIZE_SCALAR(haveSecurity);
67410037SARM gem5 Developers            UNSERIALIZE_SCALAR(haveLPAE);
67510037SARM gem5 Developers            UNSERIALIZE_SCALAR(haveVirtualization);
67610037SARM gem5 Developers            UNSERIALIZE_SCALAR(haveLargeAsid64);
67713114Sgiacomo.travaglini@arm.com            UNSERIALIZE_SCALAR(physAddrRange);
6787733SAli.Saidi@ARM.com        }
6796313Sgblack@eecs.umich.edu
68012972Sandreas.sandberg@arm.com        void startup(ThreadContext *tc);
6819461Snilay@cs.wisc.edu
68211165SRekai.GonzalezAlberquilla@arm.com        Enums::DecoderFlavour decoderFlavour() const { return _decoderFlavour; }
68311165SRekai.GonzalezAlberquilla@arm.com
68412109SRekai.GonzalezAlberquilla@arm.com        Enums::VecRegRenameMode
68512109SRekai.GonzalezAlberquilla@arm.com        vecRegRenameMode() const
68612109SRekai.GonzalezAlberquilla@arm.com        {
68712109SRekai.GonzalezAlberquilla@arm.com            return _vecRegRenameMode;
68812109SRekai.GonzalezAlberquilla@arm.com        }
68912109SRekai.GonzalezAlberquilla@arm.com
6909553Sandreas.hansson@arm.com        /// Explicitly import the otherwise hidden startup
6919553Sandreas.hansson@arm.com        using SimObject::startup;
6929553Sandreas.hansson@arm.com
6939384SAndreas.Sandberg@arm.com        typedef ArmISAParams Params;
6947400SAli.Saidi@ARM.com
6959384SAndreas.Sandberg@arm.com        const Params *params() const;
6969384SAndreas.Sandberg@arm.com
6979384SAndreas.Sandberg@arm.com        ISA(Params *p);
6986313Sgblack@eecs.umich.edu    };
6996313Sgblack@eecs.umich.edu}
7006313Sgblack@eecs.umich.edu
70112109SRekai.GonzalezAlberquilla@arm.comtemplate<>
70212109SRekai.GonzalezAlberquilla@arm.comstruct initRenameMode<ArmISA::ISA>
70312109SRekai.GonzalezAlberquilla@arm.com{
70412109SRekai.GonzalezAlberquilla@arm.com    static Enums::VecRegRenameMode mode(const ArmISA::ISA* isa)
70512109SRekai.GonzalezAlberquilla@arm.com    {
70612109SRekai.GonzalezAlberquilla@arm.com        return isa->vecRegRenameMode();
70712109SRekai.GonzalezAlberquilla@arm.com    }
70812109SRekai.GonzalezAlberquilla@arm.com    static bool equals(const ArmISA::ISA* isa1, const ArmISA::ISA* isa2)
70912109SRekai.GonzalezAlberquilla@arm.com    {
71012109SRekai.GonzalezAlberquilla@arm.com        return mode(isa1) == mode(isa2);
71112109SRekai.GonzalezAlberquilla@arm.com    }
71212109SRekai.GonzalezAlberquilla@arm.com};
71312109SRekai.GonzalezAlberquilla@arm.com
7146313Sgblack@eecs.umich.edu#endif
715