From patchwork Mon May 23 20:28:35 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [15/26] target-alpha: Use kernel mmu_idx for pal_mode. Date: Mon, 23 May 2011 10:28:35 -0000 From: Richard Henderson X-Patchwork-Id: 97080 Message-Id: <1306182526-12081-16-git-send-email-rth@twiddle.net> To: qemu-devel@nongnu.org Signed-off-by: Richard Henderson --- target-alpha/cpu.h | 8 +++++++- target-alpha/translate.c | 6 ++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/target-alpha/cpu.h b/target-alpha/cpu.h index 4407b32..a59b39a 100644 --- a/target-alpha/cpu.h +++ b/target-alpha/cpu.h @@ -341,7 +341,13 @@ enum { static inline int cpu_mmu_index(CPUState *env) { - return (env->ps & PS_USER_MODE) != 0; + if (env->pal_mode) { + return MMU_KERNEL_IDX; + } else if (env->ps & PS_USER_MODE) { + return MMU_USER_IDX; + } else { + return MMU_KERNEL_IDX; + } } enum { diff --git a/target-alpha/translate.c b/target-alpha/translate.c index 2f3c637..a937356 100644 --- a/target-alpha/translate.c +++ b/target-alpha/translate.c @@ -3098,10 +3098,8 @@ static inline void gen_intermediate_code_internal(CPUState *env, ctx.env = env; ctx.pc = pc_start; ctx.amask = env->amask; -#if defined (CONFIG_USER_ONLY) - ctx.mem_idx = 0; -#else - ctx.mem_idx = ((env->ps >> 3) & 3); + ctx.mem_idx = cpu_mmu_index(env); +#if !defined (CONFIG_USER_ONLY) ctx.pal_mode = env->pal_mode; #endif