From nobody Mon Feb 9 18:19:12 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499100613795928.2907807075709; Mon, 3 Jul 2017 09:50:13 -0700 (PDT) Received: from localhost ([::1]:36333 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dS4Y8-0004fs-9T for importer@patchew.org; Mon, 03 Jul 2017 12:50:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51758) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dS4KU-0000v5-CQ for qemu-devel@nongnu.org; Mon, 03 Jul 2017 12:36:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dS4KT-0008BT-B5 for qemu-devel@nongnu.org; Mon, 03 Jul 2017 12:36:06 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:36646) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dS4KT-0008Aw-41 for qemu-devel@nongnu.org; Mon, 03 Jul 2017 12:36:05 -0400 Received: by mail-wm0-x242.google.com with SMTP id y5so21474819wmh.3 for ; Mon, 03 Jul 2017 09:36:04 -0700 (PDT) Received: from 640k.lan (94-39-191-51.adsl-ull.clienti.tiscali.it. [94.39.191.51]) by smtp.gmail.com with ESMTPSA id r5sm4867459wmr.9.2017.07.03.09.36.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Jul 2017 09:36:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=PUSKrMDQEWgAcAp513B7tbCS3LBudXglC8NX6HnDp7U=; b=hg1YzAwVruMgKQHNsITafCel7Jt+fgc7dCSiMyNQzKHTiVWp+7RIAmfcLA3Kl2zWsD ARAsMJzN9u7SkW8Y7e1kDLEODoqAZ/NtIvZf3XmCOSoQKXud2cblyW+1khH9lHbthceg rJ6P0aaLfjwHuFHR8unGnCBn/7nYdExHnNuu2gk0TFHWiXponSm+zjkAbDS6vlDgmcsJ 0v5kfhq2wOxUn8pGO3P48bmISblYsVMaz6Leo40YQUx8XHqIYdYasxI67OVkdIC8SmiO Qwj6g5dM3x/58OfsSzmG7jcHe5fIEl9QZb/A95wOqU+eZYX69syxyKiOPnU2hZkSKoui cjjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=PUSKrMDQEWgAcAp513B7tbCS3LBudXglC8NX6HnDp7U=; b=O/2zI73Xnzn9UmuD6hT89tTSjmvLKiMCGQBemCBS+NpalTSWk/3hkWXhzG26Ej+mU7 nq32yKIpOLnXQCGKC18oAGL0XHYSY/EwcLU82HDj0Omi6I10TwWpGj4Fi8hRSzOWzCoB bMgtQrjHShH9rnISs1VsV9QfFzRtmX6LDByr7byuHJOllSr5nLYVSGoz/AZr6n2fXCji ppwy3jvalSY4E0jr0eiWAUPXVZery8LAwSz6QBro1Iq9M5BPZnWLXnRJlwYd1hnSGSbg zK5DnPXqUwGKTnVHzRMUG2zTT8Smn5puVcGFlsa5iOksKoBxzbL5awiAUDLzEXoGv3H/ K6vg== X-Gm-Message-State: AKS2vOykznWTzWY7G4u8/tzQMIX1hwGT5r5tVKIWb3HBIDcktNIY1Xhj wPnjWv2BiYi68tjFwsc= X-Received: by 10.28.182.137 with SMTP id g131mr25205066wmf.95.1499099763854; Mon, 03 Jul 2017 09:36:03 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 3 Jul 2017 18:34:47 +0200 Message-Id: <1499099693-22903-17-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1499099693-22903-1-git-send-email-pbonzini@redhat.com> References: <1499099693-22903-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PATCH 16/22] target/i386: move cpu_sync_bndcs_hflags() function X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: yang.zhong@intel.com, thuth@redhat.com, a.rigo@virtualopensystems.com, anthony.xu@intel.com, rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Yang Zhong Move cpu_sync_bndcs_hflags() function from mpx_helper.c to helper.c because mpx_helper.c need be disabled when tcg is disabled. Signed-off-by: Yang Zhong Signed-off-by: Paolo Bonzini --- target/i386/helper.c | 34 +++++++++++++++++++++++++++++++++- target/i386/mpx_helper.c | 30 ------------------------------ 2 files changed, 33 insertions(+), 31 deletions(-) diff --git a/target/i386/helper.c b/target/i386/helper.c index ef05059..87fd705 100644 --- a/target/i386/helper.c +++ b/target/i386/helper.c @@ -29,6 +29,36 @@ #include "hw/i386/apic_internal.h" #endif =20 +void cpu_sync_bndcs_hflags(CPUX86State *env) +{ + uint32_t hflags =3D env->hflags; + uint32_t hflags2 =3D env->hflags2; + uint32_t bndcsr; + + if ((hflags & HF_CPL_MASK) =3D=3D 3) { + bndcsr =3D env->bndcs_regs.cfgu; + } else { + bndcsr =3D env->msr_bndcfgs; + } + + if ((env->cr[4] & CR4_OSXSAVE_MASK) + && (env->xcr0 & XSTATE_BNDCSR_MASK) + && (bndcsr & BNDCFG_ENABLE)) { + hflags |=3D HF_MPX_EN_MASK; + } else { + hflags &=3D ~HF_MPX_EN_MASK; + } + + if (bndcsr & BNDCFG_BNDPRESERVE) { + hflags2 |=3D HF2_MPX_PR_MASK; + } else { + hflags2 &=3D ~HF2_MPX_PR_MASK; + } + + env->hflags =3D hflags; + env->hflags2 =3D hflags2; +} + static void cpu_x86_version(CPUX86State *env, int *family, int *model) { int cpuver =3D env->cpuid_version; @@ -1302,10 +1332,12 @@ void cpu_report_tpr_access(CPUX86State *env, TPRAcc= ess access) env->tpr_access_type =3D access; =20 cpu_interrupt(cs, CPU_INTERRUPT_TPR); - } else { + } else if (tcg_enabled()) { cpu_restore_state(cs, cs->mem_io_pc); =20 apic_handle_tpr_access_report(cpu->apic_state, env->eip, access); + } else { + abort(); } } #endif /* !CONFIG_USER_ONLY */ diff --git a/target/i386/mpx_helper.c b/target/i386/mpx_helper.c index 7e44820..ade5d24 100644 --- a/target/i386/mpx_helper.c +++ b/target/i386/mpx_helper.c @@ -24,36 +24,6 @@ #include "exec/exec-all.h" =20 =20 -void cpu_sync_bndcs_hflags(CPUX86State *env) -{ - uint32_t hflags =3D env->hflags; - uint32_t hflags2 =3D env->hflags2; - uint32_t bndcsr; - - if ((hflags & HF_CPL_MASK) =3D=3D 3) { - bndcsr =3D env->bndcs_regs.cfgu; - } else { - bndcsr =3D env->msr_bndcfgs; - } - - if ((env->cr[4] & CR4_OSXSAVE_MASK) - && (env->xcr0 & XSTATE_BNDCSR_MASK) - && (bndcsr & BNDCFG_ENABLE)) { - hflags |=3D HF_MPX_EN_MASK; - } else { - hflags &=3D ~HF_MPX_EN_MASK; - } - - if (bndcsr & BNDCFG_BNDPRESERVE) { - hflags2 |=3D HF2_MPX_PR_MASK; - } else { - hflags2 &=3D ~HF2_MPX_PR_MASK; - } - - env->hflags =3D hflags; - env->hflags2 =3D hflags2; -} - void helper_bndck(CPUX86State *env, uint32_t fail) { if (unlikely(fail)) { --=20 1.8.3.1