Move the check to see if you're in user mode into the isa directory.
authorGabe Black <gblack@eecs.umich.edu>
Wed, 8 Nov 2006 18:55:48 +0000 (13:55 -0500)
committerGabe Black <gblack@eecs.umich.edu>
Wed, 8 Nov 2006 18:55:48 +0000 (13:55 -0500)
--HG--
extra : convert_revision : b5b7cdf4a5e5e54228c592093516bf18d0f7dbe6

src/arch/alpha/utility.hh
src/arch/sparc/utility.hh
src/cpu/o3/commit_impl.hh
src/cpu/simple/base.cc

index cb86c7e9eb14164ab66731cec3ec75f781544352..100736555081327d5730083ea4e942bcdbbbea1f 100644 (file)
 namespace AlphaISA
 {
 
+    static inline bool
+    inUserMode(ThreadContext *tc)
+    {
+        return (tc->readMiscReg(AlphaISA::IPR_DTB_CM) & 0x18) != 0;
+    }
+
     static inline ExtMachInst
     makeExtMI(MachInst inst, Addr pc) {
 #if FULL_SYSTEM
index e2b0b2307b2fbc30f15ac345e4108ec40696bb45..e51677cdf9e1aae74fbc24864a12d2d21c43f603 100644 (file)
 
 namespace SparcISA
 {
+
+    static inline bool
+    inUserMode(ThreadContext *tc)
+    {
+        return !(tc->readMiscReg(MISCREG_PSTATE & (1 << 2)) ||
+                tc->readMiscReg(MISCREG_HPSTATE & (1 << 2)));
+    }
+
     inline ExtMachInst
     makeExtMI(MachInst inst, ThreadContext * xc) {
         ExtMachInst emi = (unsigned MachInst) inst;
index bd5c4f9ce50d3ebbf26bb9e7d52de518bf541c3f..30052a1483504d05f2cfff655836f846d6491c0a 100644 (file)
@@ -35,6 +35,7 @@
 #include <algorithm>
 #include <string>
 
+#include "arch/utility.hh"
 #include "base/loader/symtab.hh"
 #include "base/timebuf.hh"
 #include "cpu/exetrace.hh"
@@ -1084,8 +1085,7 @@ DefaultCommit<Impl>::commitHead(DynInstPtr &head_inst, unsigned inst_num)
 
 #if FULL_SYSTEM
     if (thread[tid]->profile) {
-//        bool usermode =
-//            (cpu->readMiscReg(AlphaISA::IPR_DTB_CM, tid) & 0x18) != 0;
+//        bool usermode = TheISA::inUserMode(thread[tid]->getTC());
 //        thread[tid]->profilePC = usermode ? 1 : head_inst->readPC();
         thread[tid]->profilePC = head_inst->readPC();
         ProfileNode *node = thread[tid]->profile->consume(thread[tid]->getTC(),
index 00fa4d2476181862d8dfbeee6ecce653edca9e5d..ab438aa770a712a8681583bfa8c53dfc476f549d 100644 (file)
@@ -407,8 +407,7 @@ BaseSimpleCPU::postExecute()
 {
 #if FULL_SYSTEM
     if (thread->profile) {
-        bool usermode =
-            (thread->readMiscReg(AlphaISA::IPR_DTB_CM) & 0x18) != 0;
+        bool usermode = TheISA::inUserMode(tc);
         thread->profilePC = usermode ? 1 : thread->readPC();
         ProfileNode *node = thread->profile->consume(tc, inst);
         if (node)