#include "params/BadDevice.hh"
#include "sim/system.hh"
-using namespace std;
-
BadDevice::BadDevice(const Params &p)
: BasicPioDevice(p, 0x10), devname(p.devicename)
{
#include "base/logging.hh"
#include "debug/Intel8254Timer.hh"
-using namespace std;
-
-Intel8254Timer::Intel8254Timer(EventManager *em, const string &name,
+Intel8254Timer::Intel8254Timer(EventManager *em, const std::string &name,
Counter *counter0, Counter *counter1, Counter *counter2) :
EventManager(em), _name(name)
{
counter[2] = counter2;
}
-Intel8254Timer::Intel8254Timer(EventManager *em, const string &name) :
+Intel8254Timer::Intel8254Timer(EventManager *em, const std::string &name) :
EventManager(em), _name(name)
{
counter[0] = new Counter(this, name + ".counter0", 0);
}
void
-Intel8254Timer::serialize(const string &base, CheckpointOut &cp) const
+Intel8254Timer::serialize(const std::string &base, CheckpointOut &cp) const
{
// serialize the counters
counter[0]->serialize(base + ".counter0", cp);
}
void
-Intel8254Timer::unserialize(const string &base, CheckpointIn &cp)
+Intel8254Timer::unserialize(const std::string &base, CheckpointIn &cp)
{
// unserialze the counters
counter[0]->unserialize(base + ".counter0", cp);
}
Intel8254Timer::Counter::Counter(Intel8254Timer *p,
- const string &name, unsigned int _num)
+ const std::string &name, unsigned int _num)
: _name(name), num(_num), event(this), running(false),
initial_count(0), latched_count(0), period(0), mode(0),
output_high(false), latch_on(false), read_byte(LSB),
}
void
-Intel8254Timer::Counter::serialize(const string &base, CheckpointOut &cp) const
+Intel8254Timer::Counter::serialize(
+ const std::string &base, CheckpointOut &cp) const
{
paramOut(cp, base + ".initial_count", initial_count);
paramOut(cp, base + ".latched_count", latched_count);
}
void
-Intel8254Timer::Counter::unserialize(const string &base, CheckpointIn &cp)
+Intel8254Timer::Counter::unserialize(const std::string &base, CheckpointIn &cp)
{
paramIn(cp, base + ".initial_count", initial_count);
paramIn(cp, base + ".latched_count", latched_count);
#include "mem/packet_access.hh"
#include "sim/system.hh"
-using namespace std;
-
IsaFake::IsaFake(const Params &p)
: BasicPioDevice(p, p.ret_bad_addr ? 0 : p.pio_size)
{
#include "debug/MC146818.hh"
#include "dev/rtcreg.h"
-using namespace std;
-
static uint8_t
bcdize(uint8_t val)
{
}
}
-MC146818::MC146818(EventManager *em, const string &n, const struct tm time,
- bool bcd, Tick frequency)
+MC146818::MC146818(EventManager *em, const std::string &n,
+ const struct tm time, bool bcd, Tick frequency)
: EventManager(em), _name(n), event(this, frequency), tickEvent(this)
{
memset(clock_data, 0, sizeof(clock_data));
}
void
-MC146818::serialize(const string &base, CheckpointOut &cp) const
+MC146818::serialize(const std::string &base, CheckpointOut &cp) const
{
uint8_t regA_serial(stat_regA);
uint8_t regB_serial(stat_regB);
}
void
-MC146818::unserialize(const string &base, CheckpointIn &cp)
+MC146818::unserialize(const std::string &base, CheckpointIn &cp)
{
uint8_t tmp8;
#include "params/Malta.hh"
#include "sim/system.hh"
-using namespace std;
-
Malta::Malta(const Params &p)
: Platform(p), system(p.system)
{
#include "params/MaltaCChip.hh"
#include "sim/system.hh"
-using namespace std;
-
MaltaCChip::MaltaCChip(const Params &p)
: BasicPioDevice(p, 0xfffffff), malta(p.malta)
{
#include "params/MaltaIO.hh"
#include "sim/system.hh"
-using namespace std;
-
-MaltaIO::RTC::RTC(const string &name, const MaltaIOParams &p)
+MaltaIO::RTC::RTC(const std::string &name, const MaltaIOParams &p)
: MC146818(p.malta, name, p.time, p.year_is_bcd, p.frequency),
malta(p.malta)
{
#include "sim/serialize.hh"
#include "sim/system.hh"
-using namespace std;
-
DistEtherLink::DistEtherLink(const Params &p)
: SimObject(p), linkDelay(p.delay)
{
bool packet_exists;
UNSERIALIZE_SCALAR(packet_exists);
if (packet_exists) {
- packet = make_shared<EthPacketData>();
+ packet = std::make_shared<EthPacketData>();
packet->unserialize("packet", cp);
}
#include "sim/sim_object.hh"
#include "sim/system.hh"
-using namespace std;
DistIface::Sync *DistIface::sync = nullptr;
System *DistIface::sys = nullptr;
DistIface::SyncEvent *DistIface::syncEvent = nullptr;
#include "params/EtherBus.hh"
#include "sim/core.hh"
-using namespace std;
-
EtherBus::EtherBus(const Params &p)
: SimObject(p), ticksPerByte(p.speed), loopback(p.loopback),
event([this]{ txDone(); }, "ethernet bus completion"),
#include "sim/serialize.hh"
#include "sim/system.hh"
-using namespace std;
-
EtherLink::EtherLink(const Params &p)
: SimObject(p)
{
}
-EtherLink::Interface::Interface(const string &name, Link *tx, Link *rx)
+EtherLink::Interface::Interface(const std::string &name, Link *tx, Link *rx)
: EtherInt(name), txlink(tx)
{
tx->setTxInt(this);
rx->setRxInt(this);
}
-EtherLink::Link::Link(const string &name, EtherLink *p, int num,
+EtherLink::Link::Link(const std::string &name, EtherLink *p, int num,
double rate, Tick delay, Tick delay_var, EtherDump *d)
: objName(name), parent(p), number(num), txint(NULL), rxint(NULL),
ticksPerByte(rate), linkDelay(delay), delayVar(delay_var), dump(d),
}
void
-EtherLink::Link::serialize(const string &base, CheckpointOut &cp) const
+EtherLink::Link::serialize(const std::string &base, CheckpointOut &cp) const
{
bool packet_exists = packet != nullptr;
paramOut(cp, base + ".packet_exists", packet_exists);
}
void
-EtherLink::Link::unserialize(const string &base, CheckpointIn &cp)
+EtherLink::Link::unserialize(const std::string &base, CheckpointIn &cp)
{
bool packet_exists;
paramIn(cp, base + ".packet_exists", packet_exists);
if (packet_exists) {
- packet = make_shared<EthPacketData>();
+ packet = std::make_shared<EthPacketData>();
packet->unserialize(base + ".packet", cp);
}
if (optParamIn(cp, base + ".tx_queue_size", tx_queue_size)) {
for (size_t idx = 0; idx < tx_queue_size; ++idx) {
Tick tick;
- EthPacketPtr delayed_packet = make_shared<EthPacketData>();
+ EthPacketPtr delayed_packet = std::make_shared<EthPacketData>();
paramIn(cp, csprintf("%s.txQueue[%i].tick", base, idx), tick);
delayed_packet->unserialize(
#include "base/logging.hh"
#include "sim/serialize.hh"
-using namespace std;
-
void
-EthPacketData::serialize(const string &base, CheckpointOut &cp) const
+EthPacketData::serialize(const std::string &base, CheckpointOut &cp) const
{
paramOut(cp, base + ".simLength", simLength);
paramOut(cp, base + ".bufLength", bufLength);
}
void
-EthPacketData::unserialize(const string &base, CheckpointIn &cp)
+EthPacketData::unserialize(const std::string &base, CheckpointIn &cp)
{
paramIn(cp, base + ".length", length);
unsigned chkpt_buf_length;
#include "debug/EthernetAll.hh"
#include "sim/core.hh"
-using namespace std;
-
EtherSwitch::EtherSwitch(const Params &p)
: SimObject(p), ttl(p.time_to_live)
{
void
EtherSwitch::Interface::PortFifoEntry::unserialize(CheckpointIn &cp)
{
- packet = make_shared<EthPacketData>(16384);
+ packet = std::make_shared<EthPacketData>(16384);
packet->unserialize("packet", cp);
UNSERIALIZE_SCALAR(recvTick);
UNSERIALIZE_SCALAR(srcId);
#include "dev/net/etherint.hh"
#include "dev/net/etherpkt.hh"
-using namespace std;
-
class TapEvent : public PollEvent
{
protected:
EtherTapBase::sendSimulated(void *data, size_t len)
{
EthPacketPtr packet;
- packet = make_shared<EthPacketData>(len);
+ packet = std::make_shared<EthPacketData>(len);
packet->length = len;
packet->simLength = len;
memcpy(packet->data, data, len);
port++;
}
- ccprintf(cerr, "Listening for tap connection on port %d\n", port);
+ ccprintf(std::cerr, "Listening for tap connection on port %d\n", port);
event = new Event(this, listener.getfd(), POLLIN|POLLERR);
pollQueue.schedule(event);
}
#include "base/logging.hh"
-using namespace std;
-
bool
PacketFifo::copyout(void *dest, unsigned offset, unsigned len)
{
if (i == end)
panic("invalid fifo");
- unsigned size = min(pkt->length - offset, len);
+ unsigned size = std::min(pkt->length - offset, len);
memcpy(data, pkt->data, size);
offset = 0;
len -= size;
void
-PacketFifoEntry::serialize(const string &base, CheckpointOut &cp) const
+PacketFifoEntry::serialize(const std::string &base, CheckpointOut &cp) const
{
packet->serialize(base + ".packet", cp);
paramOut(cp, base + ".slack", slack);
}
void
-PacketFifoEntry::unserialize(const string &base, CheckpointIn &cp)
+PacketFifoEntry::unserialize(const std::string &base, CheckpointIn &cp)
{
- packet = make_shared<EthPacketData>();
+ packet = std::make_shared<EthPacketData>();
packet->unserialize(base + ".packet", cp);
paramIn(cp, base + ".slack", slack);
paramIn(cp, base + ".number", number);
}
void
-PacketFifo::serialize(const string &base, CheckpointOut &cp) const
+PacketFifo::serialize(const std::string &base, CheckpointOut &cp) const
{
paramOut(cp, base + ".size", _size);
paramOut(cp, base + ".maxsize", _maxsize);
}
void
-PacketFifo::unserialize(const string &base, CheckpointIn &cp)
+PacketFifo::unserialize(const std::string &base, CheckpointIn &cp)
{
paramIn(cp, base + ".size", _size);
// paramIn(cp, base + ".maxsize", _maxsize);
#include "sim/eventq.hh"
#include "sim/stats.hh"
-using namespace std;
using namespace Net;
namespace Sinic {
goto exit;
rxDmaAddr = pciToDma(Regs::get_RxData_Addr(vnic->RxData));
- rxDmaLen = min<unsigned>(Regs::get_RxData_Len(vnic->RxData),
- vnic->rxPacketBytes);
+ rxDmaLen = std::min<unsigned>(Regs::get_RxData_Len(vnic->RxData),
+ vnic->rxPacketBytes);
/*
* if we're doing zero/delay copy and we're below the fifo
assert(Regs::get_TxDone_Busy(vnic->TxDone));
if (!txPacket) {
// Grab a new packet from the fifo.
- txPacket = make_shared<EthPacketData>(16384);
+ txPacket = std::make_shared<EthPacketData>(16384);
txPacketOffset = 0;
}
UNSERIALIZE_SCALAR(txPacketExists);
txPacket = 0;
if (txPacketExists) {
- txPacket = make_shared<EthPacketData>(16384);
+ txPacket = std::make_shared<EthPacketData>(16384);
txPacket->unserialize("txPacket", cp);
UNSERIALIZE_SCALAR(txPacketOffset);
UNSERIALIZE_SCALAR(txPacketBytes);
#endif
#endif
-using namespace std;
-
std::vector<std::pair<TCPIface::NodeInfo, int> > TCPIface::nodes;
-vector<int> TCPIface::sockRegistry;
+std::vector<int> TCPIface::sockRegistry;
int TCPIface::fdStatic = -1;
bool TCPIface::anyListening = false;
-TCPIface::TCPIface(string server_name, unsigned server_port,
+TCPIface::TCPIface(std::string server_name, unsigned server_port,
unsigned dist_rank, unsigned dist_size,
Tick sync_start, Tick sync_repeat,
EventManager *em, bool use_pseudo_op, bool is_switch,
DPRINTF(DistEthernet, "First connection, waiting for link info\n");
if (!recvTCP(sock, &ni, sizeof(ni)))
panic("Failed to receive link info");
- nodes.push_back(make_pair(ni, sock));
+ nodes.push_back(std::make_pair(ni, sock));
}
}
}
if (isSwitch) {
if (cur_id == 0) { // first connection accepted in the ctor already
auto const &iface0 =
- find_if(nodes.begin(), nodes.end(),
- [](const pair<NodeInfo, int> &cn) -> bool {
- return cn.first.rank == cur_rank;
- });
+ std::find_if(nodes.begin(), nodes.end(),
+ [](const std::pair<NodeInfo, int> &cn) -> bool {
+ return cn.first.rank == cur_rank;
+ });
assert(iface0 != nodes.end());
assert(iface0->first.distIfaceId == 0);
sock = iface0->second;
struct addrinfo addr_hint, *addr_results;
int ret;
- string port_str = to_string(serverPort);
+ std::string port_str = std::to_string(serverPort);
sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
panic_if(sock < 0, "socket() failed: %s", strerror(errno));
void
TCPIface::recvPacket(const Header &header, EthPacketPtr &packet)
{
- packet = make_shared<EthPacketData>(header.dataPacketLength);
+ packet = std::make_shared<EthPacketData>(header.dataPacketLength);
bool ret = recvTCP(sock, packet->data, header.dataPacketLength);
panic_if(!ret, "Error while reading socket");
packet->simLength = header.simLength;
#include "base/logging.hh"
#include "sim/sim_exit.hh"
-using namespace std;
-
Platform::Platform(const Params &p)
: SimObject(p), intrctrl(p.intrctrl)
{
#include "dev/platform.hh"
#include "dev/serial/uart.hh"
-using namespace std;
-
-
/*
* Poll event for the listen socket
*/
#endif
{
if (outfile)
- outfile->stream()->setf(ios::unitbuf);
+ outfile->stream()->setf(std::ios::unitbuf);
if (p.port)
listen(p.port);
port++;
}
- ccprintf(cerr, "%s: Listening for connections on port %d\n",
+ ccprintf(std::cerr, "%s: Listening for connections on port %d\n",
name(), port);
listenEvent = new ListenEvent(this, listener.getfd(), POLLIN);
dataEvent = new DataEvent(this, data_fd, POLLIN);
pollQueue.schedule(dataEvent);
- stringstream stream;
+ std::stringstream stream;
ccprintf(stream, "==== m5 terminal: Terminal %d ====", number);
// we need an actual carriage return followed by a newline for the
#include "mem/packet_access.hh"
#include "sim/serialize.hh"
-using namespace std;
-
void
Uart8250::processIntrEvent(int intrBit)
{
#include "mem/port.hh"
#include "sim/system.hh"
-using namespace std;
-
DumbTOD::DumbTOD(const Params &p)
: BasicPioDevice(p, 0x08)
{
#include "cpu/intr_control.hh"
#include "sim/system.hh"
-using namespace std;
-
T1000::T1000(const Params &p)
: Platform(p), system(p.system)
{}
#include "sim/serialize.hh"
#include "sim/sim_exit.hh"
-using namespace std;
-
////////////////////////////////////////////////////////////////////////
//
// Raw Disk image
}
void
-RawDiskImage::open(const string &filename, bool rd_only)
+RawDiskImage::open(const std::string &filename, bool rd_only)
{
if (!filename.empty()) {
initialized = true;
readonly = rd_only;
file = filename;
- ios::openmode mode = ios::in | ios::binary;
+ std::ios::openmode mode = std::ios::in | std::ios::binary;
if (!readonly)
- mode |= ios::out;
+ mode |= std::ios::out;
stream.open(file.c_str(), mode);
if (!stream.is_open())
panic("Error opening %s", filename);
if (disk_size == 0) {
if (!stream.is_open())
panic("file not open!\n");
- stream.seekg(0, ios::end);
+ stream.seekg(0, std::ios::end);
disk_size = stream.tellg();
}
if (!stream.is_open())
panic("file not open!\n");
- stream.seekg(offset * SectorSize, ios::beg);
+ stream.seekg(offset * SectorSize, std::ios::beg);
if (!stream.good())
panic("Could not seek to location in file");
- streampos pos = stream.tellg();
+ std::streampos pos = stream.tellg();
stream.read((char *)data, SectorSize);
DPRINTF(DiskImageRead, "read: offset=%d\n", (uint64_t)offset);
if (!stream.is_open())
panic("file not open!\n");
- stream.seekp(offset * SectorSize, ios::beg);
+ stream.seekp(offset * SectorSize, std::ios::beg);
if (!stream.good())
panic("Could not seek to location in file");
DPRINTF(DiskImageWrite, "write: offset=%d\n", (uint64_t)offset);
DDUMP(DiskImageWrite, data, SectorSize);
- streampos pos = stream.tellp();
+ std::streampos pos = stream.tellp();
stream.write((const char *)data, SectorSize);
return stream.tellp() - pos;
}
}
void
-SafeRead(ifstream &stream, void *data, int count)
+SafeRead(std::ifstream &stream, void *data, int count)
{
stream.read((char *)data, count);
if (!stream.is_open())
template<class T>
void
-SafeRead(ifstream &stream, T &data)
+SafeRead(std::ifstream &stream, T &data)
{
SafeRead(stream, &data, sizeof(data));
}
template<class T>
void
-SafeReadSwap(ifstream &stream, T &data)
+SafeReadSwap(std::ifstream &stream, T &data)
{
SafeRead(stream, &data, sizeof(data));
data = letoh(data); //is this the proper byte order conversion?
}
bool
-CowDiskImage::open(const string &file)
+CowDiskImage::open(const std::string &file)
{
- ifstream stream(file.c_str());
+ std::ifstream stream(file.c_str());
if (!stream.is_open())
return false;
}
void
-SafeWrite(ofstream &stream, const void *data, int count)
+SafeWrite(std::ofstream &stream, const void *data, int count)
{
stream.write((const char *)data, count);
if (!stream.is_open())
template<class T>
void
-SafeWrite(ofstream &stream, const T &data)
+SafeWrite(std::ofstream &stream, const T &data)
{
SafeWrite(stream, &data, sizeof(data));
}
template<class T>
void
-SafeWriteSwap(ofstream &stream, const T &data)
+SafeWriteSwap(std::ofstream &stream, const T &data)
{
T swappeddata = letoh(data); //is this the proper byte order conversion?
SafeWrite(stream, &swappeddata, sizeof(data));
save(filename);}
void
-CowDiskImage::save(const string &file) const
+CowDiskImage::save(const std::string &file) const
{
if (!initialized)
panic("RawDiskImage not initialized");
- ofstream stream(file.c_str());
+ std::ofstream stream(file.c_str());
if (!stream.is_open() || stream.fail() || stream.bad())
panic("Error opening %s", file);
void
CowDiskImage::serialize(CheckpointOut &cp) const
{
- string cowFilename = name() + ".cow";
+ std::string cowFilename = name() + ".cow";
SERIALIZE_SCALAR(cowFilename);
save(CheckpointIn::dir() + "/" + cowFilename);
}
void
CowDiskImage::unserialize(CheckpointIn &cp)
{
- string cowFilename;
+ std::string cowFilename;
UNSERIALIZE_SCALAR(cowFilename);
cowFilename = cp.getCptDir() + "/" + cowFilename;
open(cowFilename);
#include "mem/port_proxy.hh"
#include "sim/system.hh"
-using namespace std;
-
SimpleDisk::SimpleDisk(const Params &p)
: SimObject(p), system(p.system), image(p.disk)
{}