gem5  v21.0.1.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
reg_abi.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2020 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_REG_ABI_HH__
29 #define __ARCH_ARM_REG_ABI_HH__
30 
31 #include <vector>
32 
33 #include "base/logging.hh"
34 #include "sim/syscall_abi.hh"
35 
36 namespace ArmISA
37 {
38 
40 {
42 };
43 
45 {
47 };
48 
49 } // namespace ArmISA
50 
51 namespace GuestABI
52 {
53 
54 template <typename ABI, typename Arg>
55 struct Argument<ABI, Arg,
56  typename std::enable_if_t<
57  std::is_base_of<ArmISA::RegABI32, ABI>::value &&
58  std::is_integral<Arg>::value &&
59  ABI::template IsWide<Arg>::value>>
60 {
61  static Arg
62  get(ThreadContext *tc, typename ABI::State &state)
63  {
64  // 64 bit arguments are passed starting in an even register.
65  if (state % 2)
66  state++;
67  panic_if(state + 1 >= ABI::ArgumentRegs.size(),
68  "Ran out of syscall argument registers.");
69  auto low = ABI::ArgumentRegs[state++];
70  auto high = ABI::ArgumentRegs[state++];
71  return (Arg)ABI::mergeRegs(tc, low, high);
72  }
73 };
74 
75 } // namespace GuestABI
76 
77 #endif // __ARCH_ARM_GEM5_OP_HH__
RiscvISA::ArgumentRegs
const std::vector< int > ArgumentRegs
Definition: registers.hh:127
GenericSyscallABI64
Definition: syscall_abi.hh:44
ArmISA::RegABI64::ArgumentRegs
static const std::vector< int > ArgumentRegs
Definition: reg_abi.hh:46
std::vector< int >
syscall_abi.hh
ArmISA
Definition: ccregs.hh:41
ThreadContext
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Definition: thread_context.hh:88
GuestABI
Definition: aapcs32.hh:66
GuestABI::Argument
Definition: definition.hh:93
ArmISA::RegABI32::ArgumentRegs
static const std::vector< int > ArgumentRegs
Definition: reg_abi.hh:41
panic_if
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Definition: logging.hh:197
ArmISA::RegABI32
Definition: reg_abi.hh:39
std
Overload hash function for BasicBlockRange type.
Definition: vec_reg.hh:587
ArmISA::RegABI64
Definition: reg_abi.hh:44
GuestABI::Argument< ABI, Arg, typename std::enable_if_t< std::is_base_of< ArmISA::RegABI32, ABI >::value &&std::is_integral< Arg >::value &&ABI::template IsWide< Arg >::value > >::get
static Arg get(ThreadContext *tc, typename ABI::State &state)
Definition: reg_abi.hh:62
logging.hh
GenericSyscallABI32
Definition: syscall_abi.hh:49

Generated on Tue Jun 22 2021 15:28:21 for gem5 by doxygen 1.8.17