#include "arch/power/isa.hh"
+#include "arch/power/miscregs.hh"
+#include "cpu/base.hh"
#include "params/PowerISA.hh"
namespace PowerISA
return dynamic_cast<const Params *>(_params);
}
+MiscReg
+ISA::readMiscRegNoEffect(int misc_reg) const
+{
+ assert(isValidMiscReg(misc_reg));
+ return regVal[misc_reg];
+}
+
+void
+ISA::setMiscRegNoEffect(int misc_reg, const MiscReg &val)
+{
+ assert(isValidMiscReg(misc_reg));
+ regVal[misc_reg] = val;
+}
+
}
PowerISA::ISA *
#ifndef __ARCH_POWER_ISA_HH__
#define __ARCH_POWER_ISA_HH__
+#include "arch/power/miscregs.hh"
#include "arch/power/registers.hh"
#include "arch/power/types.hh"
#include "base/logging.hh"
class ISA : public SimObject
{
protected:
+ MiscReg regVal[NumMiscRegs];
MiscReg dummy;
- MiscReg miscRegs[NumMiscRegs];
public:
typedef PowerISAParams Params;
-
void
clear()
{
+ memset(regVal, 0, NumMiscRegs * sizeof(MiscReg));
}
- MiscReg
- readMiscRegNoEffect(int misc_reg) const
- {
- fatal("Power does not currently have any misc regs defined\n");
- return dummy;
- }
+ MiscReg readMiscRegNoEffect(int misc_reg) const;
MiscReg
readMiscReg(int misc_reg, ThreadContext *tc)
return dummy;
}
- void
- setMiscRegNoEffect(int misc_reg, const MiscReg &val)
- {
- fatal("Power does not currently have any misc regs defined\n");
- }
+ void setMiscRegNoEffect(int misc_reg, const MiscReg &val);
void
setMiscReg(int misc_reg, const MiscReg &val, ThreadContext *tc)
#include <vector>
#include "arch/power/faults.hh"
+#include "arch/power/miscregs.hh"
#include "arch/power/pagetable.hh"
+#include "arch/power/registers.hh"
#include "arch/power/utility.hh"
#include "base/inifile.hh"
#include "base/str.hh"
Fault
TLB::translateAtomic(RequestPtr req, ThreadContext *tc, Mode mode)
{
- if (FullSystem)
- fatal("translate atomic not yet implemented in full system mode.\n");
-
+ if (FullSystem){
+ Msr msr = tc->readIntReg(MISCREG_MSR);
+ if (mode == Execute){
+ if (msr.ir)
+ fatal("Translate Atomic not Implemented for POWER");
+ else{
+ Addr vaddr = req->getVaddr();
+ DPRINTF(TLB, "Translating vaddr %#x.\n", vaddr);
+ Addr paddr = vaddr;
+ DPRINTF(TLB, "Translated %#x -> %#x.\n", vaddr, paddr);
+ req->setPaddr(paddr);
+ return NoFault;
+ }
+ }
+ else{
+ if (msr.dr)
+ fatal("Translate Atomic not Implemented for POWER");
+ else{
+ Addr vaddr = req->getVaddr();
+ DPRINTF(TLB, "Translating vaddr %#x.\n", vaddr);
+ Addr paddr = vaddr;
+ DPRINTF(TLB, "Translated %#x -> %#x.\n", vaddr, paddr);
+ req->setPaddr(paddr);
+ return NoFault;
+ }
+ }
+ }
if (mode == Execute)
- return translateInst(req, tc);
- else
+ return translateInst(req, tc);
+ else{
+ std::cout<<"translateData"<<std::endl;
return translateData(req, tc, mode == Write);
+ }
}
void