sim-se: remove /sys from special paths
authorTony Gutierrez <anthony.gutierrez@amd.com>
Wed, 18 Apr 2018 22:25:23 +0000 (18:25 -0400)
committerBrandon Potter <Brandon.Potter@amd.com>
Tue, 21 May 2019 18:26:10 +0000 (18:26 +0000)
Currently, the open system call implementation in SE mode
treats /sys/ as a special path that is opened using a
special open handler. The ROC runtime, however, reads
several files in /sys/ that are supported via path
redirection. Here we remove /sys/ from the special files
so that the necessary files may be read via path
redirection.

Change-Id: Ifdab38ea1e6cc486ad43aec96b6e032fe63f137d
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/12127
Reviewed-by: Anthony Gutierrez <anthony.gutierrez@amd.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Anthony Gutierrez <anthony.gutierrez@amd.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/kern/linux/linux.cc
src/sim/syscall_emul.hh

index b71ab3079908290d9ef0af29b097caf4d266d284..e499776dcc027314e7068dc2f4c54068fb557d25 100644 (file)
@@ -55,9 +55,6 @@ Linux::openSpecialFile(std::string path, Process *process,
     } else if (path.compare(0, 11, "/etc/passwd") == 0) {
         data = Linux::etcPasswd(process, tc);
         matched = true;
-    } else if (path.compare(0, 30, "/sys/devices/system/cpu/online") == 0) {
-        data = Linux::cpuOnline(process, tc);
-        matched = true;
     }
 
     if (matched) {
@@ -90,10 +87,3 @@ Linux::etcPasswd(Process *process, ThreadContext *tc)
     return csprintf("gem5-user:x:1000:1000:gem5-user,,,:%s:/bin/bash\n",
                     process->tgtCwd);
 }
-
-std::string
-Linux::cpuOnline(Process *process, ThreadContext *tc)
-{
-    return csprintf("0-%d\n",
-                    tc->getSystemPtr()->numContexts() - 1);
-}
index caa4d2cf394f12da8c4e4e75ce074566ee3adb24..92fb8bf3e72f208459b665148d7b5ec5dc245ab9 100644 (file)
@@ -934,8 +934,7 @@ openImpl(SyscallDesc *desc, int callnum, Process *p, ThreadContext *tc,
     int sim_fd = -1;
     std::string used_path;
     std::vector<std::string> special_paths =
-            { "/proc/meminfo/", "/system/", "/sys/", "/platform/",
-              "/etc/passwd" };
+            { "/proc/meminfo/", "/system/", "/platform/", "/etc/passwd" };
     for (auto entry : special_paths) {
         if (startswith(path, entry)) {
             sim_fd = OS::openSpecialFile(abs_path, p, tc);