From c2ae978e0996e86cb267f0c7e4314b6334e40efc Mon Sep 17 00:00:00 2001 From: Erik Hallnor Date: Thu, 29 Jan 2004 14:36:18 -0500 Subject: [PATCH 1/6] Add operator= to CacheBlk to simplify some functions. --HG-- extra : convert_revision : 949a24f46f647dc2c4d0b60df4684b4f7164a04f From 423d85806160c4a7a1bf7516a87af455f2546161 Mon Sep 17 00:00:00 2001 From: Erik Hallnor Date: Mon, 2 Feb 2004 14:10:24 -0500 Subject: [PATCH 2/6] Change the way the IIC way list is handled in the primary table. --HG-- extra : convert_revision : 476f738d59446bdc43d1bd67950aac310b22a42c From 2d6db0359e5950673fe769252ce88d11d5a59da6 Mon Sep 17 00:00:00 2001 From: Erik Hallnor Date: Wed, 4 Feb 2004 16:55:05 -0500 Subject: [PATCH 3/6] Change IIC to use param class. Tweak parameters in CacheTags. --HG-- extra : convert_revision : 8239a7befe49c81b6b1f239fc478910441f64352 From 95c248c2139ff8d3568e1c92319727777f19920f Mon Sep 17 00:00:00 2001 From: David Oehmke Date: Thu, 5 Feb 2004 12:16:17 -0500 Subject: [PATCH 4/6] Modify the emulated system calls to support running the SPEC Int benchmarks for alpha-linux. arch/alpha/alpha_linux_process.cc: Added some more ioctl commands to ignore. Set unlink and rename to the new functions. Ignore setrlimit, times and rt_sigaction. Should eventually provide a function for times. arch/alpha/alpha_tru64_process.cc: Added some more ioctl commands to ignore. Set unlink and rename to the new functions. Ignore setrlimit. sim/syscall_emul.cc: Added implementations for unlink and rename. sim/syscall_emul.hh: Added unlink and rename functions. Added a couple more ioctl requests to ignore. Print out the PC of any ioctl commands that fail. --HG-- extra : convert_revision : 8af21c7fa7d0645d3f9324c9ce70ad33590c3c8e --- arch/alpha/alpha_linux_process.cc | 12 +++++++----- arch/alpha/alpha_tru64_process.cc | 9 ++++++--- sim/syscall_emul.cc | 28 ++++++++++++++++++++++++++++ sim/syscall_emul.hh | 10 +++++++++- 4 files changed, 50 insertions(+), 9 deletions(-) diff --git a/arch/alpha/alpha_linux_process.cc b/arch/alpha/alpha_linux_process.cc index d8a05849dd..ae197d1ac3 100644 --- a/arch/alpha/alpha_linux_process.cc +++ b/arch/alpha/alpha_linux_process.cc @@ -139,6 +139,8 @@ class Linux { static const unsigned TIOCGETC = 0x40067412; static const unsigned FIONREAD = 0x4004667f; static const unsigned TIOCISATTY = 0x2000745e; + static const unsigned TIOCGETS = 0x402c7413; + static const unsigned TIOCGETA = 0x40127417; //@} /// Resource enumeration for getrlimit(). @@ -421,7 +423,7 @@ SyscallDesc Linux::syscallDescs[] = { /* 7 */ SyscallDesc("osf_wait4", unimplementedFunc), /* 8 */ SyscallDesc("osf_old_creat", unimplementedFunc), /* 9 */ SyscallDesc("link", unimplementedFunc), - /* 10 */ SyscallDesc("unlink", unimplementedFunc), + /* 10 */ SyscallDesc("unlink", unlinkFunc), /* 11 */ SyscallDesc("osf_execve", unimplementedFunc), /* 12 */ SyscallDesc("chdir", unimplementedFunc), /* 13 */ SyscallDesc("fchdir", unimplementedFunc), @@ -539,7 +541,7 @@ SyscallDesc Linux::syscallDescs[] = { /* 125 */ SyscallDesc("recvfrom", unimplementedFunc), /* 126 */ SyscallDesc("setreuid", unimplementedFunc), /* 127 */ SyscallDesc("setregid", unimplementedFunc), - /* 128 */ SyscallDesc("rename", unimplementedFunc), + /* 128 */ SyscallDesc("rename", renameFunc), /* 129 */ SyscallDesc("truncate", unimplementedFunc), /* 130 */ SyscallDesc("ftruncate", unimplementedFunc), /* 131 */ SyscallDesc("flock", unimplementedFunc), @@ -556,7 +558,7 @@ SyscallDesc Linux::syscallDescs[] = { /* 142 */ SyscallDesc("osf_gethostid", unimplementedFunc), /* 143 */ SyscallDesc("osf_sethostid", unimplementedFunc), /* 144 */ SyscallDesc("getrlimit", getrlimitFunc), - /* 145 */ SyscallDesc("setrlimit", unimplementedFunc), + /* 145 */ SyscallDesc("setrlimit", ignoreFunc), /* 146 */ SyscallDesc("osf_old_killpg", unimplementedFunc), /* 147 */ SyscallDesc("setsid", unimplementedFunc), /* 148 */ SyscallDesc("quotactl", unimplementedFunc), @@ -737,7 +739,7 @@ SyscallDesc Linux::syscallDescs[] = { /* 320 */ SyscallDesc("was sys_idle", unimplementedFunc), /* 321 */ SyscallDesc("oldumount", unimplementedFunc), /* 322 */ SyscallDesc("swapon", unimplementedFunc), - /* 323 */ SyscallDesc("times", unimplementedFunc), + /* 323 */ SyscallDesc("times", ignoreFunc), /* 324 */ SyscallDesc("personality", unimplementedFunc), /* 325 */ SyscallDesc("setfsuid", unimplementedFunc), /* 326 */ SyscallDesc("setfsgid", unimplementedFunc), @@ -766,7 +768,7 @@ SyscallDesc Linux::syscallDescs[] = { /* 349 */ SyscallDesc("pread", unimplementedFunc), /* 350 */ SyscallDesc("pwrite", unimplementedFunc), /* 351 */ SyscallDesc("rt_sigreturn", unimplementedFunc), - /* 352 */ SyscallDesc("rt_sigaction", unimplementedFunc), + /* 352 */ SyscallDesc("rt_sigaction", ignoreFunc), /* 353 */ SyscallDesc("rt_sigprocmask", unimplementedFunc), /* 354 */ SyscallDesc("rt_sigpending", unimplementedFunc), /* 355 */ SyscallDesc("rt_sigtimedwait", unimplementedFunc), diff --git a/arch/alpha/alpha_tru64_process.cc b/arch/alpha/alpha_tru64_process.cc index ccf4d4d6cc..2366baed89 100644 --- a/arch/alpha/alpha_tru64_process.cc +++ b/arch/alpha/alpha_tru64_process.cc @@ -171,6 +171,9 @@ class Tru64 { static const unsigned TIOCGETC = 0x40067412; static const unsigned FIONREAD = 0x4004667f; static const unsigned TIOCISATTY = 0x2000745e; + // TIOCGETS not defined in tru64, so I made up a number + static const unsigned TIOCGETS = 0x40000000; + static const unsigned TIOCGETA = 0x402c7413; //@} /// Resource enumeration for getrlimit(). @@ -1356,7 +1359,7 @@ SyscallDesc Tru64::syscallDescs[] = { /* 7 */ SyscallDesc("wait4", unimplementedFunc), /* 8 */ SyscallDesc("old_creat", unimplementedFunc), /* 9 */ SyscallDesc("link", unimplementedFunc), - /* 10 */ SyscallDesc("unlink", unimplementedFunc), + /* 10 */ SyscallDesc("unlink", unlinkFunc), /* 11 */ SyscallDesc("execv", unimplementedFunc), /* 12 */ SyscallDesc("chdir", unimplementedFunc), /* 13 */ SyscallDesc("fchdir", unimplementedFunc), @@ -1475,7 +1478,7 @@ SyscallDesc Tru64::syscallDescs[] = { /* 125 */ SyscallDesc("old_recvfrom", unimplementedFunc), /* 126 */ SyscallDesc("setreuid", unimplementedFunc), /* 127 */ SyscallDesc("setregid", unimplementedFunc), - /* 128 */ SyscallDesc("rename", unimplementedFunc), + /* 128 */ SyscallDesc("rename", renameFunc), /* 129 */ SyscallDesc("truncate", unimplementedFunc), /* 130 */ SyscallDesc("ftruncate", unimplementedFunc), /* 131 */ SyscallDesc("flock", unimplementedFunc), @@ -1492,7 +1495,7 @@ SyscallDesc Tru64::syscallDescs[] = { /* 142 */ SyscallDesc("gethostid", unimplementedFunc), /* 143 */ SyscallDesc("sethostid", unimplementedFunc), /* 144 */ SyscallDesc("getrlimit", getrlimitFunc), - /* 145 */ SyscallDesc("setrlimit", unimplementedFunc), + /* 145 */ SyscallDesc("setrlimit", ignoreFunc), /* 146 */ SyscallDesc("old_killpg", unimplementedFunc), /* 147 */ SyscallDesc("setsid", unimplementedFunc), /* 148 */ SyscallDesc("quotactl", unimplementedFunc), diff --git a/sim/syscall_emul.cc b/sim/syscall_emul.cc index 9955d44219..e953a73080 100644 --- a/sim/syscall_emul.cc +++ b/sim/syscall_emul.cc @@ -185,4 +185,32 @@ gethostnameFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc) return 0; } +int +unlinkFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc) +{ + std::string path; + + if (xc->mem->readString(path, xc->getSyscallArg(0)) != No_Fault) + return -EFAULT; + + int result = unlink(path.c_str()); + return (result == -1) ? -errno : result; +} + +int +renameFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc) +{ + std::string old_name; + + if (xc->mem->readString(old_name, xc->getSyscallArg(0)) != No_Fault) + return -EFAULT; + + std::string new_name; + + if (xc->mem->readString(new_name, xc->getSyscallArg(1)) != No_Fault) + return -EFAULT; + + int result = rename(old_name.c_str(),new_name.c_str()); + return (result == -1) ? -errno : result; +} diff --git a/sim/syscall_emul.hh b/sim/syscall_emul.hh index df4038f71c..b425ef83c6 100644 --- a/sim/syscall_emul.hh +++ b/sim/syscall_emul.hh @@ -191,6 +191,12 @@ int munmapFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc); /// Target gethostname() handler. int gethostnameFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc); +/// Target unlink() handler. +int unlinkFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc); + +/// Target rename() handler. +int renameFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc); + ////////////////////////////////////////////////////////////////////// // // The following emulation functions are generic, but need to be @@ -223,10 +229,12 @@ ioctlFunc(SyscallDesc *desc, int callnum, Process *process, case OS::TIOCSETN: case OS::TIOCSETC: case OS::TIOCGETC: + case OS::TIOCGETS: + case OS::TIOCGETA: return -ENOTTY; default: - fatal("Unsupported ioctl call: ioctl(%d, 0x%x, ...)\n", fd, req); + fatal("Unsupported ioctl call: ioctl(%d, 0x%x, ...) @ 0x%llx\n", fd, req, xc->readPC()); } } From 8f0060b4aefc72ef9afa6aa6a79a36a234bdb1d7 Mon Sep 17 00:00:00 2001 From: Erik Hallnor Date: Fri, 6 Feb 2004 00:13:26 -0500 Subject: [PATCH 5/6] Various extraction of common code into separate functions to make life easier. --HG-- extra : convert_revision : ae303904e35975e65b4207f543ac93c9816e1f81 From 8a89f8c80722e68d2563e6823dbcff832b112397 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Fri, 6 Feb 2004 18:59:12 -0500 Subject: [PATCH 6/6] Small cleanup --HG-- extra : convert_revision : 92f6dbd3d2c4336a0f03a9da5c390a7980ca08be