summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2006-11-08 13:55:48 -0500
committerGabe Black <gblack@eecs.umich.edu>2006-11-08 13:55:48 -0500
commit67b9a2ebd850b6b0a01324b46ac3d6f87b3a8cb5 (patch)
tree7a05754175a3ba9ac87747cb265d44f0d0e6a530
parent770b575c30e734b3ed9528558a72c476a9e4bf41 (diff)
downloadgem5-67b9a2ebd850b6b0a01324b46ac3d6f87b3a8cb5.tar.xz
Move the check to see if you're in user mode into the isa directory.
--HG-- extra : convert_revision : b5b7cdf4a5e5e54228c592093516bf18d0f7dbe6
-rw-r--r--src/arch/alpha/utility.hh6
-rw-r--r--src/arch/sparc/utility.hh8
-rw-r--r--src/cpu/o3/commit_impl.hh4
-rw-r--r--src/cpu/simple/base.cc3
4 files changed, 17 insertions, 4 deletions
diff --git a/src/arch/alpha/utility.hh b/src/arch/alpha/utility.hh
index cb86c7e9e..100736555 100644
--- a/src/arch/alpha/utility.hh
+++ b/src/arch/alpha/utility.hh
@@ -42,6 +42,12 @@
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
diff --git a/src/arch/sparc/utility.hh b/src/arch/sparc/utility.hh
index e2b0b2307..e51677cdf 100644
--- a/src/arch/sparc/utility.hh
+++ b/src/arch/sparc/utility.hh
@@ -39,6 +39,14 @@
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;
diff --git a/src/cpu/o3/commit_impl.hh b/src/cpu/o3/commit_impl.hh
index bd5c4f9ce..30052a148 100644
--- a/src/cpu/o3/commit_impl.hh
+++ b/src/cpu/o3/commit_impl.hh
@@ -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(),
diff --git a/src/cpu/simple/base.cc b/src/cpu/simple/base.cc
index 00fa4d247..ab438aa77 100644
--- a/src/cpu/simple/base.cc
+++ b/src/cpu/simple/base.cc
@@ -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)