gem5
v20.1.0.0
|
This class represents the return value from an emulated system call, including any errno setting. More...
#include <syscall_return.hh>
Public Member Functions | |
SyscallReturn (int64_t v) | |
For simplicity, allow the object to be initialized with a single signed integer using the same positive=success, negative=-errno convention described above. More... | |
SyscallReturn () | |
A SyscallReturn constructed with no value means don't return anything. More... | |
SyscallReturn (int64_t v1, int64_t v2) | |
A SyscallReturn constructed with two values means put the second value in additional return registers as defined by the ABI, if they exist. More... | |
~SyscallReturn () | |
bool | successful () const |
Was the system call successful? More... | |
bool | needsRetry () const |
Does the syscall need to be retried? More... | |
bool | suppressed () const |
Should returning this value be suppressed? More... | |
int | count () const |
How many values did the syscall attempt to return? More... | |
int64_t | returnValue () const |
The return value. More... | |
int | errnoValue () const |
The errno value. More... | |
int64_t | encodedValue () const |
The encoded value (as described above) More... | |
int64_t | value2 () const |
Static Public Member Functions | |
static SyscallReturn | retry () |
Pseudo-constructor to create an instance with the retry flag set. More... | |
Private Attributes | |
int64_t | _value |
int64_t | _value2 |
int | _count |
bool | retryFlag = false |
This class represents the return value from an emulated system call, including any errno setting.
On some platforms, the return value and errno are encoded in a single signed integer. A value less than zero but greater than -4096 indicates an error, and the value is the negation of the errno value. Otherwise, the call was successful and the integer is the return value. (Large negative numbers are considered successful to allow syscalls to return pointers to high memory, e.g., stack addresses.) See, for example, Appendix A of the AMD64 ABI spec at http://www.x86-64.org/documentation/abi.pdf.
Other platforms use a more complex interface, returning a value and an error code in separate registers.
This class is designed to support both types of interfaces.
Definition at line 52 of file syscall_return.hh.
|
inline |
For simplicity, allow the object to be initialized with a single signed integer using the same positive=success, negative=-errno convention described above.
Typically this constructor is used as a default type conversion, so a bare integer is used where a SyscallReturn value is expected, e.g., as the return value from a system call emulation function ('return 0;' or 'return -EFAULT;').
Definition at line 64 of file syscall_return.hh.
|
inline |
A SyscallReturn constructed with no value means don't return anything.
Definition at line 67 of file syscall_return.hh.
|
inline |
A SyscallReturn constructed with two values means put the second value in additional return registers as defined by the ABI, if they exist.
Definition at line 71 of file syscall_return.hh.
|
inline |
Definition at line 84 of file syscall_return.hh.
|
inline |
How many values did the syscall attempt to return?
Definition at line 100 of file syscall_return.hh.
References _count.
Referenced by GuestABI::Result< ABI, SyscallReturn, typename std::enable_if< std::is_base_of< ArmFreebsdProcessBits::SyscallABI, ABI >::value >::type >::store(), GuestABI::Result< ABI, SyscallReturn, typename std::enable_if< std::is_base_of< ArmLinuxProcessBits::SyscallABI, ABI >::value >::type >::store(), GuestABI::Result< MipsProcess::SyscallABI, SyscallReturn >::store(), and GuestABI::Result< ABI, SyscallReturn, typename std::enable_if< std::is_base_of< SparcProcess::SyscallABI, ABI >::value >::type >::store().
|
inline |
The encoded value (as described above)
Definition at line 119 of file syscall_return.hh.
References _value.
Referenced by SyscallDesc::doSyscall(), GuestABI::Result< ABI, SyscallReturn, typename std::enable_if< std::is_base_of< ArmFreebsdProcessBits::SyscallABI, ABI >::value >::type >::store(), GuestABI::Result< ABI, SyscallReturn, typename std::enable_if< std::is_base_of< ArmLinuxProcessBits::SyscallABI, ABI >::value >::type >::store(), GuestABI::Result< PowerProcess::SyscallABI, SyscallReturn >::store(), GuestABI::Result< RiscvProcess::SyscallABI, SyscallReturn >::store(), and GuestABI::Result< ABI, SyscallReturn, typename std::enable_if< std::is_base_of< X86Linux::SyscallABI, ABI >::value >::type >::store().
|
inline |
The errno value.
Definition at line 112 of file syscall_return.hh.
References _value, and successful().
Referenced by GuestABI::Result< MipsProcess::SyscallABI, SyscallReturn >::store(), and GuestABI::Result< ABI, SyscallReturn, typename std::enable_if< std::is_base_of< SparcProcess::SyscallABI, ABI >::value >::type >::store().
|
inline |
Does the syscall need to be retried?
Definition at line 94 of file syscall_return.hh.
References retryFlag.
Referenced by SyscallDesc::doSyscall(), GuestABI::Result< ABI, SyscallReturn, typename std::enable_if< std::is_base_of< ArmFreebsdProcessBits::SyscallABI, ABI >::value >::type >::store(), GuestABI::Result< ABI, SyscallReturn, typename std::enable_if< std::is_base_of< ArmLinuxProcessBits::SyscallABI, ABI >::value >::type >::store(), GuestABI::Result< PowerProcess::SyscallABI, SyscallReturn >::store(), GuestABI::Result< MipsProcess::SyscallABI, SyscallReturn >::store(), GuestABI::Result< RiscvProcess::SyscallABI, SyscallReturn >::store(), GuestABI::Result< ABI, SyscallReturn, typename std::enable_if< std::is_base_of< X86Linux::SyscallABI, ABI >::value >::type >::store(), and GuestABI::Result< ABI, SyscallReturn, typename std::enable_if< std::is_base_of< SparcProcess::SyscallABI, ABI >::value >::type >::store().
|
inlinestatic |
Pseudo-constructor to create an instance with the retry flag set.
Definition at line 77 of file syscall_return.hh.
References ArmISA::s.
Referenced by acceptFunc(), pollFunc(), readFunc(), selectFunc(), wait4Func(), and writeFunc().
|
inline |
The return value.
Definition at line 104 of file syscall_return.hh.
References _value, and successful().
Referenced by GuestABI::Result< ABI, SyscallReturn, typename std::enable_if< std::is_base_of< ArmFreebsdProcessBits::SyscallABI, ABI >::value >::type >::store(), GuestABI::Result< MipsProcess::SyscallABI, SyscallReturn >::store(), GuestABI::Result< RiscvProcess::SyscallABI, SyscallReturn >::store(), and GuestABI::Result< ABI, SyscallReturn, typename std::enable_if< std::is_base_of< SparcProcess::SyscallABI, ABI >::value >::type >::store().
|
inline |
Was the system call successful?
Definition at line 88 of file syscall_return.hh.
References _value.
Referenced by errnoValue(), returnValue(), GuestABI::Result< ABI, SyscallReturn, typename std::enable_if< std::is_base_of< ArmFreebsdProcessBits::SyscallABI, ABI >::value >::type >::store(), GuestABI::Result< MipsProcess::SyscallABI, SyscallReturn >::store(), GuestABI::Result< PowerProcess::SyscallABI, SyscallReturn >::store(), GuestABI::Result< RiscvProcess::SyscallABI, SyscallReturn >::store(), and GuestABI::Result< ABI, SyscallReturn, typename std::enable_if< std::is_base_of< SparcProcess::SyscallABI, ABI >::value >::type >::store().
|
inline |
Should returning this value be suppressed?
Definition at line 97 of file syscall_return.hh.
References _count.
Referenced by SyscallDesc::doSyscall(), GuestABI::Result< ABI, SyscallReturn, typename std::enable_if< std::is_base_of< ArmFreebsdProcessBits::SyscallABI, ABI >::value >::type >::store(), GuestABI::Result< ABI, SyscallReturn, typename std::enable_if< std::is_base_of< ArmLinuxProcessBits::SyscallABI, ABI >::value >::type >::store(), GuestABI::Result< PowerProcess::SyscallABI, SyscallReturn >::store(), GuestABI::Result< MipsProcess::SyscallABI, SyscallReturn >::store(), GuestABI::Result< RiscvProcess::SyscallABI, SyscallReturn >::store(), GuestABI::Result< ABI, SyscallReturn, typename std::enable_if< std::is_base_of< X86Linux::SyscallABI, ABI >::value >::type >::store(), and GuestABI::Result< ABI, SyscallReturn, typename std::enable_if< std::is_base_of< SparcProcess::SyscallABI, ABI >::value >::type >::store().
|
inline |
Definition at line 120 of file syscall_return.hh.
References _value2.
Referenced by GuestABI::Result< ABI, SyscallReturn, typename std::enable_if< std::is_base_of< ArmFreebsdProcessBits::SyscallABI, ABI >::value >::type >::store(), GuestABI::Result< ABI, SyscallReturn, typename std::enable_if< std::is_base_of< ArmLinuxProcessBits::SyscallABI, ABI >::value >::type >::store(), GuestABI::Result< MipsProcess::SyscallABI, SyscallReturn >::store(), and GuestABI::Result< ABI, SyscallReturn, typename std::enable_if< std::is_base_of< SparcProcess::SyscallABI, ABI >::value >::type >::store().
|
private |
Definition at line 124 of file syscall_return.hh.
Referenced by count(), and suppressed().
|
private |
Definition at line 123 of file syscall_return.hh.
Referenced by encodedValue(), errnoValue(), returnValue(), and successful().
|
private |
Definition at line 123 of file syscall_return.hh.
Referenced by value2().
|
private |
Definition at line 126 of file syscall_return.hh.
Referenced by needsRetry().