exec_output += PredOpExecute.subst(loadsymbolIop)
initparamCode = '''
- Rt = PseudoInst::initParam(xc->tcBase());
-#if FULL_SYSTEM
+ uint64_t ip_val = PseudoInst::initParam(xc->tcBase());
+ R0 = bits(ip_val, 31, 0);
+ R1 = bits(ip_val, 63, 32);
-#else
- PseudoInst::panicFsOnlyPseudoInst("initparam");
-#endif
'''
initparamIop = InstObjParams("initparam", "Initparam", "PredOp",
StaticInstPtr inst = StaticInst::nullStaticInstPtr)
{
MipsFault<CoprocessorUnusableFault>::invoke(tc, inst);
- if (FULL_SYSTEM) {
+ if (FullSystem) {
CauseReg cause = tc->readMiscReg(MISCREG_CAUSE);
cause.ce = coProcID;
- tc->setMiscReg(MISCREG_CAUSE, cause);
+ tc->setMiscRegNoEffect(MISCREG_CAUSE, cause);
}
}
};
invoke(ThreadContext * tc,
StaticInstPtr inst = StaticInst::nullStaticInstPtr)
{
- if (FULL_SYSTEM) {
+ if (FullSystem) {
- DPRINTF(MipsPRA, "Fault %s encountered.\n", name());
- tc->pcState(this->vect(tc));
+ DPRINTF(MipsPRA, "Fault %s encountered.\n", this->name());
+ Addr vect = this->vect(tc);
setTlbExceptionState(tc, this->code());
+ tc->pcState(vect);
} else {
AddressFault<T>::invoke(tc, inst);
}
Fault
TLB::translateData(RequestPtr req, ThreadContext *tc, bool write)
{
-#if !FULL_SYSTEM
- //@TODO: This should actually use TLB instead of going directly
- // to the page table in syscall mode.
- /**
- * Check for alignment faults
- */
- if (req->getVaddr() & (req->getSize() - 1)) {
- DPRINTF(TLB, "Alignment Fault on %#x, size = %d", req->getVaddr(),
- req->getSize());
- return new AddressErrorFault(req->getVaddr(), write);
- }
-
+ if (!FullSystem) {
- //@TODO: This should actually use TLB instead of going directly
- // to the page table in syscall mode.
- /**
- * Check for alignment faults
- */
- if (req->getVaddr() & (req->getSize() - 1)) {
- DPRINTF(TLB, "Alignment Fault on %#x, size = %d", req->getVaddr(),
- req->getSize());
- return new AddressErrorFault(req->getVaddr(), write);
- }
-
-
+ Process * p = tc->getProcessPtr();
- Process * p = tc->getProcessPtr();
+ Fault fault = p->pTable->translate(req);
+ if (fault != NoFault)
+ return fault;
- Fault fault = p->pTable->translate(req);
- if (fault != NoFault)
- return fault;
-
- return NoFault;
-#else
- Addr vaddr = req->getVaddr();
-
- bool misaligned = (req->getSize() - 1) & vaddr;
-
- if (IsKSeg0(vaddr)) {
- // Address will not be translated through TLB, set response, and go!
- req->setPaddr(KSeg02Phys(vaddr));
- if (getOperatingMode(tc->readMiscReg(MISCREG_STATUS)) != mode_kernel ||
- misaligned) {
- return new AddressErrorFault(vaddr, true);
- }
- } else if(IsKSeg1(vaddr)) {
- // Address will not be translated through TLB, set response, and go!
- req->setPaddr(KSeg02Phys(vaddr));
+ return NoFault;
} else {
- /*
- * This is an optimization - smallPages is updated every time a TLB
- * operation is performed. That way, we don't need to look at
- * Config3 _ SP and PageGrain _ ESP every time we do a TLB lookup
- */
- Addr VPN = (vaddr >> 11) & 0xFFFFFFFC;
- if (smallPages == 1) {
- VPN = vaddr >> 11;
- }
- uint8_t Asid = req->getAsid();
- PTE *pte = lookup(VPN, Asid);
- if (misaligned) {
- return new AddressErrorFault(vaddr, true);
- }
- if (pte != NULL) {
- // Ok, found something
- /* Check for valid bits */
- int EvenOdd;
- bool Valid;
- bool Dirty;
- if ((((vaddr >> pte->AddrShiftAmount) & 1)) == 0) {
- // Check even bits
- Valid = pte->V0;
- Dirty = pte->D0;
- EvenOdd = 0;
- } else {
- // Check odd bits
- Valid = pte->V1;
- Dirty = pte->D1;
- EvenOdd = 1;
- }
-
- if (Valid == false) {
- return new TlbInvalidFault(Asid, vaddr, VPN, write);
- } else {
- // Ok, this is really a match, set paddr
- if (!Dirty && write) {
- return new TlbModifiedFault(Asid, vaddr, VPN);
- }
- Addr PAddr;
- if (EvenOdd == 0) {
- PAddr = pte->PFN0;
- } else {
- PAddr = pte->PFN1;
- }
- PAddr >>= (pte->AddrShiftAmount - 12);
- PAddr <<= pte->AddrShiftAmount;
- PAddr |= (vaddr & pte->OffsetMask);
- req->setPaddr(PAddr);
- }
- } else {
- // Didn't find any match, return a TLB Refill Exception
- return new TlbRefillFault(Asid, vaddr, VPN, write);
- }
+ panic("translateData not implemented in MIPS.\n");
}
- return checkCacheability(req);
-#endif
}
Fault
#include "config/the_isa.hh"
#include "cpu/thread_context.hh"
#include "debug/Loader.hh"
+ #include "debug/WorkItems.hh"
+#include "kern/kernel_stats.hh"
#include "mem/mem_object.hh"
#include "mem/physical.hh"
+#include "mem/vport.hh"
+#include "params/System.hh"
#include "sim/byteswap.hh"
#include "sim/debug.hh"
+#include "sim/full_system.hh"
#include "sim/system.hh"
-#if FULL_SYSTEM
-#include "arch/vtophys.hh"
-#include "kern/kernel_stats.hh"
-#include "mem/vport.hh"
-#else
-#include "params/System.hh"
-#endif
-
using namespace std;
using namespace TheISA;
System::~System()
{
-#if FULL_SYSTEM
delete kernelSymtab;
delete kernel;
-#else
- panic("System::fixFuncEventAddr needs to be rewritten "
- "to work with syscall emulation");
-#endif // FULL_SYSTEM}
+
+ for (uint32_t j = 0; j < numWorkIds; j++)
+ delete workItemStats[j];
}
void
void
System::unserialize(Checkpoint *cp, const string §ion)
{
-#if FULL_SYSTEM
- kernelSymtab->unserialize("kernel_symtab", cp, section);
-#else // !FULL_SYSTEM
+ if (FullSystem)
+ kernelSymtab->unserialize("kernel_symtab", cp, section);
UNSERIALIZE_SCALAR(pagePtr);
UNSERIALIZE_SCALAR(nextPID);
-#endif
}
+ void
+ System::regStats()
+ {
+ for (uint32_t j = 0; j < numWorkIds ; j++) {
+ workItemStats[j] = new Stats::Histogram();
+ stringstream namestr;
+ ccprintf(namestr, "work_item_type%d", j);
+ workItemStats[j]->init(20)
+ .name(name() + "." + namestr.str())
+ .desc("Run time stat for" + namestr.str())
+ .prereq(*workItemStats[j]);
+ }
+ }
+
+ void
+ System::workItemEnd(uint32_t tid, uint32_t workid)
+ {
+ std::pair<uint32_t,uint32_t> p(tid, workid);
+ if (!lastWorkItemStarted.count(p))
+ return;
+
+ Tick samp = curTick() - lastWorkItemStarted[p];
+ DPRINTF(WorkItems, "Work item end: %d\t%d\t%lld\n", tid, workid, samp);
+
+ if (workid >= numWorkIds)
+ fatal("Got workid greater than specified in system configuration\n");
+
+ workItemStats[workid]->sample(samp);
+ lastWorkItemStarted.erase(p);
+ }
+
void
System::printSystems()
{
return count;
}
-#if FULL_SYSTEM
+ inline void workItemBegin(uint32_t tid, uint32_t workid)
+ {
+ std::pair<uint32_t,uint32_t> p(tid, workid);
+ lastWorkItemStarted[p] = curTick();
+ }
+
+ void workItemEnd(uint32_t tid, uint32_t workid);
+
/**
* Fix up an address used to match PCs for hooking simulator
* events on to target function executions. See comment in