From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60735) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1brLOL-0004fd-OD for qemu-devel@nongnu.org; Tue, 04 Oct 2016 04:48:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1brLOH-0005I4-Pa for qemu-devel@nongnu.org; Tue, 04 Oct 2016 04:48:01 -0400 Received: from mail-wm0-x22c.google.com ([2a00:1450:400c:c09::22c]:37532) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1brLOH-0005HH-8R for qemu-devel@nongnu.org; Tue, 04 Oct 2016 04:47:57 -0400 Received: by mail-wm0-x22c.google.com with SMTP id b201so130324971wmb.0 for ; Tue, 04 Oct 2016 01:47:57 -0700 (PDT) References: <1474048017-26696-1-git-send-email-rth@twiddle.net> <1474048017-26696-10-git-send-email-rth@twiddle.net> From: Alex =?utf-8?Q?Benn=C3=A9e?= In-reply-to: <1474048017-26696-10-git-send-email-rth@twiddle.net> Date: Tue, 04 Oct 2016 09:47:53 +0100 Message-ID: <87vax8sdom.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v4 09/35] cputlb: Move probe_write out of softmmu_template.h List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: qemu-devel@nongnu.org Richard Henderson writes: > Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée > --- > cputlb.c | 21 +++++++++++++++++++++ > softmmu_template.h | 23 ----------------------- > 2 files changed, 21 insertions(+), 23 deletions(-) > > diff --git a/cputlb.c b/cputlb.c > index 5575b73..0c9b77b 100644 > --- a/cputlb.c > +++ b/cputlb.c > @@ -527,6 +527,27 @@ static bool victim_tlb_hit(CPUArchState *env, size_t mmu_idx, size_t index, > victim_tlb_hit(env, mmu_idx, index, offsetof(CPUTLBEntry, TY), \ > (ADDR) & TARGET_PAGE_MASK) > > +/* Probe for whether the specified guest write access is permitted. > + * If it is not permitted then an exception will be taken in the same > + * way as if this were a real write access (and we will not return). > + * Otherwise the function will return, and there will be a valid > + * entry in the TLB for this access. > + */ > +void probe_write(CPUArchState *env, target_ulong addr, int mmu_idx, > + uintptr_t retaddr) > +{ > + int index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1); > + target_ulong tlb_addr = env->tlb_table[mmu_idx][index].addr_write; > + > + if ((addr & TARGET_PAGE_MASK) > + != (tlb_addr & (TARGET_PAGE_MASK | TLB_INVALID_MASK))) { > + /* TLB entry is for a different page */ > + if (!VICTIM_TLB_HIT(addr_write, addr)) { > + tlb_fill(ENV_GET_CPU(env), addr, MMU_DATA_STORE, mmu_idx, retaddr); > + } > + } > +} > + > #define MMUSUFFIX _mmu > > #define DATA_SIZE 1 > diff --git a/softmmu_template.h b/softmmu_template.h > index f9c51fe..538cff5 100644 > --- a/softmmu_template.h > +++ b/softmmu_template.h > @@ -464,29 +464,6 @@ void helper_be_st_name(CPUArchState *env, target_ulong addr, DATA_TYPE val, > glue(glue(st, SUFFIX), _be_p)((uint8_t *)haddr, val); > } > #endif /* DATA_SIZE > 1 */ > - > -#if DATA_SIZE == 1 > -/* Probe for whether the specified guest write access is permitted. > - * If it is not permitted then an exception will be taken in the same > - * way as if this were a real write access (and we will not return). > - * Otherwise the function will return, and there will be a valid > - * entry in the TLB for this access. > - */ > -void probe_write(CPUArchState *env, target_ulong addr, int mmu_idx, > - uintptr_t retaddr) > -{ > - int index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1); > - target_ulong tlb_addr = env->tlb_table[mmu_idx][index].addr_write; > - > - if ((addr & TARGET_PAGE_MASK) > - != (tlb_addr & (TARGET_PAGE_MASK | TLB_INVALID_MASK))) { > - /* TLB entry is for a different page */ > - if (!VICTIM_TLB_HIT(addr_write, addr)) { > - tlb_fill(ENV_GET_CPU(env), addr, MMU_DATA_STORE, mmu_idx, retaddr); > - } > - } > -} > -#endif > #endif /* !defined(SOFTMMU_CODE_ACCESS) */ > > #undef READ_ACCESS_TYPE -- Alex Bennée