#include "base/output.hh"
#include "sim/eventq.hh"
-using namespace std;
-
namespace Gem5Internal
{
Tick getClockFrequency() { return _ticksPerSecond; }
void
-setOutputDir(const string &dir)
+setOutputDir(const std::string &dir)
{
simout.setDirectory(dir);
}
exitCallbacks().process();
exitCallbacks().clear();
- cout.flush();
+ std::cout.flush();
}
#include "sim/sim_exit.hh"
#include "sim/system.hh"
-using namespace std;
-
//
// Debug event: place a breakpoint on the process function and
// schedule the event to break at a particular cycle
#include "debug/Checkpoint.hh"
#include "sim/core.hh"
-using namespace std;
-
Tick simQuantum = 0;
//
// cycle, before the pipeline simulation is performed.
//
uint32_t numMainEventQueues = 0;
-vector<EventQueue *> mainEventQueue;
+std::vector<EventQueue *> mainEventQueue;
__thread EventQueue *_curEventQueue = NULL;
bool inParallelMode = false;
}
}
-EventQueue::EventQueue(const string &n)
+EventQueue::EventQueue(const std::string &n)
: objName(n), head(NULL), _curTick(0)
{
}
#endif
-using namespace std;
namespace py = pybind11;
// The python library is totally messed up with respect to constness,
{
// if we've added the importer keep track of it because we need it
// to bootstrap.
- if (string(modpath) == string("importer"))
+ if (std::string(modpath) == std::string("importer"))
importer = this;
else
getList().push_back(this);
}
-list<EmbeddedPython *> &
+std::list<EmbeddedPython *> &
EmbeddedPython::getList()
{
- static list<EmbeddedPython *> the_list;
+ static std::list<EmbeddedPython *> the_list;
return the_list;
}
// Load the rest of the embedded python files into the embedded
// python importer
- list<EmbeddedPython *>::iterator i = getList().begin();
- list<EmbeddedPython *>::iterator end = getList().end();
+ std::list<EmbeddedPython *>::iterator i = getList().begin();
+ std::list<EmbeddedPython *>::iterator end = getList().end();
for (; i != end; ++i)
if (!(*i)->addModule())
return 1;
#include "sim/core.hh"
#include "sim/eventq.hh"
-using namespace std;
-
// Use an separate stack for fatal signal handlers
static uint8_t fatalSigStack[2 * SIGSTKSZ];
{
const EventQueue *const eq(curEventQueue());
if (eq) {
- ccprintf(cerr, "Program aborted at tick %llu\n", eq->getCurTick());
+ ccprintf(std::cerr, "Program aborted at tick %llu\n",
+ eq->getCurTick());
} else {
STATIC_ERR("Program aborted\n\n");
}
#include "sim/syscall_desc.hh"
#include "sim/system.hh"
-using namespace std;
using namespace TheISA;
namespace
_gid(params.gid), _egid(params.egid),
_pid(params.pid), _ppid(params.ppid),
_pgid(params.pgid), drivers(params.drivers),
- fds(make_shared<FDArray>(params.input, params.output, params.errout)),
+ fds(std::make_shared<FDArray>(
+ params.input, params.output, params.errout)),
childClearTID(0),
ADD_STAT(numSyscalls, "Number of system calls")
{
* Duplicate the process memory address space. The state needs to be
* copied over (rather than using pointers to share everything).
*/
- typedef std::vector<pair<Addr,Addr>> MapVec;
+ typedef std::vector<std::pair<Addr,Addr>> MapVec;
MapVec mappings;
pTable->getMappings(&mappings);
#include "sim/stats.hh"
#include "sim/system.hh"
-using namespace std;
using namespace Stats;
namespace PseudoInst
{
DPRINTF(PseudoInst, "PseudoInst::loadsymbol()\n");
- const string &filename = tc->getCpuPtr()->system->params().symbolfile;
+ const std::string &filename = tc->getCpuPtr()->system->params().symbolfile;
if (filename.empty()) {
return;
}
std::string buffer;
- ifstream file(filename.c_str());
+ std::ifstream file(filename.c_str());
if (!file)
fatal("file error: Can't open symbol table file %s\n", filename);
if (buffer.empty())
continue;
- string::size_type idx = buffer.find(' ');
- if (idx == string::npos)
+ std::string::size_type idx = buffer.find(' ');
+ if (idx == std::string::npos)
continue;
- string address = "0x" + buffer.substr(0, idx);
+ std::string address = "0x" + buffer.substr(0, idx);
eat_white(address);
if (address.empty())
continue;
// Skip over letter and space
- string symbol = buffer.substr(idx + 3);
+ std::string symbol = buffer.substr(idx + 3);
eat_white(symbol);
if (symbol.empty())
continue;
// concatenate them in the key character buffer
const int len = 2 * sizeof(uint64_t) + 1;
char key[len];
- memset(key, '\0', len);
+ std::memset(key, '\0', len);
std::array<uint64_t, 2> key_regs = {{ key_str1, key_str2 }};
key_regs = letoh(key_regs);
- memcpy(key, key_regs.data(), sizeof(key_regs));
+ std::memcpy(key, key_regs.data(), sizeof(key_regs));
// Check key parameter to figure out what to return.
const std::string key_str(key);
DPRINTF(PseudoInst, "PseudoInst::readfile(0x%x, 0x%x, 0x%x)\n",
vaddr, len, offset);
- const string &file = tc->getSystemPtr()->params().readfile;
+ const std::string &file = tc->getSystemPtr()->params().readfile;
if (file.empty()) {
return ULL(0);
}
// do not truncate file if offset is non-zero
// (ios::in flag is required as well to keep the existing data
// intact, otherwise existing data will be zeroed out.)
- out = simout.open(filename, ios::in | ios::out | ios::binary, true);
+ out = simout.open(filename,
+ std::ios::in | std::ios::out | std::ios::binary, true);
}
- ostream *os(out->stream());
+ std::ostream *os(out->stream());
if (!os)
panic("could not open file %s\n", filename);
// For stat reset hack
#include "sim/stat_control.hh"
-using namespace std;
-
int ckptMaxCount = 0;
int ckptCount = 0;
int ckptPrevCount = -1;
}
void
-Serializable::serializeAll(const string &cpt_dir)
+Serializable::serializeAll(const std::string &cpt_dir)
{
- string dir = CheckpointIn::setDir(cpt_dir);
+ std::string dir = CheckpointIn::setDir(cpt_dir);
if (mkdir(dir.c_str(), 0775) == -1 && errno != EEXIST)
fatal("couldn't mkdir %s\n", dir);
- string cpt_file = dir + CheckpointIn::baseFilename;
- ofstream outstream(cpt_file.c_str());
+ std::string cpt_file = dir + CheckpointIn::baseFilename;
+ std::ofstream outstream(cpt_file.c_str());
time_t t = time(NULL);
if (!outstream.is_open())
fatal("Unable to open file %s for writing\n", cpt_file.c_str());
const char *CheckpointIn::baseFilename = "m5.cpt";
-string CheckpointIn::currentDirectory;
+std::string CheckpointIn::currentDirectory;
-string
-CheckpointIn::setDir(const string &name)
+std::string
+CheckpointIn::setDir(const std::string &name)
{
// use csprintf to insert curTick() into directory name if it
// appears to have a format placeholder in it.
- currentDirectory = (name.find("%") != string::npos) ?
+ currentDirectory = (name.find("%") != std::string::npos) ?
csprintf(name, curTick()) : name;
if (currentDirectory[currentDirectory.size() - 1] != '/')
currentDirectory += "/";
return currentDirectory;
}
-string
+std::string
CheckpointIn::dir()
{
return currentDirectory;
}
-CheckpointIn::CheckpointIn(const string &cpt_dir, SimObjectResolver &resolver)
+CheckpointIn::CheckpointIn(const std::string &cpt_dir,
+ SimObjectResolver &resolver)
: db(new IniFile), objNameResolver(resolver), _cptDir(setDir(cpt_dir))
{
- string filename = getCptDir() + "/" + CheckpointIn::baseFilename;
+ std::string filename = getCptDir() + "/" + CheckpointIn::baseFilename;
if (!db->load(filename)) {
fatal("Can't load checkpoint file '%s'\n", filename);
}
* we are looking in.
*/
bool
-CheckpointIn::entryExists(const string §ion, const string &entry)
+CheckpointIn::entryExists(const std::string §ion, const std::string &entry)
{
return db->entryExists(section, entry);
}
* the value, given the section .
*/
bool
-CheckpointIn::find(const string §ion, const string &entry, string &value)
+CheckpointIn::find(const std::string §ion, const std::string &entry,
+ std::string &value)
{
return db->find(section, entry, value);
}
*
*/
bool
-CheckpointIn::findObj(const string §ion, const string &entry,
+CheckpointIn::findObj(const std::string §ion, const std::string &entry,
SimObject *&value)
{
- string path;
+ std::string path;
if (!db->find(section, entry, path))
return false;
}
bool
-CheckpointIn::sectionExists(const string §ion)
+CheckpointIn::sectionExists(const std::string §ion)
{
return db->sectionExists(section);
}
}
void
-objParamIn(CheckpointIn &cp, const string &name, SimObject * ¶m)
+objParamIn(CheckpointIn &cp, const std::string &name, SimObject * ¶m)
{
- const string §ion(Serializable::currentSection());
+ const std::string §ion(Serializable::currentSection());
if (!cp.findObj(section, name, param)) {
fatal("Can't unserialize '%s:%s'\n", section, name);
}
}
void
-debug_serialize(const string &cpt_dir)
+debug_serialize(const std::string &cpt_dir)
{
Serializable::serializeAll(cpt_dir);
}
#include "sim/sim_exit.hh"
#include "sim/stats.hh"
-using namespace std;
-
GlobalSimLoopExitEvent::GlobalSimLoopExitEvent(Tick when,
const std::string &_cause,
int c, Tick r)
#include "debug/Checkpoint.hh"
#include "sim/probe/probe.hh"
-using namespace std;
-
-
////////////////////////////////////////////////////////////////////////
//
// SimObject member definitions
// static function: flag which objects should have the debugger break
//
void
-SimObject::debugObjectBreak(const string &objs)
+SimObject::debugObjectBreak(const std::string &objs)
{
SimObjectList::const_iterator i = simObjectList.begin();
SimObjectList::const_iterator end = simObjectList.end();
#include "base/time.hh"
#include "sim/global_event.hh"
-using namespace std;
-
namespace Stats {
GlobalEvent *dumpEvent;
#include "sim/syscall_desc.hh"
#include "sim/system.hh"
-using namespace std;
using namespace TheISA;
void
return -errno;
// Assuming that the size of loff_t is 64 bits on the target platform
BufferArg result_buf(result_ptr, sizeof(result));
- memcpy(result_buf.bufferPtr(), &result, sizeof(result));
+ std::memcpy(result_buf.bufferPtr(), &result, sizeof(result));
result_buf.copyOut(tc->getVirtProxy());
return 0;
}
BufferArg buf(buf_ptr, size);
// Is current working directory defined?
- string cwd = p->tgtCwd;
+ std::string cwd = p->tgtCwd;
if (!cwd.empty()) {
if (cwd.length() >= size) {
// Buffer too small
readlinkFunc(SyscallDesc *desc, ThreadContext *tc,
Addr pathname, Addr buf_ptr, size_t bufsiz)
{
- string path;
+ std::string path;
auto p = tc->getProcessPtr();
if (!tc->getVirtProxy().tryReadString(path, pathname))
SyscallReturn
unlinkFunc(SyscallDesc *desc, ThreadContext *tc, Addr pathname)
{
- string path;
+ std::string path;
auto p = tc->getProcessPtr();
if (!tc->getVirtProxy().tryReadString(path, pathname))
linkFunc(SyscallDesc *desc, ThreadContext *tc,
Addr pathname, Addr new_pathname)
{
- string path;
- string new_path;
+ std::string path;
+ std::string new_path;
auto p = tc->getProcessPtr();
auto &virt_mem = tc->getVirtProxy();
symlinkFunc(SyscallDesc *desc, ThreadContext *tc,
Addr pathname, Addr new_pathname)
{
- string path;
- string new_path;
+ std::string path;
+ std::string new_path;
auto p = tc->getProcessPtr();
auto &virt_mem = tc->getVirtProxy();
{
auto p = tc->getProcessPtr();
- string old_name;
+ std::string old_name;
if (!tc->getVirtProxy().tryReadString(old_name, oldpath))
return -EFAULT;
- string new_name;
+ std::string new_name;
if (!tc->getVirtProxy().tryReadString(new_name, newpath))
return -EFAULT;
SyscallReturn
truncateFunc(SyscallDesc *desc, ThreadContext *tc, Addr pathname, off_t length)
{
- string path;
+ std::string path;
auto p = tc->getProcessPtr();
if (!tc->getVirtProxy().tryReadString(path, pathname))
Addr pathname, int64_t length)
{
auto process = tc->getProcessPtr();
- string path;
+ std::string path;
if (!tc->getVirtProxy().tryReadString(path, pathname))
return -EFAULT;
chownFunc(SyscallDesc *desc, ThreadContext *tc,
Addr pathname, uint32_t owner, uint32_t group)
{
- string path;
+ std::string path;
auto p = tc->getProcessPtr();
if (!tc->getVirtProxy().tryReadString(path, pathname))
accessFunc(SyscallDesc *desc, ThreadContext *tc,
Addr pathname, mode_t mode)
{
- string path;
+ std::string path;
auto p = tc->getProcessPtr();
if (!tc->getVirtProxy().tryReadString(path, pathname))
return -EFAULT;
futexFunc(SyscallDesc *desc, ThreadContext *tc,
Addr uaddr, int op, int val, int timeout, Addr uaddr2, int val3)
{
- using namespace std;
-
auto process = tc->getProcessPtr();
/*
#include "sim/full_system.hh"
#include "sim/redirect_path.hh"
-using namespace std;
using namespace TheISA;
-vector<System *> System::systemList;
+std::vector<System *> System::systemList;
void
System::Threads::Thread::resume()
for (uint32_t j = 0; j < numWorkIds ; j++) {
workItemStats[j] = new Stats::Histogram(this);
- stringstream namestr;
+ std::stringstream namestr;
ccprintf(namestr, "work_item_type%d", j);
workItemStats[j]->init(20)
.name(name() + "." + namestr.str())
void
System::printSystems()
{
- ios::fmtflags flags(cerr.flags());
+ std::ios::fmtflags flags(std::cerr.flags());
- vector<System *>::iterator i = systemList.begin();
- vector<System *>::iterator end = systemList.end();
+ std::vector<System *>::iterator i = systemList.begin();
+ std::vector<System *>::iterator end = systemList.end();
for (; i != end; ++i) {
System *sys = *i;
- cerr << "System " << sys->name() << ": " << hex << sys << endl;
+ std::cerr << "System " << sys->name() << ": " << std::hex << sys
+ << std::endl;
}
- cerr.flags(flags);
+ std::cerr.flags(flags);
}
void