summaryrefslogtreecommitdiff
path: root/arch/alpha
diff options
context:
space:
mode:
authorAli Saidi <saidi@eecs.umich.edu>2006-03-09 15:56:42 -0500
committerAli Saidi <saidi@eecs.umich.edu>2006-03-09 15:56:42 -0500
commit56cc760f6f53138c133c5d4e1f9d3e3199965d99 (patch)
tree991271751791743eb9db33508fd3d183e61772be /arch/alpha
parent91545ac2bf5ac47ecbfc403ef6e2b2ce340ae551 (diff)
parentce3a6343b6c54e95d63403d46c9ddea384e49476 (diff)
downloadgem5-56cc760f6f53138c133c5d4e1f9d3e3199965d99.tar.xz
Merge zizzer:/bk/multiarch
into zeep.eecs.umich.edu:/z/saidi/work/m5.ma2 arch/alpha/isa_traits.hh: arch/alpha/linux/process.cc: arch/sparc/isa_traits.hh: arch/sparc/linux/process.cc: sim/process.cc: merge --HG-- rename : cpu/exec_context.hh => cpu/cpu_exec_context.hh extra : convert_revision : fea0155c8e23abbd0d5d5251abbd0f4d223fe935
Diffstat (limited to 'arch/alpha')
-rw-r--r--arch/alpha/SConscript1
-rw-r--r--arch/alpha/isa_traits.hh95
-rw-r--r--arch/alpha/linux/process.cc32
-rw-r--r--arch/alpha/tru64/process.cc7
4 files changed, 64 insertions, 71 deletions
diff --git a/arch/alpha/SConscript b/arch/alpha/SConscript
index 6dec2d070..ed7fd3404 100644
--- a/arch/alpha/SConscript
+++ b/arch/alpha/SConscript
@@ -65,7 +65,6 @@ full_system_sources = Split('''
# Syscall emulation (non-full-system) sources
syscall_emulation_sources = Split('''
- common_syscall_emul.cc
linux/process.cc
tru64/process.cc
process.cc
diff --git a/arch/alpha/isa_traits.hh b/arch/alpha/isa_traits.hh
index 3cd6868b8..6f6b11e62 100644
--- a/arch/alpha/isa_traits.hh
+++ b/arch/alpha/isa_traits.hh
@@ -53,6 +53,44 @@ int DTB_ASN_ASN(uint64_t reg);
int ITB_ASN_ASN(uint64_t reg);
}
+#if !FULL_SYSTEM
+class SyscallReturn {
+ public:
+ template <class T>
+ SyscallReturn(T v, bool s)
+ {
+ retval = (uint64_t)v;
+ success = s;
+ }
+
+ template <class T>
+ SyscallReturn(T v)
+ {
+ success = (v >= 0);
+ retval = (uint64_t)v;
+ }
+
+ ~SyscallReturn() {}
+
+ SyscallReturn& operator=(const SyscallReturn& s) {
+ retval = s.retval;
+ success = s.success;
+ return *this;
+ }
+
+ bool successful() { return success; }
+ uint64_t value() { return retval; }
+
+
+ private:
+ uint64_t retval;
+ bool success;
+};
+
+#endif
+
+
+
namespace AlphaISA
{
@@ -85,6 +123,10 @@ namespace AlphaISA
const int ArgumentReg3 = 19;
const int ArgumentReg4 = 20;
const int ArgumentReg5 = 21;
+ const int SyscallNumReg = ReturnValueReg;
+ const int SyscallPseudoReturnReg = ArgumentReg4;
+
+
const int LogVMPageSize = 13; // 8K bytes
const int VMPageSize = (1 << LogVMPageSize);
@@ -299,44 +341,21 @@ extern const int reg_redir[NumIntRegs];
template <class XC>
void zeroRegisters(XC *xc);
- const Addr MaxAddr = (Addr)-1;
-};
-
-#if !FULL_SYSTEM
-class SyscallReturn {
- public:
- template <class T>
- SyscallReturn(T v, bool s)
- {
- retval = (uint64_t)v;
- success = s;
- }
-
- template <class T>
- SyscallReturn(T v)
- {
- success = (v >= 0);
- retval = (uint64_t)v;
- }
-
- ~SyscallReturn() {}
-
- SyscallReturn& operator=(const SyscallReturn& s) {
- retval = s.retval;
- success = s.success;
- return *this;
- }
-
- bool successful() { return success; }
- uint64_t value() { return retval; }
-
-
- private:
- uint64_t retval;
- bool success;
-};
-
-#endif
+ static inline void setSyscallReturn(SyscallReturn return_value, RegFile *regs)
+ {
+ // check for error condition. Alpha syscall convention is to
+ // indicate success/failure in reg a3 (r19) and put the
+ // return value itself in the standard return value reg (v0).
+ if (return_value.successful()) {
+ // no error
+ regs->intRegFile[SyscallSuccessReg] = 0;
+ regs->intRegFile[ReturnValueReg] = return_value.value();
+ } else {
+ // got an error, return details
+ regs->intRegFile[SyscallSuccessReg] = (IntReg) -1;
+ regs->intRegFile[ReturnValueReg] = -return_value.value();
+ }
+ }
static inline AlphaISA::ExtMachInst
AlphaISA::makeExtMI(AlphaISA::MachInst inst, const uint64_t &pc) {
diff --git a/arch/alpha/linux/process.cc b/arch/alpha/linux/process.cc
index c579c47d9..1c911bc50 100644
--- a/arch/alpha/linux/process.cc
+++ b/arch/alpha/linux/process.cc
@@ -26,7 +26,6 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "arch/alpha/common_syscall_emul.hh"
#include "arch/alpha/linux/process.hh"
#include "arch/alpha/isa_traits.hh"
@@ -41,29 +40,6 @@
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->setIntReg(20, sim_fds[1]);
- return sim_fds[0];
-}
/// Target uname() handler.
@@ -162,11 +138,11 @@ SyscallDesc AlphaLinuxProcess::syscallDescs[] = {
/* 17 */ SyscallDesc("brk", obreakFunc),
/* 18 */ SyscallDesc("osf_getfsstat", unimplementedFunc),
/* 19 */ SyscallDesc("lseek", lseekFunc),
- /* 20 */ SyscallDesc("getxpid", getpidFunc),
+ /* 20 */ SyscallDesc("getxpid", getpidPseudoFunc),
/* 21 */ SyscallDesc("osf_mount", unimplementedFunc),
/* 22 */ SyscallDesc("umount", unimplementedFunc),
/* 23 */ SyscallDesc("setuid", setuidFunc),
- /* 24 */ SyscallDesc("getxuid", getuidFunc),
+ /* 24 */ SyscallDesc("getxuid", getuidPseudoFunc),
/* 25 */ SyscallDesc("exec_with_loader", unimplementedFunc),
/* 26 */ SyscallDesc("osf_ptrace", unimplementedFunc),
/* 27 */ SyscallDesc("osf_nrecvmsg", unimplementedFunc),
@@ -184,12 +160,12 @@ SyscallDesc AlphaLinuxProcess::syscallDescs[] = {
/* 39 */ SyscallDesc("setpgid", unimplementedFunc),
/* 40 */ SyscallDesc("osf_old_lstat", unimplementedFunc),
/* 41 */ SyscallDesc("dup", unimplementedFunc),
- /* 42 */ SyscallDesc("pipe", pipeFunc),
+ /* 42 */ SyscallDesc("pipe", pipePseudoFunc),
/* 43 */ SyscallDesc("osf_set_program_attributes", unimplementedFunc),
/* 44 */ SyscallDesc("osf_profil", unimplementedFunc),
/* 45 */ SyscallDesc("open", openFunc<Linux>),
/* 46 */ SyscallDesc("osf_old_sigaction", unimplementedFunc),
- /* 47 */ SyscallDesc("getxgid", getgidFunc),
+ /* 47 */ SyscallDesc("getxgid", getgidPseudoFunc),
/* 48 */ SyscallDesc("osf_sigprocmask", ignoreFunc),
/* 49 */ SyscallDesc("osf_getlogin", unimplementedFunc),
/* 50 */ SyscallDesc("osf_setlogin", unimplementedFunc),
diff --git a/arch/alpha/tru64/process.cc b/arch/alpha/tru64/process.cc
index 3d9b2aeca..c3a203587 100644
--- a/arch/alpha/tru64/process.cc
+++ b/arch/alpha/tru64/process.cc
@@ -27,7 +27,6 @@
*/
#include "arch/alpha/isa_traits.hh"
-#include "arch/alpha/common_syscall_emul.hh"
#include "arch/alpha/tru64/process.hh"
#include "cpu/exec_context.hh"
#include "kern/tru64/tru64.hh"
@@ -179,11 +178,11 @@ SyscallDesc AlphaTru64Process::syscallDescs[] = {
/* 17 */ SyscallDesc("obreak", obreakFunc),
/* 18 */ SyscallDesc("pre_F64_getfsstat", unimplementedFunc),
/* 19 */ SyscallDesc("lseek", lseekFunc),
- /* 20 */ SyscallDesc("getpid", getpidFunc),
+ /* 20 */ SyscallDesc("getpid", getpidPseudoFunc),
/* 21 */ SyscallDesc("mount", unimplementedFunc),
/* 22 */ SyscallDesc("unmount", unimplementedFunc),
/* 23 */ SyscallDesc("setuid", setuidFunc),
- /* 24 */ SyscallDesc("getuid", getuidFunc),
+ /* 24 */ SyscallDesc("getuid", getuidPseudoFunc),
/* 25 */ SyscallDesc("exec_with_loader", unimplementedFunc),
/* 26 */ SyscallDesc("ptrace", unimplementedFunc),
/* 27 */ SyscallDesc("recvmsg", unimplementedFunc),
@@ -206,7 +205,7 @@ SyscallDesc AlphaTru64Process::syscallDescs[] = {
/* 44 */ SyscallDesc("profil", unimplementedFunc),
/* 45 */ SyscallDesc("open", openFunc<Tru64>),
/* 46 */ SyscallDesc("obsolete osigaction", unimplementedFunc),
- /* 47 */ SyscallDesc("getgid", getgidFunc),
+ /* 47 */ SyscallDesc("getgid", getgidPseudoFunc),
/* 48 */ SyscallDesc("sigprocmask", ignoreFunc),
/* 49 */ SyscallDesc("getlogin", unimplementedFunc),
/* 50 */ SyscallDesc("setlogin", unimplementedFunc),