gem5  [DEVELOP-FOR-23.0]
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 {
60  std::stringstream ss;
61  printMnemonic(ss, "", false);
62  printIntReg(ss, op1);
63  return ss.str();
64 }
65 
66 std::string
68 {
69  std::stringstream ss;
70  printMnemonic(ss, "", false);
71  printIntReg(ss, op1);
72  ccprintf(ss, "#0x%x", imm1);
73  ss << ", ";
74  ccprintf(ss, "#0x%x", imm2);
75  return ss.str();
76 }
77 
78 std::string
80  Addr pc, const loader::SymbolTable *symtab) const
81 {
82  std::stringstream ss;
83  printMnemonic(ss, "", false);
84  printIntReg(ss, dest);
85  ss << ", ";
86  printIntReg(ss, op1);
87  ccprintf(ss, ", #%d, #%d", imm1, imm2);
88  return ss.str();
89 }
90 
91 std::string
93  Addr pc, const loader::SymbolTable *symtab) const
94 {
95  std::stringstream ss;
96  printMnemonic(ss, "", false);
97  printIntReg(ss, dest);
98  ss << ", ";
99  printIntReg(ss, op1);
100  ss << ", ";
101  printIntReg(ss, op2);
102  ccprintf(ss, ", #%d", imm);
103  return ss.str();
104 }
105 
106 std::string
108  Addr pc, const loader::SymbolTable *symtab) const
109 {
110  return csprintf("%-10s (inst %#08x)", "unknown", encoding());
111 }
112 
113 uint32_t
114 MiscRegOp64::_iss(const MiscRegNum64 &misc_reg, RegIndex int_index) const
115 {
116  return _miscRead |
117  (misc_reg.crm << 1) |
118  (int_index << 5) |
119  (misc_reg.crn << 10) |
120  (misc_reg.op1 << 14) |
121  (misc_reg.op2 << 17) |
122  (misc_reg.op0 << 20);
123 }
124 
125 Fault
127 {
128  return generateTrap(el, ExceptionClass::TRAPPED_MSR_MRS_64, iss());
129 }
130 
131 Fault
133  uint32_t iss) const
134 {
135  switch (el) {
136  case EL1:
137  return std::make_shared<SupervisorTrap>(getEMI(), iss, ec);
138  case EL2:
139  return std::make_shared<HypervisorTrap>(getEMI(), iss, ec);
140  case EL3:
141  return std::make_shared<SecureMonitorTrap>(getEMI(), iss, ec);
142  default:
143  panic("Invalid EL: %d\n", el);
144  }
145 }
146 
147 RegVal
149 {
150  switch (dest) {
151  case MISCREG_SPSEL:
152  return imm & 0x1;
153  case MISCREG_PAN:
154  return (imm & 0x1) << 22;
155  case MISCREG_UAO:
156  return (imm & 0x1) << 23;
157  default:
158  panic("Not a valid PSTATE field register\n");
159  }
160 }
161 
162 std::string
164  Addr pc, const loader::SymbolTable *symtab) const
165 {
166  std::stringstream ss;
167  printMnemonic(ss);
168  printMiscReg(ss, dest);
169  ss << ", ";
170  ccprintf(ss, "#0x%x", imm);
171  return ss.str();
172 }
173 
174 std::string
176  Addr pc, const loader::SymbolTable *symtab) const
177 {
178  std::stringstream ss;
179  printMnemonic(ss);
180  printMiscReg(ss, dest);
181  ss << ", ";
182  printIntReg(ss, op1);
183  return ss.str();
184 }
185 
186 uint32_t
188 {
189  const MiscRegNum64 &misc_reg = encodeAArch64SysReg(dest);
190  return _iss(misc_reg, op1);
191 }
192 
193 std::string
195  Addr pc, const loader::SymbolTable *symtab) const
196 {
197  std::stringstream ss;
198  printMnemonic(ss);
199  printIntReg(ss, dest);
200  ss << ", ";
201  printMiscReg(ss, op1);
202  return ss.str();
203 }
204 
205 uint32_t
207 {
208  const MiscRegNum64 &misc_reg = encodeAArch64SysReg(op1);
209  return _iss(misc_reg, dest);
210 }
211 
212 Fault
214  trace::InstRecord *traceData) const
215 {
216  auto tc = xc->tcBase();
217  const CPSR cpsr = tc->readMiscReg(MISCREG_CPSR);
218 
220  MISCREG_IMPDEF_UNIMPL, cpsr, tc, *this);
221 }
222 
223 std::string
225  Addr pc, const loader::SymbolTable *symtab) const
226 {
227  return csprintf("%-10s (implementation defined)", fullMnemonic.c_str());
228 }
229 
230 uint32_t
232 {
233  return _iss(miscReg, intReg);
234 }
235 
236 std::string
238  Addr pc, const loader::SymbolTable *symtab) const
239 {
240  std::stringstream ss;
241  printMnemonic(ss);
242  printIntReg(ss, dest);
243  return ss.str();
244 }
245 
246 void
248 {
249  ThreadContext* tc = xc->tcBase();
250  auto isa = static_cast<ArmISA::ISA *>(tc->getIsaPtr());
251  auto release = isa->getRelease();
252 
253  bool asid_16bits = ArmSystem::haveLargeAsid64(tc);
254 
255  switch (dest_idx) {
256  // AArch64 TLB Invalidate All, EL3
257  case MISCREG_TLBI_ALLE3:
258  {
259  TLBIALLEL tlbiOp(EL3, true);
260  tlbiOp(tc);
261  return;
262  }
263  // AArch64 TLB Invalidate All, EL3, Inner Shareable
265  // AArch64 TLB Invalidate All, EL3, Outer Shareable
266  // We are currently not distinguishing Inner and Outer domains.
267  // We therefore implement TLBIOS instructions as TLBIIS
269  {
270  TLBIALLEL tlbiOp(EL3, true);
271  tlbiOp.broadcast(tc);
272  return;
273  }
274  // AArch64 TLB Invalidate All, EL2
275  case MISCREG_TLBI_ALLE2:
276  {
277  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
278 
279  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
280  TLBIALLEL tlbiOp(EL2, secure);
281  tlbiOp(tc);
282  return;
283  }
284  // AArch64 TLB Invalidate All, EL2, Inner Shareable
286  // AArch64 TLB Invalidate All, EL2, Outer Shareable
287  // We are currently not distinguishing Inner and Outer domains.
288  // We therefore implement TLBIOS instructions as TLBIIS
290  {
291  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
292 
293  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
294  TLBIALLEL tlbiOp(EL2, secure);
295  tlbiOp.broadcast(tc);
296  return;
297  }
298  // AArch64 TLB Invalidate All, EL1
299  case MISCREG_TLBI_ALLE1:
300  {
301  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
302 
303  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
304  TLBIALLEL tlbiOp(EL1, secure);
305  tlbiOp(tc);
306  return;
307  }
308  // AArch64 TLB Invalidate All, EL1, Inner Shareable
310  // AArch64 TLB Invalidate All, EL1, Outer Shareable
311  // We are currently not distinguishing Inner and Outer domains.
312  // We therefore implement TLBIOS instructions as TLBIIS
314  {
315  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
316 
317  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
318  TLBIALLEL tlbiOp(EL1, secure);
319  tlbiOp.broadcast(tc);
320  return;
321  }
323  {
324  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
325 
326  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
327  TLBIVMALL tlbiOp(EL1, secure, true);
328  tlbiOp(tc);
329  return;
330  }
332  {
333  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
334 
335  ExceptionLevel target_el = EL1;
336  if (EL2Enabled(tc)) {
337  HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
338  if (hcr.tge && hcr.e2h) {
339  target_el = EL2;
340  }
341  }
342 
343  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
344  TLBIVMALL tlbiOp(target_el, secure, false);
345  tlbiOp(tc);
346  return;
347  }
349  // We are currently not distinguishing Inner and Outer domains.
350  // We therefore implement TLBIOS instructions as TLBIIS
352  {
353  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
354 
355  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
356  TLBIVMALL tlbiOp(EL1, secure, true);
357  tlbiOp.broadcast(tc);
358  return;
359  }
361  // We are currently not distinguishing Inner and Outer domains.
362  // We therefore implement TLBIOS instructions as TLBIIS
364  {
365  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
366 
367  ExceptionLevel target_el = EL1;
368  if (EL2Enabled(tc)) {
369  HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
370  if (hcr.tge && hcr.e2h) {
371  target_el = EL2;
372  }
373  }
374 
375  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
376  TLBIVMALL tlbiOp(target_el, secure, false);
377  tlbiOp.broadcast(tc);
378  return;
379  }
380  // AArch64 TLB Invalidate by VA, EL3
382  {
383 
384  TLBIMVAA tlbiOp(EL3, true,
385  static_cast<Addr>(bits(value, 43, 0)) << 12,
386  false);
387  tlbiOp(tc);
388  return;
389  }
390  // AArch64 TLB Invalidate by VA, Last Level, EL3
392  {
393 
394  TLBIMVAA tlbiOp(EL3, true,
395  static_cast<Addr>(bits(value, 43, 0)) << 12,
396  true);
397  tlbiOp(tc);
398  return;
399  }
400  // AArch64 TLB Invalidate by VA, EL3, Inner Shareable
402  // AArch64 TLB Invalidate by VA, EL3, Outer Shareable
403  // We are currently not distinguishing Inner and Outer domains.
404  // We therefore implement TLBIOS instructions as TLBIIS
406  {
407  TLBIMVAA tlbiOp(EL3, true,
408  static_cast<Addr>(bits(value, 43, 0)) << 12,
409  false);
410 
411  tlbiOp.broadcast(tc);
412  return;
413  }
414  // AArch64 TLB Invalidate by VA, Last Level, EL3, Inner Shareable
416  // AArch64 TLB Invalidate by VA, Last Level, EL3, Outer Shareable
417  // We are currently not distinguishing Inner and Outer domains.
418  // We therefore implement TLBIOS instructions as TLBIIS
420  {
421  TLBIMVAA tlbiOp(EL3, true,
422  static_cast<Addr>(bits(value, 43, 0)) << 12,
423  true);
424 
425  tlbiOp.broadcast(tc);
426  return;
427  }
428  // AArch64 TLB Invalidate by VA, EL2
430  {
431  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
432  HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
433 
434  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
435 
436  if (hcr.e2h) {
437  // The asid will only be used when e2h == 1
438  auto asid = asid_16bits ? bits(value, 63, 48) :
439  bits(value, 55, 48);
440 
441  TLBIMVA tlbiOp(EL2, secure,
442  static_cast<Addr>(bits(value, 43, 0)) << 12,
443  asid, false);
444  tlbiOp(tc);
445  } else {
446  TLBIMVAA tlbiOp(EL2, secure,
447  static_cast<Addr>(bits(value, 43, 0)) << 12,
448  false);
449  tlbiOp(tc);
450  }
451  return;
452  }
453  // AArch64 TLB Invalidate by VA, Last Level, EL2
455  {
456  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
457  HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
458 
459  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
460 
461  if (hcr.e2h) {
462  // The asid will only be used when e2h == 1
463  auto asid = asid_16bits ? bits(value, 63, 48) :
464  bits(value, 55, 48);
465 
466  TLBIMVA tlbiOp(EL2, secure,
467  static_cast<Addr>(bits(value, 43, 0)) << 12,
468  asid, true);
469  tlbiOp(tc);
470  } else {
471  TLBIMVAA tlbiOp(EL2, secure,
472  static_cast<Addr>(bits(value, 43, 0)) << 12,
473  true);
474  tlbiOp(tc);
475  }
476  return;
477  }
478  // AArch64 TLB Invalidate by VA, EL2, Inner Shareable
480  // AArch64 TLB Invalidate by VA, EL2, Outer Shareable
481  // We are currently not distinguishing Inner and Outer domains.
482  // We therefore implement TLBIOS instructions as TLBIIS
484  {
485  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
486  HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
487 
488  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
489 
490  if (hcr.e2h) {
491  // The asid will only be used when e2h == 1
492  auto asid = asid_16bits ? bits(value, 63, 48) :
493  bits(value, 55, 48);
494 
495  TLBIMVA tlbiOp(EL2, secure,
496  static_cast<Addr>(bits(value, 43, 0)) << 12,
497  asid, false);
498  tlbiOp.broadcast(tc);
499  } else {
500  TLBIMVAA tlbiOp(EL2, secure,
501  static_cast<Addr>(bits(value, 43, 0)) << 12,
502  false);
503  tlbiOp.broadcast(tc);
504  }
505  return;
506  }
507  // AArch64 TLB Invalidate by VA, Last Level, EL2, Inner Shareable
509  // AArch64 TLB Invalidate by VA, Last Level, EL2, Outer Shareable
510  // We are currently not distinguishing Inner and Outer domains.
511  // We therefore implement TLBIOS instructions as TLBIIS
513  {
514  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
515  HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
516 
517  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
518 
519  if (hcr.e2h) {
520  // The asid will only be used when e2h == 1
521  auto asid = asid_16bits ? bits(value, 63, 48) :
522  bits(value, 55, 48);
523 
524  TLBIMVA tlbiOp(EL2, secure,
525  static_cast<Addr>(bits(value, 43, 0)) << 12,
526  asid, true);
527  tlbiOp.broadcast(tc);
528  } else {
529  TLBIMVAA tlbiOp(EL2, secure,
530  static_cast<Addr>(bits(value, 43, 0)) << 12,
531  true);
532  tlbiOp.broadcast(tc);
533  }
534  return;
535  }
536  // AArch64 TLB Invalidate by VA, EL1
538  {
539  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
540  auto asid = asid_16bits ? bits(value, 63, 48) :
541  bits(value, 55, 48);
542 
543  ExceptionLevel target_el = EL1;
544  if (EL2Enabled(tc)) {
545  HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
546  if (hcr.tge && hcr.e2h) {
547  target_el = EL2;
548  }
549  }
550 
551  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
552  TLBIMVA tlbiOp(target_el, secure,
553  static_cast<Addr>(bits(value, 43, 0)) << 12,
554  asid, false);
555 
556  tlbiOp(tc);
557  return;
558  }
559  // AArch64 TLB Invalidate by VA, Last Level, EL1
561  {
562  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
563  auto asid = asid_16bits ? bits(value, 63, 48) :
564  bits(value, 55, 48);
565 
566  ExceptionLevel target_el = EL1;
567  if (EL2Enabled(tc)) {
568  HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
569  if (hcr.tge && hcr.e2h) {
570  target_el = EL2;
571  }
572  }
573 
574  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
575  TLBIMVA tlbiOp(target_el, secure,
576  static_cast<Addr>(bits(value, 43, 0)) << 12,
577  asid, true);
578 
579  tlbiOp(tc);
580  return;
581  }
582  // AArch64 TLB Invalidate by VA, EL1, Inner Shareable
584  // AArch64 TLB Invalidate by VA, EL1, Outer Shareable
585  // We are currently not distinguishing Inner and Outer domains.
586  // We therefore implement TLBIOS instructions as TLBIIS
588  {
589  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
590  auto asid = asid_16bits ? bits(value, 63, 48) :
591  bits(value, 55, 48);
592 
593  ExceptionLevel target_el = EL1;
594  if (EL2Enabled(tc)) {
595  HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
596  if (hcr.tge && hcr.e2h) {
597  target_el = EL2;
598  }
599  }
600 
601  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
602  TLBIMVA tlbiOp(target_el, secure,
603  static_cast<Addr>(bits(value, 43, 0)) << 12,
604  asid, false);
605 
606  tlbiOp.broadcast(tc);
607  return;
608  }
610  {
611  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
612  auto asid = asid_16bits ? bits(value, 63, 48) :
613  bits(value, 55, 48);
614 
615  ExceptionLevel target_el = EL1;
616  if (EL2Enabled(tc)) {
617  HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
618  if (hcr.tge && hcr.e2h) {
619  target_el = EL2;
620  }
621  }
622 
623  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
624  TLBIMVA tlbiOp(target_el, secure,
625  static_cast<Addr>(bits(value, 43, 0)) << 12,
626  asid, true);
627 
628  tlbiOp.broadcast(tc);
629  return;
630  }
631  // AArch64 TLB Invalidate by ASID, EL1
633  {
634  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
635  auto asid = asid_16bits ? bits(value, 63, 48) :
636  bits(value, 55, 48);
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  TLBIASID tlbiOp(target_el, secure, asid);
648  tlbiOp(tc);
649  return;
650  }
651  // AArch64 TLB Invalidate by ASID, EL1, Inner Shareable
653  // AArch64 TLB Invalidate by ASID, EL1, Outer Shareable
654  // We are currently not distinguishing Inner and Outer domains.
655  // We therefore implement TLBIOS instructions as TLBIIS
657  {
658  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
659  auto asid = asid_16bits ? bits(value, 63, 48) :
660  bits(value, 55, 48);
661 
662  ExceptionLevel target_el = EL1;
663  if (EL2Enabled(tc)) {
664  HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
665  if (hcr.tge && hcr.e2h) {
666  target_el = EL2;
667  }
668  }
669 
670  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
671  TLBIASID tlbiOp(target_el, secure, asid);
672  tlbiOp.broadcast(tc);
673  return;
674  }
675  // AArch64 TLB Invalidate by VA, All ASID, EL1
677  {
678  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
679 
680  ExceptionLevel target_el = EL1;
681  if (EL2Enabled(tc)) {
682  HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
683  if (hcr.tge && hcr.e2h) {
684  target_el = EL2;
685  }
686  }
687 
688  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
689  TLBIMVAA tlbiOp(target_el, secure,
690  static_cast<Addr>(bits(value, 43, 0)) << 12,
691  false);
692 
693  tlbiOp(tc);
694  return;
695  }
696  // AArch64 TLB Invalidate by VA, Last Level, All ASID, EL1
698  {
699  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
700 
701  ExceptionLevel target_el = EL1;
702  if (EL2Enabled(tc)) {
703  HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
704  if (hcr.tge && hcr.e2h) {
705  target_el = EL2;
706  }
707  }
708 
709  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
710  TLBIMVAA tlbiOp(target_el, secure,
711  static_cast<Addr>(bits(value, 43, 0)) << 12,
712  true);
713 
714  tlbiOp(tc);
715  return;
716  }
717  // AArch64 TLB Invalidate by VA, All ASID, EL1, Inner Shareable
719  // AArch64 TLB Invalidate by VA, All ASID, EL1, Outer Shareable
720  // We are currently not distinguishing Inner and Outer domains.
721  // We therefore implement TLBIOS instructions as TLBIIS
723  {
724  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
725 
726  ExceptionLevel target_el = EL1;
727  if (EL2Enabled(tc)) {
728  HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
729  if (hcr.tge && hcr.e2h) {
730  target_el = EL2;
731  }
732  }
733 
734  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
735  TLBIMVAA tlbiOp(target_el, secure,
736  static_cast<Addr>(bits(value, 43, 0)) << 12,
737  false);
738 
739  tlbiOp.broadcast(tc);
740  return;
741  }
742  // AArch64 TLB Invalidate by VA, All ASID,
743  // Last Level, EL1, Inner Shareable
745  // AArch64 TLB Invalidate by VA, All ASID,
746  // Last Level, EL1, Outer Shareable
747  // We are currently not distinguishing Inner and Outer domains.
748  // We therefore implement TLBIOS instructions as TLBIIS
750  {
751  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
752 
753  ExceptionLevel target_el = EL1;
754  if (EL2Enabled(tc)) {
755  HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
756  if (hcr.tge && hcr.e2h) {
757  target_el = EL2;
758  }
759  }
760 
761  bool secure = release->has(ArmExtension::SECURITY) && !scr.ns;
762  TLBIMVAA tlbiOp(target_el, secure,
763  static_cast<Addr>(bits(value, 43, 0)) << 12,
764  true);
765 
766  tlbiOp.broadcast(tc);
767  return;
768  }
769  // AArch64 TLB Invalidate by Intermediate Physical Address,
770  // Stage 2, EL1
772  {
773  if (EL2Enabled(tc)) {
774  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
775 
776  bool secure = release->has(ArmExtension::SECURITY) &&
777  !scr.ns && !bits(value, 63);
778 
779  const int top_bit = ArmSystem::physAddrRange(tc) == 52 ?
780  39 : 35;
781  TLBIIPA tlbiOp(EL1, secure,
782  static_cast<Addr>(bits(value, top_bit, 0)) << 12,
783  false);
784 
785  tlbiOp(tc);
786  }
787  return;
788  }
789  // AArch64 TLB Invalidate by Intermediate Physical Address,
790  // Stage 2, Last Level EL1
792  {
793  if (EL2Enabled(tc)) {
794  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
795 
796  bool secure = release->has(ArmExtension::SECURITY) &&
797  !scr.ns && !bits(value, 63);
798 
799  TLBIIPA tlbiOp(EL1, secure,
800  static_cast<Addr>(bits(value, 35, 0)) << 12,
801  true);
802 
803  tlbiOp(tc);
804  }
805  return;
806  }
807  // AArch64 TLB Invalidate by Intermediate Physical Address,
808  // Stage 2, EL1, Inner Shareable
810  // AArch64 TLB Invalidate by Intermediate Physical Address,
811  // Stage 2, EL1, Outer Shareable
812  // We are currently not distinguishing Inner and Outer domains.
813  // We therefore implement TLBIOS instructions as TLBIIS
815  {
816  if (EL2Enabled(tc)) {
817  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
818 
819  bool secure = release->has(ArmExtension::SECURITY) &&
820  !scr.ns && !bits(value, 63);
821 
822  const int top_bit = ArmSystem::physAddrRange(tc) == 52 ?
823  39 : 35;
824  TLBIIPA tlbiOp(EL1, secure,
825  static_cast<Addr>(bits(value, top_bit, 0)) << 12,
826  false);
827 
828  tlbiOp.broadcast(tc);
829  }
830  return;
831  }
832  // AArch64 TLB Invalidate by Intermediate Physical Address,
833  // Stage 2, Last Level, EL1, Inner Shareable
835  // AArch64 TLB Invalidate by Intermediate Physical Address,
836  // Stage 2, Last Level, EL1, Outer Shareable
837  // We are currently not distinguishing Inner and Outer domains.
838  // We therefore implement TLBIOS instructions as TLBIIS
840  {
841  if (EL2Enabled(tc)) {
842  SCR scr = tc->readMiscReg(MISCREG_SCR_EL3);
843 
844  bool secure = release->has(ArmExtension::SECURITY) &&
845  !scr.ns && !bits(value, 63);
846 
847  TLBIIPA tlbiOp(EL1, secure,
848  static_cast<Addr>(bits(value, 35, 0)) << 12,
849  true);
850 
851  tlbiOp.broadcast(tc);
852  }
853  return;
854  }
855  default:
856  panic("Invalid TLBI\n");
857  }
858 }
859 
860 } // namespace gem5
gem5::MiscRegImmOp64::generateDisassembly
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: misc64.cc:163
gem5::ArmISA::MISCREG_CPSR
@ MISCREG_CPSR
Definition: misc.hh:66
gem5::ArmSystem::physAddrRange
uint8_t physAddrRange() const
Returns the supported physical address range in bits.
Definition: system.hh:220
gem5::ThreadContext::readMiscReg
virtual RegVal readMiscReg(RegIndex misc_reg)=0
gem5::ArmISA::TLBIALLEL
Implementaton of AArch64 TLBI ALLE(1,2,3)(IS) instructions.
Definition: tlbi_op.hh:170
gem5::ArmISA::MiscRegNum64::op2
unsigned op2
Definition: misc.hh:1725
gem5::ArmISA::MISCREG_TLBI_ALLE3IS
@ MISCREG_TLBI_ALLE3IS
Definition: misc.hh:723
gem5::RegVal
uint64_t RegVal
Definition: types.hh:173
gem5::ArmISA::MISCREG_TLBI_VAAE1IS_Xt
@ MISCREG_TLBI_VAAE1IS_Xt
Definition: misc.hh:690
gem5::ArmISA::TLBIASID
TLB Invalidate by ASID match.
Definition: tlbi_op.hh:228
gem5::ArmISA::MISCREG_TLBI_ALLE1
@ MISCREG_TLBI_ALLE1
Definition: misc.hh:720
gem5::ArmISA::el
Bitfield< 3, 2 > el
Definition: misc_types.hh:73
gem5::ArmISA::MISCREG_TLBI_IPAS2E1IS_Xt
@ MISCREG_TLBI_IPAS2E1IS_Xt
Definition: misc.hh:702
gem5::ArmISA::MISCREG_TLBI_VAAE1_Xt
@ MISCREG_TLBI_VAAE1_Xt
Definition: misc.hh:699
gem5::MiscRegOp64::_iss
uint32_t _iss(const ArmISA::MiscRegNum64 &misc_reg, RegIndex int_index) const
Definition: misc64.cc:114
gem5::ArmISA::ISA
Definition: isa.hh:70
gem5::trace::InstRecord
Definition: insttracer.hh:60
gem5::ArmISA::iss
Bitfield< 24, 0 > iss
Definition: misc_types.hh:729
gem5::ArmISA::asid
asid
Definition: misc_types.hh:675
gem5::ArmISA::MISCREG_SCR_EL3
@ MISCREG_SCR_EL3
Definition: misc.hh:599
gem5::ArmISA::MISCREG_TLBI_ASIDE1OS_Xt
@ MISCREG_TLBI_ASIDE1OS_Xt
Definition: misc.hh:689
gem5::ArmISA::MISCREG_TLBI_IPAS2LE1IS_Xt
@ MISCREG_TLBI_IPAS2LE1IS_Xt
Definition: misc.hh:704
gem5::ArmISA::MISCREG_TLBI_VMALLS12E1IS
@ MISCREG_TLBI_VMALLS12E1IS
Definition: misc.hh:714
gem5::ArmISA::MISCREG_TLBI_VALE2_Xt
@ MISCREG_TLBI_VALE2_Xt
Definition: misc.hh:721
gem5::RegOp64::generateDisassembly
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: misc64.cc:58
gem5::ArmSystem::haveLargeAsid64
bool haveLargeAsid64() const
Returns true if ASID is 16 bits in AArch64 (ARMv8)
Definition: system.hh:206
gem5::ArmISA::MISCREG_TLBI_VALE2IS_Xt
@ MISCREG_TLBI_VALE2IS_Xt
Definition: misc.hh:712
gem5::ArmISA::MISCREG_TLBI_VALE1IS_Xt
@ MISCREG_TLBI_VALE1IS_Xt
Definition: misc.hh:692
gem5::ArmISA::EL1
@ EL1
Definition: types.hh:274
gem5::loader::SymbolTable
Definition: symtab.hh:64
gem5::MiscRegRegImmOp64::iss
uint32_t iss() const override
Definition: misc64.cc:187
gem5::ArmISA::MISCREG_TLBI_IPAS2E1OS_Xt
@ MISCREG_TLBI_IPAS2E1OS_Xt
Definition: misc.hh:703
gem5::csprintf
std::string csprintf(const char *format, const Args &...args)
Definition: cprintf.hh:161
gem5::ArmISA::MISCREG_TLBI_VALE1_Xt
@ MISCREG_TLBI_VALE1_Xt
Definition: misc.hh:700
gem5::ArmISA::MISCREG_TLBI_VAE1IS_Xt
@ MISCREG_TLBI_VAE1IS_Xt
Definition: misc.hh:686
gem5::ArmISA::encoding
Bitfield< 27, 25 > encoding
Definition: types.hh:90
gem5::ImmOp64::generateDisassembly
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: misc64.cc:49
gem5::ArmISA::MISCREG_TLBI_VALE3IS_Xt
@ MISCREG_TLBI_VALE3IS_Xt
Definition: misc.hh:727
gem5::ArmISA::MISCREG_TLBI_VMALLS12E1
@ MISCREG_TLBI_VMALLS12E1
Definition: misc.hh:722
gem5::ccprintf
void ccprintf(cp::Print &print)
Definition: cprintf.hh:130
gem5::ArmISA::MISCREG_TLBI_VAE2_Xt
@ MISCREG_TLBI_VAE2_Xt
Definition: misc.hh:719
gem5::ArmISA::ec
ec
Definition: misc_types.hh:727
gem5::MiscRegOp64::generateTrap
Fault generateTrap(ArmISA::ExceptionLevel el) const
Definition: misc64.cc:126
gem5::RegMiscRegImmOp64::iss
uint32_t iss() const override
Definition: misc64.cc:206
gem5::ArmISA::ExceptionClass::TRAPPED_MSR_MRS_64
@ TRAPPED_MSR_MRS_64
gem5::MiscRegImplDefined64::iss
uint32_t iss() const override
Definition: misc64.cc:231
gem5::MiscRegRegImmOp64::generateDisassembly
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: misc64.cc:175
gem5::ArmISA::MISCREG_TLBI_ALLE2OS
@ MISCREG_TLBI_ALLE2OS
Definition: misc.hh:707
misc64.hh
gem5::MiscRegImplDefined64::generateDisassembly
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: misc64.cc:224
gem5::ThreadContext
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Definition: thread_context.hh:88
gem5::ArmISA::checkFaultAccessAArch64SysReg
Fault checkFaultAccessAArch64SysReg(MiscRegIndex reg, CPSR cpsr, ThreadContext *tc, const MiscRegOp64 &inst)
Definition: misc.cc:729
gem5::TlbiOp64::performTlbi
void performTlbi(ExecContext *xc, ArmISA::MiscRegIndex idx, RegVal value) const
Definition: misc64.cc:247
gem5::Fault
std::shared_ptr< FaultBase > Fault
Definition: types.hh:248
gem5::ArmISA::MISCREG_TLBI_VMALLS12E1OS
@ MISCREG_TLBI_VMALLS12E1OS
Definition: misc.hh:715
gem5::ArmISA::EL2
@ EL2
Definition: types.hh:275
gem5::ArmISA::TLBIMVAA
TLB Invalidate by VA, All ASID.
Definition: tlbi_op.hh:301
gem5::ArmISA::MiscRegNum64::op1
unsigned op1
Definition: misc.hh:1722
isa.hh
gem5::ArmISA::MISCREG_TLBI_VAE1OS_Xt
@ MISCREG_TLBI_VAE1OS_Xt
Definition: misc.hh:687
gem5::ExecContext::tcBase
virtual ThreadContext * tcBase() const =0
Returns a pointer to the ThreadContext.
gem5::ArmISA::MISCREG_TLBI_VAE3OS_Xt
@ MISCREG_TLBI_VAE3OS_Xt
Definition: misc.hh:726
gem5::ArmISA::EL2Enabled
bool EL2Enabled(ThreadContext *tc)
Definition: utility.cc:258
gem5::MiscRegImmOp64::miscRegImm
RegVal miscRegImm() const
Returns the "register view" of the immediate field.
Definition: misc64.cc:148
gem5::ArmISA::MISCREG_SPSEL
@ MISCREG_SPSEL
Definition: misc.hh:623
tlbi_op.hh
gem5::ArmISA::MISCREG_TLBI_ASIDE1IS_Xt
@ MISCREG_TLBI_ASIDE1IS_Xt
Definition: misc.hh:688
gem5::ArmISA::MISCREG_TLBI_VAE2OS_Xt
@ MISCREG_TLBI_VAE2OS_Xt
Definition: misc.hh:709
gem5::ArmISA::MISCREG_TLBI_VMALLE1OS
@ MISCREG_TLBI_VMALLE1OS
Definition: misc.hh:685
gem5::RegRegRegImmOp64::generateDisassembly
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: misc64.cc:92
gem5::bits
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
gem5::ArmISA::EL3
@ EL3
Definition: types.hh:276
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
gem5::RegNone::generateDisassembly
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const
Internal function to generate disassembly string.
Definition: misc64.cc:237
gem5::ArmISA::MISCREG_TLBI_VAALE1OS_Xt
@ MISCREG_TLBI_VAALE1OS_Xt
Definition: misc.hh:695
gem5::ArmISA::MiscRegIndex
MiscRegIndex
Definition: misc.hh:64
gem5::ArmISA::encodeAArch64SysReg
MiscRegNum64 encodeAArch64SysReg(MiscRegIndex misc_reg)
Definition: misc.cc:2188
gem5::MiscRegImplDefined64::execute
Fault execute(ExecContext *xc, trace::InstRecord *traceData) const override
Definition: misc64.cc:213
gem5::ArmISA::TLBIIPA
TLB Invalidate by Intermediate Physical Address.
Definition: tlbi_op.hh:372
gem5::ArmISA::MISCREG_TLBI_IPAS2LE1OS_Xt
@ MISCREG_TLBI_IPAS2LE1OS_Xt
Definition: misc.hh:705
gem5::ArmISA::ExceptionClass
ExceptionClass
Definition: types.hh:300
gem5::ArmISA::MISCREG_TLBI_IPAS2LE1_Xt
@ MISCREG_TLBI_IPAS2LE1_Xt
Definition: misc.hh:717
gem5::ArmISA::MISCREG_TLBI_VAALE1IS_Xt
@ MISCREG_TLBI_VAALE1IS_Xt
Definition: misc.hh:694
gem5::ArmISA::MISCREG_TLBI_VALE3OS_Xt
@ MISCREG_TLBI_VALE3OS_Xt
Definition: misc.hh:728
gem5::ArmISA::MISCREG_TLBI_ALLE1OS
@ MISCREG_TLBI_ALLE1OS
Definition: misc.hh:711
gem5::RegImmImmOp64::generateDisassembly
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: misc64.cc:67
gem5::ArmISA::MISCREG_PAN
@ MISCREG_PAN
Definition: misc.hh:1134
gem5::ArmISA::MiscRegNum64
Definition: misc.hh:1688
gem5::ArmISA::MiscRegNum64::crn
unsigned crn
Definition: misc.hh:1723
gem5::ArmISA::imm
Bitfield< 7, 0 > imm
Definition: types.hh:132
gem5::ArmISA::MISCREG_TLBI_ASIDE1_Xt
@ MISCREG_TLBI_ASIDE1_Xt
Definition: misc.hh:698
gem5::ArmISA::ss
Bitfield< 21 > ss
Definition: misc_types.hh:60
gem5::ArmISA::TLBIOp::broadcast
void broadcast(ThreadContext *tc)
Broadcast the TLB Invalidate operation to all TLBs in the Arm system.
Definition: tlbi_op.hh:73
gem5::ArmISA::MISCREG_TLBI_VAALE1_Xt
@ MISCREG_TLBI_VAALE1_Xt
Definition: misc.hh:701
gem5::ArmISA::TLBIMVA
TLB Invalidate by VA.
Definition: tlbi_op.hh:320
gem5::UnknownOp64::generateDisassembly
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: misc64.cc:107
gem5::MipsISA::pc
Bitfield< 4 > pc
Definition: pra_constants.hh:243
gem5::ArmISA::TLBIVMALL
Implementaton of AArch64 TLBI VMALLE1(IS)/VMALLS112E1(IS) instructions.
Definition: tlbi_op.hh:198
gem5::ExecContext
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
Definition: exec_context.hh:71
gem5::ArmISA::MISCREG_TLBI_ALLE3
@ MISCREG_TLBI_ALLE3
Definition: misc.hh:729
gem5::ArmISA::MISCREG_TLBI_VALE2OS_Xt
@ MISCREG_TLBI_VALE2OS_Xt
Definition: misc.hh:713
gem5::ArmISA::MISCREG_TLBI_VAAE1OS_Xt
@ MISCREG_TLBI_VAAE1OS_Xt
Definition: misc.hh:691
gem5::ArmISA::MiscRegNum64::op0
unsigned op0
Definition: misc.hh:1721
gem5::RegMiscRegImmOp64::generateDisassembly
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: misc64.cc:194
gem5::ThreadContext::getIsaPtr
virtual BaseISA * getIsaPtr() const =0
gem5::RegIndex
uint16_t RegIndex
Definition: types.hh:176
gem5::ArmISA::MISCREG_HCR_EL2
@ MISCREG_HCR_EL2
Definition: misc.hh:591
gem5::ArmISA::MISCREG_TLBI_ALLE1IS
@ MISCREG_TLBI_ALLE1IS
Definition: misc.hh:710
gem5::ArmISA::MISCREG_IMPDEF_UNIMPL
@ MISCREG_IMPDEF_UNIMPL
Definition: misc.hh:1114
gem5::ArmISA::MISCREG_TLBI_VALE3_Xt
@ MISCREG_TLBI_VALE3_Xt
Definition: misc.hh:731
gem5::ArmISA::MISCREG_TLBI_ALLE2
@ MISCREG_TLBI_ALLE2
Definition: misc.hh:718
gem5::ArmISA::MISCREG_TLBI_VMALLE1
@ MISCREG_TLBI_VMALLE1
Definition: misc.hh:696
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::ArmISA::MISCREG_TLBI_VAE1_Xt
@ MISCREG_TLBI_VAE1_Xt
Definition: misc.hh:697
gem5::ArmISA::ISA::getRelease
const ArmRelease * getRelease() const
Definition: isa.hh:192
gem5::ArmISA::MISCREG_TLBI_VMALLE1IS
@ MISCREG_TLBI_VMALLE1IS
Definition: misc.hh:684
gem5::ArmISA::MISCREG_TLBI_VAE3IS_Xt
@ MISCREG_TLBI_VAE3IS_Xt
Definition: misc.hh:725
gem5::ArmISA::MISCREG_TLBI_IPAS2E1_Xt
@ MISCREG_TLBI_IPAS2E1_Xt
Definition: misc.hh:716
gem5::RegRegImmImmOp64::generateDisassembly
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: misc64.cc:79
gem5::ArmISA::MISCREG_TLBI_ALLE3OS
@ MISCREG_TLBI_ALLE3OS
Definition: misc.hh:724
gem5::ArmISA::MISCREG_UAO
@ MISCREG_UAO
Definition: misc.hh:1135
gem5::ArmISA::MISCREG_TLBI_VAE2IS_Xt
@ MISCREG_TLBI_VAE2IS_Xt
Definition: misc.hh:708
gem5::ArmISA::ExceptionLevel
ExceptionLevel
Definition: types.hh:271
panic
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:188
gem5::ArmISA::MISCREG_TLBI_ALLE2IS
@ MISCREG_TLBI_ALLE2IS
Definition: misc.hh:706
gem5::ArmISA::MISCREG_TLBI_VAE3_Xt
@ MISCREG_TLBI_VAE3_Xt
Definition: misc.hh:730
gem5::ArmISA::MiscRegNum64::crm
unsigned crm
Definition: misc.hh:1724

Generated on Sun Jul 30 2023 01:56:48 for gem5 by doxygen 1.8.17