gem5  v20.1.0.0
system.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010, 2012-2013, 2015-2020 ARM Limited
3  * All rights reserved
4  *
5  * The license below extends only to copyright in the software and shall
6  * not be construed as granting a license to any other intellectual
7  * property including but not limited to intellectual property relating
8  * to a hardware implementation of the functionality of the software
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Copyright (c) 2002-2005 The Regents of The University of Michigan
15  * All rights reserved.
16  *
17  * Redistribution and use in source and binary forms, with or without
18  * modification, are permitted provided that the following conditions are
19  * met: redistributions of source code must retain the above copyright
20  * notice, this list of conditions and the following disclaimer;
21  * redistributions in binary form must reproduce the above copyright
22  * notice, this list of conditions and the following disclaimer in the
23  * documentation and/or other materials provided with the distribution;
24  * neither the name of the copyright holders nor the names of its
25  * contributors may be used to endorse or promote products derived from
26  * this software without specific prior written permission.
27  *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39  */
40 
41 #ifndef __ARCH_ARM_SYSTEM_HH__
42 #define __ARCH_ARM_SYSTEM_HH__
43 
44 #include <memory>
45 #include <string>
46 #include <vector>
47 
48 #include "kern/linux/events.hh"
49 #include "params/ArmSystem.hh"
50 #include "sim/full_system.hh"
51 #include "sim/sim_object.hh"
52 #include "sim/system.hh"
53 
54 class GenericTimer;
55 class BaseGic;
56 class FVPBasePwrCtrl;
57 class ThreadContext;
58 
59 class ArmSystem : public System
60 {
61  protected:
65  const bool _haveSecurity;
66 
70  const bool _haveLPAE;
71 
75  const bool _haveVirtualization;
76 
80  const bool _haveCrypto;
81 
87 
92 
97 
103 
108  const uint8_t _physAddrRange64;
109 
113  const bool _haveLargeAsid64;
114 
118  const bool _haveTME;
119 
123  const bool _haveSVE;
124 
126  const unsigned _sveVL;
127 
131  const bool _haveLSE;
132 
134  const unsigned _havePAN;
135 
137  const unsigned _haveSecEL2;
138 
143 
144  public:
145  static constexpr Addr PageBytes = ArmISA::PageBytes;
146  static constexpr Addr PageShift = ArmISA::PageShift;
147 
148  typedef ArmSystemParams Params;
149  const Params *
150  params() const
151  {
152  return dynamic_cast<const Params *>(_params);
153  }
154 
155  ArmSystem(Params *p);
156 
158  bool multiProc;
159 
161  bool haveSecurity() const { return _haveSecurity; }
162 
165  bool haveLPAE() const { return _haveLPAE; }
166 
170  bool haveVirtualization() const { return _haveVirtualization; }
171 
175  bool haveCrypto() const { return _haveCrypto; }
176 
178  void
180  {
181  _genericTimer = generic_timer;
182  }
183 
185  void setGIC(BaseGic *gic) { _gic = gic; }
186 
189  {
190  _pwrCtrl = pwr_ctrl;
191  }
192 
195 
197  BaseGic *getGIC() const { return _gic; }
198 
201 
204  bool highestELIs64() const { return _highestELIs64; }
205 
208  highestEL() const
209  {
210  if (_haveSecurity)
211  return ArmISA::EL3;
213  return ArmISA::EL2;
214  return ArmISA::EL1;
215  }
216 
219  Addr resetAddr() const { return _resetAddr; }
221 
223  bool haveLargeAsid64() const { return _haveLargeAsid64; }
224 
228  bool haveTME() const { return _haveTME; }
229 
231  bool haveSVE() const { return _haveSVE; }
232 
234  unsigned sveVL() const { return _sveVL; }
235 
237  bool haveLSE() const { return _haveLSE; }
238 
240  bool havePAN() const { return _havePAN; }
241 
243  bool haveSecEL2() const { return _haveSecEL2; }
244 
247  uint8_t physAddrRange64() const { return _physAddrRange64; }
248 
250  uint8_t
252  {
253  if (_highestELIs64)
254  return _physAddrRange64;
255  if (_haveLPAE)
256  return 40;
257  return 32;
258  }
259 
261  Addr physAddrMask() const { return mask(physAddrRange()); }
262 
264  bool haveSemihosting() const { return semihosting != nullptr; }
265 
270  static ArmSystem*
272  {
273  assert(FullSystem);
274  return static_cast<ArmSystem *>(tc->getSystemPtr());
275  }
276 
280  static bool haveSecurity(ThreadContext *tc);
281 
285  static bool haveVirtualization(ThreadContext *tc);
286 
290  static bool haveLPAE(ThreadContext *tc);
291 
295  static bool highestELIs64(ThreadContext *tc);
296 
301 
303  static bool haveEL(ThreadContext *tc, ArmISA::ExceptionLevel el);
304 
308  static bool haveTME(ThreadContext *tc);
309 
313  static Addr resetAddr(ThreadContext *tc);
314 
318  static uint8_t physAddrRange(ThreadContext *tc);
319 
323  static Addr physAddrMask(ThreadContext *tc);
324 
327  static bool haveLargeAsid64(ThreadContext *tc);
328 
330  static bool haveSemihosting(ThreadContext *tc);
331 
333  static bool callSemihosting64(ThreadContext *tc, bool gem5_ops=false);
334 
336  static bool callSemihosting32(ThreadContext *tc, bool gem5_ops=false);
337 
339  static bool callSemihosting(ThreadContext *tc, bool gem5_ops=false);
340 
342  static void callSetStandByWfi(ThreadContext *tc);
343 
345  static void callClearStandByWfi(ThreadContext *tc);
346 
352  static bool callSetWakeRequest(ThreadContext *tc);
353 
355  static void callClearWakeRequest(ThreadContext *tc);
356 };
357 
358 #endif
events.hh
ArmSystem::_havePAN
const unsigned _havePAN
True if Priviledge Access Never is implemented.
Definition: system.hh:134
ArmISA::EL2
@ EL2
Definition: types.hh:624
ArmSystem::callSemihosting32
static bool callSemihosting32(ThreadContext *tc, bool gem5_ops=false)
Make a Semihosting call from aarch32.
Definition: system.cc:194
system.hh
ArmSystem::haveCrypto
bool haveCrypto() const
Returns true if this system implements the Crypto Extension.
Definition: system.hh:175
ArmSystem::physAddrRange
uint8_t physAddrRange() const
Returns the supported physical address range in bits.
Definition: system.hh:251
ArmSystem::highestELIs64
bool highestELIs64() const
Returns true if the register width of the highest implemented exception level is 64 bits (ARMv8)
Definition: system.hh:204
ArmSystem::resetAddr
Addr resetAddr() const
Returns the reset address if the highest implemented exception level is 64 bits (ARMv8)
Definition: system.hh:219
ArmSystem::_resetAddr
Addr _resetAddr
Reset address (ARMv8)
Definition: system.hh:96
ArmSystem::params
const Params * params() const
Definition: system.hh:150
ArmSystem::physAddrMask
Addr physAddrMask() const
Returns the physical address mask.
Definition: system.hh:261
ArmSystem::_haveLargeAsid64
const bool _haveLargeAsid64
True if ASID is 16 bits in AArch64 (ARMv8)
Definition: system.hh:113
ArmSystem::physAddrRange64
uint8_t physAddrRange64() const
Returns the supported physical address range in bits if the highest implemented exception level is 64...
Definition: system.hh:247
ArmSystem::_haveSecEL2
const unsigned _haveSecEL2
True if Secure EL2 is implemented.
Definition: system.hh:137
ArmSystem::haveSVE
bool haveSVE() const
Returns true if SVE is implemented (ARMv8)
Definition: system.hh:231
ArmSystem::setPowerController
void setPowerController(FVPBasePwrCtrl *pwr_ctrl)
Sets the pointer to the Power Controller.
Definition: system.hh:188
GenericTimer
Definition: generic_timer.hh:276
ArmISA::EL3
@ EL3
Definition: types.hh:625
FullSystem
bool FullSystem
The FullSystem variable can be used to determine the current mode of simulation.
Definition: root.cc:132
ArmSystem::getGIC
BaseGic * getGIC() const
Get a pointer to the system's GIC.
Definition: system.hh:197
ArmSystem::getPowerController
FVPBasePwrCtrl * getPowerController() const
Get a pointer to the system's power controller.
Definition: system.hh:200
ArmSystem::getGenericTimer
GenericTimer * getGenericTimer() const
Get a pointer to the system's generic timer model.
Definition: system.hh:194
ArmSystem::callSemihosting
static bool callSemihosting(ThreadContext *tc, bool gem5_ops=false)
Make a Semihosting call from either aarch64 or aarch32.
Definition: system.cc:200
ArmSystem::_gic
BaseGic * _gic
Definition: system.hh:86
ArmSystem::haveVirtualization
bool haveVirtualization() const
Returns true if this system implements the virtualization Extensions.
Definition: system.hh:170
ArmSystem::_haveVirtualization
const bool _haveVirtualization
True if this system implements the virtualization Extensions.
Definition: system.hh:75
ArmSystem::callSetStandByWfi
static void callSetStandByWfi(ThreadContext *tc)
Make a call to notify the power controller of STANDBYWFI assertion.
Definition: system.cc:209
ArmSystem::setResetAddr
void setResetAddr(Addr addr)
Definition: system.hh:220
FVPBasePwrCtrl
Definition: fvp_base_pwr_ctrl.hh:55
ArmSystem::getArmSystem
static ArmSystem * getArmSystem(ThreadContext *tc)
Returns a valid ArmSystem pointer if using ARM ISA, it fails otherwise.
Definition: system.hh:271
ArmSystem::haveSecurity
bool haveSecurity() const
Returns true if this system implements the Security Extensions.
Definition: system.hh:161
ThreadContext
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Definition: thread_context.hh:88
ArmSystem::haveLPAE
bool haveLPAE() const
Returns true if this system implements the Large Physical Address Extension.
Definition: system.hh:165
ArmSystem::_sveVL
const unsigned _sveVL
SVE vector length at reset, in quadwords.
Definition: system.hh:126
ArmSystem::_genericTimer
GenericTimer * _genericTimer
Pointer to the Generic Timer wrapper.
Definition: system.hh:85
ArmSystem::haveLSE
bool haveLSE() const
Returns true if LSE is implemented (ARMv8.1)
Definition: system.hh:237
sim_object.hh
System
Definition: system.hh:73
ArmSystem::havePAN
bool havePAN() const
Returns true if Priviledge Access Never is implemented.
Definition: system.hh:240
ArmSystem::callSemihosting64
static bool callSemihosting64(ThreadContext *tc, bool gem5_ops=false)
Make a Semihosting call from aarch64.
Definition: system.cc:188
ArmISA::ExceptionLevel
ExceptionLevel
Definition: types.hh:621
ArmISA::PageShift
const Addr PageShift
Definition: isa_traits.hh:51
ArmSystem::_highestELIs64
bool _highestELIs64
True if the register width of the highest implemented exception level is 64 bits (ARMv8)
Definition: system.hh:102
ArmISA::el
Bitfield< 3, 2 > el
Definition: miscregs_types.hh:69
ArmSystem::sveVL
unsigned sveVL() const
Returns the SVE vector length at reset, in quadwords.
Definition: system.hh:234
ArmSystem::haveSecEL2
bool haveSecEL2() const
Returns true if Priviledge Access Never is implemented.
Definition: system.hh:243
ArmSystem::ArmSystem
ArmSystem(Params *p)
Definition: system.cc:58
ArmSystem::_haveSecurity
const bool _haveSecurity
True if this system implements the Security Extensions.
Definition: system.hh:65
ArmISA::EL1
@ EL1
Definition: types.hh:623
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
ArmSystem::_haveTME
const bool _haveTME
True if system implements the transactional memory extension (TME)
Definition: system.hh:118
full_system.hh
ArmSystem::_haveSVE
const bool _haveSVE
True if SVE is implemented (ARMv8)
Definition: system.hh:123
ArmSystem
Definition: system.hh:59
ArmSystem::PageShift
static constexpr Addr PageShift
Definition: system.hh:146
ArmSystem::_haveLSE
const bool _haveLSE
True if LSE is implemented (ARMv8.1)
Definition: system.hh:131
ArmISA::PageBytes
const Addr PageBytes
Definition: isa_traits.hh:52
ArmSystem::callClearStandByWfi
static void callClearStandByWfi(ThreadContext *tc)
Make a call to notify the power controller of STANDBYWFI deassertion.
Definition: system.cc:216
BaseGic
Definition: base_gic.hh:62
ArmSystem::highestEL
ArmISA::ExceptionLevel highestEL() const
Returns the highest implemented exception level.
Definition: system.hh:208
ArmSystem::setGIC
void setGIC(BaseGic *gic)
Sets the pointer to the GIC.
Definition: system.hh:185
ArmISA::gic
Bitfield< 27, 24 > gic
Definition: miscregs_types.hh:171
addr
ip6_addr_t addr
Definition: inet.hh:423
ArmSystem::Params
ArmSystemParams Params
Definition: system.hh:148
ArmSystem::haveEL
static bool haveEL(ThreadContext *tc, ArmISA::ExceptionLevel el)
Return true if the system implements a specific exception level.
Definition: system.cc:135
System::_params
Params * _params
Definition: system.hh:567
ArmSystem::multiProc
bool multiProc
true if this a multiprocessor system
Definition: system.hh:158
ArmSystem::setGenericTimer
void setGenericTimer(GenericTimer *generic_timer)
Sets the pointer to the Generic Timer.
Definition: system.hh:179
ArmSystem::semihosting
ArmSemihosting *const semihosting
True if the Semihosting interface is enabled.
Definition: system.hh:142
ArmSystem::haveSemihosting
bool haveSemihosting() const
Is Arm Semihosting support enabled?
Definition: system.hh:264
ArmSystem::PageBytes
static constexpr Addr PageBytes
Definition: system.hh:145
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
ArmSystem::callSetWakeRequest
static bool callSetWakeRequest(ThreadContext *tc)
Notify the power controller of WAKEREQUEST assertion.
Definition: system.cc:223
ArmSystem::_pwrCtrl
FVPBasePwrCtrl * _pwrCtrl
Pointer to the Power Controller (if any)
Definition: system.hh:91
ArmSystem::haveTME
bool haveTME() const
Returns true if this system implements the transactional memory extension (ARMv9)
Definition: system.hh:228
ArmSemihosting
Semihosting for AArch32 and AArch64.
Definition: semihosting.hh:72
ArmSystem::_physAddrRange64
const uint8_t _physAddrRange64
Supported physical address range in bits if the highest implemented exception level is 64 bits (ARMv8...
Definition: system.hh:108
ArmSystem::_haveCrypto
const bool _haveCrypto
True if this system implements the Crypto Extension.
Definition: system.hh:80
ArmISA::mask
Bitfield< 28, 24 > mask
Definition: miscregs_types.hh:711
ThreadContext::getSystemPtr
virtual System * getSystemPtr()=0
ArmSystem::haveLargeAsid64
bool haveLargeAsid64() const
Returns true if ASID is 16 bits in AArch64 (ARMv8)
Definition: system.hh:223
ArmSystem::callClearWakeRequest
static void callClearWakeRequest(ThreadContext *tc)
Notify the power controller of WAKEREQUEST deassertion.
Definition: system.cc:232
ArmSystem::_haveLPAE
const bool _haveLPAE
True if this system implements the Large Physical Address Extension.
Definition: system.hh:70

Generated on Wed Sep 30 2020 14:02:01 for gem5 by doxygen 1.8.17