gem5  [DEVELOP-FOR-23.0]
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
aapcs32.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2019 Google Inc.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met: redistributions of source code must retain the above copyright
7  * notice, this list of conditions and the following disclaimer;
8  * redistributions in binary form must reproduce the above copyright
9  * notice, this list of conditions and the following disclaimer in the
10  * documentation and/or other materials provided with the distribution;
11  * neither the name of the copyright holders nor the names of its
12  * contributors may be used to endorse or promote products derived from
13  * this software without specific prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #ifndef __ARCH_ARM_AAPCS32_HH__
29 #define __ARCH_ARM_AAPCS32_HH__
30 
31 #include <algorithm>
32 #include <array>
33 #include <type_traits>
34 #include <utility>
35 
36 #include "arch/arm/regs/int.hh"
37 #include "arch/arm/regs/vec.hh"
38 #include "arch/arm/utility.hh"
39 #include "base/intmath.hh"
40 #include "cpu/thread_context.hh"
41 #include "mem/port_proxy.hh"
44 #include "sim/full_system.hh"
45 #include "sim/guest_abi.hh"
46 #include "sim/proxy_ptr.hh"
47 
48 namespace gem5
49 {
50 
51 class ThreadContext;
52 
53 struct Aapcs32
54 {
55  struct State
56  {
57  bool stackUsed=false; // Whether anything has been put on the stack.
58 
59  int ncrn=0; // Next general purpose register number.
60  Addr nsaa; // Next stacked argument address.
61 
62  // The maximum allowed general purpose register number.
63  static const int MAX_CRN = 3;
64 
66 
67  explicit State(const ThreadContext *tc) :
68  nsaa(tc->getReg(ArmISA::int_reg::Spx))
69  {}
70  };
71 };
72 
73 namespace guest_abi
74 {
75 
76 /*
77  * Composite Types
78  */
79 
80 template <typename T, typename Enabled=void>
81 struct IsAapcs32Composite : public std::false_type {};
82 
83 template <typename T>
84 struct IsAapcs32Composite<T, typename std::enable_if_t<
85  (std::is_array_v<T> || std::is_class_v<T> || std::is_union_v<T>) &&
86  // VarArgs is technically a composite type, but it's not a normal argument.
87  !IsVarArgsV<T>
88  >> : public std::true_type
89 {};
90 
91 template <typename T>
93 
94 // Homogeneous Aggregates
95 // These *should* be any aggregate type which has only one type of member, but
96 // we can't actually detect that or manipulate that with templates. Instead,
97 // we approximate that by detecting only arrays with that property.
98 
99 template <typename T, std::size_t count, typename Enabled=void>
101 
102 template <typename T>
103 struct IsAapcs32HomogeneousAggregate : public std::false_type {};
104 
105 template <typename E, size_t N>
106 struct IsAapcs32HomogeneousAggregate<E[N]> : public std::true_type {};
107 
108 template <typename T>
111 
113 {
114  template <typename T>
115  static T
117  {
118  state.stackUsed = true;
119 
120  // The alignment is the larger of 4 or the natural alignment of T.
121  size_t align = std::max<size_t>(4, alignof(T));
122  // Increase the size to the next multiple of 4.
123  size_t size = roundUp(sizeof(T), 4);
124 
125  // Align the stack.
126  state.nsaa = roundUp(state.nsaa, align);
127 
128  // Extract the value from it.
129  ConstVPtr<T> val(state.nsaa, tc);
130 
131  // Move the nsaa past this argument.
132  state.nsaa += size;
133 
134  // Return the value we extracted.
135  return gtoh(*val, ArmISA::byteOrder(tc));
136  }
137 };
138 
139 
140 /*
141  * Integer arguments and return values.
142  */
143 
144 template <typename Integer>
145 struct Result<Aapcs32, Integer, typename std::enable_if_t<
146  std::is_integral_v<Integer> && (sizeof(Integer) < sizeof(uint32_t))>>
147 {
148  static void
149  store(ThreadContext *tc, const Integer &i)
150  {
151  uint32_t val = std::is_signed_v<Integer> ?
152  sext<sizeof(Integer) * 8>(i) : i;
154  }
155 };
156 
157 template <typename Integer>
158 struct Result<Aapcs32, Integer, typename std::enable_if_t<
159  std::is_integral_v<Integer> && (sizeof(Integer) == sizeof(uint32_t))>>
160 {
161  static void
162  store(ThreadContext *tc, const Integer &i)
163  {
164  tc->setReg(ArmISA::int_reg::R0, (uint32_t)i);
165  }
166 };
167 
168 template <typename Integer>
169 struct Result<Aapcs32, Integer, typename std::enable_if_t<
170  std::is_integral_v<Integer> && (sizeof(Integer) == sizeof(uint64_t))>>
171 {
172  static void
173  store(ThreadContext *tc, const Integer &i)
174  {
175  if (ArmISA::byteOrder(tc) == ByteOrder::little) {
176  tc->setReg(ArmISA::int_reg::R0, (uint32_t)(i >> 0));
177  tc->setReg(ArmISA::int_reg::R1, (uint32_t)(i >> 32));
178  } else {
179  tc->setReg(ArmISA::int_reg::R0, (uint32_t)(i >> 32));
180  tc->setReg(ArmISA::int_reg::R1, (uint32_t)(i >> 0));
181  }
182  }
183 };
184 
185 template <typename Integer>
186 struct Argument<Aapcs32, Integer, typename std::enable_if_t<
187  std::is_integral_v<Integer> && (sizeof(Integer) <= sizeof(uint32_t))
188  >> : public Aapcs32ArgumentBase
189 {
190  static Integer
192  {
193  if (state.ncrn <= state.MAX_CRN) {
194  return tc->getReg(ArmISA::intRegClass[state.ncrn++]);
195  }
196 
197  // Max out the ncrn since we effectively exhausted it.
198  state.ncrn = state.MAX_CRN + 1;
199 
200  return loadFromStack<Integer>(tc, state);
201  }
202 };
203 
204 template <typename Integer>
205 struct Argument<Aapcs32, Integer, typename std::enable_if_t<
206  std::is_integral_v<Integer> && (sizeof(Integer) > sizeof(uint32_t))
207  >> : public Aapcs32ArgumentBase
208 {
209  static Integer
211  {
212  if (alignof(Integer) == 8 && (state.ncrn % 2))
213  state.ncrn++;
214 
215  if (sizeof(Integer) == sizeof(uint64_t) &&
216  state.ncrn + 1 <= state.MAX_CRN) {
217  Integer low, high;
218  if (ArmISA::byteOrder(tc) == ByteOrder::little) {
219  low = tc->getReg(ArmISA::intRegClass[state.ncrn++]) & mask(32);
220  high = tc->getReg(ArmISA::intRegClass[state.ncrn++]) &
221  mask(32);
222  } else {
223  high = tc->getReg(ArmISA::intRegClass[state.ncrn++]) &
224  mask(32);
225  low = tc->getReg(ArmISA::intRegClass[state.ncrn++]) & mask(32);
226  }
227  return low | (high << 32);
228  }
229 
230  // Max out the ncrn since we effectively exhausted it.
231  state.ncrn = state.MAX_CRN + 1;
232 
233  return loadFromStack<Integer>(tc, state);
234  }
235 };
236 
237 
238 /*
239  * Floating point and Short-Vector arguments and return values.
240  */
241 
242 template <typename Float>
243 struct Result<Aapcs32, Float, typename std::enable_if_t<
244  std::is_floating_point_v<Float>>>
245 {
246  static void
247  store(ThreadContext *tc, const Float &f, Aapcs32::State &state)
248  {
249  auto i = floatToBits(f);
250  storeResult<Aapcs32, decltype(i)>(tc, i, state);
251  };
252 };
253 
254 template <typename Float>
255 struct Argument<Aapcs32, Float, typename std::enable_if_t<
256  std::is_floating_point_v<Float>>> : public Aapcs32ArgumentBase
257 {
258  static Float
260  {
261  if (sizeof(Float) == sizeof(uint32_t)) {
262  return bitsToFloat32(
263  getArgument<Aapcs32, uint32_t>(tc, state));
264  } else {
265  return bitsToFloat64(
266  getArgument<Aapcs32, uint64_t>(tc, state));
267  }
268  }
269 };
270 
271 
272 /*
273  * Composite arguments and return values.
274  */
275 
276 template <typename Composite>
277 struct Result<Aapcs32, Composite, typename std::enable_if_t<
278  IsAapcs32CompositeV<Composite>>>
279 {
280  static void
281  store(ThreadContext *tc, const Composite &composite,
283  {
284  if (sizeof(Composite) <= sizeof(uint32_t)) {
285  Composite cp = htog(composite, ArmISA::byteOrder(tc));
286  uint32_t val;
287  memcpy((void *)&val, (void *)&cp, sizeof(Composite));
288  val = gtoh(val, ArmISA::byteOrder(tc));
290  } else {
291  VPtr<Composite> cp(state.retAddr, tc);
292  *cp = htog(composite, ArmISA::byteOrder(tc));
293  }
294  }
295 
296  static void
298  {
299  if (sizeof(Composite) > sizeof(uint32_t))
300  state.retAddr = tc->getReg(ArmISA::intRegClass[state.ncrn++]);
301  }
302 };
303 
304 template <typename Composite>
305 struct Argument<Aapcs32, Composite, typename std::enable_if_t<
306  IsAapcs32CompositeV<Composite>>> :
307  public Aapcs32ArgumentBase
308 {
309  static Composite
311  {
312  size_t bytes = sizeof(Composite);
313  using Chunk = uint32_t;
314 
315  const int chunk_size = sizeof(Chunk);
316  const int regs = (bytes + chunk_size - 1) / chunk_size;
317 
318  if (bytes <= chunk_size) {
319  if (state.ncrn++ <= state.MAX_CRN) {
320  alignas(alignof(Composite)) uint32_t val =
321  tc->getReg(ArmISA::intRegClass[state.ncrn++]);
322  val = htog(val, ArmISA::byteOrder(tc));
323  return gtoh(*(Composite *)&val, ArmISA::byteOrder(tc));
324  }
325  }
326 
327  if (alignof(Composite) == 8 && (state.ncrn % 2))
328  state.ncrn++;
329 
330  if (state.ncrn + regs - 1 <= state.MAX_CRN) {
331  alignas(alignof(Composite)) uint8_t buf[bytes];
332  for (int i = 0; i < regs; i++) {
333  Chunk val = tc->getReg(ArmISA::intRegClass[state.ncrn++]);
334  val = htog(val, ArmISA::byteOrder(tc));
335  size_t to_copy = std::min<size_t>(bytes, chunk_size);
336  memcpy(buf + i * chunk_size, &val, to_copy);
337  bytes -= to_copy;
338  }
339  return gtoh(*(Composite *)buf, ArmISA::byteOrder(tc));
340  }
341 
342  if (!state.stackUsed && state.ncrn <= state.MAX_CRN) {
343  alignas(alignof(Composite)) uint8_t buf[bytes];
344 
345  int offset = 0;
346  while (state.ncrn <= state.MAX_CRN) {
347  Chunk val = tc->getReg(ArmISA::intRegClass[state.ncrn++]);
348  val = htog(val, ArmISA::byteOrder(tc));
349  size_t to_copy = std::min<size_t>(bytes, chunk_size);
350  memcpy(buf + offset, &val, to_copy);
351  offset += to_copy;
352  bytes -= to_copy;
353  }
354 
355  if (bytes) {
356  TranslatingPortProxy fs_proxy(tc);
357  SETranslatingPortProxy se_proxy(tc);
358  PortProxy &virt_proxy = FullSystem ? fs_proxy : se_proxy;
359 
360  virt_proxy.readBlob(
361  state.nsaa, buf, bytes);
362 
363  state.stackUsed = true;
364  state.nsaa += roundUp(bytes, 4);
365  state.ncrn = state.MAX_CRN + 1;
366  }
367 
368  return gtoh(*(Composite *)buf, ArmISA::byteOrder(tc));
369  }
370 
371  state.ncrn = state.MAX_CRN + 1;
372 
373  return loadFromStack<Composite>(tc, state);
374  }
375 };
376 
377 } // namespace guest_abi
378 
379 
380 /*
381  * VFP ABI variant.
382  */
383 
384 struct Aapcs32Vfp : public Aapcs32
385 {
386  struct State : public Aapcs32::State
387  {
388  bool variadic=false; // Whether this function is variadic.
389 
390  // Whether the various single and double precision registers have
391  // been allocated.
392  std::array<bool, 16> s;
393  std::array<bool, 8> d;
394 
395  explicit State(const ThreadContext *tc) : Aapcs32::State(tc)
396  {
397  s.fill(false);
398  d.fill(false);
399  }
400 
401  int
402  allocate(float, int count)
403  {
404  int last = 0;
405  for (int i = 0; i <= s.size() - count; i++) {
406  if (s[i]) {
407  last = i + 1;
408  continue;
409  }
410  if (i - last + 1 == count) {
411  for (int j = 0; j < count; j++) {
412  s[last + j] = true;
413  d[(last + j) / 2] = true;
414  }
415  return last;
416  }
417  }
418  s.fill(true);
419  d.fill(true);
420  return -1;
421  }
422 
423  int
424  allocate(double, int count)
425  {
426  int last = 0;
427  for (int i = 0; i <= d.size() - count; i++) {
428  if (d[i]) {
429  last = i + 1;
430  continue;
431  }
432  if (i - last + 1 == count) {
433  for (int j = 0; j < count; j++) {
434  d[last + j] = true;
435  s[(last + j) * 2] = true;
436  s[(last + j) * 2 + 1] = true;
437  }
438  return last;
439  }
440  }
441  s.fill(true);
442  d.fill(true);
443  return -1;
444  }
445  };
446 };
447 
448 namespace guest_abi
449 {
450 
451 /*
452  * Integer arguments and return values.
453  */
454 
455 template <typename Integer>
456 struct Result<Aapcs32Vfp, Integer, typename std::enable_if_t<
457  std::is_integral_v<Integer>>> : public Result<Aapcs32, Integer>
458 {};
459 
460 template <typename Integer>
461 struct Argument<Aapcs32Vfp, Integer, typename std::enable_if_t<
462  std::is_integral_v<Integer>>> : public Argument<Aapcs32, Integer>
463 {};
464 
465 
466 /*
467  * Floating point arguments and return values.
468  */
469 
470 template <typename Float>
471 struct Result<Aapcs32Vfp, Float, typename std::enable_if_t<
472  std::is_floating_point_v<Float>>>
473 {
474  static void
476  {
477  if (state.variadic) {
478  storeResult<Aapcs32, Float>(tc, f, state);
479  return;
480  }
481 
482  auto bytes = floatToBits(f);
483  auto *vec_elems = static_cast<ArmISA::VecElem *>(&bytes);
484  constexpr int chunks = sizeof(Float) / sizeof(ArmISA::VecElem);
485  for (int chunk = 0; chunk < chunks; chunk++)
486  tc->setReg(ArmISA::vecElemClass[chunk], vec_elems[chunk]);
487  };
488 };
489 
490 template <typename Float>
491 struct Argument<Aapcs32Vfp, Float, typename std::enable_if_t<
492  std::is_floating_point_v<Float>>> : public Aapcs32ArgumentBase
493 {
494  static Float
496  {
497  if (state.variadic)
498  return getArgument<Aapcs32, Float>(tc, state);
499 
500  const int index = state.allocate(Float{}, 1);
501 
502  if (index < 0)
503  return loadFromStack<Float>(tc, state);
504 
505  decltype(floatToBits(Float{})) result;
506  auto *vec_elems = static_cast<ArmISA::VecElem *>(&result);
507 
508  constexpr int chunks = sizeof(Float) / sizeof(ArmISA::VecElem);
509  for (int chunk = 0; chunk < chunks; chunk++)
510  vec_elems[chunk] = tc->getReg(ArmISA::vecElemClass[chunk]);
511 
512  return bitsToFloat(result);
513  }
514 };
515 
516 
517 /*
518  * Composite arguments and return values which are not Homogeneous Aggregates.
519  */
520 
521 template <typename Composite>
522 struct Result<Aapcs32Vfp, Composite, typename std::enable_if_t<
523  IsAapcs32CompositeV<Composite> &&
524  !IsAapcs32HomogeneousAggregateV<Composite>>> :
525  public Result<Aapcs32, Composite>
526 {};
527 
528 template <typename Composite>
529 struct Argument<Aapcs32Vfp, Composite, typename std::enable_if_t<
530  IsAapcs32CompositeV<Composite> &&
531  !IsAapcs32HomogeneousAggregateV<Composite>>> :
532  public Argument<Aapcs32, Composite>
533 {};
534 
535 
536 /*
537  * Homogeneous Aggregate argument and return values.
538  */
539 
540 template <typename T>
541 struct Aapcs32ArrayType { using Type = void; };
542 
543 template <typename E, size_t N>
544 struct Aapcs32ArrayType<E[N]> { using Type = E; };
545 
546 template <typename HA>
547 struct Argument<Aapcs32Vfp, HA, typename std::enable_if_t<
548  IsAapcs32HomogeneousAggregateV<HA>>> :
549  public Aapcs32ArgumentBase
550 {
551  static bool
553  {
554  using Elem = typename Aapcs32ArrayType<HA>::Type;
555  constexpr size_t Count = sizeof(HA) / sizeof(Elem);
556  return state.variadic || !std::is_floating_point_v<Elem> ||
557  Count > 4;
558  }
559 
560  static HA
562  {
563  using Elem = typename Aapcs32ArrayType<HA>::Type;
564  constexpr size_t Count = sizeof(HA) / sizeof(Elem);
565 
566  if (useBaseABI(state))
567  return getArgument<Aapcs32, HA>(tc, state);
568 
569  const int base = state.allocate(Elem{}, Count);
570  if (base >= 0) {
571  constexpr int lane_per_reg = 16 / sizeof(Elem);
572  HA ha;
573  for (int i = 0; i < Count; i++) {
574  const int index = base + i;
575  const int reg = index / lane_per_reg;
576  const int lane = index % lane_per_reg;
577 
580  tc->getReg(id, &val);
581  ha[i] = val.as<Elem>()[lane];
582  }
583  return ha;
584  }
585 
586  return loadFromStack<HA>(tc, state);
587  }
588 
589  static void
591  {
592  if (useBaseABI(state))
594  }
595 };
596 
597 template <typename HA>
598 struct Result<Aapcs32Vfp, HA,
599  typename std::enable_if_t<IsAapcs32HomogeneousAggregateV<HA>>>
600 {
601  static bool
603  {
604  using Elem = typename Aapcs32ArrayType<HA>::Type;
605  constexpr size_t Count = sizeof(HA) / sizeof(Elem);
606  return state.variadic || !std::is_floating_point_v<Elem> ||
607  Count > 4;
608  }
609 
610  static HA
612  {
613  using Elem = typename Aapcs32ArrayType<HA>::Type;
614  constexpr size_t Count = sizeof(HA) / sizeof(Elem);
615 
616  if (useBaseABI(state)) {
617  storeResult<Aapcs32, HA>(tc, ha, state);
618  return;
619  }
620 
621  constexpr int lane_per_reg = 16 / sizeof(Elem);
622  for (int i = 0; i < Count; i++) {
623  const int reg = i / lane_per_reg;
624  const int lane = i % lane_per_reg;
625 
628  tc->getReg(id, &val);
629  val.as<Elem>()[lane] = ha[i];
630  tc->setReg(id, &val);
631  }
632  }
633 
634  static void
636  {
637  if (useBaseABI(state))
639  }
640 };
641 
642 
643 /*
644  * Varargs
645  */
646 
647 template <typename ...Types>
648 struct Argument<Aapcs32Vfp, VarArgs<Types...>>
649 {
650  static VarArgs<Types...>
652  {
653  state.variadic = true;
654  return getArgument<Aapcs32, VarArgs<Types...>>(tc, state);
655  }
656 };
657 
658 } // namespace guest_abi
659 } // namespace gem5
660 
661 #endif // __ARCH_ARM_AAPCS32_HH__
gem5::Aapcs32Vfp::State::allocate
int allocate(double, int count)
Definition: aapcs32.hh:424
gem5::Aapcs32Vfp::State::State
State(const ThreadContext *tc)
Definition: aapcs32.hh:395
gem5::VegaISA::f
Bitfield< 56 > f
Definition: pagetable.hh:53
gem5::SETranslatingPortProxy
Definition: se_translating_port_proxy.hh:49
gem5::guest_abi::Result< Aapcs32Vfp, HA, typename std::enable_if_t< IsAapcs32HomogeneousAggregateV< HA > > >::prepare
static void prepare(ThreadContext *tc, Aapcs32Vfp::State &state)
Definition: aapcs32.hh:635
gem5::bitsToFloat32
static float bitsToFloat32(uint32_t val)
Definition: types.hh:206
gem5::ConstProxyPtr
Definition: proxy_ptr.hh:109
gem5::MipsISA::misc_reg::Count
@ Count
Definition: misc.hh:94
gem5::guest_abi::getArgument
static Arg getArgument(ThreadContext *tc, typename ABI::State &state)
Definition: layout.hh:170
gem5::Aapcs32Vfp
Definition: aapcs32.hh:384
gem5::MipsISA::index
Bitfield< 30, 0 > index
Definition: pra_constants.hh:47
gem5::ThreadContext::getReg
virtual RegVal getReg(const RegId &reg) const
Definition: thread_context.cc:180
gem5::Aapcs32::State::retAddr
Addr retAddr
Definition: aapcs32.hh:65
gem5::guest_abi::Argument< Aapcs32, Float, typename std::enable_if_t< std::is_floating_point_v< Float > > >::get
static Float get(ThreadContext *tc, Aapcs32::State &state)
Definition: aapcs32.hh:259
gem5::Aapcs32::State
Definition: aapcs32.hh:55
gem5::bitsToFloat64
static double bitsToFloat64(uint64_t val)
Definition: types.hh:218
gem5::guest_abi::enable_if_t< std::is_integral_v< Integer > &&(sizeof(Integer)<=sizeof(uint32_t)) > >::get
static Integer get(ThreadContext *tc, Aapcs32::State &state)
Definition: aapcs32.hh:191
gem5::Aapcs32
Definition: aapcs32.hh:53
translating_port_proxy.hh
gem5::guest_abi::Argument< Aapcs32Vfp, HA, typename std::enable_if_t< IsAapcs32HomogeneousAggregateV< HA > > >::prepare
static void prepare(ThreadContext *tc, Aapcs32Vfp::State &state)
Definition: aapcs32.hh:590
gem5::X86ISA::val
Bitfield< 63 > val
Definition: misc.hh:776
gem5::guest_abi::enable_if_t< std::is_integral_v< Integer > &&(sizeof(Integer)< sizeof(uint32_t))> >::store
static void store(ThreadContext *tc, const Integer &i)
Definition: aapcs32.hh:149
gem5::guest_abi::Result< Aapcs32, Composite, typename std::enable_if_t< IsAapcs32CompositeV< Composite > > >::store
static void store(ThreadContext *tc, const Composite &composite, Aapcs32::State &state)
Definition: aapcs32.hh:281
gem5::ArmISA::byteOrder
ByteOrder byteOrder(const ThreadContext *tc)
Definition: utility.hh:357
vec.hh
proxy_ptr.hh
gem5::X86ISA::base
Bitfield< 51, 12 > base
Definition: pagetable.hh:141
gem5::guest_abi::Aapcs32ArgumentBase::loadFromStack
static T loadFromStack(ThreadContext *tc, Aapcs32::State &state)
Definition: aapcs32.hh:116
gem5::Aapcs32Vfp::State::variadic
bool variadic
Definition: aapcs32.hh:388
gem5::ArmISA::i
Bitfield< 7 > i
Definition: misc_types.hh:67
gem5::Aapcs32Vfp::State::d
std::array< bool, 8 > d
Definition: aapcs32.hh:393
gem5::guest_abi::Aapcs32ArrayType
Definition: aapcs32.hh:541
gem5::Aapcs32::State::ncrn
int ncrn
Definition: aapcs32.hh:59
sc_dt::align
void align(const scfx_rep &lhs, const scfx_rep &rhs, int &new_wp, int &len_mant, scfx_mant_ref &lhs_mant, scfx_mant_ref &rhs_mant)
Definition: scfx_rep.cc:2083
gem5::mask
constexpr uint64_t mask(unsigned nbits)
Generate a 64-bit mask of 'nbits' 1s, right justified.
Definition: bitfield.hh:63
gem5::guest_abi::Result< Aapcs32, Integer, typename std::enable_if_t< std::is_integral_v< Integer > &&(sizeof(Integer)==sizeof(uint64_t))> >::store
static void store(ThreadContext *tc, const Integer &i)
Definition: aapcs32.hh:173
gem5::TranslatingPortProxy
This proxy attempts to translate virtual addresses using the TLBs.
Definition: translating_port_proxy.hh:60
gem5::guest_abi::Result< Aapcs32, Float, typename std::enable_if_t< std::is_floating_point_v< Float > > >::store
static void store(ThreadContext *tc, const Float &f, Aapcs32::State &state)
Definition: aapcs32.hh:247
gem5::guest_abi::Result< Aapcs32Vfp, HA, typename std::enable_if_t< IsAapcs32HomogeneousAggregateV< HA > > >::store
static HA store(ThreadContext *tc, const HA &ha, Aapcs32Vfp::State &state)
Definition: aapcs32.hh:611
gem5::guest_abi::Argument< Aapcs32, Composite, typename std::enable_if_t< IsAapcs32CompositeV< Composite > > >::get
static Composite get(ThreadContext *tc, Aapcs32::State &state)
Definition: aapcs32.hh:310
gem5::Aapcs32::State::State
State(const ThreadContext *tc)
Definition: aapcs32.hh:67
gem5::ArmISA::j
Bitfield< 24 > j
Definition: misc_types.hh:57
gem5::floatToBits
static uint64_t floatToBits(double val)
Definition: types.hh:202
gem5::high
high
Definition: intmath.hh:176
gem5::guest_abi::IsAapcs32HomogeneousAggregate
Definition: aapcs32.hh:103
gem5::VecRegContainer
Vector Register Abstraction This generic class is the model in a particularization of MVC,...
Definition: vec_reg.hh:123
gem5::ThreadContext
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Definition: thread_context.hh:88
gem5::guest_abi::Argument< Aapcs32Vfp, HA, typename std::enable_if_t< IsAapcs32HomogeneousAggregateV< HA > > >::get
static HA get(ThreadContext *tc, Aapcs32Vfp::State &state)
Definition: aapcs32.hh:561
gem5::X86ISA::count
count
Definition: misc.hh:710
port_proxy.hh
gem5::gtoh
T gtoh(T value, ByteOrder guest_byte_order)
Definition: byteswap.hh:194
gem5::PortProxy
This object is a proxy for a port or other object which implements the functional response protocol,...
Definition: port_proxy.hh:86
gem5::guest_abi::Argument< Aapcs32Vfp, HA, typename std::enable_if_t< IsAapcs32HomogeneousAggregateV< HA > > >::useBaseABI
static bool useBaseABI(Aapcs32Vfp::State &state)
Definition: aapcs32.hh:552
gem5::Aapcs32Vfp::State::allocate
int allocate(float, int count)
Definition: aapcs32.hh:402
gem5::ArmISA::intRegClass
constexpr RegClass intRegClass
Definition: int.hh:173
gem5::Aapcs32Vfp::State::s
std::array< bool, 16 > s
Definition: aapcs32.hh:392
gem5::htog
T htog(T value, ByteOrder guest_byte_order)
Definition: byteswap.hh:187
gem5::ProxyPtr
Definition: proxy_ptr.hh:238
gem5::bitsToFloat
static double bitsToFloat(uint64_t val)
Definition: types.hh:229
gem5::ArmISA::offset
Bitfield< 23, 0 > offset
Definition: types.hh:144
gem5::PortProxy::readBlob
void readBlob(Addr addr, void *p, int size) const
Higher level interfaces based on the above.
Definition: port_proxy.hh:182
gem5::guest_abi::Aapcs32ArrayType::Type
void Type
Definition: aapcs32.hh:541
gem5::guest_abi::IsAapcs32Composite
Definition: aapcs32.hh:81
gem5::Aapcs32::State::nsaa
Addr nsaa
Definition: aapcs32.hh:60
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
gem5::ArmISA::vecRegClass
constexpr RegClass vecRegClass
Definition: vec.hh:101
utility.hh
full_system.hh
gem5::X86ISA::reg
Bitfield< 5, 3 > reg
Definition: types.hh:92
gem5::guest_abi::Argument< Aapcs32Vfp, VarArgs< Types... > >::get
static VarArgs< Types... > get(ThreadContext *tc, typename Aapcs32Vfp::State &state)
Definition: aapcs32.hh:651
gem5::FullSystem
bool FullSystem
The FullSystem variable can be used to determine the current mode of simulation.
Definition: root.cc:220
gem5::Aapcs32::State::MAX_CRN
static const int MAX_CRN
Definition: aapcs32.hh:63
gem5::guest_abi::Result< Aapcs32, Composite, typename std::enable_if_t< IsAapcs32CompositeV< Composite > > >::prepare
static void prepare(ThreadContext *tc, Aapcs32::State &state)
Definition: aapcs32.hh:297
state
atomic_var_t state
Definition: helpers.cc:188
gem5::guest_abi::Argument< Aapcs32Vfp, Float, typename std::enable_if_t< std::is_floating_point_v< Float > > >::get
static Float get(ThreadContext *tc, Aapcs32Vfp::State &state)
Definition: aapcs32.hh:495
gem5::guest_abi::IsAapcs32HomogeneousAggregateV
constexpr bool IsAapcs32HomogeneousAggregateV
Definition: aapcs32.hh:109
gem5::guest_abi::IsAapcs32CompositeV
constexpr bool IsAapcs32CompositeV
Definition: aapcs32.hh:92
gem5::ArmISA::vecElemClass
constexpr RegClass vecElemClass
Definition: vec.hh:105
std
Overload hash function for BasicBlockRange type.
Definition: misc.hh:2909
gem5::ArmISA::VecElem
uint32_t VecElem
Definition: vec.hh:63
gem5::guest_abi::getReg
struct IsAapcs64Hfa< E[N], typename std::enable_if_t< std::is_floating_point_v< E > &&N<=4 > > :public std::true_type{};template< typename T >constexpr bool IsAapcs64HfaV=IsAapcs64Hfa< T >::value;template< typename T, typename Enabled=void >struct IsAapcs64Hva :public std::false_type {};template< typename E, size_t N >struct IsAapcs64Hva< E[N], typename std::enable_if_t< IsAapcs64ShortVectorV< E > &&N<=4 > > :public std::true_type{};template< typename T >constexpr bool IsAapcs64HvaV=IsAapcs64Hva< T >::value;template< typename T, typename Enabled=void >struct IsAapcs64Hxa :public std::false_type {};template< typename T >struct IsAapcs64Hxa< T, typename std::enable_if_t< IsAapcs64HfaV< T >||IsAapcs64HvaV< T > > > :public std::true_type{};template< typename T >constexpr bool IsAapcs64HxaV=IsAapcs64Hxa< T >::value;struct Aapcs64ArgumentBase{ template< typename T > static T loadFromStack(ThreadContext *tc, Aapcs64::State &state) { size_t align=std::max< size_t >(8, alignof(T));size_t size=roundUp(sizeof(T), 8);state.nsaa=roundUp(state.nsaa, align);ConstVPtr< T > val(state.nsaa, tc);state.nsaa+=size;return gtoh(*val, ArmISA::byteOrder(tc));}};template< typename Float >struct Argument< Aapcs64, Float, typename std::enable_if_t< std::is_floating_point_v< Float >||IsAapcs64ShortVectorV< Float > > > :public Aapcs64ArgumentBase{ static Float get(ThreadContext *tc, Aapcs64::State &state) { if(state.nsrn<=state.MAX_SRN) { RegId id=ArmISA::vecRegClass[state.nsrn++];ArmISA::VecRegContainer vc;tc->getReg(id, &vc);return vc.as< Float >()[0];} return loadFromStack< Float >(tc, state);}};template< typename Float >struct Result< Aapcs64, Float, typename std::enable_if_t< std::is_floating_point_v< Float >||IsAapcs64ShortVectorV< Float > > >{ static void store(ThreadContext *tc, const Float &f) { RegId id=ArmISA::vecRegClass[0];ArmISA::VecRegContainer reg;tc-> getReg(id, &reg)
Definition: aapcs64.hh:223
guest_abi.hh
gem5::X86ISA::E
Bitfield< 31, 0 > E
Definition: int.hh:56
gem5::roundUp
static constexpr T roundUp(const T &val, const U &align)
This function is used to align addresses in memory.
Definition: intmath.hh:260
gem5::guest_abi::Result< Aapcs32Vfp, HA, typename std::enable_if_t< IsAapcs32HomogeneousAggregateV< HA > > >::useBaseABI
static bool useBaseABI(Aapcs32Vfp::State &state)
Definition: aapcs32.hh:602
gem5::ArmISA::int_reg::R1
constexpr RegId R1
Definition: int.hh:187
gem5::guest_abi::Aapcs32ArgumentBase
Definition: aapcs32.hh:112
gem5::guest_abi::Argument
Definition: definition.hh:98
se_translating_port_proxy.hh
gem5::Aapcs32Vfp::State
Definition: aapcs32.hh:386
gem5::guest_abi::VarArgs
Definition: varargs.hh:149
intmath.hh
gem5::guest_abi::Result
Definition: definition.hh:63
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::ArmISA::ha
Bitfield< 39 > ha
Definition: misc_types.hh:601
gem5::guest_abi::Aapcs32ArrayType< E[N]>::Type
E Type
Definition: aapcs32.hh:544
int.hh
gem5::ArmISA::int_reg::R0
constexpr RegId R0
Definition: int.hh:186
thread_context.hh
gem5::guest_abi::Result< Aapcs32, Integer, typename std::enable_if_t< std::is_integral_v< Integer > &&(sizeof(Integer)==sizeof(uint32_t))> >::store
static void store(ThreadContext *tc, const Integer &i)
Definition: aapcs32.hh:162
gem5::Aapcs32::State::stackUsed
bool stackUsed
Definition: aapcs32.hh:57
gem5::guest_abi::Aapcs32HomogeneousAggregate
T[count] Aapcs32HomogeneousAggregate
Definition: aapcs32.hh:100
gem5::ArmISA::int_reg::Spx
constexpr RegId Spx
Definition: int.hh:238
gem5::RegId
Register ID: describe an architectural register with its class and index.
Definition: reg_class.hh:92
gem5::guest_abi::Result< Aapcs32Vfp, Float, typename std::enable_if_t< std::is_floating_point_v< Float > > >::store
static void store(ThreadContext *tc, const Float &f, Aapcs32Vfp::State &state)
Definition: aapcs32.hh:475
gem5::ThreadContext::setReg
virtual void setReg(const RegId &reg, RegVal val)
Definition: thread_context.cc:188

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