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:
Brandon Potter
2016-11-09 14:27:40 -06:00
parent 7b6cf951e2
commit 3886c4a8f2
73 changed files with 582 additions and 644 deletions

View File

@@ -32,7 +32,6 @@ from m5.proxy import *
class Process(SimObject):
type = 'Process'
abstract = True
cxx_header = "sim/process.hh"
input = Param.String('cin', "filename for stdin")
output = Param.String('cout', 'filename for stdout')
@@ -50,19 +49,6 @@ class Process(SimObject):
pid = Param.Int(100, 'process id')
ppid = Param.Int(99, 'parent process id')
@classmethod
def export_methods(cls, code):
code('bool map(Addr vaddr, Addr paddr, int size, bool cacheable=true);')
class EmulatedDriver(SimObject):
type = 'EmulatedDriver'
cxx_header = "sim/emul_driver.hh"
abstract = True
filename = Param.String("device file name (under /dev)")
class LiveProcess(Process):
type = 'LiveProcess'
cxx_header = "sim/process.hh"
executable = Param.String('', "executable (overrides cmd[0] if set)")
cmd = VectorParam.String("command line (executable plus arguments)")
env = VectorParam.String([], "environment settings")
@@ -70,3 +56,12 @@ class LiveProcess(Process):
simpoint = Param.UInt64(0, 'simulation point at which to start simulation')
drivers = VectorParam.EmulatedDriver([], 'Available emulated drivers')
@classmethod
def export_methods(cls, code):
code('bool map(Addr vaddr, Addr paddr, int sz, bool cacheable=true);')
class EmulatedDriver(SimObject):
type = 'EmulatedDriver'
cxx_header = "sim/emul_driver.hh"
abstract = True
filename = Param.String("device file name (under /dev)")

View File

@@ -36,7 +36,7 @@
#include "params/EmulatedDriver.hh"
#include "sim/sim_object.hh"
class LiveProcess;
class Process;
class ThreadContext;
/**
@@ -74,7 +74,7 @@ class EmulatedDriver : public SimObject
* to openFunc() (q.v.).
* @return A newly allocated target fd, or -1 on error.
*/
virtual int open(LiveProcess *p, ThreadContext *tc,
virtual int open(Process *p, ThreadContext *tc,
int mode, int flags) = 0;
/**
@@ -84,7 +84,7 @@ class EmulatedDriver : public SimObject
* @return The return code for the ioctl, or the negation of the errno
* (see the SyscallReturn class).
*/
virtual int ioctl(LiveProcess *p, ThreadContext *tc, unsigned req) = 0;
virtual int ioctl(Process *p, ThreadContext *tc, unsigned req) = 0;
/**
* Virtual method, invoked when the user program calls mmap() on
@@ -93,7 +93,7 @@ class EmulatedDriver : public SimObject
* @return The return ptr for the mmap, or the negation of the errno
* (see the SyscallReturn class).
*/
virtual Addr mmap(LiveProcess *p, ThreadContext *tc, Addr start,
virtual Addr mmap(Process *p, ThreadContext *tc, Addr start,
uint64_t length, int prot, int tgtFlags, int tgtFd,
int offset) { return -EBADF; }
};

View File

@@ -61,7 +61,6 @@
#include "cpu/thread_context.hh"
#include "mem/page_table.hh"
#include "mem/se_translating_port_proxy.hh"
#include "params/LiveProcess.hh"
#include "params/Process.hh"
#include "sim/emul_driver.hh"
#include "sim/syscall_desc.hh"
@@ -126,7 +125,7 @@ openOutputFile(const string &filename)
return openFile(filename, O_WRONLY | O_CREAT | O_TRUNC, 0664);
}
Process::Process(ProcessParams * params)
Process::Process(ProcessParams * params, ObjectFile * obj_file)
: SimObject(params), system(params->system),
brk_point(0), stack_base(0), stack_size(0), stack_min(0),
max_stack_size(params->max_stack_size),
@@ -148,9 +147,13 @@ Process::Process(ProcessParams * params)
{"stdout", STDOUT_FILENO},
{"cerr", STDERR_FILENO},
{"stderr", STDERR_FILENO}},
objFile(obj_file),
argv(params->cmd), envp(params->env), cwd(params->cwd),
executable(params->executable),
_uid(params->uid), _euid(params->euid),
_gid(params->gid), _egid(params->egid),
_pid(params->pid), _ppid(params->ppid)
_pid(params->pid), _ppid(params->ppid),
drivers(params->drivers)
{
int sim_fd;
std::map<string,int>::iterator it;
@@ -188,6 +191,19 @@ Process::Process(ProcessParams * params)
mmap_end = 0;
nxm_start = nxm_end = 0;
// other parameters will be initialized when the program is loaded
// load up symbols, if any... these may be used for debugging or
// profiling.
if (!debugSymbolTable) {
debugSymbolTable = new SymbolTable();
if (!objFile->loadGlobalSymbols(debugSymbolTable) ||
!objFile->loadLocalSymbols(debugSymbolTable) ||
!objFile->loadWeakSymbols(debugSymbolTable)) {
// didn't load any symbols
delete debugSymbolTable;
debugSymbolTable = NULL;
}
}
}
@@ -496,36 +512,8 @@ Process::map(Addr vaddr, Addr paddr, int size, bool cacheable)
}
////////////////////////////////////////////////////////////////////////
//
// LiveProcess member definitions
//
////////////////////////////////////////////////////////////////////////
LiveProcess::LiveProcess(LiveProcessParams *params, ObjectFile *_objFile)
: Process(params), objFile(_objFile),
argv(params->cmd), envp(params->env), cwd(params->cwd),
executable(params->executable),
drivers(params->drivers)
{
// load up symbols, if any... these may be used for debugging or
// profiling.
if (!debugSymbolTable) {
debugSymbolTable = new SymbolTable();
if (!objFile->loadGlobalSymbols(debugSymbolTable) ||
!objFile->loadLocalSymbols(debugSymbolTable) ||
!objFile->loadWeakSymbols(debugSymbolTable)) {
// didn't load any symbols
delete debugSymbolTable;
debugSymbolTable = NULL;
}
}
}
void
LiveProcess::syscall(int64_t callnum, ThreadContext *tc)
Process::syscall(int64_t callnum, ThreadContext *tc)
{
num_syscalls++;
@@ -537,14 +525,14 @@ LiveProcess::syscall(int64_t callnum, ThreadContext *tc)
}
IntReg
LiveProcess::getSyscallArg(ThreadContext *tc, int &i, int width)
Process::getSyscallArg(ThreadContext *tc, int &i, int width)
{
return getSyscallArg(tc, i);
}
EmulatedDriver *
LiveProcess::findDriver(std::string filename)
Process::findDriver(std::string filename)
{
for (EmulatedDriver *d : drivers) {
if (d->match(filename))
@@ -555,7 +543,7 @@ LiveProcess::findDriver(std::string filename)
}
void
LiveProcess::updateBias()
Process::updateBias()
{
ObjectFile *interp = objFile->getInterpreter();
@@ -580,14 +568,14 @@ LiveProcess::updateBias()
ObjectFile *
LiveProcess::getInterpreter()
Process::getInterpreter()
{
return objFile->getInterpreter();
}
Addr
LiveProcess::getBias()
Process::getBias()
{
ObjectFile *interp = getInterpreter();
@@ -596,7 +584,7 @@ LiveProcess::getBias()
Addr
LiveProcess::getStartPC()
Process::getStartPC()
{
ObjectFile *interp = getInterpreter();
@@ -604,74 +592,74 @@ LiveProcess::getStartPC()
}
LiveProcess *
LiveProcess::create(LiveProcessParams * params)
Process *
ProcessParams::create()
{
LiveProcess *process = NULL;
Process *process = NULL;
// If not specified, set the executable parameter equal to the
// simulated system's zeroth command line parameter
if (params->executable == "") {
params->executable = params->cmd[0];
if (executable == "") {
executable = cmd[0];
}
ObjectFile *objFile = createObjectFile(params->executable);
if (objFile == NULL) {
fatal("Can't load object file %s", params->executable);
ObjectFile *obj_file = createObjectFile(executable);
if (obj_file == NULL) {
fatal("Can't load object file %s", executable);
}
#if THE_ISA == ALPHA_ISA
if (objFile->getArch() != ObjectFile::Alpha)
if (obj_file->getArch() != ObjectFile::Alpha)
fatal("Object file architecture does not match compiled ISA (Alpha).");
switch (objFile->getOpSys()) {
switch (obj_file->getOpSys()) {
case ObjectFile::UnknownOpSys:
warn("Unknown operating system; assuming Linux.");
// fall through
case ObjectFile::Linux:
process = new AlphaLinuxProcess(params, objFile);
process = new AlphaLinuxProcess(this, obj_file);
break;
default:
fatal("Unknown/unsupported operating system.");
}
#elif THE_ISA == SPARC_ISA
if (objFile->getArch() != ObjectFile::SPARC64 &&
objFile->getArch() != ObjectFile::SPARC32)
if (obj_file->getArch() != ObjectFile::SPARC64 &&
obj_file->getArch() != ObjectFile::SPARC32)
fatal("Object file architecture does not match compiled ISA (SPARC).");
switch (objFile->getOpSys()) {
switch (obj_file->getOpSys()) {
case ObjectFile::UnknownOpSys:
warn("Unknown operating system; assuming Linux.");
// fall through
case ObjectFile::Linux:
if (objFile->getArch() == ObjectFile::SPARC64) {
process = new Sparc64LinuxProcess(params, objFile);
if (obj_file->getArch() == ObjectFile::SPARC64) {
process = new Sparc64LinuxProcess(this, obj_file);
} else {
process = new Sparc32LinuxProcess(params, objFile);
process = new Sparc32LinuxProcess(this, obj_file);
}
break;
case ObjectFile::Solaris:
process = new SparcSolarisProcess(params, objFile);
process = new SparcSolarisProcess(this, obj_file);
break;
default:
fatal("Unknown/unsupported operating system.");
}
#elif THE_ISA == X86_ISA
if (objFile->getArch() != ObjectFile::X86_64 &&
objFile->getArch() != ObjectFile::I386)
if (obj_file->getArch() != ObjectFile::X86_64 &&
obj_file->getArch() != ObjectFile::I386)
fatal("Object file architecture does not match compiled ISA (x86).");
switch (objFile->getOpSys()) {
switch (obj_file->getOpSys()) {
case ObjectFile::UnknownOpSys:
warn("Unknown operating system; assuming Linux.");
// fall through
case ObjectFile::Linux:
if (objFile->getArch() == ObjectFile::X86_64) {
process = new X86_64LinuxProcess(params, objFile);
if (obj_file->getArch() == ObjectFile::X86_64) {
process = new X86_64LinuxProcess(this, obj_file);
} else {
process = new I386LinuxProcess(params, objFile);
process = new I386LinuxProcess(this, obj_file);
}
break;
@@ -679,44 +667,44 @@ LiveProcess::create(LiveProcessParams * params)
fatal("Unknown/unsupported operating system.");
}
#elif THE_ISA == MIPS_ISA
if (objFile->getArch() != ObjectFile::Mips)
if (obj_file->getArch() != ObjectFile::Mips)
fatal("Object file architecture does not match compiled ISA (MIPS).");
switch (objFile->getOpSys()) {
switch (obj_file->getOpSys()) {
case ObjectFile::UnknownOpSys:
warn("Unknown operating system; assuming Linux.");
// fall through
case ObjectFile::Linux:
process = new MipsLinuxProcess(params, objFile);
process = new MipsLinuxProcess(this, obj_file);
break;
default:
fatal("Unknown/unsupported operating system.");
}
#elif THE_ISA == ARM_ISA
ObjectFile::Arch arch = objFile->getArch();
ObjectFile::Arch arch = obj_file->getArch();
if (arch != ObjectFile::Arm && arch != ObjectFile::Thumb &&
arch != ObjectFile::Arm64)
fatal("Object file architecture does not match compiled ISA (ARM).");
switch (objFile->getOpSys()) {
switch (obj_file->getOpSys()) {
case ObjectFile::UnknownOpSys:
warn("Unknown operating system; assuming Linux.");
// fall through
case ObjectFile::Linux:
if (arch == ObjectFile::Arm64) {
process = new ArmLinuxProcess64(params, objFile,
objFile->getArch());
process = new ArmLinuxProcess64(this, obj_file,
obj_file->getArch());
} else {
process = new ArmLinuxProcess32(params, objFile,
objFile->getArch());
process = new ArmLinuxProcess32(this, obj_file,
obj_file->getArch());
}
break;
case ObjectFile::FreeBSD:
if (arch == ObjectFile::Arm64) {
process = new ArmFreebsdProcess64(params, objFile,
objFile->getArch());
process = new ArmFreebsdProcess64(this, obj_file,
obj_file->getArch());
} else {
process = new ArmFreebsdProcess32(params, objFile,
objFile->getArch());
process = new ArmFreebsdProcess32(this, obj_file,
obj_file->getArch());
}
break;
case ObjectFile::LinuxArmOABI:
@@ -726,28 +714,28 @@ LiveProcess::create(LiveProcessParams * params)
fatal("Unknown/unsupported operating system.");
}
#elif THE_ISA == POWER_ISA
if (objFile->getArch() != ObjectFile::Power)
if (obj_file->getArch() != ObjectFile::Power)
fatal("Object file architecture does not match compiled ISA (Power).");
switch (objFile->getOpSys()) {
switch (obj_file->getOpSys()) {
case ObjectFile::UnknownOpSys:
warn("Unknown operating system; assuming Linux.");
// fall through
case ObjectFile::Linux:
process = new PowerLinuxProcess(params, objFile);
process = new PowerLinuxProcess(this, obj_file);
break;
default:
fatal("Unknown/unsupported operating system.");
}
#elif THE_ISA == RISCV_ISA
if (objFile->getArch() != ObjectFile::Riscv)
if (obj_file->getArch() != ObjectFile::Riscv)
fatal("Object file architecture does not match compiled ISA (RISCV).");
switch (objFile->getOpSys()) {
switch (obj_file->getOpSys()) {
case ObjectFile::UnknownOpSys:
warn("Unknown operating system; assuming Linux.");
// fall through
case ObjectFile::Linux:
process = new RiscvLinuxProcess(params, objFile);
process = new RiscvLinuxProcess(this, obj_file);
break;
default:
fatal("Unknown/unsupported operating system.");
@@ -760,9 +748,3 @@ LiveProcess::create(LiveProcessParams * params)
fatal("Unknown error creating process object.");
return process;
}
LiveProcess *
LiveProcessParams::create()
{
return LiveProcess::create(this);
}

View File

@@ -46,10 +46,10 @@
#include "sim/fd_entry.hh"
#include "sim/sim_object.hh"
struct LiveProcessParams;
struct ProcessParams;
class EmulatedDriver;
class ObjectFile;
class PageTableBase;
class SyscallDesc;
class SyscallReturn;
@@ -170,9 +170,6 @@ class Process : public SimObject
// Find a free context to use
ThreadContext *findFreeContext();
// provide program name for debug messages
virtual const char *progName() const { return "<unknown>"; }
// generate new target fd for sim_fd
int allocFD(int sim_fd, const std::string& filename, int flags, int mode,
bool pipe);
@@ -202,7 +199,6 @@ class Process : public SimObject
// set the source of this read pipe for a checkpoint resume
void setReadPipeSource(int read_pipe_fd, int source_fd);
virtual void syscall(int64_t callnum, ThreadContext *tc) = 0;
void allocateMem(Addr vaddr, int64_t size, bool clobber = false);
@@ -228,6 +224,15 @@ class Process : public SimObject
void serialize(CheckpointOut &cp) const override;
void unserialize(CheckpointIn &cp) override;
protected:
ObjectFile *objFile;
std::vector<std::string> argv;
std::vector<std::string> envp;
std::string cwd;
std::string executable;
Process(ProcessParams *params, ObjectFile *obj_file);
public:
// Id of the owner of the process
uint64_t _uid;
@@ -239,28 +244,9 @@ class Process : public SimObject
uint64_t _pid;
uint64_t _ppid;
};
//
// "Live" process with system calls redirected to host system
//
class ObjectFile;
class LiveProcess : public Process
{
protected:
ObjectFile *objFile;
std::vector<std::string> argv;
std::vector<std::string> envp;
std::string cwd;
std::string executable;
LiveProcess(LiveProcessParams *params, ObjectFile *objFile);
// Emulated drivers available to this process
std::vector<EmulatedDriver *> drivers;
public:
enum AuxiliaryVectorType {
M5_AT_NULL = 0,
M5_AT_IGNORE = 1,
@@ -299,7 +285,7 @@ class LiveProcess : public Process
inline uint64_t ppid() { return _ppid; }
// provide program name for debug messages
virtual const char *progName() const { return executable.c_str(); }
const char *progName() const { return executable.c_str(); }
std::string
fullPath(const std::string &filename)
@@ -317,7 +303,7 @@ class LiveProcess : public Process
std::string getcwd() const { return cwd; }
virtual void syscall(int64_t callnum, ThreadContext *tc);
void syscall(int64_t callnum, ThreadContext *tc);
virtual TheISA::IntReg getSyscallArg(ThreadContext *tc, int &i) = 0;
virtual TheISA::IntReg getSyscallArg(ThreadContext *tc, int &i, int width);
@@ -345,12 +331,6 @@ class LiveProcess : public Process
Addr getBias();
Addr getStartPC();
// this function is used to create the LiveProcess object, since
// we can't tell which subclass of LiveProcess to use until we
// open and look at the object file.
static LiveProcess *create(LiveProcessParams *params);
};
#endif // __PROCESS_HH__

View File

@@ -42,7 +42,7 @@
#include "sim/syscall_return.hh"
void
SyscallDesc::doSyscall(int callnum, LiveProcess *process, ThreadContext *tc)
SyscallDesc::doSyscall(int callnum, Process *process, ThreadContext *tc)
{
TheISA::IntReg arg[6] M5_VAR_USED;

View File

@@ -48,7 +48,7 @@
#include <string>
class LiveProcess;
class Process;
class SyscallReturn;
class ThreadContext;
@@ -62,7 +62,7 @@ class SyscallDesc {
public:
/** Typedef the function pointer here to clean up code below */
typedef SyscallReturn (*SyscallExecutor)(SyscallDesc*, int num,
LiveProcess*, ThreadContext*);
Process*, ThreadContext*);
SyscallDesc(const char *name, SyscallExecutor sys_exec, int flags = 0)
: _name(name), executor(sys_exec), _flags(flags), _warned(false)
@@ -91,7 +91,7 @@ class SyscallDesc {
* @param proc Handle for the owning Process to pass information
* @param tc Handle for owning ThreadContext to pass information
*/
void doSyscall(int callnum, LiveProcess *proc, ThreadContext *tc);
void doSyscall(int callnum, Process *proc, ThreadContext *tc);
/**
* Return false if WarnOnce is set and a warning has already been issued.

View File

@@ -53,7 +53,7 @@ using namespace std;
using namespace TheISA;
SyscallReturn
unimplementedFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
unimplementedFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
fatal("syscall %s (#%d) unimplemented.", desc->name(), callnum);
@@ -63,7 +63,7 @@ unimplementedFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
SyscallReturn
ignoreFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ignoreFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
if (desc->needWarning()) {
@@ -76,7 +76,7 @@ ignoreFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
SyscallReturn
exitFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
exitFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
if (process->system->numRunningContexts() == 1) {
@@ -94,7 +94,7 @@ exitFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
SyscallReturn
exitGroupFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
exitGroupFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
// halt all threads belonging to this process
@@ -114,14 +114,14 @@ exitGroupFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
SyscallReturn
getpagesizeFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
getpagesizeFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
{
return (int)PageBytes;
}
SyscallReturn
brkFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
brkFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
{
// change brk addr to first arg
int index = 0;
@@ -167,7 +167,7 @@ brkFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
SyscallReturn
closeFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
closeFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
{
int index = 0;
int tgt_fd = p->getSyscallArg(tc, index);
@@ -186,7 +186,7 @@ closeFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
SyscallReturn
readFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
readFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
{
int index = 0;
int tgt_fd = p->getSyscallArg(tc, index);
@@ -207,7 +207,7 @@ readFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
}
SyscallReturn
writeFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
writeFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
{
int index = 0;
int tgt_fd = p->getSyscallArg(tc, index);
@@ -230,7 +230,7 @@ writeFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
SyscallReturn
lseekFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
lseekFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
{
int index = 0;
int tgt_fd = p->getSyscallArg(tc, index);
@@ -248,7 +248,7 @@ lseekFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
SyscallReturn
_llseekFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
_llseekFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
{
int index = 0;
int tgt_fd = p->getSyscallArg(tc, index);
@@ -277,7 +277,7 @@ _llseekFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
SyscallReturn
munmapFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
munmapFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
{
// With mmap more fully implemented, it might be worthwhile to bite
// the bullet and implement munmap. Should allow us to reuse simulated
@@ -289,7 +289,7 @@ munmapFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
const char *hostname = "m5.eecs.umich.edu";
SyscallReturn
gethostnameFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
gethostnameFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
{
int index = 0;
Addr bufPtr = p->getSyscallArg(tc, index);
@@ -304,7 +304,7 @@ gethostnameFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
}
SyscallReturn
getcwdFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
getcwdFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
{
int result = 0;
int index = 0;
@@ -336,15 +336,15 @@ getcwdFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
/// Target open() handler.
SyscallReturn
readlinkFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
readlinkFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
return readlinkFunc(desc, callnum, process, tc, 0);
}
SyscallReturn
readlinkFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc,
int index)
readlinkFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc,
int index)
{
string path;
@@ -365,7 +365,7 @@ readlinkFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc,
} else {
// Emulate readlink() called on '/proc/self/exe' should return the
// absolute path of the binary running in the simulated system (the
// LiveProcess' executable). It is possible that using this path in
// Process' executable). It is possible that using this path in
// the simulated system will result in unexpected behavior if:
// 1) One binary runs another (e.g., -c time -o "my_binary"), and
// called binary calls readlink().
@@ -403,14 +403,14 @@ readlinkFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc,
}
SyscallReturn
unlinkFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
unlinkFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
{
return unlinkHelper(desc, num, p, tc, 0);
}
SyscallReturn
unlinkHelper(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc,
int index)
unlinkHelper(SyscallDesc *desc, int num, Process *p, ThreadContext *tc,
int index)
{
string path;
@@ -426,7 +426,7 @@ unlinkHelper(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc,
SyscallReturn
mkdirFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
mkdirFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
{
string path;
@@ -444,7 +444,7 @@ mkdirFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
}
SyscallReturn
renameFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
renameFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
{
string old_name;
@@ -466,7 +466,7 @@ renameFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
}
SyscallReturn
truncateFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
truncateFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
{
string path;
@@ -485,7 +485,7 @@ truncateFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
SyscallReturn
ftruncateFunc(SyscallDesc *desc, int num,
LiveProcess *process, ThreadContext *tc)
Process *process, ThreadContext *tc)
{
int index = 0;
int tgt_fd = process->getSyscallArg(tc, index);
@@ -501,7 +501,7 @@ ftruncateFunc(SyscallDesc *desc, int num,
SyscallReturn
truncate64Func(SyscallDesc *desc, int num,
LiveProcess *process, ThreadContext *tc)
Process *process, ThreadContext *tc)
{
int index = 0;
string path;
@@ -524,7 +524,7 @@ truncate64Func(SyscallDesc *desc, int num,
SyscallReturn
ftruncate64Func(SyscallDesc *desc, int num,
LiveProcess *process, ThreadContext *tc)
Process *process, ThreadContext *tc)
{
int index = 0;
int tgt_fd = process->getSyscallArg(tc, index);
@@ -543,7 +543,7 @@ ftruncate64Func(SyscallDesc *desc, int num,
}
SyscallReturn
umaskFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc)
umaskFunc(SyscallDesc *desc, int num, Process *process, ThreadContext *tc)
{
// Letting the simulated program change the simulator's umask seems like
// a bad idea. Compromise by just returning the current umask but not
@@ -554,7 +554,7 @@ umaskFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc)
}
SyscallReturn
chownFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
chownFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
{
string path;
@@ -576,7 +576,7 @@ chownFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
}
SyscallReturn
fchownFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc)
fchownFunc(SyscallDesc *desc, int num, Process *process, ThreadContext *tc)
{
int index = 0;
int tgt_fd = process->getSyscallArg(tc, index);
@@ -597,7 +597,7 @@ fchownFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc)
SyscallReturn
dupFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc)
dupFunc(SyscallDesc *desc, int num, Process *process, ThreadContext *tc)
{
int index = 0;
int tgt_fd = process->getSyscallArg(tc, index);
@@ -615,7 +615,7 @@ dupFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc)
SyscallReturn
fcntlFunc(SyscallDesc *desc, int num, LiveProcess *process,
fcntlFunc(SyscallDesc *desc, int num, Process *process,
ThreadContext *tc)
{
int index = 0;
@@ -659,7 +659,7 @@ fcntlFunc(SyscallDesc *desc, int num, LiveProcess *process,
}
SyscallReturn
fcntl64Func(SyscallDesc *desc, int num, LiveProcess *process,
fcntl64Func(SyscallDesc *desc, int num, Process *process,
ThreadContext *tc)
{
int index = 0;
@@ -691,8 +691,8 @@ fcntl64Func(SyscallDesc *desc, int num, LiveProcess *process,
}
SyscallReturn
pipePseudoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
pipePseudoFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
int fds[2], sim_fds[2];
int pipe_retval = pipe(fds);
@@ -714,8 +714,8 @@ pipePseudoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
SyscallReturn
getpidPseudoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
getpidPseudoFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
// Make up a PID. There's no interprocess communication in
// fake_syscall mode, so there's no way for a process to know it's
@@ -727,8 +727,8 @@ getpidPseudoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
SyscallReturn
getuidPseudoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
getuidPseudoFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
// Make up a UID and EUID... it shouldn't matter, and we want the
// simulation to be deterministic.
@@ -740,8 +740,8 @@ getuidPseudoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
SyscallReturn
getgidPseudoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
getgidPseudoFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
// Get current group ID. EGID goes in r20.
tc->setIntReg(SyscallPseudoReturnReg, process->egid()); //EGID
@@ -750,7 +750,7 @@ getgidPseudoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
SyscallReturn
setuidFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
setuidFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
// can't fathom why a benchmark would call this.
@@ -760,7 +760,7 @@ setuidFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
}
SyscallReturn
getpidFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
getpidFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
// Make up a PID. There's no interprocess communication in
@@ -772,44 +772,44 @@ getpidFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
}
SyscallReturn
getppidFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
getppidFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
return process->ppid();
}
SyscallReturn
getuidFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
getuidFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
return process->uid(); // UID
}
SyscallReturn
geteuidFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
geteuidFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
return process->euid(); // UID
}
SyscallReturn
getgidFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
getgidFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
return process->gid();
}
SyscallReturn
getegidFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
getegidFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
return process->egid();
}
SyscallReturn
cloneFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
cloneFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
int index = 0;
IntReg flags = process->getSyscallArg(tc, index);
@@ -890,7 +890,7 @@ cloneFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
}
SyscallReturn
fallocateFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
fallocateFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
#if NO_FALLOCATE
@@ -914,8 +914,8 @@ fallocateFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
}
SyscallReturn
accessFunc(SyscallDesc *desc, int callnum, LiveProcess *p, ThreadContext *tc,
int index)
accessFunc(SyscallDesc *desc, int callnum, Process *p, ThreadContext *tc,
int index)
{
string path;
if (!tc->getMemProxy().tryReadString(path, p->getSyscallArg(tc, index)))
@@ -931,7 +931,7 @@ accessFunc(SyscallDesc *desc, int callnum, LiveProcess *p, ThreadContext *tc,
}
SyscallReturn
accessFunc(SyscallDesc *desc, int callnum, LiveProcess *p, ThreadContext *tc)
accessFunc(SyscallDesc *desc, int callnum, Process *p, ThreadContext *tc)
{
return accessFunc(desc, callnum, p, tc, 0);
}

View File

@@ -108,180 +108,180 @@ class SyscallDesc;
/// Handler for unimplemented syscalls that we haven't thought about.
SyscallReturn unimplementedFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// Handler for unimplemented syscalls that we never intend to
/// implement (signal handling, etc.) and should not affect the correct
/// behavior of the program. Print a warning only if the appropriate
/// trace flag is enabled. Return success to the target program.
SyscallReturn ignoreFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
// Target fallocateFunc() handler.
SyscallReturn fallocateFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// Target exit() handler: terminate current context.
SyscallReturn exitFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// Target exit_group() handler: terminate simulation. (exit all threads)
SyscallReturn exitGroupFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// Target getpagesize() handler.
SyscallReturn getpagesizeFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// Target brk() handler: set brk address.
SyscallReturn brkFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// Target close() handler.
SyscallReturn closeFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// Target read() handler.
SyscallReturn readFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// Target write() handler.
SyscallReturn writeFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// Target lseek() handler.
SyscallReturn lseekFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// Target _llseek() handler.
SyscallReturn _llseekFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// Target munmap() handler.
SyscallReturn munmapFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// Target gethostname() handler.
SyscallReturn gethostnameFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// Target getcwd() handler.
SyscallReturn getcwdFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// Target readlink() handler.
SyscallReturn readlinkFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc,
Process *p, ThreadContext *tc,
int index = 0);
SyscallReturn readlinkFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// Target unlink() handler.
SyscallReturn unlinkHelper(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc,
Process *p, ThreadContext *tc,
int index);
SyscallReturn unlinkFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// Target mkdir() handler.
SyscallReturn mkdirFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// Target rename() handler.
SyscallReturn renameFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// Target truncate() handler.
SyscallReturn truncateFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// Target ftruncate() handler.
SyscallReturn ftruncateFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// Target truncate64() handler.
SyscallReturn truncate64Func(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// Target ftruncate64() handler.
SyscallReturn ftruncate64Func(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// Target umask() handler.
SyscallReturn umaskFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// Target chown() handler.
SyscallReturn chownFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// Target fchown() handler.
SyscallReturn fchownFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// Target dup() handler.
SyscallReturn dupFunc(SyscallDesc *desc, int num,
LiveProcess *process, ThreadContext *tc);
Process *process, ThreadContext *tc);
/// Target fnctl() handler.
SyscallReturn fcntlFunc(SyscallDesc *desc, int num,
LiveProcess *process, ThreadContext *tc);
Process *process, ThreadContext *tc);
/// Target fcntl64() handler.
SyscallReturn fcntl64Func(SyscallDesc *desc, int num,
LiveProcess *process, ThreadContext *tc);
Process *process, ThreadContext *tc);
/// Target setuid() handler.
SyscallReturn setuidFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// Target getpid() handler.
SyscallReturn getpidFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// Target getuid() handler.
SyscallReturn getuidFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// Target getgid() handler.
SyscallReturn getgidFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// Target getppid() handler.
SyscallReturn getppidFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// Target geteuid() handler.
SyscallReturn geteuidFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// Target getegid() handler.
SyscallReturn getegidFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// Target clone() handler.
SyscallReturn cloneFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// Target access() handler
SyscallReturn accessFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
SyscallReturn accessFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc,
int index);
Process *p, ThreadContext *tc,
int index);
/// Futex system call
/// Implemented by Daniel Sanchez
/// Used by printf's in multi-threaded apps
template <class OS>
SyscallReturn
futexFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
futexFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
int index_uaddr = 0;
@@ -362,19 +362,19 @@ futexFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
/// Pseudo Funcs - These functions use a different return convension,
/// returning a second value in a register other than the normal return register
SyscallReturn pipePseudoFunc(SyscallDesc *desc, int num,
LiveProcess *process, ThreadContext *tc);
Process *process, ThreadContext *tc);
/// Target getpidPseudo() handler.
SyscallReturn getpidPseudoFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// Target getuidPseudo() handler.
SyscallReturn getuidPseudoFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// Target getgidPseudo() handler.
SyscallReturn getgidPseudoFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
Process *p, ThreadContext *tc);
/// A readable name for 1,000,000, for converting microseconds to seconds.
@@ -570,7 +570,7 @@ copyOutStatfsBuf(SETranslatingPortProxy &mem, Addr addr,
/// not TTYs to provide repeatable results.
template <class OS>
SyscallReturn
ioctlFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ioctlFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
int index = 0;
@@ -601,7 +601,7 @@ ioctlFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
template <class OS>
static SyscallReturn
openFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
openFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc, int index)
{
std::string path;
@@ -677,7 +677,7 @@ openFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
/// Target open() handler.
template <class OS>
SyscallReturn
openFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
openFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
return openFunc<OS>(desc, callnum, process, tc, 0);
@@ -686,8 +686,8 @@ openFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
/// Target openat() handler.
template <class OS>
SyscallReturn
openatFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
openatFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
int index = 0;
int dirfd = process->getSyscallArg(tc, index);
@@ -699,7 +699,7 @@ openatFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
/// Target unlinkat() handler.
template <class OS>
SyscallReturn
unlinkatFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
unlinkatFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
int index = 0;
@@ -713,8 +713,8 @@ unlinkatFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
/// Target facessat() handler
template <class OS>
SyscallReturn
faccessatFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
faccessatFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
int index = 0;
int dirfd = process->getSyscallArg(tc, index);
@@ -726,8 +726,8 @@ faccessatFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
/// Target readlinkat() handler
template <class OS>
SyscallReturn
readlinkatFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
readlinkatFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
int index = 0;
int dirfd = process->getSyscallArg(tc, index);
@@ -739,7 +739,7 @@ readlinkatFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
/// Target renameat() handler.
template <class OS>
SyscallReturn
renameatFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
renameatFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
int index = 0;
@@ -775,8 +775,8 @@ renameatFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
/// Target sysinfo() handler.
template <class OS>
SyscallReturn
sysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
sysinfoFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
int index = 0;
@@ -795,7 +795,7 @@ sysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
/// Target chmod() handler.
template <class OS>
SyscallReturn
chmodFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
chmodFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
std::string path;
@@ -827,7 +827,7 @@ chmodFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
/// Target fchmod() handler.
template <class OS>
SyscallReturn
fchmodFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
fchmodFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
int index = 0;
@@ -854,7 +854,7 @@ fchmodFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
/// Target mremap() handler.
template <class OS>
SyscallReturn
mremapFunc(SyscallDesc *desc, int callnum, LiveProcess *process, ThreadContext *tc)
mremapFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc)
{
int index = 0;
Addr start = process->getSyscallArg(tc, index);
@@ -920,7 +920,7 @@ mremapFunc(SyscallDesc *desc, int callnum, LiveProcess *process, ThreadContext *
/// Target stat() handler.
template <class OS>
SyscallReturn
statFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
statFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
std::string path;
@@ -950,7 +950,7 @@ statFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
/// Target stat64() handler.
template <class OS>
SyscallReturn
stat64Func(SyscallDesc *desc, int callnum, LiveProcess *process,
stat64Func(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
std::string path;
@@ -984,7 +984,7 @@ stat64Func(SyscallDesc *desc, int callnum, LiveProcess *process,
/// Target fstatat64() handler.
template <class OS>
SyscallReturn
fstatat64Func(SyscallDesc *desc, int callnum, LiveProcess *process,
fstatat64Func(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
int index = 0;
@@ -1021,7 +1021,7 @@ fstatat64Func(SyscallDesc *desc, int callnum, LiveProcess *process,
/// Target fstat64() handler.
template <class OS>
SyscallReturn
fstat64Func(SyscallDesc *desc, int callnum, LiveProcess *process,
fstat64Func(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
int index = 0;
@@ -1052,7 +1052,7 @@ fstat64Func(SyscallDesc *desc, int callnum, LiveProcess *process,
/// Target lstat() handler.
template <class OS>
SyscallReturn
lstatFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
lstatFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
std::string path;
@@ -1081,7 +1081,7 @@ lstatFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
/// Target lstat64() handler.
template <class OS>
SyscallReturn
lstat64Func(SyscallDesc *desc, int callnum, LiveProcess *process,
lstat64Func(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
std::string path;
@@ -1115,7 +1115,7 @@ lstat64Func(SyscallDesc *desc, int callnum, LiveProcess *process,
/// Target fstat() handler.
template <class OS>
SyscallReturn
fstatFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
fstatFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
int index = 0;
@@ -1143,7 +1143,7 @@ fstatFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
/// Target statfs() handler.
template <class OS>
SyscallReturn
statfsFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
statfsFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
#if NO_STATFS
@@ -1176,7 +1176,7 @@ statfsFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
/// Target fstatfs() handler.
template <class OS>
SyscallReturn
fstatfsFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
fstatfsFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
int index = 0;
@@ -1202,7 +1202,7 @@ fstatfsFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
/// Target writev() handler.
template <class OS>
SyscallReturn
writevFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
writevFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
int index = 0;
@@ -1241,7 +1241,7 @@ writevFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
/// Real mmap handler.
template <class OS>
SyscallReturn
mmapImpl(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc,
mmapImpl(SyscallDesc *desc, int num, Process *p, ThreadContext *tc,
bool is_mmap2)
{
int index = 0;
@@ -1414,7 +1414,7 @@ mmapImpl(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc,
template <class OS>
SyscallReturn
pwrite64Func(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
pwrite64Func(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
{
int index = 0;
int tgt_fd = p->getSyscallArg(tc, index);
@@ -1437,7 +1437,7 @@ pwrite64Func(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
/// Target mmap() handler.
template <class OS>
SyscallReturn
mmapFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
mmapFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
{
return mmapImpl<OS>(desc, num, p, tc, false);
}
@@ -1445,7 +1445,7 @@ mmapFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
/// Target mmap2() handler.
template <class OS>
SyscallReturn
mmap2Func(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
mmap2Func(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
{
return mmapImpl<OS>(desc, num, p, tc, true);
}
@@ -1453,8 +1453,8 @@ mmap2Func(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
/// Target getrlimit() handler.
template <class OS>
SyscallReturn
getrlimitFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
getrlimitFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
int index = 0;
unsigned resource = process->getSyscallArg(tc, index);
@@ -1488,7 +1488,7 @@ getrlimitFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
/// Target clock_gettime() function.
template <class OS>
SyscallReturn
clock_gettimeFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
clock_gettimeFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
{
int index = 1;
//int clk_id = p->getSyscallArg(tc, index);
@@ -1507,7 +1507,7 @@ clock_gettimeFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
/// Target clock_getres() function.
template <class OS>
SyscallReturn
clock_getresFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
clock_getresFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
{
int index = 1;
TypedBufferArg<typename OS::timespec> tp(p->getSyscallArg(tc, index));
@@ -1524,8 +1524,8 @@ clock_getresFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
/// Target gettimeofday() handler.
template <class OS>
SyscallReturn
gettimeofdayFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
gettimeofdayFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
int index = 0;
TypedBufferArg<typename OS::timeval> tp(process->getSyscallArg(tc, index));
@@ -1544,7 +1544,7 @@ gettimeofdayFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
/// Target utimes() handler.
template <class OS>
SyscallReturn
utimesFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
utimesFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
std::string path;
@@ -1579,7 +1579,7 @@ utimesFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
/// Target getrusage() function.
template <class OS>
SyscallReturn
getrusageFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
getrusageFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
int index = 0;
@@ -1631,8 +1631,8 @@ getrusageFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
/// Target times() function.
template <class OS>
SyscallReturn
timesFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
timesFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
int index = 0;
TypedBufferArg<typename OS::tms> bufp(process->getSyscallArg(tc, index));
@@ -1657,8 +1657,7 @@ timesFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
/// Target time() function.
template <class OS>
SyscallReturn
timeFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
timeFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc)
{
typename OS::time_t sec, usec;
getElapsedTimeMicro(sec, usec);