changeset 4a2ff62c3b4f in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=4a2ff62c3b4f
description:
        MIPS: Many style fixes.
        White space, commented out code, some other minor fixes.

diffstat:

28 files changed, 1023 insertions(+), 1500 deletions(-)
src/arch/mips/bare_iron/system.cc   |   12 
src/arch/mips/bare_iron/system.hh   |   11 
src/arch/mips/faults.cc             |  606 ++++++++++++++++++-----------------
src/arch/mips/faults.hh             |   24 -
src/arch/mips/idle_event.cc         |    5 
src/arch/mips/interrupts.cc         |  207 +++--------
src/arch/mips/interrupts.hh         |   93 -----
src/arch/mips/isa.cc                |   38 --
src/arch/mips/isa_traits.hh         |  186 +++++-----
src/arch/mips/kernel_stats.hh       |    5 
src/arch/mips/linux/linux.cc        |    4 
src/arch/mips/linux/linux.hh        |   14 
src/arch/mips/linux/process.cc      |   48 +-
src/arch/mips/linux/system.cc       |    7 
src/arch/mips/locked_mem.hh         |   15 
src/arch/mips/mips_core_specific.cc |   65 ---
src/arch/mips/mmaped_ipr.hh         |    2 
src/arch/mips/mt.hh                 |   15 
src/arch/mips/pagetable.cc          |   72 ++--
src/arch/mips/pagetable.hh          |   91 ++---
src/arch/mips/predecoder.hh         |   93 ++---
src/arch/mips/stacktrace.cc         |  120 ------
src/arch/mips/system.cc             |   86 ----
src/arch/mips/system.hh             |    9 
src/arch/mips/tlb.cc                |  493 ++++++++++++----------------
src/arch/mips/types.hh              |   65 +--
src/arch/mips/utility.hh            |  133 +++----
src/arch/mips/vtophys.cc            |    4 

diffs (truncated from 3580 to 300 lines):

diff -r aac74ffc8ca2 -r 4a2ff62c3b4f src/arch/mips/bare_iron/system.cc
--- a/src/arch/mips/bare_iron/system.cc Mon Jul 20 20:20:17 2009 -0700
+++ b/src/arch/mips/bare_iron/system.cc Tue Jul 21 01:08:53 2009 -0700
@@ -28,20 +28,8 @@
  * Authors: Jaidev Patwardhan
  */
 
-#include "arch/vtophys.hh"
 #include "arch/mips/bare_iron/system.hh"
-#include "arch/mips/system.hh"
-#include "cpu/thread_context.hh"
-#include "cpu/base.hh"
-#include "dev/platform.hh"
-#include "mem/physical.hh"
-#include "mem/port.hh"
 #include "params/BareIronMipsSystem.hh"
-#include "sim/byteswap.hh"
-
-using namespace std;
-using namespace MipsISA;
-
 
 BareIronMipsSystem::BareIronMipsSystem(Params *p)
     : MipsSystem(p)
diff -r aac74ffc8ca2 -r 4a2ff62c3b4f src/arch/mips/bare_iron/system.hh
--- a/src/arch/mips/bare_iron/system.hh Mon Jul 20 20:20:17 2009 -0700
+++ b/src/arch/mips/bare_iron/system.hh Tue Jul 21 01:08:53 2009 -0700
@@ -31,11 +31,6 @@
 #ifndef __ARCH_MIPS_BARE_IRON_SYSTEM_HH__
 #define __ARCH_MIPS_BARE_IRON_SYSTEM_HH__
 
-class ThreadContext;
-
-class BreakPCEvent;
-class IdleStartEvent;
-
 #include "arch/mips/system.hh"
 #include "params/BareIronMipsSystem.hh"
 
@@ -46,15 +41,9 @@
  */
 class BareIronMipsSystem : public MipsSystem
 {
-  private:
-
-
   public:
     static const int CommandLineSize = 256;
 
-  private:
-
-  public:
     BareIronMipsSystem(Params *p);
     ~BareIronMipsSystem();
 };
diff -r aac74ffc8ca2 -r 4a2ff62c3b4f src/arch/mips/faults.cc
--- a/src/arch/mips/faults.cc   Mon Jul 20 20:20:17 2009 -0700
+++ b/src/arch/mips/faults.cc   Tue Jul 21 01:08:53 2009 -0700
@@ -85,7 +85,6 @@
 FaultVect ThreadFault::_vect = 0x00F1;
 FaultStat ThreadFault::_count;
 
-
 FaultName ArithmeticFault::_name = "Arithmetic Overflow Exception";
 FaultVect ArithmeticFault::_vect = 0x180;
 FaultStat ArithmeticFault::_count;
@@ -106,7 +105,6 @@
 FaultVect BreakpointFault::_vect = 0x0180;
 FaultStat BreakpointFault::_count;
 
-
 FaultName ItbInvalidFault::_name = "Invalid TLB Entry Exception (I-Fetch/LW)";
 FaultVect ItbInvalidFault::_vect = 0x0180;
 FaultStat ItbInvalidFault::_count;
@@ -168,344 +166,366 @@
 FaultStat DspStateDisabledFault::_count;
 
 #if FULL_SYSTEM
-void MipsFault::setHandlerPC(Addr HandlerBase, ThreadContext *tc)
+void
+MipsFault::setHandlerPC(Addr HandlerBase, ThreadContext *tc)
 {
-  tc->setPC(HandlerBase);
-  tc->setNextPC(HandlerBase+sizeof(MachInst));
-  tc->setNextNPC(HandlerBase+2*sizeof(MachInst));
+    tc->setPC(HandlerBase);
+    tc->setNextPC(HandlerBase + sizeof(MachInst));
+    tc->setNextNPC(HandlerBase + 2 * sizeof(MachInst));
 }
 
-void MipsFault::setExceptionState(ThreadContext *tc,uint8_t ExcCode)
+void
+MipsFault::setExceptionState(ThreadContext *tc, uint8_t ExcCode)
 {
-  // modify SRS Ctl - Save CSS, put ESS into CSS
-  MiscReg stat = tc->readMiscReg(MipsISA::Status);
-  if(bits(stat,Status_EXL) != 1 && bits(stat,Status_BEV) != 1)
-    {
-      // SRS Ctl is modified only if Status_EXL and Status_BEV are not set
-      MiscReg srs = tc->readMiscReg(MipsISA::SRSCtl);
-      uint8_t CSS,ESS;
-      CSS = bits(srs,SRSCtl_CSS_HI,SRSCtl_CSS_LO);
-      ESS = bits(srs,SRSCtl_ESS_HI,SRSCtl_ESS_LO);
-      // Move CSS to PSS
-      replaceBits(srs,SRSCtl_PSS_HI,SRSCtl_PSS_LO,CSS);
-      // Move ESS to CSS
-      replaceBits(srs,SRSCtl_CSS_HI,SRSCtl_CSS_LO,ESS);
-      tc->setMiscRegNoEffect(MipsISA::SRSCtl,srs);
-      //tc->setShadowSet(ESS);
+    // modify SRS Ctl - Save CSS, put ESS into CSS
+    MiscReg stat = tc->readMiscReg(MipsISA::Status);
+    if (bits(stat, Status_EXL) != 1 && bits(stat, Status_BEV) != 1) {
+        // SRS Ctl is modified only if Status_EXL and Status_BEV are not set
+        MiscReg srs = tc->readMiscReg(MipsISA::SRSCtl);
+        uint8_t CSS, ESS;
+        CSS = bits(srs, SRSCtl_CSS_HI, SRSCtl_CSS_LO);
+        ESS = bits(srs, SRSCtl_ESS_HI, SRSCtl_ESS_LO);
+        // Move CSS to PSS
+        replaceBits(srs, SRSCtl_PSS_HI, SRSCtl_PSS_LO, CSS);
+        // Move ESS to CSS
+        replaceBits(srs, SRSCtl_CSS_HI, SRSCtl_CSS_LO, ESS);
+        tc->setMiscRegNoEffect(MipsISA::SRSCtl, srs);
     }
 
-  // set EXL bit (don't care if it is already set!)
-  replaceBits(stat,Status_EXL_HI,Status_EXL_LO,1);
-  tc->setMiscRegNoEffect(MipsISA::Status,stat);
+    // set EXL bit (don't care if it is already set!)
+    replaceBits(stat, Status_EXL_HI, Status_EXL_LO, 1);
+    tc->setMiscRegNoEffect(MipsISA::Status, stat);
 
-  // write EPC
-  //  warn("Set EPC to %x\n",tc->readPC());
-  // CHECK ME  or FIXME or FIX ME or POSSIBLE HACK
-  // Check to see if the exception occurred in the branch delay slot
-  DPRINTF(MipsPRA,"PC: %x, NextPC: %x, NNPC: 
%x\n",tc->readPC(),tc->readNextPC(),tc->readNextNPC());
-  int C_BD=0;
-  if(tc->readPC() + sizeof(MachInst) != tc->readNextPC()){
-    tc->setMiscRegNoEffect(MipsISA::EPC,tc->readPC()-sizeof(MachInst));
-    // In the branch delay slot? set CAUSE_31
-    C_BD = 1;
-  } else {
-    tc->setMiscRegNoEffect(MipsISA::EPC,tc->readPC());
-    // In the branch delay slot? reset CAUSE_31
-    C_BD = 0;
-  }
+    // write EPC
+    // CHECK ME  or FIXME or FIX ME or POSSIBLE HACK
+    // Check to see if the exception occurred in the branch delay slot
+    DPRINTF(MipsPRA, "PC: %x, NextPC: %x, NNPC: %x\n",
+            tc->readPC(), tc->readNextPC(), tc->readNextNPC());
+    int C_BD = 0;
+    if (tc->readPC() + sizeof(MachInst) != tc->readNextPC()) {
+        tc->setMiscRegNoEffect(MipsISA::EPC, tc->readPC() - sizeof(MachInst));
+        // In the branch delay slot? set CAUSE_31
+        C_BD = 1;
+    } else {
+        tc->setMiscRegNoEffect(MipsISA::EPC, tc->readPC());
+        // In the branch delay slot? reset CAUSE_31
+        C_BD = 0;
+    }
 
-  // Set Cause_EXCCODE field
-  MiscReg cause = tc->readMiscReg(MipsISA::Cause);
-  replaceBits(cause,Cause_EXCCODE_HI,Cause_EXCCODE_LO,ExcCode);
-  replaceBits(cause,Cause_BD_HI,Cause_BD_LO,C_BD);
-  replaceBits(cause,Cause_CE_HI,Cause_CE_LO,0);
-  tc->setMiscRegNoEffect(MipsISA::Cause,cause);
+    // Set Cause_EXCCODE field
+    MiscReg cause = tc->readMiscReg(MipsISA::Cause);
+    replaceBits(cause, Cause_EXCCODE_HI, Cause_EXCCODE_LO, ExcCode);
+    replaceBits(cause, Cause_BD_HI, Cause_BD_LO,C_BD);
+    replaceBits(cause, Cause_CE_HI, Cause_CE_LO,0);
+    tc->setMiscRegNoEffect(MipsISA::Cause, cause);
+}
+
+void
+ArithmeticFault::invoke(ThreadContext *tc)
+{
+    DPRINTF(MipsPRA, "%s encountered.\n", name());
+    setExceptionState(tc, 0xC);
+
+    // Set new PC
+    Addr HandlerBase;
+    MiscReg stat = tc->readMiscReg(MipsISA::Status);
+    // Here, the handler is dependent on BEV, which is not modified by
+    // setExceptionState()
+    if (bits(stat, Status_BEV) == 0 ) {
+        // See MIPS ARM Vol 3, Revision 2, Page 38
+        HandlerBase = vect() + tc->readMiscReg(MipsISA::EBase);
+    } else {
+        HandlerBase = 0xBFC00200;
+    }
+    setHandlerPC(HandlerBase, tc);
+}
+
+void
+StoreAddressErrorFault::invoke(ThreadContext *tc)
+{
+    DPRINTF(MipsPRA, "%s encountered.\n", name());
+    setExceptionState(tc, 0x5);
+    tc->setMiscRegNoEffect(MipsISA::BadVAddr, BadVAddr);
+
+    // Set new PC
+    Addr HandlerBase;
+    // Offset 0x180 - General Exception Vector
+    HandlerBase = vect() + tc->readMiscReg(MipsISA::EBase);
+    setHandlerPC(HandlerBase, tc);
+}
+
+void
+TrapFault::invoke(ThreadContext *tc)
+{
+    DPRINTF(MipsPRA, "%s encountered.\n", name());
+    setExceptionState(tc, 0xD);
+
+    // Set new PC
+    Addr HandlerBase;
+    // Offset 0x180 - General Exception Vector
+    HandlerBase = vect() + tc->readMiscReg(MipsISA::EBase);
+    setHandlerPC(HandlerBase, tc);
+}
+
+void
+BreakpointFault::invoke(ThreadContext *tc)
+{
+    setExceptionState(tc, 0x9);
+
+    // Set new PC
+    Addr HandlerBase;
+    // Offset 0x180 - General Exception Vector
+    HandlerBase = vect() + tc->readMiscReg(MipsISA::EBase);
+    setHandlerPC(HandlerBase, tc);
+}
+
+void
+DtbInvalidFault::invoke(ThreadContext *tc)
+{
+    DPRINTF(MipsPRA, "%s encountered.\n", name());
+
+    tc->setMiscRegNoEffect(MipsISA::BadVAddr, BadVAddr);
+    MiscReg eh = tc->readMiscReg(MipsISA::EntryHi);
+    replaceBits(eh, EntryHi_ASID_HI, EntryHi_ASID_LO, EntryHi_Asid);
+    replaceBits(eh, EntryHi_VPN2_HI, EntryHi_VPN2_LO, EntryHi_VPN2);
+    replaceBits(eh, EntryHi_VPN2X_HI, EntryHi_VPN2X_LO, EntryHi_VPN2X);
+    tc->setMiscRegNoEffect(MipsISA::EntryHi, eh);
+    MiscReg ctxt = tc->readMiscReg(MipsISA::Context);
+    replaceBits(ctxt, Context_BadVPN2_HI, Context_BadVPN2_LO, Context_BadVPN2);
+    tc->setMiscRegNoEffect(MipsISA::Context, ctxt);
+    setExceptionState(tc, 0x3);
+
+
+    // Set new PC
+    Addr HandlerBase;
+    // Offset 0x180 - General Exception Vector
+    HandlerBase = vect() + tc->readMiscReg(MipsISA::EBase);
+    setHandlerPC(HandlerBase,tc);
+}
+
+void
+AddressErrorFault::invoke(ThreadContext *tc)
+{
+    DPRINTF(MipsPRA, "%s encountered.\n", name());
+    setExceptionState(tc, 0x4);
+    tc->setMiscRegNoEffect(MipsISA::BadVAddr, BadVAddr);
+
+    // Set new PC
+    Addr HandlerBase;
+    // Offset 0x180 - General Exception Vector
+    HandlerBase = vect() + tc->readMiscReg(MipsISA::EBase);
+    setHandlerPC(HandlerBase, tc);
+}
+
+void
+ItbInvalidFault::invoke(ThreadContext *tc)
+{
+    DPRINTF(MipsPRA, "%s encountered.\n", name());
+    setExceptionState(tc, 0x2);
+    tc->setMiscRegNoEffect(MipsISA::BadVAddr, BadVAddr);
+    MiscReg eh = tc->readMiscReg(MipsISA::EntryHi);
+    replaceBits(eh, EntryHi_ASID_HI, EntryHi_ASID_LO, EntryHi_Asid);
+    replaceBits(eh, EntryHi_VPN2_HI, EntryHi_VPN2_LO, EntryHi_VPN2);
+    replaceBits(eh, EntryHi_VPN2X_HI, EntryHi_VPN2X_LO, EntryHi_VPN2X);
+    tc->setMiscRegNoEffect(MipsISA::EntryHi, eh);
+    MiscReg ctxt = tc->readMiscReg(MipsISA::Context);
+    replaceBits(ctxt, Context_BadVPN2_HI, Context_BadVPN2_LO, Context_BadVPN2);
+    tc->setMiscRegNoEffect(MipsISA::Context, ctxt);
+
+
+    // Set new PC
+    Addr HandlerBase;
+    // Offset 0x180 - General Exception Vector
+    HandlerBase= vect() + tc->readMiscReg(MipsISA::EBase);
+    setHandlerPC(HandlerBase,tc);
+    DPRINTF(MipsPRA,"Exception Handler At: %x , EPC set to %x\n",
+            HandlerBase, tc->readMiscReg(MipsISA::EPC));
+}
+
+void
+ItbRefillFault::invoke(ThreadContext *tc)
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to