From: Gabe Black Date: Sat, 7 Dec 2019 01:41:13 +0000 (-0800) Subject: x86: In X86 linux, system calls simply return their result in a register. X-Git-Tag: v20.0.0.0~385 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8c594cfbdb872342648530e3731b9eee2858565c;p=gem5.git 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 --- 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