diff options
-rw-r--r-- | arch/alpha/isa_desc | 32 | ||||
-rw-r--r-- | base/inifile.cc | 30 | ||||
-rw-r--r-- | base/inifile.hh | 3 | ||||
-rw-r--r-- | cpu/simple_cpu/simple_cpu.cc | 4 | ||||
-rw-r--r-- | dev/etherint.hh | 5 | ||||
-rw-r--r-- | sim/serialize.cc | 9 | ||||
-rw-r--r-- | util/tap/Makefile | 12 | ||||
-rw-r--r-- | util/tap/tap.cc | 27 |
8 files changed, 86 insertions, 36 deletions
diff --git a/arch/alpha/isa_desc b/arch/alpha/isa_desc index 3a0c1bffe..89ec05c0e 100644 --- a/arch/alpha/isa_desc +++ b/arch/alpha/isa_desc @@ -2388,27 +2388,39 @@ decode OPCODE default Unknown::unknown() { 0x1e: hw_rei({{ xc->hwrei(); }}); // M5 special opcodes use the reserved 0x01 opcode space - 0x01: decode M5FUNC{ + 0x01: decode M5FUNC { 0x00: arm({{ - Annotate::ARM(xc); - xc->kernelStats.arm(); + if (!xc->misspeculating()) { + Annotate::ARM(xc); + xc->kernelStats.arm(); + } }}); 0x01: quiesce({{ - Annotate::QUIESCE(xc); - xc->setStatus(ExecContext::Suspended); - xc->kernelStats.quiesce(); + if (!xc->misspeculating()) { + Annotate::QUIESCE(xc); + xc->setStatus(ExecContext::Suspended); + xc->kernelStats.quiesce(); + } }}); 0x10: ivlb({{ - Annotate::BeginInterval(xc); - xc->kernelStats.ivlb(); + if (!xc->misspeculating()) { + Annotate::BeginInterval(xc); + xc->kernelStats.ivlb(); + } + }}, No_OpClass); + 0x11: ivle({{ + if (!xc->misspeculating()) + Annotate::EndInterval(xc); }}, No_OpClass); - 0x11: ivle({{ Annotate::EndInterval(xc); }}, No_OpClass); 0x20: m5exit({{ if (!xc->misspeculating()) m5_exit(); }}, No_OpClass); 0x30: initparam({{ Ra = xc->cpu->system->init_param; }}); - 0x40: resetstats({{ Statistics::reset(); }}); + 0x40: resetstats({{ + if (!xc->misspeculating()) + Statistics::reset(); + }}); } } diff --git a/base/inifile.cc b/base/inifile.cc index 52468f46e..7e7485bcb 100644 --- a/base/inifile.cc +++ b/base/inifile.cc @@ -367,14 +367,40 @@ IniFile::findDefault(const string &_section, const string &entry, string &value) const { string section = _section; - while (!find(section, entry, value)) { - if (!find(section, "default", section)) + while (!findAppend(section, entry, value)) { + if (!find(section, "default", section)) { return false; + } } return true; } +bool +IniFile::findAppend(const string &_section, const string &entry, + string &value) const +{ + string section = _section; + bool ret = false; + bool first = true; + + do { + string val; + if (find(section, entry, val)) { + ret = true; + if (first) { + value = val; + first = false; + } else { + value += " "; + value += val; + } + + } + } while (find(section, "append", section)); + + return ret; +} bool IniFile::Section::printUnreferenced(const string §ionName) diff --git a/base/inifile.hh b/base/inifile.hh index 3a82f2d4d..34424eb4b 100644 --- a/base/inifile.hh +++ b/base/inifile.hh @@ -196,6 +196,9 @@ class IniFile bool findDefault(const std::string §ion, const std::string &entry, std::string &value) const; + bool findAppend(const std::string §ion, const std::string &entry, + std::string &value) const; + /// Print unreferenced entries in object. Iteratively calls /// printUnreferend() on all the constituent sections. bool printUnreferenced(); diff --git a/cpu/simple_cpu/simple_cpu.cc b/cpu/simple_cpu/simple_cpu.cc index d3d9bc2ca..3d0818672 100644 --- a/cpu/simple_cpu/simple_cpu.cc +++ b/cpu/simple_cpu/simple_cpu.cc @@ -261,7 +261,7 @@ SimpleCPU::serialize() for (int i = 0; i < NumFloatRegs; i++) { stringstream buf; ccprintf(buf, "F%02d", i); - paramOut(buf.str(), xc->regs.floatRegFile.d[i]); + paramOut(buf.str(), xc->regs.floatRegFile.q[i]); } // CPUTraitsType::serializeSpecialRegs(getProxy(), xc->regs); } @@ -281,7 +281,7 @@ SimpleCPU::unserialize(IniFile &db, const string &category, ConfigNode *node) stringstream buf; ccprintf(buf, "F%02d", i); db.findDefault(category, buf.str(), data); - xc->regs.floatRegFile.d[i] = strtod(data.c_str(),NULL); + to_number(data.c_str(), xc->regs.floatRegFile.q[i]); } // Read in Special registers diff --git a/dev/etherint.hh b/dev/etherint.hh index 1aa85f17c..dfc9f6fd6 100644 --- a/dev/etherint.hh +++ b/dev/etherint.hh @@ -56,7 +56,10 @@ class EtherInt : public SimObject void setPeer(EtherInt *p); virtual bool recvPacket(PacketPtr packet) = 0; void recvDone() { peer->sendDone(); } - bool sendPacket(PacketPtr packet) { return peer->recvPacket(packet); } + bool sendPacket(PacketPtr packet) + { + return peer ? peer->recvPacket(packet) : true; + } virtual void sendDone() = 0; }; diff --git a/sim/serialize.cc b/sim/serialize.cc index 6144c97d0..c90f1694e 100644 --- a/sim/serialize.cc +++ b/sim/serialize.cc @@ -100,8 +100,9 @@ Serializeable::childOut(const string &name, Serializeable *child) void Serializeable::setName(const string &name) { - if (objName != "") - panic("Cannot change object name"); + if (objName != "") { + cprintf("Renaming object '%s' to '%s'.\n", objName, name); + } objName = name; } @@ -160,7 +161,7 @@ Serializer::serialize(const string &f) add_objects(); while (!objects.empty()) { Serializeable *serial = objects.front(); - DPRINTF(Serialize, "Name Children of %s\n", serial->name()); + DPRINTF(Serialize, "Naming children of %s\n", serial->name()); serial->nameChildren(); objects.pop_front(); list.push_back(serial); @@ -174,7 +175,7 @@ Serializer::serialize(const string &f) add_objects(); while (!objects.empty()) { Serializeable *serial = objects.front(); - DPRINTF(Serialize, "Name Children of %s\n", serial->name()); + DPRINTF(Serialize, "Serializing %s\n", serial->name()); serial->serialize(); objects.pop_front(); list.push_back(serial); diff --git a/util/tap/Makefile b/util/tap/Makefile index c7078158b..2618a5210 100644 --- a/util/tap/Makefile +++ b/util/tap/Makefile @@ -33,14 +33,12 @@ CXX= g++ CURDIR?= $(shell /bin/pwd) SRCDIR?= . +M5_SRCDIR?= $(SRCDIR)/../.. -BASE_SRCDIR?= $(SRCDIR)/../../base -SIM_SRCDIR?= $(SRCDIR)/../../sim +vpath % $(M5_SRCDIR)/base +vpath % $(M5_SRCDIR)/sim -vpath % $(BASE_SRCDIR) -vpath % $(SIM_SRCDIR) - -INCLDIRS= -I. -I$(BASE_SRCDIR) -I$(SIM_SRCDIR) -I- -I/usr/local/include +INCLDIRS= -I. -I$(M5_SRCDIR) -I- -I/usr/local/include CCFLAGS= -g -O0 -MMD $(INCLDIRS) default: m5tap @@ -48,6 +46,8 @@ default: m5tap m5tap: tap.o cprintf.o $(CXX) $(LFLAGS) -o $@ $^ -lpcap -L/usr/local/lib -ldnet +install: m5tap + $(SUDO) install -o root -m 555 m5tap /usr/local/bin clean: @rm -f m5tap *.o *.d *~ .#* diff --git a/util/tap/tap.cc b/util/tap/tap.cc index 9c13051ca..7121ebcbb 100644 --- a/util/tap/tap.cc +++ b/util/tap/tap.cc @@ -71,12 +71,12 @@ usage() int verbose = 0; #define DPRINTF(args...) do { \ - if (verbose > 1) \ + if (verbose >= 1) \ cprintf(args); \ } while (0) #define DDUMP(args...) do { \ - if (verbose > 2) \ + if (verbose >= 2) \ dump((const u_char *)args); \ } while (0) @@ -126,13 +126,13 @@ Socket(int reuse) { int fd = ::socket(PF_INET, SOCK_STREAM, 0); if (fd < 0) - panic("Can't create socket!"); + panic("Can't create socket!\n"); if (reuse) { int i = 1; if (::setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&i, sizeof(i)) < 0) - panic("setsockopt() SO_REUSEADDR failed!"); + panic("setsockopt() SO_REUSEADDR failed!\n"); } return fd; @@ -148,10 +148,10 @@ Listen(int fd, int port) sockaddr.sin_port = htons(port); int ret = ::bind(fd, (struct sockaddr *)&sockaddr, sizeof (sockaddr)); if (ret == -1) - panic("bind() failed!"); + panic("bind() failed!\n"); if (::listen(fd, 1) == -1) - panic("listen() failed!"); + panic("listen() failed!\n"); } // Open a connection. Accept will block, so if you don't want it to, @@ -163,7 +163,7 @@ Accept(int fd, bool nodelay) socklen_t slen = sizeof (sockaddr); int sfd = ::accept(fd, (struct sockaddr *)&sockaddr, &slen); if (sfd == -1) - panic("accept() failed!"); + panic("accept() failed!\n"); if (nodelay) { int i = 1; @@ -188,7 +188,7 @@ Connect(int fd, const string &host, int port) sockaddr.sin_port = htons(port); if (::connect(fd, (struct sockaddr *)&sockaddr, sizeof(sockaddr)) != 0) - panic("could not connect to %s on port %d", host, port); + panic("could not connect to %s on port %d\n", host, port); DPRINTF("connected to %s on port %d\n", host, port); } @@ -269,13 +269,14 @@ main(int argc, char *argv[]) } char errbuf[PCAP_ERRBUF_SIZE]; + memset(errbuf, 0, sizeof errbuf); pcap_t *pcap = pcap_open_live(device, 1500, 1, -1, errbuf); if (pcap == NULL) panic("pcap_open_live failed: %s\n", errbuf); bpf_program program; bpf_u_int32 localnet, netmask; - if (!pcap_lookupnet(device, &localnet, &netmask, errbuf)) + if (pcap_lookupnet(device, &localnet, &netmask, errbuf) == -1) panic("pcap_lookupnet failed: %s\n", errbuf); if (pcap_compile(pcap, &program, filter, 1, netmask) == -1) @@ -285,6 +286,8 @@ main(int argc, char *argv[]) panic("pcap_setfilter failed\n"); eth_t *ethernet = eth_open(device); + if (!ethernet) + panic("cannot open the ethernet device for writing\n"); pollfd pfds[3]; pfds[0].fd = Socket(true); @@ -312,6 +315,7 @@ main(int argc, char *argv[]) int32_t buffer_offset = 0; int32_t data_len = 0; + DPRINTF("Begin poll loop\n"); while (!quit) { int ret = ::poll(pfds, npfds, INFTIM); if (ret < 0) @@ -392,14 +396,15 @@ main(int argc, char *argv[]) if (listening) npfds--; - else + else { + DPRINTF("Calling it quits because of poll error\n"); quit = true; + } } if (client_pfd) client_pfd->revents = 0; } - } delete [] buffer; |