summaryrefslogtreecommitdiff
path: root/src/arch/x86
diff options
context:
space:
mode:
authorBrandon Potter <brandon.potter@amd.com>2016-11-09 14:27:40 -0600
committerBrandon Potter <brandon.potter@amd.com>2016-11-09 14:27:40 -0600
commit3886c4a8f2e1bfe17cbf7a5a76ba0fc978c6bb48 (patch)
tree5a1ce6cbf42009fc9199c7ecfb068890ca74dbd4 /src/arch/x86
parent7b6cf951e2f0fa70d6599f1e1d03f664b674a75e (diff)
downloadgem5-3886c4a8f2e1bfe17cbf7a5a76ba0fc978c6bb48.tar.xz
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.
Diffstat (limited to 'src/arch/x86')
-rw-r--r--src/arch/x86/linux/process.cc31
-rw-r--r--src/arch/x86/linux/process.hh8
-rw-r--r--src/arch/x86/process.cc58
-rw-r--r--src/arch/x86/process.hh20
4 files changed, 57 insertions, 60 deletions
diff --git a/src/arch/x86/linux/process.cc b/src/arch/x86/linux/process.cc
index e4221511d..cf3a1d3d0 100644
--- a/src/arch/x86/linux/process.cc
+++ b/src/arch/x86/linux/process.cc
@@ -54,7 +54,7 @@ using namespace X86ISA;
/// Target uname() handler.
static SyscallReturn
-unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
+unameFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
int index = 0;
@@ -72,7 +72,7 @@ unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
}
static SyscallReturn
-archPrctlFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
+archPrctlFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
enum ArchPrctlCodes
@@ -139,22 +139,22 @@ struct UserDesc64 {
static SyscallReturn
setThreadArea32Func(SyscallDesc *desc, int callnum,
- LiveProcess *process, ThreadContext *tc)
+ Process *process, ThreadContext *tc)
{
const int minTLSEntry = 6;
const int numTLSEntries = 3;
const int maxTLSEntry = minTLSEntry + numTLSEntries - 1;
- X86LiveProcess *x86lp = dynamic_cast<X86LiveProcess *>(process);
- assert(x86lp);
+ X86Process *x86p = dynamic_cast<X86Process *>(process);
+ assert(x86p);
- assert((maxTLSEntry + 1) * sizeof(uint64_t) <= x86lp->gdtSize());
+ assert((maxTLSEntry + 1) * sizeof(uint64_t) <= x86p->gdtSize());
int argIndex = 0;
TypedBufferArg<UserDesc32> userDesc(process->getSyscallArg(tc, argIndex));
TypedBufferArg<uint64_t>
- gdt(x86lp->gdtStart() + minTLSEntry * sizeof(uint64_t),
- numTLSEntries * sizeof(uint64_t));
+ gdt(x86p->gdtStart() + minTLSEntry * sizeof(uint64_t),
+ numTLSEntries * sizeof(uint64_t));
if (!userDesc.copyIn(tc->getMemProxy()))
return -EFAULT;
@@ -536,10 +536,10 @@ static SyscallDesc syscallDescs64[] = {
/* 313 */ SyscallDesc("finit_module", unimplementedFunc),
};
-X86_64LinuxProcess::X86_64LinuxProcess(LiveProcessParams * params,
- ObjectFile *objFile)
- : X86_64LiveProcess(params, objFile, syscallDescs64,
- sizeof(syscallDescs64) / sizeof(SyscallDesc))
+X86_64LinuxProcess::X86_64LinuxProcess(ProcessParams * params,
+ ObjectFile *objFile)
+ : X86_64Process(params, objFile, syscallDescs64,
+ sizeof(syscallDescs64) / sizeof(SyscallDesc))
{}
static SyscallDesc syscallDescs32[] = {
@@ -869,8 +869,7 @@ static SyscallDesc syscallDescs32[] = {
/* 323 */ SyscallDesc("eventfd", unimplementedFunc)
};
-I386LinuxProcess::I386LinuxProcess(LiveProcessParams * params,
- ObjectFile *objFile)
- : I386LiveProcess(params, objFile, syscallDescs32,
- sizeof(syscallDescs32) / sizeof(SyscallDesc))
+I386LinuxProcess::I386LinuxProcess(ProcessParams * params, ObjectFile *objFile)
+ : I386Process(params, objFile, syscallDescs32,
+ sizeof(syscallDescs32) / sizeof(SyscallDesc))
{}
diff --git a/src/arch/x86/linux/process.hh b/src/arch/x86/linux/process.hh
index 69cdf01f2..70370960b 100644
--- a/src/arch/x86/linux/process.hh
+++ b/src/arch/x86/linux/process.hh
@@ -46,18 +46,18 @@
namespace X86ISA {
-class X86_64LinuxProcess : public X86_64LiveProcess
+class X86_64LinuxProcess : public X86_64Process
{
public:
/// Constructor.
- X86_64LinuxProcess(LiveProcessParams * params, ObjectFile *objFile);
+ X86_64LinuxProcess(ProcessParams * params, ObjectFile *objFile);
};
-class I386LinuxProcess : public I386LiveProcess
+class I386LinuxProcess : public I386Process
{
public:
/// Constructor.
- I386LinuxProcess(LiveProcessParams * params, ObjectFile *objFile);
+ I386LinuxProcess(ProcessParams * params, ObjectFile *objFile);
};
} // namespace X86ISA
diff --git a/src/arch/x86/process.cc b/src/arch/x86/process.cc
index a37468a88..a774dd000 100644
--- a/src/arch/x86/process.cc
+++ b/src/arch/x86/process.cc
@@ -91,19 +91,18 @@ static const int ArgumentReg32[] = {
static const int NumArgumentRegs32 M5_VAR_USED =
sizeof(ArgumentReg) / sizeof(const int);
-X86LiveProcess::X86LiveProcess(LiveProcessParams * params, ObjectFile *objFile,
- SyscallDesc *_syscallDescs, int _numSyscallDescs) :
- LiveProcess(params, objFile), syscallDescs(_syscallDescs),
- numSyscallDescs(_numSyscallDescs)
+X86Process::X86Process(ProcessParams * params, ObjectFile *objFile,
+ SyscallDesc *_syscallDescs, int _numSyscallDescs)
+ : Process(params, objFile), syscallDescs(_syscallDescs),
+ numSyscallDescs(_numSyscallDescs)
{
brk_point = objFile->dataBase() + objFile->dataSize() + objFile->bssSize();
brk_point = roundUp(brk_point, PageBytes);
}
-X86_64LiveProcess::X86_64LiveProcess(LiveProcessParams *params,
- ObjectFile *objFile, SyscallDesc *_syscallDescs,
- int _numSyscallDescs) :
- X86LiveProcess(params, objFile, _syscallDescs, _numSyscallDescs)
+X86_64Process::X86_64Process(ProcessParams *params, ObjectFile *objFile,
+ SyscallDesc *_syscallDescs, int _numSyscallDescs)
+ : X86Process(params, objFile, _syscallDescs, _numSyscallDescs)
{
vsyscallPage.base = 0xffffffffff600000ULL;
@@ -131,7 +130,7 @@ X86_64LiveProcess::X86_64LiveProcess(LiveProcessParams *params,
}
void
-I386LiveProcess::syscall(int64_t callnum, ThreadContext *tc)
+I386Process::syscall(int64_t callnum, ThreadContext *tc)
{
TheISA::PCState pc = tc->pcState();
Addr eip = pc.pc();
@@ -140,14 +139,13 @@ I386LiveProcess::syscall(int64_t callnum, ThreadContext *tc)
pc.npc(vsyscallPage.base + vsyscallPage.vsysexitOffset);
tc->pcState(pc);
}
- X86LiveProcess::syscall(callnum, tc);
+ X86Process::syscall(callnum, tc);
}
-I386LiveProcess::I386LiveProcess(LiveProcessParams *params,
- ObjectFile *objFile, SyscallDesc *_syscallDescs,
- int _numSyscallDescs) :
- X86LiveProcess(params, objFile, _syscallDescs, _numSyscallDescs)
+I386Process::I386Process(ProcessParams *params, ObjectFile *objFile,
+ SyscallDesc *_syscallDescs, int _numSyscallDescs)
+ : X86Process(params, objFile, _syscallDescs, _numSyscallDescs)
{
_gdtStart = ULL(0xffffd000);
_gdtSize = PageBytes;
@@ -174,7 +172,7 @@ I386LiveProcess::I386LiveProcess(LiveProcessParams *params,
}
SyscallDesc*
-X86LiveProcess::getDesc(int callnum)
+X86Process::getDesc(int callnum)
{
if (callnum < 0 || callnum >= numSyscallDescs)
return NULL;
@@ -182,9 +180,9 @@ X86LiveProcess::getDesc(int callnum)
}
void
-X86_64LiveProcess::initState()
+X86_64Process::initState()
{
- X86LiveProcess::initState();
+ X86Process::initState();
argsInit(sizeof(uint64_t), PageBytes);
@@ -626,9 +624,9 @@ X86_64LiveProcess::initState()
}
void
-I386LiveProcess::initState()
+I386Process::initState()
{
- X86LiveProcess::initState();
+ X86Process::initState();
argsInit(sizeof(uint32_t), PageBytes);
@@ -746,7 +744,7 @@ I386LiveProcess::initState()
template<class IntType>
void
-X86LiveProcess::argsInit(int pageSize,
+X86Process::argsInit(int pageSize,
std::vector<AuxVector<IntType> > extraAuxvs)
{
int intSize = sizeof(IntType);
@@ -1034,16 +1032,16 @@ X86LiveProcess::argsInit(int pageSize,
}
void
-X86_64LiveProcess::argsInit(int intSize, int pageSize)
+X86_64Process::argsInit(int intSize, int pageSize)
{
std::vector<AuxVector<uint64_t> > extraAuxvs;
extraAuxvs.push_back(AuxVector<uint64_t>(M5_AT_SYSINFO_EHDR,
vsyscallPage.base));
- X86LiveProcess::argsInit<uint64_t>(pageSize, extraAuxvs);
+ X86Process::argsInit<uint64_t>(pageSize, extraAuxvs);
}
void
-I386LiveProcess::argsInit(int intSize, int pageSize)
+I386Process::argsInit(int intSize, int pageSize)
{
std::vector<AuxVector<uint32_t> > extraAuxvs;
//Tell the binary where the vsyscall part of the vsyscall page is.
@@ -1051,38 +1049,38 @@ I386LiveProcess::argsInit(int intSize, int pageSize)
vsyscallPage.base + vsyscallPage.vsyscallOffset));
extraAuxvs.push_back(AuxVector<uint32_t>(M5_AT_SYSINFO_EHDR,
vsyscallPage.base));
- X86LiveProcess::argsInit<uint32_t>(pageSize, extraAuxvs);
+ X86Process::argsInit<uint32_t>(pageSize, extraAuxvs);
}
void
-X86LiveProcess::setSyscallReturn(ThreadContext *tc, SyscallReturn retval)
+X86Process::setSyscallReturn(ThreadContext *tc, SyscallReturn retval)
{
tc->setIntReg(INTREG_RAX, retval.encodedValue());
}
X86ISA::IntReg
-X86_64LiveProcess::getSyscallArg(ThreadContext *tc, int &i)
+X86_64Process::getSyscallArg(ThreadContext *tc, int &i)
{
assert(i < NumArgumentRegs);
return tc->readIntReg(ArgumentReg[i++]);
}
void
-X86_64LiveProcess::setSyscallArg(ThreadContext *tc, int i, X86ISA::IntReg val)
+X86_64Process::setSyscallArg(ThreadContext *tc, int i, X86ISA::IntReg val)
{
assert(i < NumArgumentRegs);
return tc->setIntReg(ArgumentReg[i], val);
}
X86ISA::IntReg
-I386LiveProcess::getSyscallArg(ThreadContext *tc, int &i)
+I386Process::getSyscallArg(ThreadContext *tc, int &i)
{
assert(i < NumArgumentRegs32);
return tc->readIntReg(ArgumentReg32[i++]);
}
X86ISA::IntReg
-I386LiveProcess::getSyscallArg(ThreadContext *tc, int &i, int width)
+I386Process::getSyscallArg(ThreadContext *tc, int &i, int width)
{
assert(width == 32 || width == 64);
assert(i < NumArgumentRegs);
@@ -1093,7 +1091,7 @@ I386LiveProcess::getSyscallArg(ThreadContext *tc, int &i, int width)
}
void
-I386LiveProcess::setSyscallArg(ThreadContext *tc, int i, X86ISA::IntReg val)
+I386Process::setSyscallArg(ThreadContext *tc, int i, X86ISA::IntReg val)
{
assert(i < NumArgumentRegs);
return tc->setIntReg(ArgumentReg[i], val);
diff --git a/src/arch/x86/process.hh b/src/arch/x86/process.hh
index ab513d839..34a275095 100644
--- a/src/arch/x86/process.hh
+++ b/src/arch/x86/process.hh
@@ -55,7 +55,7 @@ namespace X86ISA
M5_AT_SYSINFO_EHDR = 33
};
- class X86LiveProcess : public LiveProcess
+ class X86Process : public Process
{
protected:
Addr _gdtStart;
@@ -64,8 +64,8 @@ namespace X86ISA
SyscallDesc *syscallDescs;
const int numSyscallDescs;
- X86LiveProcess(LiveProcessParams * params, ObjectFile *objFile,
- SyscallDesc *_syscallDescs, int _numSyscallDescs);
+ X86Process(ProcessParams * params, ObjectFile *objFile,
+ SyscallDesc *_syscallDescs, int _numSyscallDescs);
template<class IntType>
void argsInit(int pageSize,
@@ -83,11 +83,11 @@ namespace X86ISA
void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value);
};
- class X86_64LiveProcess : public X86LiveProcess
+ class X86_64Process : public X86Process
{
protected:
- X86_64LiveProcess(LiveProcessParams *params, ObjectFile *objFile,
- SyscallDesc *_syscallDescs, int _numSyscallDescs);
+ X86_64Process(ProcessParams *params, ObjectFile *objFile,
+ SyscallDesc *_syscallDescs, int _numSyscallDescs);
class VSyscallPage
{
@@ -105,15 +105,15 @@ namespace X86ISA
X86ISA::IntReg getSyscallArg(ThreadContext *tc, int &i);
/// Explicitly import the otherwise hidden getSyscallArg
- using LiveProcess::getSyscallArg;
+ using Process::getSyscallArg;
void setSyscallArg(ThreadContext *tc, int i, X86ISA::IntReg val);
};
- class I386LiveProcess : public X86LiveProcess
+ class I386Process : public X86Process
{
protected:
- I386LiveProcess(LiveProcessParams *params, ObjectFile *objFile,
- SyscallDesc *_syscallDescs, int _numSyscallDescs);
+ I386Process(ProcessParams *params, ObjectFile *objFile,
+ SyscallDesc *_syscallDescs, int _numSyscallDescs);
class VSyscallPage
{