From nobody Mon Nov 23 04:29:56 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1793527222; cv=none; d=zohomail.com; s=zohoarc; b=Cj1fft1VFfpnOA9hj6rim8IrLZhCWS9L7ys901jDWx+uG4LDgTEuk2Ny3Hu0OP6YVJHqoN74zyM8njxJrsoshXb13kPw4LVKM3kL94YcrL9Ma0WBz9nrJQ9nyCbFftQy4PDv3Qaip7RccZXnj0D5+rhr9xkZT+14/WpLRKtx9zM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793527222; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=G+13MHGxkLuqyCbEbeMYCXfsI+orEiWeW3Xo6ulnYe8=; b=b28xhJnFinmQdD+UloMAKa59kX3bhzibP4+6F8Xl8y/Uu6WvLU35gehbe4bVA6JwFUVR+23QmyhEuluzaSK6rl5Pm0WfBo9iI638O6vx916s3n4da03hVpQ7utq+TXs/VYxZCFKbQPgikc8xYTNimH1lehwGN6LgfVImnYw45yI= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1793527222286448.4819432772489; Sun, 1 Nov 2026 02:00:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xNSLB-0006jL-I6; Sun, 01 Nov 2026 04:59:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xNSL9-0006iQ-Jk for qemu-devel@nongnu.org; Sun, 01 Nov 2026 04:59:03 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xNSL7-0007tR-AD for qemu-devel@nongnu.org; Sun, 01 Nov 2026 04:59:03 -0500 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-222-gpXCOsV7Mcu4y88KNj1V5Q-1; Sun, 01 Nov 2026 04:58:56 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C1C0E180066E; Sun, 1 Nov 2026 09:58:55 +0000 (UTC) Received: from pbonzini-thinkpadx1carbon6th.rmtit.csb (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E00D81800495; Sun, 1 Nov 2026 09:58:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1793527140; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=G+13MHGxkLuqyCbEbeMYCXfsI+orEiWeW3Xo6ulnYe8=; b=VvZz/GpDZSPp18iXsFeeNczA4/MviBsD9wqGkrqxKDXZ3gjpTFb4H+TNJMWK5oEyS1ZeUI 8y8dOoLVOs+6o3HFrVA61ujHG4UacKMMr883t6BZqL0JeSRZ5mUwhM9CgLUuLRCZHnzEUG JiUZsHr+6kZB13HZCmf4qmLmEo6MMUA= X-MC-Unique: gpXCOsV7Mcu4y88KNj1V5Q-1 X-Mimecast-MFC-AGG-ID: gpXCOsV7Mcu4y88KNj1V5Q_1793527136 From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Jiang Yuxuan Subject: [PULL 01/10] target/i386: raise #DE for INT_MIN / -1 in IDIV helpers Date: Sun, 1 Nov 2026 10:58:42 +0100 Message-ID: <20261101095851.1557351-2-pbonzini@redhat.com> In-Reply-To: <20261101095851.1557351-1-pbonzini@redhat.com> References: <20261101095851.1557351-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1793527224023158500 Content-Type: text/plain; charset="utf-8" From: Jiang Yuxuan helper_idivw_AX() and helper_idivl_EAX() perform the division before checking whether the quotient fits in the destination. If the dividend is the minimum value and the divisor is -1, the division overflows in the host: INT32_MIN / -1 and INT64_MIN / -1 are undefined behaviour in C and trap with SIGFPE on x86 hosts. QEMU then dies of a host SIGFPE instead of raising #DE in the guest, taking down the emulator (or the whole VM under TCG). Reject the two overflowing cases before dividing. The 8-bit form is not affected (it widens the dividend to int), and the 64-bit form already checks first. Add a regression test for both the 16-bit and 32-bit forms, run by the i386 and x86_64 linux-user test suites. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/4687 Signed-off-by: fujo Link: https://lore.kernel.org/r/CAAt7E3+jVR+YHZC3996kdC_Xrh9aVJ4YLy8X7+1Hyj= vOQk09Ug@mail.gmail.com Signed-off-by: Paolo Bonzini --- target/i386/tcg/int_helper.c | 4 +- tests/tcg/i386/test-idiv-overflow.c | 70 +++++++++++++++++++++++++++++ tests/tcg/i386/meson.build | 1 + tests/tcg/x86_64/meson.build | 1 + 4 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 tests/tcg/i386/test-idiv-overflow.c diff --git a/target/i386/tcg/int_helper.c b/target/i386/tcg/int_helper.c index 772e6adcc86..d4fa89166b4 100644 --- a/target/i386/tcg/int_helper.c +++ b/target/i386/tcg/int_helper.c @@ -91,7 +91,7 @@ void HELPER(idivw_AX)(CPUX86State *env, target_ulong t0) =20 num =3D (env->regs[R_EAX] & 0xffff) | ((env->regs[R_EDX] & 0xffff) << = 16); den =3D (int16_t)t0; - if (den =3D=3D 0) { + if (den =3D=3D 0 || (num =3D=3D INT32_MIN && den =3D=3D -1)) { raise_exception_ra(env, EXCP00_DIVZ, GETPC()); } q =3D (num / den); @@ -130,7 +130,7 @@ void HELPER(idivl_EAX)(CPUX86State *env, target_ulong t= 0) =20 num =3D ((uint32_t)env->regs[R_EAX]) | ((uint64_t)((uint32_t)env->regs= [R_EDX]) << 32); den =3D t0; - if (den =3D=3D 0) { + if (den =3D=3D 0 || (num =3D=3D INT64_MIN && den =3D=3D -1)) { raise_exception_ra(env, EXCP00_DIVZ, GETPC()); } q =3D (num / den); diff --git a/tests/tcg/i386/test-idiv-overflow.c b/tests/tcg/i386/test-idiv= -overflow.c new file mode 100644 index 00000000000..e8fc55a0481 --- /dev/null +++ b/tests/tcg/i386/test-idiv-overflow.c @@ -0,0 +1,70 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Test that IDIV of the minimum dividend by -1 raises #DE, which Linux + * delivers to the guest as SIGFPE with si_code =3D=3D FPE_INTDIV. + */ +#define _GNU_SOURCE +#include +#include +#include +#include + +static sigjmp_buf idiv_jmp; +static volatile sig_atomic_t idiv_si_code; + +static void idiv_sig_handler(int sig, siginfo_t *info, void *puc) +{ + (void)sig; + (void)puc; + idiv_si_code =3D info->si_code; + siglongjmp(idiv_jmp, 1); +} + +static int check_idiv_overflow(int width) +{ + struct sigaction sa, old; + int ret =3D 1; + + memset(&sa, 0, sizeof(sa)); + sa.sa_sigaction =3D idiv_sig_handler; + sa.sa_flags =3D SA_SIGINFO | SA_NODEFER; + sigemptyset(&sa.sa_mask); + sigaction(SIGFPE, &sa, &old); + + idiv_si_code =3D 0; + if (sigsetjmp(idiv_jmp, 1) =3D=3D 0) { + if (width =3D=3D 16) { + /* DX:AX =3D 0x8000:0x0000, divisor -1 */ + __asm__ volatile ("movl $0x8000, %%edx\n\t" + "xorl %%eax, %%eax\n\t" + "movl $-1, %%ecx\n\t" + "idivw %%cx" + : : : "eax", "ecx", "edx", "cc"); + } else { + /* EDX:EAX =3D 0x80000000:0x00000000, divisor -1 */ + __asm__ volatile ("movl $0x80000000, %%edx\n\t" + "xorl %%eax, %%eax\n\t" + "movl $-1, %%ecx\n\t" + "idivl %%ecx" + : : : "eax", "ecx", "edx", "cc"); + } + printf("FAIL: idiv%d did not raise #DE\n", width); + } else if (idiv_si_code !=3D FPE_INTDIV) { + printf("FAIL: idiv%d raised SIGFPE with si_code %d\n", + width, (int)idiv_si_code); + } else { + ret =3D 0; + } + + sigaction(SIGFPE, &old, NULL); + return ret; +} + +int main(void) +{ + int ret =3D 0; + + ret |=3D check_idiv_overflow(16); + ret |=3D check_idiv_overflow(32); + return ret; +} diff --git a/tests/tcg/i386/meson.build b/tests/tcg/i386/meson.build index e7c30958608..648b516582e 100644 --- a/tests/tcg/i386/meson.build +++ b/tests/tcg/i386/meson.build @@ -35,6 +35,7 @@ tests +=3D { 'cflags': [files('test-i386-code16.S'), files('test-i386-vm86.S'), '-lm', '-fno-pie', '-Wl,--no-warn-rwx-segments'], }, + 'test-idiv-overflow.c': {}, '../multiarch/sha512.c': { 'exe_name': 'sha512-sse', 'cflags': ['-msse4.1', '-O3'], diff --git a/tests/tcg/x86_64/meson.build b/tests/tcg/x86_64/meson.build index ad4d1f558a7..fc7f48e98eb 100644 --- a/tests/tcg/x86_64/meson.build +++ b/tests/tcg/x86_64/meson.build @@ -48,6 +48,7 @@ tests +=3D { }, '../i386/test-i386-adcox.c': {'cflags': ['-O2']}, '../i386/test-i386-bmi2.c': {'cflags': ['-O2', '-fwrapv']}, + '../i386/test-idiv-overflow.c': {}, } =20 tests +=3D { --=20 2.56.0 From nobody Mon Nov 23 04:29:56 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1793527258; cv=none; d=zohomail.com; s=zohoarc; b=TRa96TeGYrXC6eF3zO+I+9Jdq7tuHkvVNN9AoE60WgIdQ4maUogzFtFkbSUzgN8HVRU48lot2ZBWgEdN4266GWDVv6bWrsyAlsjh2fK/+1Fc13BDQBffQA/F7hqNp9ERwhl7olMVQlL3hMtliDXDs5AEjrSakLlcHN9UaRwTuIk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793527258; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=4mVqWofxzxr+R41ROxlFMUfJeczvCtanxN0ktKWM0nA=; b=dDQpcwRiR3dSKSyMCFZle+OzrVLx+HgU9E6PNdgJpYtmr29Srfn0MnkOqEVKYcHSHxK52+tm92lX97lcMbO9hlflYV1k0HeouSnUZhRolectZGbDUZK/PtAOhCVPkHCaRkpUkx0YXWBlkJ8Dk+JR60Pw87hi4lTWDWbf3uUqSPQ= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1793527258440698.6312017609182; Sun, 1 Nov 2026 02:00:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xNSLA-0006ia-L7; Sun, 01 Nov 2026 04:59:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xNSL8-0006hm-8O for qemu-devel@nongnu.org; Sun, 01 Nov 2026 04:59:02 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xNSL6-0007tF-Os for qemu-devel@nongnu.org; Sun, 01 Nov 2026 04:59:01 -0500 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-540-tlYK0KiMN-GJCydjYw6EDQ-1; Sun, 01 Nov 2026 04:58:58 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D7D0B1955F1A for ; Sun, 1 Nov 2026 09:58:56 +0000 (UTC) Received: from pbonzini-thinkpadx1carbon6th.rmtit.csb (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 312561800446 for ; Sun, 1 Nov 2026 09:58:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1793527139; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4mVqWofxzxr+R41ROxlFMUfJeczvCtanxN0ktKWM0nA=; b=MO9oRLf24V5mQwq5tPdDx6u59eKISX1xUR55cRi2Kw9sbqPO7xk+2+nxYMIcO8z+Uf9jFE lBn7aA0MNye7Pzg6KI3dAzQBnJiRoPivUvWjUlNmrdjFWZe7ObXFsdg0BTtWqFHqEOShYV BBa3ymDv20RB2lBgp4DQ0ZBgYfpybR0= X-MC-Unique: tlYK0KiMN-GJCydjYw6EDQ-1 X-Mimecast-MFC-AGG-ID: tlYK0KiMN-GJCydjYw6EDQ_1793527137 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 02/10] target/i386/tcg: change popl_esp_hack to an X86InsnSpecial Date: Sun, 1 Nov 2026 10:58:43 +0100 Message-ID: <20261101095851.1557351-3-pbonzini@redhat.com> In-Reply-To: <20261101095851.1557351-1-pbonzini@redhat.com> References: <20261101095851.1557351-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 5 X-Spam_score: 0.5 X-Spam_bar: / X-Spam_report: (0.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1793527258596158500 Content-Type: text/plain; charset="utf-8" Signed-off-by: Paolo Bonzini --- target/i386/tcg/decode-new.h | 6 ++++++ target/i386/tcg/translate.c | 1 - target/i386/tcg/decode-new.c.inc | 8 +++----- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/target/i386/tcg/decode-new.h b/target/i386/tcg/decode-new.h index 5f76b0c1b7a..a823143bbdf 100644 --- a/target/i386/tcg/decode-new.h +++ b/target/i386/tcg/decode-new.h @@ -242,6 +242,12 @@ typedef enum X86InsnSpecial { =20 /* Memory operand size of MOV from segment register is MO_16 */ X86_SPECIAL_Op0_Mw, + + /* + * If the address uses ESP as the base register, use the value + * of ESP after the pop. + */ + X86_SPECIAL_PopESP, } X86InsnSpecial; =20 /* diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 5199c330ac7..b2cbce046cb 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -108,7 +108,6 @@ typedef struct DisasContext { uint8_t vex_v; /* vex vvvv register, without 1's complement. */ bool vex_ndd; /* is this a 3-operand instruction? */ bool vex_w; /* used by AVX even on 32-bit processors */ - uint8_t popl_esp_hack; /* for correct popl with esp base handling */ uint8_t rip_offset; /* only used in x86_64, but left for simplicity */ =20 uint8_t rex_r; /* 0 for i386, but left for simplicity */ diff --git a/target/i386/tcg/decode-new.c.inc b/target/i386/tcg/decode-new.= c.inc index 3845fab5c85..2756953c744 100644 --- a/target/i386/tcg/decode-new.c.inc +++ b/target/i386/tcg/decode-new.c.inc @@ -1615,8 +1615,7 @@ static void decode_group1A(DisasContext *s, CPUX86Sta= te *env, X86OpEntry *entry, *entry =3D UNKNOWN_OPCODE; } else { entry->gen =3D gen_POP; - /* The address must use the value of ESP after the pop. */ - s->popl_esp_hack =3D 1 << mo_pushpop(s, s->dflag); + entry->special =3D X86_SPECIAL_PopESP; } } =20 @@ -2360,8 +2359,8 @@ static void decode_modrm(DisasContext *s, CPUX86State= *env, } =20 /* For correct popl handling with esp. */ - if (base =3D=3D R_ESP && s->popl_esp_hack) { - disp +=3D s->popl_esp_hack; + if (base =3D=3D R_ESP && decode->e.special =3D=3D X86_SPECIAL_PopE= SP) { + disp +=3D 1 << mo_pushpop(s, s->dflag); } if (base =3D=3D R_EBP || base =3D=3D R_ESP) { def_seg =3D R_SS; @@ -3287,7 +3286,6 @@ static void disas_insn(DisasContext *s, CPUState *cpu) =20 s->pc =3D s->base.pc_next; s->override =3D -1; - s->popl_esp_hack =3D 0; #ifdef TARGET_X86_64 s->rex_r =3D 0; s->rex_x =3D 0; --=20 2.56.0 From nobody Mon Nov 23 04:29:56 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1793527237; cv=none; d=zohomail.com; s=zohoarc; b=SpAo93MnRXqqwPJxi9lROMsLClkC8/tTEIYJR95c66eUek+fw+J3E/DcCi30j3f/sCWNYyB2Tv1g1VxXNolU/yxm+gOp1QopPEeQxSaiW5mBus9UdgXYFfoVgmmeAo3PcxZIa5smQIDpmFpHVJPzg0TGPm54rjBKAq+yWhiGmiI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793527237; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=MXlMczLzvRR9ZND8zGlwgX4KpmxI/vZ9RId1nS5XNPs=; b=awVXcvvo0b1phk56db0SzokhnbVyXDjrOf6QzjY8Oyhrf4z6+qrZY5Yb3TSK7FOROvmEGk1jVeN8lQqILFh+0brmztK4/mSj7HEBKwNUdkmN4JLBWBS4D2vBAnLxepS+eLdKpQNzSoSyH+oK0Cp4BWPuFnF5x2FPAeseLKDw0zQ= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1793527237772546.4655571522204; Sun, 1 Nov 2026 02:00:37 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xNSLA-0006il-R0; Sun, 01 Nov 2026 04:59:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xNSL9-0006iH-7d for qemu-devel@nongnu.org; Sun, 01 Nov 2026 04:59:03 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xNSL7-0007tM-2M for qemu-devel@nongnu.org; Sun, 01 Nov 2026 04:59:03 -0500 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-407-JD_hLogGN-yl2m8O0glXkA-1; Sun, 01 Nov 2026 04:58:58 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EC2C81955F37 for ; Sun, 1 Nov 2026 09:58:57 +0000 (UTC) Received: from pbonzini-thinkpadx1carbon6th.rmtit.csb (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 462C01800446 for ; Sun, 1 Nov 2026 09:58:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1793527140; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MXlMczLzvRR9ZND8zGlwgX4KpmxI/vZ9RId1nS5XNPs=; b=KsqCU5F//XVQSIm4GWgLt+EsAqOmovez2H9+TIu/4VO1Hp5+2zW0EYobCKNNNkNmMeyRGB STbGmg2wN761Glz2HPV3GFq/cYCs2ENz9NHNPL+vAchhr0hupGJWZ+4uHJm6jZXO7kWhm6 YuxyCdmnAMD0Udn7g7vdf42yH/eraB8= X-MC-Unique: JD_hLogGN-yl2m8O0glXkA-1 X-Mimecast-MFC-AGG-ID: JD_hLogGN-yl2m8O0glXkA_1793527138 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 03/10] target/i386/tcg: inline gen_leave Date: Sun, 1 Nov 2026 10:58:44 +0100 Message-ID: <20261101095851.1557351-4-pbonzini@redhat.com> In-Reply-To: <20261101095851.1557351-1-pbonzini@redhat.com> References: <20261101095851.1557351-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 5 X-Spam_score: 0.5 X-Spam_bar: / X-Spam_report: (0.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1793527238286158500 Content-Type: text/plain; charset="utf-8" The function is a vestige of the old switch-based decoder and does not add anything these days. Signed-off-by: Paolo Bonzini --- target/i386/tcg/translate.c | 14 -------------- target/i386/tcg/emit.c.inc | 11 ++++++++++- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index b2cbce046cb..3d542acd975 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -2005,20 +2005,6 @@ static void gen_enter(DisasContext *s, int esp_adden= d, int level) gen_op_mov_reg_v(s, a_ot, R_ESP, s->T1); } =20 -static void gen_leave(DisasContext *s) -{ - MemOp d_ot =3D mo_pushpop(s, s->dflag); - MemOp a_ot =3D mo_stacksize(s); - - gen_lea_ss_ofs(s, s->A0, cpu_regs[R_EBP], 0); - gen_op_ld_v(s, d_ot, s->T0, s->A0); - - tcg_gen_addi_tl(s->T1, cpu_regs[R_EBP], 1 << d_ot); - - gen_op_mov_reg_v(s, d_ot, R_EBP, s->T0); - gen_op_mov_reg_v(s, a_ot, R_ESP, s->T1); -} - /* an interrupt is different from an exception because of the privilege checks */ static void gen_interrupt(DisasContext *s, uint8_t intno) diff --git a/target/i386/tcg/emit.c.inc b/target/i386/tcg/emit.c.inc index ed56edf8a3a..a1ae5821746 100644 --- a/target/i386/tcg/emit.c.inc +++ b/target/i386/tcg/emit.c.inc @@ -2559,7 +2559,16 @@ static void gen_LEA(DisasContext *s, X86DecodedInsn = *decode) =20 static void gen_LEAVE(DisasContext *s, X86DecodedInsn *decode) { - gen_leave(s); + MemOp d_ot =3D mo_pushpop(s, s->dflag); + MemOp a_ot =3D mo_stacksize(s); + + gen_lea_ss_ofs(s, s->A0, cpu_regs[R_EBP], 0); + gen_op_ld_v(s, d_ot, s->T0, s->A0); + + tcg_gen_addi_tl(s->T1, cpu_regs[R_EBP], 1 << d_ot); + + gen_op_mov_reg_v(s, d_ot, R_EBP, s->T0); + gen_op_mov_reg_v(s, a_ot, R_ESP, s->T1); } =20 static void gen_LES(DisasContext *s, X86DecodedInsn *decode) --=20 2.56.0 From nobody Mon Nov 23 04:29:56 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1793527220; cv=none; d=zohomail.com; s=zohoarc; b=bFdarS6mMM7ft5hi43IUqWDrLKjhdj/j6C+DAg+LebZ9wr5RuHj08suo7wApxE0foUVIpH4wCraZAgKEPZrgLpz6YiTzqBWiLWkM1uVLgKDA+rnEwJtkPw5Ew+qqTpg/FPBbJdhrqXEh7xIF1wRwlbXehBl0VBW4kOYntl9Y59Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793527220; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=NDGIVjlcjalBdZgH4OhsxYmbKmXTHW0DzsQJ/j869F4=; b=geD62Xgop9UcFZvrQdHuU2JHIJ73ssGO9PGZqHvVaKnHuj1vswRm5SbxYDzX7//quNA2q6gGBtArXWnSLcd6OHthXGXcLWlYIhobHnU2gNBBKvfQRv1MomTL+g7YFiqGvtpFhX+nwH7u3Xsp/s0lB84xFw7BV8vueSLkqEAv8fU= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1793527220912795.204599855609; Sun, 1 Nov 2026 02:00:20 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xNSLD-0006kX-ED; Sun, 01 Nov 2026 04:59:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xNSLB-0006j1-22 for qemu-devel@nongnu.org; Sun, 01 Nov 2026 04:59:05 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xNSL9-0007tu-IQ for qemu-devel@nongnu.org; Sun, 01 Nov 2026 04:59:04 -0500 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-240-6QJQWiLHOPiPzSQpEmrleQ-1; Sun, 01 Nov 2026 04:59:00 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3F2981801339; Sun, 1 Nov 2026 09:58:59 +0000 (UTC) Received: from pbonzini-thinkpadx1carbon6th.rmtit.csb (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5AE441800446; Sun, 1 Nov 2026 09:58:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1793527143; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NDGIVjlcjalBdZgH4OhsxYmbKmXTHW0DzsQJ/j869F4=; b=cljZxV7PnG+r808q7gRORKtIWkZwXyWe3jg73S9ZxFE1ZTggc/qBj8z443G0/6ixFvnYfX rvsVogzvJpuqJyG+PB9fwPR2jpH9OBwh4nacCyD65d+Hit00yMLGTmhRX9V66RqOFhUwiF +1pk/rE2r2+8CM4T6kX0XsBYXPqT+bE= X-MC-Unique: 6QJQWiLHOPiPzSQpEmrleQ-1 X-Mimecast-MFC-AGG-ID: 6QJQWiLHOPiPzSQpEmrleQ_1793527139 From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org Subject: [PULL 04/10] target/i386/tcg: reject VEX.NP for MMX instructions Date: Sun, 1 Nov 2026 10:58:45 +0100 Message-ID: <20261101095851.1557351-5-pbonzini@redhat.com> In-Reply-To: <20261101095851.1557351-1-pbonzini@redhat.com> References: <20261101095851.1557351-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1793527221889158500 Content-Type: text/plain; charset="utf-8" MMX instructions do not have a VEX encoding, so reject VEX instructions with no prefix for instructions that use X86_SPECIAL_MMX. Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini --- target/i386/tcg/decode-new.c.inc | 33 +++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/target/i386/tcg/decode-new.c.inc b/target/i386/tcg/decode-new.= c.inc index 2756953c744..65fd402c17f 100644 --- a/target/i386/tcg/decode-new.c.inc +++ b/target/i386/tcg/decode-new.c.inc @@ -2425,6 +2425,12 @@ static void decode_modrm(DisasContext *s, CPUX86Stat= e *env, decode->mem =3D (AddressParts){ def_seg, base, index, scale, disp }; } =20 +static bool is_mmx(const DisasContext *s, const X86OpEntry *e) +{ + return (e->special =3D=3D X86_SPECIAL_MMX && + !(s->prefix & (PREFIX_REPZ | PREFIX_REPNZ | PREFIX_DATA))); +} + static bool decode_op_size(DisasContext *s, X86OpEntry *e, X86OpSize size,= MemOp *ot) { switch (size) { @@ -2470,8 +2476,7 @@ static bool decode_op_size(DisasContext *s, X86OpEntr= y *e, X86OpSize size, MemOp return true; =20 case X86_SIZE_dq: /* SSE/AVX 128-bit */ - if (e->special =3D=3D X86_SPECIAL_MMX && - !(s->prefix & (PREFIX_DATA | PREFIX_REPZ | PREFIX_REPNZ))) { + if (is_mmx(s, e)) { *ot =3D MO_64; return true; } @@ -2489,8 +2494,7 @@ static bool decode_op_size(DisasContext *s, X86OpEntr= y *e, X86OpSize size, MemOp return true; =20 case X86_SIZE_x: /* 128/256-bit, based on operand size */ - if (e->special =3D=3D X86_SPECIAL_MMX && - !(s->prefix & (PREFIX_DATA | PREFIX_REPZ | PREFIX_REPNZ))) { + if (is_mmx(s, e)) { *ot =3D MO_64; return true; } @@ -2605,8 +2609,7 @@ static bool decode_op(DisasContext *s, CPUX86State *e= nv, X86DecodedInsn *decode, goto get_reg; =20 case X86_TYPE_V: /* reg in the modrm byte selects an XMM/YMM register= */ - if (decode->e.special =3D=3D X86_SPECIAL_MMX && - !(s->prefix & (PREFIX_DATA | PREFIX_REPZ | PREFIX_REPNZ))) { + if (is_mmx(s, &decode->e)) { op->unit =3D X86_OP_MMX; } else { op->unit =3D X86_OP_SSE; @@ -2625,8 +2628,7 @@ static bool decode_op(DisasContext *s, CPUX86State *e= nv, X86DecodedInsn *decode, goto get_modrm; =20 case X86_TYPE_W: /* XMM/YMM modrm operand */ - if (decode->e.special =3D=3D X86_SPECIAL_MMX && - !(s->prefix & (PREFIX_DATA | PREFIX_REPZ | PREFIX_REPNZ))) { + if (is_mmx(s, &decode->e)) { op->unit =3D X86_OP_MMX; } else { op->unit =3D X86_OP_SSE; @@ -2638,8 +2640,7 @@ static bool decode_op(DisasContext *s, CPUX86State *e= nv, X86DecodedInsn *decode, goto get_modrm_reg; =20 case X86_TYPE_U: /* R/M in the modrm byte selects an XMM/YMM register= */ - if (decode->e.special =3D=3D X86_SPECIAL_MMX && - !(s->prefix & (PREFIX_DATA | PREFIX_REPZ | PREFIX_REPNZ))) { + if (is_mmx(s, &decode->e)) { op->unit =3D X86_OP_MMX; } else { op->unit =3D X86_OP_SSE; @@ -3135,12 +3136,15 @@ static bool validate_vex(DisasContext *s, X86Decode= dInsn *decode) case 4: case 5: case 7: - if (s->prefix & PREFIX_VEX) { + if (is_mmx(s, e)) { + if (s->prefix & PREFIX_VEX) { + goto illegal; + } + } else if (s->prefix & PREFIX_VEX) { if (!(s->flags & HF_AVX_EN_MASK)) { goto illegal; } - } else if (e->special !=3D X86_SPECIAL_MMX || - (s->prefix & (PREFIX_REPZ | PREFIX_REPNZ | PREFIX_DATA)= )) { + } else { if (!(s->flags & HF_OSFXSR_MASK)) { goto illegal; } @@ -3694,8 +3698,7 @@ static void disas_insn(DisasContext *s, CPUState *cpu) } } =20 - if (decode.e.special =3D=3D X86_SPECIAL_MMX && - !(s->prefix & (PREFIX_REPZ | PREFIX_REPNZ | PREFIX_DATA))) { + if (is_mmx(s, &decode.e)) { gen_helper_enter_mmx(tcg_env); } =20 --=20 2.56.0 From nobody Mon Nov 23 04:29:56 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1793527234; cv=none; d=zohomail.com; s=zohoarc; b=KgvZDgqtzMgfdhJz9nyjBk3jFVhQAXLxh37mTjmyd0GS+giTSHJHCQU7CLpNCbN+u/MMDTVagAHWPRiMIW5oyteGCQQgFSqI78yz7WoN07gXhof0Xxt7XtQthNRm8lB4tpIiN0lNtu2cIyrE7hxjseb7yAQQe4Bmn/XPpeQNqpo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793527234; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=pV2cH+Hiysbru3LIBetZGwlKrZ52MuYj2AbIed9flcw=; b=Ig8lSsDc2rFq9GAT5Z6VTp1C3L8oLO3iPXyXXu8zSGtmX9U5QuSw3oAbv/SGEt1Ub1J6/07ce8elx3f6r/iR8kn+aveWKc5J0Nkzy0wzUqqYm8yUQZmhjzIG62ICN0vj7BYelutfiZMWlsJeh/5CBkDY8FJhktFfFmLx4K3DrUg= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1793527234957370.96109076294715; Sun, 1 Nov 2026 02:00:34 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xNSLD-0006kE-1W; Sun, 01 Nov 2026 04:59:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xNSLB-0006jD-CC for qemu-devel@nongnu.org; Sun, 01 Nov 2026 04:59:05 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xNSL9-0007tr-Gr for qemu-devel@nongnu.org; Sun, 01 Nov 2026 04:59:05 -0500 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-582-TckEZAeMPTyfOKia5RF7Zg-1; Sun, 01 Nov 2026 04:59:01 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5390B19560AF for ; Sun, 1 Nov 2026 09:59:00 +0000 (UTC) Received: from pbonzini-thinkpadx1carbon6th.rmtit.csb (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A1A401800495 for ; Sun, 1 Nov 2026 09:58:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1793527143; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pV2cH+Hiysbru3LIBetZGwlKrZ52MuYj2AbIed9flcw=; b=LaST+s4MBPIOVQWQGVfR+euwL6uUkPn0Z3+IX+EMpwD+DQeMlgKzIxkUOlrEDsILcW4SrD msDhU2+fHFtc+b7ObNcAbkzkEDI9nobSplnJhewzti7S8mLI/1tL7Jnf2eiW0kuAVsa6sr kMQ7a64fvXyYwAZB1UyvRhrT9bB/SNA= X-MC-Unique: TckEZAeMPTyfOKia5RF7Zg-1 X-Mimecast-MFC-AGG-ID: TckEZAeMPTyfOKia5RF7Zg_1793527140 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 05/10] target/i386/tcg: remove X and Y operand types Date: Sun, 1 Nov 2026 10:58:46 +0100 Message-ID: <20261101095851.1557351-6-pbonzini@redhat.com> In-Reply-To: <20261101095851.1557351-1-pbonzini@redhat.com> References: <20261101095851.1557351-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 5 X-Spam_score: 0.5 X-Spam_bar: / X-Spam_report: (0.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1793527236301158500 Content-Type: text/plain; charset="utf-8" Since the Intel SDM is moving away from operand types, remove more of the implicit types; X and Y are meant for string instructions but the DS:SI and ES:DI addressing modes are handled entirely in the generator functions; the operands were just placeholders to distinguish byte string operations from s->dflag string operations. Note that this moves the port for INS and OUTS from s->T1 to s->T0. This frees up some operand letters that could be useful in the future, for example to allocate K/X/Y to mask registers in the same guise as H/V/W for AVX. Signed-off-by: Paolo Bonzini --- target/i386/tcg/decode-new.h | 2 -- target/i386/tcg/translate.c | 6 ++++++ target/i386/tcg/decode-new.c.inc | 30 ++++++++++++++---------------- target/i386/tcg/emit.c.inc | 18 +++++++++--------- 4 files changed, 29 insertions(+), 27 deletions(-) diff --git a/target/i386/tcg/decode-new.h b/target/i386/tcg/decode-new.h index a823143bbdf..2218a4eda3a 100644 --- a/target/i386/tcg/decode-new.h +++ b/target/i386/tcg/decode-new.h @@ -41,8 +41,6 @@ typedef enum X86OpType { X86_TYPE_U, /* R/M in the modrm byte selects an XMM/YMM register */ X86_TYPE_V, /* reg in the modrm byte selects an XMM/YMM register */ X86_TYPE_W, /* XMM/YMM modrm operand */ - X86_TYPE_X, /* string source */ - X86_TYPE_Y, /* string destination */ =20 /* Custom */ X86_TYPE_EM, /* modrm byte selects an ALU memory operand */ diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 3d542acd975..b715921c379 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -403,6 +403,12 @@ static inline bool byte_reg_is_xH(DisasContext *s, int= reg) return true; } =20 +/* Select the size of an INS/OUTS operation ("z" operand size). */ +static inline MemOp mo_ins_outs(DisasContext *s) +{ + return s->dflag =3D=3D MO_16 ? MO_16 : MO_32; +} + /* Select the size of a push/pop operation. */ static inline MemOp mo_pushpop(DisasContext *s, MemOp ot) { diff --git a/target/i386/tcg/decode-new.c.inc b/target/i386/tcg/decode-new.= c.inc index 65fd402c17f..7e5ece380af 100644 --- a/target/i386/tcg/decode-new.c.inc +++ b/target/i386/tcg/decode-new.c.inc @@ -1810,10 +1810,10 @@ static const X86OpEntry opcodes_root[256] =3D { [0xA1] =3D X86_OP_ENTRY3(MOV, 0,v, O,v, None, None), /* rAX, Ov */ [0xA2] =3D X86_OP_ENTRY3(MOV, O,b, 0,b, None, None), /* Ob, AL */ [0xA3] =3D X86_OP_ENTRY3(MOV, O,v, 0,v, None, None), /* Ov, rAX */ - [0xA4] =3D X86_OP_ENTRYrr(MOVS, Y,b, X,b), - [0xA5] =3D X86_OP_ENTRYrr(MOVS, Y,v, X,v), - [0xA6] =3D X86_OP_ENTRYrr(CMPS, Y,b, X,b), - [0xA7] =3D X86_OP_ENTRYrr(CMPS, Y,v, X,v), + [0xA4] =3D X86_OP_ENTRY0(MOVS), + [0xA5] =3D X86_OP_ENTRY0(MOVS), + [0xA6] =3D X86_OP_ENTRY0(CMPS), + [0xA7] =3D X86_OP_ENTRY0(CMPS), =20 [0xB0] =3D X86_OP_ENTRY3(MOV, LoBits,b, I,b, None, None), [0xB1] =3D X86_OP_ENTRY3(MOV, LoBits,b, I,b, None, None), @@ -1916,10 +1916,10 @@ static const X86OpEntry opcodes_root[256] =3D { [0x69] =3D X86_OP_ENTRY3(IMUL3, G,v, E,v, I,z, sextT0), [0x6A] =3D X86_OP_ENTRYr(PUSH, I,b), [0x6B] =3D X86_OP_ENTRY3(IMUL3, G,v, E,v, I,b, sextT0), - [0x6C] =3D X86_OP_ENTRYrr(INS, Y,b, 2,w), /* DX */ - [0x6D] =3D X86_OP_ENTRYrr(INS, Y,z, 2,w), /* DX */ - [0x6E] =3D X86_OP_ENTRYrr(OUTS, X,b, 2,w), /* DX */ - [0x6F] =3D X86_OP_ENTRYrr(OUTS, X,z, 2,w), /* DX */ + [0x6C] =3D X86_OP_ENTRYr(INS, 2,w), /* DX */ + [0x6D] =3D X86_OP_ENTRYr(INS, 2,w), /* DX */ + [0x6E] =3D X86_OP_ENTRYr(OUTS, 2,w), /* DX */ + [0x6F] =3D X86_OP_ENTRYr(OUTS, 2,w), /* DX */ =20 [0x78] =3D X86_OP_ENTRYr(Jcc, J,b), [0x79] =3D X86_OP_ENTRYr(Jcc, J,b), @@ -1951,13 +1951,13 @@ static const X86OpEntry opcodes_root[256] =3D { =20 [0xA8] =3D X86_OP_ENTRYrr(TEST, 0,b, I,b), /* AL, Ib */ [0xA9] =3D X86_OP_ENTRYrr(TEST, 0,v, I,z), /* rAX, Iz */ - [0xAA] =3D X86_OP_ENTRYwr(STOS, Y,b, 0,b), - [0xAB] =3D X86_OP_ENTRYwr(STOS, Y,v, 0,v), + [0xAA] =3D X86_OP_ENTRYr(STOS, 0,b), + [0xAB] =3D X86_OP_ENTRYr(STOS, 0,v), /* Manual writeback because REP LODS (!) has to write EAX/RAX after ev= ery LODS. */ - [0xAC] =3D X86_OP_ENTRYr(LODS, X,b), - [0xAD] =3D X86_OP_ENTRYr(LODS, X,v), - [0xAE] =3D X86_OP_ENTRYrr(SCAS, 0,b, Y,b), - [0xAF] =3D X86_OP_ENTRYrr(SCAS, 0,v, Y,v), + [0xAC] =3D X86_OP_ENTRY0(LODS), + [0xAD] =3D X86_OP_ENTRY0(LODS), + [0xAE] =3D X86_OP_ENTRYr(SCAS, 0,b), + [0xAF] =3D X86_OP_ENTRYr(SCAS, 0,v), =20 [0xB8] =3D X86_OP_ENTRYwr(MOV, LoBits,v, I,v), [0xB9] =3D X86_OP_ENTRYwr(MOV, LoBits,v, I,v), @@ -2552,8 +2552,6 @@ static bool decode_op(DisasContext *s, CPUX86State *e= nv, X86DecodedInsn *decode, switch (type) { case X86_TYPE_None: /* Implicit or absent */ case X86_TYPE_F: /* EFLAGS/RFLAGS */ - case X86_TYPE_X: /* string source */ - case X86_TYPE_Y: /* string destination */ break; =20 case X86_TYPE_B: /* VEX.vvvv selects a GPR, else use modrm */ diff --git a/target/i386/tcg/emit.c.inc b/target/i386/tcg/emit.c.inc index a1ae5821746..5754f3dcc8b 100644 --- a/target/i386/tcg/emit.c.inc +++ b/target/i386/tcg/emit.c.inc @@ -1923,7 +1923,7 @@ static void gen_CMPccXADD(DisasContext *s, X86Decoded= Insn *decode) =20 static void gen_CMPS(DisasContext *s, X86DecodedInsn *decode) { - MemOp ot =3D decode->op[2].ot; + MemOp ot =3D decode->b & 1 ? s->dflag : MO_8; gen_repz_nz(s, ot, gen_cmps); } =20 @@ -2388,10 +2388,10 @@ static void gen_INC(DisasContext *s, X86DecodedInsn= *decode) =20 static void gen_INS(DisasContext *s, X86DecodedInsn *decode) { - MemOp ot =3D decode->op[1].ot; + MemOp ot =3D decode->b & 1 ? mo_ins_outs(s) : MO_8; TCGv_i32 port =3D tcg_temp_new_i32(); =20 - tcg_gen_trunc_tl_i32(port, s->T1); + tcg_gen_trunc_tl_i32(port, s->T0); tcg_gen_ext16u_i32(port, port); if (!gen_check_io(s, ot, port, SVM_IOIO_TYPE_MASK | SVM_IOIO_STR_MASK)) { @@ -2593,7 +2593,7 @@ static void gen_LGS(DisasContext *s, X86DecodedInsn *= decode) =20 static void gen_LODS(DisasContext *s, X86DecodedInsn *decode) { - MemOp ot =3D decode->op[1].ot; + MemOp ot =3D decode->b & 1 ? s->dflag : MO_8; gen_repz(s, ot, gen_lods); } =20 @@ -2803,7 +2803,7 @@ static void gen_MOVq_dq(DisasContext *s, X86DecodedIn= sn *decode) =20 static void gen_MOVS(DisasContext *s, X86DecodedInsn *decode) { - MemOp ot =3D decode->op[2].ot; + MemOp ot =3D decode->b & 1 ? s->dflag : MO_8; gen_repz(s, ot, gen_movs); } =20 @@ -2960,10 +2960,10 @@ static void gen_OUT(DisasContext *s, X86DecodedInsn= *decode) =20 static void gen_OUTS(DisasContext *s, X86DecodedInsn *decode) { - MemOp ot =3D decode->op[1].ot; + MemOp ot =3D decode->b & 1 ? mo_ins_outs(s) : MO_8; TCGv_i32 port =3D tcg_temp_new_i32(); =20 - tcg_gen_trunc_tl_i32(port, s->T1); + tcg_gen_trunc_tl_i32(port, s->T0); tcg_gen_ext16u_i32(port, port); if (!gen_check_io(s, ot, port, SVM_IOIO_STR_MASK)) { return; @@ -4128,7 +4128,7 @@ static void gen_SBB(DisasContext *s, X86DecodedInsn *= decode) =20 static void gen_SCAS(DisasContext *s, X86DecodedInsn *decode) { - MemOp ot =3D decode->op[2].ot; + MemOp ot =3D decode->b & 1 ? s->dflag : MO_8; gen_repz_nz(s, ot, gen_scas); } =20 @@ -4332,7 +4332,7 @@ static void gen_STMXCSR(DisasContext *s, X86DecodedIn= sn *decode) =20 static void gen_STOS(DisasContext *s, X86DecodedInsn *decode) { - MemOp ot =3D decode->op[1].ot; + MemOp ot =3D decode->b & 1 ? s->dflag : MO_8; gen_repz(s, ot, gen_stos); } =20 --=20 2.56.0 From nobody Mon Nov 23 04:29:56 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1793527200; cv=none; d=zohomail.com; s=zohoarc; b=GZ0duUo1gxc8EoLiFSLZnvZbfW+Kl7r/sMNl8L/WvUkITPEJm0PbYJMfpJR3COKxPBJQVjDhp2df16ONQ4NZNIg1tOj9Qec+RpKJmn2aRqhNs7z60Hpc6zvy6/VAtzBEZx2dn4hN8FPGbD/nkh3ImQ2ty0K7EomqP3/UbalLOhs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793527200; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=xCUs/R5bet8njpUuEqDFyirdEGdUr7g+KQVWtZfkcLQ=; b=mtUO6IxgcOWAEOHfOpvMhXS18dfh9N8Rnqe5f0bLNFt/oWQM7OHwSHBmwD7KYO9eI+e47UueXYf/0eeRE/2oYMQiGlGpseukw4tE0dpbxhcMhtVbdr5JYUeWcftD14v0iPZ+MDkAiycyU8SCyIFjebkwrJ4mM3MGSjFOzr1Q5gM= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1793527200517695.4084533817415; Sun, 1 Nov 2026 02:00:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xNSLG-0006lP-8e; Sun, 01 Nov 2026 04:59:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xNSLB-0006jm-NX for qemu-devel@nongnu.org; Sun, 01 Nov 2026 04:59:05 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xNSLA-0007u9-7T for qemu-devel@nongnu.org; Sun, 01 Nov 2026 04:59:05 -0500 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-290-0h4kLKuOOXKR3VyShgxXvA-1; Sun, 01 Nov 2026 04:59:02 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 69A8F1955F1A for ; Sun, 1 Nov 2026 09:59:01 +0000 (UTC) Received: from pbonzini-thinkpadx1carbon6th.rmtit.csb (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B7DED1800446 for ; Sun, 1 Nov 2026 09:59:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1793527143; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xCUs/R5bet8njpUuEqDFyirdEGdUr7g+KQVWtZfkcLQ=; b=GE00wWRT9fxquBH4asUiL6YhIjhO57XUDzPY5bT9NJ1i37L4i9r9PAuuUw3XK+s4SbS9nL U86PtSF/CjnjSQPp6q5WgFuE1LPxK3u5MwisAlnHetjFMDJDB+UKH24g3ewSWgPjyoksf3 j7Gjd5udwtljOZmz+hTPVux+f+21drU= X-MC-Unique: 0h4kLKuOOXKR3VyShgxXvA-1 X-Mimecast-MFC-AGG-ID: 0h4kLKuOOXKR3VyShgxXvA_1793527141 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 06/10] target/i386/tcg: remove F operand type Date: Sun, 1 Nov 2026 10:58:47 +0100 Message-ID: <20261101095851.1557351-7-pbonzini@redhat.com> In-Reply-To: <20261101095851.1557351-1-pbonzini@redhat.com> References: <20261101095851.1557351-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 5 X-Spam_score: 0.5 X-Spam_bar: / X-Spam_report: (0.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1793527203858158500 Content-Type: text/plain; charset="utf-8" Signed-off-by: Paolo Bonzini --- target/i386/tcg/decode-new.h | 1 - target/i386/tcg/decode-new.c.inc | 1 - 2 files changed, 2 deletions(-) diff --git a/target/i386/tcg/decode-new.h b/target/i386/tcg/decode-new.h index 2218a4eda3a..b40c75fa222 100644 --- a/target/i386/tcg/decode-new.h +++ b/target/i386/tcg/decode-new.h @@ -26,7 +26,6 @@ typedef enum X86OpType { X86_TYPE_C, /* REG in the modrm byte selects a control register */ X86_TYPE_D, /* REG in the modrm byte selects a debug register */ X86_TYPE_E, /* ALU modrm operand */ - X86_TYPE_F, /* EFLAGS/RFLAGS */ X86_TYPE_G, /* REG in the modrm byte selects a GPR */ X86_TYPE_H, /* For AVX, VEX.vvvv selects an XMM/YMM register */ X86_TYPE_I, /* Immediate */ diff --git a/target/i386/tcg/decode-new.c.inc b/target/i386/tcg/decode-new.= c.inc index 7e5ece380af..aa22014786f 100644 --- a/target/i386/tcg/decode-new.c.inc +++ b/target/i386/tcg/decode-new.c.inc @@ -2551,7 +2551,6 @@ static bool decode_op(DisasContext *s, CPUX86State *e= nv, X86DecodedInsn *decode, { switch (type) { case X86_TYPE_None: /* Implicit or absent */ - case X86_TYPE_F: /* EFLAGS/RFLAGS */ break; =20 case X86_TYPE_B: /* VEX.vvvv selects a GPR, else use modrm */ --=20 2.56.0 From nobody Mon Nov 23 04:29:56 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1793527203; cv=none; d=zohomail.com; s=zohoarc; b=ceZ7IJlnq7nv0I1eOeu3uzcBKM8TVoI4mwi0+4fNuLg1G2NKeMHRNtSP218Zl5tKBlE/3OU/1SIJ9JLaUuP93HcmHiuTq+jb2fmWgFzgBiWJ+KZB2XFOinFtsM5B/qLPtgpppVRkwBaw6qQFn5ofr6A9OcwCHv4yU9PQ3GM8Dsc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793527203; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=mKsDoz6FDs4HuMiXZZhTGD7lLZZeoLjA136HD/MQwmo=; b=lLcUIXIxnqm/FiQpK+XwHJgZNi4SFgDSnYJQFUkPFXdzarkCc69MpmH80N8n/7daFLvWClivGlJAl6K56hgjM6+g/AQwAX8Za/tzjjasgnFb7gJ0JHbMW/h8/eQveS6RQMB9hFXaou7WUPwkqY6uGvBAIK1nox3yrLB0zLkM8i4= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1793527203400950.3954036594247; Sun, 1 Nov 2026 02:00:03 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xNSLE-0006kt-Rh; Sun, 01 Nov 2026 04:59:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xNSLD-0006kj-IS for qemu-devel@nongnu.org; Sun, 01 Nov 2026 04:59:07 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xNSLC-0007uW-6i for qemu-devel@nongnu.org; Sun, 01 Nov 2026 04:59:07 -0500 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-451-RnnsVZ1gPS2IpQ5gf5dDHA-1; Sun, 01 Nov 2026 04:59:03 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 01FE119560AF; Sun, 1 Nov 2026 09:59:03 +0000 (UTC) Received: from pbonzini-thinkpadx1carbon6th.rmtit.csb (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CD0A11800495; Sun, 1 Nov 2026 09:59:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1793527145; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mKsDoz6FDs4HuMiXZZhTGD7lLZZeoLjA136HD/MQwmo=; b=b3CWG1Ka6dGFM47mrN/KJ2ZI8f7d+DVx7Yh9TLDquTYXcZs1cc7z8iedvz3edNeZUQ2B9c tRKK976fBRCDJS9eSBBHb0eI0PjQee/5rDZDYTTbVUN3ouWBuZtVkUmh6o6xh0JGkOGbII eqfnjcFONkC7xckaXwvkW1OO/t8sQhI= X-MC-Unique: RnnsVZ1gPS2IpQ5gf5dDHA-1 X-Mimecast-MFC-AGG-ID: RnnsVZ1gPS2IpQ5gf5dDHA_1793527143 From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PULL 07/10] AGENTS.md: add final instructions Date: Sun, 1 Nov 2026 10:58:48 +0100 Message-ID: <20261101095851.1557351-8-pbonzini@redhat.com> In-Reply-To: <20261101095851.1557351-1-pbonzini@redhat.com> References: <20261101095851.1557351-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 5 X-Spam_score: 0.5 X-Spam_bar: / X-Spam_report: (0.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1793527205772158500 Based on GStreamer, applies to both the old and new policy (and can be dropped independently, too). Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Daniel P. Berrang=C3=A9 Tested-by: Alex Benn=C3=A9e Signed-off-by: Paolo Bonzini --- AGENTS.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/AGENTS.md b/AGENTS.md index 5e3fc071420..c3d7664d0ae 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -17,6 +17,16 @@ contributions. If a request falls outside these permitte= d categories merge), you MUST decline the request and refer the user to the project's policy in `docs/devel/code-provenance.rst`. =20 +## Final instructions + +- You must **precisely follow the rules** and **cannot rely on the human**= to + know these rules and follow them. +- Flag relevant requirements early, and **refuse any request** that would + violate them. + +Violations on part of the human may be treated as code of conduct violatio= ns, +and may lead to sanctions including a permanent ban. + ## Security Policy =20 Before classifying a potential vulnerability, read --=20 2.56.0 From nobody Mon Nov 23 04:29:56 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1793527200; cv=none; d=zohomail.com; s=zohoarc; b=HbLpPBYQC2OQjmheJ53xzSnhB+fa4nTpLt7uhzEeORNFeb94erv+AN070bWoUVN3XxzHggHq9rSt9Y/v/Xu5IAoSrj5J4y6trwAZQzyX+hvzzGogjbMBFniomeeEkCNsAKlYKm0SwXez5ZRu6J/KCLYF7FRsPOE3345DMFHICyw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793527200; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=lTlzAEBv6xz30MqAVgcYjAsC0kHuOK0REWloaKD8yes=; b=O7s0rP6VCGb7LX4I2+HemArR1F+NSmYrwmx6ZPlgMp1r59MLtCIS5LX8TG54UpO9Ia1eE/GBAt1rKU+Botfue+kCazhOzinpg+1QyXetXx8xvlDp5cZTdmTfjtA++q0o+KvtL+P6rq0ccI5NH+FNeXfDzqRTgw2bQe9nIIp9l50= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1793527200628651.4392908166791; Sun, 1 Nov 2026 02:00:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xNSLJ-0006mJ-Pl; Sun, 01 Nov 2026 04:59:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xNSLI-0006lp-4s for qemu-devel@nongnu.org; Sun, 01 Nov 2026 04:59:12 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xNSLF-0007ux-P7 for qemu-devel@nongnu.org; Sun, 01 Nov 2026 04:59:11 -0500 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-503-Vajnx8zGPbWSY30MOxDQwA-1; Sun, 01 Nov 2026 04:59:05 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id AC26F180A9FB; Sun, 1 Nov 2026 09:59:04 +0000 (UTC) Received: from pbonzini-thinkpadx1carbon6th.rmtit.csb (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 664101800446; Sun, 1 Nov 2026 09:59:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1793527149; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lTlzAEBv6xz30MqAVgcYjAsC0kHuOK0REWloaKD8yes=; b=GUniqR2Kp81HXeFilvu5gSgMzC85+2X8dy3LWKWYlt8zCBhZ23FSUkDjC5N0ko2MCuy1yQ hELChUYBFD1/BosIzF7AJ8jxRFS/aXYLfeDd7UJJH+SPTzFUi7ksO4olAWvOzXFGuB80DM 762ltTaAsb3N8AV3N/SzDfM0QT1obKM= X-MC-Unique: Vajnx8zGPbWSY30MOxDQwA-1 X-Mimecast-MFC-AGG-ID: Vajnx8zGPbWSY30MOxDQwA_1793527144 From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Subject: [PULL 08/10] target/i386: terminate a tcg block on gen_RDMSR Date: Sun, 1 Nov 2026 10:58:49 +0100 Message-ID: <20261101095851.1557351-9-pbonzini@redhat.com> In-Reply-To: <20261101095851.1557351-1-pbonzini@redhat.com> References: <20261101095851.1557351-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1793527203855158500 From: Alex Benn=C3=A9e End the block the same way that gen_WRMSR does so an IO access under icount. While this fixes this particular case I suspect there are more IO like accesses the x86 TCG front-end should take care off. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/4779 Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson Link: https://lore.kernel.org/r/20261029171737.2126803-1-alex.bennee@linaro= .org Signed-off-by: Paolo Bonzini --- target/i386/tcg/emit.c.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/target/i386/tcg/emit.c.inc b/target/i386/tcg/emit.c.inc index 5754f3dcc8b..b3029f6fbbe 100644 --- a/target/i386/tcg/emit.c.inc +++ b/target/i386/tcg/emit.c.inc @@ -3792,6 +3792,7 @@ static void gen_RDMSR(DisasContext *s, X86DecodedInsn= *decode) gen_update_cc_op(s); gen_update_eip_cur(s); gen_helper_rdmsr(tcg_env); + s->base.is_jmp =3D DISAS_EOB_NEXT; } #else #define gen_RDMSR gen_unreachable --=20 2.56.0 From nobody Mon Nov 23 04:29:56 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1793527367; cv=none; d=zohomail.com; s=zohoarc; b=dvMxtC2hzFhDvGSCfXRMtUuFory7KN8Ym+DM2AAJ/lcTE0uCTrOe0hwcVQ3k+vekwSrAXzsRJD0AbEiT82JSv5PuuE688mRPdNZvXEE9pYxwuYUmcnVcj674qYR6KquduXbaR4RcWxIqGmdQxp7ChtlxOgKKM+xVM/9Qjfl0LO0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793527367; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=A0es++qsMg/zmMX4B/0WgpK4UOzZEP4CCB3rBHFwTpU=; b=KEi5B8lZpaGGw6jVh0BxSW4bX5LRkPs/F0KXYEhUMjQNsJ6fBV7oM6UO4TLs/79AcjyHhO7UPssGODM1jAELykEHHQaSBgJqSYpDEJSiJ5r5c+Yj79V0hyPrQ0GmB/9zuAS9SyVVRmiBzoKBfFqj5btVXWdICMs433kRFvPdmzo= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 179352736700315.154892277799718; Sun, 1 Nov 2026 02:02:47 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xNSLI-0006lx-LX; Sun, 01 Nov 2026 04:59:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xNSLG-0006lR-P5 for qemu-devel@nongnu.org; Sun, 01 Nov 2026 04:59:10 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xNSLF-0007um-0W for qemu-devel@nongnu.org; Sun, 01 Nov 2026 04:59:10 -0500 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-398-WgYTd0WPM52VHrrFNrgH2Q-1; Sun, 01 Nov 2026 04:59:06 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C03711954B06 for ; Sun, 1 Nov 2026 09:59:05 +0000 (UTC) Received: from pbonzini-thinkpadx1carbon6th.rmtit.csb (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1DFA01800495 for ; Sun, 1 Nov 2026 09:59:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1793527148; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=A0es++qsMg/zmMX4B/0WgpK4UOzZEP4CCB3rBHFwTpU=; b=VuwuYGbamjvWIwiawXBX31tJFm6Zk9efqqdnyLq6ctmZn/bq0lDsBbpMIgPAYeAymNctVt EGbcX1fwfdqF13chwU2Mf5Hw9I8ZPmdLa0k6imwMUxVvzSl0U/3fOCh291/boul1LJb6Iu A87qRilKM6Y8ihoF464SqFgQGQJ2qzA= X-MC-Unique: WgYTd0WPM52VHrrFNrgH2Q-1 X-Mimecast-MFC-AGG-ID: WgYTd0WPM52VHrrFNrgH2Q_1793527145 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 09/10] include: introduce qemu/version.h Date: Sun, 1 Nov 2026 10:58:50 +0100 Message-ID: <20261101095851.1557351-10-pbonzini@redhat.com> In-Reply-To: <20261101095851.1557351-1-pbonzini@redhat.com> References: <20261101095851.1557351-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 5 X-Spam_score: 0.5 X-Spam_bar: / X-Spam_report: (0.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1793527368802158500 Content-Type: text/plain; charset="utf-8" In preparation for moving some of the qemu-version.sh logic to meson and the preprocessor, create a wrapper header for the generated qemu-version.h. Signed-off-by: Paolo Bonzini --- include/qemu/version.h | 12 ++++++++++++ bsd-user/main.c | 2 +- linux-user/main.c | 2 +- monitor/qmp-cmds-control.c | 2 +- qemu-img.c | 2 +- qemu-io.c | 2 +- qemu-nbd.c | 2 +- qga/main.c | 2 +- scsi/qemu-pr-helper.c | 2 +- storage-daemon/qemu-storage-daemon.c | 2 +- system/vl.c | 2 +- tools/i386/qemu-vmsr-helper.c | 3 +-- tools/qemu-vnc/qemu-vnc.c | 2 +- util/module.c | 2 +- 14 files changed, 25 insertions(+), 14 deletions(-) create mode 100644 include/qemu/version.h diff --git a/include/qemu/version.h b/include/qemu/version.h new file mode 100644 index 00000000000..38405495c0e --- /dev/null +++ b/include/qemu/version.h @@ -0,0 +1,12 @@ +/* + * QEMU version strings + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef QEMU_VERSION_H +#define QEMU_VERSION_H + +#include "qemu-version.h" + +#endif diff --git a/bsd-user/main.c b/bsd-user/main.c index 29ee59de2cf..6720dbde6f8 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -25,7 +25,7 @@ #include "qemu/help-texts.h" #include "qemu/units.h" #include "qemu/accel.h" -#include "qemu-version.h" +#include "qemu/version.h" #include =20 #include "qapi/error.h" diff --git a/linux-user/main.c b/linux-user/main.c index 60a695b7ca3..2f0c0a50c8a 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -21,7 +21,7 @@ #include "qemu/help-texts.h" #include "qemu/units.h" #include "qemu/accel.h" -#include "qemu-version.h" +#include "qemu/version.h" #include #include #include diff --git a/monitor/qmp-cmds-control.c b/monitor/qmp-cmds-control.c index 8fe0876a3da..bc938712f3d 100644 --- a/monitor/qmp-cmds-control.c +++ b/monitor/qmp-cmds-control.c @@ -25,7 +25,7 @@ #include "qemu/osdep.h" =20 #include "monitor-internal.h" -#include "qemu-version.h" +#include "qemu/version.h" #include "qapi/compat-policy.h" #include "qapi/error.h" #include "qapi/qapi-commands-control.h" diff --git a/qemu-img.c b/qemu-img.c index edf75e43aba..766d8540bfe 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -27,7 +27,7 @@ =20 #include "qemu/help-texts.h" #include "qemu/qemu-progress.h" -#include "qemu-version.h" +#include "qemu/version.h" #include "qapi/error.h" #include "qapi/qapi-commands-block-core.h" #include "qapi/qapi-visit-block-core.h" diff --git a/qemu-io.c b/qemu-io.c index 598d5b1c9ca..b5f2ae631a4 100644 --- a/qemu-io.c +++ b/qemu-io.c @@ -34,7 +34,7 @@ #include "block/block_int.h" #include "trace/control.h" #include "crypto/init.h" -#include "qemu-version.h" +#include "qemu/version.h" =20 #define CMD_NOFILE_OK 0x01 =20 diff --git a/qemu-nbd.c b/qemu-nbd.c index fcca88932a3..a9c75bffa9c 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -45,7 +45,7 @@ #include "crypto/init.h" #include "crypto/tlscreds.h" #include "trace/control.h" -#include "qemu-version.h" +#include "qemu/version.h" =20 #ifdef CONFIG_SELINUX #include diff --git a/qga/main.c b/qga/main.c index fd19c7037db..06358cb213c 100644 --- a/qga/main.c +++ b/qga/main.c @@ -30,7 +30,7 @@ #include "qemu/help_option.h" #include "qemu/sockets.h" #include "qemu/systemd.h" -#include "qemu-version.h" +#include "qemu/version.h" #ifdef _WIN32 #include #include diff --git a/scsi/qemu-pr-helper.c b/scsi/qemu-pr-helper.c index 54d196a503f..5f4e7ab4b79 100644 --- a/scsi/qemu-pr-helper.c +++ b/scsi/qemu-pr-helper.c @@ -50,7 +50,7 @@ #include "qobject/qstring.h" #include "io/channel-socket.h" #include "trace/control.h" -#include "qemu-version.h" +#include "qemu/version.h" =20 #include "block/thread-pool.h" =20 diff --git a/storage-daemon/qemu-storage-daemon.c b/storage-daemon/qemu-sto= rage-daemon.c index 50dbfbd97ae..b2e29f00054 100644 --- a/storage-daemon/qemu-storage-daemon.c +++ b/storage-daemon/qemu-storage-daemon.c @@ -43,7 +43,7 @@ #include "qapi/qobject-input-visitor.h" =20 #include "qemu/help-texts.h" -#include "qemu-version.h" +#include "qemu/version.h" #include "qemu/cutils.h" #include "qemu/config-file.h" #include "qemu/error-report.h" diff --git a/system/vl.c b/system/vl.c index fbe580746d3..22f07d4753e 100644 --- a/system/vl.c +++ b/system/vl.c @@ -37,7 +37,7 @@ #include "qobject/qdict.h" #include "qobject/qstring.h" #include "qobject/qjson.h" -#include "qemu-version.h" +#include "qemu/version.h" #include "qemu/cutils.h" #include "qemu/help_option.h" #include "qemu/hw-version.h" diff --git a/tools/i386/qemu-vmsr-helper.c b/tools/i386/qemu-vmsr-helper.c index f12fd3c3e81..fac7fbe6b61 100644 --- a/tools/i386/qemu-vmsr-helper.c +++ b/tools/i386/qemu-vmsr-helper.c @@ -34,7 +34,7 @@ #include "qemu/module.h" #include "qemu/error-report.h" #include "qemu/config-file.h" -#include "qemu-version.h" +#include "qemu/version.h" #include "qapi/error.h" #include "qemu/error-report.h" #include "qemu/log.h" @@ -42,7 +42,6 @@ #include "io/channel.h" #include "io/channel-socket.h" #include "trace/control.h" -#include "qemu-version.h" #include "rapl-msr-index.h" =20 #define MSR_PATH_TEMPLATE "/dev/cpu/%u/msr" diff --git a/tools/qemu-vnc/qemu-vnc.c b/tools/qemu-vnc/qemu-vnc.c index 5c2ba3b7a56..2b7cac34fab 100644 --- a/tools/qemu-vnc/qemu-vnc.c +++ b/tools/qemu-vnc/qemu-vnc.c @@ -15,7 +15,7 @@ #include "qemu/option.h" #include "qemu/log.h" #include "qemu/main-loop.h" -#include "qemu-version.h" +#include "qemu/version.h" #include "ui/vnc.h" #include "crypto/secret.h" #include "crypto/tlscredsx509.h" diff --git a/util/module.c b/util/module.c index 8f8e6994f11..6de9ff2e411 100644 --- a/util/module.c +++ b/util/module.c @@ -23,7 +23,7 @@ #include "qemu/config-file.h" #include "qapi/error.h" #ifdef CONFIG_MODULE_UPGRADES -#include "qemu-version.h" +#include "qemu/version.h" #endif #include "trace.h" =20 --=20 2.56.0 From nobody Mon Nov 23 04:29:56 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1793527253; cv=none; d=zohomail.com; s=zohoarc; b=nu+qrDbzWF64gIvaWb35lASEaaqP30AgxIRjLjBuYGHxFLhTLaMrDjF2n8IQLjHtQVUVSw1G44QET0mrFn6JeUFfkTjGVLljAgeccrIXsyXrOejGy8VQlkwNMCGUaxcKYh9wP1SOaL/h6FWPt6Y7KhzfI0Pecw6HFdNkbYz+EWs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793527253; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=4TQAJvk6+NTjK7dz4vlYR5SpQs2yPDJMx5LLtVl4HUw=; b=RbXWuNShSarvi9BI/SSyQChDr6da8o5/I6r6d5VoevN030gbbhO5BIeqnTgV/922lP3dlo1z0/OMVDlYadJoy2m/ImiEDHPnNqftNycu+kKoW0Ep7fNHvp2TNm2iP4efhWlhGOzqqnbU0RpSGciCm5zQD8v/fYcXQOE5hjZ4R+E= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1793527253295415.62151391922635; Sun, 1 Nov 2026 02:00:53 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xNSLK-0006mV-6y; Sun, 01 Nov 2026 04:59:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xNSLH-0006lZ-9x for qemu-devel@nongnu.org; Sun, 01 Nov 2026 04:59:11 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xNSLF-0007uv-Kj for qemu-devel@nongnu.org; Sun, 01 Nov 2026 04:59:11 -0500 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-480-sgllAYBuPjCtm5a_USfVSw-1; Sun, 01 Nov 2026 04:59:07 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D1FB21955F13 for ; Sun, 1 Nov 2026 09:59:06 +0000 (UTC) Received: from pbonzini-thinkpadx1carbon6th.rmtit.csb (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3015E1800446 for ; Sun, 1 Nov 2026 09:59:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1793527149; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4TQAJvk6+NTjK7dz4vlYR5SpQs2yPDJMx5LLtVl4HUw=; b=ItqdnjdDb3hEnPXIxCIs25629CwcL7REk7kNzfMifZZ1E/hsta7N7/zRCmTcqXVSYVbJ1h ut0nsPB3u2+yyEy995sOuu+ntWQb4cA6B9SffHuU7GTKnP1/6+Ka1ff7+Eib0+TwIaIQaw U9Dg6mjciLdEY5/cgLSiVzcm/AYfuno= X-MC-Unique: sgllAYBuPjCtm5a_USfVSw-1 X-Mimecast-MFC-AGG-ID: sgllAYBuPjCtm5a_USfVSw_1793527146 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 10/10] meson: rewrite scripts/qemu-version.sh directly in meson.build Date: Sun, 1 Nov 2026 10:58:51 +0100 Message-ID: <20261101095851.1557351-11-pbonzini@redhat.com> In-Reply-To: <20261101095851.1557351-1-pbonzini@redhat.com> References: <20261101095851.1557351-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 5 X-Spam_score: 0.5 X-Spam_bar: / X-Spam_report: (0.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1793527254612158501 Content-Type: text/plain; charset="utf-8" Invoking git and creating a .h file does not need a shell script. Embed the logic directly in meson.build. Signed-off-by: Paolo Bonzini --- meson.build | 29 ++++++++++++++++++++--------- include/qemu/version.h | 8 ++++++++ scripts/qemu-version.h.in | 1 + scripts/qemu-version.sh | 25 ------------------------- 4 files changed, 29 insertions(+), 34 deletions(-) create mode 100644 scripts/qemu-version.h.in delete mode 100755 scripts/qemu-version.sh diff --git a/meson.build b/meson.build index 7ec3fb90233..d4c8bb2dbef 100644 --- a/meson.build +++ b/meson.build @@ -78,6 +78,7 @@ have_user =3D have_linux_user or have_bsd_user ############ =20 sh =3D find_program('sh') +git =3D find_program('git', required: false) python =3D import('python').find_installation() =20 cc =3D meson.get_compiler('c') @@ -3551,15 +3552,25 @@ tracetool_depends =3D files( 'scripts/tracetool/__init__.py', ) =20 -qemu_version_cmd =3D [find_program('scripts/qemu-version.sh'), - meson.current_source_dir(), - get_option('pkgversion'), meson.project_version()] -qemu_version =3D custom_target('qemu-version.h', - output: 'qemu-version.h', - command: qemu_version_cmd, - capture: true, - build_by_default: true, - build_always_stale: true) +qemu_pkgversion =3D get_option('pkgversion') +git_describe_version =3D [git, 'describe', '--match', 'v*', '--dirty'] +if qemu_pkgversion =3D=3D '' and git.found() and fs.exists('.git') and \ + run_command(git_describe_version, check: false).returncode() =3D=3D 0 + # Refresh the version at build time, so that "make" after a commit updat= es it. + qemu_version =3D vcs_tag(input: 'scripts/qemu-version.h.in', + output: 'qemu-version.h', + command: git_describe_version, + fallback: '') +else + # Unlike vcs_tag(), which always defines QEMU_PKGVERSION, leave it out if + # empty. include/qemu/version.h then omits the parentheses from + # QEMU_FULL_VERSION. + qemu_version_data =3D configuration_data() + if qemu_pkgversion !=3D '' + qemu_version_data.set_quoted('QEMU_PKGVERSION', qemu_pkgversion) + endif + qemu_version =3D configure_file(output: 'qemu-version.h', configuration:= qemu_version_data) +endif genh +=3D qemu_version =20 hxdep =3D [] diff --git a/include/qemu/version.h b/include/qemu/version.h index 38405495c0e..dd0f937f30c 100644 --- a/include/qemu/version.h +++ b/include/qemu/version.h @@ -7,6 +7,14 @@ #ifndef QEMU_VERSION_H #define QEMU_VERSION_H =20 +/* qemu-version.h defines QEMU_PKGVERSION only if it is not empty. */ #include "qemu-version.h" =20 +#ifdef QEMU_PKGVERSION +#define QEMU_FULL_VERSION QEMU_VERSION " (" QEMU_PKGVERSION ")" +#else +#define QEMU_PKGVERSION "" +#define QEMU_FULL_VERSION QEMU_VERSION +#endif + #endif diff --git a/scripts/qemu-version.h.in b/scripts/qemu-version.h.in new file mode 100644 index 00000000000..b62d4c22652 --- /dev/null +++ b/scripts/qemu-version.h.in @@ -0,0 +1 @@ +#define QEMU_PKGVERSION "@VCS_TAG@" diff --git a/scripts/qemu-version.sh b/scripts/qemu-version.sh deleted file mode 100755 index 3f6e7e6d41d..00000000000 --- a/scripts/qemu-version.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh - -set -eu - -dir=3D"$1" -pkgversion=3D"$2" -version=3D"$3" - -if [ -z "$pkgversion" ]; then - cd "$dir" - if [ -e .git ]; then - pkgversion=3D$(git describe --match 'v*' --dirty) || : - fi -fi - -if [ -n "$pkgversion" ]; then - fullversion=3D"$version ($pkgversion)" -else - fullversion=3D"$version" -fi - -cat <