summaryrefslogtreecommitdiff
path: root/src/gpu-compute
diff options
context:
space:
mode:
authorBrandon Potter <brandon.potter@amd.com>2016-11-09 14:27:42 -0600
committerBrandon Potter <brandon.potter@amd.com>2016-11-09 14:27:42 -0600
commitd3d983caf94375b992940b017aeb4a73da28833c (patch)
tree7e6bf4226c9235ad187c0137c6518b3897b64752 /src/gpu-compute
parent6c41181b8e39e776ea2f018bf383fed2782c3d4a (diff)
downloadgem5-d3d983caf94375b992940b017aeb4a73da28833c.tar.xz
syscall_emul: [patch 10/22] refactor fdentry and add fdarray class
Several large changes happen in this patch. The FDEntry class is rewritten so that file descriptors now correspond to types: 'File' which is normal file-backed file with the file open on the host machine, 'Pipe' which is a pipe that has been opened on the host machine, and 'Device' which does not have an open file on the host yet acts as a pseudo device with which to issue ioctls. Other types which might be added in the future are directory entries and sockets (off the top of my head). The FDArray class was create to hold most of the file descriptor handling that was stuffed into the Process class. It uses shared pointers and the std::array type to hold the FDEntries mentioned above. The changes to these two classes needed to be propagated out to the rest of the code so there were quite a few changes for that. Also, comments were added where I thought they were needed to help others and extend our DOxygen coverage.
Diffstat (limited to 'src/gpu-compute')
-rw-r--r--src/gpu-compute/cl_driver.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/gpu-compute/cl_driver.cc b/src/gpu-compute/cl_driver.cc
index 41ae3ab9a..119091fc5 100644
--- a/src/gpu-compute/cl_driver.cc
+++ b/src/gpu-compute/cl_driver.cc
@@ -35,6 +35,8 @@
#include "gpu-compute/cl_driver.hh"
+#include <memory>
+
#include "base/intmath.hh"
#include "cpu/thread_context.hh"
#include "gpu-compute/dispatcher.hh"
@@ -93,11 +95,10 @@ ClDriver::handshake(GpuDispatcher *_dispatcher)
int
ClDriver::open(Process *p, ThreadContext *tc, int mode, int flags)
{
- int fd = p->allocFD(-1, filename, 0, 0, false);
- FDEntry *fde = p->getFDEntry(fd);
- fde->driver = this;
-
- return fd;
+ std::shared_ptr<DeviceFDEntry> fdp;
+ fdp = std::make_shared<DeviceFDEntry>(this, filename);
+ int tgt_fd = p->fds->allocFD(fdp);
+ return tgt_fd;
}
int