target-i386: Avoid repeated calls to the bnd_jmp helper

Two flags were tested the wrong way.

Backports commit 8b33e82b863d1c6fce7e69a41f6c96a8e15b73fb from qemu
This commit is contained in:
Paolo Bonzini 2018-02-21 21:13:20 -05:00 committed by Lioncash
parent f7bff04b7b
commit bdf1189046
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -2750,12 +2750,12 @@ static void gen_bnd_jmp(DisasContext *s)
TCGContext *tcg_ctx = s->uc->tcg_ctx; TCGContext *tcg_ctx = s->uc->tcg_ctx;
TCGv_ptr cpu_env = tcg_ctx->cpu_env; TCGv_ptr cpu_env = tcg_ctx->cpu_env;
/* Do nothing if BND prefix present, MPX is disabled, or if the /* Clear the registers only if BND prefix is missing, MPX is enabled,
BNDREGs are known to be in INIT state already. The helper and if the BNDREGs are known to be in use (non-zero) already.
itself will check BNDPRESERVE at runtime. */ The helper itself will check BNDPRESERVE at runtime. */
if ((s->prefix & PREFIX_REPNZ) == 0 if ((s->prefix & PREFIX_REPNZ) == 0
&& (s->flags & HF_MPX_EN_MASK) == 0 && (s->flags & HF_MPX_EN_MASK) != 0
&& (s->flags & HF_MPX_IU_MASK) == 0) { && (s->flags & HF_MPX_IU_MASK) != 0) {
gen_helper_bnd_jmp(tcg_ctx, cpu_env); gen_helper_bnd_jmp(tcg_ctx, cpu_env);
} }
} }