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