Jason Lowe-Power has submitted this change and it was merged. ( https://gem5-review.googlesource.com/8902 )

Change subject: sim-se: Add /sys/devices/system/cpu/online file
......................................................................

sim-se: Add /sys/devices/system/cpu/online file

Add the special file /sys/devices/system/cpu/online to the files that gem5
knows how to handle in SE mode. This file lists the CPUs that are active.
For instance, in an 8 CPU system it is the following:
0-7

This implementation simply returns a file that is 0-%d where %d is the
current number of thread contexts.

This file is required for C++11 threads with gcc 4.8 and above.

Change-Id: I0b566f77e75e9eca480509814d0fd038a231b940
Signed-off-by: Jason Lowe-Power <ja...@lowepower.com>
Reviewed-on: https://gem5-review.googlesource.com/8902
Reviewed-by: Gabe Black <gabebl...@google.com>
Reviewed-by: Brandon Potter <brandon.pot...@amd.com>
Maintainer: Brandon Potter <brandon.pot...@amd.com>
---
M src/kern/linux/linux.cc
M src/kern/linux/linux.hh
2 files changed, 11 insertions(+), 0 deletions(-)

Approvals:
  Brandon Potter: Looks good to me, approved; Looks good to me, approved
  Gabe Black: Looks good to me, but someone else must approve



diff --git a/src/kern/linux/linux.cc b/src/kern/linux/linux.cc
index bd0b4d0..d571b81 100644
--- a/src/kern/linux/linux.cc
+++ b/src/kern/linux/linux.cc
@@ -55,6 +55,9 @@
     } 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) {
@@ -87,3 +90,10 @@
     return csprintf("gem5-user:x:1000:1000:gem5-user,,,:%s:/bin/bash\n",
                     process->getcwd());
 }
+
+std::string
+Linux::cpuOnline(Process *process, ThreadContext *tc)
+{
+    return csprintf("0-%d\n",
+                    tc->getSystemPtr()->numContexts() - 1);
+}
diff --git a/src/kern/linux/linux.hh b/src/kern/linux/linux.hh
index b24ee38..a1df994 100644
--- a/src/kern/linux/linux.hh
+++ b/src/kern/linux/linux.hh
@@ -227,6 +227,7 @@
                                ThreadContext *tc);
     static std::string procMeminfo(Process *process, ThreadContext *tc);
     static std::string etcPasswd(Process *process, ThreadContext *tc);
+    static std::string cpuOnline(Process *process, ThreadContext *tc);

     // For futex system call
     static const unsigned TGT_FUTEX_WAIT  = 0;

--
To view, visit https://gem5-review.googlesource.com/8902
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I0b566f77e75e9eca480509814d0fd038a231b940
Gerrit-Change-Number: 8902
Gerrit-PatchSet: 2
Gerrit-Owner: Jason Lowe-Power <ja...@lowepower.com>
Gerrit-Reviewer: Brandon Potter <brandon.pot...@amd.com>
Gerrit-Reviewer: Gabe Black <gabebl...@google.com>
Gerrit-Reviewer: Jason Lowe-Power <ja...@lowepower.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to