summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/alpha/ev5.cc21
-rw-r--r--arch/alpha/isa_desc20
-rw-r--r--base/statistics.hh2
-rw-r--r--base/trace.cc63
-rw-r--r--cpu/base_cpu.cc6
-rw-r--r--cpu/exec_context.cc5
-rw-r--r--cpu/exec_context.hh6
-rw-r--r--cpu/simple_cpu/simple_cpu.cc31
-rw-r--r--dev/alpha_console.cc2
-rw-r--r--dev/etherdump.cc12
-rw-r--r--kern/tru64/tru64_system.cc4
-rw-r--r--kern/tru64/tru64_system.hh23
-rw-r--r--sim/sim_events.cc24
-rw-r--r--sim/system.hh49
14 files changed, 169 insertions, 99 deletions
diff --git a/arch/alpha/ev5.cc b/arch/alpha/ev5.cc
index aaa81a58d..551cbdabf 100644
--- a/arch/alpha/ev5.cc
+++ b/arch/alpha/ev5.cc
@@ -237,6 +237,11 @@ ExecContext::readIpr(int idx, Fault &fault)
retval = ipr[idx];
break;
+ case AlphaISA::IPR_CC:
+ retval |= ipr[idx] & ULL(0xffffffff00000000);
+ retval |= curTick & ULL(0x00000000ffffffff);
+ break;
+
case AlphaISA::IPR_VA:
// SFX: unlocks interrupt status registers
retval = ipr[idx];
@@ -329,13 +334,25 @@ ExecContext::setIpr(int idx, uint64_t val)
case AlphaISA::IPR_PAL_BASE:
case AlphaISA::IPR_IC_PERR_STAT:
case AlphaISA::IPR_DC_PERR_STAT:
- case AlphaISA::IPR_CC_CTL:
- case AlphaISA::IPR_CC:
case AlphaISA::IPR_PMCTR:
// write entire quad w/ no side-effect
ipr[idx] = val;
break;
+ case AlphaISA::IPR_CC_CTL:
+ // This IPR resets the cycle counter. We assume this only
+ // happens once... let's verify that.
+ assert(ipr[idx] == 0);
+ ipr[idx] = 1;
+ break;
+
+ case AlphaISA::IPR_CC:
+ // This IPR only writes the upper 64 bits. It's ok to write
+ // all 64 here since we mask out the lower 32 in rpcc (see
+ // isa_desc).
+ ipr[idx] = val;
+ break;
+
case AlphaISA::IPR_PALtemp23:
// write entire quad w/ no side-effect
ipr[idx] = val;
diff --git a/arch/alpha/isa_desc b/arch/alpha/isa_desc
index 41f7388e0..56e7cb31c 100644
--- a/arch/alpha/isa_desc
+++ b/arch/alpha/isa_desc
@@ -5,7 +5,7 @@
let {{
global rcs_id
- rcs_id = "$Id$"
+ rcs_id = "$Id: s.isa_desc 1.43 04/02/29 22:41:10-05:00 ehallnor@zazzer.eecs.umich.edu $"
}};
@@ -1854,9 +1854,10 @@ decode OPCODE default Unknown::unknown() {
0x23: ldt({{ EA = Rb + disp; }}, {{ Fa = Mem.df; }});
0x2a: ldl_l({{ EA = Rb + disp; }}, {{ Ra.sl = Mem.sl; }}, LOCKED);
0x2b: ldq_l({{ EA = Rb + disp; }}, {{ Ra.uq = Mem.uq; }}, LOCKED);
- 0x20: copy_load({{EA = Ra;}},
{{fault = memAccessObj->copySrcTranslate(EA);}},
- IsMemRef, IsLoad, IsCopy);
+ //0x20: copy_load({{EA = Ra;}},
+ // {{memAccessObj->copySrcTranslate(EA);}},
+ // IsMemRef, IsLoad, IsCopy);
}
format LoadOrPrefetch {
@@ -1876,9 +1877,10 @@ decode OPCODE default Unknown::unknown() {
0x0f: stq_u({{ EA = (Rb + disp) & ~7; }}, {{ Mem.uq = Ra.uq; }});
0x26: sts({{ EA = Rb + disp; }}, {{ Mem.ul = t_to_s(Fa.uq); }});
0x27: stt({{ EA = Rb + disp; }}, {{ Mem.df = Fa; }});
- 0x24: copy_store({{EA = Rb;}},
{{fault =memAccessObj->copy(EA);}},
- IsMemRef, IsStore, IsCopy);
+ //0x24: copy_store({{EA = Rb;}},
+ // {{memAccessObj->copy(EA);}},
+ // IsMemRef, IsStore, IsCopy);
}
format StoreCond {
@@ -2388,7 +2390,13 @@ decode OPCODE default Unknown::unknown() {
}
format BasicOperate {
- 0xc000: rpcc({{ Ra = curTick; }});
+ 0xc000: rpcc({{
+#ifdef FULL_SYSTEM
+ Ra = xc->readIpr(AlphaISA::IPR_CC, fault);
+#else
+ Ra = curTick;
+#endif
+ }});
// All of the barrier instructions below do nothing in
// their execute() methods (hence the empty code blocks).
diff --git a/base/statistics.hh b/base/statistics.hh
index 71d2aa8c8..c99aadab5 100644
--- a/base/statistics.hh
+++ b/base/statistics.hh
@@ -2498,7 +2498,7 @@ struct NoBin
* binned. If the typedef is NoBin, nothing is binned. If it is
* MainBin, then all stats are binned under that Bin.
*/
-#ifdef FS_MEASURE
+#if defined(STATS_BINNING)
typedef MainBin DefaultBin;
#else
typedef NoBin DefaultBin;
diff --git a/base/trace.cc b/base/trace.cc
index cca58d669..e56bdb11b 100644
--- a/base/trace.cc
+++ b/base/trace.cc
@@ -319,3 +319,66 @@ echoTrace(bool on)
}
}
}
+
+extern "C"
+void
+printTraceFlags()
+{
+ using namespace Trace;
+ for (int i = 0; i < numFlagStrings; ++i)
+ if (flags[i])
+ cprintf("%s\n", flagStrings[i]);
+}
+
+void
+tweakTraceFlag(const char *string, bool value)
+{
+ using namespace Trace;
+ std::string str(string);
+
+ for (int i = 0; i < numFlagStrings; ++i) {
+ if (str != flagStrings[i])
+ continue;
+
+ int idx = i;
+
+ if (idx < NumFlags) {
+ flags[idx] = value;
+ } else {
+ idx -= NumFlags;
+ if (idx >= NumCompoundFlags) {
+ ccprintf(cerr, "Invalid compound flag");
+ return;
+ }
+
+ const Flags *flagVec = compoundFlags[idx];
+
+ for (int j = 0; flagVec[j] != -1; ++j) {
+ if (flagVec[j] >= NumFlags) {
+ ccprintf(cerr, "Invalid compound flag");
+ return;
+ }
+ flags[flagVec[j]] = value;
+ }
+ }
+
+ cprintf("flag %s was %s\n", string, value ? "set" : "cleared");
+ return;
+ }
+
+ cprintf("could not find flag %s\n", string);
+}
+
+extern "C"
+void
+setTraceFlag(const char *string)
+{
+ tweakTraceFlag(string, true);
+}
+
+extern "C"
+void
+clearTraceFlag(const char *string)
+{
+ tweakTraceFlag(string, false);
+}
diff --git a/cpu/base_cpu.cc b/cpu/base_cpu.cc
index 604ee335d..367662f25 100644
--- a/cpu/base_cpu.cc
+++ b/cpu/base_cpu.cc
@@ -184,6 +184,12 @@ BaseCPU::takeOverFrom(BaseCPU *oldCPU)
newXC->process->replaceExecContext(newXC->cpu_id, newXC);
#endif
}
+
+#ifdef FULL_SYSTEM
+ for (int i = 0; i < NumInterruptLevels; ++i)
+ interrupts[i] = oldCPU->interrupts[i];
+ intstatus = oldCPU->intstatus;
+#endif
}
diff --git a/cpu/exec_context.cc b/cpu/exec_context.cc
index 6a5f463cd..b0ebb9622 100644
--- a/cpu/exec_context.cc
+++ b/cpu/exec_context.cc
@@ -48,10 +48,7 @@ ExecContext::ExecContext(BaseCPU *_cpu, int _thread_num, System *_sys,
kernelStats(this, _cpu), cpu(_cpu), thread_num(_thread_num),
cpu_id(-1), mem(_mem), itb(_itb), dtb(_dtb), system(_sys),
memCtrl(_sys->memCtrl), physmem(_sys->physmem),
-#ifdef FS_MEASURE
- swCtx(NULL),
-#endif
- func_exe_inst(0), storeCondFailures(0)
+ swCtx(NULL), func_exe_inst(0), storeCondFailures(0)
{
memset(&regs, 0, sizeof(RegFile));
}
diff --git a/cpu/exec_context.hh b/cpu/exec_context.hh
index ccb01f486..a72516ac7 100644
--- a/cpu/exec_context.hh
+++ b/cpu/exec_context.hh
@@ -45,10 +45,7 @@ class MemoryController;
#include "kern/tru64/kernel_stats.hh"
#include "sim/system.hh"
-
-#ifdef FS_MEASURE
#include "sim/sw_context.hh"
-#endif
#else // !FULL_SYSTEM
@@ -137,10 +134,7 @@ class ExecContext
MemoryController *memCtrl;
PhysicalMemory *physmem;
-#ifdef FS_MEASURE
SWContext *swCtx;
-#endif
-
#else
Process *process;
diff --git a/cpu/simple_cpu/simple_cpu.cc b/cpu/simple_cpu/simple_cpu.cc
index 2553bd22a..c2796efd0 100644
--- a/cpu/simple_cpu/simple_cpu.cc
+++ b/cpu/simple_cpu/simple_cpu.cc
@@ -715,32 +715,13 @@ SimpleCPU::tick()
xc->func_exe_inst++;
fault = si->execute(this, xc, traceData);
-#ifdef FS_MEASURE
- if (!(xc->misspeculating()) && (xc->system->bin)) {
- SWContext *ctx = xc->swCtx;
- if (ctx && !ctx->callStack.empty()) {
- if (si->isCall()) {
- ctx->calls++;
- }
- if (si->isReturn()) {
- if (ctx->calls == 0) {
- fnCall *top = ctx->callStack.top();
- DPRINTF(TCPIP, "Removing %s from callstack.\n", top->name);
- delete top;
- ctx->callStack.pop();
- if (ctx->callStack.empty())
- xc->system->nonPath->activate();
- else
- ctx->callStack.top()->myBin->activate();
-
- xc->system->dumpState(xc);
- } else {
- ctx->calls--;
- }
- }
- }
- }
+
+#ifdef FULL_SYSTEM
+ SWContext *ctx = xc->swCtx;
+ if (ctx)
+ ctx->process(xc, si.get());
#endif
+
if (si->isMemRef()) {
numMemRefs++;
}
diff --git a/dev/alpha_console.cc b/dev/alpha_console.cc
index 85b4d57f2..04046557a 100644
--- a/dev/alpha_console.cc
+++ b/dev/alpha_console.cc
@@ -63,7 +63,7 @@ AlphaConsole::AlphaConsole(const string &name, SimConsole *cons, SimpleDisk *d,
if (bus) {
pioInterface = newPioInterface(name, hier, bus, this,
&AlphaConsole::cacheAccess);
- pioInterface->setAddrRange(addr, addr + size);
+ pioInterface->addAddrRange(addr, addr + size);
}
consoleData = new uint8_t[size];
diff --git a/dev/etherdump.cc b/dev/etherdump.cc
index 23b3d778e..b6d6bbe30 100644
--- a/dev/etherdump.cc
+++ b/dev/etherdump.cc
@@ -34,6 +34,7 @@
#include <string>
+#include "base/misc.hh"
#include "dev/etherdump.hh"
#include "sim/builder.hh"
#include "sim/universe.hh"
@@ -63,7 +64,8 @@ struct pcap_file_header {
};
struct pcap_pkthdr {
- struct timeval ts; // time stamp
+ uint32_t seconds;
+ uint32_t microseconds;
uint32_t caplen; // length of portion present
uint32_t len; // length this packet (off wire)
};
@@ -96,8 +98,8 @@ EtherDump::init()
* to sim_cycles.
*/
pcap_pkthdr pkthdr;
- pkthdr.ts.tv_sec = curtime;
- pkthdr.ts.tv_usec = 0;
+ pkthdr.seconds = curtime;
+ pkthdr.microseconds = 0;
pkthdr.caplen = 0;
pkthdr.len = 0;
stream.write(reinterpret_cast<char *>(&pkthdr), sizeof(pkthdr));
@@ -109,8 +111,8 @@ void
EtherDump::dumpPacket(PacketPtr &packet)
{
pcap_pkthdr pkthdr;
- pkthdr.ts.tv_sec = curtime + (curTick / s_freq);
- pkthdr.ts.tv_usec = (curTick / us_freq) % ULL(1000000);
+ pkthdr.seconds = curtime + (curTick / s_freq);
+ pkthdr.microseconds = (curTick / us_freq) % ULL(1000000);
pkthdr.caplen = packet->length;
pkthdr.len = packet->length;
stream.write(reinterpret_cast<char *>(&pkthdr), sizeof(pkthdr));
diff --git a/kern/tru64/tru64_system.cc b/kern/tru64/tru64_system.cc
index 1cd98fdc1..13f28beab 100644
--- a/kern/tru64/tru64_system.cc
+++ b/kern/tru64/tru64_system.cc
@@ -604,7 +604,6 @@ Tru64System::breakpoint()
return remoteGDB[0]->trap(ALPHA_KENTRY_INT);
}
-#ifdef FS_MEASURE
void
Tru64System::populateMap(std::string callee, std::string caller)
{
@@ -646,7 +645,6 @@ Tru64System::dumpState(ExecContext *xc) const
}
}
}
-#endif //FS_MEASURE
BEGIN_DECLARE_SIM_OBJECT_PARAMS(Tru64System)
@@ -672,7 +670,7 @@ BEGIN_INIT_SIM_OBJECT_PARAMS(Tru64System)
INIT_PARAM(console_code, "file that contains the console code"),
INIT_PARAM(pal_code, "file that contains palcode"),
INIT_PARAM_DFLT(boot_osflags, "flags to pass to the kernel during boot",
- "a")
+ "a")
END_INIT_SIM_OBJECT_PARAMS(Tru64System)
diff --git a/kern/tru64/tru64_system.hh b/kern/tru64/tru64_system.hh
index 93cc908e3..bedf1f383 100644
--- a/kern/tru64/tru64_system.hh
+++ b/kern/tru64/tru64_system.hh
@@ -29,15 +29,12 @@
#ifndef __TRU64_SYSTEM_HH__
#define __TRU64_SYSTEM_HH__
+#include <map>
#include <vector>
#include "sim/system.hh"
#include "targetarch/isa_traits.hh"
-#ifdef FS_MEASURE
-#include <map>
-#endif
-
class ExecContext;
class EcoffObject;
class SymbolTable;
@@ -48,9 +45,7 @@ class SkipFuncEvent;
class PrintfEvent;
class DebugPrintfEvent;
class DumpMbufEvent;
-#ifdef FS_MEASURE
class FnEvent;
-#endif
class AlphaArguments;
class Tru64System : public System
@@ -150,11 +145,6 @@ class Tru64System : public System
Addr kernelEntry;
bool bin;
-#ifdef FS_MEASURE
- std::multimap<const std::string, std::string> callerMap;
- void populateMap(std::string caller, std::string callee);
-#endif
-
public:
std::vector<RemoteGDB *> remoteGDB;
std::vector<GDBListener *> gdbListen;
@@ -168,7 +158,7 @@ class Tru64System : public System
const std::string &console_path,
const std::string &palcode,
const std::string &boot_osflags,
- const bool _bin);
+ const bool _bin);
~Tru64System();
int registerExecContext(ExecContext *xc);
@@ -182,10 +172,15 @@ class Tru64System : public System
static void Printf(AlphaArguments args);
static void DumpMbuf(AlphaArguments args);
-#ifdef FS_MEASURE
+
+ // Lisa's fs measure stuff
+ private:
+ std::multimap<const std::string, std::string> callerMap;
+ void populateMap(std::string caller, std::string callee);
+
+ public:
bool findCaller(std::string callee, std::string caller) const;
void dumpState(ExecContext *xc) const;
-#endif //FS_MEASURE
};
#endif // __TRU64_SYSTEM_HH__
diff --git a/sim/sim_events.cc b/sim/sim_events.cc
index a31da18dd..f7b07359c 100644
--- a/sim/sim_events.cc
+++ b/sim/sim_events.cc
@@ -28,11 +28,13 @@
#include <string>
-#include "sim/param.hh"
-#include "sim/eventq.hh"
+#include "base/callback.hh"
#include "base/hostinfo.hh"
+#include "sim/eventq.hh"
+#include "sim/param.hh"
#include "sim/sim_events.hh"
#include "sim/sim_exit.hh"
+#include "sim/sim_init.hh"
#include "sim/sim_stats.hh"
using namespace std;
@@ -178,7 +180,7 @@ class ProgressEvent : public Event
ProgressEvent::ProgressEvent(EventQueue *q, Tick _interval)
: Event(q), interval(_interval)
{
- schedule(interval);
+ schedule(curTick + interval);
}
//
@@ -221,10 +223,24 @@ ProgressParamContext progessMessageParams("progress");
Param<Tick> progress_interval(&progessMessageParams, "cycle",
"cycle interval for progress messages");
+namespace {
+ struct SetupProgress : public Callback
+ {
+ Tick interval;
+ SetupProgress(Tick tick) : interval(tick) {}
+
+ virtual void process()
+ {
+ new ProgressEvent(&mainEventQueue, interval);
+ delete this;
+ }
+ };
+}
+
/* check execute options */
void
ProgressParamContext::checkParams()
{
if (progress_interval.isValid())
- new ProgressEvent(&mainEventQueue, progress_interval);
+ registerInitCallback(new SetupProgress(progress_interval));
}
diff --git a/sim/system.hh b/sim/system.hh
index 8348a144e..2e0cb3dbf 100644
--- a/sim/system.hh
+++ b/sim/system.hh
@@ -32,14 +32,11 @@
#include <string>
#include <vector>
-#include "sim/sim_object.hh"
-#include "cpu/pc_event.hh"
#include "base/loader/symtab.hh"
-
-#ifdef FS_MEASURE
#include "base/statistics.hh"
+#include "cpu/pc_event.hh"
+#include "sim/sim_object.hh"
#include "sim/sw_context.hh"
-#endif
class MemoryController;
class PhysicalMemory;
@@ -50,11 +47,28 @@ class ExecContext;
class System : public SimObject
{
-#ifdef FS_MEASURE
+ // lisa's binning stuff
protected:
std::map<const std::string, Statistics::MainBin *> fnBins;
std::map<const Addr, SWContext *> swCtxMap;
-#endif //FS_MEASURE
+
+ public:
+ Statistics::Scalar<Counter> fnCalls;
+ Statistics::MainBin *nonPath;
+
+ Statistics::MainBin * getBin(const std::string &name);
+ virtual bool findCaller(std::string, std::string) const = 0;
+
+ SWContext *findContext(Addr pcb);
+ bool addContext(Addr pcb, SWContext *ctx) {
+ return (swCtxMap.insert(make_pair(pcb, ctx))).second;
+ }
+ void remContext(Addr pcb) {
+ swCtxMap.erase(pcb);
+ return;
+ }
+
+ virtual void dumpState(ExecContext *xc) const = 0;
public:
const uint64_t init_param;
@@ -69,11 +83,6 @@ class System : public SimObject
virtual int registerExecContext(ExecContext *xc);
virtual void replaceExecContext(int xcIndex, ExecContext *xc);
-#ifdef FS_MEASURE
- Statistics::Scalar<Counter, Statistics::MainBin> fnCalls;
- Statistics::MainBin *nonPath;
-#endif //FS_MEASURE
-
public:
System(const std::string _name, const uint64_t _init_param,
MemoryController *, PhysicalMemory *, const bool);
@@ -84,22 +93,6 @@ class System : public SimObject
virtual Addr getKernelEntry() const = 0;
virtual bool breakpoint() = 0;
-#ifdef FS_MEASURE
- Statistics::MainBin * getBin(const std::string &name);
- virtual bool findCaller(std::string, std::string) const = 0;
-
- SWContext *findContext(Addr pcb);
- bool addContext(Addr pcb, SWContext *ctx) {
- return (swCtxMap.insert(make_pair(pcb, ctx))).second;
- }
- void remContext(Addr pcb) {
- swCtxMap.erase(pcb);
- return;
- }
-
- virtual void dumpState(ExecContext *xc) const = 0;
-#endif //FS_MEASURE
-
public:
////////////////////////////////////////////
//