struct Aapcs64
{
- struct Position
+ struct State
{
int ngrn=0; // Next general purpose register number.
int nsrn=0; // Next SIMD and floating point register number.
// The maximum allowed SIMD and floating point register number.
static const int MAX_SRN = 7;
- explicit Position(const ThreadContext *tc) :
+ explicit State(const ThreadContext *tc) :
nsaa(tc->readIntReg(ArmISA::INTREG_SPX))
{}
};
{
template <typename T>
static T
- loadFromStack(ThreadContext *tc, Aapcs64::Position &position)
+ loadFromStack(ThreadContext *tc, Aapcs64::State &state)
{
// The alignment is the larger of 8 or the natural alignment of T.
size_t align = std::max<size_t>(8, alignof(T));
size_t size = roundUp(sizeof(T), 8);
// Align the stack.
- position.nsaa = roundUp(position.nsaa, align);
+ state.nsaa = roundUp(state.nsaa, align);
// Extract the value from it.
- TypedBufferArg<T> val(position.nsaa);
+ TypedBufferArg<T> val(state.nsaa);
val.copyIn(tc->getVirtProxy());
// Move the nsaa past this argument.
- position.nsaa += size;
+ state.nsaa += size;
// Return the value we extracted.
return gtoh(*val, ArmISA::byteOrder(tc));
public Aapcs64ArgumentBase
{
static Float
- get(ThreadContext *tc, Aapcs64::Position &position)
+ get(ThreadContext *tc, Aapcs64::State &state)
{
- if (position.nsrn <= position.MAX_SRN) {
- RegId id(VecRegClass, position.nsrn++);
+ if (state.nsrn <= state.MAX_SRN) {
+ RegId id(VecRegClass, state.nsrn++);
return tc->readVecReg(id).laneView<Float, 0>();
}
- return loadFromStack<Float>(tc, position);
+ return loadFromStack<Float>(tc, state);
}
};
std::is_integral<Integer>::value>::type> : public Aapcs64ArgumentBase
{
static Integer
- get(ThreadContext *tc, Aapcs64::Position &position)
+ get(ThreadContext *tc, Aapcs64::State &state)
{
- if (sizeof(Integer) <= 8 && position.ngrn <= position.MAX_GRN)
- return tc->readIntReg(position.ngrn++);
+ if (sizeof(Integer) <= 8 && state.ngrn <= state.MAX_GRN)
+ return tc->readIntReg(state.ngrn++);
- if (alignof(Integer) == 16 && (position.ngrn % 2))
- position.ngrn++;
+ if (alignof(Integer) == 16 && (state.ngrn % 2))
+ state.ngrn++;
- if (sizeof(Integer) == 16 && position.ngrn + 1 <= position.MAX_GRN) {
- Integer low = tc->readIntReg(position.ngrn++);
- Integer high = tc->readIntReg(position.ngrn++);
+ if (sizeof(Integer) == 16 && state.ngrn + 1 <= state.MAX_GRN) {
+ Integer low = tc->readIntReg(state.ngrn++);
+ Integer high = tc->readIntReg(state.ngrn++);
high = high << 64;
return high | low;
}
// Max out ngrn since we've effectively saturated it.
- position.ngrn = position.MAX_GRN + 1;
+ state.ngrn = state.MAX_GRN + 1;
- return loadFromStack<Integer>(tc, position);
+ return loadFromStack<Integer>(tc, state);
}
};
IsAapcs64Hxa<HA>::value>::type> : public Aapcs64ArgumentBase
{
static HA
- get(ThreadContext *tc, Aapcs64::Position &position)
+ get(ThreadContext *tc, Aapcs64::State &state)
{
using Elem = typename Aapcs64ArrayType<HA>::Type;
constexpr size_t Count = sizeof(HA) / sizeof(Elem);
- if (position.nsrn + Count - 1 <= position.MAX_SRN) {
+ if (state.nsrn + Count - 1 <= state.MAX_SRN) {
HA ha;
for (int i = 0; i < Count; i++)
- ha[i] = Argument<Aapcs64, Elem>::get(tc, position);
+ ha[i] = Argument<Aapcs64, Elem>::get(tc, state);
return ha;
}
// Max out the nsrn since we effectively exhausted it.
- position.nsrn = position.MAX_SRN + 1;
+ state.nsrn = state.MAX_SRN + 1;
- return loadFromStack<HA>(tc, position);
+ return loadFromStack<HA>(tc, state);
}
};
>::type> : public Aapcs64ArgumentBase
{
static Composite
- get(ThreadContext *tc, Aapcs64::Position &position)
+ get(ThreadContext *tc, Aapcs64::State &state)
{
if (sizeof(Composite) > 16) {
// Composite values larger than 16 which aren't HFAs or HVAs are
// kept in a buffer, and the argument is actually a pointer to that
// buffer.
- Addr addr = Argument<Aapcs64, Addr>::get(tc, position);
+ Addr addr = Argument<Aapcs64, Addr>::get(tc, state);
TypedBufferArg<Composite> composite(addr);
composite.copyIn(tc->getVirtProxy());
return gtoh(*composite, ArmISA::byteOrder(tc));
const int regs = (bytes + chunk_size - 1) / chunk_size;
// Can it fit in GPRs?
- if (position.ngrn + regs - 1 <= position.MAX_GRN) {
+ if (state.ngrn + regs - 1 <= state.MAX_GRN) {
alignas(alignof(Composite)) uint8_t buf[bytes];
for (int i = 0; i < regs; i++) {
- Chunk val = tc->readIntReg(position.ngrn++);
+ Chunk val = tc->readIntReg(state.ngrn++);
val = htog(val, ArmISA::byteOrder(tc));
size_t to_copy = std::min<size_t>(bytes, chunk_size);
memcpy(buf + i * chunk_size, &val, to_copy);
}
// Max out the ngrn since we effectively exhausted it.
- position.ngrn = position.MAX_GRN;
+ state.ngrn = state.MAX_GRN;
- return loadFromStack<Composite>(tc, position);
+ return loadFromStack<Composite>(tc, state);
}
};
ABI::template IsWide<Arg>::value>::type>
{
static Arg
- get(ThreadContext *tc, typename ABI::Position &position)
+ get(ThreadContext *tc, typename ABI::State &state)
{
// 64 bit arguments are passed starting in an even register.
- if (position % 2)
- position++;
- panic_if(position + 1 >= ABI::ArgumentRegs.size(),
+ if (state % 2)
+ state++;
+ panic_if(state + 1 >= ABI::ArgumentRegs.size(),
"Ran out of syscall argument registers.");
- auto low = ABI::ArgumentRegs[position++];
- auto high = ABI::ArgumentRegs[position++];
+ auto low = ABI::ArgumentRegs[state++];
+ auto high = ABI::ArgumentRegs[state++];
return (Arg)ABI::mergeRegs(tc, low, high);
}
};
using ABI = Sparc32Process::SyscallABI;
static Arg
- get(ThreadContext *tc, typename ABI::Position &position)
+ get(ThreadContext *tc, typename ABI::State &state)
{
- panic_if(position + 1 >= ABI::ArgumentRegs.size(),
+ panic_if(state + 1 >= ABI::ArgumentRegs.size(),
"Ran out of syscall argument registers.");
- auto high = ABI::ArgumentRegs[position++];
- auto low = ABI::ArgumentRegs[position++];
+ auto high = ABI::ArgumentRegs[state++];
+ auto low = ABI::ArgumentRegs[state++];
return (Arg)ABI::mergeRegs(tc, low, high);
}
};
using ABI = X86ISA::I386LinuxProcess::SyscallABI;
static Arg
- get(ThreadContext *tc, typename ABI::Position &position)
+ get(ThreadContext *tc, typename ABI::State &state)
{
- panic_if(position + 1 >= ABI::ArgumentRegs.size(),
+ panic_if(state + 1 >= ABI::ArgumentRegs.size(),
"Ran out of syscall argument registers.");
- auto low = ABI::ArgumentRegs[position++];
- auto high = ABI::ArgumentRegs[position++];
+ auto low = ABI::ArgumentRegs[state++];
+ auto high = ABI::ArgumentRegs[state++];
return (Arg)ABI::mergeRegs(tc, low, high);
}
};
struct X86PseudoInstABI
{
- using Position = int;
+ using State = int;
};
namespace GuestABI
struct Argument<X86PseudoInstABI, uint64_t>
{
static uint64_t
- get(ThreadContext *tc, X86PseudoInstABI::Position &position)
+ get(ThreadContext *tc, X86PseudoInstABI::State &state)
{
// The first 6 integer arguments are passed in registers, the rest
// are passed on the stack.
- panic_if(position >= 6, "Too many psuedo inst arguments.");
+ panic_if(state >= 6, "Too many psuedo inst arguments.");
using namespace X86ISA;
INTREG_RCX, INTREG_R8, INTREG_R9
};
- return tc->readIntReg(int_reg_map[position++]);
+ return tc->readIntReg(int_reg_map[state++]);
}
};
invokeSimcall(ThreadContext *tc,
std::function<Ret(ThreadContext *, Args...)> target)
{
- // Default construct a Position to track consumed resources. Built in
+ // Default construct a State to track consumed resources. Built in
// types will be zero initialized.
- auto position = GuestABI::initializePosition<ABI>(tc);
- GuestABI::prepareForFunction<ABI, Ret, Args...>(tc, position);
- return GuestABI::callFrom<ABI, Ret, Args...>(tc, position, target);
+ auto state = GuestABI::initializeState<ABI>(tc);
+ GuestABI::prepareForFunction<ABI, Ret, Args...>(tc, state);
+ return GuestABI::callFrom<ABI, Ret, Args...>(tc, state, target);
}
template <typename ABI, typename Ret, typename ...Args>
invokeSimcall(ThreadContext *tc,
std::function<void(ThreadContext *, Args...)> target)
{
- // Default construct a Position to track consumed resources. Built in
+ // Default construct a State to track consumed resources. Built in
// types will be zero initialized.
- auto position = GuestABI::initializePosition<ABI>(tc);
- GuestABI::prepareForArguments<ABI, Args...>(tc, position);
- GuestABI::callFrom<ABI, Args...>(tc, position, target);
+ auto state = GuestABI::initializeState<ABI>(tc);
+ GuestABI::prepareForArguments<ABI, Args...>(tc, state);
+ GuestABI::callFrom<ABI, Args...>(tc, state, target);
}
template <typename ABI, typename ...Args>
std::function<Ret(ThreadContext *, Args...)> target=
std::function<Ret(ThreadContext *, Args...)>())
{
- auto position = GuestABI::initializePosition<ABI>(tc);
+ auto state = GuestABI::initializeState<ABI>(tc);
std::ostringstream ss;
- GuestABI::prepareForFunction<ABI, Ret, Args...>(tc, position);
+ GuestABI::prepareForFunction<ABI, Ret, Args...>(tc, state);
ss << name;
- GuestABI::dumpArgsFrom<ABI, Ret, Args...>(0, ss, tc, position);
+ GuestABI::dumpArgsFrom<ABI, Ret, Args...>(0, ss, tc, state);
return ss.str();
}
// registers.
struct TestABI_1D
{
- using Position = int;
+ using State = int;
};
// ABI anchor for an ABI which uses the prepare() hook.
struct TestABI_Prepare
{
- using Position = int;
+ using State = int;
};
// ABI anchor for an ABI which has 2D progress. Conceptually, this could be
// registers.
struct TestABI_2D
{
- using Position = std::pair<int, int>;
+ using State = std::pair<int, int>;
};
struct TestABI_TcInit
{
- struct Position
+ struct State
{
int pos;
- Position(const ThreadContext *tc) : pos(tc->intOffset) {}
+ State(const ThreadContext *tc) : pos(tc->intOffset) {}
};
};
struct Argument<TestABI_1D, int>
{
static int
- get(ThreadContext *tc, TestABI_1D::Position &position)
+ get(ThreadContext *tc, TestABI_1D::State &state)
{
- return tc->ints[position++];
+ return tc->ints[state++];
}
};
typename std::enable_if<std::is_floating_point<Arg>::value>::type>
{
static Arg
- get(ThreadContext *tc, TestABI_1D::Position &position)
+ get(ThreadContext *tc, TestABI_1D::State &state)
{
- return tc->floats[position++];
+ return tc->floats[state++];
}
};
struct Argument<TestABI_Prepare, int>
{
static int
- get(ThreadContext *tc, TestABI_Prepare::Position &position)
+ get(ThreadContext *tc, TestABI_Prepare::State &state)
{
- return tc->ints[--position];
+ return tc->ints[--state];
}
static void
- prepare(ThreadContext *tc, TestABI_Prepare::Position &position)
+ prepare(ThreadContext *tc, TestABI_Prepare::State &state)
{
- position++;
+ state++;
}
};
{
static void store(ThreadContext *tc, const Ret &ret) {}
static void
- prepare(ThreadContext *tc, TestABI_Prepare::Position &position)
+ prepare(ThreadContext *tc, TestABI_Prepare::State &state)
{
- position++;
+ state++;
}
};
struct Argument<TestABI_2D, int>
{
static int
- get(ThreadContext *tc, TestABI_2D::Position &position)
+ get(ThreadContext *tc, TestABI_2D::State &state)
{
- return tc->ints[position.first++];
+ return tc->ints[state.first++];
}
};
typename std::enable_if<std::is_floating_point<Arg>::value>::type>
{
static Arg
- get(ThreadContext *tc, TestABI_2D::Position &position)
+ get(ThreadContext *tc, TestABI_2D::State &state)
{
- return tc->floats[position.second++];
+ return tc->floats[state.second++];
}
};
struct Argument<TestABI_TcInit, int>
{
static int
- get(ThreadContext *tc, TestABI_TcInit::Position &position)
+ get(ThreadContext *tc, TestABI_TcInit::State &state)
{
- return tc->ints[position.pos++];
+ return tc->ints[state.pos++];
}
};
/*
* To implement an ABI, a subclass needs to implement a system of
* specializations of these two templates Result and Argument, and define a
- * "Position" type.
+ * "State" type.
*
- * The Position type carries information about, for instance, how many
+ * The State type carries information about, for instance, how many
* integer registers have been consumed gathering earlier arguments. It
* may contain multiple elements if there are multiple dimensions to track,
* for instance the number of integer and floating point registers used so far.
private:
/*
* Store result "ret" into the state accessible through tc. Optionally
- * accept "position" in case it holds some signature wide information.
+ * accept "state" in case it holds some signature wide information.
*
* Note that the declaration below is only to document the expected
* signature and is private so it won't be used by accident.
*/
static void store(ThreadContext *tc, const Ret &ret);
static void store(ThreadContext *tc, const Ret &ret,
- typename ABI::Position &position);
+ typename ABI::State &state);
/*
* Prepare for a result of type Ret. This might mean, for instance,
*
* This method can be excluded if no preparation is necessary.
*/
- static void prepare(ThreadContext *tc, typename ABI::Position &position);
+ static void prepare(ThreadContext *tc, typename ABI::State &state);
};
/*
{
/*
* Retrieve an argument of type Arg from the state accessible through tc,
- * assuming the state represented by "position" has already been used.
- * Also update position to account for this argument as well.
+ * assuming the state represented by "state" has already been used.
+ * Also update state to account for this argument as well.
*
* Like Result::store above, the declaration below is only to document
* the expected method signature.
*/
- static Arg get(ThreadContext *tc, typename ABI::Position &position);
+ static Arg get(ThreadContext *tc, typename ABI::State &state);
/*
* Prepare for an argument of type Arg. This might mean, for instance,
*
* This method can be excluded if no preparation is necessary.
*/
- static void allocate(ThreadContext *tc, typename ABI::Position &position);
+ static void allocate(ThreadContext *tc, typename ABI::State &state);
};
} // namespace GuestABI
// result.
template <typename ABI, typename Ret>
static typename std::enable_if<!std::is_void<Ret>::value, Ret>::type
-callFrom(ThreadContext *tc, typename ABI::Position &position,
+callFrom(ThreadContext *tc, typename ABI::State &state,
std::function<Ret(ThreadContext *)> target)
{
Ret ret = target(tc);
- storeResult<ABI, Ret>(tc, ret, position);
+ storeResult<ABI, Ret>(tc, ret, state);
return ret;
}
// With no arguments to gather and nothing to return, call the target function.
template <typename ABI>
static void
-callFrom(ThreadContext *tc, typename ABI::Position &position,
+callFrom(ThreadContext *tc, typename ABI::State &state,
std::function<void(ThreadContext *)> target)
{
target(tc);
// case above.
template <typename ABI, typename Ret, typename NextArg, typename ...Args>
static typename std::enable_if<!std::is_void<Ret>::value, Ret>::type
-callFrom(ThreadContext *tc, typename ABI::Position &position,
+callFrom(ThreadContext *tc, typename ABI::State &state,
std::function<Ret(ThreadContext *, NextArg, Args...)> target)
{
// Extract the next argument from the thread context.
- NextArg next = getArgument<ABI, NextArg>(tc, position);
+ NextArg next = getArgument<ABI, NextArg>(tc, state);
// Build a partial function which adds the next argument to the call.
std::function<Ret(ThreadContext *, Args...)> partial =
};
// Recursively handle any remaining arguments.
- return callFrom<ABI, Ret, Args...>(tc, position, partial);
+ return callFrom<ABI, Ret, Args...>(tc, state, partial);
}
// Recursively gather arguments for target from tc until we get to the base
// case above. This version is for functions that don't return anything.
template <typename ABI, typename NextArg, typename ...Args>
static void
-callFrom(ThreadContext *tc, typename ABI::Position &position,
+callFrom(ThreadContext *tc, typename ABI::State &state,
std::function<void(ThreadContext *, NextArg, Args...)> target)
{
// Extract the next argument from the thread context.
- NextArg next = getArgument<ABI, NextArg>(tc, position);
+ NextArg next = getArgument<ABI, NextArg>(tc, state);
// Build a partial function which adds the next argument to the call.
std::function<void(ThreadContext *, Args...)> partial =
};
// Recursively handle any remaining arguments.
- callFrom<ABI, Args...>(tc, position, partial);
+ callFrom<ABI, Args...>(tc, state, partial);
}
template <typename ABI, typename Ret>
static void
dumpArgsFrom(int count, std::ostream &os, ThreadContext *tc,
- typename ABI::Position &position)
+ typename ABI::State &state)
{
os << ")";
}
template <typename ABI, typename Ret, typename NextArg, typename ...Args>
static void
dumpArgsFrom(int count, std::ostream &os, ThreadContext *tc,
- typename ABI::Position &position)
+ typename ABI::State &state)
{
// Either open the parenthesis or add a comma, depending on where we are
// in the argument list.
os << (count ? ", " : "(");
// Extract the next argument from the thread context.
- NextArg next = getArgument<ABI, NextArg>(tc, position);
+ NextArg next = getArgument<ABI, NextArg>(tc, state);
// Add this argument to the list.
os << next;
// Recursively handle any remaining arguments.
- dumpArgsFrom<ABI, Ret, Args...>(count + 1, os, tc, position);
+ dumpArgsFrom<ABI, Ret, Args...>(count + 1, os, tc, state);
}
} // namespace GuestABI
{
/*
- * Position may need to be initialized based on the ThreadContext, for instance
+ * State may need to be initialized based on the ThreadContext, for instance
* to find out where the stack pointer is initially.
*/
template <typename ABI, typename Enabled=void>
-struct PositionInitializer
+struct StateInitializer
{
- static typename ABI::Position
+ static typename ABI::State
init(const ThreadContext *tc)
{
- return typename ABI::Position();
+ return typename ABI::State();
}
};
template <typename ABI>
-struct PositionInitializer<ABI, typename std::enable_if<
- std::is_constructible<typename ABI::Position, const ThreadContext *>::value
+struct StateInitializer<ABI, typename std::enable_if<
+ std::is_constructible<typename ABI::State, const ThreadContext *>::value
>::type>
{
- static typename ABI::Position
+ static typename ABI::State
init(const ThreadContext *tc)
{
- return typename ABI::Position(tc);
+ return typename ABI::State(tc);
}
};
template <typename ABI>
-static typename ABI::Position
-initializePosition(const ThreadContext *tc)
+static typename ABI::State
+initializeState(const ThreadContext *tc)
{
- return PositionInitializer<ABI>::init(tc);
+ return StateInitializer<ABI>::init(tc);
}
/*
struct Preparer
{
static void
- prepare(ThreadContext *tc, typename ABI::Position &position)
+ prepare(ThreadContext *tc, typename ABI::State &state)
{}
};
struct Preparer<ABI, Role, Type, decltype((void)&Role<ABI, Type>::prepare)>
{
static void
- prepare(ThreadContext *tc, typename ABI::Position &position)
+ prepare(ThreadContext *tc, typename ABI::State &state)
{
- Role<ABI, Type>::prepare(tc, position);
+ Role<ABI, Type>::prepare(tc, state);
}
};
template <typename ABI, typename Ret, typename Enabled=void>
static void
-prepareForResult(ThreadContext *tc, typename ABI::Position &position)
+prepareForResult(ThreadContext *tc, typename ABI::State &state)
{
- Preparer<ABI, Result, Ret>::prepare(tc, position);
+ Preparer<ABI, Result, Ret>::prepare(tc, state);
}
template <typename ABI>
static void
-prepareForArguments(ThreadContext *tc, typename ABI::Position &position)
+prepareForArguments(ThreadContext *tc, typename ABI::State &state)
{
return;
}
template <typename ABI, typename NextArg, typename ...Args>
static void
-prepareForArguments(ThreadContext *tc, typename ABI::Position &position)
+prepareForArguments(ThreadContext *tc, typename ABI::State &state)
{
- Preparer<ABI, Argument, NextArg>::prepare(tc, position);
- prepareForArguments<ABI, Args...>(tc, position);
+ Preparer<ABI, Argument, NextArg>::prepare(tc, state);
+ prepareForArguments<ABI, Args...>(tc, state);
}
template <typename ABI, typename Ret, typename ...Args>
static void
-prepareForFunction(ThreadContext *tc, typename ABI::Position &position)
+prepareForFunction(ThreadContext *tc, typename ABI::State &state)
{
- prepareForResult<ABI, Ret>(tc, position);
- prepareForArguments<ABI, Args...>(tc, position);
+ prepareForResult<ABI, Ret>(tc, state);
+ prepareForArguments<ABI, Args...>(tc, state);
}
/*
* This struct template provides a way to call the Result store method and
- * optionally pass it the position.
+ * optionally pass it the state.
*/
template <typename ABI, typename Ret, typename Enabled=void>
struct ResultStorer
{
static void
- store(ThreadContext *tc, const Ret &ret, typename ABI::Position &position)
+ store(ThreadContext *tc, const Ret &ret, typename ABI::State &state)
{
Result<ABI, Ret>::store(tc, ret);
}
template <typename ABI, typename Ret>
struct ResultStorer<ABI, Ret, typename std::enable_if<
- std::is_same<void (*)(ThreadContext *, const Ret &,
- typename ABI::Position &),
+ std::is_same<void (*)(ThreadContext *, const Ret &, typename ABI::State &),
decltype(&Result<ABI, Ret>::store)>::value>::type>
{
static void
- store(ThreadContext *tc, const Ret &ret, typename ABI::Position &position)
+ store(ThreadContext *tc, const Ret &ret, typename ABI::State &state)
{
- Result<ABI, Ret>::store(tc, ret, position);
+ Result<ABI, Ret>::store(tc, ret, state);
}
};
template <typename ABI, typename Ret>
static void
-storeResult(ThreadContext *tc, const Ret &ret,
- typename ABI::Position &position)
+storeResult(ThreadContext *tc, const Ret &ret, typename ABI::State &state)
{
- ResultStorer<ABI, Ret>::store(tc, ret, position);
+ ResultStorer<ABI, Ret>::store(tc, ret, state);
}
template <typename ABI, typename Arg>
static Arg
-getArgument(ThreadContext *tc, typename ABI::Position &position)
+getArgument(ThreadContext *tc, typename ABI::State &state)
{
- return Argument<ABI, Arg>::get(tc, position);
+ return Argument<ABI, Arg>::get(tc, state);
}
} // namespace GuestABI
void
_getImpl(First &first) override
{
- first = Argument<ABI, First>::get(this->tc, this->position);
+ first = Argument<ABI, First>::get(this->tc, this->state);
}
};
protected:
// Declare state to pass to the Argument<>::get methods.
ThreadContext *tc;
- typename ABI::Position position;
+ typename ABI::State state;
// Give the "using" statement in our subclass something to refer to.
void _getImpl();
public:
- VarArgsImpl(ThreadContext *_tc, const typename ABI::Position &_pos) :
- tc(_tc), position(_pos)
+ VarArgsImpl(ThreadContext *_tc, const typename ABI::State &_state) :
+ tc(_tc), state(_state)
{}
};
struct Argument<ABI, VarArgs<Types...>>
{
static VarArgs<Types...>
- get(ThreadContext *tc, typename ABI::Position &position)
+ get(ThreadContext *tc, typename ABI::State &state)
{
using Base = VarArgsBase<Types...>;
using Impl = VarArgsImpl<ABI, Base, Types...>;
- return VarArgs<Types...>(new Impl(tc, position));
+ return VarArgs<Types...>(new Impl(tc, state));
}
};
struct PseudoInstABI
{
- using Position = int;
+ using State = int;
};
namespace GuestABI
struct Argument<PseudoInstABI, uint64_t>
{
static uint64_t
- get(ThreadContext *tc, PseudoInstABI::Position &position)
+ get(ThreadContext *tc, PseudoInstABI::State &state)
{
- uint64_t result = TheISA::getArgument(tc, position, sizeof(uint64_t),
- false);
- position++;
+ uint64_t result =
+ TheISA::getArgument(tc, state, sizeof(uint64_t), false);
+ state++;
return result;
}
};
struct GenericSyscallABI
{
- using Position = int;
+ using State = int;
};
struct GenericSyscallABI64 : public GenericSyscallABI
std::is_integral<Arg>::value>::type>
{
static Arg
- get(ThreadContext *tc, typename ABI::Position &position)
+ get(ThreadContext *tc, typename ABI::State &state)
{
- panic_if(position >= ABI::ArgumentRegs.size(),
+ panic_if(state >= ABI::ArgumentRegs.size(),
"Ran out of syscall argument registers.");
- return tc->readIntReg(ABI::ArgumentRegs[position++]);
+ return tc->readIntReg(ABI::ArgumentRegs[state++]);
}
};
typename std::enable_if<!ABI::template IsWide<Arg>::value>::type>
{
static Arg
- get(ThreadContext *tc, typename ABI::Position &position)
+ get(ThreadContext *tc, typename ABI::State &state)
{
- panic_if(position >= ABI::ArgumentRegs.size(),
+ panic_if(state >= ABI::ArgumentRegs.size(),
"Ran out of syscall argument registers.");
- return bits(tc->readIntReg(ABI::ArgumentRegs[position++]), 31, 0);
+ return bits(tc->readIntReg(ABI::ArgumentRegs[state++]), 31, 0);
}
};