From: Peter Maydell <peter.maydell@linaro.org>
To: Sergey Sorokin <afarallax@yandex.ru>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH v2] target-arm: Break the TB after ISB to execute self-modified code correctly
Date: Fri, 4 Sep 2015 14:59:47 +0100 [thread overview]
Message-ID: <CAFEAcA_rHCvBqU_B5OLjR2o+aXvyRxZSDR4Kvso-sTdtz5oPSw@mail.gmail.com> (raw)
In-Reply-To: <1441188198-1620-1-git-send-email-afarallax@yandex.ru>
On 2 September 2015 at 11:03, Sergey Sorokin <afarallax@yandex.ru> wrote:
> If any store instruction writes the code inside the same TB
> after this store insn, the execution of the TB must be stopped
> to execute new code correctly.
> As described in ARMv8 manual D3.4.6 a self-modified code need to do
> IC invalidation to be valid, and ISB after it. So it's enough to end the TB
> after ISB instruction on the code translation.
>
> Signed-off-by: Sergey Sorokin <afarallax@yandex.ru>
> ---
> In the first version of the patch the TB was broken after IC invalidation
> instead of ISB.
This is correct code-wise as far as it goes, but:
(1) we should mention in the commit message and comments
both of the reasons for breaking the TB:
/* Break the TB after an ISB:
* (1) the architecture requires that we take any pending
* interrupts immediately (v8 ARM ARM D1.14.4)
* (2) self-modifying code might otherwise be changing a
* later insn within the same TB as itself
*/
Also, you've missed the ARMv6 ISB which is within
v6_cp_reginfo[] as a cp15 instruction.
thanks
-- PMM
prev parent reply other threads:[~2015-09-04 14:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-02 10:03 [Qemu-devel] [PATCH v2] target-arm: Break the TB after ISB to execute self-modified code correctly Sergey Sorokin
2015-09-04 13:59 ` Peter Maydell [this message]
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=CAFEAcA_rHCvBqU_B5OLjR2o+aXvyRxZSDR4Kvso-sTdtz5oPSw@mail.gmail.com \
--to=peter.maydell@linaro.org \
--cc=afarallax@yandex.ru \
--cc=qemu-devel@nongnu.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).