ARM: Fix SPEC2000 benchmarks in SE mode. With this patch all

Spec2k benchmarks seem to run with atomic or timing mode simple
CPUs. Fixed up some constants, handling of 64 bit arguments,
and marked a few more syscalls ignoreFunc.
This commit is contained in:
Ali Saidi 2010-06-02 12:58:18 -05:00
parent 5d5bf8cbc7
commit 5268067f14
5 changed files with 52 additions and 13 deletions

View file

@ -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 */
};

View file

@ -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
//@}

View file

@ -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>),

View file

@ -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)

View file

@ -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);