From nobody Sun Nov 24 10:40:38 2024 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1723431587; cv=none; d=zohomail.com; s=zohoarc; b=dc3/YZEU1meiNYDns9kPaqn7/0u0xD7tAe/Fmi0oxJxNvkBWUY1XGv4dORXoydEfqQFqbLffp5OoJpRDAALu64eA1HED3mz2DzyA34BjnPSlaec4ml66b5/2qqQDQzTp3CVTKb6HaoBdrmkpyqdtKVRpMFpkvfIebwSvXqpkrwk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1723431587; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=uTnoluISZ2MwVzhPbDJiXvg9KVOpgY1wyPYE6S/EINo=; b=AhArv1wOhVKj4/yY3kW5SZOJfvGBH+jY6JAIftYPhIW7vR2jXQyjQez8VFJyxLgzV6f/GDvyzIka0ejuvSlqQE/blS8UBiX7wBjMcmv5Py+VBZksk5UXHy4A2Y3PAPtGL6X+iNevJ48qPhsNsESz8PI3VYfEcyVekvurFDWwYH8= 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 1723431587513990.1003561203084; Sun, 11 Aug 2024 19:59:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sdLGs-0004OO-5V; Sun, 11 Aug 2024 22:58:58 -0400 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 1sdLGq-0004Hf-BJ for qemu-devel@nongnu.org; Sun, 11 Aug 2024 22:58:56 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sdLGo-0003em-JL for qemu-devel@nongnu.org; Sun, 11 Aug 2024 22:58:56 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-70d1fb6c108so2690617b3a.3 for ; Sun, 11 Aug 2024 19:58:54 -0700 (PDT) Received: from stoup.. ([203.30.4.111]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-710e5a43b49sm2984841b3a.100.2024.08.11.19.58.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 19:58:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723431533; x=1724036333; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uTnoluISZ2MwVzhPbDJiXvg9KVOpgY1wyPYE6S/EINo=; b=fjxCcQruuUVdQseaoTzlwptQeVoVQxjpVkCLNO9z9roGao3Lx5dyxbONt/7PngZPio LRMRQwocq4EOzHf7OwzluKznbaT4fZsiE/+kZ83o5VH9DrOAjVkxK5lhEbGJBuOXJoMc OwHIgTyk2EF8FZ92aBUobrClVylyoKqxNHj8HRWQHox9Ubyvtc43IM23eQlBOmnvHfxK gcQyrDK1t3ZeDsQqXQlbtjlyggv5dSV7Sn9jpl27fKzKHJGMv5P5PYBHUM108lYWoaPv PZvwTpaeYlXET3S6ztpPxygkvmHCMH2NrI4Oq7V5pSuALjnOLv3Jynr635MAuDIfcee6 mSIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723431533; x=1724036333; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uTnoluISZ2MwVzhPbDJiXvg9KVOpgY1wyPYE6S/EINo=; b=Go8PT91Tcx6qO31qJ+UbTMHUn01BaQYRfXXmz4RsY7t57D+jio8mmyGJx7IYrpZF5u kMI9xYFScWey9HbEAB05sIfC8/sZTlJBpMqSvri7zkaKmAiUMukHEg1Cfl8LblNjTWGl F9w2SMBKpMYMzCGuutO7y9iGx1hPYpEsgg50m1DXkjbixxypnb5UV4HJHPQXMqJLP+Kd EVeXExj4Y2zNGM4nvqbS9SP02ySGNfLF3i24vfheJ+Ny25kNPkpRMIH8QmCS+xHodFcs tFml8d18Pcn9kLEUlPdlpi/K6RIV8NBlWTCqEWbPmG7pvYlSOYUJsqgr5cLRlQvz+vtj plVw== X-Gm-Message-State: AOJu0YwnOd40gcJQGaHR79sI2GsHvCOVOiD+yBXoxQilzkW1nTBiWH1l TOvOh13qWwHWEToOsxe1RoPPFy+AbIr7bK5YsuX89ZtN3GjXECeX1eFtMK1VNKeGiXUavYJ1zaK rork= X-Google-Smtp-Source: AGHT+IFp8T8ktTiyPWuzR72QnaLlPB9/uu6ZEzxIptx6nmDRIgZ0KXqKR78Zd06YruQeERaruMmrcQ== X-Received: by 2002:a05:6a00:23c7:b0:706:284f:6a68 with SMTP id d2e1a72fcca58-710dcaecfb3mr6227691b3a.23.1723431532714; Sun, 11 Aug 2024 19:58:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, qemu-stable@nongnu.org Subject: [PATCH 1/3] target/i386: Do not apply REX to MMX operands Date: Mon, 12 Aug 2024 12:58:42 +1000 Message-ID: <20240812025844.58956-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240812025844.58956-1-richard.henderson@linaro.org> References: <20240812025844.58956-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: 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 @linaro.org) X-ZM-MESSAGEID: 1723431589364116600 Content-Type: text/plain; charset="utf-8" Cc: qemu-stable@nongnu.org Fixes: b3e22b2318a ("target/i386: add core of new i386 decoder") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2495 Signed-off-by: Richard Henderson --- target/i386/tcg/decode-new.c.inc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/target/i386/tcg/decode-new.c.inc b/target/i386/tcg/decode-new.= c.inc index b22210f45d..03138b3876 100644 --- a/target/i386/tcg/decode-new.c.inc +++ b/target/i386/tcg/decode-new.c.inc @@ -1979,7 +1979,10 @@ static bool decode_op(DisasContext *s, CPUX86State *= env, X86DecodedInsn *decode, op->unit =3D X86_OP_SSE; } get_reg: - op->n =3D ((get_modrm(s, env) >> 3) & 7) | REX_R(s); + op->n =3D ((get_modrm(s, env) >> 3) & 7); + if (op->unit !=3D X86_OP_MMX) { + op->n |=3D REX_R(s); + } break; =20 case X86_TYPE_E: /* ALU modrm operand */ --=20 2.43.0 From nobody Sun Nov 24 10:40:38 2024 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1723431559; cv=none; d=zohomail.com; s=zohoarc; b=h9q45uTRV1BdFF3Ib3wI6rlNmQfohXQLosZVXypwgsqzaMOuMOfWXSoOzRtaVrgKsW+ipRPklKyqBFS2HfI01ytQExWZhmqq0thPR2Ni3l8XIYXrymYtqjNt66edeSJDMeNF2U7EXn0+1r6fl7kZBLLxawoJgCIvc7o7FjP62tE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1723431559; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=RRhHm135dGLBKgHTs5Bk6uiyESpFu38TL3b65HCIA00=; b=XEfW2qWX5U31M5rEwCnsMX+/FcrFaQnkDCHLgIjdcKgCAbpgskmvLhbpmuw3biOQURqBB2FZEIX/lyDpxY1RW7cFBUz0HAjWjGAUWzlhtDoj5g5SSTBDNHDf+lW4MCdDB+7JaM5LTv2//O5uLzr1lvCxR/TgVDCARTm7UBOGiJ0= 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 1723431558892433.8788453539961; Sun, 11 Aug 2024 19:59:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sdLGt-0004W4-VR; Sun, 11 Aug 2024 22:58:59 -0400 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 1sdLGs-0004Nw-05 for qemu-devel@nongnu.org; Sun, 11 Aug 2024 22:58:58 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sdLGq-0003h1-Fx for qemu-devel@nongnu.org; Sun, 11 Aug 2024 22:58:57 -0400 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-710d0995e21so2371729b3a.1 for ; Sun, 11 Aug 2024 19:58:56 -0700 (PDT) Received: from stoup.. ([203.30.4.111]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-710e5a43b49sm2984841b3a.100.2024.08.11.19.58.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 19:58:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723431535; x=1724036335; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RRhHm135dGLBKgHTs5Bk6uiyESpFu38TL3b65HCIA00=; b=TYmYP7kEiGi6Ybujhlfdcn2HdF/jG9zxqxDaxZZ3u5ps6I98Ul9+CZKQUVRXq3MdoA X+QarAwZO8xT3ocSLd7zybfS3dAdtfy9clgtE+fKg2Qz5tlevO26vZvD17ReM9FfIXMZ ubPAdStf87nUBBxzKPA5+G8w98lpD/kUPtMts0bNTTY/3oD2kU0SAy18ShLrue9SjaGc 16cHGjVgJaSa7CtvMtJUjdxuYmcQ89EJA2NZlFlH90jhdJXmkaoGKUa+ug5Wf1d+BNH3 Cf//7chCot6UoPaaECwczxp0QkK6N7UL6pPYmHlLTyGciBf1CCqwAwbSklxVBqNImwjh qq0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723431535; x=1724036335; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RRhHm135dGLBKgHTs5Bk6uiyESpFu38TL3b65HCIA00=; b=uY3Ax2e6LTe0kYXNx54zRCYOKLOTVmLu8e+/oVVsyh1YztEQIybzR+dvkMdogiOyK+ HPqP20RDRAmcr0u+c/PJrhp4+ay+WCWzUnIafkCjIgNuK6L/uu5CA557lu06HncHTYXX pwRdOzCeKo2wzQFcEicGDiWZ5RCd31pijXBQ1Bw0VwI8X4/VyHJ2+eY6Rcqhcaw7ct6Q KlmM9fK2LiEPITLZ9zFJQSd3z2ACK05utXBozbXgf60ncVT1WHUGlnrA0pLxVMQZx1wu 7gsJlx5gtynKXyW9WoD487CCeJG0Vv0OstxrWhce7KnVz9lJMjhnjhgG052mCBVeWyMD hYJw== X-Gm-Message-State: AOJu0YzaMS44l6ASsq0iJZB5AaLN3fruNJH91QkRSqwnlrInX0MARolf AaCBz0DQ2gHAWzQr7aH1vamd6X6XPdHBl6Oz4z3G1REH9sf//liYxmMQk4W1B4ZuA4vH3GRYLgX jQNk= X-Google-Smtp-Source: AGHT+IGrkLo9fWBpsiO0Y2iwqHpkxetwZw+0N9VF770hB1YmLFkdgp4bogxObX0pCsC/KSoB62gp7Q== X-Received: by 2002:a05:6a00:b56:b0:710:9d5e:8a3 with SMTP id d2e1a72fcca58-710dcaa69fbmr5541620b3a.30.1723431535076; Sun, 11 Aug 2024 19:58:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com Subject: [PATCH 2/3] target/i386: Use unit not type in decode_modrm Date: Mon, 12 Aug 2024 12:58:43 +1000 Message-ID: <20240812025844.58956-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240812025844.58956-1-richard.henderson@linaro.org> References: <20240812025844.58956-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2607:f8b0:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @linaro.org) X-ZM-MESSAGEID: 1723431559352116600 Content-Type: text/plain; charset="utf-8" Rather that enumerating the types that can produce MMX operands, examine the unit. No functional change. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- target/i386/tcg/decode-new.c.inc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/i386/tcg/decode-new.c.inc b/target/i386/tcg/decode-new.= c.inc index 03138b3876..30be9237c3 100644 --- a/target/i386/tcg/decode-new.c.inc +++ b/target/i386/tcg/decode-new.c.inc @@ -1799,13 +1799,13 @@ static void decode_root(DisasContext *s, CPUX86Stat= e *env, X86OpEntry *entry, ui } =20 =20 -static int decode_modrm(DisasContext *s, CPUX86State *env, X86DecodedInsn = *decode, - X86DecodedOp *op, X86OpType type) +static int decode_modrm(DisasContext *s, CPUX86State *env, + X86DecodedInsn *decode, X86DecodedOp *op) { int modrm =3D get_modrm(s, env); if ((modrm >> 6) =3D=3D 3) { op->n =3D (modrm & 7); - if (type !=3D X86_TYPE_Q && type !=3D X86_TYPE_N) { + if (op->unit !=3D X86_OP_MMX) { op->n |=3D REX_B(s); } } else { @@ -2040,7 +2040,7 @@ static bool decode_op(DisasContext *s, CPUX86State *e= nv, X86DecodedInsn *decode, /* fall through */ case X86_TYPE_nop: /* modrm operand decoded but not fetched */ get_modrm: - decode_modrm(s, env, decode, op, type); + decode_modrm(s, env, decode, op); break; =20 case X86_TYPE_O: /* Absolute address encoded in the instruction */ --=20 2.43.0 From nobody Sun Nov 24 10:40:38 2024 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1723431593; cv=none; d=zohomail.com; s=zohoarc; b=nfG7nlMa+WAP1of8Qo73bWuEsDT+apD7OfpvDPbZH6SQvQqeGfV6wq4ZIK4I9asEKuDLO4SvhawavdLoXOI32pRjgQDc16WNHIabd6zCnzuh1eqyHoNMLIu6T3ur0XWncvA19iKK+En49enwJ3bDxDCj+fpi66Oa1u+PRwfOlrw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1723431593; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Pjjxaw7LIZTt8dz5CemMFoHd+/gcNlB7CUIggpOtFAI=; b=Ww9gd0eaAqq8qdE74RH6MdTuB8XbBmX26ZvNS5X13zgj7K7U2GEaaoEX0Fj6o87Zm8IGzwwHmkyDOAl1KMZUIrsVALl938JFMQXqJHz3i+s+eHiCwv7GxhZV5U3tCCOs6ceT6ZNCzl6jWAcUo4nKddk/X9L6WzFyYkXw/3GJDp8= 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 1723431593695561.3632975726824; Sun, 11 Aug 2024 19:59:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sdLGv-0004cx-Mm; Sun, 11 Aug 2024 22:59:01 -0400 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 1sdLGu-0004Xt-Df for qemu-devel@nongnu.org; Sun, 11 Aug 2024 22:59:00 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sdLGs-0003j9-R0 for qemu-devel@nongnu.org; Sun, 11 Aug 2024 22:59:00 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-710cad5778fso3177657b3a.3 for ; Sun, 11 Aug 2024 19:58:58 -0700 (PDT) Received: from stoup.. ([203.30.4.111]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-710e5a43b49sm2984841b3a.100.2024.08.11.19.58.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 19:58:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723431537; x=1724036337; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Pjjxaw7LIZTt8dz5CemMFoHd+/gcNlB7CUIggpOtFAI=; b=iM5OFsY5VRRpEut3JJpQHSUuo9coM8JBMP9b5fDD6rhvqpWG9gPPZt36Dqg1XzHe6s 4nWY00i8F8nBxcSHt2CBGPKWIFy4u18++ZAs+n7/tXspH6McOR/xzY+Qhxt2+CSTkFwu Y+v0HrJjkbBg3vdJle4jCV6o5iCzqcyNlvWkBKhzf7LEe1INcZgoW9W8RnmIEwHEGlfb fQgWZ3mP78NdzM98Te3RITVix5w6gwbyhhDzkNinjfIJgAW57a0eeBWhdUOKMFiIdHIZ oK0eSTTubmwS0zLXg7YhBLtQDJq+OyavQ0qonDvW1XwBzw0iG9fyBVM3yAz9n7MCNi9y +81Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723431537; x=1724036337; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Pjjxaw7LIZTt8dz5CemMFoHd+/gcNlB7CUIggpOtFAI=; b=m99MhcJhmVlZm+X7lbgpGzVvnEBGBzpH75lmzu2Deth7EDmZxpC0qHIVJkbtYtZEFs KnsDEEfM5tXR9t/Y0QZtPW1fqw5EY7e03yAZlwbeaUfqxWrtEbgb9vW4HvtcklGZ2j/j JQwvGdlrABPvUuPaFjzYPMAcaIoOrKryEi9V59pRLStkdwBLdYjTbQ47U+OT4PmVzHCt 3t8kdK6uyJrCqpGpDZLAwDFZLkQXssCn0wDtBFA7FC1HXjAkpUmbOEmcyAqpDz342hpq /JWmrt4ZiHqJ9LeQYWWwG7eJFzNuE/WoJedcORnJsP9Al55IxIWH25Yqdx/o5IAfBqCi uvRg== X-Gm-Message-State: AOJu0YwReLyU75YXgt+fbTxCrhaWkRH18jGWsgK6Gc5TXu0emUNsi2Eq AZMqttaDszE6dc0Da3sb/ExW3QagxDHhgRLby9xKWAS7+D9leo7CfE7gwJJBD7EmJvodKnDtr8k IBjo= X-Google-Smtp-Source: AGHT+IHKNm8zrygOUgyHLXNQPv+XO/rn4bOYa4w/tzofzuX9wa/w+x66j6AxgAF7k6Pa/S9dJsLIGA== X-Received: by 2002:a05:6a00:17a9:b0:70d:22b5:5420 with SMTP id d2e1a72fcca58-710dc75f7f8mr12238672b3a.15.1723431537429; Sun, 11 Aug 2024 19:58:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com Subject: [PATCH 3/3] target/i386: Assert MMX and XMM registers in range Date: Mon, 12 Aug 2024 12:58:44 +1000 Message-ID: <20240812025844.58956-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240812025844.58956-1-richard.henderson@linaro.org> References: <20240812025844.58956-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2607:f8b0:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @linaro.org) X-ZM-MESSAGEID: 1723431595494116600 Content-Type: text/plain; charset="utf-8" The mmx assert would fire without the fix for #2495. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- target/i386/tcg/emit.c.inc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/target/i386/tcg/emit.c.inc b/target/i386/tcg/emit.c.inc index 016dce8146..747ff71b33 100644 --- a/target/i386/tcg/emit.c.inc +++ b/target/i386/tcg/emit.c.inc @@ -33,8 +33,13 @@ #define TCG_TARGET_extract_tl_valid TCG_TARGET_extract_i32_valid #endif =20 +#define MMX_OFFSET(reg) + ({ assert((reg) >=3D 0 && (reg) <=3D 7); \ + offsetof(CPUX86State, fpregs[reg].mmx); }) =20 -#define ZMM_OFFSET(reg) offsetof(CPUX86State, xmm_regs[reg]) +#define ZMM_OFFSET(reg) \ + ({ assert((reg) >=3D 0 && (reg) <=3D 15); \ + offsetof(CPUX86State, xmm_regs[reg]); }) =20 typedef void (*SSEFunc_i_ep)(TCGv_i32 val, TCGv_ptr env, TCGv_ptr reg); typedef void (*SSEFunc_l_ep)(TCGv_i64 val, TCGv_ptr env, TCGv_ptr reg); @@ -168,7 +173,7 @@ static int vector_elem_offset(X86DecodedOp *op, MemOp o= t, int n) static void compute_mmx_offset(X86DecodedOp *op) { if (!op->has_ea) { - op->offset =3D offsetof(CPUX86State, fpregs[op->n].mmx) + mmx_offs= et(op->ot); + op->offset =3D MMX_OFFSET(op->n) + mmx_offset(op->ot); } else { op->offset =3D offsetof(CPUX86State, mmx_t0) + mmx_offset(op->ot); } --=20 2.43.0