ARM: Expand the mode checking utility functions.
inUserMode now can take either a threadcontext or a CPSR value directly. If given a thread context it just extracts the CPSR and calls the other version. An inPrivelegedMode function was also implemented which just returns the opposite of inUserMode.
This commit is contained in:
parent
75955d6c42
commit
f4f6b31df1
1 changed files with 19 additions and 1 deletions
|
@ -122,10 +122,28 @@ 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);
|
||||
|
|
Loading…
Reference in a new issue