[RFC PATCH 10/18] accel/tcg: Replace size with first/last in probe_access_internal
Richard Henderson <[email protected]>
| Newsgroups | org.nongnu.qemu-riscv,org.nongnu.qemu-arm,org.nongnu.qemu-devel |
|---|---|
| Message-ID | <[email protected]> |
Propagate the API change down one step further within cputlb.c. Signed-off-by: Richard Henderson <[email protected]> --- accel/tcg/cputlb.c | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index c2ea31a397..b8c23b2948 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1358,8 +1358,8 @@ static void notdirty_write(CPUState *cpu, vaddr mem_vaddr, unsigned size, } } -static int probe_access_internal(CPUState *cpu, vaddr addr, - int fault_size, MMUAccessType access_type, +static int probe_access_internal(CPUState *cpu, vaddr addr, vaddr first, + vaddr last, MMUAccessType access_type, int mmu_idx, bool nonfault, void **phost, CPUTLBEntryFull **pfull, uintptr_t retaddr, bool check_mem_cbs) @@ -1375,7 +1375,7 @@ static int probe_access_internal(CPUState *cpu, vaddr addr, if (!tlb_hit_page(tlb_addr, page_addr)) { if (!victim_tlb_hit(cpu, mmu_idx, index, access_type, page_addr)) { if (!tlb_fill_align(cpu, addr, access_type, mmu_idx, - 0, fault_size, nonfault, retaddr)) { + 0, last - addr + 1, nonfault, retaddr)) { /* Non-faulting page table read failed. */ *phost = NULL; *pfull = NULL; @@ -1423,7 +1423,7 @@ int probe_access_full(CPUArchState *env, vaddr addr, vaddr first, vaddr last, assert(addr <= last); assert(((first ^ last) & TARGET_PAGE_MASK) == 0); - flags = probe_access_internal(env_cpu(env), addr, last - addr + 1, + flags = probe_access_internal(env_cpu(env), addr, first, last, access_type, mmu_idx, nonfault, phost, pfull, retaddr, true); @@ -1440,6 +1440,7 @@ int probe_access_full_mmu(CPUArchState *env, vaddr addr, int size, MMUAccessType access_type, int mmu_idx, void **phost, CPUTLBEntryFull **pfull) { + vaddr last = size ? addr + size - 1 : addr; void *discard_phost; CPUTLBEntryFull *discard_tlb; @@ -1447,13 +1448,13 @@ int probe_access_full_mmu(CPUArchState *env, vaddr addr, int size, phost = phost ? phost : &discard_phost; pfull = pfull ? pfull : &discard_tlb; - int flags = probe_access_internal(env_cpu(env), addr, size, access_type, - mmu_idx, true, phost, pfull, 0, false); + int flags = probe_access_internal(env_cpu(env), addr, addr, last, + access_type, mmu_idx, true, phost, + pfull, 0, false); /* Handle clean RAM pages. */ if (unlikely(flags & TLB_NOTDIRTY)) { - int dirtysize = size == 0 ? 1 : size; - notdirty_write(env_cpu(env), addr, dirtysize, *pfull, 0); + notdirty_write(env_cpu(env), addr, last - addr + 1, *pfull, 0); flags &= ~TLB_NOTDIRTY; } @@ -1472,7 +1473,7 @@ int probe_access_flags(CPUArchState *env, vaddr addr, vaddr first, vaddr last, assert(addr <= last); assert(((first ^ last) & TARGET_PAGE_MASK) == 0); - flags = probe_access_internal(env_cpu(env), addr, last - addr + 1, + flags = probe_access_internal(env_cpu(env), addr, first, last, access_type, mmu_idx, nonfault, phost ? phost : &discard_host, &full, retaddr, true); @@ -1489,15 +1490,16 @@ int probe_access_flags(CPUArchState *env, vaddr addr, vaddr first, vaddr last, void *probe_access(CPUArchState *env, vaddr addr, int size, MMUAccessType access_type, int mmu_idx, uintptr_t retaddr) { + vaddr last = size ? addr + size - 1 : addr; CPUTLBEntryFull *full; void *host; int flags; - g_assert(-(addr | TARGET_PAGE_MASK) >= size); + assert(((addr ^ last) & TARGET_PAGE_MASK) == 0); - flags = probe_access_internal(env_cpu(env), addr, size, access_type, - mmu_idx, false, &host, &full, retaddr, - true); + flags = probe_access_internal(env_cpu(env), addr, addr, last, + access_type, mmu_idx, false, + &host, &full, retaddr, true); /* Per the interface, size == 0 merely faults the access. */ if (size == 0) { @@ -1529,7 +1531,7 @@ void *tlb_vaddr_to_host(CPUArchState *env, vaddr addr, void *host; int flags; - flags = probe_access_internal(env_cpu(env), addr, 0, access_type, + flags = probe_access_internal(env_cpu(env), addr, addr, addr, access_type, mmu_idx, true, &host, &full, 0, false); /* No combination of flags are expected by the caller. */ @@ -1552,9 +1554,10 @@ tb_page_addr_t get_page_addr_code_hostp(CPUArchState *env, vaddr addr, CPUTLBEntryFull *full; void *p; - (void)probe_access_internal(env_cpu(env), addr, 1, MMU_INST_FETCH, - cpu_mmu_index(env_cpu(env), true), false, - hostp, &full, 0, false); + (void)probe_access_internal(env_cpu(env), addr, addr, addr, + MMU_INST_FETCH, + cpu_mmu_index(env_cpu(env), true), + false, hostp, &full, 0, false); p = *hostp; if (p == NULL) { -- 2.43.0