From nobody Mon Feb 9 20:34:33 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 1499100408825780.4570565229975; Mon, 3 Jul 2017 09:46:48 -0700 (PDT) Received: from localhost ([::1]:36319 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dS4Up-0001eH-Hs for importer@patchew.org; Mon, 03 Jul 2017 12:46:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51866) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dS4Kd-00015R-Dv for qemu-devel@nongnu.org; Mon, 03 Jul 2017 12:36:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dS4KZ-0008G1-Do for qemu-devel@nongnu.org; Mon, 03 Jul 2017 12:36:15 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:32835) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dS4KZ-0008FF-3T for qemu-devel@nongnu.org; Mon, 03 Jul 2017 12:36:11 -0400 Received: by mail-wm0-x242.google.com with SMTP id j85so21516214wmj.0 for ; Mon, 03 Jul 2017 09:36:10 -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.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Jul 2017 09:36:09 -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=Z6SmLL5ry8tr0pE/33vp2AwWCvB/N3BCORZrPwXP+oM=; b=a7iowzQ7hv1sFZRying/g8f9Hz1doK+e8ZltyzVm59uLlz3t6QIke0vs4cjLVXVBVp HYrRBzrUOt8kc0QbQ88tOkG/5Wfc4t34oNH/1+sLhc0X7RWy67R2QNOOvplfDbnj2+Uh Mo3oeXzTlok4b2swqRo+mc7rbLIHdhm2sZ6YTBTBECd05HsF81T79Ck6Nv07Z2WrykBC i8u/VeqvmtIBFT6V9LPfAkjWq5/cyb6KDH2fMofclYZo80WJYtA3e8nQkEPy8dI7AKEe fCALJThQ5bWD484FgjAOeXxNDoA4uCAvDhnKtMOYy/T02IvhhqiSB0Pu6v3PpY+yNZ5F 7nDw== 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=Z6SmLL5ry8tr0pE/33vp2AwWCvB/N3BCORZrPwXP+oM=; b=sP+oCbHwaGRzk2iDwiTD0oqw4fmrKzNxGBrPDoAxJDjv7eqQNYcnV8IckAx9wiZfC6 7f+px9HxjAyIgVlg9feq/znV0m7rnfmlPXFvrKty31jpa7qHdrANkXpdPgzkvyykBvjk FGQZCwnT6F/BGd2nnWNIbE5AvzcW6dCW1kfMgO0yW/SyremWpFMwAl1OYBeKSpfYLZ8q kJ1PggEMVEpvscQ2MyMMyR8REctQS0puNQtJYcnH6+V0ZjvZKOA6CvyTIFK3HhDQiMnf kfIRveM+UZ4tChE6vaAa/YMdccaNOWUX9PUXIaI2IHbh/QVSn61zVFdgb6fd38WudrwP +5fQ== X-Gm-Message-State: AKS2vOzXwn+EEw70pMso3Jv/vh2Q9wX23EdcWT/c2SPk0Zz2DlYm8/4D 8mWkGNwr4wm/slAbnfQ= X-Received: by 10.28.236.83 with SMTP id k80mr16192606wmh.52.1499099769848; Mon, 03 Jul 2017 09:36:09 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 3 Jul 2017 18:34:51 +0200 Message-Id: <1499099693-22903-21-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 20/22] target/i386: add the tcg_enabled() in target/i386/ 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 Add the tcg_enabled() where the x86 target needs to disable TCG-specific code. Signed-off-by: Yang Zhong Signed-off-by: Paolo Bonzini --- target/i386/bpt_helper.c | 32 +++++++++++++++++++++++--------- target/i386/cpu.c | 4 +++- target/i386/cpu.h | 8 +++++++- target/i386/machine.c | 5 +++-- 4 files changed, 36 insertions(+), 13 deletions(-) diff --git a/target/i386/bpt_helper.c b/target/i386/bpt_helper.c index b3efdc7..e0fa54c 100644 --- a/target/i386/bpt_helper.c +++ b/target/i386/bpt_helper.c @@ -215,10 +215,12 @@ void breakpoint_handler(CPUState *cs) if (cs->watchpoint_hit) { if (cs->watchpoint_hit->flags & BP_CPU) { cs->watchpoint_hit =3D NULL; - if (check_hw_breakpoints(env, false)) { - raise_exception(env, EXCP01_DB); - } else { - cpu_loop_exit_noexc(cs); + if (tcg_enabled()) { + if (check_hw_breakpoints(env, false)) { + raise_exception(env, EXCP01_DB); + } else { + cpu_loop_exit_noexc(cs); + } } } } else { @@ -226,7 +228,9 @@ void breakpoint_handler(CPUState *cs) if (bp->pc =3D=3D env->eip) { if (bp->flags & BP_CPU) { check_hw_breakpoints(env, true); - raise_exception(env, EXCP01_DB); + if (tcg_enabled()) { + raise_exception(env, EXCP01_DB); + } } break; } @@ -241,7 +245,9 @@ void helper_single_step(CPUX86State *env) check_hw_breakpoints(env, true); env->dr[6] |=3D DR6_BS; #endif - raise_exception(env, EXCP01_DB); + if (tcg_enabled()) { + raise_exception(env, EXCP01_DB); + } } =20 void helper_rechecking_single_step(CPUX86State *env) @@ -282,7 +288,9 @@ void helper_set_dr(CPUX86State *env, int reg, target_ul= ong t0) cpu_x86_update_dr7(env, t0); return; } - raise_exception_err_ra(env, EXCP06_ILLOP, 0, GETPC()); + if (tcg_enabled()) { + raise_exception_err_ra(env, EXCP06_ILLOP, 0, GETPC()); + } #endif } =20 @@ -304,7 +312,11 @@ target_ulong helper_get_dr(CPUX86State *env, int reg) return env->dr[7]; } } - raise_exception_err_ra(env, EXCP06_ILLOP, 0, GETPC()); + if (tcg_enabled()) { + raise_exception_err_ra(env, EXCP06_ILLOP, 0, GETPC()); + } else { + return 0; + } } =20 /* Check if Port I/O is trapped by a breakpoint. */ @@ -329,7 +341,9 @@ void helper_bpt_io(CPUX86State *env, uint32_t port, if (hit) { env->dr[6] =3D (env->dr[6] & ~0xf) | hit; env->eip =3D next_eip; - raise_exception(env, EXCP01_DB); + if (tcg_enabled()) { + raise_exception(env, EXCP01_DB); + } } #endif } diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 642519a..c571772 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -4040,8 +4040,10 @@ static void x86_cpu_common_class_init(ObjectClass *o= c, void *data) cc->class_by_name =3D x86_cpu_class_by_name; cc->parse_features =3D x86_cpu_parse_featurestr; cc->has_work =3D x86_cpu_has_work; +#ifdef CONFIG_TCG cc->do_interrupt =3D x86_cpu_do_interrupt; cc->cpu_exec_interrupt =3D x86_cpu_exec_interrupt; +#endif cc->dump_state =3D x86_cpu_dump_state; cc->get_crash_info =3D x86_cpu_get_crash_info; cc->set_pc =3D x86_cpu_set_pc; @@ -4070,7 +4072,7 @@ static void x86_cpu_common_class_init(ObjectClass *oc= , void *data) cc->gdb_core_xml_file =3D "i386-32bit.xml"; cc->gdb_num_core_regs =3D 41; #endif -#ifndef CONFIG_USER_ONLY +#if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY) cc->debug_excp_handler =3D breakpoint_handler; #endif cc->cpu_exec_enter =3D x86_cpu_exec_enter; diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 67a6091..27732ad 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -52,7 +52,9 @@ =20 #include "exec/cpu-defs.h" =20 +#ifdef CONFIG_TCG #include "fpu/softfloat.h" +#endif =20 #define R_EAX 0 #define R_ECX 1 @@ -1598,7 +1600,11 @@ void update_fp_status(CPUX86State *env); =20 static inline uint32_t cpu_compute_eflags(CPUX86State *env) { - return env->eflags | cpu_cc_compute_all(env, CC_OP) | (env->df & DF_MA= SK); + uint32_t eflags =3D env->eflags; + if (tcg_enabled()) { + eflags |=3D cpu_cc_compute_all(env, CC_OP) | (env->df & DF_MASK); + } + return eflags; } =20 /* NOTE: the translator must set DisasContext.cc_op to CC_OP_EFLAGS diff --git a/target/i386/machine.c b/target/i386/machine.c index 53587ae..b78b36c 100644 --- a/target/i386/machine.c +++ b/target/i386/machine.c @@ -280,8 +280,9 @@ static int cpu_post_load(void *opaque, int version_id) for(i =3D 0; i < 8; i++) { env->fptags[i] =3D (env->fptag_vmstate >> i) & 1; } - update_fp_status(env); - + if (tcg_enabled()) { + update_fp_status(env); + } cpu_breakpoint_remove_all(cs, BP_CPU); cpu_watchpoint_remove_all(cs, BP_CPU); { --=20 1.8.3.1