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 <matthew.poremba@amd.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Gabe Black
2021-09-13 16:15:46 -07:00
parent a024c9f19e
commit 9da405ce96
2 changed files with 8 additions and 4 deletions

View File

@@ -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 &params, EmulationPageTable *pTable,
loader::ObjectFile *obj_file)
: SimObject(params), system(params.system),
seWorkload(dynamic_cast<SEWorkload *>(system->workload)),
useArchPT(params.useArchPT),
kvmInSE(params.kvmInSE),
useForClone(false),
@@ -132,12 +134,11 @@ Process::Process(const ProcessParams &params, 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

View File

@@ -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