gem5  v22.1.0.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 gem5
34 {
35 
36 GEM5_DEPRECATED_NAMESPACE(FastModel, fastmodel);
37 namespace fastmodel
38 {
39 
40 // This ThreadContext class translates accesses to state using gem5's native
41 // to the Iris API. This includes extracting and translating register indices.
43 {
44  protected:
49 
50  public:
51  CortexR52TC(gem5::BaseCPU *cpu, int id, System *system,
52  gem5::BaseMMU *mmu, gem5::BaseISA *isa,
53  iris::IrisConnectionInterface *iris_if,
54  const std::string &iris_path);
55 
56  bool translateAddress(Addr &paddr, Addr vaddr) override;
57 
58  void initFromIrisInstance(const ResourceMap &resources) override;
59  void sendFunctional(PacketPtr pkt) override;
60 
61  // Since this CPU doesn't support aarch64, we override these two methods
62  // and always assume we're 32 bit. More than likely we could be more
63  // general than that, but that would require letting the default
64  // implementation read the CPSR, and that's not currently implemented.
65  RegVal readIntReg(RegIndex reg_idx) const override;
66  void setIntReg(RegIndex reg_idx, RegVal val) override;
67 
68  RegVal readCCRegFlat(RegIndex idx) const override;
69  void setCCRegFlat(RegIndex idx, RegVal val) override;
70 
71  const std::vector<iris::MemorySpaceId> &getBpSpaceIds() const override;
72 
73  // The map from gem5 indexes to IRIS resource names is not currently set
74  // up. It will be a little more complicated for R52, since it won't have
75  // many of the registers since it doesn't support aarch64. We may need to
76  // just return dummy values on reads and throw away writes, throw an
77  // error, or some combination of the two.
78  RegVal
79  readMiscRegNoEffect(RegIndex idx) const override
80  {
81  panic_if(miscRegIdxNameMap.find(idx) == miscRegIdxNameMap.end(),
82  "No mapping for index %#x.", idx);
84  }
85 
86  void
87  setMiscRegNoEffect(RegIndex idx, const RegVal val) override
88  {
89  panic_if(miscRegIdxNameMap.find(idx) == miscRegIdxNameMap.end(),
90  "No mapping for index %#x.", idx);
92  }
93 
94  // Like the Misc regs, not currently supported and a little complicated.
95  RegVal
96  readIntRegFlat(RegIndex idx) const override
97  {
98  panic("%s not implemented.", __FUNCTION__);
99  }
100 
101  void
103  {
104  panic("%s not implemented.", __FUNCTION__);
105  }
106 
107  // Not supported by the CPU. There isn't anything to set up here as far
108  // as mapping, but the question still remains what to do about registers
109  // that don't exist in the CPU.
111  readVecReg(const RegId &) const override
112  {
113  panic("%s not implemented.", __FUNCTION__);
114  }
115 };
116 
117 } // namespace fastmodel
118 } // namespace gem5
119 
120 #endif // __ARCH_ARM_FASTMODEL_CORTEXR52_THREAD_CONTEXT_HH__
std::map< std::string, iris::ResourceInfo > ResourceMap
std::map< int, std::string > IdxNameMap
RegVal readMiscRegNoEffect(RegIndex misc_reg) const override
void setMiscRegNoEffect(RegIndex misc_reg, const RegVal val) override
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:294
Register ID: describe an architectural register with its class and index.
Definition: reg_class.hh:91
Vector Register Abstraction This generic class is the model in a particularization of MVC,...
Definition: vec_reg.hh:124
RegVal readMiscRegNoEffect(RegIndex idx) const override
void setIntRegFlat(RegIndex idx, RegVal val) override
RegVal readIntReg(RegIndex reg_idx) const override
bool translateAddress(Addr &paddr, Addr vaddr) override
RegVal readCCRegFlat(RegIndex idx) const override
static IdxNameMap ccRegIdxNameMap
void sendFunctional(PacketPtr pkt) override
const std::vector< iris::MemorySpaceId > & getBpSpaceIds() const override
CortexR52TC(gem5::BaseCPU *cpu, int id, System *system, gem5::BaseMMU *mmu, gem5::BaseISA *isa, iris::IrisConnectionInterface *iris_if, const std::string &iris_path)
void setCCRegFlat(RegIndex idx, RegVal val) override
void setIntReg(RegIndex reg_idx, RegVal val) override
void initFromIrisInstance(const ResourceMap &resources) override
RegVal readIntRegFlat(RegIndex idx) const override
const ArmISA::VecRegContainer & readVecReg(const RegId &) const override
void setMiscRegNoEffect(RegIndex idx, const RegVal val) override
static IdxNameMap miscRegIdxNameMap
static IdxNameMap intReg32IdxNameMap
static std::vector< iris::MemorySpaceId > bpSpaceIds
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:178
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Definition: logging.hh:204
Bitfield< 15 > system
Definition: misc.hh:1004
Bitfield< 63 > val
Definition: misc.hh:776
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
uint16_t RegIndex
Definition: types.hh:176
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
uint64_t RegVal
Definition: types.hh:173
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi)

Generated on Wed Dec 21 2022 10:22:24 for gem5 by doxygen 1.9.1