From patchwork Mon Oct 24 13:24:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 617880 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp2754321pvb; Mon, 24 Oct 2022 07:20:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6yxAZG6esYAzowXZi6+oDMQUczyIqsJBwoDP4BpynnnaHdZ6DGoMn+MtFSzkIZKcl1DRKF X-Received: by 2002:a05:620a:4447:b0:6c6:c438:1ced with SMTP id w7-20020a05620a444700b006c6c4381cedmr24208031qkp.658.1666621228156; Mon, 24 Oct 2022 07:20:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666621228; cv=none; d=google.com; s=arc-20160816; b=wSGLQ4yqkQGfwqxBtFhR+z/NIOwumMVOV+JpL0mnR+3FqrOdhwjD6TAV5h6stYJrEi 9c0sdXELBfeLEl+PtVe9osSxyi7KiwwTIdgUu/XAPFWcI806bQD33lwyDb87knmufJG8 ZqWlh+1JRi3HpE22djWNZs2ysMMCx17UOa9ObO4TPfpp2PiqM8D9bm2fttsN/r36cCNm u8S6PLuqmIYSb/IAFfx9n8CMxS1S/zptWDoKx/8pwW9NYf6ts2U8lpWZG1YSRi7R8cBa pIDFHgIkpplt2fy42+SqFiZoVJagvSCPsaJ2F6urZlGn1JAuCqACDbQyV+Mg0HFRdFIg b3kQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender: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=Oz6SbhxWMBqT3eH0LGJA5+0yBaJCELCj9GF6rT/F9o0=; b=D/2vf6dCuuLioiEpsaabBdpgv0vsNy1RTT561OpE29nCn7pSp3xY4j07cbnKtVwJbu BlqV6Fi60+wxapAxU1FKnr5vS0lpL5FXlqefTdutVc41L3NzfxrjVdtzwy1plwFkgqV7 sVe0+IBfzdoCIjLe2Ej5D25G0c13JoW9X/EDdEdVLdcAFuhGqTlwqJJ4wcR5kYZ/9nGP QS57MXQD1ql9GPgcvw4CDDNXNY/EpEAAaJ+m/ksq41D9TRpstMz3UTJpqXTsVKXQEDRg 6R0UZDqvYufj+jY2ia/YGAmyhjPJx8X+pdjmkOf/XkS+NlG1E8x7K2KfETyOttRYinVg MElw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="yx/5yQr9"; 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 fo6-20020ad45f06000000b004ad5fa80bc0si41115qvb.298.2022.10.24.07.20.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 Oct 2022 07:20:28 -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="yx/5yQr9"; 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 1omxTJ-0003d8-Ny; Mon, 24 Oct 2022 09:26: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 1omxTB-0003X7-K1 for qemu-devel@nongnu.org; Mon, 24 Oct 2022 09:26:21 -0400 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1omxT8-0004BY-AQ for qemu-devel@nongnu.org; Mon, 24 Oct 2022 09:26:21 -0400 Received: by mail-pj1-x102d.google.com with SMTP id q9-20020a17090a178900b00212fe7c6bbeso3073239pja.4 for ; Mon, 24 Oct 2022 06:26:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=Oz6SbhxWMBqT3eH0LGJA5+0yBaJCELCj9GF6rT/F9o0=; b=yx/5yQr9Z8WKCYyjmPZbdv+QzggBr5pqdKn+rSyHy8PL9iHKACjScUu0c9+oME83x5 0gR+WtQewuOoTgMsSTztcbcx2u/qnE9/mRWMiWdqXDpkY0RQuD5diRbQTryRGfHDQD0c k848wrRy4VvL5jtP+eceNAzH1ujMhbsZ/yxyjxm/o+bL1QIwY3qCca5E4KLGO6Yxo2Jt jaFwBm0YZ9gB615XCGoijz2vzyiMv6OZoKWYX3pz+caoWE3iUx1Iu11ycR/fm9opxZSI 24WN5XczjLVPTHbQ1uc8nOj9XZ2vhkIS2WpBUOY/pf+UKQJ+jO3cVzccoKxb5nyoZjyl 16tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=Oz6SbhxWMBqT3eH0LGJA5+0yBaJCELCj9GF6rT/F9o0=; b=rvwL7MHFYDtopo6LsQkpIkzLFxUCS2MzfBjpFz3bwEu8cXLCzSomDSGsLu0YlPqZkc BsgNsEuhVo+whgI9WP4Vr7wNGAu8VabEkvrM6HCvPksyAZ1Ttz3+D3MLHm57II9ljdw+ qldcFhDm2rQUnITJq1eOOtOOiijrSAd35Je4ndzJAgnFBVVS5/0AEx9E49fVlgHlxWI5 repDbQBQYFlBrALwSS+juJJSlt+E9X0KwWIy5FbpBNIgZPtd4nLETYmZ1Ga1So69Hxlk kaMlQlcdG//Y03uIgAziGdByI4hmWJmITLKu3vdTNuVzTCOzNUMgjXsueFAAUYXskbEU JU1Q== X-Gm-Message-State: ACrzQf01ZVMqXSPuqPCqbKJZLHQj4uZ9n2PV01QN9u0A2MOIzWSXATSm YlcSUVUNS6uRMCtsT7+/eviJQkqgG7RshA== X-Received: by 2002:a17:90b:3a86:b0:20d:616f:4bb6 with SMTP id om6-20020a17090b3a8600b0020d616f4bb6mr75106842pjb.238.1666617976655; Mon, 24 Oct 2022 06:26:16 -0700 (PDT) Received: from stoup.. ([103.100.225.182]) by smtp.gmail.com with ESMTPSA id b12-20020a1709027e0c00b00178ab008364sm17009216plm.37.2022.10.24.06.26.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Oct 2022 06:26:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 27/29] target/openrisc: Use cpu_unwind_state_data for mfspr Date: Mon, 24 Oct 2022 23:24:57 +1000 Message-Id: <20221024132459.3229709-29-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221024132459.3229709-1-richard.henderson@linaro.org> References: <20221024132459.3229709-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102d.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: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Since we do not plan to exit, use cpu_unwind_state_data and extract exactly the data requested. Signed-off-by: Richard Henderson --- target/openrisc/sys_helper.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/target/openrisc/sys_helper.c b/target/openrisc/sys_helper.c index a3508e421d..dde2fa1623 100644 --- a/target/openrisc/sys_helper.c +++ b/target/openrisc/sys_helper.c @@ -199,6 +199,7 @@ target_ulong HELPER(mfspr)(CPUOpenRISCState *env, target_ulong rd, target_ulong spr) { #ifndef CONFIG_USER_ONLY + uint64_t data[TARGET_INSN_START_WORDS]; MachineState *ms = MACHINE(qdev_get_machine()); OpenRISCCPU *cpu = env_archcpu(env); CPUState *cs = env_cpu(env); @@ -232,14 +233,20 @@ target_ulong HELPER(mfspr)(CPUOpenRISCState *env, target_ulong rd, return env->evbar; case TO_SPR(0, 16): /* NPC (equals PC) */ - cpu_restore_state(cs, GETPC(), false); + if (cpu_unwind_state_data(cs, GETPC(), data)) { + return data[0]; + } return env->pc; case TO_SPR(0, 17): /* SR */ return cpu_get_sr(env); case TO_SPR(0, 18): /* PPC */ - cpu_restore_state(cs, GETPC(), false); + if (cpu_unwind_state_data(cs, GETPC(), data)) { + if (data[1] & 2) { + return data[0] - 4; + } + } return env->ppc; case TO_SPR(0, 32): /* EPCR */