diff options
author | Tom Musta <tommusta@gmail.com> | 2014-02-10 11:26:57 -0600 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2014-03-05 03:06:50 +0100 |
commit | 71a8c019c445377f0dd04881cbd7c7dfb6ff3e5c (patch) | |
tree | d01b7e9a4e489778bc6f45cd28bc727022ced42e /target-ppc/translate.c | |
parent | 38a853375e63ea7315e138d7016ed387d744e43d (diff) | |
download | hqemu-71a8c019c445377f0dd04881cbd7c7dfb6ff3e5c.zip hqemu-71a8c019c445377f0dd04881cbd7c7dfb6ff3e5c.tar.gz |
target-ppc: Add is_user_mode Utility Routine
This patch adds a boolean function is_user_mode that can be re-used
in translation code that is sensitive to the MSR[PR] (user-mode)
state.
Signed-off-by: Tom Musta <tommusta@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'target-ppc/translate.c')
-rw-r--r-- | target-ppc/translate.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/target-ppc/translate.c b/target-ppc/translate.c index 6abe71a..f6ff248 100644 --- a/target-ppc/translate.c +++ b/target-ppc/translate.c @@ -622,6 +622,20 @@ static opc_handler_t invalid_handler = { .handler = gen_invalid, }; +#if defined(TARGET_PPC64) +/* NOTE: as this time, the only use of is_user_mode() is in 64 bit code. And */ +/* so the function is wrapped in the standard 64-bit ifdef in order to */ +/* avoid compiler warnings in 32-bit implementations. */ +static bool is_user_mode(DisasContext *ctx) +{ +#if defined(CONFIG_USER_ONLY) + return true; +#else + return ctx->mem_idx == 0; +#endif +} +#endif + /*** Integer comparison ***/ static inline void gen_op_cmp(TCGv arg0, TCGv arg1, int s, int crf) |