process: get rid of some unused code & vars

This commit is contained in:
Steve Reinhardt 2010-07-05 21:39:38 -07:00
parent 2c2f956060
commit f98cce5771
2 changed files with 0 additions and 79 deletions

View file

@ -496,7 +496,6 @@ Process::FdMap::unserialize(Checkpoint *cp, const std::string &section)
void
Process::serialize(std::ostream &os)
{
SERIALIZE_SCALAR(initialContextLoaded);
SERIALIZE_SCALAR(brk_point);
SERIALIZE_SCALAR(stack_base);
SERIALIZE_SCALAR(stack_size);
@ -519,7 +518,6 @@ Process::serialize(std::ostream &os)
void
Process::unserialize(Checkpoint *cp, const std::string &section)
{
UNSERIALIZE_SCALAR(initialContextLoaded);
UNSERIALIZE_SCALAR(brk_point);
UNSERIALIZE_SCALAR(stack_base);
UNSERIALIZE_SCALAR(stack_size);
@ -578,76 +576,6 @@ LiveProcess::LiveProcess(LiveProcessParams * params, ObjectFile *_objFile)
}
}
void
LiveProcess::argsInit(int intSize, int pageSize)
{
Process::startup();
// load object file into target memory
objFile->loadSections(initVirtMem);
// Calculate how much space we need for arg & env arrays.
int argv_array_size = intSize * (argv.size() + 1);
int envp_array_size = intSize * (envp.size() + 1);
int arg_data_size = 0;
for (vector<string>::size_type i = 0; i < argv.size(); ++i) {
arg_data_size += argv[i].size() + 1;
}
int env_data_size = 0;
for (vector<string>::size_type i = 0; i < envp.size(); ++i) {
env_data_size += envp[i].size() + 1;
}
int space_needed =
argv_array_size + envp_array_size + arg_data_size + env_data_size;
if (space_needed < 32*1024)
space_needed = 32*1024;
// set bottom of stack
stack_min = stack_base - space_needed;
// align it
stack_min = roundDown(stack_min, pageSize);
stack_size = stack_base - stack_min;
// map memory
pTable->allocate(stack_min, roundUp(stack_size, pageSize));
// map out initial stack contents
Addr argv_array_base = stack_min + intSize; // room for argc
Addr envp_array_base = argv_array_base + argv_array_size;
Addr arg_data_base = envp_array_base + envp_array_size;
Addr env_data_base = arg_data_base + arg_data_size;
// write contents to stack
uint64_t argc = argv.size();
if (intSize == 8)
argc = htog((uint64_t)argc);
else if (intSize == 4)
argc = htog((uint32_t)argc);
else
panic("Unknown int size");
initVirtMem->writeBlob(stack_min, (uint8_t*)&argc, intSize);
copyStringArray(argv, argv_array_base, arg_data_base, initVirtMem);
copyStringArray(envp, envp_array_base, env_data_base, initVirtMem);
ThreadContext *tc = system->getThreadContext(contextIds[0]);
setSyscallArg(tc, 0, argc);
setSyscallArg(tc, 1, argv_array_base);
tc->setIntReg(StackPointerReg, stack_min);
Addr prog_entry = objFile->entryPoint();
tc->setPC(prog_entry);
tc->setNextPC(prog_entry + sizeof(MachInst));
#if THE_ISA != ALPHA_ISA && THE_ISA != POWER_ISA //e.g. MIPS or Sparc
tc->setNextNPC(prog_entry + (2 * sizeof(MachInst)));
#endif
num_processes++;
}
void
LiveProcess::syscall(int64_t callnum, ThreadContext *tc)
{

View file

@ -79,11 +79,6 @@ class Process : public SimObject
/// running on.
System *system;
// have we initialized a thread context from this process? If
// yes, subsequent contexts are assumed to be for dynamically
// created threads and are not initialized.
bool initialContextLoaded;
bool checkpointRestored;
// thread contexts associated with this process
@ -250,8 +245,6 @@ class LiveProcess : public Process
LiveProcess(LiveProcessParams * params, ObjectFile *objFile);
virtual void argsInit(int intSize, int pageSize);
// Id of the owner of the process
uint64_t __uid;
uint64_t __euid;