arch,sim: Rename GuestABI namespace as guest_abi
As part of recent decisions regarding namespace naming conventions, all namespaces will be changed to snake case. ::GuestABI became ::guest_abi. Change-Id: I68700ef63479f1bb3eeab044b29dc09d86424608 Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/45433 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu> Maintainer: Gabe Black <gabe.black@gmail.com>
This commit is contained in:
committed by
Daniel Carvalho
parent
b8ff106024
commit
0c8bd5013a
@@ -49,9 +49,10 @@ invokeSimcall(ThreadContext *tc,
|
||||
{
|
||||
// Default construct a State to track consumed resources. Built in
|
||||
// types will be zero initialized.
|
||||
auto state = GuestABI::initializeState<ABI>(tc);
|
||||
GuestABI::prepareForFunction<ABI, Ret, Args...>(tc, state);
|
||||
return GuestABI::callFrom<ABI, Ret, store_ret, Args...>(tc, state, target);
|
||||
auto state = guest_abi::initializeState<ABI>(tc);
|
||||
guest_abi::prepareForFunction<ABI, Ret, Args...>(tc, state);
|
||||
return guest_abi::callFrom<ABI, Ret, store_ret, Args...>(tc, state,
|
||||
target);
|
||||
}
|
||||
|
||||
template <typename ABI, typename Ret, typename ...Args>
|
||||
@@ -84,9 +85,9 @@ invokeSimcall(ThreadContext *tc,
|
||||
{
|
||||
// Default construct a State to track consumed resources. Built in
|
||||
// types will be zero initialized.
|
||||
auto state = GuestABI::initializeState<ABI>(tc);
|
||||
GuestABI::prepareForArguments<ABI, Args...>(tc, state);
|
||||
GuestABI::callFrom<ABI, void, false, Args...>(tc, state, target);
|
||||
auto state = guest_abi::initializeState<ABI>(tc);
|
||||
guest_abi::prepareForArguments<ABI, Args...>(tc, state);
|
||||
guest_abi::callFrom<ABI, void, false, Args...>(tc, state, target);
|
||||
}
|
||||
|
||||
template <typename ABI, typename ...Args>
|
||||
@@ -108,12 +109,12 @@ dumpSimcall(std::string name, ThreadContext *tc,
|
||||
std::function<Ret(ThreadContext *, Args...)> target=
|
||||
std::function<Ret(ThreadContext *, Args...)>())
|
||||
{
|
||||
auto state = GuestABI::initializeState<ABI>(tc);
|
||||
auto state = guest_abi::initializeState<ABI>(tc);
|
||||
std::ostringstream ss;
|
||||
|
||||
GuestABI::prepareForFunction<ABI, Ret, Args...>(tc, state);
|
||||
guest_abi::prepareForFunction<ABI, Ret, Args...>(tc, state);
|
||||
ss << name;
|
||||
GuestABI::dumpArgsFrom<ABI, Ret, Args...>(ss, tc, state);
|
||||
guest_abi::dumpArgsFrom<ABI, Ret, Args...>(ss, tc, state);
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,8 @@ struct TestABI_TcInit
|
||||
};
|
||||
};
|
||||
|
||||
namespace GuestABI
|
||||
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi);
|
||||
namespace guest_abi
|
||||
{
|
||||
|
||||
// Hooks for the 1D ABI arguments and return value. Add 1 or 1.0 to return
|
||||
@@ -222,13 +223,13 @@ struct Argument<TestABI_TcInit, int>
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace GuestABI
|
||||
} // namespace guest_abi
|
||||
|
||||
// Test function which verifies that its arguments reflect the 1D ABI and
|
||||
// which doesn't return anything.
|
||||
void
|
||||
testIntVoid(ThreadContext *tc, int a, float b, int c, double d,
|
||||
GuestABI::VarArgs<int,float,double> varargs)
|
||||
guest_abi::VarArgs<int,float,double> varargs)
|
||||
{
|
||||
EXPECT_EQ(a, tc->ints[0]);
|
||||
EXPECT_EQ(b, tc->floats[1]);
|
||||
@@ -261,7 +262,7 @@ testPrepareInt(ThreadContext *tc, int a, int b)
|
||||
// which doesn't return anything.
|
||||
void
|
||||
test2DVoid(ThreadContext *tc, int a, float b, int c, double d,
|
||||
GuestABI::VarArgs<int,float,double> varargs)
|
||||
guest_abi::VarArgs<int,float,double> varargs)
|
||||
{
|
||||
EXPECT_EQ(a, tc->ints[0]);
|
||||
EXPECT_EQ(b, tc->floats[0]);
|
||||
@@ -291,7 +292,7 @@ double testDoubleRet(ThreadContext *tc) { return DoubleRetValue; }
|
||||
|
||||
|
||||
// The actual test bodies.
|
||||
TEST(GuestABI, ABI_1D_args)
|
||||
TEST(guest_abi, ABI_1D_args)
|
||||
{
|
||||
ThreadContext tc;
|
||||
invokeSimcall<TestABI_1D>(&tc, testIntVoid);
|
||||
@@ -299,14 +300,14 @@ TEST(GuestABI, ABI_1D_args)
|
||||
EXPECT_EQ(tc.floatResult, tc.DefaultFloatResult);
|
||||
}
|
||||
|
||||
TEST(GuestABI, ABI_Prepare)
|
||||
TEST(guest_abi, ABI_Prepare)
|
||||
{
|
||||
ThreadContext tc;
|
||||
invokeSimcall<TestABI_Prepare>(&tc, testPrepareVoid);
|
||||
invokeSimcall<TestABI_Prepare>(&tc, testPrepareInt);
|
||||
}
|
||||
|
||||
TEST(GuestABI, ABI_2D_args)
|
||||
TEST(guest_abi, ABI_2D_args)
|
||||
{
|
||||
ThreadContext tc;
|
||||
invokeSimcall<TestABI_2D>(&tc, test2DVoid);
|
||||
@@ -314,14 +315,14 @@ TEST(GuestABI, ABI_2D_args)
|
||||
EXPECT_EQ(tc.floatResult, tc.DefaultFloatResult);
|
||||
}
|
||||
|
||||
TEST(GuestABI, ABI_TC_init)
|
||||
TEST(guest_abi, ABI_TC_init)
|
||||
{
|
||||
ThreadContext tc;
|
||||
tc.intOffset = 2;
|
||||
invokeSimcall<TestABI_TcInit>(&tc, testTcInit);
|
||||
}
|
||||
|
||||
TEST(GuestABI, ABI_returns)
|
||||
TEST(guest_abi, ABI_returns)
|
||||
{
|
||||
// 1D returns.
|
||||
{
|
||||
@@ -379,20 +380,20 @@ TEST(GuestABI, ABI_returns)
|
||||
}
|
||||
}
|
||||
|
||||
TEST(GuestABI, dumpSimcall)
|
||||
TEST(guest_abi, dumpSimcall)
|
||||
{
|
||||
ThreadContext tc;
|
||||
std::string dump = dumpSimcall<TestABI_1D>("test", &tc, testIntVoid);
|
||||
EXPECT_EQ(dump, "test(0, 11, 2, 13, ...)");
|
||||
}
|
||||
|
||||
TEST(GuestABI, isVarArgs)
|
||||
TEST(guest_abi, isVarArgs)
|
||||
{
|
||||
EXPECT_TRUE(GuestABI::IsVarArgs<GuestABI::VarArgs<int>>::value);
|
||||
EXPECT_FALSE(GuestABI::IsVarArgs<int>::value);
|
||||
EXPECT_FALSE(GuestABI::IsVarArgs<double>::value);
|
||||
EXPECT_TRUE(guest_abi::IsVarArgs<guest_abi::VarArgs<int>>::value);
|
||||
EXPECT_FALSE(guest_abi::IsVarArgs<int>::value);
|
||||
EXPECT_FALSE(guest_abi::IsVarArgs<double>::value);
|
||||
struct FooStruct {};
|
||||
EXPECT_FALSE(GuestABI::IsVarArgs<FooStruct>::value);
|
||||
EXPECT_FALSE(guest_abi::IsVarArgs<FooStruct>::value);
|
||||
union FooUnion {};
|
||||
EXPECT_FALSE(GuestABI::IsVarArgs<FooUnion>::value);
|
||||
EXPECT_FALSE(guest_abi::IsVarArgs<FooUnion>::value);
|
||||
}
|
||||
|
||||
@@ -28,9 +28,12 @@
|
||||
#ifndef __SIM_GUEST_ABI_DEFINITION_HH__
|
||||
#define __SIM_GUEST_ABI_DEFINITION_HH__
|
||||
|
||||
#include "base/compiler.hh"
|
||||
|
||||
class ThreadContext;
|
||||
|
||||
namespace GuestABI
|
||||
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi);
|
||||
namespace guest_abi
|
||||
{
|
||||
|
||||
/*
|
||||
@@ -113,6 +116,6 @@ struct Argument
|
||||
*/
|
||||
};
|
||||
|
||||
} // namespace GuestABI
|
||||
} // namespace guest_abi
|
||||
|
||||
#endif // __SIM_GUEST_ABI_DEFINITION_HH__
|
||||
|
||||
@@ -40,7 +40,8 @@
|
||||
|
||||
class ThreadContext;
|
||||
|
||||
namespace GuestABI
|
||||
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi);
|
||||
namespace guest_abi
|
||||
{
|
||||
|
||||
/*
|
||||
@@ -107,6 +108,6 @@ dumpArgsFrom(std::ostream &os, GEM5_VAR_USED ThreadContext *tc,
|
||||
os << ")";
|
||||
}
|
||||
|
||||
} // namespace GuestABI
|
||||
} // namespace guest_abi
|
||||
|
||||
#endif // __SIM_GUEST_ABI_DISPATCH_HH__
|
||||
|
||||
@@ -35,7 +35,8 @@
|
||||
|
||||
class ThreadContext;
|
||||
|
||||
namespace GuestABI
|
||||
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi);
|
||||
namespace guest_abi
|
||||
{
|
||||
|
||||
/*
|
||||
@@ -168,6 +169,6 @@ getArgument(ThreadContext *tc, typename ABI::State &state)
|
||||
return Argument<ABI, Arg>::get(tc, state);
|
||||
}
|
||||
|
||||
} // namespace GuestABI
|
||||
} // namespace guest_abi
|
||||
|
||||
#endif // __SIM_GUEST_ABI_LAYOUT_HH__
|
||||
|
||||
@@ -36,7 +36,8 @@
|
||||
|
||||
class ThreadContext;
|
||||
|
||||
namespace GuestABI
|
||||
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi);
|
||||
namespace guest_abi
|
||||
{
|
||||
|
||||
/*
|
||||
@@ -180,7 +181,7 @@ operator << (std::ostream &os, const VarArgs<Types...> &va)
|
||||
return os;
|
||||
}
|
||||
|
||||
// The ABI independent hook which tells the GuestABI mechanism what to do with
|
||||
// The ABI independent hook which tells the guest_abi mechanism what to do with
|
||||
// a VarArgs argument. It constructs the underlying implementation which knows
|
||||
// about the ABI, and installs it in the VarArgs wrapper to give to the
|
||||
// function.
|
||||
@@ -196,6 +197,6 @@ struct Argument<ABI, VarArgs<Types...>>
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace GuestABI
|
||||
} // namespace guest_abi
|
||||
|
||||
#endif // __SIM_GUEST_ABI_VARARGS_HH__
|
||||
|
||||
@@ -354,7 +354,8 @@ operator + (A a, const ProxyPtr<T, Proxy> &other)
|
||||
return other + a;
|
||||
}
|
||||
|
||||
namespace GuestABI
|
||||
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi);
|
||||
namespace guest_abi
|
||||
{
|
||||
|
||||
template <typename ABI, typename T, typename Proxy>
|
||||
@@ -379,7 +380,7 @@ struct Argument<ABI, ConstProxyPtr<T, Proxy>>
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace GuestABI
|
||||
} // namespace guest_abi
|
||||
|
||||
template <typename T, typename Proxy>
|
||||
std::ostream &
|
||||
|
||||
@@ -163,7 +163,7 @@ class TestProxy
|
||||
BackingStore &store;
|
||||
|
||||
TestProxy(BackingStore &_store) : store(_store) {}
|
||||
// Sneaky constructor for testing GuestABI integration.
|
||||
// Sneaky constructor for testing guest_abi integration.
|
||||
TestProxy(ThreadContext *tc) : store(*(BackingStore *)tc) {}
|
||||
|
||||
void
|
||||
@@ -469,7 +469,8 @@ struct TestABI
|
||||
using State = int;
|
||||
};
|
||||
|
||||
namespace GuestABI
|
||||
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi);
|
||||
namespace guest_abi
|
||||
{
|
||||
|
||||
template <>
|
||||
@@ -482,7 +483,7 @@ struct Argument<TestABI, Addr>
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace guest_abi
|
||||
|
||||
bool abiCalled = false;
|
||||
bool abiCalledConst = false;
|
||||
@@ -501,7 +502,7 @@ abiTestFuncConst(ThreadContext *tc, ConstTestPtr<uint8_t> ptr)
|
||||
EXPECT_EQ(ptr.addr(), 0x1000);
|
||||
}
|
||||
|
||||
TEST(ProxyPtr, GuestABI)
|
||||
TEST(ProxyPtr, guest_abi)
|
||||
{
|
||||
BackingStore store(0x1000, 0x1000);
|
||||
|
||||
|
||||
@@ -69,7 +69,8 @@ struct GenericSyscallABI32 : public GenericSyscallABI
|
||||
}
|
||||
};
|
||||
|
||||
namespace GuestABI
|
||||
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi);
|
||||
namespace guest_abi
|
||||
{
|
||||
|
||||
// For 64 bit systems, return syscall args directly.
|
||||
@@ -104,6 +105,6 @@ struct Argument<ABI, Arg,
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace GuestABI
|
||||
} // namespace guest_abi
|
||||
|
||||
#endif // __SIM_SYSCALL_ABI_HH__
|
||||
|
||||
@@ -105,7 +105,7 @@ class SyscallDesc
|
||||
/*
|
||||
* This SyscallDesc subclass template adapts a given syscall implementation so
|
||||
* that some arguments can come from the simulator (desc, num and tc) while the
|
||||
* rest can come from the guest using the GuestABI mechanism.
|
||||
* rest can come from the guest using the guest_abi mechanism.
|
||||
*/
|
||||
template <typename ABI>
|
||||
class SyscallDescABI : public SyscallDesc
|
||||
@@ -173,7 +173,7 @@ class SyscallDescABI : public SyscallDesc
|
||||
void
|
||||
returnInto(ThreadContext *tc, const SyscallReturn &ret) override
|
||||
{
|
||||
GuestABI::Result<ABI, SyscallReturn>::store(tc, ret);
|
||||
guest_abi::Result<ABI, SyscallReturn>::store(tc, ret);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -714,7 +714,7 @@ dup2Func(SyscallDesc *desc, ThreadContext *tc, int old_tgt_fd, int new_tgt_fd)
|
||||
|
||||
SyscallReturn
|
||||
fcntlFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
int tgt_fd, int cmd, GuestABI::VarArgs<int> varargs)
|
||||
int tgt_fd, int cmd, guest_abi::VarArgs<int> varargs)
|
||||
{
|
||||
auto p = tc->getProcessPtr();
|
||||
|
||||
|
||||
@@ -267,7 +267,7 @@ SyscallReturn dup2Func(SyscallDesc *desc, ThreadContext *tc,
|
||||
|
||||
/// Target fcntl() handler.
|
||||
SyscallReturn fcntlFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
int tgt_fd, int cmd, GuestABI::VarArgs<int> varargs);
|
||||
int tgt_fd, int cmd, guest_abi::VarArgs<int> varargs);
|
||||
|
||||
/// Target fcntl64() handler.
|
||||
SyscallReturn fcntl64Func(SyscallDesc *desc, ThreadContext *tc,
|
||||
@@ -1092,7 +1092,7 @@ template <class OS>
|
||||
SyscallReturn
|
||||
mremapFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
VPtr<> start, uint64_t old_length, uint64_t new_length, uint64_t flags,
|
||||
GuestABI::VarArgs<uint64_t> varargs)
|
||||
guest_abi::VarArgs<uint64_t> varargs)
|
||||
{
|
||||
auto p = tc->getProcessPtr();
|
||||
Addr page_bytes = p->pTable->pageSize();
|
||||
|
||||
Reference in New Issue
Block a user