Remove intr_post function. No longer being used.
[gem5.git] / arch / alpha / linux_process.cc
index 783b189ccdbca133965ea96227cdf837fae5b38c..0b193fb55ee1aebaa5a21634ef3ceeb14b0a0a0f 100644 (file)
@@ -26,8 +26,8 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "arch/alpha/alpha_common_syscall_emul.hh"
-#include "arch/alpha/alpha_linux_process.hh"
+#include "arch/alpha/common_syscall_emul.hh"
+#include "arch/alpha/linux_process.hh"
 #include "arch/alpha/isa_traits.hh"
 
 #include "base/trace.hh"
 using namespace std;
 using namespace AlphaISA;
 
+/// Target pipe() handler.  Even though this is a generic Posix call,
+/// the Alpha return convention is funky, so that makes it
+/// Alpha-specific.
+SyscallReturn
+pipeFunc(SyscallDesc *desc, int callnum, Process *process,
+         ExecContext *xc)
+{
+    int fds[2], sim_fds[2];
+    int pipe_retval = pipe(fds);
+
+    if (pipe_retval < 0) {
+        // error
+        return pipe_retval;
+    }
+
+    sim_fds[0] = process->alloc_fd(fds[0]);
+    sim_fds[1] = process->alloc_fd(fds[1]);
+
+    // Alpha Linux convention for pipe() is that fd[0] is returned as
+    // the return value of the function, and fd[1] is returned in r20.
+    xc->regs.intRegFile[20] = sim_fds[1];
+    return sim_fds[0];
+}
+
+
 /// Target uname() handler.
 static SyscallReturn
 unameFunc(SyscallDesc *desc, int callnum, Process *process,
@@ -159,7 +184,7 @@ SyscallDesc AlphaLinuxProcess::syscallDescs[] = {
     /* 39 */ SyscallDesc("setpgid", unimplementedFunc),
     /* 40 */ SyscallDesc("osf_old_lstat", unimplementedFunc),
     /* 41 */ SyscallDesc("dup", unimplementedFunc),
-    /* 42 */ SyscallDesc("pipe", unimplementedFunc),
+    /* 42 */ SyscallDesc("pipe", pipeFunc),
     /* 43 */ SyscallDesc("osf_set_program_attributes", unimplementedFunc),
     /* 44 */ SyscallDesc("osf_profil", unimplementedFunc),
     /* 45 */ SyscallDesc("open", openFunc<Linux>),