提交 d10367e0 编写于 作者: E Edgar E. Iglesias

target-microblaze: Consolidate MMU enabled checks

Consolidate MMU enabled checks to cpu_mmu_index().
No functional changes.
Suggested-by: NRichard Henderson <richard.henderson@linaro.org>
Reviewed-by: NAlistair Francis <alistair.francis@wdc.com>
Reviewed-by: NRichard Henderson <richard.henderson@linaro.org>
Signed-off-by: NEdgar E. Iglesias <edgar.iglesias@xilinx.com>
上级 923ce2e6
...@@ -360,8 +360,10 @@ int cpu_mb_signal_handler(int host_signum, void *pinfo, ...@@ -360,8 +360,10 @@ int cpu_mb_signal_handler(int host_signum, void *pinfo,
static inline int cpu_mmu_index (CPUMBState *env, bool ifetch) static inline int cpu_mmu_index (CPUMBState *env, bool ifetch)
{ {
MicroBlazeCPU *cpu = mb_env_get_cpu(env);
/* Are we in nommu mode?. */ /* Are we in nommu mode?. */
if (!(env->sregs[SR_MSR] & MSR_VM)) { if (!(env->sregs[SR_MSR] & MSR_VM) || !cpu->cfg.use_mmu) {
return MMU_NOMMU_IDX; return MMU_NOMMU_IDX;
} }
......
...@@ -58,8 +58,7 @@ int mb_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int size, int rw, ...@@ -58,8 +58,7 @@ int mb_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int size, int rw,
int prot; int prot;
/* Translate if the MMU is available and enabled. */ /* Translate if the MMU is available and enabled. */
if (cpu->cfg.use_mmu && (env->sregs[SR_MSR] & MSR_VM) if (mmu_idx != MMU_NOMMU_IDX) {
&& mmu_idx != MMU_NOMMU_IDX) {
uint32_t vaddr, paddr; uint32_t vaddr, paddr;
struct microblaze_mmu_lookup lu; struct microblaze_mmu_lookup lu;
...@@ -270,9 +269,10 @@ hwaddr mb_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) ...@@ -270,9 +269,10 @@ hwaddr mb_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
CPUMBState *env = &cpu->env; CPUMBState *env = &cpu->env;
target_ulong vaddr, paddr = 0; target_ulong vaddr, paddr = 0;
struct microblaze_mmu_lookup lu; struct microblaze_mmu_lookup lu;
int mmu_idx = cpu_mmu_index(env, false);
unsigned int hit; unsigned int hit;
if (env->sregs[SR_MSR] & MSR_VM) { if (mmu_idx != MMU_NOMMU_IDX) {
hit = mmu_translate(&env->mmu, &lu, addr, 0, 0); hit = mmu_translate(&env->mmu, &lu, addr, 0, 0);
if (hit) { if (hit) {
vaddr = addr & TARGET_PAGE_MASK; vaddr = addr & TARGET_PAGE_MASK;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册