From: Yongbok Kim <yongbok.kim@imgtec.com>
To: Richard Henderson <rth@twiddle.net>,
Peter Maydell <peter.maydell@linaro.org>
Cc: "Leon Alrae" <leon.alrae@imgtec.com>,
"QEMU Developers" <qemu-devel@nongnu.org>,
"Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH v5 2/3] softmmu: Add probe_write()
Date: Wed, 27 May 2015 10:17:38 +0100 [thread overview]
Message-ID: <55658BB2.9070606@imgtec.com> (raw)
In-Reply-To: <5564AE6B.4070406@twiddle.net>
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 <yongbok.kim@imgtec.com> 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
next prev parent reply other threads:[~2015-05-27 9:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-26 16:49 [Qemu-devel] [PATCH v5 0/3] target-mips: Add support for misaligned accesses Yongbok Kim
2015-05-26 16:49 ` [Qemu-devel] [PATCH v5 1/3] target-mips: Misaligned memory accesses for R6 Yongbok Kim
2015-05-26 16:49 ` [Qemu-devel] [PATCH v5 2/3] softmmu: Add probe_write() Yongbok Kim
2015-05-26 16:53 ` Peter Maydell
2015-05-26 17:33 ` Richard Henderson
2015-05-27 9:17 ` Yongbok Kim [this message]
2015-05-26 16:58 ` Andreas Färber
2015-05-26 17:16 ` Paolo Bonzini
2015-05-26 17:19 ` Peter Crosthwaite
2015-05-26 16:49 ` [Qemu-devel] [PATCH v5 3/3] target-mips: Misaligned memory accesses for MSA Yongbok Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55658BB2.9070606@imgtec.com \
--to=yongbok.kim@imgtec.com \
--cc=afaerber@suse.de \
--cc=leon.alrae@imgtec.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.