From patchwork Thu Jul 18 13:20:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 813190 Delivered-To: patch@linaro.org Received: by 2002:adf:f288:0:b0:367:895a:4699 with SMTP id k8csp291096wro; Thu, 18 Jul 2024 06:23:52 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUa2GlDqAMMYmWI0CFTFwQCZPmBPIBEZl/mO4Dy6pVGS+9F6hPRYtodpzEIa8a85LaemTZ3RyNGwOtGEzgJpKvp X-Google-Smtp-Source: AGHT+IF5OyIe7kteLxQB8D5lKp+mccAA+DURJoi3ccMzUPo6k09+fjiEOT6iIE1TShN5N+tLpBnB X-Received: by 2002:a05:620a:4143:b0:79d:7423:d040 with SMTP id af79cd13be357-7a193970db7mr82660785a.54.1721309031797; Thu, 18 Jul 2024 06:23:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721309031; cv=none; d=google.com; s=arc-20160816; b=NbnoiZ2SYFsIYTVP0ChHamMEFESp1JTqzPfFADUoBUr0WLBXeaYDAi7PkfsZz5b0HI P6MtpePK+HQ7v/oC65PuexMnAfzo0044WwnOnammlLF2ToVtMuOPywrTS6eyNqldciG3 HsN3/F02iaW9UUvX1itr1/wWRoBhAyYNpbJt7E/ub1YP0FBItkK221qcXY/7X98nNYRN rZ1F+aIfbr/KysXk5YlIHSbI/t5LI+a54kR4j7EzMOpkGFr4QW6tiVcCK7QUoRhFKa+J SDTCoRU60SJgprqLAewVUKAmrtp+tMMD1ZC+8acYETjIwcpW/M3dirVBJolKcqtb8v63 Km+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=cAG6/a6hlbAJcA7xle3K3QGG4JF+dWFlZQV04eIRpCY=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=tesBNtE0sgs0uSAdoEHCd+rz5a1p0lOcvfRHSB9veowLEihIntbR8vEA7IN3V1NtAq ArmKs3MmDtCiKef1sWQDWklSABwlaTqHJPz1M/jh1sDdVVNv3MWanRGsuLppmOam//NZ UEf5ioebiYb8vQrFqAN1SJTeMvXKKA1A81gv9nqT3GSdzq9MtaaLfJaHdPmifrkbAqIi WRSU5q0byUkuGgEMDfyXKY/iL96OCQgX/dyrzkE8U3qTD5uzA9JO96hAsKD/Ke2h2tQo P57HtTUxc6Ej+SsETy7oeV7XypeJ2Gkq535jAedu//h1zTUEuyxIO25retk+qTaxzShR Uo9w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AMTTUvm8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7a1939c2482si53906285a.661.2024.07.18.06.23.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Jul 2024 06:23:51 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AMTTUvm8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sUR44-0001HY-Ku; Thu, 18 Jul 2024 09:20:56 -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 1sUR3l-0007uJ-AW for qemu-devel@nongnu.org; Thu, 18 Jul 2024 09:20:38 -0400 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sUR3i-0004Sn-NR for qemu-devel@nongnu.org; Thu, 18 Jul 2024 09:20:37 -0400 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-52e9b9fb3dcso355547e87.1 for ; Thu, 18 Jul 2024 06:20:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721308831; x=1721913631; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=cAG6/a6hlbAJcA7xle3K3QGG4JF+dWFlZQV04eIRpCY=; b=AMTTUvm8pG3gLFeld2bBPH5xJ89aBp0IfHgHL6o7YnfiFsa6npqYqE1CVZ4Ejg9HUq tDLK2RWkVrD/WSOr7kgoKZjitXAiiuACijQh/Xocwu/+lApAaudwqgKwL2jD4brTL4oj nLdgWLJgUMtRIWtA4P7caWkScr8GBpfPVxVpvqzNeLP46LidX+Himo9o3m/vdRExT+US 5LCVxYCP6ivkHS1i0omdoklQpU48K60qxPO9gR2cxPuHvZ8c4V3WwzPqIzXZJkEqzjK+ PWInuLwiCwH2V5ibukU+xtftmIzUx++8XtHYH43NMAmUY7ixedTgtLWi7/rjV7ESs1Ol eP6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721308831; x=1721913631; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cAG6/a6hlbAJcA7xle3K3QGG4JF+dWFlZQV04eIRpCY=; b=u/cBPtM2Rvg8ckmBmmYpb4DTUeMtqeR94P6Faw2mp4LK/EMKgYG1WKXOSiczPj5Y7W D0x+JEQOxpB5YSwEKlBBvy7ucw49+sXuHHDR5jHb/FmFvMh8eJ3nptIKZpn3ekz5J6wZ Y1MehVyxRYvA66Pd2ipgxd1whHIcMXWe78AHyf2LPue5agNv0Bg91h+GsBdBG9KAbLYo NOCZ5w2yr1wm6txqIotQifFT2LnA5EngZ075VyAZf8vc3bCLrI80AKErxzj7n9AqRSgZ yxrTZxSs25KQKk9UAtsf2ZFquCV1Uy84DTfhPL+PK3Cimrye2EB1qPt5y7LhfuDmlksG i6bw== X-Gm-Message-State: AOJu0Yz2X0/Py6zS52zN93qq2GfgvuHEFVH9BYjXGiAeS8YxfLjtHFat hfg2lJhZULVL2zqq2KbJ6FjHz1kYMhuh2hlHHOcmh4A7PGXzz5SCyQYCQb4Q5BumJtLm7zNdr2J Z X-Received: by 2002:a05:6512:1281:b0:52b:bf8e:ffea with SMTP id 2adb3069b0e04-52ee54113d0mr3636635e87.40.1721308830611; Thu, 18 Jul 2024 06:20:30 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427d2a8e420sm14059315e9.35.2024.07.18.06.20.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jul 2024 06:20:30 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 01/26] target/arm: Fix handling of LDAPR/STLR with negative offset Date: Thu, 18 Jul 2024 14:20:03 +0100 Message-Id: <20240718132028.697927-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240718132028.697927-1-peter.maydell@linaro.org> References: <20240718132028.697927-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::133; envelope-from=peter.maydell@linaro.org; helo=mail-lf1-x133.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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org When we converted the LDAPR/STLR instructions to decodetree we accidentally introduced a regression where the offset is negative. The 9-bit immediate field is signed, and the old hand decoder correctly used sextract32() to get it out of the insn word, but the ldapr_stlr_i pattern in the decode file used "imm:9" instead of "imm:s9", so it treated the field as unsigned. Fix the pattern to treat the field as a signed immediate. Cc: qemu-stable@nongnu.org Fixes: 2521b6073b7 ("target/arm: Convert LDAPR/STLR (imm) to decodetree") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2419 Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-id: 20240709134504.3500007-2-peter.maydell@linaro.org --- target/arm/tcg/a64.decode | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 2922de700ca..62df4c4ceb4 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -520,7 +520,7 @@ LDAPR sz:2 111 0 00 1 0 1 11111 1100 00 rn:5 rt:5 LDRA 11 111 0 00 m:1 . 1 ......... w:1 1 rn:5 rt:5 imm=%ldra_imm &ldapr_stlr_i rn rt imm sz sign ext -@ldapr_stlr_i .. ...... .. . imm:9 .. rn:5 rt:5 &ldapr_stlr_i +@ldapr_stlr_i .. ...... .. . imm:s9 .. rn:5 rt:5 &ldapr_stlr_i STLR_i sz:2 011001 00 0 ......... 00 ..... ..... @ldapr_stlr_i sign=0 ext=0 LDAPR_i sz:2 011001 01 0 ......... 00 ..... ..... @ldapr_stlr_i sign=0 ext=0 LDAPR_i 00 011001 10 0 ......... 00 ..... ..... @ldapr_stlr_i sign=1 ext=0 sz=0