syscall_emul: [patch 5/22] remove LiveProcess class and use Process instead
The EIOProcess class was removed recently and it was the only other class which derived from Process. Since every Process invocation is also a LiveProcess invocation, it makes sense to simplify the organization by combining the fields from LiveProcess into Process.
This commit is contained in:
parent
7b6cf951e2
commit
3886c4a8f2
73 changed files with 582 additions and 644 deletions
|
@ -131,8 +131,8 @@ class Benchmark(object):
|
|||
|
||||
func(self, isa, os)
|
||||
|
||||
def makeLiveProcessArgs(self, **kwargs):
|
||||
# set up default args for LiveProcess object
|
||||
def makeProcessArgs(self, **kwargs):
|
||||
# set up default args for Process object
|
||||
process_args = {}
|
||||
process_args['cmd'] = [ self.name ] + self.args
|
||||
process_args['executable'] = self.executable
|
||||
|
@ -147,11 +147,11 @@ class Benchmark(object):
|
|||
|
||||
return process_args
|
||||
|
||||
def makeLiveProcess(self, **kwargs):
|
||||
process_args = self.makeLiveProcessArgs(**kwargs)
|
||||
def makeProcess(self, **kwargs):
|
||||
process_args = self.makeProcessArgs(**kwargs)
|
||||
|
||||
# figure out working directory: use m5's outdir unless
|
||||
# overridden by LiveProcess's cwd param
|
||||
# overridden by Process's cwd param
|
||||
cwd = process_args.get('cwd')
|
||||
|
||||
if not cwd:
|
||||
|
@ -163,9 +163,9 @@ class Benchmark(object):
|
|||
# copy input files to working directory
|
||||
for d in self.inputs_dir:
|
||||
copyfiles(d, cwd)
|
||||
# generate LiveProcess object
|
||||
from m5.objects import LiveProcess
|
||||
return LiveProcess(**process_args)
|
||||
# generate Process object
|
||||
from m5.objects import Process
|
||||
return Process(**process_args)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
@ -750,5 +750,5 @@ if __name__ == '__main__':
|
|||
print 'class: %s' % bench.__name__
|
||||
x = bench('alpha', 'tru64', input_set)
|
||||
print '%s: %s' % (x, input_set)
|
||||
pprint(x.makeLiveProcessArgs())
|
||||
pprint(x.makeProcessArgs())
|
||||
print
|
||||
|
|
|
@ -392,9 +392,9 @@ else:
|
|||
# OpenCL driver
|
||||
driver = ClDriver(filename="hsa", codefile=kernel_files)
|
||||
for cpu in cpu_list:
|
||||
cpu.workload = LiveProcess(executable = executable,
|
||||
cmd = [options.cmd] + options.options.split(),
|
||||
drivers = [driver])
|
||||
cpu.workload = Process(executable = executable,
|
||||
cmd = [options.cmd] + options.options.split(),
|
||||
drivers = [driver])
|
||||
for cp in cp_list:
|
||||
cp.workload = host_cpu.workload
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ def get_processes(options):
|
|||
|
||||
idx = 0
|
||||
for wrkld in workloads:
|
||||
process = LiveProcess()
|
||||
process = Process()
|
||||
process.executable = wrkld
|
||||
process.cwd = os.getcwd()
|
||||
|
||||
|
@ -154,7 +154,7 @@ if options.bench:
|
|||
else:
|
||||
exec("workload = %s(buildEnv['TARGET_ISA', 'linux', '%s')" % (
|
||||
app, options.spec_input))
|
||||
multiprocesses.append(workload.makeLiveProcess())
|
||||
multiprocesses.append(workload.makeProcess())
|
||||
except:
|
||||
print >>sys.stderr, "Unable to find workload for %s: %s" % (
|
||||
buildEnv['TARGET_ISA'], app)
|
||||
|
|
|
@ -89,7 +89,7 @@ isa = str(m5.defines.buildEnv['TARGET_ISA']).lower()
|
|||
binary = 'tests/test-progs/hello/bin/' + isa + '/linux/hello'
|
||||
|
||||
# Create a process for a simple "Hello World" application
|
||||
process = LiveProcess()
|
||||
process = Process()
|
||||
# Set the command
|
||||
# cmd is a list which begins with the executable (like argv)
|
||||
process.cmd = [binary]
|
||||
|
|
|
@ -133,7 +133,7 @@ system.mem_ctrl.range = system.mem_ranges[0]
|
|||
system.mem_ctrl.port = system.membus.master
|
||||
|
||||
# Create a process for a simple "Hello World" application
|
||||
process = LiveProcess()
|
||||
process = Process()
|
||||
# Set the command
|
||||
# cmd is a list which begins with the executable (like argv)
|
||||
process.cmd = [binary]
|
||||
|
|
|
@ -76,56 +76,56 @@ if args:
|
|||
# --------------------
|
||||
# Define Splash2 Benchmarks
|
||||
# ====================
|
||||
class Cholesky(LiveProcess):
|
||||
class Cholesky(Process):
|
||||
executable = options.rootdir + '/kernels/cholesky/CHOLESKY'
|
||||
cmd = 'CHOLESKY -p' + str(options.numcpus) + ' '\
|
||||
+ options.rootdir + '/kernels/cholesky/inputs/tk23.O'
|
||||
|
||||
class FFT(LiveProcess):
|
||||
class FFT(Process):
|
||||
executable = options.rootdir + 'kernels/fft/FFT'
|
||||
cmd = 'FFT -p' + str(options.numcpus) + ' -m18'
|
||||
|
||||
class LU_contig(LiveProcess):
|
||||
class LU_contig(Process):
|
||||
executable = options.rootdir + 'kernels/lu/contiguous_blocks/LU'
|
||||
cmd = 'LU -p' + str(options.numcpus)
|
||||
|
||||
class LU_noncontig(LiveProcess):
|
||||
class LU_noncontig(Process):
|
||||
executable = options.rootdir + 'kernels/lu/non_contiguous_blocks/LU'
|
||||
cmd = 'LU -p' + str(options.numcpus)
|
||||
|
||||
class Radix(LiveProcess):
|
||||
class Radix(Process):
|
||||
executable = options.rootdir + 'kernels/radix/RADIX'
|
||||
cmd = 'RADIX -n524288 -p' + str(options.numcpus)
|
||||
|
||||
class Barnes(LiveProcess):
|
||||
class Barnes(Process):
|
||||
executable = options.rootdir + 'apps/barnes/BARNES'
|
||||
cmd = 'BARNES'
|
||||
input = options.rootdir + 'apps/barnes/input.p' + str(options.numcpus)
|
||||
|
||||
class FMM(LiveProcess):
|
||||
class FMM(Process):
|
||||
executable = options.rootdir + 'apps/fmm/FMM'
|
||||
cmd = 'FMM'
|
||||
input = options.rootdir + 'apps/fmm/inputs/input.2048.p' + str(options.numcpus)
|
||||
|
||||
class Ocean_contig(LiveProcess):
|
||||
class Ocean_contig(Process):
|
||||
executable = options.rootdir + 'apps/ocean/contiguous_partitions/OCEAN'
|
||||
cmd = 'OCEAN -p' + str(options.numcpus)
|
||||
|
||||
class Ocean_noncontig(LiveProcess):
|
||||
class Ocean_noncontig(Process):
|
||||
executable = options.rootdir + 'apps/ocean/non_contiguous_partitions/OCEAN'
|
||||
cmd = 'OCEAN -p' + str(options.numcpus)
|
||||
|
||||
class Raytrace(LiveProcess):
|
||||
class Raytrace(Process):
|
||||
executable = options.rootdir + 'apps/raytrace/RAYTRACE'
|
||||
cmd = 'RAYTRACE -p' + str(options.numcpus) + ' ' \
|
||||
+ options.rootdir + 'apps/raytrace/inputs/teapot.env'
|
||||
|
||||
class Water_nsquared(LiveProcess):
|
||||
class Water_nsquared(Process):
|
||||
executable = options.rootdir + 'apps/water-nsquared/WATER-NSQUARED'
|
||||
cmd = 'WATER-NSQUARED'
|
||||
input = options.rootdir + 'apps/water-nsquared/input.p' + str(options.numcpus)
|
||||
|
||||
class Water_spatial(LiveProcess):
|
||||
class Water_spatial(Process):
|
||||
executable = options.rootdir + 'apps/water-spatial/WATER-SPATIAL'
|
||||
cmd = 'WATER-SPATIAL'
|
||||
input = options.rootdir + 'apps/water-spatial/input.p' + str(options.numcpus)
|
||||
|
|
|
@ -77,39 +77,39 @@ if not options.numcpus:
|
|||
# --------------------
|
||||
# Define Splash2 Benchmarks
|
||||
# ====================
|
||||
class Cholesky(LiveProcess):
|
||||
class Cholesky(Process):
|
||||
cwd = options.rootdir + '/kernels/cholesky'
|
||||
executable = options.rootdir + '/kernels/cholesky/CHOLESKY'
|
||||
cmd = ['CHOLESKY', '-p' + str(options.numcpus),
|
||||
options.rootdir + '/kernels/cholesky/inputs/tk23.O']
|
||||
|
||||
class FFT(LiveProcess):
|
||||
class FFT(Process):
|
||||
cwd = options.rootdir + '/kernels/fft'
|
||||
executable = options.rootdir + '/kernels/fft/FFT'
|
||||
cmd = ['FFT', '-p', str(options.numcpus), '-m18']
|
||||
|
||||
class LU_contig(LiveProcess):
|
||||
class LU_contig(Process):
|
||||
executable = options.rootdir + '/kernels/lu/contiguous_blocks/LU'
|
||||
cmd = ['LU', '-p', str(options.numcpus)]
|
||||
cwd = options.rootdir + '/kernels/lu/contiguous_blocks'
|
||||
|
||||
class LU_noncontig(LiveProcess):
|
||||
class LU_noncontig(Process):
|
||||
executable = options.rootdir + '/kernels/lu/non_contiguous_blocks/LU'
|
||||
cmd = ['LU', '-p', str(options.numcpus)]
|
||||
cwd = options.rootdir + '/kernels/lu/non_contiguous_blocks'
|
||||
|
||||
class Radix(LiveProcess):
|
||||
class Radix(Process):
|
||||
executable = options.rootdir + '/kernels/radix/RADIX'
|
||||
cmd = ['RADIX', '-n524288', '-p', str(options.numcpus)]
|
||||
cwd = options.rootdir + '/kernels/radix'
|
||||
|
||||
class Barnes(LiveProcess):
|
||||
class Barnes(Process):
|
||||
executable = options.rootdir + '/apps/barnes/BARNES'
|
||||
cmd = ['BARNES']
|
||||
input = options.rootdir + '/apps/barnes/input.p' + str(options.numcpus)
|
||||
cwd = options.rootdir + '/apps/barnes'
|
||||
|
||||
class FMM(LiveProcess):
|
||||
class FMM(Process):
|
||||
executable = options.rootdir + '/apps/fmm/FMM'
|
||||
cmd = ['FMM']
|
||||
if str(options.numcpus) == '1':
|
||||
|
@ -118,23 +118,23 @@ class FMM(LiveProcess):
|
|||
input = options.rootdir + '/apps/fmm/inputs/input.2048.p' + str(options.numcpus)
|
||||
cwd = options.rootdir + '/apps/fmm'
|
||||
|
||||
class Ocean_contig(LiveProcess):
|
||||
class Ocean_contig(Process):
|
||||
executable = options.rootdir + '/apps/ocean/contiguous_partitions/OCEAN'
|
||||
cmd = ['OCEAN', '-p', str(options.numcpus)]
|
||||
cwd = options.rootdir + '/apps/ocean/contiguous_partitions'
|
||||
|
||||
class Ocean_noncontig(LiveProcess):
|
||||
class Ocean_noncontig(Process):
|
||||
executable = options.rootdir + '/apps/ocean/non_contiguous_partitions/OCEAN'
|
||||
cmd = ['OCEAN', '-p', str(options.numcpus)]
|
||||
cwd = options.rootdir + '/apps/ocean/non_contiguous_partitions'
|
||||
|
||||
class Raytrace(LiveProcess):
|
||||
class Raytrace(Process):
|
||||
executable = options.rootdir + '/apps/raytrace/RAYTRACE'
|
||||
cmd = ['RAYTRACE', '-p' + str(options.numcpus),
|
||||
options.rootdir + '/apps/raytrace/inputs/teapot.env']
|
||||
cwd = options.rootdir + '/apps/raytrace'
|
||||
|
||||
class Water_nsquared(LiveProcess):
|
||||
class Water_nsquared(Process):
|
||||
executable = options.rootdir + '/apps/water-nsquared/WATER-NSQUARED'
|
||||
cmd = ['WATER-NSQUARED']
|
||||
if options.numcpus==1:
|
||||
|
@ -143,7 +143,7 @@ class Water_nsquared(LiveProcess):
|
|||
input = options.rootdir + '/apps/water-nsquared/input.p' + str(options.numcpus)
|
||||
cwd = options.rootdir + '/apps/water-nsquared'
|
||||
|
||||
class Water_spatial(LiveProcess):
|
||||
class Water_spatial(Process):
|
||||
executable = options.rootdir + '/apps/water-spatial/WATER-SPATIAL'
|
||||
cmd = ['WATER-SPATIAL']
|
||||
if options.numcpus==1:
|
||||
|
|
|
@ -46,7 +46,7 @@ using namespace AlphaISA;
|
|||
|
||||
/// Target uname() handler.
|
||||
static SyscallReturn
|
||||
unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
unameFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
|
@ -66,7 +66,7 @@ unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
/// borrowed from Tru64, the subcases that get used appear to be
|
||||
/// different in practice from those used by Tru64 processes.
|
||||
static SyscallReturn
|
||||
osf_getsysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
osf_getsysinfoFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
|
@ -95,7 +95,7 @@ osf_getsysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
|
||||
/// Target osf_setsysinfo() handler.
|
||||
static SyscallReturn
|
||||
osf_setsysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
osf_setsysinfoFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
|
@ -572,9 +572,9 @@ SyscallDesc AlphaLinuxProcess::syscallDescs[] = {
|
|||
/* 441 */ SyscallDesc("keyctl", unimplementedFunc)
|
||||
};
|
||||
|
||||
AlphaLinuxProcess::AlphaLinuxProcess(LiveProcessParams * params,
|
||||
AlphaLinuxProcess::AlphaLinuxProcess(ProcessParams * params,
|
||||
ObjectFile *objFile)
|
||||
: AlphaLiveProcess(params, objFile),
|
||||
: AlphaProcess(params, objFile),
|
||||
Num_Syscall_Descs(sizeof(syscallDescs) / sizeof(SyscallDesc))
|
||||
{
|
||||
//init_regs->intRegFile[0] = 0;
|
||||
|
|
|
@ -36,11 +36,11 @@
|
|||
namespace AlphaISA {
|
||||
|
||||
/// A process with emulated Alpha/Linux syscalls.
|
||||
class AlphaLinuxProcess : public AlphaLiveProcess
|
||||
class AlphaLinuxProcess : public AlphaProcess
|
||||
{
|
||||
public:
|
||||
/// Constructor.
|
||||
AlphaLinuxProcess(LiveProcessParams * params, ObjectFile *objFile);
|
||||
AlphaLinuxProcess(ProcessParams * params, ObjectFile *objFile);
|
||||
|
||||
virtual SyscallDesc* getDesc(int callnum);
|
||||
|
||||
|
|
|
@ -46,9 +46,8 @@
|
|||
using namespace AlphaISA;
|
||||
using namespace std;
|
||||
|
||||
AlphaLiveProcess::AlphaLiveProcess(LiveProcessParams *params,
|
||||
ObjectFile *objFile)
|
||||
: LiveProcess(params, objFile)
|
||||
AlphaProcess::AlphaProcess(ProcessParams *params, ObjectFile *objFile)
|
||||
: Process(params, objFile)
|
||||
{
|
||||
brk_point = objFile->dataBase() + objFile->dataSize() + objFile->bssSize();
|
||||
brk_point = roundUp(brk_point, PageBytes);
|
||||
|
@ -67,7 +66,7 @@ AlphaLiveProcess::AlphaLiveProcess(LiveProcessParams *params,
|
|||
}
|
||||
|
||||
void
|
||||
AlphaLiveProcess::argsInit(int intSize, int pageSize)
|
||||
AlphaProcess::argsInit(int intSize, int pageSize)
|
||||
{
|
||||
// Patch the ld_bias for dynamic executables.
|
||||
updateBias();
|
||||
|
@ -176,7 +175,7 @@ AlphaLiveProcess::argsInit(int intSize, int pageSize)
|
|||
}
|
||||
|
||||
void
|
||||
AlphaLiveProcess::setupASNReg()
|
||||
AlphaProcess::setupASNReg()
|
||||
{
|
||||
ThreadContext *tc = system->getThreadContext(contextIds[0]);
|
||||
tc->setMiscRegNoEffect(IPR_DTB_ASN, _pid << 57);
|
||||
|
@ -184,9 +183,9 @@ AlphaLiveProcess::setupASNReg()
|
|||
|
||||
|
||||
void
|
||||
AlphaLiveProcess::loadState(CheckpointIn &cp)
|
||||
AlphaProcess::loadState(CheckpointIn &cp)
|
||||
{
|
||||
LiveProcess::loadState(cp);
|
||||
Process::loadState(cp);
|
||||
// need to set up ASN after unserialization since _pid value may
|
||||
// come from checkpoint
|
||||
setupASNReg();
|
||||
|
@ -194,13 +193,13 @@ AlphaLiveProcess::loadState(CheckpointIn &cp)
|
|||
|
||||
|
||||
void
|
||||
AlphaLiveProcess::initState()
|
||||
AlphaProcess::initState()
|
||||
{
|
||||
// need to set up ASN before further initialization since init
|
||||
// will involve writing to virtual memory addresses
|
||||
setupASNReg();
|
||||
|
||||
LiveProcess::initState();
|
||||
Process::initState();
|
||||
|
||||
argsInit(MachineBytes, PageBytes);
|
||||
|
||||
|
@ -214,22 +213,21 @@ AlphaLiveProcess::initState()
|
|||
}
|
||||
|
||||
AlphaISA::IntReg
|
||||
AlphaLiveProcess::getSyscallArg(ThreadContext *tc, int &i)
|
||||
AlphaProcess::getSyscallArg(ThreadContext *tc, int &i)
|
||||
{
|
||||
assert(i < 6);
|
||||
return tc->readIntReg(FirstArgumentReg + i++);
|
||||
}
|
||||
|
||||
void
|
||||
AlphaLiveProcess::setSyscallArg(ThreadContext *tc,
|
||||
int i, AlphaISA::IntReg val)
|
||||
AlphaProcess::setSyscallArg(ThreadContext *tc, int i, AlphaISA::IntReg val)
|
||||
{
|
||||
assert(i < 6);
|
||||
tc->setIntReg(FirstArgumentReg + i, val);
|
||||
}
|
||||
|
||||
void
|
||||
AlphaLiveProcess::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret)
|
||||
AlphaProcess::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret)
|
||||
{
|
||||
// check for error condition. Alpha syscall convention is to
|
||||
// indicate success/failure in reg a3 (r19) and put the
|
||||
|
|
|
@ -35,13 +35,13 @@
|
|||
#include "mem/page_table.hh"
|
||||
#include "sim/process.hh"
|
||||
|
||||
class AlphaLiveProcess : public LiveProcess
|
||||
class AlphaProcess : public Process
|
||||
{
|
||||
private:
|
||||
void setupASNReg();
|
||||
|
||||
protected:
|
||||
AlphaLiveProcess(LiveProcessParams *params, ObjectFile *objFile);
|
||||
AlphaProcess(ProcessParams *params, ObjectFile *objFile);
|
||||
|
||||
void loadState(CheckpointIn &cp) override;
|
||||
void initState() override;
|
||||
|
@ -51,12 +51,12 @@ class AlphaLiveProcess : public LiveProcess
|
|||
public:
|
||||
AlphaISA::IntReg getSyscallArg(ThreadContext *tc, int &i) override;
|
||||
/// Explicitly import the otherwise hidden getSyscallArg
|
||||
using LiveProcess::getSyscallArg;
|
||||
using Process::getSyscallArg;
|
||||
void setSyscallArg(ThreadContext *tc, int i, AlphaISA::IntReg val) override;
|
||||
void setSyscallReturn(ThreadContext *tc,
|
||||
SyscallReturn return_value) override;
|
||||
|
||||
// override default implementation in LiveProcess as the mmap
|
||||
// override default implementation in Process as the mmap
|
||||
// region for Alpha platforms grows upward
|
||||
virtual bool mmapGrowsDown() const override { return false; }
|
||||
};
|
||||
|
|
|
@ -53,7 +53,7 @@ using namespace std;
|
|||
using namespace ArmISA;
|
||||
|
||||
static SyscallReturn
|
||||
issetugidFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
issetugidFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
|
||||
|
@ -61,7 +61,7 @@ issetugidFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
}
|
||||
|
||||
static SyscallReturn
|
||||
sysctlFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
sysctlFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
|
@ -1206,9 +1206,9 @@ static SyscallDesc syscallDescs64[] = {
|
|||
/* 547 */ SyscallDesc("unused#547", unimplementedFunc),
|
||||
};
|
||||
|
||||
ArmFreebsdProcess32::ArmFreebsdProcess32(LiveProcessParams * params,
|
||||
ArmFreebsdProcess32::ArmFreebsdProcess32(ProcessParams * params,
|
||||
ObjectFile *objFile, ObjectFile::Arch _arch)
|
||||
: ArmLiveProcess32(params, objFile, _arch)
|
||||
: ArmProcess32(params, objFile, _arch)
|
||||
{
|
||||
SyscallTable table;
|
||||
|
||||
|
@ -1218,9 +1218,9 @@ ArmFreebsdProcess32::ArmFreebsdProcess32(LiveProcessParams * params,
|
|||
syscallTables.push_back(table);
|
||||
}
|
||||
|
||||
ArmFreebsdProcess64::ArmFreebsdProcess64(LiveProcessParams * params,
|
||||
ArmFreebsdProcess64::ArmFreebsdProcess64(ProcessParams * params,
|
||||
ObjectFile *objFile, ObjectFile::Arch _arch)
|
||||
: ArmLiveProcess64(params, objFile, _arch)
|
||||
: ArmProcess64(params, objFile, _arch)
|
||||
{
|
||||
SyscallTable table;
|
||||
|
||||
|
@ -1269,13 +1269,13 @@ ArmFreebsdProcess64::getDesc(int callnum)
|
|||
void
|
||||
ArmFreebsdProcess32::initState()
|
||||
{
|
||||
ArmLiveProcess32::initState();
|
||||
ArmProcess32::initState();
|
||||
// The 32 bit equivalent of the comm page would be set up here.
|
||||
}
|
||||
|
||||
void
|
||||
ArmFreebsdProcess64::initState()
|
||||
{
|
||||
ArmLiveProcess64::initState();
|
||||
ArmProcess64::initState();
|
||||
// The 64 bit equivalent of the comm page would be set up here.
|
||||
}
|
||||
|
|
|
@ -55,16 +55,16 @@ class ArmFreebsdProcessBits
|
|||
};
|
||||
|
||||
/// A process with emulated Arm/Freebsd syscalls.
|
||||
class ArmFreebsdProcess32 : public ArmLiveProcess32, public ArmFreebsdProcessBits
|
||||
class ArmFreebsdProcess32 : public ArmProcess32, public ArmFreebsdProcessBits
|
||||
{
|
||||
public:
|
||||
ArmFreebsdProcess32(LiveProcessParams * params, ObjectFile *objFile,
|
||||
ObjectFile::Arch _arch);
|
||||
ArmFreebsdProcess32(ProcessParams * params, ObjectFile *objFile,
|
||||
ObjectFile::Arch _arch);
|
||||
|
||||
void initState();
|
||||
|
||||
/// Explicitly import the otherwise hidden getSyscallArg
|
||||
using ArmLiveProcess::getSyscallArg;
|
||||
using ArmProcess::getSyscallArg;
|
||||
|
||||
/// A page to hold "kernel" provided functions. The name might be wrong.
|
||||
static const Addr commPage;
|
||||
|
@ -73,11 +73,11 @@ class ArmFreebsdProcess32 : public ArmLiveProcess32, public ArmFreebsdProcessBit
|
|||
};
|
||||
|
||||
/// A process with emulated Arm/Freebsd syscalls.
|
||||
class ArmFreebsdProcess64 : public ArmLiveProcess64, public ArmFreebsdProcessBits
|
||||
class ArmFreebsdProcess64 : public ArmProcess64, public ArmFreebsdProcessBits
|
||||
{
|
||||
public:
|
||||
ArmFreebsdProcess64(LiveProcessParams * params, ObjectFile *objFile,
|
||||
ObjectFile::Arch _arch);
|
||||
ArmFreebsdProcess64(ProcessParams * params, ObjectFile *objFile,
|
||||
ObjectFile::Arch _arch);
|
||||
|
||||
void initState();
|
||||
SyscallDesc* getDesc(int callnum);
|
||||
|
|
|
@ -61,7 +61,7 @@ using namespace ArmISA;
|
|||
|
||||
/// Target uname() handler.
|
||||
static SyscallReturn
|
||||
unameFunc32(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
unameFunc32(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
|
@ -79,7 +79,7 @@ unameFunc32(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
|
||||
/// Target uname() handler.
|
||||
static SyscallReturn
|
||||
unameFunc64(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
unameFunc64(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
|
@ -97,7 +97,7 @@ unameFunc64(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
|
||||
/// Target set_tls() handler.
|
||||
static SyscallReturn
|
||||
setTLSFunc32(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
setTLSFunc32(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
|
@ -110,7 +110,7 @@ setTLSFunc32(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
}
|
||||
|
||||
static SyscallReturn
|
||||
setTLSFunc64(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
setTLSFunc64(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
|
@ -1589,9 +1589,9 @@ static SyscallDesc privSyscallDescs64[] = {
|
|||
/* 5 */ SyscallDesc("set_tls", setTLSFunc64)
|
||||
};
|
||||
|
||||
ArmLinuxProcess32::ArmLinuxProcess32(LiveProcessParams * params,
|
||||
ArmLinuxProcess32::ArmLinuxProcess32(ProcessParams * params,
|
||||
ObjectFile *objFile, ObjectFile::Arch _arch)
|
||||
: ArmLiveProcess32(params, objFile, _arch)
|
||||
: ArmProcess32(params, objFile, _arch)
|
||||
{
|
||||
SyscallTable table;
|
||||
|
||||
|
@ -1608,9 +1608,9 @@ ArmLinuxProcess32::ArmLinuxProcess32(LiveProcessParams * params,
|
|||
syscallTables.push_back(table);
|
||||
}
|
||||
|
||||
ArmLinuxProcess64::ArmLinuxProcess64(LiveProcessParams * params,
|
||||
ArmLinuxProcess64::ArmLinuxProcess64(ProcessParams * params,
|
||||
ObjectFile *objFile, ObjectFile::Arch _arch)
|
||||
: ArmLiveProcess64(params, objFile, _arch)
|
||||
: ArmProcess64(params, objFile, _arch)
|
||||
{
|
||||
SyscallTable table;
|
||||
|
||||
|
@ -1667,7 +1667,7 @@ ArmLinuxProcess64::getDesc(int callnum)
|
|||
void
|
||||
ArmLinuxProcess32::initState()
|
||||
{
|
||||
ArmLiveProcess32::initState();
|
||||
ArmProcess32::initState();
|
||||
allocateMem(commPage, PageBytes);
|
||||
ThreadContext *tc = system->getThreadContext(contextIds[0]);
|
||||
|
||||
|
@ -1714,6 +1714,6 @@ ArmLinuxProcess32::initState()
|
|||
void
|
||||
ArmLinuxProcess64::initState()
|
||||
{
|
||||
ArmLiveProcess64::initState();
|
||||
ArmProcess64::initState();
|
||||
// The 64 bit equivalent of the comm page would be set up here.
|
||||
}
|
||||
|
|
|
@ -65,16 +65,16 @@ class ArmLinuxProcessBits
|
|||
};
|
||||
|
||||
/// A process with emulated Arm/Linux syscalls.
|
||||
class ArmLinuxProcess32 : public ArmLiveProcess32, public ArmLinuxProcessBits
|
||||
class ArmLinuxProcess32 : public ArmProcess32, public ArmLinuxProcessBits
|
||||
{
|
||||
public:
|
||||
ArmLinuxProcess32(LiveProcessParams * params, ObjectFile *objFile,
|
||||
ArmLinuxProcess32(ProcessParams * params, ObjectFile *objFile,
|
||||
ObjectFile::Arch _arch);
|
||||
|
||||
void initState();
|
||||
|
||||
/// Explicitly import the otherwise hidden getSyscallArg
|
||||
using ArmLiveProcess::getSyscallArg;
|
||||
using ArmProcess::getSyscallArg;
|
||||
|
||||
/// A page to hold "kernel" provided functions. The name might be wrong.
|
||||
static const Addr commPage;
|
||||
|
@ -83,10 +83,10 @@ class ArmLinuxProcess32 : public ArmLiveProcess32, public ArmLinuxProcessBits
|
|||
};
|
||||
|
||||
/// A process with emulated Arm/Linux syscalls.
|
||||
class ArmLinuxProcess64 : public ArmLiveProcess64, public ArmLinuxProcessBits
|
||||
class ArmLinuxProcess64 : public ArmProcess64, public ArmLinuxProcessBits
|
||||
{
|
||||
public:
|
||||
ArmLinuxProcess64(LiveProcessParams * params, ObjectFile *objFile,
|
||||
ArmLinuxProcess64(ProcessParams * params, ObjectFile *objFile,
|
||||
ObjectFile::Arch _arch);
|
||||
|
||||
void initState();
|
||||
|
|
|
@ -59,15 +59,15 @@
|
|||
using namespace std;
|
||||
using namespace ArmISA;
|
||||
|
||||
ArmLiveProcess::ArmLiveProcess(LiveProcessParams *params, ObjectFile *objFile,
|
||||
ObjectFile::Arch _arch)
|
||||
: LiveProcess(params, objFile), arch(_arch)
|
||||
ArmProcess::ArmProcess(ProcessParams *params, ObjectFile *objFile,
|
||||
ObjectFile::Arch _arch)
|
||||
: Process(params, objFile), arch(_arch)
|
||||
{
|
||||
}
|
||||
|
||||
ArmLiveProcess32::ArmLiveProcess32(LiveProcessParams *params,
|
||||
ObjectFile *objFile, ObjectFile::Arch _arch)
|
||||
: ArmLiveProcess(params, objFile, _arch)
|
||||
ArmProcess32::ArmProcess32(ProcessParams *params, ObjectFile *objFile,
|
||||
ObjectFile::Arch _arch)
|
||||
: ArmProcess(params, objFile, _arch)
|
||||
{
|
||||
stack_base = 0xbf000000L;
|
||||
|
||||
|
@ -82,9 +82,9 @@ ArmLiveProcess32::ArmLiveProcess32(LiveProcessParams *params,
|
|||
mmap_end = 0x40000000L;
|
||||
}
|
||||
|
||||
ArmLiveProcess64::ArmLiveProcess64(LiveProcessParams *params,
|
||||
ObjectFile *objFile, ObjectFile::Arch _arch)
|
||||
: ArmLiveProcess(params, objFile, _arch)
|
||||
ArmProcess64::ArmProcess64(ProcessParams *params, ObjectFile *objFile,
|
||||
ObjectFile::Arch _arch)
|
||||
: ArmProcess(params, objFile, _arch)
|
||||
{
|
||||
stack_base = 0x7fffff0000L;
|
||||
|
||||
|
@ -100,9 +100,9 @@ ArmLiveProcess64::ArmLiveProcess64(LiveProcessParams *params,
|
|||
}
|
||||
|
||||
void
|
||||
ArmLiveProcess32::initState()
|
||||
ArmProcess32::initState()
|
||||
{
|
||||
LiveProcess::initState();
|
||||
Process::initState();
|
||||
argsInit<uint32_t>(PageBytes, INTREG_SP);
|
||||
for (int i = 0; i < contextIds.size(); i++) {
|
||||
ThreadContext * tc = system->getThreadContext(contextIds[i]);
|
||||
|
@ -119,9 +119,9 @@ ArmLiveProcess32::initState()
|
|||
}
|
||||
|
||||
void
|
||||
ArmLiveProcess64::initState()
|
||||
ArmProcess64::initState()
|
||||
{
|
||||
LiveProcess::initState();
|
||||
Process::initState();
|
||||
argsInit<uint64_t>(PageBytes, INTREG_SP0);
|
||||
for (int i = 0; i < contextIds.size(); i++) {
|
||||
ThreadContext * tc = system->getThreadContext(contextIds[i]);
|
||||
|
@ -142,7 +142,7 @@ ArmLiveProcess64::initState()
|
|||
|
||||
template <class IntType>
|
||||
void
|
||||
ArmLiveProcess::argsInit(int pageSize, IntRegIndex spIndex)
|
||||
ArmProcess::argsInit(int pageSize, IntRegIndex spIndex)
|
||||
{
|
||||
int intSize = sizeof(IntType);
|
||||
|
||||
|
@ -405,21 +405,21 @@ ArmLiveProcess::argsInit(int pageSize, IntRegIndex spIndex)
|
|||
}
|
||||
|
||||
ArmISA::IntReg
|
||||
ArmLiveProcess32::getSyscallArg(ThreadContext *tc, int &i)
|
||||
ArmProcess32::getSyscallArg(ThreadContext *tc, int &i)
|
||||
{
|
||||
assert(i < 6);
|
||||
return tc->readIntReg(ArgumentReg0 + i++);
|
||||
}
|
||||
|
||||
ArmISA::IntReg
|
||||
ArmLiveProcess64::getSyscallArg(ThreadContext *tc, int &i)
|
||||
ArmProcess64::getSyscallArg(ThreadContext *tc, int &i)
|
||||
{
|
||||
assert(i < 8);
|
||||
return tc->readIntReg(ArgumentReg0 + i++);
|
||||
}
|
||||
|
||||
ArmISA::IntReg
|
||||
ArmLiveProcess32::getSyscallArg(ThreadContext *tc, int &i, int width)
|
||||
ArmProcess32::getSyscallArg(ThreadContext *tc, int &i, int width)
|
||||
{
|
||||
assert(width == 32 || width == 64);
|
||||
if (width == 32)
|
||||
|
@ -438,29 +438,28 @@ ArmLiveProcess32::getSyscallArg(ThreadContext *tc, int &i, int width)
|
|||
}
|
||||
|
||||
ArmISA::IntReg
|
||||
ArmLiveProcess64::getSyscallArg(ThreadContext *tc, int &i, int width)
|
||||
ArmProcess64::getSyscallArg(ThreadContext *tc, int &i, int width)
|
||||
{
|
||||
return getSyscallArg(tc, i);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ArmLiveProcess32::setSyscallArg(ThreadContext *tc, int i, ArmISA::IntReg val)
|
||||
ArmProcess32::setSyscallArg(ThreadContext *tc, int i, ArmISA::IntReg val)
|
||||
{
|
||||
assert(i < 6);
|
||||
tc->setIntReg(ArgumentReg0 + i, val);
|
||||
}
|
||||
|
||||
void
|
||||
ArmLiveProcess64::setSyscallArg(ThreadContext *tc,
|
||||
int i, ArmISA::IntReg val)
|
||||
ArmProcess64::setSyscallArg(ThreadContext *tc, int i, ArmISA::IntReg val)
|
||||
{
|
||||
assert(i < 8);
|
||||
tc->setIntReg(ArgumentReg0 + i, val);
|
||||
}
|
||||
|
||||
void
|
||||
ArmLiveProcess32::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret)
|
||||
ArmProcess32::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret)
|
||||
{
|
||||
|
||||
if (objFile->getOpSys() == ObjectFile::FreeBSD) {
|
||||
|
@ -477,7 +476,7 @@ ArmLiveProcess32::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret)
|
|||
}
|
||||
|
||||
void
|
||||
ArmLiveProcess64::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret)
|
||||
ArmProcess64::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret)
|
||||
{
|
||||
|
||||
if (objFile->getOpSys() == ObjectFile::FreeBSD) {
|
||||
|
|
|
@ -51,25 +51,23 @@
|
|||
#include "mem/page_table.hh"
|
||||
#include "sim/process.hh"
|
||||
|
||||
class LiveProcess;
|
||||
class ObjectFile;
|
||||
class System;
|
||||
|
||||
class ArmLiveProcess : public LiveProcess
|
||||
class ArmProcess : public Process
|
||||
{
|
||||
protected:
|
||||
ObjectFile::Arch arch;
|
||||
ArmLiveProcess(LiveProcessParams * params, ObjectFile *objFile,
|
||||
ObjectFile::Arch _arch);
|
||||
ArmProcess(ProcessParams * params, ObjectFile *objFile,
|
||||
ObjectFile::Arch _arch);
|
||||
template<class IntType>
|
||||
void argsInit(int pageSize, ArmISA::IntRegIndex spIndex);
|
||||
};
|
||||
|
||||
class ArmLiveProcess32 : public ArmLiveProcess
|
||||
class ArmProcess32 : public ArmProcess
|
||||
{
|
||||
protected:
|
||||
ArmLiveProcess32(LiveProcessParams * params, ObjectFile *objFile,
|
||||
ObjectFile::Arch _arch);
|
||||
ArmProcess32(ProcessParams * params, ObjectFile *objFile,
|
||||
ObjectFile::Arch _arch);
|
||||
|
||||
void initState();
|
||||
|
||||
|
@ -81,11 +79,11 @@ class ArmLiveProcess32 : public ArmLiveProcess
|
|||
void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value);
|
||||
};
|
||||
|
||||
class ArmLiveProcess64 : public ArmLiveProcess
|
||||
class ArmProcess64 : public ArmProcess
|
||||
{
|
||||
protected:
|
||||
ArmLiveProcess64(LiveProcessParams * params, ObjectFile *objFile,
|
||||
ObjectFile::Arch _arch);
|
||||
ArmProcess64(ProcessParams * params, ObjectFile *objFile,
|
||||
ObjectFile::Arch _arch);
|
||||
|
||||
void initState();
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ using namespace MipsISA;
|
|||
|
||||
/// Target uname() handler.
|
||||
static SyscallReturn
|
||||
unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
unameFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
|
@ -69,7 +69,7 @@ unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
/// borrowed from Tru64, the subcases that get used appear to be
|
||||
/// different in practice from those used by Tru64 processes.
|
||||
static SyscallReturn
|
||||
sys_getsysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
sys_getsysinfoFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
|
@ -98,7 +98,7 @@ sys_getsysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
|
||||
/// Target sys_setsysinfo() handler.
|
||||
static SyscallReturn
|
||||
sys_setsysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
sys_setsysinfoFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
|
@ -128,7 +128,7 @@ sys_setsysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
}
|
||||
|
||||
static SyscallReturn
|
||||
setThreadAreaFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
setThreadAreaFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
|
@ -460,10 +460,10 @@ SyscallDesc MipsLinuxProcess::syscallDescs[] = {
|
|||
/* 319 */ SyscallDesc("eventfd", unimplementedFunc)
|
||||
};
|
||||
|
||||
MipsLinuxProcess::MipsLinuxProcess(LiveProcessParams * params,
|
||||
ObjectFile *objFile)
|
||||
: MipsLiveProcess(params, objFile),
|
||||
Num_Syscall_Descs(sizeof(syscallDescs) / sizeof(SyscallDesc))
|
||||
MipsLinuxProcess::MipsLinuxProcess(ProcessParams * params,
|
||||
ObjectFile *objFile)
|
||||
: MipsProcess(params, objFile),
|
||||
Num_Syscall_Descs(sizeof(syscallDescs) / sizeof(SyscallDesc))
|
||||
{ }
|
||||
|
||||
SyscallDesc*
|
||||
|
|
|
@ -37,11 +37,11 @@
|
|||
#include "sim/eventq.hh"
|
||||
|
||||
/// A process with emulated Mips/Linux syscalls.
|
||||
class MipsLinuxProcess : public MipsLiveProcess
|
||||
class MipsLinuxProcess : public MipsProcess
|
||||
{
|
||||
public:
|
||||
/// Constructor.
|
||||
MipsLinuxProcess(LiveProcessParams * params, ObjectFile *objFile);
|
||||
MipsLinuxProcess(ProcessParams * params, ObjectFile *objFile);
|
||||
|
||||
virtual SyscallDesc* getDesc(int callnum);
|
||||
|
||||
|
|
|
@ -47,9 +47,8 @@
|
|||
using namespace std;
|
||||
using namespace MipsISA;
|
||||
|
||||
MipsLiveProcess::MipsLiveProcess(LiveProcessParams * params,
|
||||
ObjectFile *objFile)
|
||||
: LiveProcess(params, objFile)
|
||||
MipsProcess::MipsProcess(ProcessParams * params, ObjectFile *objFile)
|
||||
: Process(params, objFile)
|
||||
{
|
||||
// Set up stack. On MIPS, stack starts at the top of kuseg
|
||||
// user address space. MIPS stack grows down from here
|
||||
|
@ -67,16 +66,16 @@ MipsLiveProcess::MipsLiveProcess(LiveProcessParams * params,
|
|||
}
|
||||
|
||||
void
|
||||
MipsLiveProcess::initState()
|
||||
MipsProcess::initState()
|
||||
{
|
||||
LiveProcess::initState();
|
||||
Process::initState();
|
||||
|
||||
argsInit<uint32_t>(PageBytes);
|
||||
}
|
||||
|
||||
template<class IntType>
|
||||
void
|
||||
MipsLiveProcess::argsInit(int pageSize)
|
||||
MipsProcess::argsInit(int pageSize)
|
||||
{
|
||||
int intSize = sizeof(IntType);
|
||||
|
||||
|
@ -191,22 +190,21 @@ MipsLiveProcess::argsInit(int pageSize)
|
|||
|
||||
|
||||
MipsISA::IntReg
|
||||
MipsLiveProcess::getSyscallArg(ThreadContext *tc, int &i)
|
||||
MipsProcess::getSyscallArg(ThreadContext *tc, int &i)
|
||||
{
|
||||
assert(i < 6);
|
||||
return tc->readIntReg(FirstArgumentReg + i++);
|
||||
}
|
||||
|
||||
void
|
||||
MipsLiveProcess::setSyscallArg(ThreadContext *tc,
|
||||
int i, MipsISA::IntReg val)
|
||||
MipsProcess::setSyscallArg(ThreadContext *tc, int i, MipsISA::IntReg val)
|
||||
{
|
||||
assert(i < 6);
|
||||
tc->setIntReg(FirstArgumentReg + i, val);
|
||||
}
|
||||
|
||||
void
|
||||
MipsLiveProcess::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret)
|
||||
MipsProcess::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret)
|
||||
{
|
||||
if (sysret.successful()) {
|
||||
// no error
|
||||
|
|
|
@ -38,14 +38,12 @@
|
|||
#include "mem/page_table.hh"
|
||||
#include "sim/process.hh"
|
||||
|
||||
class LiveProcess;
|
||||
class ObjectFile;
|
||||
class System;
|
||||
|
||||
class MipsLiveProcess : public LiveProcess
|
||||
class MipsProcess : public Process
|
||||
{
|
||||
protected:
|
||||
MipsLiveProcess(LiveProcessParams * params, ObjectFile *objFile);
|
||||
MipsProcess(ProcessParams * params, ObjectFile *objFile);
|
||||
|
||||
void initState();
|
||||
|
||||
|
@ -55,7 +53,7 @@ class MipsLiveProcess : public LiveProcess
|
|||
public:
|
||||
MipsISA::IntReg getSyscallArg(ThreadContext *tc, int &i);
|
||||
/// Explicitly import the otherwise hidden getSyscallArg
|
||||
using LiveProcess::getSyscallArg;
|
||||
using Process::getSyscallArg;
|
||||
void setSyscallArg(ThreadContext *tc, int i, MipsISA::IntReg val);
|
||||
void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value);
|
||||
};
|
||||
|
|
|
@ -49,7 +49,7 @@ using namespace PowerISA;
|
|||
|
||||
/// Target uname() handler.
|
||||
static SyscallReturn
|
||||
unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
unameFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
|
@ -415,10 +415,10 @@ SyscallDesc PowerLinuxProcess::syscallDescs[] = {
|
|||
/* 346 */ SyscallDesc("epoll_pwait", unimplementedFunc),
|
||||
};
|
||||
|
||||
PowerLinuxProcess::PowerLinuxProcess(LiveProcessParams * params,
|
||||
PowerLinuxProcess::PowerLinuxProcess(ProcessParams * params,
|
||||
ObjectFile *objFile)
|
||||
: PowerLiveProcess(params, objFile),
|
||||
Num_Syscall_Descs(sizeof(syscallDescs) / sizeof(SyscallDesc))
|
||||
: PowerProcess(params, objFile),
|
||||
Num_Syscall_Descs(sizeof(syscallDescs) / sizeof(SyscallDesc))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -434,7 +434,7 @@ PowerLinuxProcess::getDesc(int callnum)
|
|||
void
|
||||
PowerLinuxProcess::initState()
|
||||
{
|
||||
PowerLiveProcess::initState();
|
||||
PowerProcess::initState();
|
||||
}
|
||||
|
||||
PowerISA::IntReg
|
||||
|
|
|
@ -36,10 +36,10 @@
|
|||
#include "arch/power/process.hh"
|
||||
|
||||
/// A process with emulated PPC/Linux syscalls.
|
||||
class PowerLinuxProcess : public PowerLiveProcess
|
||||
class PowerLinuxProcess : public PowerProcess
|
||||
{
|
||||
public:
|
||||
PowerLinuxProcess(LiveProcessParams * params, ObjectFile *objFile);
|
||||
PowerLinuxProcess(ProcessParams * params, ObjectFile *objFile);
|
||||
|
||||
virtual SyscallDesc* getDesc(int callnum);
|
||||
|
||||
|
@ -47,7 +47,7 @@ class PowerLinuxProcess : public PowerLiveProcess
|
|||
|
||||
PowerISA::IntReg getSyscallArg(ThreadContext *tc, int &i);
|
||||
/// Explicitly import the otherwise hidden getSyscallArg
|
||||
using LiveProcess::getSyscallArg;
|
||||
using Process::getSyscallArg;
|
||||
void setSyscallArg(ThreadContext *tc, int i, PowerISA::IntReg val);
|
||||
|
||||
/// Array of syscall descriptors, indexed by call number.
|
||||
|
|
|
@ -47,9 +47,8 @@
|
|||
using namespace std;
|
||||
using namespace PowerISA;
|
||||
|
||||
PowerLiveProcess::PowerLiveProcess(LiveProcessParams *params,
|
||||
ObjectFile *objFile)
|
||||
: LiveProcess(params, objFile)
|
||||
PowerProcess::PowerProcess(ProcessParams *params, ObjectFile *objFile)
|
||||
: Process(params, objFile)
|
||||
{
|
||||
stack_base = 0xbf000000L;
|
||||
|
||||
|
@ -65,7 +64,7 @@ PowerLiveProcess::PowerLiveProcess(LiveProcessParams *params,
|
|||
}
|
||||
|
||||
void
|
||||
PowerLiveProcess::initState()
|
||||
PowerProcess::initState()
|
||||
{
|
||||
Process::initState();
|
||||
|
||||
|
@ -73,7 +72,7 @@ PowerLiveProcess::initState()
|
|||
}
|
||||
|
||||
void
|
||||
PowerLiveProcess::argsInit(int intSize, int pageSize)
|
||||
PowerProcess::argsInit(int intSize, int pageSize)
|
||||
{
|
||||
typedef AuxVector<uint32_t> auxv_t;
|
||||
std::vector<auxv_t> auxv;
|
||||
|
@ -266,22 +265,21 @@ PowerLiveProcess::argsInit(int intSize, int pageSize)
|
|||
}
|
||||
|
||||
PowerISA::IntReg
|
||||
PowerLiveProcess::getSyscallArg(ThreadContext *tc, int &i)
|
||||
PowerProcess::getSyscallArg(ThreadContext *tc, int &i)
|
||||
{
|
||||
assert(i < 5);
|
||||
return tc->readIntReg(ArgumentReg0 + i++);
|
||||
}
|
||||
|
||||
void
|
||||
PowerLiveProcess::setSyscallArg(ThreadContext *tc,
|
||||
int i, PowerISA::IntReg val)
|
||||
PowerProcess::setSyscallArg(ThreadContext *tc, int i, PowerISA::IntReg val)
|
||||
{
|
||||
assert(i < 5);
|
||||
tc->setIntReg(ArgumentReg0 + i, val);
|
||||
}
|
||||
|
||||
void
|
||||
PowerLiveProcess::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret)
|
||||
PowerProcess::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret)
|
||||
{
|
||||
Cr cr = tc->readIntReg(INTREG_CR);
|
||||
if (sysret.successful()) {
|
||||
|
|
|
@ -39,14 +39,12 @@
|
|||
#include "mem/page_table.hh"
|
||||
#include "sim/process.hh"
|
||||
|
||||
class LiveProcess;
|
||||
class ObjectFile;
|
||||
class System;
|
||||
|
||||
class PowerLiveProcess : public LiveProcess
|
||||
class PowerProcess : public Process
|
||||
{
|
||||
protected:
|
||||
PowerLiveProcess(LiveProcessParams * params, ObjectFile *objFile);
|
||||
PowerProcess(ProcessParams * params, ObjectFile *objFile);
|
||||
|
||||
void initState();
|
||||
|
||||
|
@ -54,7 +52,7 @@ class PowerLiveProcess : public LiveProcess
|
|||
void argsInit(int intSize, int pageSize);
|
||||
PowerISA::IntReg getSyscallArg(ThreadContext *tc, int &i);
|
||||
/// Explicitly import the otherwise hidden getSyscallArg
|
||||
using LiveProcess::getSyscallArg;
|
||||
using Process::getSyscallArg;
|
||||
void setSyscallArg(ThreadContext *tc, int i, PowerISA::IntReg val);
|
||||
void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value);
|
||||
};
|
||||
|
|
|
@ -53,7 +53,7 @@ using namespace RiscvISA;
|
|||
|
||||
/// Target uname() handler.
|
||||
static SyscallReturn
|
||||
unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
unameFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
|
@ -126,8 +126,8 @@ std::map<int, SyscallDesc> RiscvLinuxProcess::syscallDescs = {
|
|||
{2011, SyscallDesc("getmainvars", unimplementedFunc)},
|
||||
};
|
||||
|
||||
RiscvLinuxProcess::RiscvLinuxProcess(LiveProcessParams * params,
|
||||
ObjectFile *objFile) : RiscvLiveProcess(params, objFile)
|
||||
RiscvLinuxProcess::RiscvLinuxProcess(ProcessParams * params,
|
||||
ObjectFile *objFile) : RiscvProcess(params, objFile)
|
||||
{}
|
||||
|
||||
SyscallDesc*
|
||||
|
|
|
@ -41,11 +41,11 @@
|
|||
#include "sim/eventq.hh"
|
||||
|
||||
/// A process with emulated Riscv/Linux syscalls.
|
||||
class RiscvLinuxProcess : public RiscvLiveProcess
|
||||
class RiscvLinuxProcess : public RiscvProcess
|
||||
{
|
||||
public:
|
||||
/// Constructor.
|
||||
RiscvLinuxProcess(LiveProcessParams * params, ObjectFile *objFile);
|
||||
RiscvLinuxProcess(ProcessParams * params, ObjectFile *objFile);
|
||||
|
||||
virtual SyscallDesc* getDesc(int callnum);
|
||||
|
||||
|
|
|
@ -50,8 +50,8 @@
|
|||
using namespace std;
|
||||
using namespace RiscvISA;
|
||||
|
||||
RiscvLiveProcess::RiscvLiveProcess(LiveProcessParams * params,
|
||||
ObjectFile *objFile) : LiveProcess(params, objFile)
|
||||
RiscvProcess::RiscvProcess(ProcessParams * params,
|
||||
ObjectFile *objFile) : Process(params, objFile)
|
||||
{
|
||||
// Set up stack. On RISC-V, stack starts at the top of kuseg
|
||||
// user address space. RISC-V stack grows down from here
|
||||
|
@ -68,15 +68,15 @@ RiscvLiveProcess::RiscvLiveProcess(LiveProcessParams * params,
|
|||
}
|
||||
|
||||
void
|
||||
RiscvLiveProcess::initState()
|
||||
RiscvProcess::initState()
|
||||
{
|
||||
LiveProcess::initState();
|
||||
Process::initState();
|
||||
|
||||
argsInit<uint64_t>(PageBytes);
|
||||
}
|
||||
|
||||
template<class IntType> void
|
||||
RiscvLiveProcess::argsInit(int pageSize)
|
||||
RiscvProcess::argsInit(int pageSize)
|
||||
{
|
||||
updateBias();
|
||||
|
||||
|
@ -215,7 +215,7 @@ RiscvLiveProcess::argsInit(int pageSize)
|
|||
}
|
||||
|
||||
RiscvISA::IntReg
|
||||
RiscvLiveProcess::getSyscallArg(ThreadContext *tc, int &i)
|
||||
RiscvProcess::getSyscallArg(ThreadContext *tc, int &i)
|
||||
{
|
||||
// RISC-V only has four system call argument registers by convention, so
|
||||
// if a larger index is requested return 0
|
||||
|
@ -227,13 +227,13 @@ RiscvLiveProcess::getSyscallArg(ThreadContext *tc, int &i)
|
|||
}
|
||||
|
||||
void
|
||||
RiscvLiveProcess::setSyscallArg(ThreadContext *tc, int i, RiscvISA::IntReg val)
|
||||
RiscvProcess::setSyscallArg(ThreadContext *tc, int i, RiscvISA::IntReg val)
|
||||
{
|
||||
tc->setIntReg(SyscallArgumentRegs[i], val);
|
||||
}
|
||||
|
||||
void
|
||||
RiscvLiveProcess::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret)
|
||||
RiscvProcess::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret)
|
||||
{
|
||||
if (sysret.successful()) {
|
||||
// no error
|
||||
|
|
|
@ -38,14 +38,13 @@
|
|||
#include "mem/page_table.hh"
|
||||
#include "sim/process.hh"
|
||||
|
||||
class LiveProcess;
|
||||
class ObjectFile;
|
||||
class System;
|
||||
|
||||
class RiscvLiveProcess : public LiveProcess
|
||||
class RiscvProcess : public Process
|
||||
{
|
||||
protected:
|
||||
RiscvLiveProcess(LiveProcessParams * params, ObjectFile *objFile);
|
||||
RiscvProcess(ProcessParams * params, ObjectFile *objFile);
|
||||
|
||||
void initState();
|
||||
|
||||
|
@ -55,7 +54,7 @@ class RiscvLiveProcess : public LiveProcess
|
|||
public:
|
||||
RiscvISA::IntReg getSyscallArg(ThreadContext *tc, int &i);
|
||||
/// Explicitly import the otherwise hidden getSyscallArg
|
||||
using LiveProcess::getSyscallArg;
|
||||
using Process::getSyscallArg;
|
||||
void setSyscallArg(ThreadContext *tc, int i, RiscvISA::IntReg val);
|
||||
void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value);
|
||||
};
|
||||
|
|
|
@ -768,12 +768,11 @@ SpillNNormal::invoke(ThreadContext *tc, const StaticInstPtr &inst)
|
|||
|
||||
Process *p = tc->getProcessPtr();
|
||||
|
||||
//XXX This will only work in faults from a SparcLiveProcess
|
||||
SparcLiveProcess *lp = dynamic_cast<SparcLiveProcess *>(p);
|
||||
assert(lp);
|
||||
SparcProcess *sp = dynamic_cast<SparcProcess *>(p);
|
||||
assert(sp);
|
||||
|
||||
// Then adjust the PC and NPC
|
||||
tc->pcState(lp->readSpillStart());
|
||||
tc->pcState(sp->readSpillStart());
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -788,12 +787,11 @@ FillNNormal::invoke(ThreadContext *tc, const StaticInstPtr &inst)
|
|||
|
||||
Process *p = tc->getProcessPtr();
|
||||
|
||||
//XXX This will only work in faults from a SparcLiveProcess
|
||||
SparcLiveProcess *lp = dynamic_cast<SparcLiveProcess *>(p);
|
||||
assert(lp);
|
||||
SparcProcess *sp = dynamic_cast<SparcProcess *>(p);
|
||||
assert(sp);
|
||||
|
||||
// Then adjust the PC and NPC
|
||||
tc->pcState(lp->readFillStart());
|
||||
tc->pcState(sp->readFillStart());
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -810,10 +808,10 @@ TrapInstruction::invoke(ThreadContext *tc, const StaticInstPtr &inst)
|
|||
|
||||
Process *p = tc->getProcessPtr();
|
||||
|
||||
SparcLiveProcess *lp = dynamic_cast<SparcLiveProcess *>(p);
|
||||
assert(lp);
|
||||
SparcProcess *sp = dynamic_cast<SparcProcess *>(p);
|
||||
assert(sp);
|
||||
|
||||
lp->handleTrap(_n, tc);
|
||||
sp->handleTrap(_n, tc);
|
||||
|
||||
// We need to explicitly advance the pc, since that's not done for us
|
||||
// on a faulting instruction
|
||||
|
|
|
@ -60,9 +60,9 @@ SparcLinuxProcess::getDesc32(int callnum)
|
|||
return &syscall32Descs[callnum];
|
||||
}
|
||||
|
||||
Sparc32LinuxProcess::Sparc32LinuxProcess(LiveProcessParams * params,
|
||||
Sparc32LinuxProcess::Sparc32LinuxProcess(ProcessParams * params,
|
||||
ObjectFile *objFile)
|
||||
: Sparc32LiveProcess(params, objFile)
|
||||
: Sparc32Process(params, objFile)
|
||||
{}
|
||||
|
||||
void Sparc32LinuxProcess::handleTrap(int trapNum, ThreadContext *tc)
|
||||
|
@ -72,13 +72,13 @@ void Sparc32LinuxProcess::handleTrap(int trapNum, ThreadContext *tc)
|
|||
tc->syscall(tc->readIntReg(1));
|
||||
break;
|
||||
default:
|
||||
SparcLiveProcess::handleTrap(trapNum, tc);
|
||||
SparcProcess::handleTrap(trapNum, tc);
|
||||
}
|
||||
}
|
||||
|
||||
Sparc64LinuxProcess::Sparc64LinuxProcess(LiveProcessParams * params,
|
||||
Sparc64LinuxProcess::Sparc64LinuxProcess(ProcessParams * params,
|
||||
ObjectFile *objFile)
|
||||
: Sparc64LiveProcess(params, objFile)
|
||||
: Sparc64Process(params, objFile)
|
||||
{}
|
||||
|
||||
void Sparc64LinuxProcess::handleTrap(int trapNum, ThreadContext *tc)
|
||||
|
@ -89,6 +89,6 @@ void Sparc64LinuxProcess::handleTrap(int trapNum, ThreadContext *tc)
|
|||
tc->syscall(tc->readIntReg(1));
|
||||
break;
|
||||
default:
|
||||
SparcLiveProcess::handleTrap(trapNum, tc);
|
||||
SparcProcess::handleTrap(trapNum, tc);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,11 +58,11 @@ class SparcLinuxProcess
|
|||
};
|
||||
|
||||
/// A process with emulated SPARC/Linux syscalls.
|
||||
class Sparc32LinuxProcess : public SparcLinuxProcess, public Sparc32LiveProcess
|
||||
class Sparc32LinuxProcess : public SparcLinuxProcess, public Sparc32Process
|
||||
{
|
||||
public:
|
||||
/// Constructor.
|
||||
Sparc32LinuxProcess(LiveProcessParams * params, ObjectFile *objFile);
|
||||
Sparc32LinuxProcess(ProcessParams * params, ObjectFile *objFile);
|
||||
|
||||
SyscallDesc*
|
||||
getDesc(int callnum)
|
||||
|
@ -74,11 +74,11 @@ class Sparc32LinuxProcess : public SparcLinuxProcess, public Sparc32LiveProcess
|
|||
};
|
||||
|
||||
/// A process with emulated 32 bit SPARC/Linux syscalls.
|
||||
class Sparc64LinuxProcess : public SparcLinuxProcess, public Sparc64LiveProcess
|
||||
class Sparc64LinuxProcess : public SparcLinuxProcess, public Sparc64Process
|
||||
{
|
||||
public:
|
||||
/// Constructor.
|
||||
Sparc64LinuxProcess(LiveProcessParams * params, ObjectFile *objFile);
|
||||
Sparc64LinuxProcess(ProcessParams * params, ObjectFile *objFile);
|
||||
|
||||
SyscallDesc*
|
||||
getDesc(int callnum)
|
||||
|
@ -90,7 +90,7 @@ class Sparc64LinuxProcess : public SparcLinuxProcess, public Sparc64LiveProcess
|
|||
};
|
||||
|
||||
SyscallReturn getresuidFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
} // namespace SparcISA
|
||||
#endif // __SPARC_LINUX_PROCESS_HH__
|
||||
|
|
|
@ -32,15 +32,15 @@
|
|||
#include "sim/syscall_desc.hh"
|
||||
#include "sim/syscall_emul.hh"
|
||||
|
||||
class LiveProcess;
|
||||
class Process;
|
||||
class ThreadContext;
|
||||
|
||||
namespace SparcISA {
|
||||
|
||||
/// Target uname() handler.
|
||||
static SyscallReturn
|
||||
unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
ThreadContext *tc)
|
||||
unameFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
TypedBufferArg<Linux::utsname> name(process->getSyscallArg(tc, index));
|
||||
|
@ -58,7 +58,7 @@ unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
|
||||
|
||||
SyscallReturn
|
||||
getresuidFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
||||
getresuidFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
|
||||
{
|
||||
const IntReg id = htog(100);
|
||||
int index = 0;
|
||||
|
|
|
@ -52,9 +52,9 @@ using namespace SparcISA;
|
|||
static const int FirstArgumentReg = 8;
|
||||
|
||||
|
||||
SparcLiveProcess::SparcLiveProcess(LiveProcessParams * params,
|
||||
ObjectFile *objFile, Addr _StackBias)
|
||||
: LiveProcess(params, objFile), StackBias(_StackBias)
|
||||
SparcProcess::SparcProcess(ProcessParams * params, ObjectFile *objFile,
|
||||
Addr _StackBias)
|
||||
: Process(params, objFile), StackBias(_StackBias)
|
||||
{
|
||||
|
||||
// XXX all the below need to be updated for SPARC - Ali
|
||||
|
@ -70,7 +70,7 @@ SparcLiveProcess::SparcLiveProcess(LiveProcessParams * params,
|
|||
}
|
||||
|
||||
void
|
||||
SparcLiveProcess::handleTrap(int trapNum, ThreadContext *tc)
|
||||
SparcProcess::handleTrap(int trapNum, ThreadContext *tc)
|
||||
{
|
||||
PCState pc = tc->pcState();
|
||||
switch (trapNum) {
|
||||
|
@ -111,9 +111,9 @@ SparcLiveProcess::handleTrap(int trapNum, ThreadContext *tc)
|
|||
}
|
||||
|
||||
void
|
||||
SparcLiveProcess::initState()
|
||||
SparcProcess::initState()
|
||||
{
|
||||
LiveProcess::initState();
|
||||
Process::initState();
|
||||
|
||||
ThreadContext *tc = system->getThreadContext(contextIds[0]);
|
||||
// From the SPARC ABI
|
||||
|
@ -160,9 +160,9 @@ SparcLiveProcess::initState()
|
|||
}
|
||||
|
||||
void
|
||||
Sparc32LiveProcess::initState()
|
||||
Sparc32Process::initState()
|
||||
{
|
||||
SparcLiveProcess::initState();
|
||||
SparcProcess::initState();
|
||||
|
||||
ThreadContext *tc = system->getThreadContext(contextIds[0]);
|
||||
// The process runs in user mode with 32 bit addresses
|
||||
|
@ -175,9 +175,9 @@ Sparc32LiveProcess::initState()
|
|||
}
|
||||
|
||||
void
|
||||
Sparc64LiveProcess::initState()
|
||||
Sparc64Process::initState()
|
||||
{
|
||||
SparcLiveProcess::initState();
|
||||
SparcProcess::initState();
|
||||
|
||||
ThreadContext *tc = system->getThreadContext(contextIds[0]);
|
||||
// The process runs in user mode
|
||||
|
@ -190,7 +190,7 @@ Sparc64LiveProcess::initState()
|
|||
|
||||
template<class IntType>
|
||||
void
|
||||
SparcLiveProcess::argsInit(int pageSize)
|
||||
SparcProcess::argsInit(int pageSize)
|
||||
{
|
||||
int intSize = sizeof(IntType);
|
||||
|
||||
|
@ -419,9 +419,9 @@ SparcLiveProcess::argsInit(int pageSize)
|
|||
}
|
||||
|
||||
void
|
||||
Sparc64LiveProcess::argsInit(int intSize, int pageSize)
|
||||
Sparc64Process::argsInit(int intSize, int pageSize)
|
||||
{
|
||||
SparcLiveProcess::argsInit<uint64_t>(pageSize);
|
||||
SparcProcess::argsInit<uint64_t>(pageSize);
|
||||
|
||||
// Stuff the trap handlers into the process address space
|
||||
initVirtMem.writeBlob(fillStart,
|
||||
|
@ -431,9 +431,9 @@ Sparc64LiveProcess::argsInit(int intSize, int pageSize)
|
|||
}
|
||||
|
||||
void
|
||||
Sparc32LiveProcess::argsInit(int intSize, int pageSize)
|
||||
Sparc32Process::argsInit(int intSize, int pageSize)
|
||||
{
|
||||
SparcLiveProcess::argsInit<uint32_t>(pageSize);
|
||||
SparcProcess::argsInit<uint32_t>(pageSize);
|
||||
|
||||
// Stuff the trap handlers into the process address space
|
||||
initVirtMem.writeBlob(fillStart,
|
||||
|
@ -442,7 +442,7 @@ Sparc32LiveProcess::argsInit(int intSize, int pageSize)
|
|||
(uint8_t*)spillHandler32, sizeof(MachInst) * numSpillInsts);
|
||||
}
|
||||
|
||||
void Sparc32LiveProcess::flushWindows(ThreadContext *tc)
|
||||
void Sparc32Process::flushWindows(ThreadContext *tc)
|
||||
{
|
||||
IntReg Cansave = tc->readIntReg(NumIntArchRegs + 3);
|
||||
IntReg Canrestore = tc->readIntReg(NumIntArchRegs + 4);
|
||||
|
@ -477,7 +477,7 @@ void Sparc32LiveProcess::flushWindows(ThreadContext *tc)
|
|||
}
|
||||
|
||||
void
|
||||
Sparc64LiveProcess::flushWindows(ThreadContext *tc)
|
||||
Sparc64Process::flushWindows(ThreadContext *tc)
|
||||
{
|
||||
IntReg Cansave = tc->readIntReg(NumIntArchRegs + 3);
|
||||
IntReg Canrestore = tc->readIntReg(NumIntArchRegs + 4);
|
||||
|
@ -512,35 +512,35 @@ Sparc64LiveProcess::flushWindows(ThreadContext *tc)
|
|||
}
|
||||
|
||||
IntReg
|
||||
Sparc32LiveProcess::getSyscallArg(ThreadContext *tc, int &i)
|
||||
Sparc32Process::getSyscallArg(ThreadContext *tc, int &i)
|
||||
{
|
||||
assert(i < 6);
|
||||
return bits(tc->readIntReg(FirstArgumentReg + i++), 31, 0);
|
||||
}
|
||||
|
||||
void
|
||||
Sparc32LiveProcess::setSyscallArg(ThreadContext *tc, int i, IntReg val)
|
||||
Sparc32Process::setSyscallArg(ThreadContext *tc, int i, IntReg val)
|
||||
{
|
||||
assert(i < 6);
|
||||
tc->setIntReg(FirstArgumentReg + i, bits(val, 31, 0));
|
||||
}
|
||||
|
||||
IntReg
|
||||
Sparc64LiveProcess::getSyscallArg(ThreadContext *tc, int &i)
|
||||
Sparc64Process::getSyscallArg(ThreadContext *tc, int &i)
|
||||
{
|
||||
assert(i < 6);
|
||||
return tc->readIntReg(FirstArgumentReg + i++);
|
||||
}
|
||||
|
||||
void
|
||||
Sparc64LiveProcess::setSyscallArg(ThreadContext *tc, int i, IntReg val)
|
||||
Sparc64Process::setSyscallArg(ThreadContext *tc, int i, IntReg val)
|
||||
{
|
||||
assert(i < 6);
|
||||
tc->setIntReg(FirstArgumentReg + i, val);
|
||||
}
|
||||
|
||||
void
|
||||
SparcLiveProcess::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret)
|
||||
SparcProcess::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret)
|
||||
{
|
||||
// check for error condition. SPARC syscall convention is to
|
||||
// indicate success/failure in reg the carry bit of the ccr
|
||||
|
|
|
@ -40,9 +40,8 @@
|
|||
#include "sim/process.hh"
|
||||
|
||||
class ObjectFile;
|
||||
class System;
|
||||
|
||||
class SparcLiveProcess : public LiveProcess
|
||||
class SparcProcess : public Process
|
||||
{
|
||||
protected:
|
||||
|
||||
|
@ -51,8 +50,8 @@ class SparcLiveProcess : public LiveProcess
|
|||
// The locations of the fill and spill handlers
|
||||
Addr fillStart, spillStart;
|
||||
|
||||
SparcLiveProcess(LiveProcessParams * params,
|
||||
ObjectFile *objFile, Addr _StackBias);
|
||||
SparcProcess(ProcessParams * params, ObjectFile *objFile,
|
||||
Addr _StackBias);
|
||||
|
||||
void initState();
|
||||
|
||||
|
@ -71,12 +70,12 @@ class SparcLiveProcess : public LiveProcess
|
|||
void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value);
|
||||
};
|
||||
|
||||
class Sparc32LiveProcess : public SparcLiveProcess
|
||||
class Sparc32Process : public SparcProcess
|
||||
{
|
||||
protected:
|
||||
|
||||
Sparc32LiveProcess(LiveProcessParams * params, ObjectFile *objFile) :
|
||||
SparcLiveProcess(params, objFile, 0)
|
||||
Sparc32Process(ProcessParams * params, ObjectFile *objFile)
|
||||
: SparcProcess(params, objFile, 0)
|
||||
{
|
||||
// Set up stack. On SPARC Linux, stack goes from the top of memory
|
||||
// downward, less the hole for the kernel address space.
|
||||
|
@ -96,17 +95,17 @@ class Sparc32LiveProcess : public SparcLiveProcess
|
|||
|
||||
SparcISA::IntReg getSyscallArg(ThreadContext *tc, int &i);
|
||||
/// Explicitly import the otherwise hidden getSyscallArg
|
||||
using LiveProcess::getSyscallArg;
|
||||
using Process::getSyscallArg;
|
||||
|
||||
void setSyscallArg(ThreadContext *tc, int i, SparcISA::IntReg val);
|
||||
};
|
||||
|
||||
class Sparc64LiveProcess : public SparcLiveProcess
|
||||
class Sparc64Process : public SparcProcess
|
||||
{
|
||||
protected:
|
||||
|
||||
Sparc64LiveProcess(LiveProcessParams * params, ObjectFile *objFile) :
|
||||
SparcLiveProcess(params, objFile, 2047)
|
||||
Sparc64Process(ProcessParams * params, ObjectFile *objFile)
|
||||
: SparcProcess(params, objFile, 2047)
|
||||
{
|
||||
// Set up stack. On SPARC Linux, stack goes from the top of memory
|
||||
// downward, less the hole for the kernel address space.
|
||||
|
@ -126,7 +125,7 @@ class Sparc64LiveProcess : public SparcLiveProcess
|
|||
|
||||
SparcISA::IntReg getSyscallArg(ThreadContext *tc, int &i);
|
||||
/// Explicitly import the otherwise hidden getSyscallArg
|
||||
using LiveProcess::getSyscallArg;
|
||||
using Process::getSyscallArg;
|
||||
|
||||
void setSyscallArg(ThreadContext *tc, int i, SparcISA::IntReg val);
|
||||
};
|
||||
|
|
|
@ -45,7 +45,7 @@ using namespace SparcISA;
|
|||
|
||||
/// Target uname() handler.
|
||||
static SyscallReturn
|
||||
unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
unameFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
|
@ -322,9 +322,9 @@ SyscallDesc SparcSolarisProcess::syscallDescs[] = {
|
|||
/* 255 */ SyscallDesc("umount2", unimplementedFunc)
|
||||
};
|
||||
|
||||
SparcSolarisProcess::SparcSolarisProcess(LiveProcessParams * params,
|
||||
ObjectFile *objFile)
|
||||
: Sparc64LiveProcess(params, objFile),
|
||||
SparcSolarisProcess::SparcSolarisProcess(ProcessParams * params,
|
||||
ObjectFile *objFile)
|
||||
: Sparc64Process(params, objFile),
|
||||
Num_Syscall_Descs(sizeof(syscallDescs) / sizeof(SyscallDesc))
|
||||
{
|
||||
// The sparc syscall table must be <= 284 entries because that is all there
|
||||
|
|
|
@ -38,11 +38,11 @@
|
|||
namespace SparcISA {
|
||||
|
||||
/// A process with emulated SPARC/Solaris syscalls.
|
||||
class SparcSolarisProcess : public Sparc64LiveProcess
|
||||
class SparcSolarisProcess : public Sparc64Process
|
||||
{
|
||||
public:
|
||||
/// Constructor.
|
||||
SparcSolarisProcess(LiveProcessParams * params, ObjectFile *objFile);
|
||||
SparcSolarisProcess(ProcessParams * params, ObjectFile *objFile);
|
||||
|
||||
virtual SyscallDesc* getDesc(int callnum);
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ using namespace X86ISA;
|
|||
|
||||
/// Target uname() handler.
|
||||
static SyscallReturn
|
||||
unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
unameFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
|
@ -72,7 +72,7 @@ unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
}
|
||||
|
||||
static SyscallReturn
|
||||
archPrctlFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
archPrctlFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
enum ArchPrctlCodes
|
||||
|
@ -139,22 +139,22 @@ struct UserDesc64 {
|
|||
|
||||
static SyscallReturn
|
||||
setThreadArea32Func(SyscallDesc *desc, int callnum,
|
||||
LiveProcess *process, ThreadContext *tc)
|
||||
Process *process, ThreadContext *tc)
|
||||
{
|
||||
const int minTLSEntry = 6;
|
||||
const int numTLSEntries = 3;
|
||||
const int maxTLSEntry = minTLSEntry + numTLSEntries - 1;
|
||||
|
||||
X86LiveProcess *x86lp = dynamic_cast<X86LiveProcess *>(process);
|
||||
assert(x86lp);
|
||||
X86Process *x86p = dynamic_cast<X86Process *>(process);
|
||||
assert(x86p);
|
||||
|
||||
assert((maxTLSEntry + 1) * sizeof(uint64_t) <= x86lp->gdtSize());
|
||||
assert((maxTLSEntry + 1) * sizeof(uint64_t) <= x86p->gdtSize());
|
||||
|
||||
int argIndex = 0;
|
||||
TypedBufferArg<UserDesc32> userDesc(process->getSyscallArg(tc, argIndex));
|
||||
TypedBufferArg<uint64_t>
|
||||
gdt(x86lp->gdtStart() + minTLSEntry * sizeof(uint64_t),
|
||||
numTLSEntries * sizeof(uint64_t));
|
||||
gdt(x86p->gdtStart() + minTLSEntry * sizeof(uint64_t),
|
||||
numTLSEntries * sizeof(uint64_t));
|
||||
|
||||
if (!userDesc.copyIn(tc->getMemProxy()))
|
||||
return -EFAULT;
|
||||
|
@ -536,10 +536,10 @@ static SyscallDesc syscallDescs64[] = {
|
|||
/* 313 */ SyscallDesc("finit_module", unimplementedFunc),
|
||||
};
|
||||
|
||||
X86_64LinuxProcess::X86_64LinuxProcess(LiveProcessParams * params,
|
||||
ObjectFile *objFile)
|
||||
: X86_64LiveProcess(params, objFile, syscallDescs64,
|
||||
sizeof(syscallDescs64) / sizeof(SyscallDesc))
|
||||
X86_64LinuxProcess::X86_64LinuxProcess(ProcessParams * params,
|
||||
ObjectFile *objFile)
|
||||
: X86_64Process(params, objFile, syscallDescs64,
|
||||
sizeof(syscallDescs64) / sizeof(SyscallDesc))
|
||||
{}
|
||||
|
||||
static SyscallDesc syscallDescs32[] = {
|
||||
|
@ -869,8 +869,7 @@ static SyscallDesc syscallDescs32[] = {
|
|||
/* 323 */ SyscallDesc("eventfd", unimplementedFunc)
|
||||
};
|
||||
|
||||
I386LinuxProcess::I386LinuxProcess(LiveProcessParams * params,
|
||||
ObjectFile *objFile)
|
||||
: I386LiveProcess(params, objFile, syscallDescs32,
|
||||
sizeof(syscallDescs32) / sizeof(SyscallDesc))
|
||||
I386LinuxProcess::I386LinuxProcess(ProcessParams * params, ObjectFile *objFile)
|
||||
: I386Process(params, objFile, syscallDescs32,
|
||||
sizeof(syscallDescs32) / sizeof(SyscallDesc))
|
||||
{}
|
||||
|
|
|
@ -46,18 +46,18 @@
|
|||
|
||||
namespace X86ISA {
|
||||
|
||||
class X86_64LinuxProcess : public X86_64LiveProcess
|
||||
class X86_64LinuxProcess : public X86_64Process
|
||||
{
|
||||
public:
|
||||
/// Constructor.
|
||||
X86_64LinuxProcess(LiveProcessParams * params, ObjectFile *objFile);
|
||||
X86_64LinuxProcess(ProcessParams * params, ObjectFile *objFile);
|
||||
};
|
||||
|
||||
class I386LinuxProcess : public I386LiveProcess
|
||||
class I386LinuxProcess : public I386Process
|
||||
{
|
||||
public:
|
||||
/// Constructor.
|
||||
I386LinuxProcess(LiveProcessParams * params, ObjectFile *objFile);
|
||||
I386LinuxProcess(ProcessParams * params, ObjectFile *objFile);
|
||||
};
|
||||
|
||||
} // namespace X86ISA
|
||||
|
|
|
@ -91,19 +91,18 @@ static const int ArgumentReg32[] = {
|
|||
static const int NumArgumentRegs32 M5_VAR_USED =
|
||||
sizeof(ArgumentReg) / sizeof(const int);
|
||||
|
||||
X86LiveProcess::X86LiveProcess(LiveProcessParams * params, ObjectFile *objFile,
|
||||
SyscallDesc *_syscallDescs, int _numSyscallDescs) :
|
||||
LiveProcess(params, objFile), syscallDescs(_syscallDescs),
|
||||
numSyscallDescs(_numSyscallDescs)
|
||||
X86Process::X86Process(ProcessParams * params, ObjectFile *objFile,
|
||||
SyscallDesc *_syscallDescs, int _numSyscallDescs)
|
||||
: Process(params, objFile), syscallDescs(_syscallDescs),
|
||||
numSyscallDescs(_numSyscallDescs)
|
||||
{
|
||||
brk_point = objFile->dataBase() + objFile->dataSize() + objFile->bssSize();
|
||||
brk_point = roundUp(brk_point, PageBytes);
|
||||
}
|
||||
|
||||
X86_64LiveProcess::X86_64LiveProcess(LiveProcessParams *params,
|
||||
ObjectFile *objFile, SyscallDesc *_syscallDescs,
|
||||
int _numSyscallDescs) :
|
||||
X86LiveProcess(params, objFile, _syscallDescs, _numSyscallDescs)
|
||||
X86_64Process::X86_64Process(ProcessParams *params, ObjectFile *objFile,
|
||||
SyscallDesc *_syscallDescs, int _numSyscallDescs)
|
||||
: X86Process(params, objFile, _syscallDescs, _numSyscallDescs)
|
||||
{
|
||||
|
||||
vsyscallPage.base = 0xffffffffff600000ULL;
|
||||
|
@ -131,7 +130,7 @@ X86_64LiveProcess::X86_64LiveProcess(LiveProcessParams *params,
|
|||
}
|
||||
|
||||
void
|
||||
I386LiveProcess::syscall(int64_t callnum, ThreadContext *tc)
|
||||
I386Process::syscall(int64_t callnum, ThreadContext *tc)
|
||||
{
|
||||
TheISA::PCState pc = tc->pcState();
|
||||
Addr eip = pc.pc();
|
||||
|
@ -140,14 +139,13 @@ I386LiveProcess::syscall(int64_t callnum, ThreadContext *tc)
|
|||
pc.npc(vsyscallPage.base + vsyscallPage.vsysexitOffset);
|
||||
tc->pcState(pc);
|
||||
}
|
||||
X86LiveProcess::syscall(callnum, tc);
|
||||
X86Process::syscall(callnum, tc);
|
||||
}
|
||||
|
||||
|
||||
I386LiveProcess::I386LiveProcess(LiveProcessParams *params,
|
||||
ObjectFile *objFile, SyscallDesc *_syscallDescs,
|
||||
int _numSyscallDescs) :
|
||||
X86LiveProcess(params, objFile, _syscallDescs, _numSyscallDescs)
|
||||
I386Process::I386Process(ProcessParams *params, ObjectFile *objFile,
|
||||
SyscallDesc *_syscallDescs, int _numSyscallDescs)
|
||||
: X86Process(params, objFile, _syscallDescs, _numSyscallDescs)
|
||||
{
|
||||
_gdtStart = ULL(0xffffd000);
|
||||
_gdtSize = PageBytes;
|
||||
|
@ -174,7 +172,7 @@ I386LiveProcess::I386LiveProcess(LiveProcessParams *params,
|
|||
}
|
||||
|
||||
SyscallDesc*
|
||||
X86LiveProcess::getDesc(int callnum)
|
||||
X86Process::getDesc(int callnum)
|
||||
{
|
||||
if (callnum < 0 || callnum >= numSyscallDescs)
|
||||
return NULL;
|
||||
|
@ -182,9 +180,9 @@ X86LiveProcess::getDesc(int callnum)
|
|||
}
|
||||
|
||||
void
|
||||
X86_64LiveProcess::initState()
|
||||
X86_64Process::initState()
|
||||
{
|
||||
X86LiveProcess::initState();
|
||||
X86Process::initState();
|
||||
|
||||
argsInit(sizeof(uint64_t), PageBytes);
|
||||
|
||||
|
@ -626,9 +624,9 @@ X86_64LiveProcess::initState()
|
|||
}
|
||||
|
||||
void
|
||||
I386LiveProcess::initState()
|
||||
I386Process::initState()
|
||||
{
|
||||
X86LiveProcess::initState();
|
||||
X86Process::initState();
|
||||
|
||||
argsInit(sizeof(uint32_t), PageBytes);
|
||||
|
||||
|
@ -746,7 +744,7 @@ I386LiveProcess::initState()
|
|||
|
||||
template<class IntType>
|
||||
void
|
||||
X86LiveProcess::argsInit(int pageSize,
|
||||
X86Process::argsInit(int pageSize,
|
||||
std::vector<AuxVector<IntType> > extraAuxvs)
|
||||
{
|
||||
int intSize = sizeof(IntType);
|
||||
|
@ -1034,16 +1032,16 @@ X86LiveProcess::argsInit(int pageSize,
|
|||
}
|
||||
|
||||
void
|
||||
X86_64LiveProcess::argsInit(int intSize, int pageSize)
|
||||
X86_64Process::argsInit(int intSize, int pageSize)
|
||||
{
|
||||
std::vector<AuxVector<uint64_t> > extraAuxvs;
|
||||
extraAuxvs.push_back(AuxVector<uint64_t>(M5_AT_SYSINFO_EHDR,
|
||||
vsyscallPage.base));
|
||||
X86LiveProcess::argsInit<uint64_t>(pageSize, extraAuxvs);
|
||||
X86Process::argsInit<uint64_t>(pageSize, extraAuxvs);
|
||||
}
|
||||
|
||||
void
|
||||
I386LiveProcess::argsInit(int intSize, int pageSize)
|
||||
I386Process::argsInit(int intSize, int pageSize)
|
||||
{
|
||||
std::vector<AuxVector<uint32_t> > extraAuxvs;
|
||||
//Tell the binary where the vsyscall part of the vsyscall page is.
|
||||
|
@ -1051,38 +1049,38 @@ I386LiveProcess::argsInit(int intSize, int pageSize)
|
|||
vsyscallPage.base + vsyscallPage.vsyscallOffset));
|
||||
extraAuxvs.push_back(AuxVector<uint32_t>(M5_AT_SYSINFO_EHDR,
|
||||
vsyscallPage.base));
|
||||
X86LiveProcess::argsInit<uint32_t>(pageSize, extraAuxvs);
|
||||
X86Process::argsInit<uint32_t>(pageSize, extraAuxvs);
|
||||
}
|
||||
|
||||
void
|
||||
X86LiveProcess::setSyscallReturn(ThreadContext *tc, SyscallReturn retval)
|
||||
X86Process::setSyscallReturn(ThreadContext *tc, SyscallReturn retval)
|
||||
{
|
||||
tc->setIntReg(INTREG_RAX, retval.encodedValue());
|
||||
}
|
||||
|
||||
X86ISA::IntReg
|
||||
X86_64LiveProcess::getSyscallArg(ThreadContext *tc, int &i)
|
||||
X86_64Process::getSyscallArg(ThreadContext *tc, int &i)
|
||||
{
|
||||
assert(i < NumArgumentRegs);
|
||||
return tc->readIntReg(ArgumentReg[i++]);
|
||||
}
|
||||
|
||||
void
|
||||
X86_64LiveProcess::setSyscallArg(ThreadContext *tc, int i, X86ISA::IntReg val)
|
||||
X86_64Process::setSyscallArg(ThreadContext *tc, int i, X86ISA::IntReg val)
|
||||
{
|
||||
assert(i < NumArgumentRegs);
|
||||
return tc->setIntReg(ArgumentReg[i], val);
|
||||
}
|
||||
|
||||
X86ISA::IntReg
|
||||
I386LiveProcess::getSyscallArg(ThreadContext *tc, int &i)
|
||||
I386Process::getSyscallArg(ThreadContext *tc, int &i)
|
||||
{
|
||||
assert(i < NumArgumentRegs32);
|
||||
return tc->readIntReg(ArgumentReg32[i++]);
|
||||
}
|
||||
|
||||
X86ISA::IntReg
|
||||
I386LiveProcess::getSyscallArg(ThreadContext *tc, int &i, int width)
|
||||
I386Process::getSyscallArg(ThreadContext *tc, int &i, int width)
|
||||
{
|
||||
assert(width == 32 || width == 64);
|
||||
assert(i < NumArgumentRegs);
|
||||
|
@ -1093,7 +1091,7 @@ I386LiveProcess::getSyscallArg(ThreadContext *tc, int &i, int width)
|
|||
}
|
||||
|
||||
void
|
||||
I386LiveProcess::setSyscallArg(ThreadContext *tc, int i, X86ISA::IntReg val)
|
||||
I386Process::setSyscallArg(ThreadContext *tc, int i, X86ISA::IntReg val)
|
||||
{
|
||||
assert(i < NumArgumentRegs);
|
||||
return tc->setIntReg(ArgumentReg[i], val);
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace X86ISA
|
|||
M5_AT_SYSINFO_EHDR = 33
|
||||
};
|
||||
|
||||
class X86LiveProcess : public LiveProcess
|
||||
class X86Process : public Process
|
||||
{
|
||||
protected:
|
||||
Addr _gdtStart;
|
||||
|
@ -64,8 +64,8 @@ namespace X86ISA
|
|||
SyscallDesc *syscallDescs;
|
||||
const int numSyscallDescs;
|
||||
|
||||
X86LiveProcess(LiveProcessParams * params, ObjectFile *objFile,
|
||||
SyscallDesc *_syscallDescs, int _numSyscallDescs);
|
||||
X86Process(ProcessParams * params, ObjectFile *objFile,
|
||||
SyscallDesc *_syscallDescs, int _numSyscallDescs);
|
||||
|
||||
template<class IntType>
|
||||
void argsInit(int pageSize,
|
||||
|
@ -83,11 +83,11 @@ namespace X86ISA
|
|||
void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value);
|
||||
};
|
||||
|
||||
class X86_64LiveProcess : public X86LiveProcess
|
||||
class X86_64Process : public X86Process
|
||||
{
|
||||
protected:
|
||||
X86_64LiveProcess(LiveProcessParams *params, ObjectFile *objFile,
|
||||
SyscallDesc *_syscallDescs, int _numSyscallDescs);
|
||||
X86_64Process(ProcessParams *params, ObjectFile *objFile,
|
||||
SyscallDesc *_syscallDescs, int _numSyscallDescs);
|
||||
|
||||
class VSyscallPage
|
||||
{
|
||||
|
@ -105,15 +105,15 @@ namespace X86ISA
|
|||
|
||||
X86ISA::IntReg getSyscallArg(ThreadContext *tc, int &i);
|
||||
/// Explicitly import the otherwise hidden getSyscallArg
|
||||
using LiveProcess::getSyscallArg;
|
||||
using Process::getSyscallArg;
|
||||
void setSyscallArg(ThreadContext *tc, int i, X86ISA::IntReg val);
|
||||
};
|
||||
|
||||
class I386LiveProcess : public X86LiveProcess
|
||||
class I386Process : public X86Process
|
||||
{
|
||||
protected:
|
||||
I386LiveProcess(LiveProcessParams *params, ObjectFile *objFile,
|
||||
SyscallDesc *_syscallDescs, int _numSyscallDescs);
|
||||
I386Process(ProcessParams *params, ObjectFile *objFile,
|
||||
SyscallDesc *_syscallDescs, int _numSyscallDescs);
|
||||
|
||||
class VSyscallPage
|
||||
{
|
||||
|
|
|
@ -91,7 +91,7 @@ ClDriver::handshake(GpuDispatcher *_dispatcher)
|
|||
}
|
||||
|
||||
int
|
||||
ClDriver::open(LiveProcess *p, ThreadContext *tc, int mode, int flags)
|
||||
ClDriver::open(Process *p, ThreadContext *tc, int mode, int flags)
|
||||
{
|
||||
int fd = p->allocFD(-1, filename, 0, 0, false);
|
||||
FDEntry *fde = p->getFDEntry(fd);
|
||||
|
@ -101,7 +101,7 @@ ClDriver::open(LiveProcess *p, ThreadContext *tc, int mode, int flags)
|
|||
}
|
||||
|
||||
int
|
||||
ClDriver::ioctl(LiveProcess *process, ThreadContext *tc, unsigned req)
|
||||
ClDriver::ioctl(Process *process, ThreadContext *tc, unsigned req)
|
||||
{
|
||||
int index = 2;
|
||||
Addr buf_addr = process->getSyscallArg(tc, index);
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
|
||||
class GpuDispatcher;
|
||||
class HsaCode;
|
||||
class LiveProcess;
|
||||
class Process;
|
||||
class ThreadContext;
|
||||
|
||||
struct ClDriverParams;
|
||||
|
@ -53,8 +53,8 @@ class ClDriver final : public EmulatedDriver
|
|||
public:
|
||||
ClDriver(ClDriverParams *p);
|
||||
void handshake(GpuDispatcher *_dispatcher);
|
||||
int open(LiveProcess *p, ThreadContext *tc, int mode, int flags);
|
||||
int ioctl(LiveProcess *p, ThreadContext *tc, unsigned req);
|
||||
int open(Process *p, ThreadContext *tc, int mode, int flags);
|
||||
int ioctl(Process *p, ThreadContext *tc, unsigned req);
|
||||
const char* codeOffToKernelName(uint64_t code_ptr);
|
||||
|
||||
private:
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include "kern/operatingsystem.hh"
|
||||
|
||||
class ThreadContext;
|
||||
class LiveProcess;
|
||||
class Process;
|
||||
|
||||
///
|
||||
/// This class encapsulates the types, structures, constants,
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "sim/system.hh"
|
||||
|
||||
int
|
||||
Linux::openSpecialFile(std::string path, LiveProcess *process,
|
||||
Linux::openSpecialFile(std::string path, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
DPRINTF(SyscallVerbose, "Opening special file: %s\n", path.c_str());
|
||||
|
@ -59,7 +59,7 @@ Linux::openSpecialFile(std::string path, LiveProcess *process,
|
|||
}
|
||||
|
||||
std::string
|
||||
Linux::procMeminfo(LiveProcess *process, ThreadContext *tc)
|
||||
Linux::procMeminfo(Process *process, ThreadContext *tc)
|
||||
{
|
||||
return csprintf("MemTotal:%12d kB\nMemFree: %12d kB\n",
|
||||
process->system->memSize() >> 10,
|
||||
|
|
|
@ -223,8 +223,9 @@ class Linux : public OperatingSystem
|
|||
int64_t ru_nivcsw; //!< involuntary "
|
||||
};
|
||||
|
||||
static int openSpecialFile(std::string path, LiveProcess *process, ThreadContext *tc);
|
||||
static std::string procMeminfo(LiveProcess *process, ThreadContext *tc);
|
||||
static int openSpecialFile(std::string path, Process *process,
|
||||
ThreadContext *tc);
|
||||
static std::string procMeminfo(Process *process, ThreadContext *tc);
|
||||
|
||||
// For futex system call
|
||||
static const unsigned TGT_FUTEX_WAIT = 0;
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include "base/misc.hh"
|
||||
|
||||
int
|
||||
OperatingSystem::openSpecialFile(std::string path, LiveProcess *process,
|
||||
OperatingSystem::openSpecialFile(std::string path, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
warn("Attempting to open special file: %s. Ignoring. Simulation may"
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
class LiveProcess;
|
||||
class Process;
|
||||
class ThreadContext;
|
||||
|
||||
/// This struct is used to build target-OS-dependent tables that
|
||||
|
@ -114,7 +114,8 @@ class OperatingSystem {
|
|||
int64_t ru_nivcsw; //!< involuntary "
|
||||
} rusage;
|
||||
|
||||
static int openSpecialFile(std::string path, LiveProcess *process, ThreadContext *tc);
|
||||
static int openSpecialFile(std::string path, Process *process,
|
||||
ThreadContext *tc);
|
||||
|
||||
}; // class OperatingSystem
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ from m5.proxy import *
|
|||
|
||||
class Process(SimObject):
|
||||
type = 'Process'
|
||||
abstract = True
|
||||
cxx_header = "sim/process.hh"
|
||||
input = Param.String('cin', "filename for stdin")
|
||||
output = Param.String('cout', 'filename for stdout')
|
||||
|
@ -50,19 +49,6 @@ class Process(SimObject):
|
|||
pid = Param.Int(100, 'process id')
|
||||
ppid = Param.Int(99, 'parent process id')
|
||||
|
||||
@classmethod
|
||||
def export_methods(cls, code):
|
||||
code('bool map(Addr vaddr, Addr paddr, int size, bool cacheable=true);')
|
||||
|
||||
class EmulatedDriver(SimObject):
|
||||
type = 'EmulatedDriver'
|
||||
cxx_header = "sim/emul_driver.hh"
|
||||
abstract = True
|
||||
filename = Param.String("device file name (under /dev)")
|
||||
|
||||
class LiveProcess(Process):
|
||||
type = 'LiveProcess'
|
||||
cxx_header = "sim/process.hh"
|
||||
executable = Param.String('', "executable (overrides cmd[0] if set)")
|
||||
cmd = VectorParam.String("command line (executable plus arguments)")
|
||||
env = VectorParam.String([], "environment settings")
|
||||
|
@ -70,3 +56,12 @@ class LiveProcess(Process):
|
|||
simpoint = Param.UInt64(0, 'simulation point at which to start simulation')
|
||||
drivers = VectorParam.EmulatedDriver([], 'Available emulated drivers')
|
||||
|
||||
@classmethod
|
||||
def export_methods(cls, code):
|
||||
code('bool map(Addr vaddr, Addr paddr, int sz, bool cacheable=true);')
|
||||
|
||||
class EmulatedDriver(SimObject):
|
||||
type = 'EmulatedDriver'
|
||||
cxx_header = "sim/emul_driver.hh"
|
||||
abstract = True
|
||||
filename = Param.String("device file name (under /dev)")
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#include "params/EmulatedDriver.hh"
|
||||
#include "sim/sim_object.hh"
|
||||
|
||||
class LiveProcess;
|
||||
class Process;
|
||||
class ThreadContext;
|
||||
|
||||
/**
|
||||
|
@ -74,7 +74,7 @@ class EmulatedDriver : public SimObject
|
|||
* to openFunc() (q.v.).
|
||||
* @return A newly allocated target fd, or -1 on error.
|
||||
*/
|
||||
virtual int open(LiveProcess *p, ThreadContext *tc,
|
||||
virtual int open(Process *p, ThreadContext *tc,
|
||||
int mode, int flags) = 0;
|
||||
|
||||
/**
|
||||
|
@ -84,7 +84,7 @@ class EmulatedDriver : public SimObject
|
|||
* @return The return code for the ioctl, or the negation of the errno
|
||||
* (see the SyscallReturn class).
|
||||
*/
|
||||
virtual int ioctl(LiveProcess *p, ThreadContext *tc, unsigned req) = 0;
|
||||
virtual int ioctl(Process *p, ThreadContext *tc, unsigned req) = 0;
|
||||
|
||||
/**
|
||||
* Virtual method, invoked when the user program calls mmap() on
|
||||
|
@ -93,7 +93,7 @@ class EmulatedDriver : public SimObject
|
|||
* @return The return ptr for the mmap, or the negation of the errno
|
||||
* (see the SyscallReturn class).
|
||||
*/
|
||||
virtual Addr mmap(LiveProcess *p, ThreadContext *tc, Addr start,
|
||||
virtual Addr mmap(Process *p, ThreadContext *tc, Addr start,
|
||||
uint64_t length, int prot, int tgtFlags, int tgtFd,
|
||||
int offset) { return -EBADF; }
|
||||
};
|
||||
|
|
|
@ -61,7 +61,6 @@
|
|||
#include "cpu/thread_context.hh"
|
||||
#include "mem/page_table.hh"
|
||||
#include "mem/se_translating_port_proxy.hh"
|
||||
#include "params/LiveProcess.hh"
|
||||
#include "params/Process.hh"
|
||||
#include "sim/emul_driver.hh"
|
||||
#include "sim/syscall_desc.hh"
|
||||
|
@ -126,7 +125,7 @@ openOutputFile(const string &filename)
|
|||
return openFile(filename, O_WRONLY | O_CREAT | O_TRUNC, 0664);
|
||||
}
|
||||
|
||||
Process::Process(ProcessParams * params)
|
||||
Process::Process(ProcessParams * params, ObjectFile * obj_file)
|
||||
: SimObject(params), system(params->system),
|
||||
brk_point(0), stack_base(0), stack_size(0), stack_min(0),
|
||||
max_stack_size(params->max_stack_size),
|
||||
|
@ -148,9 +147,13 @@ Process::Process(ProcessParams * params)
|
|||
{"stdout", STDOUT_FILENO},
|
||||
{"cerr", STDERR_FILENO},
|
||||
{"stderr", STDERR_FILENO}},
|
||||
objFile(obj_file),
|
||||
argv(params->cmd), envp(params->env), cwd(params->cwd),
|
||||
executable(params->executable),
|
||||
_uid(params->uid), _euid(params->euid),
|
||||
_gid(params->gid), _egid(params->egid),
|
||||
_pid(params->pid), _ppid(params->ppid)
|
||||
_pid(params->pid), _ppid(params->ppid),
|
||||
drivers(params->drivers)
|
||||
{
|
||||
int sim_fd;
|
||||
std::map<string,int>::iterator it;
|
||||
|
@ -188,6 +191,19 @@ Process::Process(ProcessParams * params)
|
|||
mmap_end = 0;
|
||||
nxm_start = nxm_end = 0;
|
||||
// other parameters will be initialized when the program is loaded
|
||||
|
||||
// load up symbols, if any... these may be used for debugging or
|
||||
// profiling.
|
||||
if (!debugSymbolTable) {
|
||||
debugSymbolTable = new SymbolTable();
|
||||
if (!objFile->loadGlobalSymbols(debugSymbolTable) ||
|
||||
!objFile->loadLocalSymbols(debugSymbolTable) ||
|
||||
!objFile->loadWeakSymbols(debugSymbolTable)) {
|
||||
// didn't load any symbols
|
||||
delete debugSymbolTable;
|
||||
debugSymbolTable = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -496,36 +512,8 @@ Process::map(Addr vaddr, Addr paddr, int size, bool cacheable)
|
|||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// LiveProcess member definitions
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
LiveProcess::LiveProcess(LiveProcessParams *params, ObjectFile *_objFile)
|
||||
: Process(params), objFile(_objFile),
|
||||
argv(params->cmd), envp(params->env), cwd(params->cwd),
|
||||
executable(params->executable),
|
||||
drivers(params->drivers)
|
||||
{
|
||||
|
||||
// load up symbols, if any... these may be used for debugging or
|
||||
// profiling.
|
||||
if (!debugSymbolTable) {
|
||||
debugSymbolTable = new SymbolTable();
|
||||
if (!objFile->loadGlobalSymbols(debugSymbolTable) ||
|
||||
!objFile->loadLocalSymbols(debugSymbolTable) ||
|
||||
!objFile->loadWeakSymbols(debugSymbolTable)) {
|
||||
// didn't load any symbols
|
||||
delete debugSymbolTable;
|
||||
debugSymbolTable = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LiveProcess::syscall(int64_t callnum, ThreadContext *tc)
|
||||
Process::syscall(int64_t callnum, ThreadContext *tc)
|
||||
{
|
||||
num_syscalls++;
|
||||
|
||||
|
@ -537,14 +525,14 @@ LiveProcess::syscall(int64_t callnum, ThreadContext *tc)
|
|||
}
|
||||
|
||||
IntReg
|
||||
LiveProcess::getSyscallArg(ThreadContext *tc, int &i, int width)
|
||||
Process::getSyscallArg(ThreadContext *tc, int &i, int width)
|
||||
{
|
||||
return getSyscallArg(tc, i);
|
||||
}
|
||||
|
||||
|
||||
EmulatedDriver *
|
||||
LiveProcess::findDriver(std::string filename)
|
||||
Process::findDriver(std::string filename)
|
||||
{
|
||||
for (EmulatedDriver *d : drivers) {
|
||||
if (d->match(filename))
|
||||
|
@ -555,7 +543,7 @@ LiveProcess::findDriver(std::string filename)
|
|||
}
|
||||
|
||||
void
|
||||
LiveProcess::updateBias()
|
||||
Process::updateBias()
|
||||
{
|
||||
ObjectFile *interp = objFile->getInterpreter();
|
||||
|
||||
|
@ -580,14 +568,14 @@ LiveProcess::updateBias()
|
|||
|
||||
|
||||
ObjectFile *
|
||||
LiveProcess::getInterpreter()
|
||||
Process::getInterpreter()
|
||||
{
|
||||
return objFile->getInterpreter();
|
||||
}
|
||||
|
||||
|
||||
Addr
|
||||
LiveProcess::getBias()
|
||||
Process::getBias()
|
||||
{
|
||||
ObjectFile *interp = getInterpreter();
|
||||
|
||||
|
@ -596,7 +584,7 @@ LiveProcess::getBias()
|
|||
|
||||
|
||||
Addr
|
||||
LiveProcess::getStartPC()
|
||||
Process::getStartPC()
|
||||
{
|
||||
ObjectFile *interp = getInterpreter();
|
||||
|
||||
|
@ -604,74 +592,74 @@ LiveProcess::getStartPC()
|
|||
}
|
||||
|
||||
|
||||
LiveProcess *
|
||||
LiveProcess::create(LiveProcessParams * params)
|
||||
Process *
|
||||
ProcessParams::create()
|
||||
{
|
||||
LiveProcess *process = NULL;
|
||||
Process *process = NULL;
|
||||
|
||||
// If not specified, set the executable parameter equal to the
|
||||
// simulated system's zeroth command line parameter
|
||||
if (params->executable == "") {
|
||||
params->executable = params->cmd[0];
|
||||
if (executable == "") {
|
||||
executable = cmd[0];
|
||||
}
|
||||
|
||||
ObjectFile *objFile = createObjectFile(params->executable);
|
||||
if (objFile == NULL) {
|
||||
fatal("Can't load object file %s", params->executable);
|
||||
ObjectFile *obj_file = createObjectFile(executable);
|
||||
if (obj_file == NULL) {
|
||||
fatal("Can't load object file %s", executable);
|
||||
}
|
||||
|
||||
#if THE_ISA == ALPHA_ISA
|
||||
if (objFile->getArch() != ObjectFile::Alpha)
|
||||
if (obj_file->getArch() != ObjectFile::Alpha)
|
||||
fatal("Object file architecture does not match compiled ISA (Alpha).");
|
||||
|
||||
switch (objFile->getOpSys()) {
|
||||
switch (obj_file->getOpSys()) {
|
||||
case ObjectFile::UnknownOpSys:
|
||||
warn("Unknown operating system; assuming Linux.");
|
||||
// fall through
|
||||
case ObjectFile::Linux:
|
||||
process = new AlphaLinuxProcess(params, objFile);
|
||||
process = new AlphaLinuxProcess(this, obj_file);
|
||||
break;
|
||||
|
||||
default:
|
||||
fatal("Unknown/unsupported operating system.");
|
||||
}
|
||||
#elif THE_ISA == SPARC_ISA
|
||||
if (objFile->getArch() != ObjectFile::SPARC64 &&
|
||||
objFile->getArch() != ObjectFile::SPARC32)
|
||||
if (obj_file->getArch() != ObjectFile::SPARC64 &&
|
||||
obj_file->getArch() != ObjectFile::SPARC32)
|
||||
fatal("Object file architecture does not match compiled ISA (SPARC).");
|
||||
switch (objFile->getOpSys()) {
|
||||
switch (obj_file->getOpSys()) {
|
||||
case ObjectFile::UnknownOpSys:
|
||||
warn("Unknown operating system; assuming Linux.");
|
||||
// fall through
|
||||
case ObjectFile::Linux:
|
||||
if (objFile->getArch() == ObjectFile::SPARC64) {
|
||||
process = new Sparc64LinuxProcess(params, objFile);
|
||||
if (obj_file->getArch() == ObjectFile::SPARC64) {
|
||||
process = new Sparc64LinuxProcess(this, obj_file);
|
||||
} else {
|
||||
process = new Sparc32LinuxProcess(params, objFile);
|
||||
process = new Sparc32LinuxProcess(this, obj_file);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case ObjectFile::Solaris:
|
||||
process = new SparcSolarisProcess(params, objFile);
|
||||
process = new SparcSolarisProcess(this, obj_file);
|
||||
break;
|
||||
|
||||
default:
|
||||
fatal("Unknown/unsupported operating system.");
|
||||
}
|
||||
#elif THE_ISA == X86_ISA
|
||||
if (objFile->getArch() != ObjectFile::X86_64 &&
|
||||
objFile->getArch() != ObjectFile::I386)
|
||||
if (obj_file->getArch() != ObjectFile::X86_64 &&
|
||||
obj_file->getArch() != ObjectFile::I386)
|
||||
fatal("Object file architecture does not match compiled ISA (x86).");
|
||||
switch (objFile->getOpSys()) {
|
||||
switch (obj_file->getOpSys()) {
|
||||
case ObjectFile::UnknownOpSys:
|
||||
warn("Unknown operating system; assuming Linux.");
|
||||
// fall through
|
||||
case ObjectFile::Linux:
|
||||
if (objFile->getArch() == ObjectFile::X86_64) {
|
||||
process = new X86_64LinuxProcess(params, objFile);
|
||||
if (obj_file->getArch() == ObjectFile::X86_64) {
|
||||
process = new X86_64LinuxProcess(this, obj_file);
|
||||
} else {
|
||||
process = new I386LinuxProcess(params, objFile);
|
||||
process = new I386LinuxProcess(this, obj_file);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -679,44 +667,44 @@ LiveProcess::create(LiveProcessParams * params)
|
|||
fatal("Unknown/unsupported operating system.");
|
||||
}
|
||||
#elif THE_ISA == MIPS_ISA
|
||||
if (objFile->getArch() != ObjectFile::Mips)
|
||||
if (obj_file->getArch() != ObjectFile::Mips)
|
||||
fatal("Object file architecture does not match compiled ISA (MIPS).");
|
||||
switch (objFile->getOpSys()) {
|
||||
switch (obj_file->getOpSys()) {
|
||||
case ObjectFile::UnknownOpSys:
|
||||
warn("Unknown operating system; assuming Linux.");
|
||||
// fall through
|
||||
case ObjectFile::Linux:
|
||||
process = new MipsLinuxProcess(params, objFile);
|
||||
process = new MipsLinuxProcess(this, obj_file);
|
||||
break;
|
||||
|
||||
default:
|
||||
fatal("Unknown/unsupported operating system.");
|
||||
}
|
||||
#elif THE_ISA == ARM_ISA
|
||||
ObjectFile::Arch arch = objFile->getArch();
|
||||
ObjectFile::Arch arch = obj_file->getArch();
|
||||
if (arch != ObjectFile::Arm && arch != ObjectFile::Thumb &&
|
||||
arch != ObjectFile::Arm64)
|
||||
fatal("Object file architecture does not match compiled ISA (ARM).");
|
||||
switch (objFile->getOpSys()) {
|
||||
switch (obj_file->getOpSys()) {
|
||||
case ObjectFile::UnknownOpSys:
|
||||
warn("Unknown operating system; assuming Linux.");
|
||||
// fall through
|
||||
case ObjectFile::Linux:
|
||||
if (arch == ObjectFile::Arm64) {
|
||||
process = new ArmLinuxProcess64(params, objFile,
|
||||
objFile->getArch());
|
||||
process = new ArmLinuxProcess64(this, obj_file,
|
||||
obj_file->getArch());
|
||||
} else {
|
||||
process = new ArmLinuxProcess32(params, objFile,
|
||||
objFile->getArch());
|
||||
process = new ArmLinuxProcess32(this, obj_file,
|
||||
obj_file->getArch());
|
||||
}
|
||||
break;
|
||||
case ObjectFile::FreeBSD:
|
||||
if (arch == ObjectFile::Arm64) {
|
||||
process = new ArmFreebsdProcess64(params, objFile,
|
||||
objFile->getArch());
|
||||
process = new ArmFreebsdProcess64(this, obj_file,
|
||||
obj_file->getArch());
|
||||
} else {
|
||||
process = new ArmFreebsdProcess32(params, objFile,
|
||||
objFile->getArch());
|
||||
process = new ArmFreebsdProcess32(this, obj_file,
|
||||
obj_file->getArch());
|
||||
}
|
||||
break;
|
||||
case ObjectFile::LinuxArmOABI:
|
||||
|
@ -726,28 +714,28 @@ LiveProcess::create(LiveProcessParams * params)
|
|||
fatal("Unknown/unsupported operating system.");
|
||||
}
|
||||
#elif THE_ISA == POWER_ISA
|
||||
if (objFile->getArch() != ObjectFile::Power)
|
||||
if (obj_file->getArch() != ObjectFile::Power)
|
||||
fatal("Object file architecture does not match compiled ISA (Power).");
|
||||
switch (objFile->getOpSys()) {
|
||||
switch (obj_file->getOpSys()) {
|
||||
case ObjectFile::UnknownOpSys:
|
||||
warn("Unknown operating system; assuming Linux.");
|
||||
// fall through
|
||||
case ObjectFile::Linux:
|
||||
process = new PowerLinuxProcess(params, objFile);
|
||||
process = new PowerLinuxProcess(this, obj_file);
|
||||
break;
|
||||
|
||||
default:
|
||||
fatal("Unknown/unsupported operating system.");
|
||||
}
|
||||
#elif THE_ISA == RISCV_ISA
|
||||
if (objFile->getArch() != ObjectFile::Riscv)
|
||||
if (obj_file->getArch() != ObjectFile::Riscv)
|
||||
fatal("Object file architecture does not match compiled ISA (RISCV).");
|
||||
switch (objFile->getOpSys()) {
|
||||
switch (obj_file->getOpSys()) {
|
||||
case ObjectFile::UnknownOpSys:
|
||||
warn("Unknown operating system; assuming Linux.");
|
||||
// fall through
|
||||
case ObjectFile::Linux:
|
||||
process = new RiscvLinuxProcess(params, objFile);
|
||||
process = new RiscvLinuxProcess(this, obj_file);
|
||||
break;
|
||||
default:
|
||||
fatal("Unknown/unsupported operating system.");
|
||||
|
@ -760,9 +748,3 @@ LiveProcess::create(LiveProcessParams * params)
|
|||
fatal("Unknown error creating process object.");
|
||||
return process;
|
||||
}
|
||||
|
||||
LiveProcess *
|
||||
LiveProcessParams::create()
|
||||
{
|
||||
return LiveProcess::create(this);
|
||||
}
|
||||
|
|
|
@ -46,10 +46,10 @@
|
|||
#include "sim/fd_entry.hh"
|
||||
#include "sim/sim_object.hh"
|
||||
|
||||
struct LiveProcessParams;
|
||||
struct ProcessParams;
|
||||
|
||||
class EmulatedDriver;
|
||||
class ObjectFile;
|
||||
class PageTableBase;
|
||||
class SyscallDesc;
|
||||
class SyscallReturn;
|
||||
|
@ -170,9 +170,6 @@ class Process : public SimObject
|
|||
// Find a free context to use
|
||||
ThreadContext *findFreeContext();
|
||||
|
||||
// provide program name for debug messages
|
||||
virtual const char *progName() const { return "<unknown>"; }
|
||||
|
||||
// generate new target fd for sim_fd
|
||||
int allocFD(int sim_fd, const std::string& filename, int flags, int mode,
|
||||
bool pipe);
|
||||
|
@ -202,7 +199,6 @@ class Process : public SimObject
|
|||
// set the source of this read pipe for a checkpoint resume
|
||||
void setReadPipeSource(int read_pipe_fd, int source_fd);
|
||||
|
||||
virtual void syscall(int64_t callnum, ThreadContext *tc) = 0;
|
||||
|
||||
void allocateMem(Addr vaddr, int64_t size, bool clobber = false);
|
||||
|
||||
|
@ -228,6 +224,15 @@ class Process : public SimObject
|
|||
void serialize(CheckpointOut &cp) const override;
|
||||
void unserialize(CheckpointIn &cp) override;
|
||||
|
||||
protected:
|
||||
ObjectFile *objFile;
|
||||
std::vector<std::string> argv;
|
||||
std::vector<std::string> envp;
|
||||
std::string cwd;
|
||||
std::string executable;
|
||||
|
||||
Process(ProcessParams *params, ObjectFile *obj_file);
|
||||
|
||||
public:
|
||||
// Id of the owner of the process
|
||||
uint64_t _uid;
|
||||
|
@ -239,28 +244,9 @@ class Process : public SimObject
|
|||
uint64_t _pid;
|
||||
uint64_t _ppid;
|
||||
|
||||
};
|
||||
|
||||
//
|
||||
// "Live" process with system calls redirected to host system
|
||||
//
|
||||
class ObjectFile;
|
||||
class LiveProcess : public Process
|
||||
{
|
||||
protected:
|
||||
ObjectFile *objFile;
|
||||
std::vector<std::string> argv;
|
||||
std::vector<std::string> envp;
|
||||
std::string cwd;
|
||||
std::string executable;
|
||||
|
||||
LiveProcess(LiveProcessParams *params, ObjectFile *objFile);
|
||||
|
||||
// Emulated drivers available to this process
|
||||
std::vector<EmulatedDriver *> drivers;
|
||||
|
||||
public:
|
||||
|
||||
enum AuxiliaryVectorType {
|
||||
M5_AT_NULL = 0,
|
||||
M5_AT_IGNORE = 1,
|
||||
|
@ -299,7 +285,7 @@ class LiveProcess : public Process
|
|||
inline uint64_t ppid() { return _ppid; }
|
||||
|
||||
// provide program name for debug messages
|
||||
virtual const char *progName() const { return executable.c_str(); }
|
||||
const char *progName() const { return executable.c_str(); }
|
||||
|
||||
std::string
|
||||
fullPath(const std::string &filename)
|
||||
|
@ -317,7 +303,7 @@ class LiveProcess : public Process
|
|||
|
||||
std::string getcwd() const { return cwd; }
|
||||
|
||||
virtual void syscall(int64_t callnum, ThreadContext *tc);
|
||||
void syscall(int64_t callnum, ThreadContext *tc);
|
||||
|
||||
virtual TheISA::IntReg getSyscallArg(ThreadContext *tc, int &i) = 0;
|
||||
virtual TheISA::IntReg getSyscallArg(ThreadContext *tc, int &i, int width);
|
||||
|
@ -345,12 +331,6 @@ class LiveProcess : public Process
|
|||
|
||||
Addr getBias();
|
||||
Addr getStartPC();
|
||||
|
||||
// this function is used to create the LiveProcess object, since
|
||||
// we can't tell which subclass of LiveProcess to use until we
|
||||
// open and look at the object file.
|
||||
static LiveProcess *create(LiveProcessParams *params);
|
||||
};
|
||||
|
||||
|
||||
#endif // __PROCESS_HH__
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#include "sim/syscall_return.hh"
|
||||
|
||||
void
|
||||
SyscallDesc::doSyscall(int callnum, LiveProcess *process, ThreadContext *tc)
|
||||
SyscallDesc::doSyscall(int callnum, Process *process, ThreadContext *tc)
|
||||
{
|
||||
TheISA::IntReg arg[6] M5_VAR_USED;
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
class LiveProcess;
|
||||
class Process;
|
||||
class SyscallReturn;
|
||||
class ThreadContext;
|
||||
|
||||
|
@ -62,7 +62,7 @@ class SyscallDesc {
|
|||
public:
|
||||
/** Typedef the function pointer here to clean up code below */
|
||||
typedef SyscallReturn (*SyscallExecutor)(SyscallDesc*, int num,
|
||||
LiveProcess*, ThreadContext*);
|
||||
Process*, ThreadContext*);
|
||||
|
||||
SyscallDesc(const char *name, SyscallExecutor sys_exec, int flags = 0)
|
||||
: _name(name), executor(sys_exec), _flags(flags), _warned(false)
|
||||
|
@ -91,7 +91,7 @@ class SyscallDesc {
|
|||
* @param proc Handle for the owning Process to pass information
|
||||
* @param tc Handle for owning ThreadContext to pass information
|
||||
*/
|
||||
void doSyscall(int callnum, LiveProcess *proc, ThreadContext *tc);
|
||||
void doSyscall(int callnum, Process *proc, ThreadContext *tc);
|
||||
|
||||
/**
|
||||
* Return false if WarnOnce is set and a warning has already been issued.
|
||||
|
|
|
@ -53,7 +53,7 @@ using namespace std;
|
|||
using namespace TheISA;
|
||||
|
||||
SyscallReturn
|
||||
unimplementedFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
unimplementedFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
fatal("syscall %s (#%d) unimplemented.", desc->name(), callnum);
|
||||
|
@ -63,7 +63,7 @@ unimplementedFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
|
||||
|
||||
SyscallReturn
|
||||
ignoreFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
ignoreFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
if (desc->needWarning()) {
|
||||
|
@ -76,7 +76,7 @@ ignoreFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
|
||||
|
||||
SyscallReturn
|
||||
exitFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
exitFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
if (process->system->numRunningContexts() == 1) {
|
||||
|
@ -94,7 +94,7 @@ exitFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
|
||||
|
||||
SyscallReturn
|
||||
exitGroupFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
exitGroupFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
// halt all threads belonging to this process
|
||||
|
@ -114,14 +114,14 @@ exitGroupFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
|
||||
|
||||
SyscallReturn
|
||||
getpagesizeFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
||||
getpagesizeFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
|
||||
{
|
||||
return (int)PageBytes;
|
||||
}
|
||||
|
||||
|
||||
SyscallReturn
|
||||
brkFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
||||
brkFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
|
||||
{
|
||||
// change brk addr to first arg
|
||||
int index = 0;
|
||||
|
@ -167,7 +167,7 @@ brkFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
|||
|
||||
|
||||
SyscallReturn
|
||||
closeFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
||||
closeFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
int tgt_fd = p->getSyscallArg(tc, index);
|
||||
|
@ -186,7 +186,7 @@ closeFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
|||
|
||||
|
||||
SyscallReturn
|
||||
readFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
||||
readFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
int tgt_fd = p->getSyscallArg(tc, index);
|
||||
|
@ -207,7 +207,7 @@ readFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
|||
}
|
||||
|
||||
SyscallReturn
|
||||
writeFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
||||
writeFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
int tgt_fd = p->getSyscallArg(tc, index);
|
||||
|
@ -230,7 +230,7 @@ writeFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
|||
|
||||
|
||||
SyscallReturn
|
||||
lseekFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
||||
lseekFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
int tgt_fd = p->getSyscallArg(tc, index);
|
||||
|
@ -248,7 +248,7 @@ lseekFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
|||
|
||||
|
||||
SyscallReturn
|
||||
_llseekFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
||||
_llseekFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
int tgt_fd = p->getSyscallArg(tc, index);
|
||||
|
@ -277,7 +277,7 @@ _llseekFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
|||
|
||||
|
||||
SyscallReturn
|
||||
munmapFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
||||
munmapFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
|
||||
{
|
||||
// With mmap more fully implemented, it might be worthwhile to bite
|
||||
// the bullet and implement munmap. Should allow us to reuse simulated
|
||||
|
@ -289,7 +289,7 @@ munmapFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
|||
const char *hostname = "m5.eecs.umich.edu";
|
||||
|
||||
SyscallReturn
|
||||
gethostnameFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
||||
gethostnameFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
Addr bufPtr = p->getSyscallArg(tc, index);
|
||||
|
@ -304,7 +304,7 @@ gethostnameFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
|||
}
|
||||
|
||||
SyscallReturn
|
||||
getcwdFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
||||
getcwdFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
|
||||
{
|
||||
int result = 0;
|
||||
int index = 0;
|
||||
|
@ -336,15 +336,15 @@ getcwdFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
|||
|
||||
/// Target open() handler.
|
||||
SyscallReturn
|
||||
readlinkFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
ThreadContext *tc)
|
||||
readlinkFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
return readlinkFunc(desc, callnum, process, tc, 0);
|
||||
}
|
||||
|
||||
SyscallReturn
|
||||
readlinkFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc,
|
||||
int index)
|
||||
readlinkFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc,
|
||||
int index)
|
||||
{
|
||||
string path;
|
||||
|
||||
|
@ -365,7 +365,7 @@ readlinkFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc,
|
|||
} else {
|
||||
// Emulate readlink() called on '/proc/self/exe' should return the
|
||||
// absolute path of the binary running in the simulated system (the
|
||||
// LiveProcess' executable). It is possible that using this path in
|
||||
// Process' executable). It is possible that using this path in
|
||||
// the simulated system will result in unexpected behavior if:
|
||||
// 1) One binary runs another (e.g., -c time -o "my_binary"), and
|
||||
// called binary calls readlink().
|
||||
|
@ -403,14 +403,14 @@ readlinkFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc,
|
|||
}
|
||||
|
||||
SyscallReturn
|
||||
unlinkFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
||||
unlinkFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
|
||||
{
|
||||
return unlinkHelper(desc, num, p, tc, 0);
|
||||
}
|
||||
|
||||
SyscallReturn
|
||||
unlinkHelper(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc,
|
||||
int index)
|
||||
unlinkHelper(SyscallDesc *desc, int num, Process *p, ThreadContext *tc,
|
||||
int index)
|
||||
{
|
||||
string path;
|
||||
|
||||
|
@ -426,7 +426,7 @@ unlinkHelper(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc,
|
|||
|
||||
|
||||
SyscallReturn
|
||||
mkdirFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
||||
mkdirFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
|
||||
{
|
||||
string path;
|
||||
|
||||
|
@ -444,7 +444,7 @@ mkdirFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
|||
}
|
||||
|
||||
SyscallReturn
|
||||
renameFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
||||
renameFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
|
||||
{
|
||||
string old_name;
|
||||
|
||||
|
@ -466,7 +466,7 @@ renameFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
|||
}
|
||||
|
||||
SyscallReturn
|
||||
truncateFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
||||
truncateFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
|
||||
{
|
||||
string path;
|
||||
|
||||
|
@ -485,7 +485,7 @@ truncateFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
|||
|
||||
SyscallReturn
|
||||
ftruncateFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *process, ThreadContext *tc)
|
||||
Process *process, ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
int tgt_fd = process->getSyscallArg(tc, index);
|
||||
|
@ -501,7 +501,7 @@ ftruncateFunc(SyscallDesc *desc, int num,
|
|||
|
||||
SyscallReturn
|
||||
truncate64Func(SyscallDesc *desc, int num,
|
||||
LiveProcess *process, ThreadContext *tc)
|
||||
Process *process, ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
string path;
|
||||
|
@ -524,7 +524,7 @@ truncate64Func(SyscallDesc *desc, int num,
|
|||
|
||||
SyscallReturn
|
||||
ftruncate64Func(SyscallDesc *desc, int num,
|
||||
LiveProcess *process, ThreadContext *tc)
|
||||
Process *process, ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
int tgt_fd = process->getSyscallArg(tc, index);
|
||||
|
@ -543,7 +543,7 @@ ftruncate64Func(SyscallDesc *desc, int num,
|
|||
}
|
||||
|
||||
SyscallReturn
|
||||
umaskFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc)
|
||||
umaskFunc(SyscallDesc *desc, int num, Process *process, ThreadContext *tc)
|
||||
{
|
||||
// Letting the simulated program change the simulator's umask seems like
|
||||
// a bad idea. Compromise by just returning the current umask but not
|
||||
|
@ -554,7 +554,7 @@ umaskFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc)
|
|||
}
|
||||
|
||||
SyscallReturn
|
||||
chownFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
||||
chownFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
|
||||
{
|
||||
string path;
|
||||
|
||||
|
@ -576,7 +576,7 @@ chownFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
|||
}
|
||||
|
||||
SyscallReturn
|
||||
fchownFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc)
|
||||
fchownFunc(SyscallDesc *desc, int num, Process *process, ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
int tgt_fd = process->getSyscallArg(tc, index);
|
||||
|
@ -597,7 +597,7 @@ fchownFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc)
|
|||
|
||||
|
||||
SyscallReturn
|
||||
dupFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc)
|
||||
dupFunc(SyscallDesc *desc, int num, Process *process, ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
int tgt_fd = process->getSyscallArg(tc, index);
|
||||
|
@ -615,7 +615,7 @@ dupFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc)
|
|||
|
||||
|
||||
SyscallReturn
|
||||
fcntlFunc(SyscallDesc *desc, int num, LiveProcess *process,
|
||||
fcntlFunc(SyscallDesc *desc, int num, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
|
@ -659,7 +659,7 @@ fcntlFunc(SyscallDesc *desc, int num, LiveProcess *process,
|
|||
}
|
||||
|
||||
SyscallReturn
|
||||
fcntl64Func(SyscallDesc *desc, int num, LiveProcess *process,
|
||||
fcntl64Func(SyscallDesc *desc, int num, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
|
@ -691,8 +691,8 @@ fcntl64Func(SyscallDesc *desc, int num, LiveProcess *process,
|
|||
}
|
||||
|
||||
SyscallReturn
|
||||
pipePseudoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
ThreadContext *tc)
|
||||
pipePseudoFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int fds[2], sim_fds[2];
|
||||
int pipe_retval = pipe(fds);
|
||||
|
@ -714,8 +714,8 @@ pipePseudoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
|
||||
|
||||
SyscallReturn
|
||||
getpidPseudoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
ThreadContext *tc)
|
||||
getpidPseudoFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
// Make up a PID. There's no interprocess communication in
|
||||
// fake_syscall mode, so there's no way for a process to know it's
|
||||
|
@ -727,8 +727,8 @@ getpidPseudoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
|
||||
|
||||
SyscallReturn
|
||||
getuidPseudoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
ThreadContext *tc)
|
||||
getuidPseudoFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
// Make up a UID and EUID... it shouldn't matter, and we want the
|
||||
// simulation to be deterministic.
|
||||
|
@ -740,8 +740,8 @@ getuidPseudoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
|
||||
|
||||
SyscallReturn
|
||||
getgidPseudoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
ThreadContext *tc)
|
||||
getgidPseudoFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
// Get current group ID. EGID goes in r20.
|
||||
tc->setIntReg(SyscallPseudoReturnReg, process->egid()); //EGID
|
||||
|
@ -750,7 +750,7 @@ getgidPseudoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
|
||||
|
||||
SyscallReturn
|
||||
setuidFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
setuidFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
// can't fathom why a benchmark would call this.
|
||||
|
@ -760,7 +760,7 @@ setuidFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
}
|
||||
|
||||
SyscallReturn
|
||||
getpidFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
getpidFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
// Make up a PID. There's no interprocess communication in
|
||||
|
@ -772,44 +772,44 @@ getpidFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
}
|
||||
|
||||
SyscallReturn
|
||||
getppidFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
ThreadContext *tc)
|
||||
getppidFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
return process->ppid();
|
||||
}
|
||||
|
||||
SyscallReturn
|
||||
getuidFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
getuidFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
return process->uid(); // UID
|
||||
}
|
||||
|
||||
SyscallReturn
|
||||
geteuidFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
ThreadContext *tc)
|
||||
geteuidFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
return process->euid(); // UID
|
||||
}
|
||||
|
||||
SyscallReturn
|
||||
getgidFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
getgidFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
return process->gid();
|
||||
}
|
||||
|
||||
SyscallReturn
|
||||
getegidFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
ThreadContext *tc)
|
||||
getegidFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
return process->egid();
|
||||
}
|
||||
|
||||
|
||||
SyscallReturn
|
||||
cloneFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
ThreadContext *tc)
|
||||
cloneFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
IntReg flags = process->getSyscallArg(tc, index);
|
||||
|
@ -890,7 +890,7 @@ cloneFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
}
|
||||
|
||||
SyscallReturn
|
||||
fallocateFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
fallocateFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
#if NO_FALLOCATE
|
||||
|
@ -914,8 +914,8 @@ fallocateFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
}
|
||||
|
||||
SyscallReturn
|
||||
accessFunc(SyscallDesc *desc, int callnum, LiveProcess *p, ThreadContext *tc,
|
||||
int index)
|
||||
accessFunc(SyscallDesc *desc, int callnum, Process *p, ThreadContext *tc,
|
||||
int index)
|
||||
{
|
||||
string path;
|
||||
if (!tc->getMemProxy().tryReadString(path, p->getSyscallArg(tc, index)))
|
||||
|
@ -931,7 +931,7 @@ accessFunc(SyscallDesc *desc, int callnum, LiveProcess *p, ThreadContext *tc,
|
|||
}
|
||||
|
||||
SyscallReturn
|
||||
accessFunc(SyscallDesc *desc, int callnum, LiveProcess *p, ThreadContext *tc)
|
||||
accessFunc(SyscallDesc *desc, int callnum, Process *p, ThreadContext *tc)
|
||||
{
|
||||
return accessFunc(desc, callnum, p, tc, 0);
|
||||
}
|
||||
|
|
|
@ -108,180 +108,180 @@ class SyscallDesc;
|
|||
|
||||
/// Handler for unimplemented syscalls that we haven't thought about.
|
||||
SyscallReturn unimplementedFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
/// Handler for unimplemented syscalls that we never intend to
|
||||
/// implement (signal handling, etc.) and should not affect the correct
|
||||
/// behavior of the program. Print a warning only if the appropriate
|
||||
/// trace flag is enabled. Return success to the target program.
|
||||
SyscallReturn ignoreFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
// Target fallocateFunc() handler.
|
||||
SyscallReturn fallocateFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
/// Target exit() handler: terminate current context.
|
||||
SyscallReturn exitFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
/// Target exit_group() handler: terminate simulation. (exit all threads)
|
||||
SyscallReturn exitGroupFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
/// Target getpagesize() handler.
|
||||
SyscallReturn getpagesizeFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
/// Target brk() handler: set brk address.
|
||||
SyscallReturn brkFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
/// Target close() handler.
|
||||
SyscallReturn closeFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
/// Target read() handler.
|
||||
SyscallReturn readFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
/// Target write() handler.
|
||||
SyscallReturn writeFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
/// Target lseek() handler.
|
||||
SyscallReturn lseekFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
/// Target _llseek() handler.
|
||||
SyscallReturn _llseekFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
/// Target munmap() handler.
|
||||
SyscallReturn munmapFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
/// Target gethostname() handler.
|
||||
SyscallReturn gethostnameFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
/// Target getcwd() handler.
|
||||
SyscallReturn getcwdFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
/// Target readlink() handler.
|
||||
SyscallReturn readlinkFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc,
|
||||
Process *p, ThreadContext *tc,
|
||||
int index = 0);
|
||||
SyscallReturn readlinkFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
/// Target unlink() handler.
|
||||
SyscallReturn unlinkHelper(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc,
|
||||
Process *p, ThreadContext *tc,
|
||||
int index);
|
||||
SyscallReturn unlinkFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
/// Target mkdir() handler.
|
||||
SyscallReturn mkdirFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
/// Target rename() handler.
|
||||
SyscallReturn renameFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
|
||||
/// Target truncate() handler.
|
||||
SyscallReturn truncateFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
|
||||
/// Target ftruncate() handler.
|
||||
SyscallReturn ftruncateFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
|
||||
/// Target truncate64() handler.
|
||||
SyscallReturn truncate64Func(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
/// Target ftruncate64() handler.
|
||||
SyscallReturn ftruncate64Func(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
|
||||
/// Target umask() handler.
|
||||
SyscallReturn umaskFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
|
||||
/// Target chown() handler.
|
||||
SyscallReturn chownFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
|
||||
/// Target fchown() handler.
|
||||
SyscallReturn fchownFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
/// Target dup() handler.
|
||||
SyscallReturn dupFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *process, ThreadContext *tc);
|
||||
Process *process, ThreadContext *tc);
|
||||
|
||||
/// Target fnctl() handler.
|
||||
SyscallReturn fcntlFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *process, ThreadContext *tc);
|
||||
Process *process, ThreadContext *tc);
|
||||
|
||||
/// Target fcntl64() handler.
|
||||
SyscallReturn fcntl64Func(SyscallDesc *desc, int num,
|
||||
LiveProcess *process, ThreadContext *tc);
|
||||
Process *process, ThreadContext *tc);
|
||||
|
||||
/// Target setuid() handler.
|
||||
SyscallReturn setuidFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
/// Target getpid() handler.
|
||||
SyscallReturn getpidFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
/// Target getuid() handler.
|
||||
SyscallReturn getuidFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
/// Target getgid() handler.
|
||||
SyscallReturn getgidFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
/// Target getppid() handler.
|
||||
SyscallReturn getppidFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
/// Target geteuid() handler.
|
||||
SyscallReturn geteuidFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
/// Target getegid() handler.
|
||||
SyscallReturn getegidFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
/// Target clone() handler.
|
||||
SyscallReturn cloneFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
/// Target access() handler
|
||||
SyscallReturn accessFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
SyscallReturn accessFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc,
|
||||
int index);
|
||||
Process *p, ThreadContext *tc,
|
||||
int index);
|
||||
|
||||
/// Futex system call
|
||||
/// Implemented by Daniel Sanchez
|
||||
/// Used by printf's in multi-threaded apps
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
futexFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
futexFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index_uaddr = 0;
|
||||
|
@ -362,19 +362,19 @@ futexFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
/// Pseudo Funcs - These functions use a different return convension,
|
||||
/// returning a second value in a register other than the normal return register
|
||||
SyscallReturn pipePseudoFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *process, ThreadContext *tc);
|
||||
Process *process, ThreadContext *tc);
|
||||
|
||||
/// Target getpidPseudo() handler.
|
||||
SyscallReturn getpidPseudoFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
/// Target getuidPseudo() handler.
|
||||
SyscallReturn getuidPseudoFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
/// Target getgidPseudo() handler.
|
||||
SyscallReturn getgidPseudoFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
Process *p, ThreadContext *tc);
|
||||
|
||||
|
||||
/// A readable name for 1,000,000, for converting microseconds to seconds.
|
||||
|
@ -570,7 +570,7 @@ copyOutStatfsBuf(SETranslatingPortProxy &mem, Addr addr,
|
|||
/// not TTYs to provide repeatable results.
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
ioctlFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
ioctlFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
|
@ -601,7 +601,7 @@ ioctlFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
|
||||
template <class OS>
|
||||
static SyscallReturn
|
||||
openFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
openFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc, int index)
|
||||
{
|
||||
std::string path;
|
||||
|
@ -677,7 +677,7 @@ openFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
/// Target open() handler.
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
openFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
openFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
return openFunc<OS>(desc, callnum, process, tc, 0);
|
||||
|
@ -686,8 +686,8 @@ openFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
/// Target openat() handler.
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
openatFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
ThreadContext *tc)
|
||||
openatFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
int dirfd = process->getSyscallArg(tc, index);
|
||||
|
@ -699,7 +699,7 @@ openatFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
/// Target unlinkat() handler.
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
unlinkatFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
unlinkatFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
|
@ -713,8 +713,8 @@ unlinkatFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
/// Target facessat() handler
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
faccessatFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
ThreadContext *tc)
|
||||
faccessatFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
int dirfd = process->getSyscallArg(tc, index);
|
||||
|
@ -726,8 +726,8 @@ faccessatFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
/// Target readlinkat() handler
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
readlinkatFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
ThreadContext *tc)
|
||||
readlinkatFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
int dirfd = process->getSyscallArg(tc, index);
|
||||
|
@ -739,7 +739,7 @@ readlinkatFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
/// Target renameat() handler.
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
renameatFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
renameatFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
|
@ -775,8 +775,8 @@ renameatFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
/// Target sysinfo() handler.
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
sysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
ThreadContext *tc)
|
||||
sysinfoFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
|
||||
int index = 0;
|
||||
|
@ -795,7 +795,7 @@ sysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
/// Target chmod() handler.
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
chmodFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
chmodFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
std::string path;
|
||||
|
@ -827,7 +827,7 @@ chmodFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
/// Target fchmod() handler.
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
fchmodFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
fchmodFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
|
@ -854,7 +854,7 @@ fchmodFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
/// Target mremap() handler.
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
mremapFunc(SyscallDesc *desc, int callnum, LiveProcess *process, ThreadContext *tc)
|
||||
mremapFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
Addr start = process->getSyscallArg(tc, index);
|
||||
|
@ -920,7 +920,7 @@ mremapFunc(SyscallDesc *desc, int callnum, LiveProcess *process, ThreadContext *
|
|||
/// Target stat() handler.
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
statFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
statFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
std::string path;
|
||||
|
@ -950,7 +950,7 @@ statFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
/// Target stat64() handler.
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
stat64Func(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
stat64Func(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
std::string path;
|
||||
|
@ -984,7 +984,7 @@ stat64Func(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
/// Target fstatat64() handler.
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
fstatat64Func(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
fstatat64Func(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
|
@ -1021,7 +1021,7 @@ fstatat64Func(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
/// Target fstat64() handler.
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
fstat64Func(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
fstat64Func(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
|
@ -1052,7 +1052,7 @@ fstat64Func(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
/// Target lstat() handler.
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
lstatFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
lstatFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
std::string path;
|
||||
|
@ -1081,7 +1081,7 @@ lstatFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
/// Target lstat64() handler.
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
lstat64Func(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
lstat64Func(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
std::string path;
|
||||
|
@ -1115,7 +1115,7 @@ lstat64Func(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
/// Target fstat() handler.
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
fstatFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
fstatFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
|
@ -1143,7 +1143,7 @@ fstatFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
/// Target statfs() handler.
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
statfsFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
statfsFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
#if NO_STATFS
|
||||
|
@ -1176,7 +1176,7 @@ statfsFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
/// Target fstatfs() handler.
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
fstatfsFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
fstatfsFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
|
@ -1202,7 +1202,7 @@ fstatfsFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
/// Target writev() handler.
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
writevFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
writevFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
|
@ -1241,7 +1241,7 @@ writevFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
/// Real mmap handler.
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
mmapImpl(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc,
|
||||
mmapImpl(SyscallDesc *desc, int num, Process *p, ThreadContext *tc,
|
||||
bool is_mmap2)
|
||||
{
|
||||
int index = 0;
|
||||
|
@ -1414,7 +1414,7 @@ mmapImpl(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc,
|
|||
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
pwrite64Func(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
||||
pwrite64Func(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
int tgt_fd = p->getSyscallArg(tc, index);
|
||||
|
@ -1437,7 +1437,7 @@ pwrite64Func(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
|||
/// Target mmap() handler.
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
mmapFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
||||
mmapFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
|
||||
{
|
||||
return mmapImpl<OS>(desc, num, p, tc, false);
|
||||
}
|
||||
|
@ -1445,7 +1445,7 @@ mmapFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
|||
/// Target mmap2() handler.
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
mmap2Func(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
||||
mmap2Func(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
|
||||
{
|
||||
return mmapImpl<OS>(desc, num, p, tc, true);
|
||||
}
|
||||
|
@ -1453,8 +1453,8 @@ mmap2Func(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
|||
/// Target getrlimit() handler.
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
getrlimitFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
ThreadContext *tc)
|
||||
getrlimitFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
unsigned resource = process->getSyscallArg(tc, index);
|
||||
|
@ -1488,7 +1488,7 @@ getrlimitFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
/// Target clock_gettime() function.
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
clock_gettimeFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
||||
clock_gettimeFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
|
||||
{
|
||||
int index = 1;
|
||||
//int clk_id = p->getSyscallArg(tc, index);
|
||||
|
@ -1507,7 +1507,7 @@ clock_gettimeFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
|||
/// Target clock_getres() function.
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
clock_getresFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
||||
clock_getresFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
|
||||
{
|
||||
int index = 1;
|
||||
TypedBufferArg<typename OS::timespec> tp(p->getSyscallArg(tc, index));
|
||||
|
@ -1524,8 +1524,8 @@ clock_getresFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
|||
/// Target gettimeofday() handler.
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
gettimeofdayFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
ThreadContext *tc)
|
||||
gettimeofdayFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
TypedBufferArg<typename OS::timeval> tp(process->getSyscallArg(tc, index));
|
||||
|
@ -1544,7 +1544,7 @@ gettimeofdayFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
/// Target utimes() handler.
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
utimesFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
utimesFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
std::string path;
|
||||
|
@ -1579,7 +1579,7 @@ utimesFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
/// Target getrusage() function.
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
getrusageFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
getrusageFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
|
@ -1631,8 +1631,8 @@ getrusageFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
/// Target times() function.
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
timesFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
ThreadContext *tc)
|
||||
timesFunc(SyscallDesc *desc, int callnum, Process *process,
|
||||
ThreadContext *tc)
|
||||
{
|
||||
int index = 0;
|
||||
TypedBufferArg<typename OS::tms> bufp(process->getSyscallArg(tc, index));
|
||||
|
@ -1657,8 +1657,7 @@ timesFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
/// Target time() function.
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
timeFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
||||
ThreadContext *tc)
|
||||
timeFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc)
|
||||
{
|
||||
typename OS::time_t sec, usec;
|
||||
getElapsedTimeMicro(sec, usec);
|
||||
|
|
|
@ -30,5 +30,5 @@ m5.util.addToPath('../configs/common')
|
|||
from cpu2000 import mcf
|
||||
|
||||
workload = mcf(isa, opsys, 'smred')
|
||||
root.system.cpu[0].workload = workload.makeLiveProcess()
|
||||
root.system.cpu[0].workload = workload.makeProcess()
|
||||
root.system.physmem.range=AddrRange('256MB')
|
||||
|
|
|
@ -30,4 +30,4 @@ m5.util.addToPath('../configs/common')
|
|||
from cpu2000 import parser
|
||||
|
||||
workload = parser(isa, opsys, 'mdred')
|
||||
root.system.cpu[0].workload = workload.makeLiveProcess()
|
||||
root.system.cpu[0].workload = workload.makeProcess()
|
||||
|
|
|
@ -30,4 +30,4 @@ m5.util.addToPath('../configs/common')
|
|||
from cpu2000 import eon_cook
|
||||
|
||||
workload = eon_cook(isa, opsys, 'mdred')
|
||||
root.system.cpu[0].workload = workload.makeLiveProcess()
|
||||
root.system.cpu[0].workload = workload.makeProcess()
|
||||
|
|
|
@ -30,4 +30,4 @@ m5.util.addToPath('../configs/common')
|
|||
from cpu2000 import perlbmk_makerand
|
||||
|
||||
workload = perlbmk_makerand(isa, opsys, 'mdred')
|
||||
root.system.cpu[0].workload = workload.makeLiveProcess()
|
||||
root.system.cpu[0].workload = workload.makeProcess()
|
||||
|
|
|
@ -30,4 +30,4 @@ m5.util.addToPath('../configs/common')
|
|||
from cpu2000 import vortex
|
||||
|
||||
workload = vortex(isa, opsys, 'smred')
|
||||
root.system.cpu[0].workload = workload.makeLiveProcess()
|
||||
root.system.cpu[0].workload = workload.makeProcess()
|
||||
|
|
|
@ -30,4 +30,4 @@ m5.util.addToPath('../configs/common')
|
|||
from cpu2000 import bzip2_source
|
||||
|
||||
workload = bzip2_source(isa, opsys, 'lgred')
|
||||
root.system.cpu[0].workload = workload.makeLiveProcess()
|
||||
root.system.cpu[0].workload = workload.makeProcess()
|
||||
|
|
|
@ -31,7 +31,7 @@ from cpu2000 import twolf
|
|||
import os
|
||||
|
||||
workload = twolf(isa, opsys, 'smred')
|
||||
root.system.cpu[0].workload = workload.makeLiveProcess()
|
||||
root.system.cpu[0].workload = workload.makeProcess()
|
||||
cwd = root.system.cpu[0].workload[0].cwd
|
||||
|
||||
#Remove two files who's presence or absence affects execution
|
||||
|
|
|
@ -35,10 +35,10 @@ benchmarks = [
|
|||
]
|
||||
|
||||
for i, cpu in zip(range(len(cpus)), root.system.cpu):
|
||||
p = LiveProcess()
|
||||
p = Process()
|
||||
p.executable = benchmarks[i*2]
|
||||
p.cmd = benchmarks[(i*2)+1]
|
||||
root.system.cpu[i].workload = p
|
||||
root.system.cpu[i].max_insts_all_threads = 10000000
|
||||
#root.system.cpu.workload = LiveProcess(cmd = 'hello',
|
||||
# executable = binpath('hello'))
|
||||
#root.system.cpu.workload = Process(cmd = 'hello',
|
||||
# executable = binpath('hello'))
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#
|
||||
# Authors: Steve Reinhardt
|
||||
|
||||
root.system.cpu[0].workload = LiveProcess(cmd = 'hello',
|
||||
executable = binpath('hello'))
|
||||
root.system.cpu[0].workload = Process(cmd = 'hello',
|
||||
executable = binpath('hello'))
|
||||
if root.system.cpu[0].checker != NULL:
|
||||
root.system.cpu[0].checker.workload = root.system.cpu[0].workload
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#
|
||||
# Authors: Korey Sewell
|
||||
|
||||
process1 = LiveProcess(cmd = 'hello', executable = binpath('hello'))
|
||||
process2 = LiveProcess(cmd = 'hello', executable = binpath('hello'))
|
||||
process1 = Process(cmd = 'hello', executable = binpath('hello'))
|
||||
process2 = Process(cmd = 'hello', executable = binpath('hello'))
|
||||
|
||||
root.system.cpu[0].workload = [process1, process2]
|
||||
|
|
|
@ -26,5 +26,5 @@
|
|||
#
|
||||
# Authors: Ali Saidi
|
||||
|
||||
root.system.cpu[0].workload = LiveProcess(cmd = 'insttest',
|
||||
executable = binpath('insttest'))
|
||||
root.system.cpu[0].workload = Process(cmd = 'insttest',
|
||||
executable = binpath('insttest'))
|
||||
|
|
|
@ -42,7 +42,7 @@ else:
|
|||
|
||||
driver = ClDriver(filename="hsa", codefile=kernel_files)
|
||||
root.system.cpu[2].cl_driver = driver
|
||||
root.system.cpu[0].workload = LiveProcess(cmd = 'gpu-hello',
|
||||
executable = binpath('gpu-hello'),
|
||||
drivers = [driver])
|
||||
root.system.cpu[0].workload = Process(cmd = 'gpu-hello',
|
||||
executable = binpath('gpu-hello'),
|
||||
drivers = [driver])
|
||||
|
||||
|
|
|
@ -30,5 +30,5 @@ m5.util.addToPath('../configs/common')
|
|||
from cpu2000 import mcf
|
||||
|
||||
workload = mcf(isa, opsys, 'smred')
|
||||
root.system.cpu[0].workload = workload.makeLiveProcess()
|
||||
root.system.cpu[0].workload = workload.makeProcess()
|
||||
root.system.physmem.range=AddrRange('256MB')
|
||||
|
|
|
@ -30,4 +30,4 @@ m5.util.addToPath('../configs/common')
|
|||
from cpu2000 import eon_cook
|
||||
|
||||
workload = eon_cook(isa, opsys, 'mdred')
|
||||
root.system.cpu[0].workload = workload.makeLiveProcess()
|
||||
root.system.cpu[0].workload = workload.makeProcess()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
process = LiveProcess(executable = binpath('m5threads', 'test_atomic'),
|
||||
cmd = ['test_atomic', str(nb_cores)])
|
||||
process = Process(executable = binpath('m5threads', 'test_atomic'),
|
||||
cmd = ['test_atomic', str(nb_cores)])
|
||||
|
||||
for i in range(nb_cores):
|
||||
root.system.cpu[i].workload = process
|
||||
|
|
|
@ -30,4 +30,4 @@ m5.util.addToPath('../configs/common')
|
|||
from cpu2000 import vortex
|
||||
|
||||
workload = vortex(isa, opsys, 'smred')
|
||||
root.system.cpu[0].workload = workload.makeLiveProcess()
|
||||
root.system.cpu[0].workload = workload.makeProcess()
|
||||
|
|
|
@ -31,7 +31,7 @@ from cpu2000 import twolf
|
|||
import os
|
||||
|
||||
workload = twolf(isa, opsys, 'smred')
|
||||
root.system.cpu[0].workload = workload.makeLiveProcess()
|
||||
root.system.cpu[0].workload = workload.makeProcess()
|
||||
cwd = root.system.cpu[0].workload[0].cwd
|
||||
|
||||
#Remove two files who's presence or absence affects execution
|
||||
|
|
Loading…
Reference in a new issue