summaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
authorDavid Oehmke <doehmke@umich.edu>2004-02-05 12:16:17 -0500
committerDavid Oehmke <doehmke@umich.edu>2004-02-05 12:16:17 -0500
commit95c248c2139ff8d3568e1c92319727777f19920f (patch)
tree97497d04270a5288a02ea8576aa220ed90fced52 /sim
parent98948b2e572d10faf1ac91f977837cf2e8a903c3 (diff)
downloadgem5-95c248c2139ff8d3568e1c92319727777f19920f.tar.xz
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
Diffstat (limited to 'sim')
-rw-r--r--sim/syscall_emul.cc28
-rw-r--r--sim/syscall_emul.hh10
2 files changed, 37 insertions, 1 deletions
diff --git a/sim/syscall_emul.cc b/sim/syscall_emul.cc
index 9955d4421..e953a7308 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 df4038f71..b425ef83c 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());
}
}