X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;ds=sidebyside;f=sim%2Fprocess.cc;h=98db1f2e063a94836d0740182f68f6e9e1d8eafe;hb=400daa7e41057ec358691afeffe35ffa430d11b0;hp=bb433389667e28aca4a38816420473549a11728e;hpb=745f0044cd65d476b3b190377989eb0af3738df5;p=gem5.git diff --git a/sim/process.cc b/sim/process.cc index bb4333896..98db1f2e0 100644 --- a/sim/process.cc +++ b/sim/process.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003 The Regents of The University of Michigan + * Copyright (c) 2001-2004 The Regents of The University of Michigan * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -43,7 +43,7 @@ #include "sim/builder.hh" #include "sim/fake_syscall.hh" #include "sim/process.hh" -#include "sim/sim_stats.hh" +#include "sim/stats.hh" #ifdef TARGET_ALPHA #include "arch/alpha/alpha_tru64_process.hh" @@ -75,6 +75,7 @@ Process::Process(const string &name, // allocate initial register file init_regs = new RegFile; + memset(init_regs, 0, sizeof(RegFile)); // initialize first 3 fds (stdin, stdout, stderr) fd_map[STDIN_FILENO] = stdin_fd; @@ -94,7 +95,7 @@ Process::Process(const string &name, void Process::regStats() { - using namespace Statistics; + using namespace Stats; num_syscalls .name(name() + ".PROG:num_syscalls") @@ -148,8 +149,10 @@ Process::registerExecContext(ExecContext *xc) // copy process's initial regs struct xc->regs = *init_regs; - // mark this context as active - xc->setStatus(ExecContext::Active); + // mark this context as active. + // activate with zero delay so that we start ticking right + // away on cycle 0 + xc->activate(0); } // return CPU number to caller and increment available CPU count @@ -158,7 +161,7 @@ Process::registerExecContext(ExecContext *xc) void -Process::replaceExecContext(int xcIndex, ExecContext *xc) +Process::replaceExecContext(ExecContext *xc, int xcIndex) { if (xcIndex >= execContexts.size()) { panic("replaceExecContext: bad xcIndex, %d >= %d\n", @@ -218,7 +221,7 @@ Process::sim_fd(int tgt_fd) // that can be constructed (i.e., no REGISTER_SIM_OBJECT() macro call, // which is where these get declared for concrete types). // -DEFINE_SIM_OBJECT_CLASS_NAME("Process object", Process) +DEFINE_SIM_OBJECT_CLASS_NAME("Process", Process) //////////////////////////////////////////////////////////////////////// @@ -389,14 +392,10 @@ CREATE_SIM_OBJECT(LiveProcess) // dummy for default env vector null_vec; - // We do this with "temp" because of the bogus compiler warning - // you get with g++ 2.95 -O if you just "return new LiveProcess(..." - LiveProcess *temp = LiveProcess::create(getInstanceName(), - stdin_fd, stdout_fd, stderr_fd, - cmd, - env.isValid() ? env : null_vec); - - return temp; + return LiveProcess::create(getInstanceName(), + stdin_fd, stdout_fd, stderr_fd, + cmd, + env.isValid() ? env : null_vec); }