diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2016-03-01 16:12:25 +0100 |
---|---|---|
committer | Richard Henderson <rth@twiddle.net> | 2016-03-14 10:45:41 -0700 |
commit | 8b33e82b863d1c6fce7e69a41f6c96a8e15b73fb (patch) | |
tree | fb7d62b26e701975843f664848e67e9fb7a9472b /target-i386/translate.c | |
parent | 618a5a8bc52ba0f2ecbb3dffd01e657f4d841f75 (diff) |
target-i386: Avoid repeated calls to the bnd_jmp helper
Two flags were tested the wrong way.
Tested-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <1456845145-18891-1-git-send-email-pbonzini@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
[rth: Fixed enable test as well.]
Diffstat (limited to 'target-i386/translate.c')
-rw-r--r-- | target-i386/translate.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/target-i386/translate.c b/target-i386/translate.c index 53dee79afd..cd214a6180 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); } } |