From nobody Fri Apr 4 21:12:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1741377428; cv=none; d=zohomail.com; s=zohoarc; b=QabQM+amE629cMaXI8QTPVTRHRmI/WNgr4yamViXOkplw9tal2Qf42bRtQWfcCEMbNu6VKDV0X5vVTDcSaGvCwsoubcVzt/0QMzI90sqvkHeg0hwk4hF3j1HB4lKHge54Eln2OMQU4mFHoV6OrOwNMcjK2ZDFr/MUX72DvSAnOQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741377428; h=Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=uK+kdzNkKDZrnT0yBwwpB4lvxszopJKdzSxPU5w2DnE=; b=KxSUCH+eR4V7oVSIrTHxRFhYAdvM3vz5UgH0BfJou4dVT9iYlfTJnCtfhiVQMOgtQf+rPzuijk05z19lMk0SfxhqNXVFQslIHR6/e7/VZ3I+VtC8Zj8921732f+Abfy5QTeMmF9X5LPoOTsEHVm9IOvJUePOoUyIRrOD7s2Pehk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1741377428587677.5585261597322; Fri, 7 Mar 2025 11:57:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tqdoA-0008PU-CV; Fri, 07 Mar 2025 14:56:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tqdnO-00080H-Vy for qemu-devel@nongnu.org; Fri, 07 Mar 2025 14:55:48 -0500 Received: from linux.microsoft.com ([13.77.154.182]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tqdnK-0005iv-MC for qemu-devel@nongnu.org; Fri, 07 Mar 2025 14:55:45 -0500 Received: by linux.microsoft.com (Postfix, from userid 1031) id 726772038F42; Fri, 7 Mar 2025 11:55:36 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 726772038F42 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1741377336; bh=uK+kdzNkKDZrnT0yBwwpB4lvxszopJKdzSxPU5w2DnE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tbp6akmfyspzvF33wLjMyhHlwZnFCU1qh+GGsjSlPU2r8X0qbcBaR25Ih/R/msC2e R5/tRA3m5iBdUtrBLrLHb5Z6Kb7AYdmu/Tgh6l3unIpIWUamplLGwu7PvXeiM3mXXM Hy3F0me/qqeY9JLBhRGrSCq3OpjhRon+hOCZtng0= From: Wei Liu To: qemu-devel@nongnu.org Cc: wei.liu@kernel.org, dirty@apple.com, rbolshakov@ddn.com, phil@philjordan.eu, jinankjain@linux.microsoft.com, liuwe@microsoft.com, muislam@microsoft.com, ziqiaozhou@microsoft.com, mukeshrathor@microsoft.com, magnuskulke@microsoft.com, prapal@microsoft.com, jpiotrowski@microsoft.com, deviv@microsoft.com, Wei Liu Subject: [PATCH v2 08/14] target/i386: rename lazy flags field and its type Date: Fri, 7 Mar 2025 11:55:19 -0800 Message-Id: <1741377325-28175-9-git-send-email-liuwe@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1741377325-28175-1-git-send-email-liuwe@linux.microsoft.com> References: <1741377325-28175-1-git-send-email-liuwe@linux.microsoft.com> Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=13.77.154.182; envelope-from=liuwe@linux.microsoft.com; helo=linux.microsoft.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linux.microsoft.com) X-ZM-MESSAGEID: 1741377430181019100 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The same structure and code can be used by other accelerators. Drop the hvf prefix in the type and field name. No functional change. Signed-off-by: Wei Liu --- target/i386/cpu.h | 6 ++-- target/i386/hvf/x86_flags.c | 56 ++++++++++++++++++------------------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/target/i386/cpu.h b/target/i386/cpu.h index cf2bd0e9ada9..04ade00abb3d 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1811,10 +1811,10 @@ typedef struct CPUCaches { CPUCacheInfo *l3_cache; } CPUCaches; =20 -typedef struct HVFX86LazyFlags { +typedef struct X86LazyFlags { target_ulong result; target_ulong auxbits; -} HVFX86LazyFlags; +} X86LazyFlags; =20 typedef struct CPUArchState { /* standard registers */ @@ -2108,7 +2108,7 @@ typedef struct CPUArchState { QemuMutex xen_timers_lock; #endif #if defined(CONFIG_HVF) - HVFX86LazyFlags hvf_lflags; + X86LazyFlags lflags; void *emu_mmio_buf; #endif =20 diff --git a/target/i386/hvf/x86_flags.c b/target/i386/hvf/x86_flags.c index 03d6de5efc3e..3c02c9c5632e 100644 --- a/target/i386/hvf/x86_flags.c +++ b/target/i386/hvf/x86_flags.c @@ -62,7 +62,7 @@ #define SET_FLAGS_OSZAPC_SIZE(size, lf_carries, lf_result) { \ target_ulong temp =3D ((lf_carries) & (LF_MASK_AF)) | \ (((lf_carries) >> (size - 2)) << LF_BIT_PO); \ - env->hvf_lflags.result =3D (target_ulong)(int##size##_t)(lf_result); \ + env->lflags.result =3D (target_ulong)(int##size##_t)(lf_result); \ if ((size) =3D=3D 32) { \ temp =3D ((lf_carries) & ~(LF_MASK_PDB | LF_MASK_SD)); \ } else if ((size) =3D=3D 16) { \ @@ -72,7 +72,7 @@ } else { \ VM_PANIC("unimplemented"); \ } \ - env->hvf_lflags.auxbits =3D (target_ulong)(uint32_t)temp; \ + env->lflags.auxbits =3D (target_ulong)(uint32_t)temp; \ } =20 /* carries, result */ @@ -99,10 +99,10 @@ } else { \ VM_PANIC("unimplemented"); \ } \ - env->hvf_lflags.result =3D (target_ulong)(int##size##_t)(lf_result); \ - target_ulong delta_c =3D (env->hvf_lflags.auxbits ^ temp) & LF_MASK_CF= ; \ + env->lflags.result =3D (target_ulong)(int##size##_t)(lf_result); \ + target_ulong delta_c =3D (env->lflags.auxbits ^ temp) & LF_MASK_CF; \ delta_c ^=3D (delta_c >> 1); \ - env->hvf_lflags.auxbits =3D (target_ulong)(uint32_t)(temp ^ delta_c); \ + env->lflags.auxbits =3D (target_ulong)(uint32_t)(temp ^ delta_c); \ } =20 /* carries, result */ @@ -116,8 +116,8 @@ void SET_FLAGS_OxxxxC(CPUX86State *env, uint32_t new_of, uint32_t new_cf) { uint32_t temp_po =3D new_of ^ new_cf; - env->hvf_lflags.auxbits &=3D ~(LF_MASK_PO | LF_MASK_CF); - env->hvf_lflags.auxbits |=3D (temp_po << LF_BIT_PO) | (new_cf << LF_BI= T_CF); + env->lflags.auxbits &=3D ~(LF_MASK_PO | LF_MASK_CF); + env->lflags.auxbits |=3D (temp_po << LF_BIT_PO) | (new_cf << LF_BIT_CF= ); } =20 void SET_FLAGS_OSZAPC_SUB32(CPUX86State *env, uint32_t v1, uint32_t v2, @@ -213,27 +213,27 @@ void SET_FLAGS_OSZAPC_LOGIC8(CPUX86State *env, uint8_= t v1, uint8_t v2, =20 bool get_PF(CPUX86State *env) { - uint32_t temp =3D (255 & env->hvf_lflags.result); - temp =3D temp ^ (255 & (env->hvf_lflags.auxbits >> LF_BIT_PDB)); + uint32_t temp =3D (255 & env->lflags.result); + temp =3D temp ^ (255 & (env->lflags.auxbits >> LF_BIT_PDB)); temp =3D (temp ^ (temp >> 4)) & 0x0F; return (0x9669U >> temp) & 1; } =20 void set_PF(CPUX86State *env, bool val) { - uint32_t temp =3D (255 & env->hvf_lflags.result) ^ (!val); - env->hvf_lflags.auxbits &=3D ~(LF_MASK_PDB); - env->hvf_lflags.auxbits |=3D (temp << LF_BIT_PDB); + uint32_t temp =3D (255 & env->lflags.result) ^ (!val); + env->lflags.auxbits &=3D ~(LF_MASK_PDB); + env->lflags.auxbits |=3D (temp << LF_BIT_PDB); } =20 bool get_OF(CPUX86State *env) { - return ((env->hvf_lflags.auxbits + (1U << LF_BIT_PO)) >> LF_BIT_CF) & = 1; + return ((env->lflags.auxbits + (1U << LF_BIT_PO)) >> LF_BIT_CF) & 1; } =20 bool get_CF(CPUX86State *env) { - return (env->hvf_lflags.auxbits >> LF_BIT_CF) & 1; + return (env->lflags.auxbits >> LF_BIT_CF) & 1; } =20 void set_OF(CPUX86State *env, bool val) @@ -250,45 +250,45 @@ void set_CF(CPUX86State *env, bool val) =20 bool get_AF(CPUX86State *env) { - return (env->hvf_lflags.auxbits >> LF_BIT_AF) & 1; + return (env->lflags.auxbits >> LF_BIT_AF) & 1; } =20 void set_AF(CPUX86State *env, bool val) { - env->hvf_lflags.auxbits &=3D ~(LF_MASK_AF); - env->hvf_lflags.auxbits |=3D val << LF_BIT_AF; + env->lflags.auxbits &=3D ~(LF_MASK_AF); + env->lflags.auxbits |=3D val << LF_BIT_AF; } =20 bool get_ZF(CPUX86State *env) { - return !env->hvf_lflags.result; + return !env->lflags.result; } =20 void set_ZF(CPUX86State *env, bool val) { if (val) { - env->hvf_lflags.auxbits ^=3D - (((env->hvf_lflags.result >> LF_SIGN_BIT) & 1) << LF_BIT_SD); + env->lflags.auxbits ^=3D + (((env->lflags.result >> LF_SIGN_BIT) & 1) << LF_BIT_SD); /* merge the parity bits into the Parity Delta Byte */ - uint32_t temp_pdb =3D (255 & env->hvf_lflags.result); - env->hvf_lflags.auxbits ^=3D (temp_pdb << LF_BIT_PDB); + uint32_t temp_pdb =3D (255 & env->lflags.result); + env->lflags.auxbits ^=3D (temp_pdb << LF_BIT_PDB); /* now zero the .result value */ - env->hvf_lflags.result =3D 0; + env->lflags.result =3D 0; } else { - env->hvf_lflags.result |=3D (1 << 8); + env->lflags.result |=3D (1 << 8); } } =20 bool get_SF(CPUX86State *env) { - return ((env->hvf_lflags.result >> LF_SIGN_BIT) ^ - (env->hvf_lflags.auxbits >> LF_BIT_SD)) & 1; + return ((env->lflags.result >> LF_SIGN_BIT) ^ + (env->lflags.auxbits >> LF_BIT_SD)) & 1; } =20 void set_SF(CPUX86State *env, bool val) { bool temp_sf =3D get_SF(env); - env->hvf_lflags.auxbits ^=3D (temp_sf ^ val) << LF_BIT_SD; + env->lflags.auxbits ^=3D (temp_sf ^ val) << LF_BIT_SD; } =20 void lflags_to_rflags(CPUX86State *env) @@ -303,7 +303,7 @@ void lflags_to_rflags(CPUX86State *env) =20 void rflags_to_lflags(CPUX86State *env) { - env->hvf_lflags.auxbits =3D env->hvf_lflags.result =3D 0; + env->lflags.auxbits =3D env->lflags.result =3D 0; set_OF(env, env->eflags & CC_O); set_SF(env, env->eflags & CC_S); set_ZF(env, env->eflags & CC_Z); --=20 2.47.2