[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 05/14] target-i386: Enable control registers for
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 05/14] target-i386: Enable control registers for MPX |
Date: |
Thu, 9 Jul 2015 15:18:53 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 |
On 09/07/2015 10:17, Richard Henderson wrote:
>
> +void cpu_sync_bndcs_hf(CPUX86State *env)
s/hf/hflags/ :)
> +{
> + uint32_t hflags = env->hflags;
> + uint32_t bndcsr;
> +
> + if ((hflags & HF_CPL_MASK) == 3) {
> + bndcsr = env->bndcs_regs.cfgu;
> + } else {
> + bndcsr = env->msr_bndcfgs;
> + }
> +
> + if ((hflags & HF_OSXSAVE_MASK)
> + && (env->xcr0 & XSTATE_BNDCSR)
> + && (bndcsr & BNDCFG_ENABLE)) {
> + hflags |= HF_MPX_EN_MASK;
> + } else {
> + hflags &= ~HF_MPX_EN_MASK;
> + }
> +
> + if (bndcsr & BNDCFG_BNDPRESERVE) {
> + hflags |= HF_MPX_PR_MASK;
> + } else {
> + hflags &= ~HF_MPX_PR_MASK;
> + }
> +
> + env->hflags = hflags;
> +}
> diff --git a/target-i386/kvm.c b/target-i386/kvm.c
> index f057982..27ae029 100644
> --- a/target-i386/kvm.c
> +++ b/target-i386/kvm.c
> @@ -2186,6 +2186,11 @@ int kvm_arch_get_registers(CPUState *cs)
> if (ret < 0) {
> return ret;
> }
> +
> + /* ??? HFLAGS may be out of sync if any of the above error out.
> + But there seems little point in recomputing this multiple times. */
> + cpu_sync_bndcs_hf(&cpu->env);
Why aren't you just using a goto, like
if (ret < 0) {
goto out;
}
ret = 0;
out:
cpu_sync_bndcs_hf(&cpu->env);
return ret;
> return 0;
- [Qemu-devel] [PATCH 00/14] target-i386: Implement MPX extension, Richard Henderson, 2015/07/09
- [Qemu-devel] [PATCH 01/14] target-i386: Split fxsave/fxrstor implementation, Richard Henderson, 2015/07/09
- [Qemu-devel] [PATCH 02/14] target-i386: Rearrange processing of 0F 01, Richard Henderson, 2015/07/09
- [Qemu-devel] [PATCH 03/14] target-i386: Add XSAVE extension, Richard Henderson, 2015/07/09
- [Qemu-devel] [PATCH 04/14] target-i386: Implement XSAVEOPT, Richard Henderson, 2015/07/09
- [Qemu-devel] [PATCH 05/14] target-i386: Enable control registers for MPX, Richard Henderson, 2015/07/09
- [Qemu-devel] [PATCH 06/14] target-i386: Perform set/reset_inhibit_irq inline, Richard Henderson, 2015/07/09
- [Qemu-devel] [PATCH 07/14] target-i386: Split up gen_lea_modrm, Richard Henderson, 2015/07/09
- [Qemu-devel] [PATCH 08/14] target-i386: Implement BNDMK, Richard Henderson, 2015/07/09
- [Qemu-devel] [PATCH 09/14] target-i386: Implement BNDMOV, Richard Henderson, 2015/07/09
- [Qemu-devel] [PATCH 11/14] target-i386: Update BNDSTATUS for exceptions raised by BOUND, Richard Henderson, 2015/07/09
- [Qemu-devel] [PATCH 12/14] target-i386: Implement BNDLDX, BNDSTX, Richard Henderson, 2015/07/09
- [Qemu-devel] [PATCH 10/14] target-i386: Implement BNDCL, BNDCU, BNDCN, Richard Henderson, 2015/07/09
- [Qemu-devel] [PATCH 13/14] target-i386: Clear bndregs during legacy near jumps, Richard Henderson, 2015/07/09
- [Qemu-devel] [PATCH 14/14] target-i386: Enable XCR0 features for user-mode, Richard Henderson, 2015/07/09