diff --git a/src/arch/arm/aapcs64.hh b/src/arch/arm/aapcs64.hh index 16edcb3899..9d7623a058 100644 --- a/src/arch/arm/aapcs64.hh +++ b/src/arch/arm/aapcs64.hh @@ -44,7 +44,7 @@ class ThreadContext; struct Aapcs64 { - struct Position + struct State { int ngrn=0; // Next general purpose register number. int nsrn=0; // Next SIMD and floating point register number. @@ -55,7 +55,7 @@ struct Aapcs64 // 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)) {} }; @@ -161,7 +161,7 @@ struct Aapcs64ArgumentBase { template 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(8, alignof(T)); @@ -169,14 +169,14 @@ struct Aapcs64ArgumentBase 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 val(position.nsaa); + TypedBufferArg 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)); @@ -195,14 +195,14 @@ struct ArgumentreadVecReg(id).laneView(); } - return loadFromStack(tc, position); + return loadFromStack(tc, state); } }; @@ -232,25 +232,25 @@ struct Argument::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(tc, position); + return loadFromStack(tc, state); } }; @@ -287,22 +287,22 @@ struct Argument::value>::type> : public Aapcs64ArgumentBase { static HA - get(ThreadContext *tc, Aapcs64::Position &position) + get(ThreadContext *tc, Aapcs64::State &state) { using Elem = typename Aapcs64ArrayType::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::get(tc, position); + ha[i] = Argument::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(tc, position); + return loadFromStack(tc, state); } }; @@ -332,13 +332,13 @@ struct Argument::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::get(tc, position); + Addr addr = Argument::get(tc, state); TypedBufferArg composite(addr); composite.copyIn(tc->getVirtProxy()); return gtoh(*composite, ArmISA::byteOrder(tc)); @@ -353,10 +353,10 @@ struct ArgumentreadIntReg(position.ngrn++); + Chunk val = tc->readIntReg(state.ngrn++); val = htog(val, ArmISA::byteOrder(tc)); size_t to_copy = std::min(bytes, chunk_size); memcpy(buf + i * chunk_size, &val, to_copy); @@ -366,9 +366,9 @@ struct Argument(tc, position); + return loadFromStack(tc, state); } }; diff --git a/src/arch/arm/process.hh b/src/arch/arm/process.hh index 08100fcd46..3d0e349373 100644 --- a/src/arch/arm/process.hh +++ b/src/arch/arm/process.hh @@ -101,15 +101,15 @@ struct Argument::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); } }; diff --git a/src/arch/sparc/process.hh b/src/arch/sparc/process.hh index 79e3e41fb3..785417ca73 100644 --- a/src/arch/sparc/process.hh +++ b/src/arch/sparc/process.hh @@ -166,12 +166,12 @@ struct Argument= 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); } }; diff --git a/src/arch/x86/linux/process.hh b/src/arch/x86/linux/process.hh index a236a9e122..c3bd4ebb9d 100644 --- a/src/arch/x86/linux/process.hh +++ b/src/arch/x86/linux/process.hh @@ -91,12 +91,12 @@ struct Argument= 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); } }; diff --git a/src/arch/x86/pseudo_inst_abi.hh b/src/arch/x86/pseudo_inst_abi.hh index 5ac5efe42f..36e40db83d 100644 --- a/src/arch/x86/pseudo_inst_abi.hh +++ b/src/arch/x86/pseudo_inst_abi.hh @@ -40,7 +40,7 @@ struct X86PseudoInstABI { - using Position = int; + using State = int; }; namespace GuestABI @@ -63,12 +63,12 @@ template <> struct Argument { 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; @@ -77,7 +77,7 @@ struct Argument INTREG_RCX, INTREG_R8, INTREG_R9 }; - return tc->readIntReg(int_reg_map[position++]); + return tc->readIntReg(int_reg_map[state++]); } }; diff --git a/src/sim/guest_abi.hh b/src/sim/guest_abi.hh index 310fc00d04..704155b4e5 100644 --- a/src/sim/guest_abi.hh +++ b/src/sim/guest_abi.hh @@ -47,11 +47,11 @@ Ret invokeSimcall(ThreadContext *tc, std::function 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(tc); - GuestABI::prepareForFunction(tc, position); - return GuestABI::callFrom(tc, position, target); + auto state = GuestABI::initializeState(tc); + GuestABI::prepareForFunction(tc, state); + return GuestABI::callFrom(tc, state, target); } template @@ -67,11 +67,11 @@ void invokeSimcall(ThreadContext *tc, std::function 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(tc); - GuestABI::prepareForArguments(tc, position); - GuestABI::callFrom(tc, position, target); + auto state = GuestABI::initializeState(tc); + GuestABI::prepareForArguments(tc, state); + GuestABI::callFrom(tc, state, target); } template @@ -93,12 +93,12 @@ dumpSimcall(std::string name, ThreadContext *tc, std::function target= std::function()) { - auto position = GuestABI::initializePosition(tc); + auto state = GuestABI::initializeState(tc); std::ostringstream ss; - GuestABI::prepareForFunction(tc, position); + GuestABI::prepareForFunction(tc, state); ss << name; - GuestABI::dumpArgsFrom(0, ss, tc, position); + GuestABI::dumpArgsFrom(0, ss, tc, state); return ss.str(); } diff --git a/src/sim/guest_abi.test.cc b/src/sim/guest_abi.test.cc index 9ac7defc2e..6b5d0607bd 100644 --- a/src/sim/guest_abi.test.cc +++ b/src/sim/guest_abi.test.cc @@ -63,13 +63,13 @@ const double ThreadContext::DefaultFloatResult = 0.0; // 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 @@ -77,15 +77,15 @@ struct TestABI_Prepare // registers. struct TestABI_2D { - using Position = std::pair; + using State = std::pair; }; struct TestABI_TcInit { - struct Position + struct State { int pos; - Position(const ThreadContext *tc) : pos(tc->intOffset) {} + State(const ThreadContext *tc) : pos(tc->intOffset) {} }; }; @@ -98,9 +98,9 @@ template <> struct Argument { static int - get(ThreadContext *tc, TestABI_1D::Position &position) + get(ThreadContext *tc, TestABI_1D::State &state) { - return tc->ints[position++]; + return tc->ints[state++]; } }; @@ -109,9 +109,9 @@ struct Argument::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++]; } }; @@ -143,15 +143,15 @@ template <> struct Argument { 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++; } }; @@ -160,9 +160,9 @@ struct Result { 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++; } }; @@ -173,9 +173,9 @@ template <> struct Argument { 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++]; } }; @@ -184,9 +184,9 @@ struct Argument::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++]; } }; @@ -216,9 +216,9 @@ template <> struct Argument { 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++]; } }; diff --git a/src/sim/guest_abi/definition.hh b/src/sim/guest_abi/definition.hh index b43a482d03..becdb3c859 100644 --- a/src/sim/guest_abi/definition.hh +++ b/src/sim/guest_abi/definition.hh @@ -36,9 +36,9 @@ namespace GuestABI /* * 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. @@ -60,7 +60,7 @@ struct Result 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. @@ -69,7 +69,7 @@ struct Result */ 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, @@ -77,7 +77,7 @@ struct Result * * 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); }; /* @@ -93,13 +93,13 @@ struct Argument { /* * 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, @@ -107,7 +107,7 @@ struct Argument * * 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 diff --git a/src/sim/guest_abi/dispatch.hh b/src/sim/guest_abi/dispatch.hh index eb703a5fd4..62cbf291d2 100644 --- a/src/sim/guest_abi/dispatch.hh +++ b/src/sim/guest_abi/dispatch.hh @@ -54,18 +54,18 @@ namespace GuestABI // result. template static typename std::enable_if::value, Ret>::type -callFrom(ThreadContext *tc, typename ABI::Position &position, +callFrom(ThreadContext *tc, typename ABI::State &state, std::function target) { Ret ret = target(tc); - storeResult(tc, ret, position); + storeResult(tc, ret, state); return ret; } // With no arguments to gather and nothing to return, call the target function. template static void -callFrom(ThreadContext *tc, typename ABI::Position &position, +callFrom(ThreadContext *tc, typename ABI::State &state, std::function target) { target(tc); @@ -75,11 +75,11 @@ callFrom(ThreadContext *tc, typename ABI::Position &position, // case above. template static typename std::enable_if::value, Ret>::type -callFrom(ThreadContext *tc, typename ABI::Position &position, +callFrom(ThreadContext *tc, typename ABI::State &state, std::function target) { // Extract the next argument from the thread context. - NextArg next = getArgument(tc, position); + NextArg next = getArgument(tc, state); // Build a partial function which adds the next argument to the call. std::function partial = @@ -88,18 +88,18 @@ callFrom(ThreadContext *tc, typename ABI::Position &position, }; // Recursively handle any remaining arguments. - return callFrom(tc, position, partial); + return callFrom(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 static void -callFrom(ThreadContext *tc, typename ABI::Position &position, +callFrom(ThreadContext *tc, typename ABI::State &state, std::function target) { // Extract the next argument from the thread context. - NextArg next = getArgument(tc, position); + NextArg next = getArgument(tc, state); // Build a partial function which adds the next argument to the call. std::function partial = @@ -108,7 +108,7 @@ callFrom(ThreadContext *tc, typename ABI::Position &position, }; // Recursively handle any remaining arguments. - callFrom(tc, position, partial); + callFrom(tc, state, partial); } @@ -122,7 +122,7 @@ callFrom(ThreadContext *tc, typename ABI::Position &position, template static void dumpArgsFrom(int count, std::ostream &os, ThreadContext *tc, - typename ABI::Position &position) + typename ABI::State &state) { os << ")"; } @@ -133,20 +133,20 @@ dumpArgsFrom(int count, std::ostream &os, ThreadContext *tc, template 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(tc, position); + NextArg next = getArgument(tc, state); // Add this argument to the list. os << next; // Recursively handle any remaining arguments. - dumpArgsFrom(count + 1, os, tc, position); + dumpArgsFrom(count + 1, os, tc, state); } } // namespace GuestABI diff --git a/src/sim/guest_abi/layout.hh b/src/sim/guest_abi/layout.hh index ecc3a0826b..d5df3a7c45 100644 --- a/src/sim/guest_abi/layout.hh +++ b/src/sim/guest_abi/layout.hh @@ -38,36 +38,36 @@ 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 -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 -struct PositionInitializer::value +struct StateInitializer::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 -static typename ABI::Position -initializePosition(const ThreadContext *tc) +static typename ABI::State +initializeState(const ThreadContext *tc) { - return PositionInitializer::init(tc); + return StateInitializer::init(tc); } /* @@ -81,7 +81,7 @@ template class Role, struct Preparer { static void - prepare(ThreadContext *tc, typename ABI::Position &position) + prepare(ThreadContext *tc, typename ABI::State &state) {} }; @@ -94,52 +94,52 @@ template class Role, typename Type> struct Preparer::prepare)> { static void - prepare(ThreadContext *tc, typename ABI::Position &position) + prepare(ThreadContext *tc, typename ABI::State &state) { - Role::prepare(tc, position); + Role::prepare(tc, state); } }; template static void -prepareForResult(ThreadContext *tc, typename ABI::Position &position) +prepareForResult(ThreadContext *tc, typename ABI::State &state) { - Preparer::prepare(tc, position); + Preparer::prepare(tc, state); } template static void -prepareForArguments(ThreadContext *tc, typename ABI::Position &position) +prepareForArguments(ThreadContext *tc, typename ABI::State &state) { return; } template static void -prepareForArguments(ThreadContext *tc, typename ABI::Position &position) +prepareForArguments(ThreadContext *tc, typename ABI::State &state) { - Preparer::prepare(tc, position); - prepareForArguments(tc, position); + Preparer::prepare(tc, state); + prepareForArguments(tc, state); } template static void -prepareForFunction(ThreadContext *tc, typename ABI::Position &position) +prepareForFunction(ThreadContext *tc, typename ABI::State &state) { - prepareForResult(tc, position); - prepareForArguments(tc, position); + prepareForResult(tc, state); + prepareForArguments(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 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::store(tc, ret); } @@ -153,14 +153,13 @@ std::false_type foo(void (*)(ThreadContext *, const Ret &ret)); template struct ResultStorer::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::store(tc, ret, position); + Result::store(tc, ret, state); } }; @@ -170,17 +169,16 @@ struct ResultStorer static void -storeResult(ThreadContext *tc, const Ret &ret, - typename ABI::Position &position) +storeResult(ThreadContext *tc, const Ret &ret, typename ABI::State &state) { - ResultStorer::store(tc, ret, position); + ResultStorer::store(tc, ret, state); } template static Arg -getArgument(ThreadContext *tc, typename ABI::Position &position) +getArgument(ThreadContext *tc, typename ABI::State &state) { - return Argument::get(tc, position); + return Argument::get(tc, state); } } // namespace GuestABI diff --git a/src/sim/guest_abi/varargs.hh b/src/sim/guest_abi/varargs.hh index c350a8128d..41e3c623f9 100644 --- a/src/sim/guest_abi/varargs.hh +++ b/src/sim/guest_abi/varargs.hh @@ -114,7 +114,7 @@ class VarArgsImpl : void _getImpl(First &first) override { - first = Argument::get(this->tc, this->position); + first = Argument::get(this->tc, this->state); } }; @@ -125,14 +125,14 @@ class VarArgsImpl : public Base 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) {} }; @@ -184,11 +184,11 @@ template struct Argument> { static VarArgs - get(ThreadContext *tc, typename ABI::Position &position) + get(ThreadContext *tc, typename ABI::State &state) { using Base = VarArgsBase; using Impl = VarArgsImpl; - return VarArgs(new Impl(tc, position)); + return VarArgs(new Impl(tc, state)); } }; diff --git a/src/sim/pseudo_inst.hh b/src/sim/pseudo_inst.hh index 9be742e961..fbf997a9c1 100644 --- a/src/sim/pseudo_inst.hh +++ b/src/sim/pseudo_inst.hh @@ -53,7 +53,7 @@ class ThreadContext; struct PseudoInstABI { - using Position = int; + using State = int; }; namespace GuestABI @@ -73,11 +73,11 @@ template <> struct Argument { 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; } }; diff --git a/src/sim/syscall_abi.hh b/src/sim/syscall_abi.hh index f6eade50e9..533dece47c 100644 --- a/src/sim/syscall_abi.hh +++ b/src/sim/syscall_abi.hh @@ -49,7 +49,7 @@ struct IsConforming : public std::true_type {}; struct GenericSyscallABI { - using Position = int; + using State = int; }; struct GenericSyscallABI64 : public GenericSyscallABI @@ -100,11 +100,11 @@ struct Argument::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++]); } }; @@ -115,11 +115,11 @@ struct Argument::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); } };