From nobody Sat Nov 23 19:34:47 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=1731684142; cv=none; d=zohomail.com; s=zohoarc; b=hG5bcpF7NoUmSMu6Pz5df3Pxsa1mv90YeNpZ1g9ZhXqGT+GhKDRwJRAVtif/ccbgFHsJteq91Draua3FMaciHiL7+kI8/nlUU/1NOYEKNzCWrk6yiEqWsP15t2XO5PnlD14eDdvigoVHyzIA5oHhcgxkyIZx2WBLPAfakfdwv8s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731684142; 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=LzsaTbH/TKzp8tqs/UlH1bp9VqSjjTrJOViR/Wph0HQ=; b=n4kMn5W9e/n6EyRFBf2nRvW3mpivlllCx2JLAeBnpVJ7q46zMUMD+vrrOg5gG/lRUvER/PO2CeojuAmrhKxc5CcWV5DB846gQoLKBaYLpLqm332RU5IjHj4YAJNLNi1uq6EapPu/6pgB9QcikUd6XZ4mhd0d8Q35m39LLJFMqGw= 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 1731684142434863.9454066122679; Fri, 15 Nov 2024 07:22:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBy8K-0001oX-E8; Fri, 15 Nov 2024 10:21:16 -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 1tBy8J-0001oM-DC for qemu-devel@nongnu.org; Fri, 15 Nov 2024 10:21:15 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tBy8H-00045H-QW for qemu-devel@nongnu.org; Fri, 15 Nov 2024 10:21:15 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4314fa33a35so15834675e9.1 for ; Fri, 15 Nov 2024 07:21:13 -0800 (PST) Received: from localhost.localdomain ([176.187.214.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432dac0ae45sm57136675e9.30.2024.11.15.07.21.09 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Nov 2024 07:21:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731684071; x=1732288871; 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=LzsaTbH/TKzp8tqs/UlH1bp9VqSjjTrJOViR/Wph0HQ=; b=SSD8KP13PVIm5XMoKG/p7LRjIqGP3pT9fqdQ/xNTpYWlW63kQxSwdBMIVd30QPix/u 9E68mf5o0r1nwz86983LC9mHBr0Cl18v4J5U7cBKeJEONXOK5GWF09xFK9skTf7x/S3v Y72Hn6+CoPM7FNIwpv7D6IKtN3p3epT5rT1Dk7ULi0vRtE/TI611+9Q1dOWXa3zK44X1 d3XEc5S5DpJQyugPDvIbdTmTb35AsH942oH5w5gXwkilxsuNLEOB1lvYooN1+Ui8ztEs eDBoXNAwy9aNtOlnp7BdYi03ZNsJ6FKtQCWfpXlbKWmkczsCQf9z0PTv64yV98UTMUS5 FoPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731684071; x=1732288871; 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=LzsaTbH/TKzp8tqs/UlH1bp9VqSjjTrJOViR/Wph0HQ=; b=az9Sz/++sJpukaoCBHzW15QBihKwrMP3FXb33GSpQLRNUN9abjmXBa3OXRbXSJRtrP mrOV5SiHzLdlt3vsLkjps5ZeQIynk5+Tq2d9VBApcpOSJ0Jl4WGccbxqiScjp0pNSGiY OrVNOj0DYxrB8Jvrko2JaHs2/8icWL1C2mb7sblwhqEMyiz8p90TaluLG9Hwn4gdsQ+n 7LmbPImsHRf/vQIxOHa5aUYPKC5NlLFNd8QsiQpXvpQ9ZU0Uu382W/mPaf9sMoSCX0pC sxQm3PxvtyZR3ytpJb3w6tyABfj5OHkG9gsHg+wfkskZAe47fcdtL9yov02WFeVBFTVb 7Oug== X-Gm-Message-State: AOJu0Yytw5jQnKgBsr26sinlzcMxJIA6Wcf9ytjmm3KvYpUSsQeH+udb QmBsrDhQCJY9YwPgK8IfkCExcEPHXHLFbkK2IW5tn6V1f3AyZR5pGX0XKAH7Li+tDWfK3U1qZs7 y X-Google-Smtp-Source: AGHT+IF3yC99cTCgXvfRbDp7cGVEg27uPQx9XuZipM7vsZvLqMT12uoo+ojpjZ8Virl5ejx+xIh1FA== X-Received: by 2002:a05:600c:4595:b0:42c:b80e:5e50 with SMTP id 5b1f17b1804b1-432df67991emr26832545e9.0.1731684070978; Fri, 15 Nov 2024 07:21:10 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 03/10] target/sparc: Move sparc_restore_state_to_opc() to cpu.c Date: Fri, 15 Nov 2024 16:20:46 +0100 Message-ID: <20241115152053.66442-4-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241115152053.66442-1-philmd@linaro.org> References: <20241115152053.66442-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::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.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: 1731684144647116600 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 --- target/sparc/cpu.h | 11 ++++++++--- target/sparc/cpu.c | 23 +++++++++++++++++++++++ target/sparc/translate.c | 32 -------------------------------- 3 files changed, 31 insertions(+), 35 deletions(-) diff --git a/target/sparc/cpu.h b/target/sparc/cpu.h index f517e5a383..bcb3566a92 100644 --- a/target/sparc/cpu.h +++ b/target/sparc/cpu.h @@ -607,12 +607,17 @@ int sparc_cpu_memory_rw_debug(CPUState *cpu, vaddr ad= dr, uint8_t *buf, int len, bool is_write); #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 /* 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/cpu.c b/target/sparc/cpu.c index dd7af86de7..59db8c8472 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -713,6 +713,29 @@ static void sparc_cpu_synchronize_from_tb(CPUState *cs, cpu->env.npc =3D tb->cs_base; } =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 cdd0a95c03..9942e78412 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -101,15 +101,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 - /* global register indexes */ static TCGv_ptr cpu_regwptr; static TCGv cpu_pc, cpu_npc; @@ -5881,26 +5872,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.45.2