From patchwork Fri Oct 13 21:28:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 733343 Delivered-To: patch@linaro.org Received: by 2002:a5d:54d1:0:b0:31d:da82:a3b4 with SMTP id x17csp1680808wrv; Fri, 13 Oct 2023 14:40:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGnjNiLNgFEAAeapbZVjeplA6aRhFcTlqV/PVsd5xUQh5OWNufhxQEZxfKc3jDTaSUNtPky X-Received: by 2002:a25:c7d2:0:b0:d9b:353b:9e24 with SMTP id w201-20020a25c7d2000000b00d9b353b9e24mr2227422ybe.11.1697233224543; Fri, 13 Oct 2023 14:40:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697233224; cv=none; d=google.com; s=arc-20160816; b=fmOQKMzHCE/WNIZ7TE53HAaSsIXJkmA4uUGPCZafzx+GdPtfcHMPYWrfoPywuAgbeY HN5KzBlE7mupUcQT0Z+sro2SsntZKpxFoLf9jtktDOB5pLzHhtd2aVLQ1H7yvBWS9uJ+ 5GQMp+1T3H/stZsQCzrXpNlwa8FnUabiGqSnM34R2F1EFUuONT+ZGTY4wix1POS8vlcD 45u1J+wM5JxnLQ3I22IHNKITX8oetUZm1DqUGbykLs3e5Qhs04gDbffOgrqZEg+XC0ot Me7M6AzlVqqwHM/K2FBVBfI1QQNgymwHY2rw/3bKQD5oHsKYp+uBoKRL5b7IelIUF2iQ qbhg== 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:cc:to :from:dkim-signature; bh=3x6eGpyMzcHLtmXWSfLOAiDgrHIMIv6MYnepjBlPbGI=; fh=OY/jf0qYEhT53LcIJp8d/e39mN3vEzshkseI36O8N8s=; b=ZGO3j2hPYVwFWU891aqC4NktBPxrxwtZDGO6pbpj6Tq+0YHdb4I6JbKzbATVJNJdXl trnoT+547eRkQJe7b4vGAibViBC04i9Gmaaoioj3jdOz2RLZfHXghVabTN2gna2OtONI YA+LHVFZStmIdW+3gakTbkU/M0TgAov6f8MqefYA3DMV/+Jex18e4ZvktzZO3TkQwRhA dpl2HgihAfq9qyX8ECpdqnzdsbT3YEy0vElVjVoKsDq9IVwib/rfCftr6o85qPYclndJ ntyNu8QuiaPwIdUj8Lis2RM7pDdXAJ/y5ofOkCzLqWE4t/lB5jN/vrpGRuxIPVXnNaLm oLCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CKC08jYL; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h12-20020a0ceecc000000b0066b13c94254si1873168qvs.247.2023.10.13.14.40.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Oct 2023 14:40:24 -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=CKC08jYL; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qrPir-0006RQ-Px; Fri, 13 Oct 2023 17:29:29 -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 1qrPip-0006Qy-KQ for qemu-devel@nongnu.org; Fri, 13 Oct 2023 17:29:27 -0400 Received: from mail-ot1-x332.google.com ([2607:f8b0:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qrPio-0000YS-48 for qemu-devel@nongnu.org; Fri, 13 Oct 2023 17:29:27 -0400 Received: by mail-ot1-x332.google.com with SMTP id 46e09a7af769-6c4fc2ce697so1713730a34.0 for ; Fri, 13 Oct 2023 14:29:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697232565; x=1697837365; 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=3x6eGpyMzcHLtmXWSfLOAiDgrHIMIv6MYnepjBlPbGI=; b=CKC08jYLeZWKjRuRZ9t8bMosgQ1Dx4wXSbygce9Cgo//4Q6UXjpquq7oVYke9w065g 7jX//0wJddYaO3xGOmPmbr28dv5ZR4IILt2ilSWjZ3lSAXxkCL4hm8vNUNzL58ytS179 msLknoK27eDePSAQPwZXDClCz5G+ljnAThCb2CMxxsBCrsdciyIxS65zsUJ4tzcC3rwt A5f9p25cFrF1shTS1niH7TNru+LwvfpV5ldtF0GhobcHfOFlPeAwTlhv00+EgGI9CTBN 9LyAYPWx40hX4b6T4qjxv7BSiI/hx4dk7k9NQP0yxx2UXheqLd5ug+UbvBLcFH0gt9fs htyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697232565; x=1697837365; 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=3x6eGpyMzcHLtmXWSfLOAiDgrHIMIv6MYnepjBlPbGI=; b=T153dYYBfqgE/oWxerz7Kna/i7mad3BpeDyEWM22m6cIRccn0Mo7pSmySUmxr0LAl2 +T7JWBTEuqBqDV3cYbQynaskCe6a2j2qxlhGJCjhkTt8cGlquHET8NADc1RIOA+w1RyJ ALh6mxuXuWnb6N0AZGBfDRnETiFUdUQ9BP9isiKaCJaJ9riP2VmMJTeIKpGxaRtsGLB3 vITL0Pt0/qoY3jXop5+Bn7ahFNI+Cm+XKx8AHXeT0+mbK6zb/WG1ZncTpxA1Lh8zhDXr xVzb4mA0EbQFlxTM2r2mHFn1q/IFOH6n/XnaX1leKKNmj32ewXhMJpfUAiEPUVX5l29r zBQA== X-Gm-Message-State: AOJu0YxpyDufTf+/u3WGZRb9Y8dBFjTbTHJPjfqJmaiiQfyZJTWD8AAb QHzbbSPMw16B7LKqXZYN16XyOrpD2K60DeFPM1M= X-Received: by 2002:a05:6871:8a4:b0:1e9:8885:b534 with SMTP id r36-20020a05687108a400b001e98885b534mr11693856oaq.9.1697232564878; Fri, 13 Oct 2023 14:29:24 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id b185-20020a6334c2000000b0058988954686sm70753pga.90.2023.10.13.14.29.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 14:29:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk, atar4qemu@gmail.com Subject: [PATCH 39/85] target/sparc: Split out resolve_asi Date: Fri, 13 Oct 2023 14:28:00 -0700 Message-Id: <20231013212846.165724-40-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231013212846.165724-1-richard.henderson@linaro.org> References: <20231013212846.165724-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::332; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x332.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 Signed-off-by: Richard Henderson --- target/sparc/translate.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index e652bdcac2..42a26671f1 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1815,15 +1815,25 @@ typedef struct { MemOp memop; } DisasASI; -static DisasASI get_asi(DisasContext *dc, int insn, MemOp memop) +/* + * Build DisasASI. + * For asi == -1, treat as non-asi. + * For ask == -2, treat as immediate offset (v8 error, v9 %asi). + */ +static DisasASI resolve_asi(DisasContext *dc, int asi, MemOp memop) { - int asi = GET_FIELD(insn, 19, 26); ASIType type = GET_ASI_HELPER; int mem_idx = dc->mem_idx; + if (asi == -1) { + /* Artificial "non-asi" case. */ + type = GET_ASI_DIRECT; + goto done; + } + #ifndef TARGET_SPARC64 /* Before v9, all asis are immediate and privileged. */ - if (IS_IMM) { + if (asi < 0) { gen_exception(dc, TT_ILL_INSN); type = GET_ASI_EXCP; } else if (supervisor(dc) @@ -1866,7 +1876,7 @@ static DisasASI get_asi(DisasContext *dc, int insn, MemOp memop) type = GET_ASI_EXCP; } #else - if (IS_IMM) { + if (asi < 0) { asi = dc->asi; } /* With v9, all asis below 0x80 are privileged. */ @@ -2025,9 +2035,16 @@ static DisasASI get_asi(DisasContext *dc, int insn, MemOp memop) } #endif + done: return (DisasASI){ type, asi, mem_idx, memop }; } +static DisasASI get_asi(DisasContext *dc, int insn, MemOp memop) +{ + int asi = IS_IMM ? -2 : GET_FIELD(insn, 19, 26); + return resolve_asi(dc, asi, memop); +} + static void gen_ld_asi(DisasContext *dc, TCGv dst, TCGv addr, int insn, MemOp memop) {