summaryrefslogtreecommitdiff
path: root/src/sim/syscall_emul.hh
diff options
context:
space:
mode:
authorBrandon Potter <brandon.potter@amd.com>2015-07-24 12:25:22 -0700
committerBrandon Potter <brandon.potter@amd.com>2015-07-24 12:25:22 -0700
commitb90711ea53f51d85890dd6e1bed0ca852adb8074 (patch)
treeeded5a2ba8f4b283271f1ee4c7deb508f3b42cac /src/sim/syscall_emul.hh
parentef08046af413e2dc19cf7e8e1a3a329cc3c05bec (diff)
downloadgem5-b90711ea53f51d85890dd6e1bed0ca852adb8074.tar.xz
base: refactor process class (specifically FdMap and friends)
This patch extends the previous patch's alterations around fd_map. It cleans up some of the uglier code in the process file and replaces it with a more concise C++11 version. As part of the changes, the FdMap class is pulled out of the Process class and receives its own file.
Diffstat (limited to 'src/sim/syscall_emul.hh')
-rw-r--r--src/sim/syscall_emul.hh22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
index 07b910727..b942cb601 100644
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -553,20 +553,20 @@ ioctlFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
int index = 0;
- int fd = process->getSyscallArg(tc, index);
+ int tgt_fd = process->getSyscallArg(tc, index);
unsigned req = process->getSyscallArg(tc, index);
- DPRINTF(SyscallVerbose, "ioctl(%d, 0x%x, ...)\n", fd, req);
+ DPRINTF(SyscallVerbose, "ioctl(%d, 0x%x, ...)\n", tgt_fd, req);
- Process::FdMap *fdObj = process->sim_fd_obj(fd);
+ FDEntry *fde = process->get_fd_entry(tgt_fd);
- if (fdObj == NULL) {
+ if (fde == NULL) {
// doesn't map to any simulator fd: not a valid target fd
return -EBADF;
}
- if (fdObj->driver != NULL) {
- return fdObj->driver->ioctl(process, tc, req);
+ if (fde->driver != NULL) {
+ return fde->driver->ioctl(process, tc, req);
}
if (OS::isTtyReq(req)) {
@@ -574,7 +574,7 @@ ioctlFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
}
warn("Unsupported ioctl call: ioctl(%d, 0x%x, ...) @ \n",
- fd, req, tc->pcState());
+ tgt_fd, req, tc->pcState());
return -ENOTTY;
}
@@ -1235,18 +1235,18 @@ mmapFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
warn("mmap length argument %#x is unreasonably large.\n", length);
if (!(flags & OS::TGT_MAP_ANONYMOUS)) {
- Process::FdMap *fd_map = p->sim_fd_obj(tgt_fd);
- if (!fd_map || fd_map->fd < 0) {
+ FDEntry *fde = p->get_fd_entry(tgt_fd);
+ if (!fde || fde->fd < 0) {
warn("mmap failing: target fd %d is not valid\n", tgt_fd);
return -EBADF;
}
- if (fd_map->filename != "/dev/zero") {
+ if (fde->filename != "/dev/zero") {
// This is very likely broken, but leave a warning here
// (rather than panic) in case /dev/zero is known by
// another name on some platform
warn("allowing mmap of file %s; mmap not supported on files"
- " other than /dev/zero\n", fd_map->filename);
+ " other than /dev/zero\n", fde->filename);
}
}