From patchwork Thu Oct 26 00:14:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 738272 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp559107wrq; Wed, 25 Oct 2023 17:38:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGtmN+LfkDT1TJ56OGT2ofDmmw1s+e8JGPFo5FXMHWRjxmLmSct6TCV+RF6U8wpZLmpqIUg X-Received: by 2002:a05:6402:3506:b0:540:bf39:bf72 with SMTP id b6-20020a056402350600b00540bf39bf72mr4015402edd.25.1698280697036; Wed, 25 Oct 2023 17:38:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280697; cv=none; d=google.com; s=arc-20160816; b=sABtaHlF+ktV6uW2YuGDQPctpls3yugkNSJ0b1yNZQezX0Hjdzn0YCRbsoONNWAPnK ojlN+pnMZWUxyW8hc/29ox/0SNMDeX1drqpfu8/vMti0AVrn5f5QvQoLp0hLVwM2dXUg FXGjr1YHOpUQCSQwow7wnLfKSDGrjCxYdP0mNhG28kfBHxLX123TzQGY/P8NcVzjb+Ca ELr4FlWgaTCpD0Bek9cxnCUIcnQ+4I3E2ApFIyfEujrTNGIn18Q6/ec9mL5DDIX0AXSR 2tiRM8kIdzVfLzU64gx4tlHT7glKP/facSVf+Fd+WUXYefbr1DEDKBEauf7MVhzAP/UF FRkw== 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=aVBY1LYgLUlwFA05aut9PR71PO2vl5OwkfiJRqeU+Ek=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=Kd10iHT7LkqzvKMrvK6sn9RJWZFZloy7YIIbzvdOYrLxmQgXlJ1MnJnJcB/rZLHLYR ZyfXAv2OhayVUYwSuPJcnPd1n2HOcT0hpG+pV7iQraUEjwaC03/Q+hlXGufo6MdN8q61 c9aETLBUs7XcSDLfSlG2+tX9HoGhgGlImP83XyqnOMlCZVMDsoRHdD7dzJK/XEw+h7Dq k5p6Gq6sYvq+0XXtPNY9wrlCIGXX6SAQPzcmclW42yoWoGzV9Y581dLUcPy7JkvCqGAI r7/hL8nOZTV7Wbk2nSPiyTRpXAUwKZDd4N2aQpepfM7YXLT/Ch9OURgBEjpq4RHqU3oJ qobg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HeRqIjo3; 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 m17-20020a50c191000000b00530893136fcsi3974508edf.18.2023.10.25.17.38.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:38:17 -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=HeRqIjo3; 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 1qvo6q-0002H4-4U; Wed, 25 Oct 2023 20:20:24 -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 1qvo6M-0001Sx-At for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:54 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo6I-0006ue-5l for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:54 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1c9a1762b43so2254675ad.1 for ; Wed, 25 Oct 2023 17:19:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279587; x=1698884387; 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=aVBY1LYgLUlwFA05aut9PR71PO2vl5OwkfiJRqeU+Ek=; b=HeRqIjo3R6K476jX+K7LQSjwv/vPFdZbYViQAEkLgIZWNOmflW0SSFlgW0/oZFRsKw H7U3PgpItS3VYgz1KkRXrlCNdwbmja0JXppxz7KMS0NVY3W8Fx4lBZSAAujfGiPlzPJC oIO2wIrrb3IL0Rzm9jimVMkPy9bzfpm6uIG2A92FZk51oIdVl1waeta/5s8vnPwHKwlf XkDAcM2jZNytZKKMmZpMpmP27IZJ/Mehfi/GNvtBpuQtZZJLqnd5DLW6azQxcMWoNPb+ TVq9xOzhM7/T79ygG1N5hq1O5MswWgt5Kz7WCpOFbhj9fulIwFN457cFPwRfxOR4TfY7 nWKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279587; x=1698884387; 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=aVBY1LYgLUlwFA05aut9PR71PO2vl5OwkfiJRqeU+Ek=; b=U3vjsmEogRsiTVF1Y2tJQrbAc2sqSr7f1LgqtWQZa3wFCWYg5yJJcKyg7HvVMF1Ebf th+qlmbjR1S6NZ1zsyVpKXnBir1gTS8R2y8zQbVaEFcN7QQSJECn4IXmE5zVIyCMV8Z2 Q53JoCJUjt/ZQNH+9/7Mqr2Bza/BPkKmXo3jeyZLRxzgiCHC5tcMzAJUWT5nRiD29DGN JDnynf50/Unl6i7D/acBrC99zwm+NlqJGKGufsqSjs07hFN2cRG6dKVwuM/bx93AplN7 HAPplrzMXKFpurdL7xIyDT1NGvu1Us8cXQmf276GW35X2eqjTOpJD5nrwl+4A/IJUTVJ CQbQ== X-Gm-Message-State: AOJu0YxqCOmXogZGCPbUSqVWB2Fz4EioZws3EyhuzUX0Bz3prkrg5SbK bq8CJWmzc8RGYOQZAq+7VGTWvIz3cwVR1a4RDbA= X-Received: by 2002:a17:903:2642:b0:1ca:7439:f74f with SMTP id je2-20020a170903264200b001ca7439f74fmr16448865plb.60.1698279587656; Wed, 25 Oct 2023 17:19:47 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b001c5fc291ef9sm9754655plb.209.2023.10.25.17.19.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:19:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 48/94] target/sparc: Split out resolve_asi Date: Wed, 25 Oct 2023 17:14:56 -0700 Message-Id: <20231026001542.1141412-78-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.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 Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland 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 8faf2c59b2..6c1610486e 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1919,15 +1919,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) @@ -1970,7 +1980,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. */ @@ -2129,9 +2139,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) {