gem5 v24.0.0.0
Loading...
Searching...
No Matches
gem5::SyscallReturn Class Reference

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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ SyscallReturn() [1/3]

gem5::SyscallReturn::SyscallReturn ( int64_t v)
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.

◆ SyscallReturn() [2/3]

gem5::SyscallReturn::SyscallReturn ( )
inline

A SyscallReturn constructed with no value means don't return anything.

Definition at line 70 of file syscall_return.hh.

◆ SyscallReturn() [3/3]

gem5::SyscallReturn::SyscallReturn ( int64_t v1,
int64_t v2 )
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.

◆ ~SyscallReturn()

gem5::SyscallReturn::~SyscallReturn ( )
inline

Definition at line 87 of file syscall_return.hh.

Member Function Documentation

◆ count()

◆ encodedValue()

◆ errnoValue()

◆ needsRetry()

bool gem5::SyscallReturn::needsRetry ( ) const
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().

◆ retry()

static SyscallReturn gem5::SyscallReturn::retry ( )
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().

◆ returnValue()

◆ successful()

◆ suppressed()

bool gem5::SyscallReturn::suppressed ( ) const
inline

Should returning this value be suppressed?

Definition at line 100 of file syscall_return.hh.

References _count.

Referenced by gem5::SyscallDesc::handleReturn().

◆ value2()

Member Data Documentation

◆ _count

int gem5::SyscallReturn::_count
private

Definition at line 127 of file syscall_return.hh.

Referenced by count(), and suppressed().

◆ _value

int64_t gem5::SyscallReturn::_value
private

Definition at line 126 of file syscall_return.hh.

Referenced by encodedValue(), errnoValue(), returnValue(), and successful().

◆ _value2

int64_t gem5::SyscallReturn::_value2
private

Definition at line 126 of file syscall_return.hh.

Referenced by value2().

◆ retryFlag

bool gem5::SyscallReturn::retryFlag = false
private

Definition at line 129 of file syscall_return.hh.

Referenced by needsRetry().


The documentation for this class was generated from the following file:

Generated on Tue Jun 18 2024 16:24:15 for gem5 by doxygen 1.11.0