cpu: rename the misleading inSyscall to noSquashFromTC
authorAli Saidi <Ali.Saidi@ARM.com>
Mon, 7 Jan 2013 18:05:33 +0000 (13:05 -0500)
committerAli Saidi <Ali.Saidi@ARM.com>
Mon, 7 Jan 2013 18:05:33 +0000 (13:05 -0500)
isSyscall was originally created because during handling of a syscall in SE
mode the threadcontext had to be updated. However, in many places this is used
in FS mode (e.g. fault handlers) and the name doesn't make much sense. The
boolean actually stops gem5 from squashing speculative and non-committed state
when a write to a threadcontext happens, so re-name the variable to something
more appropriate

18 files changed:
src/cpu/checker/cpu_impl.hh
src/cpu/inorder/cpu.cc
src/cpu/inorder/inorder_dyn_inst.cc
src/cpu/inorder/thread_context.cc
src/cpu/inorder/thread_state.hh
src/cpu/o3/commit_impl.hh
src/cpu/o3/cpu.cc
src/cpu/o3/dyn_inst.hh
src/cpu/o3/dyn_inst_impl.hh
src/cpu/o3/thread_context.hh
src/cpu/o3/thread_context_impl.hh
src/cpu/o3/thread_state.hh
src/cpu/ozone/back_end_impl.hh
src/cpu/ozone/cpu_impl.hh
src/cpu/ozone/dyn_inst_impl.hh
src/cpu/ozone/inorder_back_end_impl.hh
src/cpu/ozone/lw_back_end_impl.hh
src/cpu/ozone/thread_state.hh

index 5637eb08b48211d611c4c93e60e7a32840ef44a8..49ff8eaa178e393faad3bac93626dc6c66a940a2 100644 (file)
@@ -573,12 +573,12 @@ Checker<Impl>::validateState()
              "registers from main CPU", curTick(), unverifiedInst->instAddr());
 
         // Terribly convoluted way to make sure O3 model does not implode
-        bool inSyscall = unverifiedInst->thread->inSyscall;
-        unverifiedInst->thread->inSyscall = true;
+        bool no_squash_from_TC = unverifiedInst->thread->noSquashFromTC;
+        unverifiedInst->thread->noSquashFromTC = true;
 
         // Heavy-weight copying of all registers
         thread->copyArchRegs(unverifiedInst->tcBase());
-        unverifiedInst->thread->inSyscall = inSyscall;
+        unverifiedInst->thread->noSquashFromTC = no_squash_from_TC;
 
         // Set curStaticInst to unverifiedInst->staticInst
         curStaticInst = unverifiedInst->staticInst;
index 3dad7d1f47d675e311ea07172cd1cb7262650dbb..5815775f9a2a69ac0905f95f8a1a7741c7d74855 100644 (file)
@@ -786,9 +786,9 @@ InOrderCPU::init()
     BaseCPU::init();
 
     for (ThreadID tid = 0; tid < numThreads; ++tid) {
-        // Set inSyscall so that the CPU doesn't squash when initially
+        // Set noSquashFromTC so that the CPU doesn't squash when initially
         // setting up registers.
-        thread[tid]->inSyscall = true;
+        thread[tid]->noSquashFromTC = true;
         // Initialise the ThreadContext's memory proxies
         thread[tid]->initMemProxies(thread[tid]->getTC());
     }
@@ -800,9 +800,9 @@ InOrderCPU::init()
         }
     }
 
-    // Clear inSyscall.
+    // Clear noSquashFromTC.
     for (ThreadID tid = 0; tid < numThreads; ++tid)
-        thread[tid]->inSyscall = false;
+        thread[tid]->noSquashFromTC = false;
 
     // Call Initializiation Routine for Resource Pool
     resPool->init();
index 760c63948d513db41850d6ee8e705165b8a5f149..dcf0ce6ae9beea2eec3577b40c246521926a03d4 100644 (file)
@@ -220,12 +220,12 @@ InOrderDynInst::execute()
     // when using the TC during an instruction's execution
     // (specifically for instructions that have side-effects that use
     // the TC).  Fix this.
-    bool in_syscall = this->thread->inSyscall;
-    this->thread->inSyscall = true;
+    bool no_squash_from_TC = this->thread->noSquashFromTC;
+    this->thread->noSquashFromTC = true;
 
     this->fault = this->staticInst->execute(this, this->traceData);
 
-    this->thread->inSyscall = in_syscall;
+    this->thread->noSquashFromTC = no_squash_from_TC;
 
     return this->fault;
 }
@@ -244,12 +244,12 @@ InOrderDynInst::initiateAcc()
     // when using the TC during an instruction's execution
     // (specifically for instructions that have side-effects that use
     // the TC).  Fix this.
-    bool in_syscall = this->thread->inSyscall;
-    this->thread->inSyscall = true;
+    bool no_squash_from_TC = this->thread->noSquashFromTC;
+    this->thread->noSquashFromTC = true;
 
     this->fault = this->staticInst->initiateAcc(this, this->traceData);
 
-    this->thread->inSyscall = in_syscall;
+    this->thread->noSquashFromTC = no_squash_from_TC;
 
     return this->fault;
 }
index 16ffd5b0fc9e7df3a801513c8c2cce974a2dec7a..b8662ef4cf991d663bce3281ed133eff296afa93 100644 (file)
@@ -90,10 +90,10 @@ InOrderThreadContext::takeOverFrom(ThreadContext *old_context)
     copyArchRegs(old_context);
 
     thread->funcExeInst = old_context->readFuncExeInst();
+
     old_context->setStatus(ThreadContext::Halted);
 
-    thread->inSyscall = false;
+    thread->noSquashFromTC = false;
     thread->trapPending = false;
 }
 
@@ -159,7 +159,7 @@ InOrderThreadContext::serialize(std::ostream &os)
 void
 InOrderThreadContext::unserialize(Checkpoint *cp, const std::string &section)
 {
-    panic("unserialize unimplemented");    
+    panic("unserialize unimplemented");
 }
 
 
index 34c146b42c4d026a95f5fcf2c3fa0982e3ef9b72..4472bf1dd9e0d34cb2d7d21a9593734e699cffac 100644 (file)
@@ -61,10 +61,15 @@ class InOrderThreadState : public ThreadState {
     InOrderCPU *cpu;
 
   public:
-    /** Whether or not the thread is currently in syscall mode, and
-     * thus able to be externally updated without squashing.
+    /* This variable controls if writes to a thread context should cause a all
+     * dynamic/speculative state to be thrown away. Nominally this is the
+     * desired behavior because the external thread context write has updated
+     * some state that could be used by an inflight instruction, however there
+     * are some cases like in a fault/trap handler where this behavior would
+     * lead to successive restarts and forward progress couldn't be made. This
+     * variable controls if the squashing will occur.
      */
-    bool inSyscall;
+    bool noSquashFromTC;
 
     /** Whether or not the thread is currently waiting on a trap, and
      * thus able to be externally updated without squashing.
@@ -75,7 +80,8 @@ class InOrderThreadState : public ThreadState {
                        Process *_process)
         : ThreadState(reinterpret_cast<BaseCPU*>(_cpu), _thread_num,
                       _process),
-          cpu(_cpu), inSyscall(0), trapPending(0), lastGradIsBranch(false)
+          cpu(_cpu), noSquashFromTC(false), trapPending(false),
+          lastGradIsBranch(false)
     { }
 
     /** Handles the syscall. */
index f6c868720397e457954782a7f585448a297ecd55..351b4794d769279dccd7e6c802728277ee72cd48 100644 (file)
@@ -559,7 +559,7 @@ DefaultCommit<Impl>::squashFromTrap(ThreadID tid)
     DPRINTF(Commit, "Squashing from trap, restarting at PC %s\n", pc[tid]);
 
     thread[tid]->trapPending = false;
-    thread[tid]->inSyscall = false;
+    thread[tid]->noSquashFromTC = false;
     trapInFlight[tid] = false;
 
     trapSquash[tid] = false;
@@ -576,7 +576,7 @@ DefaultCommit<Impl>::squashFromTC(ThreadID tid)
 
     DPRINTF(Commit, "Squashing from TC, restarting at PC %s\n", pc[tid]);
 
-    thread[tid]->inSyscall = false;
+    thread[tid]->noSquashFromTC = false;
     assert(!thread[tid]->trapPending);
 
     commitStatus[tid] = ROBSquashing;
@@ -721,8 +721,8 @@ DefaultCommit<Impl>::handleInterrupt()
         // Clear the interrupt now that it's going to be handled
         toIEW->commitInfo[0].clearInterrupt = true;
 
-        assert(!thread[0]->inSyscall);
-        thread[0]->inSyscall = true;
+        assert(!thread[0]->noSquashFromTC);
+        thread[0]->noSquashFromTC = true;
 
         if (cpu->checker) {
             cpu->checker->handlePendingInt();
@@ -731,7 +731,7 @@ DefaultCommit<Impl>::handleInterrupt()
         // CPU will handle interrupt.
         cpu->processInterrupts(interrupt);
 
-        thread[0]->inSyscall = false;
+        thread[0]->noSquashFromTC = false;
 
         commitStatus[0] = TrapPending;
 
@@ -1014,7 +1014,7 @@ DefaultCommit<Impl>::commitInsts()
                 Addr oldpc;
                 // Debug statement.  Checks to make sure we're not
                 // currently updating state while handling PC events.
-                assert(!thread[tid]->inSyscall && !thread[tid]->trapPending);
+                assert(!thread[tid]->noSquashFromTC && !thread[tid]->trapPending);
                 do {
                     oldpc = pc[tid].instAddr();
                     cpu->system->pcEventQueue.service(thread[tid]->getTC());
@@ -1140,11 +1140,11 @@ DefaultCommit<Impl>::commitHead(DynInstPtr &head_inst, unsigned inst_num)
             cpu->checker->verify(head_inst);
         }
 
-        assert(!thread[tid]->inSyscall);
+        assert(!thread[tid]->noSquashFromTC);
 
         // Mark that we're in state update mode so that the trap's
         // execution doesn't generate extra squashes.
-        thread[tid]->inSyscall = true;
+        thread[tid]->noSquashFromTC = true;
 
         // Execute the trap.  Although it's slightly unrealistic in
         // terms of timing (as it doesn't wait for the full timing of
@@ -1155,7 +1155,7 @@ DefaultCommit<Impl>::commitHead(DynInstPtr &head_inst, unsigned inst_num)
         cpu->trap(inst_fault, tid, head_inst->staticInst);
 
         // Exit state update mode to avoid accidental updating.
-        thread[tid]->inSyscall = false;
+        thread[tid]->noSquashFromTC = false;
 
         commitStatus[tid] = TrapPending;
 
index bc5f096e690bb3b78968d57752fa89e406dc87bc..c5421302d61cbe62d50e812e2bc2929095dc0ce4 100644 (file)
@@ -644,9 +644,9 @@ FullO3CPU<Impl>::init()
     BaseCPU::init();
 
     for (ThreadID tid = 0; tid < numThreads; ++tid) {
-        // Set inSyscall so that the CPU doesn't squash when initially
+        // Set noSquashFromTC so that the CPU doesn't squash when initially
         // setting up registers.
-        thread[tid]->inSyscall = true;
+        thread[tid]->noSquashFromTC = true;
         // Initialise the ThreadContext's memory proxies
         thread[tid]->initMemProxies(thread[tid]->getTC());
     }
@@ -665,9 +665,9 @@ FullO3CPU<Impl>::init()
         }
     }
 
-    // Clear inSyscall.
+    // Clear noSquashFromTC.
     for (int tid = 0; tid < numThreads; ++tid)
-        thread[tid]->inSyscall = false;
+        thread[tid]->noSquashFromTC = false;
 
     // Initialize stages.
     fetch.initStage();
@@ -1464,7 +1464,7 @@ template <class Impl>
 void
 FullO3CPU<Impl>::squashFromTC(ThreadID tid)
 {
-    this->thread[tid]->inSyscall = true;
+    this->thread[tid]->noSquashFromTC = true;
     this->commit.generateTCEvent(tid);
 }
 
index b5344f87569e1fb51ff6533773b032eceaccd417..de50bbda90402745e2a8d7da290f8739d114e4b0 100644 (file)
@@ -183,14 +183,14 @@ class BaseO3DynInst : public BaseDynInst<Impl>
         // using the TC during an instruction's execution (specifically for
         // instructions that have side-effects that use the TC).  Fix this.
         // See cpu/o3/dyn_inst_impl.hh.
-        bool in_syscall = this->thread->inSyscall;
-        this->thread->inSyscall = true;
+        bool no_squash_from_TC = this->thread->noSquashFromTC;
+        this->thread->noSquashFromTC = true;
 
         for (int i = 0; i < _numDestMiscRegs; i++)
             this->cpu->setMiscReg(
                 _destMiscRegIdx[i], _destMiscRegVal[i], this->threadNumber);
 
-        this->thread->inSyscall = in_syscall;
+        this->thread->noSquashFromTC = no_squash_from_TC;
     }
 
     void forwardOldRegs()
index 7f8d5a030b22df7a1a25a5d8f2becf5d014ab725..e37caf7f0dc3c7184a810a1adc87b9b969f01ab7 100644 (file)
@@ -130,12 +130,12 @@ BaseO3DynInst<Impl>::execute()
     // when using the TC during an instruction's execution
     // (specifically for instructions that have side-effects that use
     // the TC).  Fix this.
-    bool in_syscall = this->thread->inSyscall;
-    this->thread->inSyscall = true;
+    bool no_squash_from_TC = this->thread->noSquashFromTC;
+    this->thread->noSquashFromTC = true;
 
     this->fault = this->staticInst->execute(this, this->traceData);
 
-    this->thread->inSyscall = in_syscall;
+    this->thread->noSquashFromTC = no_squash_from_TC;
 
     return this->fault;
 }
@@ -148,12 +148,12 @@ BaseO3DynInst<Impl>::initiateAcc()
     // when using the TC during an instruction's execution
     // (specifically for instructions that have side-effects that use
     // the TC).  Fix this.
-    bool in_syscall = this->thread->inSyscall;
-    this->thread->inSyscall = true;
+    bool no_squash_from_TC = this->thread->noSquashFromTC;
+    this->thread->noSquashFromTC = true;
 
     this->fault = this->staticInst->initiateAcc(this, this->traceData);
 
-    this->thread->inSyscall = in_syscall;
+    this->thread->noSquashFromTC = no_squash_from_TC;
 
     return this->fault;
 }
@@ -166,8 +166,8 @@ BaseO3DynInst<Impl>::completeAcc(PacketPtr pkt)
     // when using the TC during an instruction's execution
     // (specifically for instructions that have side-effects that use
     // the TC).  Fix this.
-    bool in_syscall = this->thread->inSyscall;
-    this->thread->inSyscall = true;
+    bool no_squash_from_TC = this->thread->noSquashFromTC;
+    this->thread->noSquashFromTC = true;
 
     if (this->cpu->checker) {
         if (this->isStoreConditional()) {
@@ -177,7 +177,7 @@ BaseO3DynInst<Impl>::completeAcc(PacketPtr pkt)
 
     this->fault = this->staticInst->completeAcc(pkt, this, this->traceData);
 
-    this->thread->inSyscall = in_syscall;
+    this->thread->noSquashFromTC = no_squash_from_TC;
 
     return this->fault;
 }
index 520f07b0f8ea77280bed670e8ebcf85081f7160d..c6fa178b5e520512988a439f1fb3352266870585 100755 (executable)
@@ -257,6 +257,16 @@ class O3ThreadContext : public ThreadContext
     {
         return this->thread->quiesceEvent;
     }
+    /** check if the cpu is currently in state update mode and squash if not.
+     * This function will return true if a trap is pending or if a fault or
+     * similar is currently writing to the thread context and doesn't want
+     * reset all the state (see noSquashFromTC).
+     */
+    inline void conditionalSquash()
+    {
+        if (!thread->trapPending && !thread->noSquashFromTC)
+            cpu->squashFromTC(thread->threadId());
+    }
 
 };
 
index 8a8ee636a6221527b85e94e10200c31795f91a8a..38e7c5dec3da0f97b361ff508de9f512163b4a33 100755 (executable)
@@ -96,7 +96,7 @@ O3ThreadContext<Impl>::takeOverFrom(ThreadContext *old_context)
 
     old_context->setStatus(ThreadContext::Halted);
 
-    thread->inSyscall = false;
+    thread->noSquashFromTC = false;
     thread->trapPending = false;
 }
 
@@ -207,9 +207,9 @@ void
 O3ThreadContext<Impl>::copyArchRegs(ThreadContext *tc)
 {
     // Prevent squashing
-    thread->inSyscall = true;
+    thread->noSquashFromTC = true;
     TheISA::copyRegs(tc, this);
-    thread->inSyscall = false;
+    thread->noSquashFromTC = false;
 
     if (!FullSystem)
         this->thread->funcExeInst = tc->readFuncExeInst();
@@ -253,10 +253,7 @@ O3ThreadContext<Impl>::setIntReg(int reg_idx, uint64_t val)
     reg_idx = cpu->isa[thread->threadId()].flattenIntIndex(reg_idx);
     cpu->setArchIntReg(reg_idx, val, thread->threadId());
 
-    // Squash if we're not already in a state update mode.
-    if (!thread->trapPending && !thread->inSyscall) {
-        cpu->squashFromTC(thread->threadId());
-    }
+    conditionalSquash();
 }
 
 template <class Impl>
@@ -266,9 +263,7 @@ O3ThreadContext<Impl>::setFloatReg(int reg_idx, FloatReg val)
     reg_idx = cpu->isa[thread->threadId()].flattenFloatIndex(reg_idx);
     cpu->setArchFloatReg(reg_idx, val, thread->threadId());
 
-    if (!thread->trapPending && !thread->inSyscall) {
-        cpu->squashFromTC(thread->threadId());
-    }
+    conditionalSquash();
 }
 
 template <class Impl>
@@ -278,10 +273,7 @@ O3ThreadContext<Impl>::setFloatRegBits(int reg_idx, FloatRegBits val)
     reg_idx = cpu->isa[thread->threadId()].flattenFloatIndex(reg_idx);
     cpu->setArchFloatRegInt(reg_idx, val, thread->threadId());
 
-    // Squash if we're not already in a state update mode.
-    if (!thread->trapPending && !thread->inSyscall) {
-        cpu->squashFromTC(thread->threadId());
-    }
+    conditionalSquash();
 }
 
 template <class Impl>
@@ -290,10 +282,7 @@ O3ThreadContext<Impl>::pcState(const TheISA::PCState &val)
 {
     cpu->pcState(val, thread->threadId());
 
-    // Squash if we're not already in a state update mode.
-    if (!thread->trapPending && !thread->inSyscall) {
-        cpu->squashFromTC(thread->threadId());
-    }
+    conditionalSquash();
 }
 
 template <class Impl>
@@ -302,10 +291,7 @@ O3ThreadContext<Impl>::pcStateNoRecord(const TheISA::PCState &val)
 {
     cpu->pcState(val, thread->threadId());
 
-    // Squash if we're not already in a state update mode.
-    if (!thread->trapPending && !thread->inSyscall) {
-        cpu->squashFromTC(thread->threadId());
-    }
+    conditionalSquash();
 }
 
 template <class Impl>
@@ -328,10 +314,7 @@ O3ThreadContext<Impl>::setMiscRegNoEffect(int misc_reg, const MiscReg &val)
 {
     cpu->setMiscRegNoEffect(misc_reg, val, thread->threadId());
 
-    // Squash if we're not already in a state update mode.
-    if (!thread->trapPending && !thread->inSyscall) {
-        cpu->squashFromTC(thread->threadId());
-    }
+    conditionalSquash();
 }
 
 template <class Impl>
@@ -340,9 +323,6 @@ O3ThreadContext<Impl>::setMiscReg(int misc_reg, const MiscReg &val)
 {
     cpu->setMiscReg(misc_reg, val, thread->threadId());
 
-    // Squash if we're not already in a state update mode.
-    if (!thread->trapPending && !thread->inSyscall) {
-        cpu->squashFromTC(thread->threadId());
-    }
+    conditionalSquash();
 }
 
index 9273b00daa4989d0fb7cf387485e752136bb24e2..96ccfc95c691601c4adf07d14faee76f33a46574 100644 (file)
@@ -61,10 +61,15 @@ struct O3ThreadState : public ThreadState {
     /** Pointer to the CPU. */
     O3CPU *cpu;
   public:
-    /** Whether or not the thread is currently in syscall mode, and
-     * thus able to be externally updated without squashing.
+    /* This variable controls if writes to a thread context should cause a all
+     * dynamic/speculative state to be thrown away. Nominally this is the
+     * desired behavior because the external thread context write has updated
+     * some state that could be used by an inflight instruction, however there
+     * are some cases like in a fault/trap handler where this behavior would
+     * lead to successive restarts and forward progress couldn't be made. This
+     * variable controls if the squashing will occur.
      */
-    bool inSyscall;
+    bool noSquashFromTC;
 
     /** Whether or not the thread is currently waiting on a trap, and
      * thus able to be externally updated without squashing.
@@ -73,7 +78,7 @@ struct O3ThreadState : public ThreadState {
 
     O3ThreadState(O3CPU *_cpu, int _thread_num, Process *_process)
         : ThreadState(_cpu, _thread_num, _process),
-          cpu(_cpu), inSyscall(0), trapPending(0)
+          cpu(_cpu), noSquashFromTC(false), trapPending(false)
     {
         if (!FullSystem)
             return;
index 9c9ca311e0b2259b2910bef3580253a9120200eb..bcc897369094c750e97546f5771f31a2b8115a09 100644 (file)
@@ -1513,16 +1513,16 @@ BackEnd<Impl>::commitInst(int inst_num)
             DPRINTF(BE, "Inst [sn:%lli] PC %#x has a fault\n",
                     inst->seqNum, inst->readPC());
 
-//            assert(!thread->inSyscall);
+//            assert(!thread->noSquashFromTC);
 
-//            thread->inSyscall = true;
+//            thread->noSquashFromTC = true;
 
             // Consider holding onto the trap and waiting until the trap event
             // happens for this to be executed.
             inst_fault->invoke(thread->getXCProxy());
 
             // Exit state update mode to avoid accidental updating.
-//            thread->inSyscall = false;
+//            thread->noSquashFromTC = false;
 
 //            commitStatus = TrapPending;
 
@@ -1571,7 +1571,7 @@ BackEnd<Impl>::commitInst(int inst_num)
     Addr oldpc;
     do {
         if (count == 0)
-            assert(!thread->inSyscall && !thread->trapPending);
+            assert(!thread->noSquashFromTC && !thread->trapPending);
         oldpc = thread->readPC();
         cpu->system->pcEventQueue.service(
             thread->getXCProxy());
index 3a32c07c65006543162068873c57e3a8da26cd73..fe8ae25512dbf63e4814002b65c1c8b04d31510f 100644 (file)
@@ -110,7 +110,7 @@ OzoneCPU<Impl>::OzoneCPU(Params *p)
     ozoneTC.cpu = this;
     ozoneTC.thread = &thread;
 
-    thread.inSyscall = false;
+    thread.noSquashFromTC = false;
 
     itb = p->itb;
     dtb = p->dtb;
@@ -236,7 +236,7 @@ OzoneCPU<Impl>::takeOverFrom(BaseCPU *oldCPU)
     BaseCPU::takeOverFrom(oldCPU);
 
     thread.trapPending = false;
-    thread.inSyscall = false;
+    thread.noSquashFromTC = false;
 
     backEnd->takeOverFrom();
     frontEnd->takeOverFrom();
@@ -375,7 +375,7 @@ OzoneCPU<Impl>::init()
     BaseCPU::init();
 
     // Mark this as in syscall so it won't need to squash
-    thread.inSyscall = true;
+    thread.noSquashFromTC = true;
     if (FullSystem) {
         for (int i = 0; i < threadContexts.size(); ++i) {
             ThreadContext *tc = threadContexts[i];
@@ -387,7 +387,7 @@ OzoneCPU<Impl>::init()
     frontEnd->renameTable.copyFrom(thread.renameTable);
     backEnd->renameTable.copyFrom(thread.renameTable);
 
-    thread.inSyscall = false;
+    thread.noSquashFromTC = false;
 }
 
 template <class Impl>
@@ -476,7 +476,7 @@ template <class Impl>
 void
 OzoneCPU<Impl>::squashFromTC()
 {
-    thread.inSyscall = true;
+    thread.noSquashFromTC = true;
     backEnd->generateTCEvent();
 }
 
@@ -487,7 +487,7 @@ OzoneCPU<Impl>::syscall(uint64_t &callnum)
     // Not sure this copy is needed, depending on how the TC proxy is made.
     thread.renameTable.copyFrom(backEnd->renameTable);
 
-    thread.inSyscall = true;
+    thread.noSquashFromTC = true;
 
     thread.funcExeInst++;
 
@@ -497,7 +497,7 @@ OzoneCPU<Impl>::syscall(uint64_t &callnum)
 
     thread.funcExeInst--;
 
-    thread.inSyscall = false;
+    thread.noSquashFromTC = false;
 
     frontEnd->renameTable.copyFrom(thread.renameTable);
     backEnd->renameTable.copyFrom(thread.renameTable);
@@ -774,7 +774,7 @@ OzoneCPU<Impl>::OzoneTC::setIntReg(int reg_idx, uint64_t val)
 {
     thread->renameTable[reg_idx]->setIntResult(val);
 
-    if (!thread->inSyscall) {
+    if (!thread->noSquashFromTC) {
         cpu->squashFromTC();
     }
 }
@@ -787,7 +787,7 @@ OzoneCPU<Impl>::OzoneTC::setFloatReg(int reg_idx, FloatReg val)
 
     thread->renameTable[idx]->setDoubleResult(val);
 
-    if (!thread->inSyscall) {
+    if (!thread->noSquashFromTC) {
         cpu->squashFromTC();
     }
 }
@@ -806,7 +806,7 @@ OzoneCPU<Impl>::OzoneTC::setPC(Addr val)
     thread->PC = val;
     cpu->frontEnd->setPC(val);
 
-    if (!thread->inSyscall) {
+    if (!thread->noSquashFromTC) {
         cpu->squashFromTC();
     }
 }
@@ -818,7 +818,7 @@ OzoneCPU<Impl>::OzoneTC::setNextPC(Addr val)
     thread->nextPC = val;
     cpu->frontEnd->setNextPC(val);
 
-    if (!thread->inSyscall) {
+    if (!thread->noSquashFromTC) {
         cpu->squashFromTC();
     }
 }
@@ -844,7 +844,7 @@ OzoneCPU<Impl>::OzoneTC::setMiscRegNoEffect(int misc_reg, const MiscReg &val)
     // Needs to setup a squash event unless we're in syscall mode
     thread->miscRegFile.setRegNoEffect(misc_reg, val);
 
-    if (!thread->inSyscall) {
+    if (!thread->noSquashFromTC) {
         cpu->squashFromTC();
     }
 }
@@ -856,7 +856,7 @@ OzoneCPU<Impl>::OzoneTC::setMiscReg(int misc_reg, const MiscReg &val)
     // Needs to setup a squash event unless we're in syscall mode
     thread->miscRegFile.setReg(misc_reg, val, this);
 
-    if (!thread->inSyscall) {
+    if (!thread->noSquashFromTC) {
         cpu->squashFromTC();
     }
 }
index 96d326ffc780dfd44f1d3de1f13bd89587e0f107..2066c58d7816ddfcd20e6ceb0e9e932299dace0c 100644 (file)
@@ -71,12 +71,12 @@ OzoneDynInst<Impl>::execute()
     // @todo: Pretty convoluted way to avoid squashing from happening when using
     // the XC during an instruction's execution (specifically for instructions
     // that have sideeffects that use the XC).  Fix this.
-    bool in_syscall = this->thread->inSyscall;
-    this->thread->inSyscall = true;
+    bool no_squash_from_TC = this->thread->noSquashFromTC;
+    this->thread->noSquashFromTC = true;
 
     this->fault = this->staticInst->execute(this, this->traceData);
 
-    this->thread->inSyscall = in_syscall;
+    this->thread->noSquashFromTC = no_squash_from_TC;
 
     return this->fault;
 }
@@ -88,12 +88,12 @@ OzoneDynInst<Impl>::initiateAcc()
     // @todo: Pretty convoluted way to avoid squashing from happening when using
     // the XC during an instruction's execution (specifically for instructions
     // that have sideeffects that use the XC).  Fix this.
-    bool in_syscall = this->thread->inSyscall;
-    this->thread->inSyscall = true;
+    bool no_squash_from_TC = this->thread->noSquashFromTC;
+    this->thread->noSquashFromTC = true;
 
     this->fault = this->staticInst->initiateAcc(this, this->traceData);
 
-    this->thread->inSyscall = in_syscall;
+    this->thread->noSquashFromTC = no_squash_from_TC;
 
     return this->fault;
 }
index 59d1dab0de9ecd40af0e32ea339c6809434cc829..7bb876e4a23d1fff655e8536fb0635f3292d7dbf 100644 (file)
@@ -117,7 +117,7 @@ InorderBackEnd<Impl>::checkInterrupts()
     }
 
     if (ipl && ipl > thread->readMiscRegNoEffect(IPR_IPLR)) {
-        thread->inSyscall = true;
+        thread->noSquashFromTC = true;
 
         thread->setMiscRegNoEffect(IPR_ISR, summary);
         thread->setMiscRegNoEffect(IPR_INTID, ipl);
@@ -128,7 +128,7 @@ InorderBackEnd<Impl>::checkInterrupts()
         // May need to go 1 inst prior
         squashPending = true;
 
-        thread->inSyscall = false;
+        thread->noSquashFromTC = false;
 
         setSquashInfoFromXC();
     }
@@ -206,7 +206,7 @@ InorderBackEnd<Impl>::executeInsts()
             Addr oldpc;
             do {
                 if (count == 0)
-                    assert(!thread->inSyscall && !thread->trapPending);
+                    assert(!thread->noSquashFromTC && !thread->trapPending);
                 oldpc = thread->readPC();
                 cpu->system->pcEventQueue.service(
                     thread->getXCProxy());
@@ -291,16 +291,16 @@ InorderBackEnd<Impl>::executeInsts()
             DPRINTF(IBE, "Inst [sn:%lli] PC %#x has a fault\n",
                     inst->seqNum, inst->readPC());
 
-            assert(!thread->inSyscall);
+            assert(!thread->noSquashFromTC);
 
-            thread->inSyscall = true;
+            thread->noSquashFromTC = true;
 
             // Consider holding onto the trap and waiting until the trap event
             // happens for this to be executed.
             inst_fault->invoke(xc);
 
             // Exit state update mode to avoid accidental updating.
-            thread->inSyscall = false;
+            thread->noSquashFromTC = false;
 
             squashPending = true;
 
@@ -365,16 +365,16 @@ InorderBackEnd<Impl>::handleFault()
 {
     DPRINTF(Commit, "Handling fault from fetch\n");
 
-    assert(!thread->inSyscall);
+    assert(!thread->noSquashFromTC);
 
-    thread->inSyscall = true;
+    thread->noSquashFromTC = true;
 
     // Consider holding onto the trap and waiting until the trap event
     // happens for this to be executed.
     faultFromFetch->invoke(xc);
 
     // Exit state update mode to avoid accidental updating.
-    thread->inSyscall = false;
+    thread->noSquashFromTC = false;
 
     squashPending = true;
 
@@ -415,8 +415,8 @@ InorderBackEnd<Impl>::squash(const InstSeqNum &squash_num, const Addr &next_PC)
     squashPending = false;
 
     // Probably want to make sure that this squash is the one that set the
-    // thread into inSyscall mode.
-    thread->inSyscall = false;
+    // thread into noSquashFromTC mode.
+    thread->noSquashFromTC = false;
 
     // Tell front end to squash, reset PC to new one.
     frontEnd->squash(squash_num, next_PC);
@@ -431,7 +431,7 @@ InorderBackEnd<Impl>::squashFromXC()
     // Record that I need to squash
     squashPending = true;
 
-    thread->inSyscall = true;
+    thread->noSquashFromTC = true;
 }
 
 template <class Impl>
index cd23293b4bc6e81d6767a5fed17a46f2ed6334e5..79ae434652629cb748b3892039b4603a7a0f4dd3 100644 (file)
@@ -531,8 +531,8 @@ LWBackEnd<Impl>::checkInterrupts()
 
             // Not sure which thread should be the one to interrupt.  For now
             // always do thread 0.
-            assert(!thread->inSyscall);
-            thread->inSyscall = true;
+            assert(!thread->noSquashFromTC);
+            thread->noSquashFromTC = true;
 
             // CPU will handle implementation of the interrupt.
             cpu->processInterrupts();
@@ -541,7 +541,7 @@ LWBackEnd<Impl>::checkInterrupts()
             commitStatus = TrapPending;
 
             // Exit state update mode to avoid accidental updating.
-            thread->inSyscall = false;
+            thread->noSquashFromTC = false;
 
             // Generate trap squash event.
             generateTrapEvent();
@@ -559,16 +559,16 @@ LWBackEnd<Impl>::handleFault(Fault &fault, Tick latency)
 {
     DPRINTF(BE, "Handling fault!\n");
 
-    assert(!thread->inSyscall);
+    assert(!thread->noSquashFromTC);
 
-    thread->inSyscall = true;
+    thread->noSquashFromTC = true;
 
     // Consider holding onto the trap and waiting until the trap event
     // happens for this to be executed.
     fault->invoke(thread->getTC());
 
     // Exit state update mode to avoid accidental updating.
-    thread->inSyscall = false;
+    thread->noSquashFromTC = false;
 
     commitStatus = TrapPending;
 
@@ -1205,7 +1205,7 @@ LWBackEnd<Impl>::commitInst(int inst_num)
         Addr oldpc;
         do {
             if (count == 0)
-                assert(!thread->inSyscall && !thread->trapPending);
+                assert(!thread->noSquashFromTC && !thread->trapPending);
             oldpc = thread->readPC();
             cpu->system->pcEventQueue.service(
                 thread->getTC());
@@ -1357,7 +1357,7 @@ LWBackEnd<Impl>::squashFromTC()
     frontEnd->interruptPending = false;
 
     thread->trapPending = false;
-    thread->inSyscall = false;
+    thread->noSquashFromTC = false;
     tcSquash = false;
     commitStatus = Running;
 }
@@ -1373,7 +1373,7 @@ LWBackEnd<Impl>::squashFromTrap()
     frontEnd->interruptPending = false;
 
     thread->trapPending = false;
-    thread->inSyscall = false;
+    thread->noSquashFromTC = false;
     trapSquash = false;
     commitStatus = Running;
 }
index 98ecd850c60723ba0b5f3c29f817ed7206d6aadd..0c03155b8a8b77164e733e5c692b31b56bc9c344 100644 (file)
@@ -65,7 +65,7 @@ struct OzoneThreadState : public ThreadState {
 
     OzoneThreadState(CPUType *_cpu, int _thread_num)
         : ThreadState(_cpu, -1, _thread_num),
-          intrflag(0), cpu(_cpu), inSyscall(0), trapPending(0)
+          intrflag(0), cpu(_cpu), noSquashFromTC(false), trapPending(false)
     {
         if (cpu->params->profile) {
             profile = new FunctionProfile(cpu->params->system->kernelSymtab);
@@ -85,7 +85,7 @@ struct OzoneThreadState : public ThreadState {
 
     OzoneThreadState(CPUType *_cpu, int _thread_num, Process *_process)
         : ThreadState(_cpu, -1, _thread_num, _process),
-          cpu(_cpu), inSyscall(0), trapPending(0)
+          cpu(_cpu), noSquashFromTC(false), trapPending(false)
     {
         miscRegFile.clear();
     }
@@ -102,7 +102,7 @@ struct OzoneThreadState : public ThreadState {
 
     typename Impl::CPUType *cpu;
 
-    bool inSyscall;
+    bool noSquashFromTC;
 
     bool trapPending;