diff options
-rw-r--r-- | src/arch/arm/utility.hh | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/arch/arm/utility.hh b/src/arch/arm/utility.hh index 076468e0d..65c94926e 100644 --- a/src/arch/arm/utility.hh +++ b/src/arch/arm/utility.hh @@ -123,9 +123,27 @@ namespace ArmISA { void initCPU(ThreadContext *tc, int cpuId); static inline bool + inUserMode(CPSR cpsr) + { + return cpsr.mode == MODE_USER; + } + + static inline bool inUserMode(ThreadContext *tc) { - return (tc->readMiscRegNoEffect(MISCREG_CPSR) & 0x1f) == MODE_USER; + return inUserMode(tc->readMiscRegNoEffect(MISCREG_CPSR)); + } + + static inline bool + inPrivilegedMode(CPSR cpsr) + { + return !inUserMode(cpsr); + } + + static inline bool + inPrivilegedMode(ThreadContext *tc) + { + return !inUserMode(tc); } uint64_t getArgument(ThreadContext *tc, int number, bool fp); |