From patchwork Tue Oct 17 06:11:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734264 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp322467wro; Mon, 16 Oct 2023 23:14:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGWQOyAVWSAMh02FDAoiwfPErTLvnTxgcFlA//Wo/qT8c5RGdw2AIyT3Ckzedsym6qLUUpF X-Received: by 2002:a05:620a:2452:b0:76e:f496:1930 with SMTP id h18-20020a05620a245200b0076ef4961930mr1527292qkn.43.1697523291488; Mon, 16 Oct 2023 23:14:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523291; cv=none; d=google.com; s=arc-20160816; b=pCy7edBQs+7JYsy9Lw9/Fr3zDKhgOgS5xHwxC4WGj1PpPof4yzF1VVqnBl7l12PB2S cytYx2c+eb7aSrnSwQ3zhqN2RkasHwVa4l2dfeSBZoesaJQdYc1D6LzxEk7bQt+/hNu9 6LCmb2/exkxTm6e7S6kxQaOU0dAZHZGA0S4FneTZ8NNd+LSkxLbkZl+D71qCfiPwHebK ak22dWOiJxIH5CHylu7kqlYNNrC2Kc0GsGiYRO5rRqk2S+VjcH15cUFuG5btVEjWtPoD ZuUc1+EZO1N0H0SUnkv+T6JalEm9RcTvwXwVeceCoDtYLWam63lxb/dKzvYY5aUz9YTn 4Hyw== 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=oQP6a6MxMoaNROE6UWCMRh+qyHbWDId1yiJtSMIXUyE=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=VRkpLsmbSIst8t5Ja4R4UfOIfDCwBeCwpEzxJ4eOqRJHNberfodZSDvmbsLmX4QXl6 JplPoXYb/WgCLl/YJrlVPRaPaCiYEGUPkX3LezClO9jldP5LTp6aAnKWUI7zaZgFRHtv hgGx9OOFIDAHfvlydXYMrxZWloO6OdaSt7zw4lTkUMQZreqzrCxNK2GhA5qIW160IXs4 qDCvaGHPOEgkcB6uR4FEUTtlb6tk9L8MY3vlFlb+qDbGTrRX4BbbMWYdvdF7NttH3W0z MA0/mkeI1kFEhAV+SjIX5FFlamg3l6uSoHPmqx3vnxXZDsEk9dT3TJoPmWnd8Q8w1yZz C8zA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BLWVTNbv; 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 q8-20020a05620a024800b007788bb3ee9esi63276qkn.554.2023.10.16.23.14.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:14: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=BLWVTNbv; 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 1qsdKM-0000e9-DT; Tue, 17 Oct 2023 02:13:14 -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 1qsdKK-0000aK-At for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:12 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdKI-0003ug-CB for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:12 -0400 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1bdf4752c3cso31197325ad.2 for ; Mon, 16 Oct 2023 23:13:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523187; x=1698127987; 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=oQP6a6MxMoaNROE6UWCMRh+qyHbWDId1yiJtSMIXUyE=; b=BLWVTNbv3B7o/3PUIbpXDimLSYS5IayzhWr+IxESXaswlgCLYc1dIJgQstlJkNLNyq nW7cVnUEedss44W8+1btwD5SHG0iLACaPXdCD6nKYMO2LA5ic10PVurYy8foOZtlgocH gvaFlhO+54sUlrq5Wrfy/kCqnteziYOXVdFLB+SIII+XdElUwXWVj2A6KgQNpfvGIUPe 81sWbbv40mctpV+02dWbTxrarTnJpaPDaiCAOkEcqF8XcKRIMRgQB2s1khrPLRh/tPRc S8mIV5/aNxtegP8W5kX4cTjVY0WcTg2LL1mPDIvxwk8uPH75COV2Wjfjmw5n4xeUnHU/ MEdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523187; x=1698127987; 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=oQP6a6MxMoaNROE6UWCMRh+qyHbWDId1yiJtSMIXUyE=; b=o9Zjqz0j63j95a7gxyF54bqopqen9Sml5huJ7+NMr4JBDv0soIN5P0sfKpftRX5HSp utGZwU6YnASwWNt/Iy0ZPiP12uyGIL8tqW9Fb8B/et9+aGPVuaqUk1qZRVYH1pkv0FFv h7aToBl+9CTtcQEBifqkqILF3E/xgSs392h1u7PHBka/e5rNDWP0fSX8xoRPhj1OStp8 rtPmoDck74fyaLLyvLwu0Ux0iD2mb+vFU3Mkf7YuxQJVK3Hnm2ttfrVHQd4RpZogcBSV dVJPtj1hapkTchbbSb6yrdohr0gDfV7hnyMnhU9P5LfRXlMFdsMGD0TVjF8aFpx+COIg FL2w== X-Gm-Message-State: AOJu0YzB23eM6JUyIz44PVQF0NDB4BexILPCW2R1ABuIrJzltLf3l6TX 6azNwA0LXzT0ef/KQQB+xzlIzFB4KnKVqWFgj9E= X-Received: by 2002:a17:902:f543:b0:1ca:9934:d014 with SMTP id h3-20020a170902f54300b001ca9934d014mr557655plf.10.1697523187680; Mon, 16 Oct 2023 23:13:07 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.13.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:13:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 26/90] target/sparc: Move WRPSR, SAVED, RESTORED to decodetree Date: Mon, 16 Oct 2023 23:11:40 -0700 Message-Id: <20231017061244.681584-27-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x630.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/insns.decode | 10 +++++++ target/sparc/translate.c | 61 ++++++++++++++++++--------------------- 2 files changed, 38 insertions(+), 33 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 6acf0f9403..850b5d58d0 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -85,6 +85,16 @@ RDHPR_htba 10 rd:5 101001 00101 0 0000000000000 RDHPR_hver 10 rd:5 101001 00110 0 0000000000000 RDHPR_hstick_cmpr 10 rd:5 101001 11111 0 0000000000000 +{ + WRPSR 10 00000 110001 ..... . ............. @n_r_ri + SAVED 10 00000 110001 00000 0 0000000000000 +} +RESTORED 10 00001 110001 00000 0 0000000000000 +# UA2005 ALLCLEAN +# UA2005 OTHERW +# UA2005 NORMALW +# UA2005 INVALW + { RDWIM 10 rd:5 101010 00000 0 0000000000000 RDPR_tpc 10 rd:5 101010 00000 0 0000000000000 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 59931c053f..a5058b5931 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -38,6 +38,7 @@ #ifdef TARGET_SPARC64 #define gen_helper_rdpsr(D, E) qemu_build_not_reached() +#define gen_helper_wrpsr(E, S) qemu_build_not_reached() #define gen_helper_power_down(E) g_assert_not_reached() #else #define gen_helper_rdccr(D, E) qemu_build_not_reached() @@ -46,6 +47,8 @@ #define gen_helper_set_softint(E, S) qemu_build_not_reached() #define gen_helper_clear_softint(E, S) qemu_build_not_reached() #define gen_helper_write_softint(E, S) qemu_build_not_reached() +#define gen_helper_saved ({ qemu_build_not_reached(); NULL; }) +#define gen_helper_restored ({ qemu_build_not_reached(); NULL; }) #endif /* Dynamic PC, must exit to main loop. */ @@ -3806,6 +3809,31 @@ static void do_wrpowerdown(DisasContext *dc, TCGv src) TRANS(WRPOWERDOWN, POWERDOWN, do_wr_special, a, supervisor(dc), do_wrpowerdown) +static void do_wrpsr(DisasContext *dc, TCGv src) +{ + gen_helper_wrpsr(tcg_env, src); + tcg_gen_movi_i32(cpu_cc_op, CC_OP_FLAGS); + dc->cc_op = CC_OP_FLAGS; + save_state(dc); + gen_op_next_insn(); + tcg_gen_exit_tb(NULL, 0); + dc->base.is_jmp = DISAS_NORETURN; +} + +TRANS(WRPSR, 32, do_wr_special, a, supervisor(dc), do_wrpsr) + +static bool do_saved_restored(DisasContext *dc, void (*func)(TCGv_env)) +{ + if (!supervisor(dc)) { + return raise_priv(dc); + } + func(tcg_env); + return advance_pc(dc); +} + +TRANS(SAVED, 64, do_saved_restored, gen_helper_saved) +TRANS(RESTORED, 64, do_saved_restored, gen_helper_restored) + static bool trans_NOP_v7(DisasContext *dc, arg_NOP_v7 *a) { /* @@ -4480,39 +4508,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x30: goto illegal_insn; /* WRASR in decodetree */ #if !defined(CONFIG_USER_ONLY) - case 0x31: /* wrpsr, V9 saved, restored */ - { - if (!supervisor(dc)) - goto priv_insn; -#ifdef TARGET_SPARC64 - switch (rd) { - case 0: - gen_helper_saved(tcg_env); - break; - case 1: - gen_helper_restored(tcg_env); - break; - case 2: /* UA2005 allclean */ - case 3: /* UA2005 otherw */ - case 4: /* UA2005 normalw */ - case 5: /* UA2005 invalw */ - // XXX - default: - goto illegal_insn; - } -#else - cpu_tmp0 = tcg_temp_new(); - tcg_gen_xor_tl(cpu_tmp0, cpu_src1, cpu_src2); - gen_helper_wrpsr(tcg_env, cpu_tmp0); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_FLAGS); - dc->cc_op = CC_OP_FLAGS; - save_state(dc); - gen_op_next_insn(); - tcg_gen_exit_tb(NULL, 0); - dc->base.is_jmp = DISAS_NORETURN; -#endif - } - break; case 0x32: /* wrwim, V9 wrpr */ { if (!supervisor(dc))