arch: Do value-initialization for MemOperand
[gem5.git] / src / sim / syscall_return.hh
index 4c7db82263eb7537f705324ab8b1d06876f342b3..7c6a0c68aa0dac3170afd85312361aed925093d6 100644 (file)
@@ -61,10 +61,16 @@ class SyscallReturn
     /// 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;').
-    SyscallReturn(int64_t v) : value(v) {}
+    SyscallReturn(int64_t v) : _value(v), _count(1) {}
 
     /// A SyscallReturn constructed with no value means don't return anything.
-    SyscallReturn() : suppressedFlag(true) {}
+    SyscallReturn() : _count(0) {}
+
+    /// A SyscallReturn constructed with two values means put the second value
+    /// in additional return registers as defined by the ABI, if they exist.
+    SyscallReturn(int64_t v1, int64_t v2) :
+        _value(v1), _value2(v2), _count(2)
+    {}
 
     /// Pseudo-constructor to create an instance with the retry flag set.
     static SyscallReturn
@@ -81,21 +87,24 @@ class SyscallReturn
     bool
     successful() const
     {
-        return (value >= 0 || value <= -4096);
+        return (_value >= 0 || _value <= -4096);
     }
 
     /// Does the syscall need to be retried?
     bool needsRetry() const { return retryFlag; }
 
     /// Should returning this value be suppressed?
-    bool suppressed() const { return suppressedFlag; }
+    bool suppressed() const { return _count == 0; }
+
+    /// How many values did the syscall attempt to return?
+    int count() const { return _count; }
 
     /// The return value
     int64_t
     returnValue() const
     {
         assert(successful());
-        return value;
+        return _value;
     }
 
     /// The errno value
@@ -103,17 +112,18 @@ class SyscallReturn
     errnoValue() const
     {
         assert(!successful());
-        return -value;
+        return -_value;
     }
 
     /// The encoded value (as described above)
-    int64_t encodedValue() const { return value; }
+    int64_t encodedValue() const { return _value; }
+    int64_t value2() const { return _value2; }
 
   private:
-    int64_t value;
+    int64_t _value, _value2;
+    int _count;
 
     bool retryFlag = false;
-    bool suppressedFlag =  false;
 };
 
 #endif