gem5 v24.0.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. | |
SyscallReturn () | |
A SyscallReturn constructed with no value means don't return anything. | |
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. | |
~SyscallReturn () | |
bool | successful () const |
Was the system call successful? | |
bool | needsRetry () const |
Does the syscall need to be retried? | |
bool | suppressed () const |
Should returning this value be suppressed? | |
int | count () const |
How many values did the syscall attempt to return? | |
int64_t | returnValue () const |
The return value. | |
int | errnoValue () const |
The errno value. | |
int64_t | encodedValue () const |
The encoded value (as described above) | |
int64_t | value2 () const |
Static Public Member Functions | |
static SyscallReturn | retry () |
Pseudo-constructor to create an instance with the retry flag set. | |
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 55 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 67 of file syscall_return.hh.
|
inline |
A SyscallReturn constructed with no value means don't return anything.
Definition at line 70 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 74 of file syscall_return.hh.
|
inline |
Definition at line 87 of file syscall_return.hh.
|
inline |
How many values did the syscall attempt to return?
Definition at line 103 of file syscall_return.hh.
References _count.
Referenced by gem5::guest_abi::Result< ABI, SyscallReturn, typename std::enable_if_t< std::is_base_of_v< ArmISA::EmuFreebsd::BaseSyscallABI, ABI > > >::store(), gem5::guest_abi::Result< ABI, SyscallReturn, typename std::enable_if_t< std::is_base_of_v< ArmISA::EmuLinux::BaseSyscallABI, ABI > > >::store(), gem5::guest_abi::Result< ABI, SyscallReturn, typename std::enable_if_t< std::is_base_of_v< SparcISA::SEWorkload::BaseSyscallABI, ABI > > >::store(), and gem5::guest_abi::Result< MipsISA::SEWorkload::SyscallABI, SyscallReturn >::store().
|
inline |
The encoded value (as described above)
Definition at line 122 of file syscall_return.hh.
References _value.
Referenced by gem5::SyscallDesc::handleReturn(), gem5::guest_abi::Result< ABI, SyscallReturn, typename std::enable_if_t< std::is_base_of_v< ArmISA::EmuFreebsd::BaseSyscallABI, ABI > > >::store(), gem5::guest_abi::Result< ABI, SyscallReturn, typename std::enable_if_t< std::is_base_of_v< ArmISA::EmuLinux::BaseSyscallABI, ABI > > >::store(), gem5::guest_abi::Result< ABI, SyscallReturn, typename std::enable_if_t< std::is_base_of_v< X86Linux::SyscallABI, ABI > > >::store(), gem5::guest_abi::Result< PowerISA::SEWorkload::SyscallABI, SyscallReturn >::store(), gem5::guest_abi::Result< RiscvISA::SEWorkload::SyscallABI32, SyscallReturn >::store(), and gem5::guest_abi::Result< RiscvISA::SEWorkload::SyscallABI64, SyscallReturn >::store().
|
inline |
The errno value.
Definition at line 115 of file syscall_return.hh.
References _value, and successful().
Referenced by gem5::guest_abi::Result< ABI, SyscallReturn, typename std::enable_if_t< std::is_base_of_v< SparcISA::SEWorkload::BaseSyscallABI, ABI > > >::store(), and gem5::guest_abi::Result< MipsISA::SEWorkload::SyscallABI, SyscallReturn >::store().
|
inline |
Does the syscall need to be retried?
Definition at line 97 of file syscall_return.hh.
References retryFlag.
Referenced by gem5::SyscallDesc::doSyscall(), and gem5::SyscallDesc::retrySyscall().
|
inlinestatic |
Pseudo-constructor to create an instance with the retry flag set.
Definition at line 80 of file syscall_return.hh.
References gem5::ArmISA::s.
Referenced by gem5::acceptFunc(), gem5::pollFunc(), gem5::readFunc(), gem5::selectFunc(), gem5::wait4Func(), and gem5::writeFunc().
|
inline |
The return value.
Definition at line 107 of file syscall_return.hh.
References _value, and successful().
Referenced by gem5::guest_abi::Result< ABI, SyscallReturn, typename std::enable_if_t< std::is_base_of_v< ArmISA::EmuFreebsd::BaseSyscallABI, ABI > > >::store(), gem5::guest_abi::Result< ABI, SyscallReturn, typename std::enable_if_t< std::is_base_of_v< SparcISA::SEWorkload::BaseSyscallABI, ABI > > >::store(), gem5::guest_abi::Result< MipsISA::SEWorkload::SyscallABI, SyscallReturn >::store(), gem5::guest_abi::Result< RiscvISA::SEWorkload::SyscallABI32, SyscallReturn >::store(), and gem5::guest_abi::Result< RiscvISA::SEWorkload::SyscallABI64, SyscallReturn >::store().
|
inline |
Was the system call successful?
Definition at line 91 of file syscall_return.hh.
References _value.
Referenced by errnoValue(), gem5::faccessatFunc(), gem5::fchmodatFunc(), gem5::fchownatFunc(), gem5::fstatat64Func(), gem5::futimesatFunc(), gem5::mkdiratFunc(), gem5::mknodatFunc(), gem5::newfstatatFunc(), gem5::readlinkatFunc(), gem5::renameatFunc(), returnValue(), gem5::statxFunc(), gem5::guest_abi::Result< ABI, SyscallReturn, typename std::enable_if_t< std::is_base_of_v< ArmISA::EmuFreebsd::BaseSyscallABI, ABI > > >::store(), gem5::guest_abi::Result< ABI, SyscallReturn, typename std::enable_if_t< std::is_base_of_v< SparcISA::SEWorkload::BaseSyscallABI, ABI > > >::store(), gem5::guest_abi::Result< MipsISA::SEWorkload::SyscallABI, SyscallReturn >::store(), gem5::guest_abi::Result< PowerISA::SEWorkload::SyscallABI, SyscallReturn >::store(), gem5::guest_abi::Result< RiscvISA::SEWorkload::SyscallABI32, SyscallReturn >::store(), gem5::guest_abi::Result< RiscvISA::SEWorkload::SyscallABI64, SyscallReturn >::store(), and gem5::unlinkatFunc().
|
inline |
Should returning this value be suppressed?
Definition at line 100 of file syscall_return.hh.
References _count.
Referenced by gem5::SyscallDesc::handleReturn().
|
inline |
Definition at line 123 of file syscall_return.hh.
References _value2.
Referenced by gem5::guest_abi::Result< ABI, SyscallReturn, typename std::enable_if_t< std::is_base_of_v< ArmISA::EmuFreebsd::BaseSyscallABI, ABI > > >::store(), gem5::guest_abi::Result< ABI, SyscallReturn, typename std::enable_if_t< std::is_base_of_v< ArmISA::EmuLinux::BaseSyscallABI, ABI > > >::store(), gem5::guest_abi::Result< ABI, SyscallReturn, typename std::enable_if_t< std::is_base_of_v< SparcISA::SEWorkload::BaseSyscallABI, ABI > > >::store(), and gem5::guest_abi::Result< MipsISA::SEWorkload::SyscallABI, SyscallReturn >::store().
|
private |
Definition at line 127 of file syscall_return.hh.
Referenced by count(), and suppressed().
|
private |
Definition at line 126 of file syscall_return.hh.
Referenced by encodedValue(), errnoValue(), returnValue(), and successful().
|
private |
Definition at line 126 of file syscall_return.hh.
Referenced by value2().
|
private |
Definition at line 129 of file syscall_return.hh.
Referenced by needsRetry().