gem5  v19.0.0.0
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  * Authors: Ali Saidi
38  * Giacomo Gabrielli
39  */
40 
41 #ifndef __ARCH_ARM_TABLE_WALKER_HH__
42 #define __ARCH_ARM_TABLE_WALKER_HH__
43 
44 #include <list>
45 
46 #include "arch/arm/faults.hh"
47 #include "arch/arm/miscregs.hh"
48 #include "arch/arm/system.hh"
49 #include "arch/arm/tlb.hh"
50 #include "mem/request.hh"
51 #include "params/ArmTableWalker.hh"
52 #include "sim/clocked_object.hh"
53 #include "sim/eventq.hh"
54 
55 class ThreadContext;
56 
57 class DmaPort;
58 
59 namespace ArmISA {
60 class Translation;
61 class TLB;
62 class Stage2MMU;
63 
64 class TableWalker : public ClockedObject
65 {
66  public:
67  class WalkerState;
68 
70  public:
72 
75 
76  virtual Addr pfn() const = 0;
77  virtual TlbEntry::DomainType domain() const = 0;
78  virtual bool xn() const = 0;
79  virtual uint8_t ap() const = 0;
80  virtual bool global(WalkerState *currState) const = 0;
81  virtual uint8_t offsetBits() const = 0;
82  virtual bool secure(bool have_security, WalkerState *currState) const = 0;
83  virtual std::string dbgHeader() const = 0;
84  virtual uint64_t getRawData() const = 0;
85  virtual uint8_t texcb() const
86  {
87  panic("texcb() not implemented for this class\n");
88  }
89  virtual bool shareable() const
90  {
91  panic("shareable() not implemented for this class\n");
92  }
93  };
94 
95  class L1Descriptor : public DescriptorBase {
96  public:
98  enum EntryType {
102  Reserved
103  };
104 
106  uint32_t data;
107 
110  bool _dirty;
111 
113  L1Descriptor() : data(0), _dirty(false)
114  {
115  lookupLevel = L1;
116  }
117 
118  virtual uint64_t getRawData() const
119  {
120  return (data);
121  }
122 
123  virtual std::string dbgHeader() const
124  {
125  return "Inserting Section Descriptor into TLB\n";
126  }
127 
128  virtual uint8_t offsetBits() const
129  {
130  return 20;
131  }
132 
133  EntryType type() const
134  {
135  return (EntryType)(data & 0x3);
136  }
137 
139  bool supersection() const
140  {
141  return bits(data, 18);
142  }
143 
145  Addr paddr() const
146  {
147  if (supersection())
148  panic("Super sections not implemented\n");
149  return mbits(data, 31, 20);
150  }
152  Addr paddr(Addr va) const
153  {
154  if (supersection())
155  panic("Super sections not implemented\n");
156  return mbits(data, 31, 20) | mbits(va, 19, 0);
157  }
158 
159 
161  Addr pfn() const
162  {
163  if (supersection())
164  panic("Super sections not implemented\n");
165  return bits(data, 31, 20);
166  }
167 
170  {
171  return !bits(data, 17);
172  }
173 
175  bool xn() const
176  {
177  return bits(data, 4);
178  }
179 
181  uint8_t ap() const
182  {
183  return (bits(data, 15) << 2) | bits(data, 11, 10);
184  }
185 
188  {
189  return static_cast<TlbEntry::DomainType>(bits(data, 8, 5));
190  }
191 
193  Addr l2Addr() const
194  {
195  return mbits(data, 31, 10);
196  }
197 
203  uint8_t texcb() const
204  {
205  return bits(data, 2) | bits(data, 3) << 1 | bits(data, 14, 12) << 2;
206  }
207 
209  bool shareable() const
210  {
211  return bits(data, 16);
212  }
213 
217  void setAp0()
218  {
219  data |= 1 << 10;
220  _dirty = true;
221  }
222 
224  bool dirty() const
225  {
226  return _dirty;
227  }
228 
233  bool secure(bool have_security, WalkerState *currState) const
234  {
235  if (have_security) {
236  if (type() == PageTable)
237  return !bits(data, 3);
238  else
239  return !bits(data, 19);
240  }
241  return false;
242  }
243  };
244 
246  class L2Descriptor : public DescriptorBase {
247  public:
249  uint32_t data;
251 
254  bool _dirty;
255 
257  L2Descriptor() : data(0), l1Parent(nullptr), _dirty(false)
258  {
259  lookupLevel = L2;
260  }
261 
262  L2Descriptor(L1Descriptor &parent) : data(0), l1Parent(&parent),
263  _dirty(false)
264  {
265  lookupLevel = L2;
266  }
267 
268  virtual uint64_t getRawData() const
269  {
270  return (data);
271  }
272 
273  virtual std::string dbgHeader() const
274  {
275  return "Inserting L2 Descriptor into TLB\n";
276  }
277 
278  virtual TlbEntry::DomainType domain() const
279  {
280  return l1Parent->domain();
281  }
282 
283  bool secure(bool have_security, WalkerState *currState) const
284  {
285  return l1Parent->secure(have_security, currState);
286  }
287 
288  virtual uint8_t offsetBits() const
289  {
290  return large() ? 16 : 12;
291  }
292 
294  bool invalid() const
295  {
296  return bits(data, 1, 0) == 0;
297  }
298 
300  bool large() const
301  {
302  return bits(data, 1) == 0;
303  }
304 
306  bool xn() const
307  {
308  return large() ? bits(data, 15) : bits(data, 0);
309  }
310 
313  {
314  return !bits(data, 11);
315  }
316 
318  uint8_t ap() const
319  {
320  return bits(data, 5, 4) | (bits(data, 9) << 2);
321  }
322 
324  uint8_t texcb() const
325  {
326  return large() ?
327  (bits(data, 2) | (bits(data, 3) << 1) | (bits(data, 14, 12) << 2)) :
328  (bits(data, 2) | (bits(data, 3) << 1) | (bits(data, 8, 6) << 2));
329  }
330 
332  Addr pfn() const
333  {
334  return large() ? bits(data, 31, 16) : bits(data, 31, 12);
335  }
336 
338  Addr paddr(Addr va) const
339  {
340  if (large())
341  return mbits(data, 31, 16) | mbits(va, 15, 0);
342  else
343  return mbits(data, 31, 12) | mbits(va, 11, 0);
344  }
345 
347  bool shareable() const
348  {
349  return bits(data, 10);
350  }
351 
355  void setAp0()
356  {
357  data |= 1 << 4;
358  _dirty = true;
359  }
360 
362  bool dirty() const
363  {
364  return _dirty;
365  }
366 
367  };
368 
369  // Granule sizes for AArch64 long descriptors
370  enum GrainSize {
371  Grain4KB = 12,
372  Grain16KB = 14,
373  Grain64KB = 16,
375  };
376 
379  public:
381  enum EntryType {
385  Page
386  };
387 
388  LongDescriptor() : data(0), _dirty(false) {}
389 
391  uint64_t data;
392 
395  bool _dirty;
396 
397  virtual uint64_t getRawData() const
398  {
399  return (data);
400  }
401 
402  virtual std::string dbgHeader() const
403  {
404  if (type() == LongDescriptor::Page) {
405  assert(lookupLevel == L3);
406  return "Inserting Page descriptor into TLB\n";
407  } else {
408  assert(lookupLevel < L3);
409  return "Inserting Block descriptor into TLB\n";
410  }
411  }
412 
417  bool secure(bool have_security, WalkerState *currState) const
418  {
419  assert(type() == Block || type() == Page);
420  return have_security && (currState->secureLookup && !bits(data, 5));
421  }
422 
424  bool aarch64;
425 
428 
430  EntryType type() const
431  {
432  switch (bits(data, 1, 0)) {
433  case 0x1:
434  // In AArch64 blocks are not allowed at L0 for the 4 KB granule
435  // and at L1 for 16/64 KB granules
436  if (grainSize > Grain4KB)
437  return lookupLevel == L2 ? Block : Invalid;
438  return lookupLevel == L0 || lookupLevel == L3 ? Invalid : Block;
439  case 0x3:
440  return lookupLevel == L3 ? Page : Table;
441  default:
442  return Invalid;
443  }
444  }
445 
447  uint8_t offsetBits() const
448  {
449  if (type() == Block) {
450  switch (grainSize) {
451  case Grain4KB:
452  return lookupLevel == L1 ? 30 /* 1 GB */
453  : 21 /* 2 MB */;
454  case Grain16KB:
455  return 25 /* 32 MB */;
456  case Grain64KB:
457  return 29 /* 512 MB */;
458  default:
459  panic("Invalid AArch64 VM granule size\n");
460  }
461  } else if (type() == Page) {
462  switch (grainSize) {
463  case Grain4KB:
464  case Grain16KB:
465  case Grain64KB:
466  return grainSize; /* enum -> uint okay */
467  default:
468  panic("Invalid AArch64 VM granule size\n");
469  }
470  } else {
471  panic("AArch64 page table entry must be block or page\n");
472  }
473  }
474 
476  Addr pfn() const
477  {
478  if (aarch64)
479  return bits(data, 47, offsetBits());
480  return bits(data, 39, offsetBits());
481  }
482 
484  Addr paddr(Addr va) const
485  {
486  int n = offsetBits();
487  if (aarch64)
488  return mbits(data, 47, n) | mbits(va, n - 1, 0);
489  return mbits(data, 39, n) | mbits(va, n - 1, 0);
490  }
491 
493  Addr paddr() const
494  {
495  if (aarch64)
496  return mbits(data, 47, offsetBits());
497  return mbits(data, 39, offsetBits());
498  }
499 
502  {
503  assert(type() == Table);
504  if (aarch64)
505  return mbits(data, 47, grainSize);
506  else
507  return mbits(data, 39, 12);
508  }
509 
512  {
513  assert(type() == Table);
514  Addr pa = 0;
515  if (aarch64) {
516  int stride = grainSize - 3;
517  int va_lo = stride * (3 - (lookupLevel + 1)) + grainSize;
518  int va_hi = va_lo + stride - 1;
519  pa = nextTableAddr() | (bits(va, va_hi, va_lo) << 3);
520  } else {
521  if (lookupLevel == L1)
522  pa = nextTableAddr() | (bits(va, 29, 21) << 3);
523  else // lookupLevel == L2
524  pa = nextTableAddr() | (bits(va, 20, 12) << 3);
525  }
526  return pa;
527  }
528 
530  bool xn() const
531  {
532  assert(type() == Block || type() == Page);
533  return bits(data, 54);
534  }
535 
537  bool pxn() const
538  {
539  assert(type() == Block || type() == Page);
540  return bits(data, 53);
541  }
542 
544  bool contiguousHint() const
545  {
546  assert(type() == Block || type() == Page);
547  return bits(data, 52);
548  }
549 
552  {
553  assert(currState && (type() == Block || type() == Page));
554  if (!currState->aarch64 && (currState->isSecure &&
555  !currState->secureLookup)) {
556  return false; // ARM ARM issue C B3.6.3
557  } else if (currState->aarch64) {
558  if (currState->el == EL2 || currState->el == EL3) {
559  return true; // By default translations are treated as global
560  // in AArch64 EL2 and EL3
561  } else if (currState->isSecure && !currState->secureLookup) {
562  return false;
563  }
564  }
565  return !bits(data, 11);
566  }
567 
569  bool af() const
570  {
571  assert(type() == Block || type() == Page);
572  return bits(data, 10);
573  }
574 
576  uint8_t sh() const
577  {
578  assert(type() == Block || type() == Page);
579  return bits(data, 9, 8);
580  }
581 
583  uint8_t ap() const
584  {
585  assert(type() == Block || type() == Page);
586  // Long descriptors only support the AP[2:1] scheme
587  return bits(data, 7, 6);
588  }
589 
591  bool rw() const
592  {
593  assert(type() == Block || type() == Page);
594  return !bits(data, 7);
595  }
596 
598  bool user() const
599  {
600  assert(type() == Block || type() == Page);
601  return bits(data, 6);
602  }
603 
607  static uint8_t ap(bool rw, bool user)
608  {
609  return ((!rw) << 2) | (user << 1);
610  }
611 
613  {
614  // Long-desc. format only supports Client domain
615  assert(type() == Block || type() == Page);
617  }
618 
620  uint8_t attrIndx() const
621  {
622  assert(type() == Block || type() == Page);
623  return bits(data, 4, 2);
624  }
625 
627  uint8_t memAttr() const
628  {
629  assert(type() == Block || type() == Page);
630  return bits(data, 5, 2);
631  }
632 
635  void setAf()
636  {
637  data |= 1 << 10;
638  _dirty = true;
639  }
640 
642  bool dirty() const
643  {
644  return _dirty;
645  }
646 
648  bool secureTable() const
649  {
650  assert(type() == Table);
651  return !bits(data, 63);
652  }
653 
655  uint8_t apTable() const
656  {
657  assert(type() == Table);
658  return bits(data, 62, 61);
659  }
660 
662  uint8_t rwTable() const
663  {
664  assert(type() == Table);
665  return !bits(data, 62);
666  }
667 
670  uint8_t userTable() const
671  {
672  assert(type() == Table);
673  return !bits(data, 61);
674  }
675 
677  bool xnTable() const
678  {
679  assert(type() == Table);
680  return bits(data, 60);
681  }
682 
684  bool pxnTable() const
685  {
686  assert(type() == Table);
687  return bits(data, 59);
688  }
689  };
690 
692  {
693  public:
696 
698  bool aarch64;
699 
702 
705 
708 
710  uint16_t asid;
711  uint8_t vmid;
712  bool isHyp;
713 
716 
719 
722 
725 
727  SCTLR sctlr;
728 
730  SCR scr;
731 
733  CPSR cpsr;
734 
736  union {
737  TTBCR ttbcr; // AArch32 translations
738  TCR tcr; // AArch64 translations
739  };
740 
742  HTCR htcr;
743 
745  HCR hcr;
746 
748  VTCR_t vtcr;
749 
751  bool isWrite;
752 
754  bool isFetch;
755 
757  bool isSecure;
758 
761 
765  bool rwTable;
766  bool userTable;
767  bool xnTable;
768  bool pxnTable;
769 
771  bool hpd;
772 
774  bool stage2Req;
775 
778 
780  bool timing;
781 
784 
787 
790 
794 
797 
800  bool delayed;
801 
803 
806 
808  unsigned levels;
809 
810  void doL1Descriptor();
811  void doL2Descriptor();
812 
813  void doLongDescriptor();
814 
815  WalkerState();
816 
817  std::string name() const { return tableWalker->name(); }
818  };
819 
820  protected:
821 
824 
828 
831 
834 
837 
839  const bool isStage2;
840 
843 
845  SCTLR sctlr;
846 
848 
850  bool pending;
851 
854  unsigned numSquashable;
855 
858  bool _haveLPAE;
860  uint8_t physAddrRange;
862 
873  Stats::Histogram statPendingWalks; // essentially "L" of queueing theory
876 
877  mutable unsigned pendingReqs;
879 
880  static const unsigned REQUESTED = 0;
881  static const unsigned COMPLETED = 1;
882 
883  public:
884  typedef ArmTableWalkerParams Params;
885  TableWalker(const Params *p);
886  virtual ~TableWalker();
887 
888  const Params *
889  params() const
890  {
891  return dynamic_cast<const Params *>(_params);
892  }
893 
894  void init() override;
895 
896  bool haveLPAE() const { return _haveLPAE; }
897  bool haveVirtualization() const { return _haveVirtualization; }
898  bool haveLargeAsid64() const { return _haveLargeAsid64; }
900  void completeDrain();
901  DrainState drain() override;
902  void drainResume() override;
903 
904  Port &getPort(const std::string &if_name,
905  PortID idx=InvalidPortID) override;
906 
907  void regStats() override;
908 
909  Fault walk(const RequestPtr &req, ThreadContext *tc,
910  uint16_t asid, uint8_t _vmid,
911  bool _isHyp, TLB::Mode mode, TLB::Translation *_trans,
912  bool timing, bool functional, bool secure,
913  TLB::ArmTranslationType tranType, bool _stage2Req);
914 
915  void setTlb(TLB *_tlb) { tlb = _tlb; }
916  TLB* getTlb() { return tlb; }
917  void setMMU(Stage2MMU *m, MasterID master_id);
918  void memAttrs(ThreadContext *tc, TlbEntry &te, SCTLR sctlr,
919  uint8_t texcb, bool s);
920  void memAttrsLPAE(ThreadContext *tc, TlbEntry &te,
921  LongDescriptor &lDescriptor);
922  void memAttrsAArch64(ThreadContext *tc, TlbEntry &te,
923  LongDescriptor &lDescriptor);
924 
925  static LookupLevel toLookupLevel(uint8_t lookup_level_as_int);
926 
927  private:
928 
929  void doL1Descriptor();
930  void doL1DescriptorWrapper();
932 
933  void doL2Descriptor();
934  void doL2DescriptorWrapper();
936 
937  void doLongDescriptor();
938 
947 
948  void doLongDescriptorWrapper(LookupLevel curr_lookup_level);
950 
951  bool fetchDescriptor(Addr descAddr, uint8_t *data, int numBytes,
952  Request::Flags flags, int queueIndex, Event *event,
953  void (TableWalker::*doDescriptor)());
954 
956 
957  void insertTableEntry(DescriptorBase &descriptor, bool longDescriptor);
958 
959  Fault processWalk();
961  static unsigned adjustTableSizeAArch64(unsigned tsz);
964  static bool checkAddrSizeFaultAArch64(Addr addr, int currPhysAddrRange);
966  void processWalkWrapper();
968 
969  void nextWalk(ThreadContext *tc);
970 
971  void pendingChange();
972 
973  static uint8_t pageSizeNtoStatBin(uint8_t N);
974 
976  LookupLevel lookup_level);
977 };
978 
979 } // namespace ArmISA
980 
981 #endif //__ARCH_ARM_TABLE_WALKER_HH__
982 
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:167
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:60
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:74
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:238
DrainState
Object drain/handover states.
Definition: drain.hh:71
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:83
virtual std::string dbgHeader() const
static uint8_t pageSizeNtoStatBin(uint8_t N)
Stats::Vector statWalksShortTerminatedAtLevel
ip6_addr_t addr
Definition: inet.hh:335
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:59
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:85
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:2550
Definition: ccregs.hh:42
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:2508
Addr vaddr
The virtual address that is being translated with tagging removed.
virtual bool secure(bool have_security, WalkerState *currState) const =0
DmaPort * port
Port shared by the two table walkers.
ExceptionLevel
Definition: types.hh:585
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:333
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:96
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:63
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)
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:2629
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:54
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:125
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
uint16_t MasterID
Definition: request.hh:86
virtual const std::string name() const
Definition: sim_object.hh:120
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:59
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
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:189
bool xn() const
Is execution allowed on this mapping?
EventFunctionWrapper doProcessEvent
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.
const SimObjectParams * _params
Cached copy of the object parameters.
Definition: sim_object.hh:110
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:237
FaultSource
Generic fault source enums used to index into {short/long/aarch64}DescFaultSources[] to get the actua...
Definition: faults.hh:95
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:2578
EntryType
Type of page table entry ARM DDI 0406B: B3-8.
Definition: table_walker.hh:98
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:96
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:72
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:77
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:240
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 Fri Feb 28 2020 16:26:57 for gem5 by doxygen 1.8.13