mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 09:13:55 -06:00
target/ppc: Don't use mmu_ctx_t for mmu40x_get_physical_address()
mmu40x_get_physical_address() only uses the raddr and prot fields from mmu_ctx_t. Pass these directly instead of using a ctx struct. Reviewed-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
This commit is contained in:
parent
f178e4f894
commit
5cc867a679
1 changed files with 15 additions and 22 deletions
|
@ -519,20 +519,18 @@ int ppcemb_tlb_search(CPUPPCState *env, target_ulong address, uint32_t pid)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mmu40x_get_physical_address(CPUPPCState *env, mmu_ctx_t *ctx,
|
static int mmu40x_get_physical_address(CPUPPCState *env, hwaddr *raddr,
|
||||||
target_ulong address,
|
int *prot, target_ulong address,
|
||||||
MMUAccessType access_type)
|
MMUAccessType access_type)
|
||||||
{
|
{
|
||||||
ppcemb_tlb_t *tlb;
|
ppcemb_tlb_t *tlb;
|
||||||
hwaddr raddr;
|
|
||||||
int i, ret, zsel, zpr, pr;
|
int i, ret, zsel, zpr, pr;
|
||||||
|
|
||||||
ret = -1;
|
ret = -1;
|
||||||
raddr = (hwaddr)-1ULL;
|
|
||||||
pr = FIELD_EX64(env->msr, MSR, PR);
|
pr = FIELD_EX64(env->msr, MSR, PR);
|
||||||
for (i = 0; i < env->nb_tlb; i++) {
|
for (i = 0; i < env->nb_tlb; i++) {
|
||||||
tlb = &env->tlb.tlbe[i];
|
tlb = &env->tlb.tlbe[i];
|
||||||
if (!ppcemb_tlb_check(env, tlb, &raddr, address,
|
if (!ppcemb_tlb_check(env, tlb, raddr, address,
|
||||||
env->spr[SPR_40x_PID], i)) {
|
env->spr[SPR_40x_PID], i)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -550,40 +548,34 @@ static int mmu40x_get_physical_address(CPUPPCState *env, mmu_ctx_t *ctx,
|
||||||
/* fall through */
|
/* fall through */
|
||||||
case 0x3:
|
case 0x3:
|
||||||
/* All accesses granted */
|
/* All accesses granted */
|
||||||
ctx->prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
|
*prot = PAGE_RWX;
|
||||||
ret = 0;
|
ret = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x0:
|
case 0x0:
|
||||||
if (pr != 0) {
|
if (pr != 0) {
|
||||||
/* Raise Zone protection fault. */
|
/* Raise Zone protection fault. */
|
||||||
env->spr[SPR_40x_ESR] = 1 << 22;
|
env->spr[SPR_40x_ESR] = 1 << 22;
|
||||||
ctx->prot = 0;
|
*prot = 0;
|
||||||
ret = -2;
|
ret = -2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* fall through */
|
/* fall through */
|
||||||
case 0x1:
|
case 0x1:
|
||||||
check_perms:
|
check_perms:
|
||||||
/* Check from TLB entry */
|
/* Check from TLB entry */
|
||||||
ctx->prot = tlb->prot;
|
*prot = tlb->prot;
|
||||||
ret = check_prot(ctx->prot, access_type);
|
ret = check_prot(*prot, access_type);
|
||||||
if (ret == -2) {
|
if (ret == -2) {
|
||||||
env->spr[SPR_40x_ESR] = 0;
|
env->spr[SPR_40x_ESR] = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (ret >= 0) {
|
|
||||||
ctx->raddr = raddr;
|
|
||||||
qemu_log_mask(CPU_LOG_MMU, "%s: access granted " TARGET_FMT_lx
|
|
||||||
" => " HWADDR_FMT_plx
|
|
||||||
" %d %d\n", __func__, address, ctx->raddr, ctx->prot,
|
|
||||||
ret);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
qemu_log_mask(CPU_LOG_MMU, "%s: access %s " TARGET_FMT_lx " => "
|
||||||
qemu_log_mask(CPU_LOG_MMU, "%s: access refused " TARGET_FMT_lx
|
HWADDR_FMT_plx " %d %d\n", __func__,
|
||||||
" => " HWADDR_FMT_plx " %d %d\n",
|
ret < 0 ? "refused" : "granted", address,
|
||||||
__func__, address, raddr, ctx->prot, ret);
|
ret < 0 ? 0 : *raddr, *prot, ret);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1171,7 +1163,8 @@ int get_physical_address_wtlb(CPUPPCState *env, mmu_ctx_t *ctx,
|
||||||
case POWERPC_MMU_SOFT_6xx:
|
case POWERPC_MMU_SOFT_6xx:
|
||||||
return mmu6xx_get_physical_address(env, ctx, eaddr, access_type, type);
|
return mmu6xx_get_physical_address(env, ctx, eaddr, access_type, type);
|
||||||
case POWERPC_MMU_SOFT_4xx:
|
case POWERPC_MMU_SOFT_4xx:
|
||||||
return mmu40x_get_physical_address(env, ctx, eaddr, access_type);
|
return mmu40x_get_physical_address(env, &ctx->raddr, &ctx->prot, eaddr,
|
||||||
|
access_type);
|
||||||
case POWERPC_MMU_REAL:
|
case POWERPC_MMU_REAL:
|
||||||
cpu_abort(env_cpu(env),
|
cpu_abort(env_cpu(env),
|
||||||
"PowerPC in real mode do not do any translation\n");
|
"PowerPC in real mode do not do any translation\n");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue