From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45115) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxXU5-0003Jn-Mo for qemu-devel@nongnu.org; Wed, 27 May 2015 05:18:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YxXU1-0002gh-MS for qemu-devel@nongnu.org; Wed, 27 May 2015 05:18:45 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:47093) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxXU1-0002gX-8F for qemu-devel@nongnu.org; Wed, 27 May 2015 05:18:41 -0400 Message-ID: <55658BB2.9070606@imgtec.com> Date: Wed, 27 May 2015 10:17:38 +0100 From: Yongbok Kim MIME-Version: 1.0 References: <1432658961-48553-1-git-send-email-yongbok.kim@imgtec.com> <1432658961-48553-3-git-send-email-yongbok.kim@imgtec.com> <5564AE6B.4070406@twiddle.net> In-Reply-To: <5564AE6B.4070406@twiddle.net> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v5 2/3] softmmu: Add probe_write() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson , Peter Maydell Cc: Leon Alrae , QEMU Developers , =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= On 26/05/2015 18:33, Richard Henderson wrote: > On 05/26/2015 09:53 AM, Peter Maydell wrote: >> On 26 May 2015 at 17:49, Yongbok Kim wrote: >>> Add probe_write() forces a tlb_fill if the specified guest virtual >>> index isn't in the TCG softmmu TLB. >> >> Surely the point is not to fill the TLB but to raise an >> exception if the address is not writable? >> >>> +#if DATA_SIZE == 1 >>> +/* >>> + * Force a tlb_fill if the specified guest virtual index isn't in the TCG >>> + * softmmu TLB. >>> + */ >>> +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)) { >>> + tlb_fill(ENV_GET_CPU(env), addr, MMU_DATA_STORE, mmu_idx, retaddr); >>> + } >>> + } >>> +} >>> +#endif >>> #endif /* !defined(SOFTMMU_CODE_ACCESS) */ >> >> I think this code does what you want, but the comments are >> rather misleading... > > Indeed. The fact that the TLB gets loaded is merely a happy side-effect. > > > r~ > Agreed, I will change the description. Regards, Yongbok