From nobody Tue Dec 24 13:58:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1734711767; cv=none; d=zohomail.com; s=zohoarc; b=CLwey0c9Qakkst7MM8UcfFY2GsckZYpA4yW9nA2P9tpIk0mvh8ZPJkBm6r2s0MOqQjTFwi/i4T7LOQK2fxliItUO3S8oYMEHqAsKnjXxBywr04tn2sX3QG99gSgL6VIn025QfvEiUW5eYDGM6+2Jo9OGLmPC4JiC0NVA+e1mKDc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1734711767; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=cJe0InTlBUAjWEm5xiP9chgyYvTxYPda1BH0conYBG8=; b=L+OIT6WI3KU1jVXgMwcw8GpBFyGpxbDAW6rveVvI19Pkrb67QRryiA0Es9PgMC4b4la6HEYxFl8iXOqwn+am0qW0VTii7mhWOeG5FIy2gn2lEDY8u0xR4IoLbZYp8D1oV8JgmpmMnuRFVL3ZiU90xNFDoQYCItkMKQYzZ5bLyfw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1734711766997328.0501677984222; Fri, 20 Dec 2024 08:22:46 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOfih-0003TL-VF; Fri, 20 Dec 2024 11:19:20 -0500 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 1tOfib-0002ag-AC for qemu-devel@nongnu.org; Fri, 20 Dec 2024 11:19:13 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOfiZ-0008Ef-3J for qemu-devel@nongnu.org; Fri, 20 Dec 2024 11:19:12 -0500 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-4363dc916ceso20263875e9.0 for ; Fri, 20 Dec 2024 08:19:10 -0800 (PST) Received: from localhost.localdomain ([78.196.4.158]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a1c8474a9sm4353134f8f.52.2024.12.20.08.19.08 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 20 Dec 2024 08:19:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734711549; x=1735316349; 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=cJe0InTlBUAjWEm5xiP9chgyYvTxYPda1BH0conYBG8=; b=Augm+EctumBWNE4fvhGKn9LM5N3am0WXEVunz4CnOV37CBGJhJQusguiixpBvkanJn DthbjDRSw7hYYAfGapIF0pm4x5yK2n46crExZEVV0+XxtKMtwyuuul3DsSnD3+0A94FW kUJLk4HLDZc5+JuyUnnjYCvq7yQEpa5QotLR/U3e0F+o6m5PJk0PcuMPRTYOVPJdCdkN KvzBLYMR/KBdUYYkrrE9ofKTo1UZ+/z8URxuKBPO71wQ7LSKFeCsCoqqLmgI8GXRotYG kJlw38atx5UujoW+whjVVsd9TPD1Nt6DYJqg+DuPPhrXoe2RIwfwXy/VGMDHAMHcoP9x EmgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734711549; x=1735316349; 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=cJe0InTlBUAjWEm5xiP9chgyYvTxYPda1BH0conYBG8=; b=RPZ6RfYsvhe1dNxYgANSM7q4yTxDyyuRHFhmLHxLSe5asyABFrAK0laQGS9wkpvd/X OnMcUuVFIQJY8L2vUWKklsAjvqZnIhu0NFNSC5VudA28E35ZY2sn21vsWiOo08KY2Pqh 0chxRFW0fhiBm2ZjWQEIHIC/7+CJu3vvmLWjOYSkMHaITh9wMtd2L4JOGm6DGd9U0jNS Swrk7iPdr2IL/RrO3WK1rYfOe4DU0OnKVfWiWwi9Ep2kVdBws+fBjIp2hhtxkyad+yQL hrVW2+UPQEx+qrO/xPXCaeyXI4E+WNdTO2MAAzKkinlv8SaizduVioapSvmHnas9onTA lQaQ== X-Gm-Message-State: AOJu0YyTmPzT3EABIP/h7ZldTt7qI02e+aLaLBh0taR7kvIbPQFIwqEd NjfpStfEOYuinFjFM/dnXJ3LyFOmqNRvs6ItvQCQoySQs7ztIgvRZYvsOz+t3qRg/rue8ifRRqj c X-Gm-Gg: ASbGncvWSIxBrg9teTIpJnkr7rpEswXlFqqF0Zpro3Npw+ZY327XAtGEQiObfdbFeAn 6oWkxm20x3zJqmoYVuOzgUCcjIU7IFdxBbDwNp41aVSnxD548ovC/CWrkzFP54mkQUCxc9a9bbw tVnDmIe22Fq1cGZyTVU0A8MnIhSSES2TfzE+2URi+FwCh297Eqt+lv71/AW49ZuavMp5gSio4Ng AEgciVVNGbognnfVMQd9qRYLMnl58fJWjmAq223C35uNoAKv+Wr7xBffwVrraiC9SLc9CEkBVY= X-Google-Smtp-Source: AGHT+IFoDTeXW1NM4xi/lTIfL7HuWpqYKL2sO/r/zkfESA2WgD2N6U3CS0auD6IbblnNEemi7UOCMw== X-Received: by 2002:a5d:59a4:0:b0:385:df17:2148 with SMTP id ffacd0b85a97d-38a1a2641b7mr6518026f8f.20.1734711549419; Fri, 20 Dec 2024 08:19:09 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , Peter Maydell Subject: [PULL 43/59] target/sparc: Move sparc_restore_state_to_opc() to cpu.c Date: Fri, 20 Dec 2024 17:15:34 +0100 Message-ID: <20241220161551.89317-44-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241220161551.89317-1-philmd@linaro.org> References: <20241220161551.89317-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=philmd@linaro.org; helo=mail-wm1-x32a.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1734711768385116600 Most targets define their restore_state_to_opc() handler in cpu.c. In order to keep SPARC aligned, move sparc_restore_state_to_opc() from translate.c to cpu.c. Suggested-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Peter Maydell Message-Id: <20241115152053.66442-4-philmd@linaro.org> [PMD: Move definitions to new target/sparc/translate.h] --- target/sparc/cpu.h | 4 ---- target/sparc/translate.h | 17 +++++++++++++++++ target/sparc/cpu.c | 24 ++++++++++++++++++++++++ target/sparc/translate.c | 31 +------------------------------ 4 files changed, 42 insertions(+), 34 deletions(-) create mode 100644 target/sparc/translate.h diff --git a/target/sparc/cpu.h b/target/sparc/cpu.h index e9ccec6175f..5c981234bb3 100644 --- a/target/sparc/cpu.h +++ b/target/sparc/cpu.h @@ -607,12 +607,8 @@ int sparc_cpu_memory_rw_debug(CPUState *cpu, vaddr add= r, uint8_t *buf, int len, bool is_write); #endif =20 - /* translate.c */ void sparc_tcg_init(void); -void sparc_restore_state_to_opc(CPUState *cs, - const TranslationBlock *tb, - const uint64_t *data); =20 /* fop_helper.c */ target_ulong cpu_get_fsr(CPUSPARCState *); diff --git a/target/sparc/translate.h b/target/sparc/translate.h new file mode 100644 index 00000000000..a46fa4f124b --- /dev/null +++ b/target/sparc/translate.h @@ -0,0 +1,17 @@ +/* + * QEMU translation definitions for SPARC + * + * Copyright (c) 2024 Linaro, Ltd + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#ifndef SPARC_TRANSLATION_H +#define SPARC_TRANSLATION_H + +/* Dynamic PC, must exit to main loop. */ +#define DYNAMIC_PC 1 +/* Dynamic PC, one of two values according to jump_pc[T2]. */ +#define JUMP_PC 2 +/* Dynamic PC, may lookup next TB. */ +#define DYNAMIC_PC_LOOKUP 3 + +#endif diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index b11f3248d82..fc0c66afecf 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -27,6 +27,7 @@ #include "qapi/visitor.h" #include "tcg/tcg.h" #include "fpu/softfloat.h" +#include "target/sparc/translate.h" =20 //#define DEBUG_FEATURES =20 @@ -751,6 +752,29 @@ void cpu_get_tb_cpu_state(CPUSPARCState *env, vaddr *p= c, *pflags =3D flags; } =20 +static void sparc_restore_state_to_opc(CPUState *cs, + const TranslationBlock *tb, + const uint64_t *data) +{ + CPUSPARCState *env =3D cpu_env(cs); + target_ulong pc =3D data[0]; + target_ulong npc =3D data[1]; + + env->pc =3D pc; + if (npc =3D=3D DYNAMIC_PC) { + /* dynamic NPC: already stored */ + } else if (npc & JUMP_PC) { + /* jump PC: use 'cond' and the jump targets of the translation */ + if (env->cond) { + env->npc =3D npc & ~3; + } else { + env->npc =3D pc + 4; + } + } else { + env->npc =3D npc; + } +} + static bool sparc_cpu_has_work(CPUState *cs) { return (cs->interrupt_request & CPU_INTERRUPT_HARD) && diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 322319a1288..ac063772310 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -30,6 +30,7 @@ #include "exec/log.h" #include "fpu/softfloat.h" #include "asi.h" +#include "target/sparc/translate.h" =20 #define HELPER_H "helper.h" #include "exec/helper-info.c.inc" @@ -101,13 +102,6 @@ # define MAXTL_MASK 0 #endif =20 -/* Dynamic PC, must exit to main loop. */ -#define DYNAMIC_PC 1 -/* Dynamic PC, one of two values according to jump_pc[T2]. */ -#define JUMP_PC 2 -/* Dynamic PC, may lookup next TB. */ -#define DYNAMIC_PC_LOOKUP 3 - #define DISAS_EXIT DISAS_TARGET_0 =20 /* global register indexes */ @@ -5881,26 +5875,3 @@ void sparc_tcg_init(void) gregnames[i]); } } - -void sparc_restore_state_to_opc(CPUState *cs, - const TranslationBlock *tb, - const uint64_t *data) -{ - CPUSPARCState *env =3D cpu_env(cs); - target_ulong pc =3D data[0]; - target_ulong npc =3D data[1]; - - env->pc =3D pc; - if (npc =3D=3D DYNAMIC_PC) { - /* dynamic NPC: already stored */ - } else if (npc & JUMP_PC) { - /* jump PC: use 'cond' and the jump targets of the translation */ - if (env->cond) { - env->npc =3D npc & ~3; - } else { - env->npc =3D pc + 4; - } - } else { - env->npc =3D npc; - } -} --=20 2.47.1