break;
case AlphaISA::IPR_DTB_CM:
- kernelStats->mode((val & 0x18) != 0);
+ if (val & 0x18)
+ kernelStats->mode(Kernel::user);
+ else
+ kernelStats->mode(Kernel::kernel);
case AlphaISA::IPR_ICM:
// only write two mode bits - processor mode
// forward declarations
#ifdef FULL_SYSTEM
class Processor;
-class Kernel;
class AlphaITB;
class AlphaDTB;
class PhysicalMemory;
namespace Kernel {
-const char *modestr[] = { "kernel", "user", "idle" };
+const char *modestr[] = { "kernel", "user", "idle", "interrupt" };
Statistics::Statistics(ExecContext *context)
: xc(context), idleProcess((Addr)-1), themode(kernel), lastModeTick(0),
iplLast(0), iplLastTick(0)
{
+ bin_int = xc->system->params->bin_int;
}
void
}
_mode
- .init(3)
+ .init(cpu_mode_num)
.name(name() + ".mode_switch")
.desc("number of protection mode switches")
;
- for (int i = 0; i < 3; ++i)
+ for (int i = 0; i < cpu_mode_num; ++i)
_mode.subname(i, modestr[i]);
_modeGood
- .init(3)
+ .init(cpu_mode_num)
.name(name() + ".mode_good")
;
- for (int i = 0; i < 3; ++i)
+ for (int i = 0; i < cpu_mode_num; ++i)
_modeGood.subname(i, modestr[i]);
_modeFraction
.flags(total)
;
- for (int i = 0; i < 3; ++i)
+ for (int i = 0; i < cpu_mode_num; ++i)
_modeFraction.subname(i, modestr[i]);
_modeFraction = _modeGood / _mode;
_modeTicks
- .init(3)
+ .init(cpu_mode_num)
.name(name() + ".mode_ticks")
.desc("number of ticks spent at the given mode")
.flags(pdf)
;
- for (int i = 0; i < 3; ++i)
+ for (int i = 0; i < cpu_mode_num; ++i)
_modeTicks.subname(i, modestr[i]);
_swap_context
void
Statistics::setIdleProcess(Addr idlepcbb)
{
- assert(themode == kernel);
+ assert(themode == kernel || themode == interrupt);
idleProcess = idlepcbb;
themode = idle;
changeMode(themode);
}
void
-Statistics::mode(bool usermode)
+Statistics::mode(cpu_mode newmode)
{
Addr pcbb = xc->regs.ipr[AlphaISA::IPR_PALtemp23];
- cpu_mode newmode = usermode ? user : kernel;
- if (newmode == kernel && pcbb == idleProcess)
+ if ((newmode == kernel || newmode == interrupt) &&
+ pcbb == idleProcess)
newmode = idle;
+ if (bin_int == false && newmode == interrupt)
+ newmode = kernel;
+
changeMode(newmode);
}
namespace Kernel {
-enum cpu_mode { kernel, user, idle, cpu_mode_num };
+enum cpu_mode { kernel, user, idle, interrupt, cpu_mode_num };
extern const char *modestr[];
class Binning
std::vector<std::string> binned_fns;
private:
- Stats::MainBin *modeBin[3];
+ Stats::MainBin *modeBin[cpu_mode_num];
public:
const bool bin;
Addr idleProcess;
cpu_mode themode;
Tick lastModeTick;
+ bool bin_int;
void changeMode(cpu_mode newmode);
void hwrei() { _hwrei++; }
void fault(Fault fault) { _faults[fault]++; }
void swpipl(int ipl);
- void mode(bool usermode);
+ void mode(cpu_mode newmode);
void context(Addr oldpcbb, Addr newpcbb);
void callpal(int code);
printThreadEvent = new PrintThreadInfo(&pcEventQueue, "threadinfo");
if (kernelSymtab->findAddress("alpha_switch_to", addr) && DTRACE(Thread))
printThreadEvent->schedule(addr + sizeof(MachInst) * 6);
+
+ intStartEvent = new InterruptStartEvent(&pcEventQueue, "intStartEvent");
+ if (kernelSymtab->findAddress("do_entInt", addr))
+ intStartEvent->schedule(addr + sizeof(MachInst) * 2);
+
+ intEndEvent = new InterruptEndEvent(&pcEventQueue, "intStartEvent");
+ if (palSymtab->findAddress("Call_Pal_Rti", addr))
+ intEndEvent->schedule(addr + sizeof(MachInst));
+ else
+ panic("could not find symbol\n");
}
LinuxSystem::~LinuxSystem()
delete skipCacheProbeEvent;
delete debugPrintkEvent;
delete idleStartEvent;
+ delete printThreadEvent;
+ delete intStartEvent;
}
Param<bool> bin;
VectorParam<string> binned_fns;
+ Param<bool> bin_int;
END_DECLARE_SIM_OBJECT_PARAMS(LinuxSystem)
INIT_PARAM_DFLT(system_type, "Type of system we are emulating", 34),
INIT_PARAM_DFLT(system_rev, "Revision of system we are emulating", 1<<10),
INIT_PARAM_DFLT(bin, "is this system to be binned", false),
- INIT_PARAM(binned_fns, "functions to be broken down and binned")
+ INIT_PARAM(binned_fns, "functions to be broken down and binned"),
+ INIT_PARAM_DFLT(bin_int, "is interrupt code binned seperately?", false)
END_INIT_SIM_OBJECT_PARAMS(LinuxSystem)
p->system_rev = system_rev;
p->bin = bin;
p->binned_fns = binned_fns;
-
+ p->bin_int = bin_int;
return new LinuxSystem(p);
}
*/
LinuxSkipDelayLoopEvent *skipDelayLoopEvent;
+ /**
+ * Event to print information about thread switches if the trace flag
+ * Thread is set
+ */
PrintThreadInfo *printThreadEvent;
+ /**
+ * Event to bin Interrupts seperately from kernel code
+ */
+ InterruptStartEvent *intStartEvent;
+
+ /**
+ * Event to bin Interrupts seperately from kernel code
+ */
+ InterruptEndEvent *intEndEvent;
+
/** Grab the PCBB of the idle process when it starts */
IdleStartEvent *idleStartEvent;
{
xc->kernelStats->setIdleProcess(xc->regs.ipr[AlphaISA::IPR_PALtemp23]);
}
+
+void
+InterruptStartEvent::process(ExecContext *xc)
+{
+ xc->kernelStats->mode(Kernel::interrupt);
+}
+
+void
+InterruptEndEvent::process(ExecContext *xc)
+{
+ // We go back to kernel, if we are user, inside the rti
+ // pal code we will get switched to user because of the ICM write
+ xc->kernelStats->mode(Kernel::kernel);
+}
{}
virtual void process(ExecContext *xc);
};
+
+class InterruptStartEvent : public PCEvent
+{
+ public:
+ InterruptStartEvent(PCEventQueue *q, const std::string &desc)
+ : PCEvent(q, desc)
+ {}
+ virtual void process(ExecContext *xc);
+};
+
+class InterruptEndEvent : public PCEvent
+{
+ public:
+ InterruptEndEvent(PCEventQueue *q, const std::string &desc)
+ : PCEvent(q, desc)
+ {}
+ virtual void process(ExecContext *xc);
+};
+
+
#endif // __SYSTEM_EVENTS_HH__
kernelSymtab = new SymbolTable;
consoleSymtab = new SymbolTable;
+ palSymtab = new SymbolTable;
debugSymbolTable = new SymbolTable;
/**
if (!console->loadGlobalSymbols(consoleSymtab))
panic("could not load console symbols\n");
- if (!kernel->loadGlobalSymbols(debugSymbolTable))
+ if (!pal->loadGlobalSymbols(palSymtab))
+ panic("could not load pal symbols\n");
+
+ if (!kernel->loadGlobalSymbols(debugSymbolTable))
panic("could not load kernel symbols\n");
if (!kernel->loadLocalSymbols(debugSymbolTable))
/** console symbol table */
SymbolTable *consoleSymtab;
+ /** pal symbol table */
+ SymbolTable *palSymtab;
+
/** Object pointer for the kernel code */
ObjectFile *kernel;
uint64_t init_param;
bool bin;
std::vector<std::string> binned_fns;
+ bool bin_int;
std::string kernel_path;
std::string console_path;