gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
system.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010, 2012-2013, 2015-2016 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  * Authors: Ali Saidi
41  */
42 
43 #ifndef __ARCH_ARM_SYSTEM_HH__
44 #define __ARCH_ARM_SYSTEM_HH__
45 
46 #include <memory>
47 #include <string>
48 #include <vector>
49 
50 #include "kern/linux/events.hh"
51 #include "params/ArmSystem.hh"
52 #include "params/GenericArmSystem.hh"
53 #include "sim/sim_object.hh"
54 #include "sim/system.hh"
55 
56 class GenericTimer;
57 class ThreadContext;
58 
59 class ArmSystem : public System
60 {
61  protected:
67 
70 
75 
79  const bool _haveSecurity;
80 
84  const bool _haveLPAE;
85 
89  const bool _haveVirtualization;
90 
95 
101 
107 
112  const uint8_t _physAddrRange64;
113 
117  const bool _haveLargeAsid64;
118 
124 
125  protected:
133  ObjectFile *getBootLoader(ObjectFile *const obj);
134 
135  public:
136  typedef ArmSystemParams Params;
137  const Params *
138  params() const
139  {
140  return dynamic_cast<const Params *>(_params);
141  }
142 
143  ArmSystem(Params *p);
144  ~ArmSystem();
145 
149  virtual void initState();
150 
152  {
153  // Remove the low bit that thumb symbols have set
154  // but that aren't actually odd aligned
155  if (addr & 0x1)
156  return addr & ~1;
157  return addr;
158  }
159 
161  bool multiProc;
162 
164  bool haveSecurity() const { return _haveSecurity; }
165 
168  bool haveLPAE() const { return _haveLPAE; }
169 
173  bool haveVirtualization() const { return _haveVirtualization; }
174 
176  void setGenericTimer(GenericTimer *generic_timer)
177  {
178  _genericTimer = generic_timer;
179  }
180 
183 
186  bool highestELIs64() const { return _highestELIs64; }
187 
190  {
191  if (_haveSecurity)
192  return EL3;
194  return EL2;
195  return EL1;
196  }
197 
200  Addr resetAddr64() const { return _resetAddr64; }
201 
203  bool haveLargeAsid64() const { return _haveLargeAsid64; }
204 
207  uint8_t physAddrRange64() const { return _physAddrRange64; }
208 
210  uint8_t physAddrRange() const
211  {
212  if (_highestELIs64)
213  return _physAddrRange64;
214  if (_haveLPAE)
215  return 40;
216  return 32;
217  }
218 
221  {
222  return mask(physAddrRange());
223  }
224 
229  const AddrRange &m5opRange() const { return _m5opRange; }
230 
234  static bool haveSecurity(ThreadContext *tc);
235 
239  static bool haveVirtualization(ThreadContext *tc);
240 
244  static bool haveLPAE(ThreadContext *tc);
245 
249  static bool highestELIs64(ThreadContext *tc);
250 
255 
259  static Addr resetAddr64(ThreadContext *tc);
260 
264  static uint8_t physAddrRange(ThreadContext *tc);
265 
269  static Addr physAddrMask(ThreadContext *tc);
270 
273  static bool haveLargeAsid64(ThreadContext *tc);
274 };
275 
277 {
278  public:
279  typedef GenericArmSystemParams Params;
280  const Params *
281  params() const
282  {
283  return dynamic_cast<const Params *>(_params);
284  }
285 
287  virtual ~GenericArmSystem() {};
288 
292  virtual void initState();
293 };
294 
295 #endif
ObjectFile * getBootLoader(ObjectFile *const obj)
Get a boot loader that matches the kernel.
Definition: system.cc:191
const uint8_t _physAddrRange64
Supported physical address range in bits if the highest implemented exception level is 64 bits (ARMv8...
Definition: system.hh:112
virtual void initState()
Initialise the system.
Definition: system.cc:270
const bool _haveLargeAsid64
True if ASID is 16 bits in AArch64 (ARMv8)
Definition: system.hh:117
ExceptionLevel highestEL() const
Returns the highest implemented exception level.
Definition: system.hh:189
GenericArmSystem(Params *p)
Definition: system.hh:286
ip6_addr_t addr
Definition: inet.hh:335
Definition: system.hh:83
uint8_t physAddrRange() const
Returns the supported physical address range in bits.
Definition: system.hh:210
Addr physAddrMask() const
Returns the physical address mask.
Definition: system.hh:220
const Params * params() const
Definition: system.hh:138
ThreadContext is the external interface to all thread state for anything outside of the CPU...
uint8_t physAddrRange64() const
Returns the supported physical address range in bits if the highest implemented exception level is 64...
Definition: system.hh:207
STL vector class.
Definition: stl.hh:40
void setGenericTimer(GenericTimer *generic_timer)
Sets the pointer to the Generic Timer.
Definition: system.hh:176
ObjectFile * bootldr
Pointer to the bootloader object.
Definition: system.hh:74
ExceptionLevel
Definition: types.hh:562
ArmSystem(Params *p)
Definition: system.cc:57
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
Definition: addr_range.hh:72
std::vector< std::unique_ptr< ObjectFile > > bootLoaders
Bootloaders.
Definition: system.hh:69
bool haveLPAE() const
Returns true if this system implements the Large Physical Address Extension.
Definition: system.hh:168
bool _highestELIs64
True if the register width of the highest implemented exception level is 64 bits (ARMv8) ...
Definition: system.hh:100
bool multiProc
true if this a multiprocessor system
Definition: system.hh:161
const bool _haveVirtualization
True if this system implements the virtualization Extensions.
Definition: system.hh:89
const Params * params() const
Definition: system.hh:281
virtual ~GenericArmSystem()
Definition: system.hh:287
const AddrRange _m5opRange
Range for memory-mapped m5 pseudo ops.
Definition: system.hh:123
bool highestELIs64() const
Returns true if the register width of the highest implemented exception level is 64 bits (ARMv8) ...
Definition: system.hh:186
const AddrRange & m5opRange() const
Range used by memory-mapped m5 pseudo-ops if enabled.
Definition: system.hh:229
Linux::DebugPrintkEvent * debugPrintkEvent
PC based event to skip the dprink() call and emulate its functionality.
Definition: system.hh:66
GenericArmSystemParams Params
Definition: system.hh:279
bool haveSecurity() const
Returns true if this system implements the Security Extensions.
Definition: system.hh:164
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
~ArmSystem()
Definition: system.cc:184
Params * _params
Definition: system.hh:495
const Addr _resetAddr64
Reset address if the highest implemented exception level is 64 bits (ARMv8)
Definition: system.hh:106
bool haveVirtualization() const
Returns true if this system implements the virtualization Extensions.
Definition: system.hh:173
ArmSystemParams Params
Definition: system.hh:136
virtual void initState()
Initialise the system.
Definition: system.cc:117
GenericTimer * _genericTimer
Pointer to the Generic Timer wrapper.
Definition: system.hh:94
virtual Addr fixFuncEventAddr(Addr addr)
Fix up an address used to match PCs for hooking simulator events on to target function executions...
Definition: system.hh:151
const bool _haveLPAE
True if this system implements the Large Physical Address Extension.
Definition: system.hh:84
Bitfield< 3, 0 > mask
Definition: types.hh:64
const bool _haveSecurity
True if this system implements the Security Extensions.
Definition: system.hh:79
Bitfield< 0 > p
bool haveLargeAsid64() const
Returns true if ASID is 16 bits in AArch64 (ARMv8)
Definition: system.hh:203
GenericTimer * getGenericTimer() const
Get a pointer to the system's generic timer model.
Definition: system.hh:182
Addr resetAddr64() const
Returns the reset address if the highest implemented exception level is 64 bits (ARMv8) ...
Definition: system.hh:200

Generated on Fri Jun 9 2017 13:03:34 for gem5 by doxygen 1.8.6