From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41273) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXrXI-0003dO-FW for qemu-devel@nongnu.org; Fri, 04 Sep 2015 10:00:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZXrXD-0005ry-Gm for qemu-devel@nongnu.org; Fri, 04 Sep 2015 10:00:12 -0400 Received: from mail-vk0-f53.google.com ([209.85.213.53]:34081) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXrXD-0005rj-Di for qemu-devel@nongnu.org; Fri, 04 Sep 2015 10:00:07 -0400 Received: by vkhf67 with SMTP id f67so11902264vkh.1 for ; Fri, 04 Sep 2015 07:00:06 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1441188198-1620-1-git-send-email-afarallax@yandex.ru> References: <1441188198-1620-1-git-send-email-afarallax@yandex.ru> From: Peter Maydell Date: Fri, 4 Sep 2015 14:59:47 +0100 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [PATCH v2] target-arm: Break the TB after ISB to execute self-modified code correctly List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sergey Sorokin Cc: QEMU Developers On 2 September 2015 at 11:03, Sergey Sorokin 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 > --- > 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