summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/arch/arm/linux/linux.cc21
-rw-r--r--src/arch/arm/linux/linux.hh13
-rw-r--r--src/arch/arm/linux/process.cc8
-rw-r--r--src/arch/arm/process.cc22
-rw-r--r--src/arch/arm/process.hh1
5 files changed, 52 insertions, 13 deletions
diff --git a/src/arch/arm/linux/linux.cc b/src/arch/arm/linux/linux.cc
index a4c782403..c81eee3c8 100644
--- a/src/arch/arm/linux/linux.cc
+++ b/src/arch/arm/linux/linux.cc
@@ -56,15 +56,30 @@ OpenFlagTransTable ArmLinux::openFlagTable[] = {
{ ArmLinux::TGT_O_RDONLY, O_RDONLY },
{ ArmLinux::TGT_O_WRONLY, O_WRONLY },
{ ArmLinux::TGT_O_RDWR, O_RDWR },
- { ArmLinux::TGT_O_APPEND, O_APPEND },
{ ArmLinux::TGT_O_CREAT, O_CREAT },
- { ArmLinux::TGT_O_TRUNC, O_TRUNC },
{ ArmLinux::TGT_O_EXCL, O_EXCL },
- { ArmLinux::TGT_O_NONBLOCK, O_NONBLOCK },
{ ArmLinux::TGT_O_NOCTTY, O_NOCTTY },
+ { ArmLinux::TGT_O_TRUNC, O_TRUNC },
+ { ArmLinux::TGT_O_APPEND, O_APPEND },
+ { ArmLinux::TGT_O_NONBLOCK, O_NONBLOCK },
#ifdef O_SYNC
{ ArmLinux::TGT_O_SYNC, O_SYNC },
#endif
+#ifdef FASYNC
+ { ArmLinux::TGT_FASYNC, FASYNC },
+#endif
+#ifdef O_DIRECT
+ { ArmLinux::TGT_O_DIRECT, O_DIRECT },
+#endif
+#ifdef O_LARGEFILE
+ { ArmLinux::TGT_O_LARGEFILE, O_LARGEFILE },
+#endif
+#ifdef O_DIRECTORY
+ { ArmLinux::TGT_O_DIRECTORY, O_DIRECTORY },
+#endif
+#ifdef O_NOFOLLOW
+ { ArmLinux::TGT_O_NOFOLLOW, O_NOFOLLOW },
+#endif
#endif /* _MSC_VER */
};
diff --git a/src/arch/arm/linux/linux.hh b/src/arch/arm/linux/linux.hh
index 6ad4a862d..33e48fc93 100644
--- a/src/arch/arm/linux/linux.hh
+++ b/src/arch/arm/linux/linux.hh
@@ -79,11 +79,14 @@ class ArmLinux : public Linux
static const int TGT_O_NONBLOCK = 00004000; //!< O_NONBLOCK
static const int TGT_O_SYNC = 00010000; //!< O_SYNC
static const int TGT_FASYNC = 00020000; //!< FASYNC
- static const int TGT_O_DIRECTORY = 00040000; //!< O_DIRECTORY
- static const int TGT_O_NOFOLLOW = 00100000; //!< O_NOFOLLOW
- static const int TGT_O_DIRECT = 00200000; //!< O_DIRECT
- static const int TGT_O_LARGEFILE = 00400000; //!< O_LARGEFILE
+ static const int TGT_O_DIRECT = 00040000; //!< O_DIRECT
+ static const int TGT_O_LARGEFILE = 00100000; //!< O_LARGEFILE
+ static const int TGT_O_DIRECTORY = 00200000; //!< O_DIRECTORY
+ static const int TGT_O_NOFOLLOW = 00400000; //!< O_NOFOLLOW
static const int TGT_O_NOATIME = 01000000; //!< O_NOATIME
+ static const int TGT_O_CLOEXEC = 02000000; //!< O_NOATIME
+
+
//@}
/// For mmap().
@@ -106,7 +109,7 @@ class ArmLinux : public Linux
static const unsigned FIONREAD_ = 0x4004667f;
static const unsigned TIOCISATTY_ = 0x2000745e;
static const unsigned TIOCGETS_ = 0x402c7413;
- static const unsigned TIOCGETA_ = 0x40127417;
+ static const unsigned TIOCGETA_ = 0x5405;
static const unsigned TCSETAW_ = 0x5407; // 2.6.15 kernel
//@}
diff --git a/src/arch/arm/linux/process.cc b/src/arch/arm/linux/process.cc
index 66a19a13f..e3455d211 100644
--- a/src/arch/arm/linux/process.cc
+++ b/src/arch/arm/linux/process.cc
@@ -152,7 +152,7 @@ SyscallDesc ArmLinuxProcess::syscallDescs[] = {
/* 72 */ SyscallDesc("sigsuspend", unimplementedFunc),
/* 73 */ SyscallDesc("sigpending", unimplementedFunc),
/* 74 */ SyscallDesc("sethostname", ignoreFunc),
- /* 75 */ SyscallDesc("setrlimit", unimplementedFunc),
+ /* 75 */ SyscallDesc("setrlimit", ignoreFunc),
/* 76 */ SyscallDesc("getrlimit", unimplementedFunc),
/* 77 */ SyscallDesc("getrusage", getrusageFunc<ArmLinux>),
/* 78 */ SyscallDesc("gettimeofday", gettimeofdayFunc<ArmLinux>),
@@ -251,7 +251,7 @@ SyscallDesc ArmLinuxProcess::syscallDescs[] = {
/* 171 */ SyscallDesc("getresgid", unimplementedFunc),
/* 172 */ SyscallDesc("prctl", unimplementedFunc),
/* 173 */ SyscallDesc("rt_sigreturn", unimplementedFunc),
- /* 174 */ SyscallDesc("rt_sigaction", unimplementedFunc),
+ /* 174 */ SyscallDesc("rt_sigaction", ignoreFunc),
/* 175 */ SyscallDesc("rt_sigprocmask", unimplementedFunc),
/* 176 */ SyscallDesc("rt_sigpending", unimplementedFunc),
/* 177 */ SyscallDesc("rt_sigtimedwait", unimplementedFunc),
@@ -268,10 +268,10 @@ SyscallDesc ArmLinuxProcess::syscallDescs[] = {
/* 188 */ SyscallDesc("unused#188", unimplementedFunc),
/* 189 */ SyscallDesc("unused#189", unimplementedFunc),
/* 190 */ SyscallDesc("vfork", unimplementedFunc),
- /* 191 */ SyscallDesc("getrlimit", unimplementedFunc),
+ /* 191 */ SyscallDesc("getrlimit", getrlimitFunc<ArmLinux>),
/* 192 */ SyscallDesc("mmap2", mmapFunc<ArmLinux>),
/* 193 */ SyscallDesc("truncate64", unimplementedFunc),
- /* 194 */ SyscallDesc("ftruncate64", unimplementedFunc),
+ /* 194 */ SyscallDesc("ftruncate64", ftruncate64Func),
/* 195 */ SyscallDesc("stat64", stat64Func<ArmLinux>),
/* 196 */ SyscallDesc("lstat64", lstat64Func<ArmLinux>),
/* 197 */ SyscallDesc("fstat64", fstat64Func<ArmLinux>),
diff --git a/src/arch/arm/process.cc b/src/arch/arm/process.cc
index 00a6290c2..555fdf56e 100644
--- a/src/arch/arm/process.cc
+++ b/src/arch/arm/process.cc
@@ -362,10 +362,30 @@ ArmLiveProcess::argsInit(int intSize, int pageSize)
ArmISA::IntReg
ArmLiveProcess::getSyscallArg(ThreadContext *tc, int &i)
{
- assert(i < 4);
+ assert(i < 6);
return tc->readIntReg(ArgumentReg0 + i++);
}
+uint64_t
+ArmLiveProcess::getSyscallArg(ThreadContext *tc, int &i, int width)
+{
+ assert(width == 32 || width == 64);
+ if (width == 32)
+ return getSyscallArg(tc, i);
+
+ // 64 bit arguments are passed starting in an even register
+ if (i % 2 != 0)
+ i++;
+
+ // Registers r0-r6 can be used
+ assert(i < 5);
+ uint64_t val;
+ val = tc->readIntReg(ArgumentReg0 + i++);
+ val |= ((uint64_t)tc->readIntReg(ArgumentReg0 + i++) << 32);
+ return val;
+}
+
+
void
ArmLiveProcess::setSyscallArg(ThreadContext *tc,
int i, ArmISA::IntReg val)
diff --git a/src/arch/arm/process.hh b/src/arch/arm/process.hh
index a4dd5e842..3f7af2c9b 100644
--- a/src/arch/arm/process.hh
+++ b/src/arch/arm/process.hh
@@ -56,6 +56,7 @@ class ArmLiveProcess : public LiveProcess
public:
void argsInit(int intSize, int pageSize);
+ uint64_t getSyscallArg(ThreadContext *tc, int &i, int width);
ArmISA::IntReg getSyscallArg(ThreadContext *tc, int &i);
void setSyscallArg(ThreadContext *tc, int i, ArmISA::IntReg val);
void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value);