gem5  v21.0.1.0
thread_context.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2020 Google, Inc.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met: redistributions of source code must retain the above copyright
7  * notice, this list of conditions and the following disclaimer;
8  * redistributions in binary form must reproduce the above copyright
9  * notice, this list of conditions and the following disclaimer in the
10  * documentation and/or other materials provided with the distribution;
11  * neither the name of the copyright holders nor the names of its
12  * contributors may be used to endorse or promote products derived from
13  * this software without specific prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #ifndef __ARCH_ARM_FASTMODEL_CORTEXR52_THREAD_CONTEXT_HH__
29 #define __ARCH_ARM_FASTMODEL_CORTEXR52_THREAD_CONTEXT_HH__
30 
32 
33 namespace FastModel
34 {
35 
36 // This ThreadContext class translates accesses to state using gem5's native
37 // to the Iris API. This includes extracting and translating register indices.
39 {
40  protected:
44 
45  public:
46  CortexR52TC(::BaseCPU *cpu, int id, System *system,
47  ::BaseMMU *mmu, ::BaseISA *isa,
48  iris::IrisConnectionInterface *iris_if,
49  const std::string &iris_path);
50 
51  bool translateAddress(Addr &paddr, Addr vaddr) override;
52 
53  void initFromIrisInstance(const ResourceMap &resources) override;
54 
55  // Since this CPU doesn't support aarch64, we override these two methods
56  // and always assume we're 32 bit. More than likely we could be more
57  // general than that, but that would require letting the default
58  // implementation read the CPSR, and that's not currently implemented.
59  RegVal readIntReg(RegIndex reg_idx) const override;
60  void setIntReg(RegIndex reg_idx, RegVal val) override;
61 
62  RegVal readCCRegFlat(RegIndex idx) const override;
63  void setCCRegFlat(RegIndex idx, RegVal val) override;
64 
65  const std::vector<iris::MemorySpaceId> &getBpSpaceIds() const override;
66 
67  // The map from gem5 indexes to IRIS resource names is not currently set
68  // up. It will be a little more complicated for R52, since it won't have
69  // many of the registers since it doesn't support aarch64. We may need to
70  // just return dummy values on reads and throw away writes, throw an
71  // error, or some combination of the two.
72  RegVal
73  readMiscRegNoEffect(RegIndex) const override
74  {
75  panic("%s not implemented.", __FUNCTION__);
76  }
77 
78  void
80  {
81  panic("%s not implemented.", __FUNCTION__);
82  }
83 
84  // Like the Misc regs, not currently supported and a little complicated.
85  RegVal
86  readIntRegFlat(RegIndex idx) const override
87  {
88  panic("%s not implemented.", __FUNCTION__);
89  }
90 
91  void
93  {
94  panic("%s not implemented.", __FUNCTION__);
95  }
96 
97  // Not supported by the CPU. There isn't anything to set up here as far
98  // as mapping, but the question still remains what to do about registers
99  // that don't exist in the CPU.
101  readVecReg(const RegId &) const override
102  {
103  panic("%s not implemented.", __FUNCTION__);
104  }
105 };
106 
107 } // namespace FastModel
108 
109 #endif // __ARCH_ARM_FASTMODEL_CORTEXR52_THREAD_CONTEXT_HH__
FastModel::CortexR52TC::readCCRegFlat
RegVal readCCRegFlat(RegIndex idx) const override
Definition: thread_context.cc:107
FastModel::CortexR52TC::getBpSpaceIds
const std::vector< iris::MemorySpaceId > & getBpSpaceIds() const override
Definition: thread_context.cc:147
BaseMMU
Definition: mmu.hh:45
ArmISA::VecRegContainer
VecReg::Container VecRegContainer
Definition: registers.hh:63
FastModel::CortexR52TC::setMiscRegNoEffect
void setMiscRegNoEffect(RegIndex, const RegVal) override
Definition: thread_context.hh:79
FastModel::CortexR52TC::CortexR52TC
CortexR52TC(::BaseCPU *cpu, int id, System *system, ::BaseMMU *mmu, ::BaseISA *isa, iris::IrisConnectionInterface *iris_if, const std::string &iris_path)
Definition: thread_context.cc:38
FastModel::CortexR52TC::setIntRegFlat
void setIntRegFlat(RegIndex idx, RegVal val) override
Definition: thread_context.hh:92
FastModel::CortexR52TC::readIntRegFlat
RegVal readIntRegFlat(RegIndex idx) const override
Flat register interfaces.
Definition: thread_context.hh:86
FastModel::CortexR52TC::readIntReg
RegVal readIntReg(RegIndex reg_idx) const override
Definition: thread_context.cc:92
std::vector< iris::MemorySpaceId >
FastModel::CortexR52TC
Definition: thread_context.hh:38
FastModel::CortexR52TC::setCCRegFlat
void setCCRegFlat(RegIndex idx, RegVal val) override
Definition: thread_context.cc:124
RegId
Register ID: describe an architectural register with its class and index.
Definition: reg_class.hh:75
FastModel::CortexR52TC::intReg32IdxNameMap
static IdxNameMap intReg32IdxNameMap
Definition: thread_context.hh:41
FastModel::CortexR52TC::readVecReg
const ArmISA::VecRegContainer & readVecReg(const RegId &) const override
Definition: thread_context.hh:101
X86ISA::system
Bitfield< 15 > system
Definition: misc.hh:997
FastModel::CortexR52TC::ccRegIdxNameMap
static IdxNameMap ccRegIdxNameMap
Definition: thread_context.hh:42
FastModel::CortexR52TC::readMiscRegNoEffect
RegVal readMiscRegNoEffect(RegIndex) const override
Definition: thread_context.hh:73
System
Definition: system.hh:73
MipsISA::vaddr
vaddr
Definition: pra_constants.hh:275
FastModel::CortexR52TC::bpSpaceIds
static std::vector< iris::MemorySpaceId > bpSpaceIds
Definition: thread_context.hh:43
Iris::ThreadContext::IdxNameMap
std::map< int, std::string > IdxNameMap
Definition: thread_context.hh:53
X86ISA::val
Bitfield< 63 > val
Definition: misc.hh:769
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:148
FastModel::CortexR52TC::initFromIrisInstance
void initFromIrisInstance(const ResourceMap &resources) override
Definition: thread_context.cc:83
FastModel::CortexR52TC::translateAddress
bool translateAddress(Addr &paddr, Addr vaddr) override
Definition: thread_context.cc:46
BaseCPU
Definition: base.hh:104
FastModel
Definition: amba_from_tlm_bridge.cc:32
RegIndex
uint16_t RegIndex
Definition: types.hh:52
thread_context.hh
Iris::ThreadContext::ResourceMap
std::map< std::string, iris::ResourceInfo > ResourceMap
Definition: thread_context.hh:50
BaseISA
Definition: isa.hh:47
Iris::ThreadContext
Definition: thread_context.hh:47
RegVal
uint64_t RegVal
Definition: types.hh:174
FastModel::CortexR52TC::setIntReg
void setIntReg(RegIndex reg_idx, RegVal val) override
Definition: thread_context.cc:100
panic
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:171

Generated on Tue Jun 22 2021 15:28:19 for gem5 by doxygen 1.8.17