x86: In X86 linux, system calls simply return their result in a register.
We can partially define an x86 linux system call ABI which handles the return value. Argument gathering would be handled elsewhere. Change-Id: Id2841dea39aa2ea3fc42e1a0fb70ff4e477b3671 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23442 Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu> Maintainer: Gabe Black <gabeblack@google.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -40,6 +40,8 @@
|
||||
|
||||
#include "arch/x86/utility.hh"
|
||||
#include "kern/linux/linux.hh"
|
||||
#include "sim/guest_abi.hh"
|
||||
#include "sim/syscall_return.hh"
|
||||
|
||||
class X86Linux : public Linux
|
||||
{
|
||||
@@ -62,6 +64,27 @@ class X86Linux : public Linux
|
||||
if (stack)
|
||||
ctc->setIntReg(X86ISA::StackPointerReg, stack);
|
||||
}
|
||||
|
||||
class SyscallABI
|
||||
{
|
||||
};
|
||||
};
|
||||
|
||||
namespace GuestABI
|
||||
{
|
||||
|
||||
template <typename ABI>
|
||||
struct Result<ABI, SyscallReturn,
|
||||
typename std::enable_if<std::is_base_of<
|
||||
X86Linux::SyscallABI, ABI>::value>::type>
|
||||
{
|
||||
static void
|
||||
store(ThreadContext *tc, const SyscallReturn &ret)
|
||||
{
|
||||
tc->setIntReg(ABI::ReturnValueReg, ret.encodedValue());
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
class X86Linux64 : public X86Linux
|
||||
|
||||
Reference in New Issue
Block a user