gem5  [DEVELOP-FOR-23.0]
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
syscall_return.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2003-2005 The Regents of The University of Michigan
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met: redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer;
9  * redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution;
12  * neither the name of the copyright holders nor the names of its
13  * contributors may be used to endorse or promote products derived from
14  * this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef __SIM_SYSCALLRETURN_HH__
30 #define __SIM_SYSCALLRETURN_HH__
31 
32 #include <inttypes.h>
33 
34 namespace gem5
35 {
36 
56 {
57  public:
58 
67  SyscallReturn(int64_t v) : _value(v), _count(1) {}
68 
71 
74  SyscallReturn(int64_t v1, int64_t v2) :
75  _value(v1), _value2(v2), _count(2)
76  {}
77 
79  static SyscallReturn
81  {
82  SyscallReturn s(0);
83  s.retryFlag = true;
84  return s;
85  }
86 
88 
90  bool
91  successful() const
92  {
93  return (_value >= 0 || _value <= -4096);
94  }
95 
97  bool needsRetry() const { return retryFlag; }
98 
100  bool suppressed() const { return _count == 0; }
101 
103  int count() const { return _count; }
104 
106  int64_t
107  returnValue() const
108  {
109  assert(successful());
110  return _value;
111  }
112 
114  int
115  errnoValue() const
116  {
117  assert(!successful());
118  return -_value;
119  }
120 
122  int64_t encodedValue() const { return _value; }
123  int64_t value2() const { return _value2; }
124 
125  private:
126  int64_t _value, _value2;
127  int _count;
128 
129  bool retryFlag = false;
130 };
131 
132 } // namespace gem5
133 
134 #endif
gem5::VegaISA::s
Bitfield< 1 > s
Definition: pagetable.hh:64
gem5::SyscallReturn::returnValue
int64_t returnValue() const
The return value.
Definition: syscall_return.hh:107
gem5::SyscallReturn::errnoValue
int errnoValue() const
The errno value.
Definition: syscall_return.hh:115
gem5::SyscallReturn
This class represents the return value from an emulated system call, including any errno setting.
Definition: syscall_return.hh:55
gem5::SyscallReturn::retry
static SyscallReturn retry()
Pseudo-constructor to create an instance with the retry flag set.
Definition: syscall_return.hh:80
gem5::SyscallReturn::_value2
int64_t _value2
Definition: syscall_return.hh:126
gem5::SyscallReturn::SyscallReturn
SyscallReturn()
A SyscallReturn constructed with no value means don't return anything.
Definition: syscall_return.hh:70
gem5::SyscallReturn::SyscallReturn
SyscallReturn(int64_t v)
For simplicity, allow the object to be initialized with a single signed integer using the same positi...
Definition: syscall_return.hh:67
gem5::SyscallReturn::SyscallReturn
SyscallReturn(int64_t v1, int64_t v2)
A SyscallReturn constructed with two values means put the second value in additional return registers...
Definition: syscall_return.hh:74
gem5::SyscallReturn::_value
int64_t _value
Definition: syscall_return.hh:126
gem5::SyscallReturn::retryFlag
bool retryFlag
Definition: syscall_return.hh:129
gem5::SyscallReturn::~SyscallReturn
~SyscallReturn()
Definition: syscall_return.hh:87
gem5::SyscallReturn::encodedValue
int64_t encodedValue() const
The encoded value (as described above)
Definition: syscall_return.hh:122
gem5::VegaISA::v
Bitfield< 0 > v
Definition: pagetable.hh:65
gem5::SyscallReturn::count
int count() const
How many values did the syscall attempt to return?
Definition: syscall_return.hh:103
gem5::SyscallReturn::_count
int _count
Definition: syscall_return.hh:127
gem5::SyscallReturn::value2
int64_t value2() const
Definition: syscall_return.hh:123
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::SyscallReturn::suppressed
bool suppressed() const
Should returning this value be suppressed?
Definition: syscall_return.hh:100
gem5::SyscallReturn::successful
bool successful() const
Was the system call successful?
Definition: syscall_return.hh:91
gem5::SyscallReturn::needsRetry
bool needsRetry() const
Does the syscall need to be retried?
Definition: syscall_return.hh:97

Generated on Sun Jul 30 2023 01:57:00 for gem5 by doxygen 1.8.17