gem5  v20.0.0.3
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 _haveSVE;
119 
121  const unsigned _sveVL;
122 
126  const bool _haveLSE;
127 
129  const unsigned _havePAN;
130 
135 
136  public:
137  typedef ArmSystemParams Params;
138  const Params *
139  params() const
140  {
141  return dynamic_cast<const Params *>(_params);
142  }
143 
144  ArmSystem(Params *p);
145 
147  bool multiProc;
148 
150  bool haveSecurity() const { return _haveSecurity; }
151 
154  bool haveLPAE() const { return _haveLPAE; }
155 
159  bool haveVirtualization() const { return _haveVirtualization; }
160 
164  bool haveCrypto() const { return _haveCrypto; }
165 
167  void
169  {
170  _genericTimer = generic_timer;
171  }
172 
174  void setGIC(BaseGic *gic) { _gic = gic; }
175 
178  {
179  _pwrCtrl = pwr_ctrl;
180  }
181 
184 
186  BaseGic *getGIC() const { return _gic; }
187 
190 
193  bool highestELIs64() const { return _highestELIs64; }
194 
197  highestEL() const
198  {
199  if (_haveSecurity)
200  return EL3;
201  if (_haveVirtualization)
202  return EL2;
203  return EL1;
204  }
205 
208  Addr resetAddr() const { return _resetAddr; }
209  void setResetAddr(Addr addr) { _resetAddr = addr; }
210 
212  bool haveLargeAsid64() const { return _haveLargeAsid64; }
213 
215  bool haveSVE() const { return _haveSVE; }
216 
218  unsigned sveVL() const { return _sveVL; }
219 
221  bool haveLSE() const { return _haveLSE; }
222 
224  bool havePAN() const { return _havePAN; }
225 
228  uint8_t physAddrRange64() const { return _physAddrRange64; }
229 
231  uint8_t
233  {
234  if (_highestELIs64)
235  return _physAddrRange64;
236  if (_haveLPAE)
237  return 40;
238  return 32;
239  }
240 
242  Addr physAddrMask() const { return mask(physAddrRange()); }
243 
245  bool haveSemihosting() const { return semihosting != nullptr; }
246 
251  static ArmSystem*
253  {
254  assert(FullSystem);
255  return static_cast<ArmSystem *>(tc->getSystemPtr());
256  }
257 
261  static bool haveSecurity(ThreadContext *tc);
262 
266  static bool haveVirtualization(ThreadContext *tc);
267 
271  static bool haveLPAE(ThreadContext *tc);
272 
276  static bool highestELIs64(ThreadContext *tc);
277 
282 
284  static bool haveEL(ThreadContext *tc, ExceptionLevel el);
285 
289  static Addr resetAddr(ThreadContext *tc);
290 
294  static uint8_t physAddrRange(ThreadContext *tc);
295 
299  static Addr physAddrMask(ThreadContext *tc);
300 
303  static bool haveLargeAsid64(ThreadContext *tc);
304 
306  static bool haveSemihosting(ThreadContext *tc);
307 
309  static bool callSemihosting64(ThreadContext *tc, bool gem5_ops=false);
310 
312  static bool callSemihosting32(ThreadContext *tc, bool gem5_ops=false);
313 
315  static bool callSemihosting(ThreadContext *tc, bool gem5_ops=false);
316 
318  static void callSetStandByWfi(ThreadContext *tc);
319 
321  static void callClearStandByWfi(ThreadContext *tc);
322 
328  static bool callSetWakeRequest(ThreadContext *tc);
329 
331  static void callClearWakeRequest(ThreadContext *tc);
332 };
333 
334 #endif
void setResetAddr(Addr addr)
Definition: system.hh:209
virtual System * getSystemPtr()=0
const uint8_t _physAddrRange64
Supported physical address range in bits if the highest implemented exception level is 64 bits (ARMv8...
Definition: system.hh:108
Addr physAddrMask() const
Returns the physical address mask.
Definition: system.hh:242
const unsigned _sveVL
SVE vector length at reset, in quadwords.
Definition: system.hh:121
bool haveSecurity() const
Returns true if this system implements the Security Extensions.
Definition: system.hh:150
const bool _haveLargeAsid64
True if ASID is 16 bits in AArch64 (ARMv8)
Definition: system.hh:113
void setPowerController(FVPBasePwrCtrl *pwr_ctrl)
Sets the pointer to the Power Controller.
Definition: system.hh:177
const bool _haveSVE
True if SVE is implemented (ARMv8)
Definition: system.hh:118
const unsigned _havePAN
True if Priviledge Access Never is implemented.
Definition: system.hh:129
bool havePAN() const
Returns true if Priviledge Access Never is implemented.
Definition: system.hh:224
ip6_addr_t addr
Definition: inet.hh:330
static void callClearWakeRequest(ThreadContext *tc)
Notify the power controller of WAKEREQUEST deassertion.
Definition: system.cc:223
bool highestELIs64() const
Returns true if the register width of the highest implemented exception level is 64 bits (ARMv8) ...
Definition: system.hh:193
bool FullSystem
The FullSystem variable can be used to determine the current mode of simulation.
Definition: root.cc:132
Definition: system.hh:72
static bool callSetWakeRequest(ThreadContext *tc)
Notify the power controller of WAKEREQUEST assertion.
Definition: system.cc:214
ThreadContext is the external interface to all thread state for anything outside of the CPU...
void setGenericTimer(GenericTimer *generic_timer)
Sets the pointer to the Generic Timer.
Definition: system.hh:168
ExceptionLevel
Definition: types.hh:583
static bool haveEL(ThreadContext *tc, ExceptionLevel el)
Return true if the system implements a specific exception level.
Definition: system.cc:132
bool haveSVE() const
Returns true if SVE is implemented (ARMv8)
Definition: system.hh:215
ArmSystem(Params *p)
Definition: system.cc:57
uint8_t physAddrRange64() const
Returns the supported physical address range in bits if the highest implemented exception level is 64...
Definition: system.hh:228
Bitfield< 3, 2 > el
const bool _haveLSE
True if LSE is implemented (ARMv8.1)
Definition: system.hh:126
bool _highestELIs64
True if the register width of the highest implemented exception level is 64 bits (ARMv8) ...
Definition: system.hh:102
bool multiProc
true if this a multiprocessor system
Definition: system.hh:147
const bool _haveVirtualization
True if this system implements the virtualization Extensions.
Definition: system.hh:75
Semihosting for AArch32 and AArch64.
Definition: semihosting.hh:72
unsigned sveVL() const
Returns the SVE vector length at reset, in quadwords.
Definition: system.hh:218
BaseGic * getGIC() const
Get a pointer to the system&#39;s GIC.
Definition: system.hh:186
static ArmSystem * getArmSystem(ThreadContext *tc)
Returns a valid ArmSystem pointer if using ARM ISA, it fails otherwise.
Definition: system.hh:252
FVPBasePwrCtrl * _pwrCtrl
Pointer to the Power Controller (if any)
Definition: system.hh:91
FVPBasePwrCtrl * getPowerController() const
Get a pointer to the system&#39;s power controller.
Definition: system.hh:189
bool haveVirtualization() const
Returns true if this system implements the virtualization Extensions.
Definition: system.hh:159
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:140
static void callSetStandByWfi(ThreadContext *tc)
Make a call to notify the power controller of STANDBYWFI assertion.
Definition: system.cc:200
bool haveCrypto() const
Returns true if this system implements the Crypto Extension.
Definition: system.hh:164
static void callClearStandByWfi(ThreadContext *tc)
Make a call to notify the power controller of STANDBYWFI deassertion.
Definition: system.cc:207
Params * _params
Definition: system.hh:444
void setGIC(BaseGic *gic)
Sets the pointer to the GIC.
Definition: system.hh:174
uint8_t physAddrRange() const
Returns the supported physical address range in bits.
Definition: system.hh:232
ExceptionLevel highestEL() const
Returns the highest implemented exception level.
Definition: system.hh:197
ArmSemihosting *const semihosting
True if the Semihosting interface is enabled.
Definition: system.hh:134
ArmSystemParams Params
Definition: system.hh:137
GenericTimer * _genericTimer
Pointer to the Generic Timer wrapper.
Definition: system.hh:85
static bool callSemihosting(ThreadContext *tc, bool gem5_ops=false)
Make a Semihosting call from either aarch64 or aarch32.
Definition: system.cc:191
Bitfield< 27, 24 > gic
bool haveLSE() const
Returns true if LSE is implemented (ARMv8.1)
Definition: system.hh:221
GenericTimer * getGenericTimer() const
Get a pointer to the system&#39;s generic timer model.
Definition: system.hh:183
BaseGic * _gic
Definition: system.hh:86
const bool _haveLPAE
True if this system implements the Large Physical Address Extension.
Definition: system.hh:70
Bitfield< 3, 0 > mask
Definition: types.hh:62
const bool _haveCrypto
True if this system implements the Crypto Extension.
Definition: system.hh:80
const bool _haveSecurity
True if this system implements the Security Extensions.
Definition: system.hh:65
bool haveLargeAsid64() const
Returns true if ASID is 16 bits in AArch64 (ARMv8)
Definition: system.hh:212
Addr _resetAddr
Reset address (ARMv8)
Definition: system.hh:96
bool haveSemihosting() const
Is Arm Semihosting support enabled?
Definition: system.hh:245
Bitfield< 0 > p
const Params * params() const
Definition: system.hh:139
Addr resetAddr() const
Returns the reset address if the highest implemented exception level is 64 bits (ARMv8) ...
Definition: system.hh:208
static bool callSemihosting32(ThreadContext *tc, bool gem5_ops=false)
Make a Semihosting call from aarch32.
Definition: system.cc:185
static bool callSemihosting64(ThreadContext *tc, bool gem5_ops=false)
Make a Semihosting call from aarch64.
Definition: system.cc:179
bool haveLPAE() const
Returns true if this system implements the Large Physical Address Extension.
Definition: system.hh:154

Generated on Fri Jul 3 2020 15:42:40 for gem5 by doxygen 1.8.13