mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2024-12-23 19:45:29 +00:00
target/arm: Remove fsr argument from arm_ld*_ptw()
All the callers of arm_ldq_ptw() and arm_ldl_ptw() ignore the value that those functions store in the fsr argument on failure: if they return failure to their callers they will always overwrite the fsr value with something else. Remove the argument from these functions and S1_ptw_translate(). This will simplify removing fsr from the calling functions. Backports commit 3795a6de9f7ec4a7e3dcb8bf02a88a014147b0b0 from qemu
This commit is contained in:
parent
211cbde764
commit
457e4f35ac
|
@ -7457,7 +7457,6 @@ static bool get_level1_table_address(CPUARMState *env, ARMMMUIdx mmu_idx,
|
|||
/* Translate a S1 pagetable walk through S2 if needed. */
|
||||
static hwaddr S1_ptw_translate(CPUARMState *env, ARMMMUIdx mmu_idx,
|
||||
hwaddr addr, MemTxAttrs txattrs,
|
||||
uint32_t *fsr,
|
||||
ARMMMUFaultInfo *fi)
|
||||
{
|
||||
if ((mmu_idx == ARMMMUIdx_S1NSE0 || mmu_idx == ARMMMUIdx_S1NSE1) &&
|
||||
|
@ -7466,9 +7465,10 @@ static hwaddr S1_ptw_translate(CPUARMState *env, ARMMMUIdx mmu_idx,
|
|||
hwaddr s2pa;
|
||||
int s2prot;
|
||||
int ret;
|
||||
uint32_t fsr;
|
||||
|
||||
ret = get_phys_addr_lpae(env, addr, 0, ARMMMUIdx_S2NS, &s2pa,
|
||||
&txattrs, &s2prot, &s2size, fsr, fi, NULL);
|
||||
&txattrs, &s2prot, &s2size, &fsr, fi, NULL);
|
||||
if (ret) {
|
||||
fi->s2addr = addr;
|
||||
fi->stage2 = true;
|
||||
|
@ -7488,8 +7488,7 @@ static hwaddr S1_ptw_translate(CPUARMState *env, ARMMMUIdx mmu_idx,
|
|||
* (but not if it was for a debug access).
|
||||
*/
|
||||
static uint32_t arm_ldl_ptw(CPUState *cs, hwaddr addr, bool is_secure,
|
||||
ARMMMUIdx mmu_idx, uint32_t *fsr,
|
||||
ARMMMUFaultInfo *fi)
|
||||
ARMMMUIdx mmu_idx, ARMMMUFaultInfo *fi)
|
||||
{
|
||||
ARMCPU *cpu = ARM_CPU(cs->uc, cs);
|
||||
CPUARMState *env = &cpu->env;
|
||||
|
@ -7498,7 +7497,7 @@ static uint32_t arm_ldl_ptw(CPUState *cs, hwaddr addr, bool is_secure,
|
|||
|
||||
attrs.secure = is_secure;
|
||||
as = arm_addressspace(cs, attrs);
|
||||
addr = S1_ptw_translate(env, mmu_idx, addr, attrs, fsr, fi);
|
||||
addr = S1_ptw_translate(env, mmu_idx, addr, attrs, fi);
|
||||
if (fi->s1ptw) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -7510,8 +7509,7 @@ static uint32_t arm_ldl_ptw(CPUState *cs, hwaddr addr, bool is_secure,
|
|||
}
|
||||
|
||||
static uint64_t arm_ldq_ptw(CPUState *cs, hwaddr addr, bool is_secure,
|
||||
ARMMMUIdx mmu_idx, uint32_t *fsr,
|
||||
ARMMMUFaultInfo *fi)
|
||||
ARMMMUIdx mmu_idx, ARMMMUFaultInfo *fi)
|
||||
{
|
||||
ARMCPU *cpu = ARM_CPU(cs->uc, cs);
|
||||
CPUARMState *env = &cpu->env;
|
||||
|
@ -7520,7 +7518,7 @@ static uint64_t arm_ldq_ptw(CPUState *cs, hwaddr addr, bool is_secure,
|
|||
|
||||
attrs.secure = is_secure;
|
||||
as = arm_addressspace(cs, attrs);
|
||||
addr = S1_ptw_translate(env, mmu_idx, addr, attrs, fsr, fi);
|
||||
addr = S1_ptw_translate(env, mmu_idx, addr, attrs, fi);
|
||||
if (fi->s1ptw) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -7556,7 +7554,7 @@ static bool get_phys_addr_v5(CPUARMState *env, uint32_t address,
|
|||
goto do_fault;
|
||||
}
|
||||
desc = arm_ldl_ptw(cs, table, regime_is_secure(env, mmu_idx),
|
||||
mmu_idx, fsr, fi);
|
||||
mmu_idx, fi);
|
||||
type = (desc & 3);
|
||||
domain = (desc >> 5) & 0x0f;
|
||||
if (regime_el(env, mmu_idx) == 1) {
|
||||
|
@ -7593,7 +7591,7 @@ static bool get_phys_addr_v5(CPUARMState *env, uint32_t address,
|
|||
table = (desc & 0xfffff000) | ((address >> 8) & 0xffc);
|
||||
}
|
||||
desc = arm_ldl_ptw(cs, table, regime_is_secure(env, mmu_idx),
|
||||
mmu_idx, fsr, fi);
|
||||
mmu_idx, fi);
|
||||
switch (desc & 3) {
|
||||
case 0: /* Page translation fault. */
|
||||
code = 7;
|
||||
|
@ -7675,7 +7673,7 @@ static bool get_phys_addr_v6(CPUARMState *env, uint32_t address,
|
|||
goto do_fault;
|
||||
}
|
||||
desc = arm_ldl_ptw(cs, table, regime_is_secure(env, mmu_idx),
|
||||
mmu_idx, fsr, fi);
|
||||
mmu_idx, fi);
|
||||
type = (desc & 3);
|
||||
if (type == 0 || (type == 3 && !arm_feature(env, ARM_FEATURE_PXN))) {
|
||||
/* Section translation fault, or attempt to use the encoding
|
||||
|
@ -7727,7 +7725,7 @@ static bool get_phys_addr_v6(CPUARMState *env, uint32_t address,
|
|||
/* Lookup l2 entry. */
|
||||
table = (desc & 0xfffffc00) | ((address >> 10) & 0x3fc);
|
||||
desc = arm_ldl_ptw(cs, table, regime_is_secure(env, mmu_idx),
|
||||
mmu_idx, fsr, fi);
|
||||
mmu_idx, fi);
|
||||
ap = ((desc >> 4) & 3) | ((desc >> 7) & 4);
|
||||
switch (desc & 3) {
|
||||
case 0: /* Page translation fault. */
|
||||
|
@ -8138,7 +8136,7 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,
|
|||
descaddr |= (address >> (stride * (4 - level))) & indexmask;
|
||||
descaddr &= ~7ULL;
|
||||
nstable = extract32(tableattrs, 4, 1);
|
||||
descriptor = arm_ldq_ptw(cs, descaddr, !nstable, mmu_idx, fsr, fi);
|
||||
descriptor = arm_ldq_ptw(cs, descaddr, !nstable, mmu_idx, fi);
|
||||
if (fi->s1ptw) {
|
||||
goto do_fault;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue