gem5  v22.1.0.0
misc64.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2013,2017-2022 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 #include "arch/arm/insts/misc64.hh"
39 #include "arch/arm/isa.hh"
40 
41 #include "arch/arm/tlbi_op.hh"
42 
43 namespace gem5
44 {
45 
46 using namespace ArmISA;
47 
48 std::string
50 {
51  std::stringstream ss;
52  printMnemonic(ss, "", false);
53  ccprintf(ss, "#0x%x", imm);
54  return ss.str();
55 }
56 
57 std::string
59  Addr pc, const loader::SymbolTable *symtab) const
60 {
61  std::stringstream ss;
62  printMnemonic(ss, "", false);
63  printIntReg(ss, dest);
64  ss << ", ";
65  printIntReg(ss, op1);
66  ccprintf(ss, ", #%d, #%d", imm1, imm2);
67  return ss.str();
68 }
69 
70 std::string
72  Addr pc, const loader::SymbolTable *symtab) const
73 {
74  std::stringstream ss;
75  printMnemonic(ss, "", false);
76  printIntReg(ss, dest);
77  ss << ", ";
78  printIntReg(ss, op1);
79  ss << ", ";
80  printIntReg(ss, op2);
81  ccprintf(ss, ", #%d", imm);
82  return ss.str();
83 }
84 
85 std::string
87  Addr pc, const loader::SymbolTable *symtab) const
88 {
89  return csprintf("%-10s (inst %#08x)", "unknown", encoding());
90 }
91 
92 uint32_t
93 MiscRegOp64::_iss(const MiscRegNum64 &misc_reg, RegIndex int_index) const
94 {
95  return _miscRead |
96  (misc_reg.crm << 1) |
97  (int_index << 5) |
98  (misc_reg.crn << 10) |
99  (misc_reg.op1 << 14) |
100  (misc_reg.op2 << 17) |
101  (misc_reg.op0 << 20);
102 }
103 
104 Fault
106 {
107  return generateTrap(el, ExceptionClass::TRAPPED_MSR_MRS_64, iss());
108 }
109 
110 Fault
112  uint32_t iss) const
113 {
114  switch (el) {
115  case EL1:
116  return std::make_shared<SupervisorTrap>(getEMI(), iss, ec);
117  case EL2:
118  return std::make_shared<HypervisorTrap>(getEMI(), iss, ec);
119  case EL3:
120  return std::make_shared<SecureMonitorTrap>(getEMI(), iss, ec);
121  default:
122  panic("Invalid EL: %d\n", el);
123  }
124 }
125 
126 RegVal
128 {
129  switch (dest) {
130  case MISCREG_SPSEL:
131  return imm & 0x1;
132  case MISCREG_PAN:
133  return (imm & 0x1) << 22;
134  case MISCREG_UAO:
135  return (imm & 0x1) << 23;
136  default:
137  panic("Not a valid PSTATE field register\n");
138  }
139 }
140 
141 std::string
143  Addr pc, const loader::SymbolTable *symtab) const
144 {
145  std::stringstream ss;
146  printMnemonic(ss);
147  printMiscReg(ss, dest);
148  ss << ", ";
149  ccprintf(ss, "#0x%x", imm);
150  return ss.str();
151 }
152 
153 std::string
155  Addr pc, const loader::SymbolTable *symtab) const
156 {
157  std::stringstream ss;
158  printMnemonic(ss);
159  printMiscReg(ss, dest);
160  ss << ", ";
161  printIntReg(ss, op1);
162  return ss.str();
163 }
164 
165 uint32_t
167 {
168  const MiscRegNum64 &misc_reg = encodeAArch64SysReg(dest);
169  return _iss(misc_reg, op1);
170 }
171 
172 std::string
174  Addr pc, const loader::SymbolTable *symtab) const
175 {
176  std::stringstream ss;
177  printMnemonic(ss);
178  printIntReg(ss, dest);
179  ss << ", ";
180  printMiscReg(ss, op1);
181  return ss.str();
182 }
183 
184 uint32_t
186 {
187  const MiscRegNum64 &misc_reg = encodeAArch64SysReg(op1);
188  return _iss(misc_reg, dest);
189 }
190 
191 Fault
193  trace::InstRecord *traceData) const
194 {
195  auto tc = xc->tcBase();
196  const CPSR cpsr = tc->readMiscReg(MISCREG_CPSR);
197 
199  MISCREG_IMPDEF_UNIMPL, cpsr, tc, *this);
200 }
201 
202 std::string
204  Addr pc, const loader::SymbolTable *symtab) const
205 {
206  return csprintf("%-10s (implementation defined)", fullMnemonic.c_str());
207 }
208 
209 uint32_t
211 {
212  return _iss(miscReg, intReg);
213 }
214 
215 std::string
217  Addr pc, const loader::SymbolTable *symtab) const
218 {
219  std::stringstream ss;
220  printMnemonic(ss);
221  printIntReg(ss, dest);
222  return ss.str();
223 }
224 
225 void
227 {
228  ThreadContext* tc = xc->tcBase();
229  auto isa = static_cast<ArmISA::ISA *>(tc->getIsaPtr());
230  auto release = isa->getRelease();
231 
232  bool asid_16bits = ArmSystem::haveLargeAsid64(tc);
233 
234  switch (dest_idx) {
235  // AArch64 TLB Invalidate All, EL3
236  case MISCREG_TLBI_ALLE3:
237  {
238  TLBIALLEL tlbiOp(EL3, true);
239  tlbiOp(tc);
240  return;
241  }
242  // AArch64 TLB Invalidate All, EL3, Inner Shareable
244  {
245  TLBIALLEL tlbiOp(EL3, true);
246  tlbiOp.broadcast(tc);
247  return;
248  }
249  // AArch64 TLB Invalidate All, EL2
250  case MISCREG_TLBI_ALLE2:
251  {
252  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
253 
254  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
255  TLBIALLEL tlbiOp(EL2, secure);
256  tlbiOp(tc);
257  return;
258  }
259  // AArch64 TLB Invalidate All, EL2, Inner Shareable
261  {
262  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
263 
264  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
265  TLBIALLEL tlbiOp(EL2, secure);
266  tlbiOp.broadcast(tc);
267  return;
268  }
269  // AArch64 TLB Invalidate All, EL1
270  case MISCREG_TLBI_ALLE1:
271  {
272  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
273 
274  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
275  TLBIALLEL tlbiOp(EL1, secure);
276  tlbiOp(tc);
277  return;
278  }
279  // AArch64 TLB Invalidate All, EL1, Inner Shareable
281  {
282  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
283 
284  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
285  TLBIALLEL tlbiOp(EL1, secure);
286  tlbiOp.broadcast(tc);
287  return;
288  }
290  {
291  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
292 
293  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
294  TLBIVMALL tlbiOp(EL1, secure, true);
295  tlbiOp(tc);
296  return;
297  }
299  {
300  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
301 
302  ExceptionLevel target_el = EL1;
303  if (EL2Enabled(tc)) {
304  HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
305  if (hcr.tge && hcr.e2h) {
306  target_el = EL2;
307  }
308  }
309 
310  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
311  TLBIVMALL tlbiOp(target_el, secure, false);
312  tlbiOp(tc);
313  return;
314  }
316  {
317  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
318 
319  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
320  TLBIVMALL tlbiOp(EL1, secure, true);
321  tlbiOp.broadcast(tc);
322  return;
323  }
325  {
326  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
327 
328  ExceptionLevel target_el = EL1;
329  if (EL2Enabled(tc)) {
330  HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
331  if (hcr.tge && hcr.e2h) {
332  target_el = EL2;
333  }
334  }
335 
336  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
337  TLBIVMALL tlbiOp(target_el, secure, false);
338  tlbiOp.broadcast(tc);
339  return;
340  }
341  // AArch64 TLB Invalidate by VA, EL3
343  {
344 
345  TLBIMVAA tlbiOp(EL3, true,
346  static_cast<Addr>(bits(value, 43, 0)) << 12,
347  false);
348  tlbiOp(tc);
349  return;
350  }
351  // AArch64 TLB Invalidate by VA, Last Level, EL3
353  {
354 
355  TLBIMVAA tlbiOp(EL3, true,
356  static_cast<Addr>(bits(value, 43, 0)) << 12,
357  true);
358  tlbiOp(tc);
359  return;
360  }
361  // AArch64 TLB Invalidate by VA, EL3, Inner Shareable
363  {
364  TLBIMVAA tlbiOp(EL3, true,
365  static_cast<Addr>(bits(value, 43, 0)) << 12,
366  false);
367 
368  tlbiOp.broadcast(tc);
369  return;
370  }
371  // AArch64 TLB Invalidate by VA, Last Level, EL3, Inner Shareable
373  {
374  TLBIMVAA tlbiOp(EL3, true,
375  static_cast<Addr>(bits(value, 43, 0)) << 12,
376  true);
377 
378  tlbiOp.broadcast(tc);
379  return;
380  }
381  // AArch64 TLB Invalidate by VA, EL2
383  {
384  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
385  HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
386 
387  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
388 
389  if (hcr.e2h) {
390  // The asid will only be used when e2h == 1
391  auto asid = asid_16bits ? bits(value, 63, 48) :
392  bits(value, 55, 48);
393 
394  TLBIMVA tlbiOp(EL2, secure,
395  static_cast<Addr>(bits(value, 43, 0)) << 12,
396  asid, false);
397  tlbiOp(tc);
398  } else {
399  TLBIMVAA tlbiOp(EL2, secure,
400  static_cast<Addr>(bits(value, 43, 0)) << 12,
401  false);
402  tlbiOp(tc);
403  }
404  return;
405  }
406  // AArch64 TLB Invalidate by VA, Last Level, EL2
408  {
409  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
410  HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
411 
412  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
413 
414  if (hcr.e2h) {
415  // The asid will only be used when e2h == 1
416  auto asid = asid_16bits ? bits(value, 63, 48) :
417  bits(value, 55, 48);
418 
419  TLBIMVA tlbiOp(EL2, secure,
420  static_cast<Addr>(bits(value, 43, 0)) << 12,
421  asid, true);
422  tlbiOp(tc);
423  } else {
424  TLBIMVAA tlbiOp(EL2, secure,
425  static_cast<Addr>(bits(value, 43, 0)) << 12,
426  true);
427  tlbiOp(tc);
428  }
429  return;
430  }
431  // AArch64 TLB Invalidate by VA, EL2, Inner Shareable
433  {
434  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
435  HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
436 
437  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
438 
439  if (hcr.e2h) {
440  // The asid will only be used when e2h == 1
441  auto asid = asid_16bits ? bits(value, 63, 48) :
442  bits(value, 55, 48);
443 
444  TLBIMVA tlbiOp(EL2, secure,
445  static_cast<Addr>(bits(value, 43, 0)) << 12,
446  asid, false);
447  tlbiOp.broadcast(tc);
448  } else {
449  TLBIMVAA tlbiOp(EL2, secure,
450  static_cast<Addr>(bits(value, 43, 0)) << 12,
451  false);
452  tlbiOp.broadcast(tc);
453  }
454  return;
455  }
456  // AArch64 TLB Invalidate by VA, Last Level, EL2, Inner Shareable
458  {
459  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
460  HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
461 
462  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
463 
464  if (hcr.e2h) {
465  // The asid will only be used when e2h == 1
466  auto asid = asid_16bits ? bits(value, 63, 48) :
467  bits(value, 55, 48);
468 
469  TLBIMVA tlbiOp(EL2, secure,
470  static_cast<Addr>(bits(value, 43, 0)) << 12,
471  asid, true);
472  tlbiOp.broadcast(tc);
473  } else {
474  TLBIMVAA tlbiOp(EL2, secure,
475  static_cast<Addr>(bits(value, 43, 0)) << 12,
476  true);
477  tlbiOp.broadcast(tc);
478  }
479  return;
480  }
481  // AArch64 TLB Invalidate by VA, EL1
483  {
484  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
485  auto asid = asid_16bits ? bits(value, 63, 48) :
486  bits(value, 55, 48);
487 
488  ExceptionLevel target_el = EL1;
489  if (EL2Enabled(tc)) {
490  HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
491  if (hcr.tge && hcr.e2h) {
492  target_el = EL2;
493  }
494  }
495 
496  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
497  TLBIMVA tlbiOp(target_el, secure,
498  static_cast<Addr>(bits(value, 43, 0)) << 12,
499  asid, false);
500 
501  tlbiOp(tc);
502  return;
503  }
504  // AArch64 TLB Invalidate by VA, Last Level, EL1
506  {
507  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
508  auto asid = asid_16bits ? bits(value, 63, 48) :
509  bits(value, 55, 48);
510 
511  ExceptionLevel target_el = EL1;
512  if (EL2Enabled(tc)) {
513  HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
514  if (hcr.tge && hcr.e2h) {
515  target_el = EL2;
516  }
517  }
518 
519  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
520  TLBIMVA tlbiOp(target_el, secure,
521  static_cast<Addr>(bits(value, 43, 0)) << 12,
522  asid, true);
523 
524  tlbiOp(tc);
525  return;
526  }
527  // AArch64 TLB Invalidate by VA, EL1, Inner Shareable
529  {
530  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
531  auto asid = asid_16bits ? bits(value, 63, 48) :
532  bits(value, 55, 48);
533 
534  ExceptionLevel target_el = EL1;
535  if (EL2Enabled(tc)) {
536  HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
537  if (hcr.tge && hcr.e2h) {
538  target_el = EL2;
539  }
540  }
541 
542  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
543  TLBIMVA tlbiOp(target_el, secure,
544  static_cast<Addr>(bits(value, 43, 0)) << 12,
545  asid, false);
546 
547  tlbiOp.broadcast(tc);
548  return;
549  }
551  {
552  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
553  auto asid = asid_16bits ? bits(value, 63, 48) :
554  bits(value, 55, 48);
555 
556  ExceptionLevel target_el = EL1;
557  if (EL2Enabled(tc)) {
558  HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
559  if (hcr.tge && hcr.e2h) {
560  target_el = EL2;
561  }
562  }
563 
564  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
565  TLBIMVA tlbiOp(target_el, secure,
566  static_cast<Addr>(bits(value, 43, 0)) << 12,
567  asid, true);
568 
569  tlbiOp.broadcast(tc);
570  return;
571  }
572  // AArch64 TLB Invalidate by ASID, EL1
574  {
575  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
576  auto asid = asid_16bits ? bits(value, 63, 48) :
577  bits(value, 55, 48);
578 
579  ExceptionLevel target_el = EL1;
580  if (EL2Enabled(tc)) {
581  HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
582  if (hcr.tge && hcr.e2h) {
583  target_el = EL2;
584  }
585  }
586 
587  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
588  TLBIASID tlbiOp(target_el, secure, asid);
589  tlbiOp(tc);
590  return;
591  }
592  // AArch64 TLB Invalidate by ASID, EL1, Inner Shareable
594  {
595  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
596  auto asid = asid_16bits ? bits(value, 63, 48) :
597  bits(value, 55, 48);
598 
599  ExceptionLevel target_el = EL1;
600  if (EL2Enabled(tc)) {
601  HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
602  if (hcr.tge && hcr.e2h) {
603  target_el = EL2;
604  }
605  }
606 
607  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
608  TLBIASID tlbiOp(target_el, secure, asid);
609  tlbiOp.broadcast(tc);
610  return;
611  }
612  // AArch64 TLB Invalidate by VA, All ASID, EL1
614  {
615  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
616 
617  ExceptionLevel target_el = EL1;
618  if (EL2Enabled(tc)) {
619  HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
620  if (hcr.tge && hcr.e2h) {
621  target_el = EL2;
622  }
623  }
624 
625  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
626  TLBIMVAA tlbiOp(target_el, secure,
627  static_cast<Addr>(bits(value, 43, 0)) << 12,
628  false);
629 
630  tlbiOp(tc);
631  return;
632  }
633  // AArch64 TLB Invalidate by VA, Last Level, All ASID, EL1
635  {
636  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
637 
638  ExceptionLevel target_el = EL1;
639  if (EL2Enabled(tc)) {
640  HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
641  if (hcr.tge && hcr.e2h) {
642  target_el = EL2;
643  }
644  }
645 
646  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
647  TLBIMVAA tlbiOp(target_el, secure,
648  static_cast<Addr>(bits(value, 43, 0)) << 12,
649  true);
650 
651  tlbiOp(tc);
652  return;
653  }
654  // AArch64 TLB Invalidate by VA, All ASID, EL1, Inner Shareable
656  {
657  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
658 
659  ExceptionLevel target_el = EL1;
660  if (EL2Enabled(tc)) {
661  HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
662  if (hcr.tge && hcr.e2h) {
663  target_el = EL2;
664  }
665  }
666 
667  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
668  TLBIMVAA tlbiOp(target_el, secure,
669  static_cast<Addr>(bits(value, 43, 0)) << 12,
670  false);
671 
672  tlbiOp.broadcast(tc);
673  return;
674  }
675  // AArch64 TLB Invalidate by VA, All ASID,
676  // Last Level, EL1, Inner Shareable
678  {
679  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
680 
681  ExceptionLevel target_el = EL1;
682  if (EL2Enabled(tc)) {
683  HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
684  if (hcr.tge && hcr.e2h) {
685  target_el = EL2;
686  }
687  }
688 
689  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
690  TLBIMVAA tlbiOp(target_el, secure,
691  static_cast<Addr>(bits(value, 43, 0)) << 12,
692  true);
693 
694  tlbiOp.broadcast(tc);
695  return;
696  }
697  // AArch64 TLB Invalidate by Intermediate Physical Address,
698  // Stage 2, EL1
700  {
701  if (EL2Enabled(tc)) {
702  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
703 
704  bool secure = release->has(ArmExtension::SECURITY) &&
705  !scr.ns && !bits(value, 63);
706 
707  const int top_bit = ArmSystem::physAddrRange(tc) == 52 ?
708  39 : 35;
709  TLBIIPA tlbiOp(EL1, secure,
710  static_cast<Addr>(bits(value, top_bit, 0)) << 12,
711  false);
712 
713  tlbiOp(tc);
714  }
715  return;
716  }
717  // AArch64 TLB Invalidate by Intermediate Physical Address,
718  // Stage 2, Last Level EL1
720  {
721  if (EL2Enabled(tc)) {
722  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
723 
724  bool secure = release->has(ArmExtension::SECURITY) &&
725  !scr.ns && !bits(value, 63);
726 
727  TLBIIPA tlbiOp(EL1, secure,
728  static_cast<Addr>(bits(value, 35, 0)) << 12,
729  true);
730 
731  tlbiOp(tc);
732  }
733  return;
734  }
735  // AArch64 TLB Invalidate by Intermediate Physical Address,
736  // Stage 2, EL1, Inner Shareable
738  {
739  if (EL2Enabled(tc)) {
740  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
741 
742  bool secure = release->has(ArmExtension::SECURITY) &&
743  !scr.ns && !bits(value, 63);
744 
745  const int top_bit = ArmSystem::physAddrRange(tc) == 52 ?
746  39 : 35;
747  TLBIIPA tlbiOp(EL1, secure,
748  static_cast<Addr>(bits(value, top_bit, 0)) << 12,
749  false);
750 
751  tlbiOp.broadcast(tc);
752  }
753  return;
754  }
755  // AArch64 TLB Invalidate by Intermediate Physical Address,
756  // Stage 2, Last Level, EL1, Inner Shareable
758  {
759  if (EL2Enabled(tc)) {
760  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
761 
762  bool secure = release->has(ArmExtension::SECURITY) &&
763  !scr.ns && !bits(value, 63);
764 
765  TLBIIPA tlbiOp(EL1, secure,
766  static_cast<Addr>(bits(value, 35, 0)) << 12,
767  true);
768 
769  tlbiOp.broadcast(tc);
770  }
771  return;
772  }
773  default:
774  panic("Invalid TLBI\n");
775  }
776 }
777 
778 } // namespace gem5
const ArmRelease * getRelease() const
Definition: isa.hh:193
Implementaton of AArch64 TLBI ALLE(1,2,3)(IS) instructions.
Definition: tlbi_op.hh:171
TLB Invalidate by ASID match.
Definition: tlbi_op.hh:229
TLB Invalidate by Intermediate Physical Address.
Definition: tlbi_op.hh:373
TLB Invalidate by VA, All ASID.
Definition: tlbi_op.hh:302
TLB Invalidate by VA.
Definition: tlbi_op.hh:321
void broadcast(ThreadContext *tc)
Broadcast the TLB Invalidate operation to all TLBs in the Arm system.
Definition: tlbi_op.hh:73
Implementaton of AArch64 TLBI VMALLE1(IS)/VMALLS112E1(IS) instructions.
Definition: tlbi_op.hh:199
uint8_t physAddrRange() const
Returns the supported physical address range in bits.
Definition: system.hh:214
bool haveLargeAsid64() const
Returns true if ASID is 16 bits in AArch64 (ARMv8)
Definition: system.hh:203
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
Definition: exec_context.hh:72
virtual ThreadContext * tcBase() const =0
Returns a pointer to the ThreadContext.
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: misc64.cc:49
RegVal miscRegImm() const
Returns the "register view" of the immediate field.
Definition: misc64.cc:127
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: misc64.cc:142
uint32_t iss() const override
Definition: misc64.cc:210
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: misc64.cc:203
Fault execute(ExecContext *xc, trace::InstRecord *traceData) const override
Definition: misc64.cc:192
uint32_t _iss(const ArmISA::MiscRegNum64 &misc_reg, RegIndex int_index) const
Definition: misc64.cc:93
Fault generateTrap(ArmISA::ExceptionLevel el) const
Definition: misc64.cc:105
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: misc64.cc:154
uint32_t iss() const override
Definition: misc64.cc:166
uint32_t iss() const override
Definition: misc64.cc:185
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: misc64.cc:173
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const
Internal function to generate disassembly string.
Definition: misc64.cc:216
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: misc64.cc:58
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: misc64.cc:71
ThreadContext is the external interface to all thread state for anything outside of the CPU.
virtual RegVal readMiscReg(RegIndex misc_reg)=0
virtual BaseISA * getIsaPtr() const =0
void performTlbi(ExecContext *xc, ArmISA::MiscRegIndex idx, RegVal value) const
Definition: misc64.cc:226
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: misc64.cc:86
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
Definition: bitfield.hh:76
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:178
MiscRegNum64 encodeAArch64SysReg(MiscRegIndex misc_reg)
Definition: misc.cc:2001
Bitfield< 7, 0 > imm
Definition: types.hh:132
Fault checkFaultAccessAArch64SysReg(MiscRegIndex reg, CPSR cpsr, ThreadContext *tc, const MiscRegOp64 &inst)
Definition: misc.cc:728
bool EL2Enabled(ThreadContext *tc)
Definition: utility.cc:260
Bitfield< 24, 0 > iss
Definition: misc_types.hh:678
MiscRegIndex
Definition: misc.hh:64
@ MISCREG_TLBI_ALLE3
Definition: misc.hh:712
@ MISCREG_TLBI_ALLE1IS
Definition: misc.hh:699
@ MISCREG_TLBI_IPAS2E1IS_Xt
Definition: misc.hh:695
@ MISCREG_SPSEL
Definition: misc.hh:622
@ MISCREG_TLBI_IPAS2E1_Xt
Definition: misc.hh:702
@ MISCREG_TLBI_ALLE1
Definition: misc.hh:706
@ MISCREG_TLBI_VAE2_Xt
Definition: misc.hh:705
@ MISCREG_SCR_EL3
Definition: misc.hh:598
@ MISCREG_TLBI_ASIDE1IS_Xt
Definition: misc.hh:685
@ MISCREG_TLBI_VAE2IS_Xt
Definition: misc.hh:698
@ MISCREG_UAO
Definition: misc.hh:1097
@ MISCREG_TLBI_VAAE1_Xt
Definition: misc.hh:692
@ MISCREG_TLBI_ALLE2IS
Definition: misc.hh:697
@ MISCREG_TLBI_VAAE1IS_Xt
Definition: misc.hh:686
@ MISCREG_TLBI_VMALLE1
Definition: misc.hh:689
@ MISCREG_TLBI_VMALLS12E1
Definition: misc.hh:708
@ MISCREG_CPSR
Definition: misc.hh:65
@ MISCREG_TLBI_VALE2_Xt
Definition: misc.hh:707
@ MISCREG_TLBI_VMALLS12E1IS
Definition: misc.hh:701
@ MISCREG_TLBI_VAE3IS_Xt
Definition: misc.hh:710
@ MISCREG_TLBI_VAE1IS_Xt
Definition: misc.hh:684
@ MISCREG_TLBI_ALLE3IS
Definition: misc.hh:709
@ MISCREG_TLBI_IPAS2LE1IS_Xt
Definition: misc.hh:696
@ MISCREG_PAN
Definition: misc.hh:1096
@ MISCREG_HCR_EL2
Definition: misc.hh:591
@ MISCREG_TLBI_VAALE1_Xt
Definition: misc.hh:694
@ MISCREG_TLBI_VAE3_Xt
Definition: misc.hh:713
@ MISCREG_TLBI_VALE3IS_Xt
Definition: misc.hh:711
@ MISCREG_TLBI_VAALE1IS_Xt
Definition: misc.hh:688
@ MISCREG_TLBI_VALE2IS_Xt
Definition: misc.hh:700
@ MISCREG_TLBI_VMALLE1IS
Definition: misc.hh:683
@ MISCREG_TLBI_ALLE2
Definition: misc.hh:704
@ MISCREG_TLBI_VALE1IS_Xt
Definition: misc.hh:687
@ MISCREG_TLBI_VALE3_Xt
Definition: misc.hh:714
@ MISCREG_TLBI_ASIDE1_Xt
Definition: misc.hh:691
@ MISCREG_TLBI_IPAS2LE1_Xt
Definition: misc.hh:703
@ MISCREG_IMPDEF_UNIMPL
Definition: misc.hh:1080
@ MISCREG_TLBI_VALE1_Xt
Definition: misc.hh:693
@ MISCREG_TLBI_VAE1_Xt
Definition: misc.hh:690
Bitfield< 3, 2 > el
Definition: misc_types.hh:73
Bitfield< 27, 25 > encoding
Definition: types.hh:90
Bitfield< 21 > ss
Definition: misc_types.hh:60
Bitfield< 4 > pc
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
std::shared_ptr< FaultBase > Fault
Definition: types.hh:248
uint16_t RegIndex
Definition: types.hh:176
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
uint64_t RegVal
Definition: types.hh:173
std::string csprintf(const char *format, const Args &...args)
Definition: cprintf.hh:161
void ccprintf(cp::Print &print)
Definition: cprintf.hh:130
The file contains the definition of a set of TLB Invalidate Instructions.

Generated on Wed Dec 21 2022 10:22:26 for gem5 by doxygen 1.9.1