From patchwork Sat Oct 21 05:31:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736654 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp634284wrl; Fri, 20 Oct 2023 22:44:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFaeJgqdcJehwVTDU2DhkTBnoWrnEKI9quw2c8LJOv3Pej0D8ZXZ92DuDJuVY3br+dJL4vF X-Received: by 2002:ac8:58d1:0:b0:417:a469:1680 with SMTP id u17-20020ac858d1000000b00417a4691680mr4344120qta.38.1697867063426; Fri, 20 Oct 2023 22:44:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867063; cv=none; d=google.com; s=arc-20160816; b=adIjSoA2D9aEcesASbQz/g8zD3hp5Xq2D8Edj9gEdIkju5eDxwj/ySSBJpcBASrM+8 tafm16diFv27jk/zl9WaGfODn30t4Dbiy6CGwR5QgOk1jXfRv2cHp3Ot3D9Abns3Wiae 0iUp3b8TonnWGgWmWmMcKZ1tepPUAf6c7ZJrq6Pl+yqQN8XD9IDYD4+iBzeapOFt6xyJ SyZspqT5yvPf2pvHdyalKKqhoonI6bXZR+FhQNWAt+eBHUUn2WDyyn6GBwStP8OOLTyO 1IUpxWdjsXjj0yWXdEjX/YJXHNA37ck+HqfRf+jFSD9vaWd7vAnbnVdAk7dVlfuxpKP0 GQ4w== 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=dqcfeNJ9wzGAGV7oxUL/7nZeKmkczdhN3f+SdC8Dc8c=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=k7kcOlZwZMAvl+CvO7f7t51PgYDdZMt95nDpDeBKBhDK+EwgMb7z1RwZdogwWrEEqP tO0McLes8zIMJ1u4VntQO3JEgfPlU2gbZ7Iy9xDOwvBFS4sfo1Uk0NKo6DQ75K2tfl1A 4BAA+a/1Tmc5aPuxXzDpDqsgMyfgem/eWxFcfpfHNiE4EP8nY6LX2idY/sytynQMUxzq 5+R4PTIJRlravqz5u4xDE2eAzIHHpIbPtFiM5vf3k0DRcdJY1SYIYbBh0CsMs7YCrJUF LYiugd0tW36KlIM7OngWucq8wfRo70Rk97lYXrB/xEZjq96a2SdhTCgiYIqiHfkKeKMd c01g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UTl6KukJ; 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 14-20020ac8574e000000b0041980065908si2463503qtx.506.2023.10.20.22.44.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:44:23 -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=UTl6KukJ; 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 1qu4eN-0002en-2J; Sat, 21 Oct 2023 01:35:51 -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 1qu4eC-0002CQ-Bb for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:40 -0400 Received: from mail-oa1-x36.google.com ([2001:4860:4864:20::36]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4e9-00015E-JQ for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:40 -0400 Received: by mail-oa1-x36.google.com with SMTP id 586e51a60fabf-1e0ee4e777bso1082436fac.3 for ; Fri, 20 Oct 2023 22:35:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866536; x=1698471336; 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=dqcfeNJ9wzGAGV7oxUL/7nZeKmkczdhN3f+SdC8Dc8c=; b=UTl6KukJjtirXIvslns2KHu/ThbgHTARIxrkpJT4vX2APojqQOzCT5+RIxUqrw0odF OZbxZ5Djz/uPyXE5jRTzlkrJIvyfL6/cnRYzZZUzgfbIOGb+w6JP5oqi9lmr/PrcrwTW VmC+5CdJCuYHLWP7Ev4GwdOLcOxPoSh9pGpdR7aCo++ZzvkJ/1AByvroC5HnHwskqXfV cgoDjXMx0N8DCnxg3+F2eY/ZKl1wNobqQcCknw1tDUJ3XV0MFMZhlcxv596HnJkuJoq8 GYmkz/aZ8TUSV+MyVVTaXafNLnemFBE5P7okvSjY7RMAQfvk+80vdDkGcdE9YzvjF+BY Ox0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866536; x=1698471336; 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=dqcfeNJ9wzGAGV7oxUL/7nZeKmkczdhN3f+SdC8Dc8c=; b=SLJywaQw1YAIJQtu71L9qo/fjRUWDTHa9JAgb+1pE3qpHMDk2vwyN0rCc1oftqq0x9 MHhCQoxPcUFKKfChCjwRoRXvQBtxgV0u7BbyZEJHwWhdu/PMBjGjD0YflhkpD5bLzakQ /ZQvis8Q4EV7gIO1FPwivxzBi8FFsVLGpMjVyJXk/Za9JuUZoiWSt5AM7gAR8IbJ+g+q 9yt611sjQPlsQ7gVbhMp5jNpHwIf4EMHnX7tfk8QIHJmPxgSdiIep4JX41pB5hDuURyF QSS4EeKnQ3pzEzlJtYBdY5Pxoj3zq6NC9GoKnc5s4cGsuDpwnEAEvxqUMMDBf+qbcehZ GzUg== X-Gm-Message-State: AOJu0YxqEu9KA82IOZ69xAkOE/8bDZX6hMIAMKWOVxuc6Vcg+0tuHaVo CMKRTzvpR4pi7UTj3FleX7o1V13ueLMP6Nxx2NE= X-Received: by 2002:a05:6870:888:b0:1bf:b863:b6d with SMTP id fx8-20020a056870088800b001bfb8630b6dmr4271513oab.1.1697866536154; Fri, 20 Oct 2023 22:35:36 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.35.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:35:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 44/90] target/sparc: Split out resolve_asi Date: Fri, 20 Oct 2023 22:31:12 -0700 Message-Id: <20231021053158.278135-45-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::36; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x36.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 2e2df42c53..f71c70a897 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1906,15 +1906,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) @@ -1957,7 +1967,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. */ @@ -2116,9 +2126,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) {