gem5  v20.0.0.2
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
table_walker.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010-2016, 2019 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  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions are
16  * met: redistributions of source code must retain the above copyright
17  * notice, this list of conditions and the following disclaimer;
18  * redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in the
20  * documentation and/or other materials provided with the distribution;
21  * neither the name of the copyright holders nor the names of its
22  * contributors may be used to endorse or promote products derived from
23  * this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  */
37 
38 #ifndef __ARCH_ARM_TABLE_WALKER_HH__
39 #define __ARCH_ARM_TABLE_WALKER_HH__
40 
41 #include <list>
42 
43 #include "arch/arm/faults.hh"
44 #include "arch/arm/miscregs.hh"
45 #include "arch/arm/system.hh"
46 #include "arch/arm/tlb.hh"
47 #include "mem/request.hh"
48 #include "params/ArmTableWalker.hh"
49 #include "sim/clocked_object.hh"
50 #include "sim/eventq.hh"
51 
52 class ThreadContext;
53 
54 class DmaPort;
55 
56 namespace ArmISA {
57 class Translation;
58 class TLB;
59 class Stage2MMU;
60 
61 class TableWalker : public ClockedObject
62 {
63  public:
64  class WalkerState;
65 
67  public:
69 
72 
73  virtual Addr pfn() const = 0;
74  virtual TlbEntry::DomainType domain() const = 0;
75  virtual bool xn() const = 0;
76  virtual uint8_t ap() const = 0;
77  virtual bool global(WalkerState *currState) const = 0;
78  virtual uint8_t offsetBits() const = 0;
79  virtual bool secure(bool have_security, WalkerState *currState) const = 0;
80  virtual std::string dbgHeader() const = 0;
81  virtual uint64_t getRawData() const = 0;
82  virtual uint8_t texcb() const
83  {
84  panic("texcb() not implemented for this class\n");
85  }
86  virtual bool shareable() const
87  {
88  panic("shareable() not implemented for this class\n");
89  }
90  };
91 
92  class L1Descriptor : public DescriptorBase {
93  public:
95  enum EntryType {
99  Reserved
100  };
101 
103  uint32_t data;
104 
107  bool _dirty;
108 
110  L1Descriptor() : data(0), _dirty(false)
111  {
112  lookupLevel = L1;
113  }
114 
115  virtual uint64_t getRawData() const
116  {
117  return (data);
118  }
119 
120  virtual std::string dbgHeader() const
121  {
122  return "Inserting Section Descriptor into TLB\n";
123  }
124 
125  virtual uint8_t offsetBits() const
126  {
127  return 20;
128  }
129 
130  EntryType type() const
131  {
132  return (EntryType)(data & 0x3);
133  }
134 
136  bool supersection() const
137  {
138  return bits(data, 18);
139  }
140 
142  Addr paddr() const
143  {
144  if (supersection())
145  panic("Super sections not implemented\n");
146  return mbits(data, 31, 20);
147  }
149  Addr paddr(Addr va) const
150  {
151  if (supersection())
152  panic("Super sections not implemented\n");
153  return mbits(data, 31, 20) | mbits(va, 19, 0);
154  }
155 
156 
158  Addr pfn() const
159  {
160  if (supersection())
161  panic("Super sections not implemented\n");
162  return bits(data, 31, 20);
163  }
164 
167  {
168  return !bits(data, 17);
169  }
170 
172  bool xn() const
173  {
174  return bits(data, 4);
175  }
176 
178  uint8_t ap() const
179  {
180  return (bits(data, 15) << 2) | bits(data, 11, 10);
181  }
182 
185  {
186  return static_cast<TlbEntry::DomainType>(bits(data, 8, 5));
187  }
188 
190  Addr l2Addr() const
191  {
192  return mbits(data, 31, 10);
193  }
194 
200  uint8_t texcb() const
201  {
202  return bits(data, 2) | bits(data, 3) << 1 | bits(data, 14, 12) << 2;
203  }
204 
206  bool shareable() const
207  {
208  return bits(data, 16);
209  }
210 
214  void setAp0()
215  {
216  data |= 1 << 10;
217  _dirty = true;
218  }
219 
221  bool dirty() const
222  {
223  return _dirty;
224  }
225 
230  bool secure(bool have_security, WalkerState *currState) const
231  {
232  if (have_security) {
233  if (type() == PageTable)
234  return !bits(data, 3);
235  else
236  return !bits(data, 19);
237  }
238  return false;
239  }
240  };
241 
243  class L2Descriptor : public DescriptorBase {
244  public:
246  uint32_t data;
248 
251  bool _dirty;
252 
254  L2Descriptor() : data(0), l1Parent(nullptr), _dirty(false)
255  {
256  lookupLevel = L2;
257  }
258 
259  L2Descriptor(L1Descriptor &parent) : data(0), l1Parent(&parent),
260  _dirty(false)
261  {
262  lookupLevel = L2;
263  }
264 
265  virtual uint64_t getRawData() const
266  {
267  return (data);
268  }
269 
270  virtual std::string dbgHeader() const
271  {
272  return "Inserting L2 Descriptor into TLB\n";
273  }
274 
275  virtual TlbEntry::DomainType domain() const
276  {
277  return l1Parent->domain();
278  }
279 
280  bool secure(bool have_security, WalkerState *currState) const
281  {
282  return l1Parent->secure(have_security, currState);
283  }
284 
285  virtual uint8_t offsetBits() const
286  {
287  return large() ? 16 : 12;
288  }
289 
291  bool invalid() const
292  {
293  return bits(data, 1, 0) == 0;
294  }
295 
297  bool large() const
298  {
299  return bits(data, 1) == 0;
300  }
301 
303  bool xn() const
304  {
305  return large() ? bits(data, 15) : bits(data, 0);
306  }
307 
310  {
311  return !bits(data, 11);
312  }
313 
315  uint8_t ap() const
316  {
317  return bits(data, 5, 4) | (bits(data, 9) << 2);
318  }
319 
321  uint8_t texcb() const
322  {
323  return large() ?
324  (bits(data, 2) | (bits(data, 3) << 1) | (bits(data, 14, 12) << 2)) :
325  (bits(data, 2) | (bits(data, 3) << 1) | (bits(data, 8, 6) << 2));
326  }
327 
329  Addr pfn() const
330  {
331  return large() ? bits(data, 31, 16) : bits(data, 31, 12);
332  }
333 
335  Addr paddr(Addr va) const
336  {
337  if (large())
338  return mbits(data, 31, 16) | mbits(va, 15, 0);
339  else
340  return mbits(data, 31, 12) | mbits(va, 11, 0);
341  }
342 
344  bool shareable() const
345  {
346  return bits(data, 10);
347  }
348 
352  void setAp0()
353  {
354  data |= 1 << 4;
355  _dirty = true;
356  }
357 
359  bool dirty() const
360  {
361  return _dirty;
362  }
363 
364  };
365 
366  // Granule sizes for AArch64 long descriptors
367  enum GrainSize {
368  Grain4KB = 12,
369  Grain16KB = 14,
370  Grain64KB = 16,
372  };
373 
376  public:
378  enum EntryType {
382  Page
383  };
384 
385  LongDescriptor() : data(0), _dirty(false) {}
386 
388  uint64_t data;
389 
392  bool _dirty;
393 
394  virtual uint64_t getRawData() const
395  {
396  return (data);
397  }
398 
399  virtual std::string dbgHeader() const
400  {
401  if (type() == LongDescriptor::Page) {
402  assert(lookupLevel == L3);
403  return "Inserting Page descriptor into TLB\n";
404  } else {
405  assert(lookupLevel < L3);
406  return "Inserting Block descriptor into TLB\n";
407  }
408  }
409 
414  bool secure(bool have_security, WalkerState *currState) const
415  {
416  assert(type() == Block || type() == Page);
417  return have_security && (currState->secureLookup && !bits(data, 5));
418  }
419 
421  bool aarch64;
422 
425 
427  EntryType type() const
428  {
429  switch (bits(data, 1, 0)) {
430  case 0x1:
431  // In AArch64 blocks are not allowed at L0 for the 4 KB granule
432  // and at L1 for 16/64 KB granules
433  if (grainSize > Grain4KB)
434  return lookupLevel == L2 ? Block : Invalid;
435  return lookupLevel == L0 || lookupLevel == L3 ? Invalid : Block;
436  case 0x3:
437  return lookupLevel == L3 ? Page : Table;
438  default:
439  return Invalid;
440  }
441  }
442 
444  uint8_t offsetBits() const
445  {
446  if (type() == Block) {
447  switch (grainSize) {
448  case Grain4KB:
449  return lookupLevel == L1 ? 30 /* 1 GB */
450  : 21 /* 2 MB */;
451  case Grain16KB:
452  return 25 /* 32 MB */;
453  case Grain64KB:
454  return 29 /* 512 MB */;
455  default:
456  panic("Invalid AArch64 VM granule size\n");
457  }
458  } else if (type() == Page) {
459  switch (grainSize) {
460  case Grain4KB:
461  case Grain16KB:
462  case Grain64KB:
463  return grainSize; /* enum -> uint okay */
464  default:
465  panic("Invalid AArch64 VM granule size\n");
466  }
467  } else {
468  panic("AArch64 page table entry must be block or page\n");
469  }
470  }
471 
473  Addr pfn() const
474  {
475  if (aarch64)
476  return bits(data, 47, offsetBits());
477  return bits(data, 39, offsetBits());
478  }
479 
481  Addr paddr(Addr va) const
482  {
483  int n = offsetBits();
484  if (aarch64)
485  return mbits(data, 47, n) | mbits(va, n - 1, 0);
486  return mbits(data, 39, n) | mbits(va, n - 1, 0);
487  }
488 
490  Addr paddr() const
491  {
492  if (aarch64)
493  return mbits(data, 47, offsetBits());
494  return mbits(data, 39, offsetBits());
495  }
496 
499  {
500  assert(type() == Table);
501  if (aarch64)
502  return mbits(data, 47, grainSize);
503  else
504  return mbits(data, 39, 12);
505  }
506 
509  {
510  assert(type() == Table);
511  Addr pa = 0;
512  if (aarch64) {
513  int stride = grainSize - 3;
514  int va_lo = stride * (3 - (lookupLevel + 1)) + grainSize;
515  int va_hi = va_lo + stride - 1;
516  pa = nextTableAddr() | (bits(va, va_hi, va_lo) << 3);
517  } else {
518  if (lookupLevel == L1)
519  pa = nextTableAddr() | (bits(va, 29, 21) << 3);
520  else // lookupLevel == L2
521  pa = nextTableAddr() | (bits(va, 20, 12) << 3);
522  }
523  return pa;
524  }
525 
527  bool xn() const
528  {
529  assert(type() == Block || type() == Page);
530  return bits(data, 54);
531  }
532 
534  bool pxn() const
535  {
536  assert(type() == Block || type() == Page);
537  return bits(data, 53);
538  }
539 
541  bool contiguousHint() const
542  {
543  assert(type() == Block || type() == Page);
544  return bits(data, 52);
545  }
546 
549  {
550  assert(currState && (type() == Block || type() == Page));
551  if (!currState->aarch64 && (currState->isSecure &&
552  !currState->secureLookup)) {
553  return false; // ARM ARM issue C B3.6.3
554  } else if (currState->aarch64) {
555  if (currState->el == EL2 || currState->el == EL3) {
556  return true; // By default translations are treated as global
557  // in AArch64 EL2 and EL3
558  } else if (currState->isSecure && !currState->secureLookup) {
559  return false;
560  }
561  }
562  return !bits(data, 11);
563  }
564 
566  bool af() const
567  {
568  assert(type() == Block || type() == Page);
569  return bits(data, 10);
570  }
571 
573  uint8_t sh() const
574  {
575  assert(type() == Block || type() == Page);
576  return bits(data, 9, 8);
577  }
578 
580  uint8_t ap() const
581  {
582  assert(type() == Block || type() == Page);
583  // Long descriptors only support the AP[2:1] scheme
584  return bits(data, 7, 6);
585  }
586 
588  bool rw() const
589  {
590  assert(type() == Block || type() == Page);
591  return !bits(data, 7);
592  }
593 
595  bool user() const
596  {
597  assert(type() == Block || type() == Page);
598  return bits(data, 6);
599  }
600 
604  static uint8_t ap(bool rw, bool user)
605  {
606  return ((!rw) << 2) | (user << 1);
607  }
608 
610  {
611  // Long-desc. format only supports Client domain
612  assert(type() == Block || type() == Page);
614  }
615 
617  uint8_t attrIndx() const
618  {
619  assert(type() == Block || type() == Page);
620  return bits(data, 4, 2);
621  }
622 
624  uint8_t memAttr() const
625  {
626  assert(type() == Block || type() == Page);
627  return bits(data, 5, 2);
628  }
629 
632  void setAf()
633  {
634  data |= 1 << 10;
635  _dirty = true;
636  }
637 
639  bool dirty() const
640  {
641  return _dirty;
642  }
643 
645  bool secureTable() const
646  {
647  assert(type() == Table);
648  return !bits(data, 63);
649  }
650 
652  uint8_t apTable() const
653  {
654  assert(type() == Table);
655  return bits(data, 62, 61);
656  }
657 
659  uint8_t rwTable() const
660  {
661  assert(type() == Table);
662  return !bits(data, 62);
663  }
664 
667  uint8_t userTable() const
668  {
669  assert(type() == Table);
670  return !bits(data, 61);
671  }
672 
674  bool xnTable() const
675  {
676  assert(type() == Table);
677  return bits(data, 60);
678  }
679 
681  bool pxnTable() const
682  {
683  assert(type() == Table);
684  return bits(data, 59);
685  }
686  };
687 
689  {
690  public:
693 
695  bool aarch64;
696 
699 
702 
705 
707  uint16_t asid;
708  uint8_t vmid;
709  bool isHyp;
710 
713 
716 
719 
722 
724  SCTLR sctlr;
725 
727  SCR scr;
728 
730  CPSR cpsr;
731 
733  union {
734  TTBCR ttbcr; // AArch32 translations
735  TCR tcr; // AArch64 translations
736  };
737 
739  HTCR htcr;
740 
742  HCR hcr;
743 
745  VTCR_t vtcr;
746 
748  bool isWrite;
749 
751  bool isFetch;
752 
754  bool isSecure;
755 
758 
762  bool rwTable;
763  bool userTable;
764  bool xnTable;
765  bool pxnTable;
766 
768  bool hpd;
769 
771  bool stage2Req;
772 
775 
777  bool timing;
778 
781 
784 
787 
791 
794 
797  bool delayed;
798 
800 
803 
805  unsigned levels;
806 
807  void doL1Descriptor();
808  void doL2Descriptor();
809 
810  void doLongDescriptor();
811 
812  WalkerState();
813 
814  std::string name() const { return tableWalker->name(); }
815  };
816 
817  protected:
818 
821 
825 
828 
831 
834 
836  const bool isStage2;
837 
840 
842  SCTLR sctlr;
843 
845 
847  bool pending;
848 
851  unsigned numSquashable;
852 
855  bool _haveLPAE;
857  uint8_t physAddrRange;
859 
870  Stats::Histogram statPendingWalks; // essentially "L" of queueing theory
873 
874  mutable unsigned pendingReqs;
876 
877  static const unsigned REQUESTED = 0;
878  static const unsigned COMPLETED = 1;
879 
880  public:
881  typedef ArmTableWalkerParams Params;
882  TableWalker(const Params *p);
883  virtual ~TableWalker();
884 
885  const Params *
886  params() const
887  {
888  return dynamic_cast<const Params *>(_params);
889  }
890 
891  void init() override;
892 
893  bool haveLPAE() const { return _haveLPAE; }
894  bool haveVirtualization() const { return _haveVirtualization; }
895  bool haveLargeAsid64() const { return _haveLargeAsid64; }
897  void completeDrain();
898  DrainState drain() override;
899  void drainResume() override;
900 
901  Port &getPort(const std::string &if_name,
902  PortID idx=InvalidPortID) override;
903 
904  void regStats() override;
905 
906  Fault walk(const RequestPtr &req, ThreadContext *tc,
907  uint16_t asid, uint8_t _vmid,
908  bool _isHyp, TLB::Mode mode, TLB::Translation *_trans,
909  bool timing, bool functional, bool secure,
910  TLB::ArmTranslationType tranType, bool _stage2Req);
911 
912  void setTlb(TLB *_tlb) { tlb = _tlb; }
913  TLB* getTlb() { return tlb; }
914  void setMMU(Stage2MMU *m, MasterID master_id);
915  void memAttrs(ThreadContext *tc, TlbEntry &te, SCTLR sctlr,
916  uint8_t texcb, bool s);
917  void memAttrsLPAE(ThreadContext *tc, TlbEntry &te,
918  LongDescriptor &lDescriptor);
919  void memAttrsAArch64(ThreadContext *tc, TlbEntry &te,
920  LongDescriptor &lDescriptor);
921 
922  static LookupLevel toLookupLevel(uint8_t lookup_level_as_int);
923 
924  private:
925 
926  void doL1Descriptor();
927  void doL1DescriptorWrapper();
929 
930  void doL2Descriptor();
931  void doL2DescriptorWrapper();
933 
934  void doLongDescriptor();
935 
944 
945  void doLongDescriptorWrapper(LookupLevel curr_lookup_level);
947 
948  bool fetchDescriptor(Addr descAddr, uint8_t *data, int numBytes,
949  Request::Flags flags, int queueIndex, Event *event,
950  void (TableWalker::*doDescriptor)());
951 
953 
954  void insertTableEntry(DescriptorBase &descriptor, bool longDescriptor);
955 
956  Fault processWalk();
958  static unsigned adjustTableSizeAArch64(unsigned tsz);
961  static bool checkAddrSizeFaultAArch64(Addr addr, int currPhysAddrRange);
963  void processWalkWrapper();
965 
966  void nextWalk(ThreadContext *tc);
967 
968  void pendingChange();
969 
970  static uint8_t pageSizeNtoStatBin(uint8_t N);
971 
973  LookupLevel lookup_level);
974 };
975 
976 } // namespace ArmISA
977 
978 #endif //__ARCH_ARM_TABLE_WALKER_HH__
979 
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:163
void regStats() override
Callback to set stat parameters.
bool large() const
What is the size of the mapping?
void memAttrsLPAE(ThreadContext *tc, TlbEntry &te, LongDescriptor &lDescriptor)
Ports are used to interface objects to each other.
Definition: port.hh:56
bool contiguousHint() const
Contiguous hint bit.
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
bool isFetch
If the access is a fetch (for execution, and no-exec) must be checked?
LookupLevel lookupLevel
Current lookup level for this descriptor.
Definition: table_walker.hh:71
bool shareable() const
If the section is shareable.
virtual TlbEntry::DomainType domain() const =0
uint32_t data
The raw bits of the entry.
virtual Addr pfn() const =0
const PortID InvalidPortID
Definition: types.hh:236
Bitfield< 0 > m
void doL3LongDescriptorWrapper()
unsigned numSquashable
The number of walks belonging to squashed instructions that can be removed from the pendingQueue per ...
Addr l2Addr() const
Address of L2 descriptor if it exists.
Addr paddr() const
Return the physcal address of the entry, bits in position.
std::list< WalkerState * > stateQueues[MAX_LOOKUP_LEVELS]
Queues of requests for all the different lookup levels.
virtual uint64_t getRawData() const
GrainSize grainSize
Width of the granule size in bits.
bool pending
If a timing translation is currently in progress.
EventFunctionWrapper doL2LongDescEvent
Declaration of a request, the overall memory request consisting of the parts of the request that are ...
Bitfield< 21, 20 > stride
EntryType type() const
Return the descriptor type.
std::shared_ptr< Request > RequestPtr
Definition: request.hh:81
virtual std::string dbgHeader() const
static uint8_t pageSizeNtoStatBin(uint8_t N)
Stats::Vector statWalksShortTerminatedAtLevel
ip6_addr_t addr
Definition: inet.hh:330
bool secureTable() const
Whether the subsequent levels of lookup are secure.
Fault testWalk(Addr pa, Addr size, TlbEntry::DomainType domain, LookupLevel lookup_level)
TableWalker(const Params *p)
Definition: table_walker.cc:56
bool isWrite
If the access is a write.
bool invalid() const
Is the entry invalid.
Stats::Histogram statPendingWalks
DrainState drain() override
Notify an object that it needs to drain its state.
virtual uint8_t texcb() const
Definition: table_walker.hh:82
Bitfield< 30 > te
bool haveSecurity
Cached copies of system-level properties.
bool haveLPAE() const
Stats::Scalar statWalksShortDescriptor
bool timing
If the mode is timing or atomic.
uint8_t memAttr() const
Memory attributes, only used by stage 2 translations.
uint8_t ap() const
Three bit access protection flags.
bool isUncacheable
True if table walks are uncacheable (for table descriptors)
bool secure(bool have_security, WalkerState *currState) const
Stats::Scalar statSquashedBefore
A vector of scalar stats.
Definition: statistics.hh:2547
Definition: ccregs.hh:41
bool hpd
Hierarchical access permission disable.
CPSR cpsr
Cached copy of the cpsr as it existed when translation began.
bool rw() const
Read/write access protection flag.
bool stage2Req
Flag indicating if a second stage of lookup is required.
Bitfield< 4, 0 > mode
TLB::Translation * transState
Translation state for delayed requests.
HTCR htcr
Cached copy of the htcr as it existed when translation began.
void doL2LongDescriptorWrapper()
uint8_t texcb() const
Memory region attributes: ARM DDI 0406B: B3-32.
Addr pfn() const
Return the physical frame, bits shifted right.
uint8_t attrIndx() const
Attribute index.
ThreadContext is the external interface to all thread state for anything outside of the CPU...
virtual uint64_t getRawData() const
EventFunctionWrapper doL0LongDescEvent
virtual std::string dbgHeader() const
Fault walk(const RequestPtr &req, ThreadContext *tc, uint16_t asid, uint8_t _vmid, bool _isHyp, TLB::Mode mode, TLB::Translation *_trans, bool timing, bool functional, bool secure, TLB::ArmTranslationType tranType, bool _stage2Req)
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:2505
Addr vaddr
The virtual address that is being translated with tagging removed.
virtual bool secure(bool have_security, WalkerState *currState) const =0
DrainState
Object drain/handover states.
Definition: drain.hh:71
DmaPort * port
Port shared by the two table walkers.
ExceptionLevel
Definition: types.hh:583
uint8_t offsetBits() const
Return the bit width of the page/block offset.
Bitfield< 31 > n
void memAttrs(ThreadContext *tc, TlbEntry &te, SCTLR sctlr, uint8_t texcb, bool s)
Addr pfn() const
Return the physical frame, bits shifted right.
WalkerState * currState
bool haveVirtualization() const
EventFunctionWrapper doL1DescEvent
virtual uint8_t offsetBits() const =0
bool xn() const
Is the translation not allow execution?
bool haveLargeAsid64() const
HCR hcr
Cached copy of the htcr as it existed when translation began.
uint8_t type
Definition: inet.hh:328
MasterID masterId
Master id assigned by the MMU.
Addr paddr(Addr va) const
Return complete physical address given a VA.
Stats::Vector statWalksLongTerminatedAtLevel
bool dirty() const
This entry needs to be written back to memory.
bool secure(bool have_security, WalkerState *currState) const
Returns true if this entry targets the secure physical address map.
bool global(WalkerState *currState) const
Is the translation global (no asid used)?
virtual ~TableWalker()
Definition: table_walker.cc:93
void insertTableEntry(DescriptorBase &descriptor, bool longDescriptor)
int physAddrRange
Current physical address range in bits.
Bitfield< 4 > s
Fault fault
The fault that we are going to return.
const Params * params() const
static LookupLevel toLookupLevel(uint8_t lookup_level_as_int)
virtual bool xn() const =0
uint64_t Tick
Tick count type.
Definition: types.hh:61
static uint8_t ap(bool rw, bool user)
Return the AP bits as compatible with the AP[2:0] format.
bool _dirty
This entry has been modified (access flag set) and needs to be written back to memory.
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
virtual uint8_t offsetBits() const
bool global(WalkerState *currState) const
Is the translation global (no asid used)?
void setMMU(Stage2MMU *m, MasterID master_id)
Definition: table_walker.cc:99
ExceptionLevel el
Current exception level.
EventFunctionWrapper doL3LongDescEvent
uint8_t apTable() const
Two bit access protection flags for subsequent levels of lookup.
void doL1LongDescriptorWrapper()
bool dirty() const
This entry needs to be written back to memory.
Addr pfn() const
Return the physical frame, bits shifted right.
ClockedObject declaration and implementation.
bool isSecure
If the access comes from the secure state.
Bitfield< 39, 12 > pa
A simple histogram stat.
Definition: statistics.hh:2626
bool fetchDescriptor(Addr descAddr, uint8_t *data, int numBytes, Request::Flags flags, int queueIndex, Event *event, void(TableWalker::*doDescriptor)())
void doLongDescriptorWrapper(LookupLevel curr_lookup_level)
bool supersection() const
Is the page a Supersection (16MB)?
bool xnTable() const
Is execution allowed on subsequent lookup levels?
Event * LongDescEventByLevel[4]
bool dirty() const
This entry needs to be written back to memory.
Stats::Histogram statWalkServiceTime
Fault generateLongDescFault(ArmFault::FaultSource src)
TLB::ArmTranslationType tranType
The translation type that has been requested.
bool functional
If the atomic mode should be functional.
SCTLR sctlr
Cached copy of the sctlr as it existed when translation began.
STL list class.
Definition: stl.hh:51
void doL0LongDescriptorWrapper()
virtual bool global(WalkerState *currState) const =0
virtual uint8_t offsetBits() const
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
static unsigned adjustTableSizeAArch64(unsigned tsz)
ArmTranslationType
Definition: tlb.hh:118
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:140
uint16_t MasterID
Definition: request.hh:84
uint8_t userTable() const
User/privileged mode protection flag for subsequent levels of lookup.
void completeDrain()
Checks if all state is cleared and if so, completes drain.
SCTLR sctlr
Cached copy of the sctlr as it existed when translation began.
Addr paddr(Addr va) const
Return the physcal address of the entry, bits in position.
uint8_t ap() const
2-bit access protection flags
Bitfield< 10, 5 > event
Bitfield< 8 > va
bool _dirty
This entry has been modified (access flag set) and needs to be written back to memory.
Stats::Histogram statWalkWaitTime
Stats::Scalar statSquashedAfter
static const unsigned REQUESTED
TLB * tlb
TLB that is initiating these table walks.
SCR scr
Cached copy of the scr as it existed when translation began.
bool shareable() const
If the section is shareable.
void drainResume() override
Resume execution after a successful drain.
uint8_t texcb() const
Memory region attributes: ARM DDI 0406B: B3-32.
Mode
Definition: tlb.hh:57
bool xn() const
Is execution allowed on this mapping?
virtual uint8_t ap() const =0
virtual uint64_t getRawData() const
virtual TlbEntry::DomainType domain() const
virtual const std::string name() const
Definition: sim_object.hh:128
std::list< WalkerState * > pendingQueue
Queue of requests that have passed are waiting because the walker is currently busy.
Tick startTime
Timestamp for calculating elapsed time in service (for stats)
Stats::Scalar statWalks
Statistics.
uint64_t data
The raw bits of the entry.
ThreadContext * tc
Thread context that we&#39;re doing the walk for.
Definition: global.h:77
bool pxn() const
Is privileged execution allowed on this mapping? (LPAE only)
static const unsigned COMPLETED
virtual uint64_t getRawData() const =0
Definition: eventq.hh:246
bool xn() const
Is execution allowed on this mapping?
EventFunctionWrapper doProcessEvent
const SimObjectParams * _params
Cached copy of the object parameters.
Definition: sim_object.hh:110
LongDescriptor longDesc
Long-format descriptor (LPAE and AArch64)
unsigned levels
Page entries walked during service (for stats)
Level 2 page table descriptor.
TlbEntry::DomainType domain() const
Domain Client/Manager: ARM DDI 0406B: B3-31.
TlbEntry::DomainType domain() const
virtual std::string dbgHeader() const
BaseTLB::Mode mode
Save mode for use in delayed response.
Bitfield< 31 > rw
uint16_t asid
ASID that we&#39;re servicing the request under.
Stats::Scalar statWalksLongDescriptor
VTCR_t vtcr
Cached copy of the vtcr as it existed when translation began.
Stats::Vector2d statRequestOrigin
Addr paddr(Addr va) const
Return the complete physical address given a VA.
L1Descriptor l1Desc
Short-format descriptors.
void setTlb(TLB *_tlb)
void nextWalk(ThreadContext *tc)
uint32_t data
The raw bits of the entry.
virtual std::string dbgHeader() const =0
bool secure(bool have_security, WalkerState *currState) const
Returns true if this entry targets the secure physical address map.
Addr nextDescAddr(Addr va) const
Return the address of the next descriptor.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:235
FaultSource
Generic fault source enums used to index into {short/long/aarch64}DescFaultSources[] to get the actua...
Definition: faults.hh:90
uint8_t sh() const
2-bit shareability field
Addr paddr() const
Return the physical address of the entry.
L2Descriptor(L1Descriptor &parent)
bool secureLookup
Helper variables used to implement hierarchical access permissions when the long-desc.
Stage2MMU * stage2Mmu
The MMU to forward second stage look upts to.
A 2-Dimensional vecto of scalar stats.
Definition: statistics.hh:2575
EntryType
Type of page table entry ARM DDI 0406B: B3-8.
Definition: table_walker.hh:95
bool aarch64
True if the current lookup is performed in AArch64 state.
T mbits(T val, int first, int last)
Mask off the given bits in place like bits() but without shifting.
Definition: bitfield.hh:95
bool aarch64
If the access is performed in AArch64 state.
T bits(T val, int first, int last)
Extract the bitfield from position &#39;first&#39; to &#39;last&#39; (inclusive) from &#39;val&#39; and right justify it...
Definition: bitfield.hh:71
ArmTableWalkerParams Params
const bool isStage2
Indicates whether this table walker is part of the stage 2 mmu.
bool af() const
Returns true if the access flag (AF) is set.
void setAp0()
Set access flag that this entry has been touched.
static bool checkAddrSizeFaultAArch64(Addr addr, int currPhysAddrRange)
Returns true if the address exceeds the range permitted by the system-wide setting or by the TCR_ELx ...
Bitfield< 0 > p
LookupLevel
Definition: pagetable.hh:74
uint8_t ap() const
Three bit access protection flags.
bool user() const
User/privileged level access protection flag.
const char data[]
std::shared_ptr< FaultBase > Fault
Definition: types.hh:238
EventFunctionWrapper doL1LongDescEvent
Addr nextTableAddr() const
Return the address of the next page table.
Long-descriptor format (LPAE)
void setAf()
Set access flag that this entry has been touched.
bool pxnTable() const
Is privileged execution allowed on subsequent lookup levels?
void memAttrsAArch64(ThreadContext *tc, TlbEntry &te, LongDescriptor &lDescriptor)
Addr vaddr_tainted
The virtual address that is being translated.
EventFunctionWrapper doL2DescEvent
RequestPtr req
Request that is currently being serviced.
bool delayed
Whether the response is delayed in timing mode due to additional lookups.
uint8_t rwTable() const
R/W protection flag for subsequent levels of lookup.
void setAp0()
Set access flag that this entry has been touched.
TLB::Translation * stage2Tran
A pointer to the stage 2 translation that&#39;s in progress.
Stats::Vector statPageSizes
bool global(WalkerState *currState) const
Is the translation global (no asid used)?
bool _dirty
This entry has been modified (access flag set) and needs to be written back to memory.

Generated on Mon Jun 8 2020 15:34:40 for gem5 by doxygen 1.8.13