gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
table_walker.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010-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  * 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/miscregs.hh"
47 #include "arch/arm/system.hh"
48 #include "arch/arm/tlb.hh"
49 #include "mem/request.hh"
50 #include "params/ArmTableWalker.hh"
51 #include "sim/eventq.hh"
52 
53 class ThreadContext;
54 
55 class DmaPort;
56 
57 namespace ArmISA {
58 class Translation;
59 class TLB;
60 class Stage2MMU;
61 
62 class TableWalker : public MemObject
63 {
64  public:
65  class WalkerState;
66 
68  public:
71 
72  virtual Addr pfn() const = 0;
73  virtual TlbEntry::DomainType domain() const = 0;
74  virtual bool xn() const = 0;
75  virtual uint8_t ap() const = 0;
76  virtual bool global(WalkerState *currState) const = 0;
77  virtual uint8_t offsetBits() const = 0;
78  virtual bool secure(bool have_security, WalkerState *currState) const = 0;
79  virtual std::string dbgHeader() const = 0;
80  virtual uint64_t getRawData() const = 0;
81  virtual uint8_t texcb() const
82  {
83  panic("texcb() not implemented for this class\n");
84  }
85  virtual bool shareable() const
86  {
87  panic("shareable() not implemented for this class\n");
88  }
89  };
90 
91  class L1Descriptor : public DescriptorBase {
92  public:
94  enum EntryType {
99  };
100 
102  uint32_t data;
103 
106  bool _dirty;
107 
109  L1Descriptor() : data(0), _dirty(false)
110  {
111  lookupLevel = L1;
112  }
113 
114  virtual uint64_t getRawData() const
115  {
116  return (data);
117  }
118 
119  virtual std::string dbgHeader() const
120  {
121  return "Inserting Section Descriptor into TLB\n";
122  }
123 
124  virtual uint8_t offsetBits() const
125  {
126  return 20;
127  }
128 
129  EntryType type() const
130  {
131  return (EntryType)(data & 0x3);
132  }
133 
135  bool supersection() const
136  {
137  return bits(data, 18);
138  }
139 
141  Addr paddr() const
142  {
143  if (supersection())
144  panic("Super sections not implemented\n");
145  return mbits(data, 31, 20);
146  }
148  Addr paddr(Addr va) const
149  {
150  if (supersection())
151  panic("Super sections not implemented\n");
152  return mbits(data, 31, 20) | mbits(va, 19, 0);
153  }
154 
155 
157  Addr pfn() const
158  {
159  if (supersection())
160  panic("Super sections not implemented\n");
161  return bits(data, 31, 20);
162  }
163 
166  {
167  return !bits(data, 17);
168  }
169 
171  bool xn() const
172  {
173  return bits(data, 4);
174  }
175 
177  uint8_t ap() const
178  {
179  return (bits(data, 15) << 2) | bits(data, 11, 10);
180  }
181 
184  {
185  return static_cast<TlbEntry::DomainType>(bits(data, 8, 5));
186  }
187 
189  Addr l2Addr() const
190  {
191  return mbits(data, 31, 10);
192  }
193 
199  uint8_t texcb() const
200  {
201  return bits(data, 2) | bits(data, 3) << 1 | bits(data, 14, 12) << 2;
202  }
203 
205  bool shareable() const
206  {
207  return bits(data, 16);
208  }
209 
213  void setAp0()
214  {
215  data |= 1 << 10;
216  _dirty = true;
217  }
218 
220  bool dirty() const
221  {
222  return _dirty;
223  }
224 
229  bool secure(bool have_security, WalkerState *currState) const
230  {
231  if (have_security) {
232  if (type() == PageTable)
233  return !bits(data, 3);
234  else
235  return !bits(data, 19);
236  }
237  return false;
238  }
239  };
240 
242  class L2Descriptor : public DescriptorBase {
243  public:
245  uint32_t data;
247 
250  bool _dirty;
251 
253  L2Descriptor() : data(0), l1Parent(nullptr), _dirty(false)
254  {
255  lookupLevel = L2;
256  }
257 
258  L2Descriptor(L1Descriptor &parent) : data(0), l1Parent(&parent),
259  _dirty(false)
260  {
261  lookupLevel = L2;
262  }
263 
264  virtual uint64_t getRawData() const
265  {
266  return (data);
267  }
268 
269  virtual std::string dbgHeader() const
270  {
271  return "Inserting L2 Descriptor into TLB\n";
272  }
273 
274  virtual TlbEntry::DomainType domain() const
275  {
276  return l1Parent->domain();
277  }
278 
279  bool secure(bool have_security, WalkerState *currState) const
280  {
281  return l1Parent->secure(have_security, currState);
282  }
283 
284  virtual uint8_t offsetBits() const
285  {
286  return large() ? 16 : 12;
287  }
288 
290  bool invalid() const
291  {
292  return bits(data, 1, 0) == 0;
293  }
294 
296  bool large() const
297  {
298  return bits(data, 1) == 0;
299  }
300 
302  bool xn() const
303  {
304  return large() ? bits(data, 15) : bits(data, 0);
305  }
306 
309  {
310  return !bits(data, 11);
311  }
312 
314  uint8_t ap() const
315  {
316  return bits(data, 5, 4) | (bits(data, 9) << 2);
317  }
318 
320  uint8_t texcb() const
321  {
322  return large() ?
323  (bits(data, 2) | (bits(data, 3) << 1) | (bits(data, 14, 12) << 2)) :
324  (bits(data, 2) | (bits(data, 3) << 1) | (bits(data, 8, 6) << 2));
325  }
326 
328  Addr pfn() const
329  {
330  return large() ? bits(data, 31, 16) : bits(data, 31, 12);
331  }
332 
334  Addr paddr(Addr va) const
335  {
336  if (large())
337  return mbits(data, 31, 16) | mbits(va, 15, 0);
338  else
339  return mbits(data, 31, 12) | mbits(va, 11, 0);
340  }
341 
343  bool shareable() const
344  {
345  return bits(data, 10);
346  }
347 
351  void setAp0()
352  {
353  data |= 1 << 4;
354  _dirty = true;
355  }
356 
358  bool dirty() const
359  {
360  return _dirty;
361  }
362 
363  };
364 
365  // Granule sizes for AArch64 long descriptors
366  enum GrainSize {
367  Grain4KB = 12,
368  Grain16KB = 14,
369  Grain64KB = 16,
371  };
372 
375  public:
377  enum EntryType {
382  };
383 
385  uint64_t data;
386 
389  bool _dirty;
390 
391  virtual uint64_t getRawData() const
392  {
393  return (data);
394  }
395 
396  virtual std::string dbgHeader() const
397  {
398  if (type() == LongDescriptor::Page) {
399  assert(lookupLevel == L3);
400  return "Inserting Page descriptor into TLB\n";
401  } else {
402  assert(lookupLevel < L3);
403  return "Inserting Block descriptor into TLB\n";
404  }
405  }
406 
411  bool secure(bool have_security, WalkerState *currState) const
412  {
413  assert(type() == Block || type() == Page);
414  return have_security && (currState->secureLookup && !bits(data, 5));
415  }
416 
418  bool aarch64;
419 
422 
424  EntryType type() const
425  {
426  switch (bits(data, 1, 0)) {
427  case 0x1:
428  // In AArch64 blocks are not allowed at L0 for the 4 KB granule
429  // and at L1 for 16/64 KB granules
430  if (grainSize > Grain4KB)
431  return lookupLevel == L2 ? Block : Invalid;
432  return lookupLevel == L0 || lookupLevel == L3 ? Invalid : Block;
433  case 0x3:
434  return lookupLevel == L3 ? Page : Table;
435  default:
436  return Invalid;
437  }
438  }
439 
441  uint8_t offsetBits() const
442  {
443  if (type() == Block) {
444  switch (grainSize) {
445  case Grain4KB:
446  return lookupLevel == L1 ? 30 /* 1 GB */
447  : 21 /* 2 MB */;
448  case Grain16KB:
449  return 25 /* 32 MB */;
450  case Grain64KB:
451  return 29 /* 512 MB */;
452  default:
453  panic("Invalid AArch64 VM granule size\n");
454  }
455  } else if (type() == Page) {
456  switch (grainSize) {
457  case Grain4KB:
458  case Grain16KB:
459  case Grain64KB:
460  return grainSize; /* enum -> uint okay */
461  default:
462  panic("Invalid AArch64 VM granule size\n");
463  }
464  } else {
465  panic("AArch64 page table entry must be block or page\n");
466  }
467  }
468 
470  Addr pfn() const
471  {
472  if (aarch64)
473  return bits(data, 47, offsetBits());
474  return bits(data, 39, offsetBits());
475  }
476 
478  Addr paddr(Addr va) const
479  {
480  int n = offsetBits();
481  if (aarch64)
482  return mbits(data, 47, n) | mbits(va, n - 1, 0);
483  return mbits(data, 39, n) | mbits(va, n - 1, 0);
484  }
485 
487  Addr paddr() const
488  {
489  if (aarch64)
490  return mbits(data, 47, offsetBits());
491  return mbits(data, 39, offsetBits());
492  }
493 
496  {
497  assert(type() == Table);
498  if (aarch64)
499  return mbits(data, 47, grainSize);
500  else
501  return mbits(data, 39, 12);
502  }
503 
506  {
507  assert(type() == Table);
508  Addr pa = 0;
509  if (aarch64) {
510  int stride = grainSize - 3;
511  int va_lo = stride * (3 - (lookupLevel + 1)) + grainSize;
512  int va_hi = va_lo + stride - 1;
513  pa = nextTableAddr() | (bits(va, va_hi, va_lo) << 3);
514  } else {
515  if (lookupLevel == L1)
516  pa = nextTableAddr() | (bits(va, 29, 21) << 3);
517  else // lookupLevel == L2
518  pa = nextTableAddr() | (bits(va, 20, 12) << 3);
519  }
520  return pa;
521  }
522 
524  bool xn() const
525  {
526  assert(type() == Block || type() == Page);
527  return bits(data, 54);
528  }
529 
531  bool pxn() const
532  {
533  assert(type() == Block || type() == Page);
534  return bits(data, 53);
535  }
536 
538  bool contiguousHint() const
539  {
540  assert(type() == Block || type() == Page);
541  return bits(data, 52);
542  }
543 
546  {
547  assert(currState && (type() == Block || type() == Page));
548  if (!currState->aarch64 && (currState->isSecure &&
549  !currState->secureLookup)) {
550  return false; // ARM ARM issue C B3.6.3
551  } else if (currState->aarch64) {
552  if (currState->el == EL2 || currState->el == EL3) {
553  return true; // By default translations are treated as global
554  // in AArch64 EL2 and EL3
555  } else if (currState->isSecure && !currState->secureLookup) {
556  return false;
557  }
558  }
559  return !bits(data, 11);
560  }
561 
563  bool af() const
564  {
565  assert(type() == Block || type() == Page);
566  return bits(data, 10);
567  }
568 
570  uint8_t sh() const
571  {
572  assert(type() == Block || type() == Page);
573  return bits(data, 9, 8);
574  }
575 
577  uint8_t ap() const
578  {
579  assert(type() == Block || type() == Page);
580  // Long descriptors only support the AP[2:1] scheme
581  return bits(data, 7, 6);
582  }
583 
585  bool rw() const
586  {
587  assert(type() == Block || type() == Page);
588  return !bits(data, 7);
589  }
590 
592  bool user() const
593  {
594  assert(type() == Block || type() == Page);
595  return bits(data, 6);
596  }
597 
601  static uint8_t ap(bool rw, bool user)
602  {
603  return ((!rw) << 2) | (user << 1);
604  }
605 
607  {
608  // Long-desc. format only supports Client domain
609  assert(type() == Block || type() == Page);
611  }
612 
614  uint8_t attrIndx() const
615  {
616  assert(type() == Block || type() == Page);
617  return bits(data, 4, 2);
618  }
619 
621  uint8_t memAttr() const
622  {
623  assert(type() == Block || type() == Page);
624  return bits(data, 5, 2);
625  }
626 
629  void setAf()
630  {
631  data |= 1 << 10;
632  _dirty = true;
633  }
634 
636  bool dirty() const
637  {
638  return _dirty;
639  }
640 
642  bool secureTable() const
643  {
644  assert(type() == Table);
645  return !bits(data, 63);
646  }
647 
649  uint8_t apTable() const
650  {
651  assert(type() == Table);
652  return bits(data, 62, 61);
653  }
654 
656  uint8_t rwTable() const
657  {
658  assert(type() == Table);
659  return !bits(data, 62);
660  }
661 
664  uint8_t userTable() const
665  {
666  assert(type() == Table);
667  return !bits(data, 61);
668  }
669 
671  bool xnTable() const
672  {
673  assert(type() == Table);
674  return bits(data, 60);
675  }
676 
678  bool pxnTable() const
679  {
680  assert(type() == Table);
681  return bits(data, 59);
682  }
683  };
684 
686  {
687  public:
690 
692  bool aarch64;
693 
696 
699 
702 
704  uint16_t asid;
705  uint8_t vmid;
706  bool isHyp;
707 
710 
713 
716 
719 
721  SCTLR sctlr;
722 
724  SCR scr;
725 
727  CPSR cpsr;
728 
730  union {
731  TTBCR ttbcr; // AArch32 translations
732  TCR tcr; // AArch64 translations
733  };
734 
736  HTCR htcr;
737 
739  HCR hcr;
740 
742  VTCR_t vtcr;
743 
745  bool isWrite;
746 
748  bool isFetch;
749 
751  bool isSecure;
752 
756  bool rwTable;
757  bool userTable;
758  bool xnTable;
759  bool pxnTable;
760 
762  bool stage2Req;
763 
768 
771 
773  bool timing;
774 
777 
780 
783 
787 
790 
793  bool delayed;
794 
796 
799 
801  unsigned levels;
802 
803  void doL1Descriptor();
804  void doL2Descriptor();
805 
806  void doLongDescriptor();
807 
808  WalkerState();
809 
810  std::string name() const { return tableWalker->name(); }
811  };
812 
813  protected:
814 
817 
821 
824 
827 
830 
832  const bool isStage2;
833 
836 
838  SCTLR sctlr;
839 
841 
843  bool pending;
844 
847  unsigned numSquashable;
848 
851  bool _haveLPAE;
853  uint8_t physAddrRange;
855 
866  Stats::Histogram statPendingWalks; // essentially "L" of queueing theory
869 
870  mutable unsigned pendingReqs;
872 
873  static const unsigned REQUESTED = 0;
874  static const unsigned COMPLETED = 1;
875 
876  public:
877  typedef ArmTableWalkerParams Params;
878  TableWalker(const Params *p);
879  virtual ~TableWalker();
880 
881  const Params *
882  params() const
883  {
884  return dynamic_cast<const Params *>(_params);
885  }
886 
887  void init() override;
888 
889  bool haveLPAE() const { return _haveLPAE; }
890  bool haveVirtualization() const { return _haveVirtualization; }
891  bool haveLargeAsid64() const { return _haveLargeAsid64; }
893  void completeDrain();
894  DrainState drain() override;
895  void drainResume() override;
896 
897  BaseMasterPort& getMasterPort(const std::string &if_name,
898  PortID idx = InvalidPortID) override;
899 
900  void regStats() override;
901 
902  Fault walk(RequestPtr req, ThreadContext *tc, uint16_t asid, uint8_t _vmid,
903  bool _isHyp, TLB::Mode mode, TLB::Translation *_trans,
904  bool timing, bool functional, bool secure,
905  TLB::ArmTranslationType tranType, bool _stage2Req);
906 
907  void setTlb(TLB *_tlb) { tlb = _tlb; }
908  TLB* getTlb() { return tlb; }
909  void setMMU(Stage2MMU *m, MasterID master_id);
910  void memAttrs(ThreadContext *tc, TlbEntry &te, SCTLR sctlr,
911  uint8_t texcb, bool s);
913  LongDescriptor &lDescriptor);
915  LongDescriptor &lDescriptor);
916 
917  static LookupLevel toLookupLevel(uint8_t lookup_level_as_int);
918 
919  private:
920 
921  void doL1Descriptor();
922  void doL1DescriptorWrapper();
925 
926  void doL2Descriptor();
927  void doL2DescriptorWrapper();
930 
931  void doLongDescriptor();
932 
945 
946  void doLongDescriptorWrapper(LookupLevel curr_lookup_level);
948 
949  bool fetchDescriptor(Addr descAddr, uint8_t *data, int numBytes,
950  Request::Flags flags, int queueIndex, Event *event,
951  void (TableWalker::*doDescriptor)());
952 
953  void insertTableEntry(DescriptorBase &descriptor, bool longDescriptor);
954 
955  Fault processWalk();
957  static unsigned adjustTableSizeAArch64(unsigned tsz);
960  static bool checkAddrSizeFaultAArch64(Addr addr, int currPhysAddrRange);
962  void processWalkWrapper();
964 
965  void nextWalk(ThreadContext *tc);
966 
967  void pendingChange();
968 
969  static uint8_t pageSizeNtoStatBin(uint8_t N);
970 
972  LookupLevel lookup_level);
973 };
974 
975 } // namespace ArmISA
976 
977 #endif //__ARCH_ARM_TABLE_WALKER_HH__
978 
uint8_t ap() const
Three bit access protection flags.
void regStats() override
Register statistics for this object.
EventWrapper< TableWalker,&TableWalker::doL2LongDescriptorWrapper > doL2LongDescEvent
void memAttrsLPAE(ThreadContext *tc, TlbEntry &te, LongDescriptor &lDescriptor)
bool global(WalkerState *currState) const
Is the translation global (no asid used)?
bool global(WalkerState *currState) const
Is the translation global (no asid used)?
Bitfield< 15 > te
Definition: mt_constants.hh:62
EntryType type() const
Return the descriptor type.
Addr pfn() const
Return the physical frame, bits shifted right.
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
uint8_t attrIndx() const
Attribute index.
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:70
bool doingStage2
Indicates whether the translation has been passed onto the second stage mmu, and no more work is requ...
virtual uint64_t getRawData() const
virtual TlbEntry::DomainType domain() const =0
EventWrapper< TableWalker,&TableWalker::processWalkWrapper > doProcessEvent
uint32_t data
The raw bits of the entry.
virtual Addr pfn() const =0
const PortID InvalidPortID
Definition: types.hh:182
DrainState
Object drain/handover states.
Definition: drain.hh:71
Bitfield< 0 > m
Definition: miscregs.hh:1577
void doL3LongDescriptorWrapper()
#define panic(...)
Definition: misc.hh:153
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.
std::list< WalkerState * > stateQueues[MAX_LOOKUP_LEVELS]
Queues of requests for all the different lookup levels.
GrainSize grainSize
Width of the granule size in bits.
bool pending
If a timing translation is currently in progress.
Addr paddr(Addr va) const
Return the complete physical address given a VA.
Declaration of a request, the overall memory request consisting of the parts of the request that are ...
Bitfield< 21, 20 > stride
Definition: miscregs.hh:1627
static uint8_t pageSizeNtoStatBin(uint8_t N)
Stats::Vector statWalksShortTerminatedAtLevel
ip6_addr_t addr
Definition: inet.hh:335
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.
Stats::Histogram statPendingWalks
DrainState drain() override
Notify an object that it needs to drain its state.
bool haveSecurity
Cached copies of system-level properties.
bool af() const
Returns true if the access flag (AF) is set.
Stats::Scalar statWalksShortDescriptor
bool timing
If the mode is timing or atomic.
Stats::Scalar statSquashedBefore
A vector of scalar stats.
Definition: statistics.hh:2499
uint8_t offsetBits() const
Return the bit width of the page/block offset.
CPSR cpsr
Cached copy of the cpsr as it existed when translation began.
bool stage2Req
Flag indicating if a second stage of lookup is required.
Bitfield< 4, 0 > mode
Definition: miscregs.hh:1385
bool haveVirtualization() const
bool shareable() const
If the section is shareable.
TLB::Translation * transState
Translation state for delayed requests.
HTCR htcr
Cached copy of the htcr as it existed when translation began.
void doL2LongDescriptorWrapper()
bool user() const
User/privileged level access protection flag.
Addr paddr() const
Return the physcal address of the entry, bits in position.
ThreadContext is the external interface to all thread state for anything outside of the CPU...
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:2475
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:562
uint8_t memAttr() const
Memory attributes, only used by stage 2 translations.
Bitfield< 31 > n
Definition: miscregs.hh:1636
const char data[]
Definition: circlebuf.cc:43
void memAttrs(ThreadContext *tc, TlbEntry &te, SCTLR sctlr, uint8_t texcb, bool s)
Addr paddr(Addr va) const
Return complete physical address given a VA.
WalkerState * currState
bool xnTable() const
Is execution allowed on subsequent lookup levels?
bool large() const
What is the size of the mapping?
bool xn() const
Is execution allowed on this mapping?
virtual uint8_t offsetBits() const =0
uint8_t ap() const
Three bit access protection flags.
EventWrapper< TableWalker,&TableWalker::doL1DescriptorWrapper > doL1DescEvent
HCR hcr
Cached copy of the htcr as it existed when translation began.
bool xn() const
Is the translation not allow execution?
MasterID masterId
Master id assigned by the MMU.
Stats::Vector statWalksLongTerminatedAtLevel
bool secure(bool have_security, WalkerState *currState) const
Returns true if this entry targets the secure physical address map.
virtual ~TableWalker()
Definition: table_walker.cc:93
void insertTableEntry(DescriptorBase &descriptor, bool longDescriptor)
int physAddrRange
Current physical address range in bits.
Bitfield< 4 > s
Definition: miscregs.hh:1738
Fault fault
The fault that we are going to return.
bool invalid() const
Is the entry invalid.
static LookupLevel toLookupLevel(uint8_t lookup_level_as_int)
virtual bool xn() const =0
bool supersection() const
Is the page a Supersection (16MB)?
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.
bool pxn() const
Is privileged execution allowed on this mapping? (LPAE only)
void setMMU(Stage2MMU *m, MasterID master_id)
Definition: table_walker.cc:99
ExceptionLevel el
Current exception level.
void doL1LongDescriptorWrapper()
bool shareable() const
If the section is shareable.
bool isSecure
If the access comes from the secure state.
Bitfield< 39, 12 > pa
Definition: miscregs.hh:1829
TlbEntry::DomainType domain() const
A simple histogram stat.
Definition: statistics.hh:2551
virtual uint8_t texcb() const
Definition: table_walker.hh:81
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)
Event * LongDescEventByLevel[4]
bool contiguousHint() const
Contiguous hint bit.
Stats::Histogram statWalkServiceTime
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
Addr nextDescAddr(Addr va) const
Return the address of the next descriptor.
static unsigned adjustTableSizeAArch64(unsigned tsz)
uint8_t sh() const
2-bit shareability field
ArmTranslationType
Definition: tlb.hh:124
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
uint8_t userTable() const
User/privileged mode protection flag for subsequent levels of lookup.
uint16_t MasterID
Definition: request.hh:85
TlbEntry::DomainType domain() const
Domain Client/Manager: ARM DDI 0406B: B3-31.
uint8_t rwTable() const
R/W protection flag for subsequent levels of lookup.
Addr paddr() const
Return the physical address of the entry.
bool pxnTable() const
Is privileged execution allowed on subsequent lookup levels?
bool dirty() const
This entry needs to be written back to memory.
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.
bool secure(bool have_security, WalkerState *currState) const
bool rw() const
Read/write access protection flag.
Bitfield< 10, 5 > event
Bitfield< 8 > va
Definition: miscregs.hh:1473
bool _dirty
This entry has been modified (access flag set) and needs to be written back to memory.
Stats::Histogram statWalkWaitTime
const Params * params() const
Stats::Scalar statSquashedAfter
static const unsigned REQUESTED
TLB * tlb
TLB that is initiating these table walks.
bool dirty() const
This entry needs to be written back to memory.
SCR scr
Cached copy of the scr as it existed when translation began.
void drainResume() override
Resume execution after a successful drain.
Mode
Definition: tlb.hh:61
Addr pfn() const
Return the physical frame, bits shifted right.
virtual uint8_t ap() const =0
EventWrapper< TableWalker,&TableWalker::doL3LongDescriptorWrapper > doL3LongDescEvent
Addr paddr(Addr va) const
Return the physcal address of the entry, bits in position.
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)
int size()
Definition: pagetable.hh:146
Stats::Scalar statWalks
Statistics.
virtual const std::string name() const
Definition: sim_object.hh:117
uint64_t data
The raw bits of the entry.
ThreadContext * tc
Thread context that we're doing the walk for.
Bitfield< 7, 4 > domain
Definition: miscregs.hh:1605
static const unsigned COMPLETED
Addr pfn() const
Return the physical frame, bits shifted right.
virtual uint64_t getRawData() const =0
bool xn() const
Is execution allowed on this mapping?
Definition: eventq.hh:185
virtual uint8_t offsetBits() const
Fault walk(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)
EventWrapper< TableWalker,&TableWalker::doL0LongDescriptorWrapper > doL0LongDescEvent
The MemObject class extends the ClockedObject with accessor functions to get its master and slave por...
Definition: mem_object.hh:60
LongDescriptor longDesc
Long-format descriptor (LPAE and AArch64)
A BaseMasterPort is a protocol-agnostic master port, responsible only for the structural connection t...
Definition: port.hh:115
unsigned levels
Page entries walked during service (for stats)
Level 2 page table descriptor.
uint8_t apTable() const
Two bit access protection flags for subsequent levels of lookup.
const SimObjectParams * _params
Cached copy of the object parameters.
Definition: sim_object.hh:107
BaseTLB::Mode mode
Save mode for use in delayed response.
uint8_t texcb() const
Memory region attributes: ARM DDI 0406B: B3-32.
uint16_t asid
ASID that we'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
EventWrapper< TableWalker,&TableWalker::doL1LongDescriptorWrapper > doL1LongDescEvent
virtual bool shareable() const
Definition: table_walker.hh:85
L1Descriptor l1Desc
Short-format descriptors.
void setTlb(TLB *_tlb)
void nextWalk(ThreadContext *tc)
virtual std::string dbgHeader() const
uint32_t data
The raw bits of the entry.
virtual std::string dbgHeader() const =0
bool dirty() const
This entry needs to be written back to memory.
bool secureTable() const
Whether the subsequent levels of lookup are secure.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:181
EventWrapper< TableWalker,&TableWalker::doL2DescriptorWrapper > doL2DescEvent
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:2515
virtual TlbEntry::DomainType domain() const
EntryType
Type of page table entry ARM DDI 0406B: B3-8.
Definition: table_walker.hh:94
bool aarch64
True if the current lookup is performed in AArch64 state.
virtual uint64_t getRawData() const
T mbits(T val, int first, int last)
Mask off the given bits in place like bits() but without shifting.
Definition: bitfield.hh:91
bool aarch64
If the access is performed in AArch64 state.
T bits(T val, int first, int last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it...
Definition: bitfield.hh:67
bool secure(bool have_security, WalkerState *currState) const
Returns true if this entry targets the secure physical address map.
ArmTableWalkerParams Params
const bool isStage2
Indicates whether this table walker is part of the stage 2 mmu.
virtual uint8_t offsetBits() const
Addr nextTableAddr() const
Return the address of the next page table.
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 ...
virtual std::string dbgHeader() const
bool haveLargeAsid64() const
Bitfield< 0 > p
LookupLevel
Definition: pagetable.hh:77
virtual uint64_t getRawData() const
virtual std::string dbgHeader() const
std::shared_ptr< FaultBase > Fault
Definition: types.hh:184
Long-descriptor format (LPAE)
void setAf()
Set access flag that this entry has been touched.
uint8_t ap() const
2-bit access protection flags
void memAttrsAArch64(ThreadContext *tc, TlbEntry &te, LongDescriptor &lDescriptor)
BaseMasterPort & getMasterPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a master port with a given name and index.
Addr vaddr_tainted
The virtual address that is being translated.
RequestPtr req
Request that is currently being serviced.
bool delayed
Whether the response is delayed in timing mode due to additional lookups.
void setAp0()
Set access flag that this entry has been touched.
TLB::Translation * stage2Tran
A pointer to the stage 2 translation that's in progress.
Stats::Vector statPageSizes
bool global(WalkerState *currState) const
Is the translation global (no asid used)?
bool haveLPAE() const
bool _dirty
This entry has been modified (access flag set) and needs to be written back to memory.
uint8_t texcb() const
Memory region attributes: ARM DDI 0406B: B3-32.

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