From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52195) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abLrG-0007Ou-UM for qemu-devel@nongnu.org; Thu, 03 Mar 2016 00:31:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1abLrD-00031g-Fu for qemu-devel@nongnu.org; Thu, 03 Mar 2016 00:31:30 -0500 Received: from mail-qg0-x241.google.com ([2607:f8b0:400d:c04::241]:33080) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abLrD-00031Y-Bb for qemu-devel@nongnu.org; Thu, 03 Mar 2016 00:31:27 -0500 Received: by mail-qg0-x241.google.com with SMTP id y89so760941qge.0 for ; Wed, 02 Mar 2016 21:31:27 -0800 (PST) Sender: Richard Henderson From: Richard Henderson Date: Wed, 2 Mar 2016 21:30:45 -0800 Message-Id: <1456983051-14707-2-git-send-email-rth@twiddle.net> In-Reply-To: <1456983051-14707-1-git-send-email-rth@twiddle.net> References: <1456983051-14707-1-git-send-email-rth@twiddle.net> Subject: [Qemu-devel] [PATCH 1/7] target-i386: avoid repeated calls to the bnd_jmp helper List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, hpoussin@reactos.org From: Paolo Bonzini Two flags were tested the wrong way. Signed-off-by: Paolo Bonzini Message-Id: <1456845145-18891-1-git-send-email-pbonzini@redhat.com> Signed-off-by: Richard Henderson [rth: Fixed enable test as well.] --- target-i386/translate.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/target-i386/translate.c b/target-i386/translate.c index 53dee79..cd214a6 100644 --- a/target-i386/translate.c +++ b/target-i386/translate.c @@ -2409,12 +2409,12 @@ static void gen_reset_hflag(DisasContext *s, uint32_t mask) /* Clear BND registers during legacy branches. */ static void gen_bnd_jmp(DisasContext *s) { - /* Do nothing if BND prefix present, MPX is disabled, or if the - BNDREGs are known to be in INIT state already. The helper - itself will check BNDPRESERVE at runtime. */ + /* Clear the registers only if BND prefix is missing, MPX is enabled, + and if the BNDREGs are known to be in use (non-zero) already. + The helper itself will check BNDPRESERVE at runtime. */ if ((s->prefix & PREFIX_REPNZ) == 0 - && (s->flags & HF_MPX_EN_MASK) == 0 - && (s->flags & HF_MPX_IU_MASK) == 0) { + && (s->flags & HF_MPX_EN_MASK) != 0 + && (s->flags & HF_MPX_IU_MASK) != 0) { gen_helper_bnd_jmp(cpu_env); } } -- 2.5.0