dev: Stop "using namespace std"
Change-Id: I317df9b566936445c3a02c28ed37146a16610454 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39538 Tested-by: kokoro <noreply+kokoro@google.com> Maintainer: Gabe Black <gabe.black@gmail.com> Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
This commit is contained in:
@@ -38,8 +38,6 @@
|
||||
#include "params/BadDevice.hh"
|
||||
#include "sim/system.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
BadDevice::BadDevice(const Params &p)
|
||||
: BasicPioDevice(p, 0x10), devname(p.devicename)
|
||||
{
|
||||
|
||||
@@ -31,9 +31,7 @@
|
||||
#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)
|
||||
{
|
||||
@@ -42,7 +40,7 @@ Intel8254Timer::Intel8254Timer(EventManager *em, const string &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);
|
||||
@@ -68,7 +66,7 @@ Intel8254Timer::writeControl(const CtrlReg data)
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -77,7 +75,7 @@ Intel8254Timer::serialize(const string &base, CheckpointOut &cp) const
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -94,7 +92,7 @@ Intel8254Timer::startup()
|
||||
}
|
||||
|
||||
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),
|
||||
@@ -225,7 +223,8 @@ Intel8254Timer::Counter::outputHigh()
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -243,7 +242,7 @@ Intel8254Timer::Counter::serialize(const string &base, CheckpointOut &cp) const
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
#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)
|
||||
{
|
||||
|
||||
@@ -39,8 +39,6 @@
|
||||
#include "debug/MC146818.hh"
|
||||
#include "dev/rtcreg.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
static uint8_t
|
||||
bcdize(uint8_t val)
|
||||
{
|
||||
@@ -87,8 +85,8 @@ MC146818::setTime(const struct tm time)
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
@@ -262,7 +260,7 @@ MC146818::tickClock()
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -282,7 +280,7 @@ MC146818::serialize(const string &base, CheckpointOut &cp) const
|
||||
}
|
||||
|
||||
void
|
||||
MC146818::unserialize(const string &base, CheckpointIn &cp)
|
||||
MC146818::unserialize(const std::string &base, CheckpointIn &cp)
|
||||
{
|
||||
uint8_t tmp8;
|
||||
|
||||
|
||||
@@ -43,8 +43,6 @@
|
||||
#include "params/Malta.hh"
|
||||
#include "sim/system.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
Malta::Malta(const Params &p)
|
||||
: Platform(p), system(p.system)
|
||||
{
|
||||
|
||||
@@ -48,8 +48,6 @@
|
||||
#include "params/MaltaCChip.hh"
|
||||
#include "sim/system.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
MaltaCChip::MaltaCChip(const Params &p)
|
||||
: BasicPioDevice(p, 0xfffffff), malta(p.malta)
|
||||
{
|
||||
|
||||
@@ -51,9 +51,7 @@
|
||||
#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)
|
||||
{
|
||||
|
||||
@@ -66,8 +66,6 @@
|
||||
#include "sim/serialize.hh"
|
||||
#include "sim/system.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
DistEtherLink::DistEtherLink(const Params &p)
|
||||
: SimObject(p), linkDelay(p.delay)
|
||||
{
|
||||
@@ -228,7 +226,7 @@ DistEtherLink::Link::unserialize(CheckpointIn &cp)
|
||||
bool packet_exists;
|
||||
UNSERIALIZE_SCALAR(packet_exists);
|
||||
if (packet_exists) {
|
||||
packet = make_shared<EthPacketData>();
|
||||
packet = std::make_shared<EthPacketData>();
|
||||
packet->unserialize("packet", cp);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,6 @@
|
||||
#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;
|
||||
|
||||
@@ -46,8 +46,6 @@
|
||||
#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"),
|
||||
|
||||
@@ -63,8 +63,6 @@
|
||||
#include "sim/serialize.hh"
|
||||
#include "sim/system.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
EtherLink::EtherLink(const Params &p)
|
||||
: SimObject(p)
|
||||
{
|
||||
@@ -98,14 +96,14 @@ EtherLink::getPort(const std::string &if_name, PortID idx)
|
||||
}
|
||||
|
||||
|
||||
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),
|
||||
@@ -198,7 +196,7 @@ EtherLink::Link::transmit(EthPacketPtr pkt)
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -224,12 +222,12 @@ EtherLink::Link::serialize(const string &base, CheckpointOut &cp) const
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -245,7 +243,7 @@ EtherLink::Link::unserialize(const string &base, CheckpointIn &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(
|
||||
|
||||
@@ -34,10 +34,8 @@
|
||||
#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);
|
||||
@@ -46,7 +44,7 @@ EthPacketData::serialize(const string &base, CheckpointOut &cp) const
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@@ -37,8 +37,6 @@
|
||||
#include "debug/EthernetAll.hh"
|
||||
#include "sim/core.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
EtherSwitch::EtherSwitch(const Params &p)
|
||||
: SimObject(p), ttl(p.time_to_live)
|
||||
{
|
||||
@@ -308,7 +306,7 @@ EtherSwitch::Interface::PortFifoEntry::serialize(CheckpointOut &cp) const
|
||||
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);
|
||||
|
||||
@@ -67,8 +67,6 @@
|
||||
#include "dev/net/etherint.hh"
|
||||
#include "dev/net/etherpkt.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
class TapEvent : public PollEvent
|
||||
{
|
||||
protected:
|
||||
@@ -185,7 +183,7 @@ void
|
||||
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);
|
||||
@@ -261,7 +259,7 @@ TapListener::listen()
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
|
||||
#include "base/logging.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool
|
||||
PacketFifo::copyout(void *dest, unsigned offset, unsigned len)
|
||||
{
|
||||
@@ -51,7 +49,7 @@ 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;
|
||||
@@ -64,7 +62,7 @@ PacketFifo::copyout(void *dest, unsigned offset, unsigned len)
|
||||
|
||||
|
||||
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);
|
||||
@@ -73,9 +71,9 @@ PacketFifoEntry::serialize(const string &base, CheckpointOut &cp) const
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -83,7 +81,7 @@ PacketFifoEntry::unserialize(const string &base, CheckpointIn &cp)
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -96,7 +94,7 @@ PacketFifo::serialize(const string &base, CheckpointOut &cp) const
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
#include "sim/eventq.hh"
|
||||
#include "sim/stats.hh"
|
||||
|
||||
using namespace std;
|
||||
using namespace Net;
|
||||
|
||||
namespace Sinic {
|
||||
@@ -835,8 +834,8 @@ Device::rxKick()
|
||||
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
|
||||
@@ -1016,7 +1015,7 @@ Device::txKick()
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -1425,7 +1424,7 @@ Device::unserialize(CheckpointIn &cp)
|
||||
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);
|
||||
|
||||
@@ -71,14 +71,12 @@
|
||||
#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,
|
||||
@@ -105,7 +103,7 @@ TCPIface::TCPIface(string server_name, unsigned server_port,
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -157,10 +155,10 @@ TCPIface::establishConnection()
|
||||
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;
|
||||
@@ -223,7 +221,7 @@ TCPIface::connect()
|
||||
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));
|
||||
@@ -326,7 +324,7 @@ TCPIface::recvHeader(Header &header)
|
||||
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;
|
||||
|
||||
@@ -31,8 +31,6 @@
|
||||
#include "base/logging.hh"
|
||||
#include "sim/sim_exit.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
Platform::Platform(const Params &p)
|
||||
: SimObject(p), intrctrl(p.intrctrl)
|
||||
{
|
||||
|
||||
@@ -73,9 +73,6 @@
|
||||
#include "dev/platform.hh"
|
||||
#include "dev/serial/uart.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
/*
|
||||
* Poll event for the listen socket
|
||||
*/
|
||||
@@ -124,7 +121,7 @@ Terminal::Terminal(const Params &p)
|
||||
#endif
|
||||
{
|
||||
if (outfile)
|
||||
outfile->stream()->setf(ios::unitbuf);
|
||||
outfile->stream()->setf(std::ios::unitbuf);
|
||||
|
||||
if (p.port)
|
||||
listen(p.port);
|
||||
@@ -178,7 +175,7 @@ Terminal::listen(int 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);
|
||||
@@ -203,7 +200,7 @@ Terminal::accept()
|
||||
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
|
||||
|
||||
@@ -43,8 +43,6 @@
|
||||
#include "mem/packet_access.hh"
|
||||
#include "sim/serialize.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
void
|
||||
Uart8250::processIntrEvent(int intrBit)
|
||||
{
|
||||
|
||||
@@ -44,8 +44,6 @@
|
||||
#include "mem/port.hh"
|
||||
#include "sim/system.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
DumbTOD::DumbTOD(const Params &p)
|
||||
: BasicPioDevice(p, 0x08)
|
||||
{
|
||||
|
||||
@@ -39,8 +39,6 @@
|
||||
#include "cpu/intr_control.hh"
|
||||
#include "sim/system.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
T1000::T1000(const Params &p)
|
||||
: Platform(p), system(p.system)
|
||||
{}
|
||||
|
||||
@@ -50,8 +50,6 @@
|
||||
#include "sim/serialize.hh"
|
||||
#include "sim/sim_exit.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Raw Disk image
|
||||
@@ -79,16 +77,16 @@ RawDiskImage::notifyFork()
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -107,7 +105,7 @@ RawDiskImage::size() const
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -123,11 +121,11 @@ RawDiskImage::read(uint8_t *data, std::streampos offset) const
|
||||
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);
|
||||
@@ -148,14 +146,14 @@ RawDiskImage::write(const uint8_t *data, std::streampos 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;
|
||||
}
|
||||
@@ -206,7 +204,7 @@ CowDiskImage::notifyFork()
|
||||
}
|
||||
|
||||
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())
|
||||
@@ -221,23 +219,23 @@ SafeRead(ifstream &stream, void *data, int count)
|
||||
|
||||
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;
|
||||
|
||||
@@ -289,7 +287,7 @@ CowDiskImage::initSectorTable(int hash_size)
|
||||
}
|
||||
|
||||
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())
|
||||
@@ -304,14 +302,14 @@ SafeWrite(ofstream &stream, const void *data, int count)
|
||||
|
||||
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));
|
||||
@@ -327,12 +325,12 @@ CowDiskImage::save() const
|
||||
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);
|
||||
|
||||
@@ -423,7 +421,7 @@ CowDiskImage::write(const uint8_t *data, std::streampos offset)
|
||||
void
|
||||
CowDiskImage::serialize(CheckpointOut &cp) const
|
||||
{
|
||||
string cowFilename = name() + ".cow";
|
||||
std::string cowFilename = name() + ".cow";
|
||||
SERIALIZE_SCALAR(cowFilename);
|
||||
save(CheckpointIn::dir() + "/" + cowFilename);
|
||||
}
|
||||
@@ -431,7 +429,7 @@ CowDiskImage::serialize(CheckpointOut &cp) const
|
||||
void
|
||||
CowDiskImage::unserialize(CheckpointIn &cp)
|
||||
{
|
||||
string cowFilename;
|
||||
std::string cowFilename;
|
||||
UNSERIALIZE_SCALAR(cowFilename);
|
||||
cowFilename = cp.getCptDir() + "/" + cowFilename;
|
||||
open(cowFilename);
|
||||
|
||||
@@ -48,8 +48,6 @@
|
||||
#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)
|
||||
{}
|
||||
|
||||
Reference in New Issue
Block a user