From 8c594cfbdb872342648530e3731b9eee2858565c Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Fri, 6 Dec 2019 17:41:13 -0800 Subject: [PATCH] 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 Maintainer: Gabe Black Tested-by: kokoro --- src/arch/x86/linux/linux.hh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/arch/x86/linux/linux.hh b/src/arch/x86/linux/linux.hh index 11979cebc..7fb362784 100644 --- a/src/arch/x86/linux/linux.hh +++ b/src/arch/x86/linux/linux.hh @@ -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 +struct Result::value>::type> +{ + static void + store(ThreadContext *tc, const SyscallReturn &ret) + { + tc->setIntReg(ABI::ReturnValueReg, ret.encodedValue()); + } +}; + }; class X86Linux64 : public X86Linux -- 2.30.2