From 9da405ce969bb3277ae9cd88e1b6c8897aa9c540 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Mon, 13 Sep 2021 16:15:46 -0700 Subject: [PATCH] sim: Set up an SEWorkload pointer in the base Process class. This will make it easier for the process object to access shared SE level functionality and info. Change-Id: I2cbddcabdf7264fde492b0566791d909ce2b10be Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/50341 Reviewed-by: Matthew Poremba Maintainer: Gabe Black Tested-by: kokoro --- src/sim/process.cc | 9 +++++---- src/sim/process.hh | 3 +++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/sim/process.cc b/src/sim/process.cc index 8d0a2af147..8be5940039 100644 --- a/src/sim/process.cc +++ b/src/sim/process.cc @@ -63,6 +63,7 @@ #include "sim/fd_array.hh" #include "sim/fd_entry.hh" #include "sim/redirect_path.hh" +#include "sim/se_workload.hh" #include "sim/syscall_desc.hh" #include "sim/system.hh" @@ -112,6 +113,7 @@ normalize(const std::string& directory) Process::Process(const ProcessParams ¶ms, EmulationPageTable *pTable, loader::ObjectFile *obj_file) : SimObject(params), system(params.system), + seWorkload(dynamic_cast(system->workload)), useArchPT(params.useArchPT), kvmInSE(params.kvmInSE), useForClone(false), @@ -132,12 +134,11 @@ Process::Process(const ProcessParams ¶ms, EmulationPageTable *pTable, ADD_STAT(numSyscalls, statistics::units::Count::get(), "Number of system calls") { - if (_pid >= System::maxPID) - fatal("_pid is too large: %d", _pid); + fatal_if(!seWorkload, "Couldn't find appropriate workload object."); + fatal_if(_pid >= System::maxPID, "_pid is too large: %d", _pid); auto ret_pair = system->PIDs.emplace(_pid); - if (!ret_pair.second) - fatal("_pid %d is already used", _pid); + fatal_if(!ret_pair.second, "_pid %d is already used", _pid); /** * Linux bundles together processes into this concept called a thread diff --git a/src/sim/process.hh b/src/sim/process.hh index 34768a0d92..880b34bef7 100644 --- a/src/sim/process.hh +++ b/src/sim/process.hh @@ -59,6 +59,7 @@ struct ProcessParams; class EmulatedDriver; class EmulationPageTable; +class SEWorkload; class SyscallDesc; class SyscallReturn; class System; @@ -161,6 +162,8 @@ class Process : public SimObject // system object which owns this process System *system; + SEWorkload *seWorkload; + // flag for using architecture specific page table bool useArchPT; // running KVM requires special initialization