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 <jason@lowepower.com> Reviewed-on: https://gem5-review.googlesource.com/8902 Reviewed-by: Gabe Black <gabeblack@google.com> Reviewed-by: Brandon Potter <Brandon.Potter@amd.com> Maintainer: Brandon Potter <Brandon.Potter@amd.com>
This commit is contained in:
@@ -55,6 +55,9 @@ 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) {
|
||||
@@ -87,3 +90,10 @@ Linux::etcPasswd(Process *process, ThreadContext *tc)
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -227,6 +227,7 @@ class Linux : public OperatingSystem
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user