From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 2Az5KDhcpmMSLAgAWB0awg (envelope-from ) for ; Fri, 23 Dec 2022 20:56:08 -0500 Received: by simark.ca (Postfix, from userid 112) id 9CBE21E222; Fri, 23 Dec 2022 20:56:08 -0500 (EST) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=Ceqc32ld; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id A05E51E0D3 for ; Fri, 23 Dec 2022 20:56:04 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D96D53858425 for ; Sat, 24 Dec 2022 01:56:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D96D53858425 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1671846963; bh=UEbFLnWv3aU7BcI8QR/hXdBr5ijGORWmHkBO2qLwk2I=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=Ceqc32ldQPanJPmwWCwDq23niiveczDLKs3oqZWWJmGhhq4MlCrA+YsmZyQPr58kY 5qIfIGamJdbnKXt+UKWBiFSgp9Bxg5hlIDHwhMdiCbGIHVECZr9UxxKAr3y/aEz7Qg s3Ysc8W/F6aR5FNJZwl+y2fwBgnJRv5v8N3AAJFI= Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id A68273858D1E for ; Sat, 24 Dec 2022 01:55:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A68273858D1E Received: by smtp.gentoo.org (Postfix, from userid 559) id 5762433BF41; Sat, 24 Dec 2022 01:55:42 +0000 (UTC) To: gdb-patches@sourceware.org Subject: [PATCH] sim: or1k: move arch-specific settings to internal header Date: Fri, 23 Dec 2022 20:55:39 -0500 Message-Id: <20221224015539.8804-1-vapier@gentoo.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20221223060713.28821-1-vapier@gentoo.org> References: <20221223060713.28821-1-vapier@gentoo.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Mike Frysinger via Gdb-patches Reply-To: Mike Frysinger Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" There's no need for these settings to be in sim-main.h which is shared with common/ sim code, so move it all out to the existing or1k-sim.h. Unfortunately, we can't yet drop the or1k-sim.h include from sim-main.h as many of the generated CGEN files refer only to sim-main.h. We'll have to improve the CGEN interface before we can make more progress, but this is at least a minor improvement. --- sim/or1k/or1k-sim.h | 27 +++++++++++++++++++++++++++ sim/or1k/sim-main.h | 32 ++------------------------------ sim/or1k/traps.c | 1 + 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/sim/or1k/or1k-sim.h b/sim/or1k/or1k-sim.h index 417272033cd1..61d542fcf7c8 100644 --- a/sim/or1k/or1k-sim.h +++ b/sim/or1k/or1k-sim.h @@ -89,4 +89,31 @@ USI or1k32bf_make_load_store_addr (sim_cpu *current_cpu, USI base, SI offset, USI or1k32bf_ff1 (sim_cpu *current_cpu, USI val); USI or1k32bf_fl1 (sim_cpu *current_cpu, USI val); +#define OR1K_DEFAULT_MEM_SIZE 0x800000 /* 8M */ + +struct or1k_sim_cpu +{ + OR1K_MISC_PROFILE or1k_misc_profile; +#define CPU_OR1K_MISC_PROFILE(cpu) (& OR1K_SIM_CPU (cpu)->or1k_misc_profile) + + /* CPU specific parts go here. + Note that in files that don't need to access these pieces WANT_CPU_FOO + won't be defined and thus these parts won't appear. This is ok in the + sense that things work. It is a source of bugs though. + One has to of course be careful to not take the size of this + struct and no structure members accessed in non-cpu specific files can + go after here. Oh for a better language. */ + UWI spr[NUM_SPR]; + + /* Next instruction will be in delay slot. */ + BI next_delay_slot; + /* Currently in delay slot. */ + BI delay_slot; + +#ifdef WANT_CPU_OR1K32BF + OR1K32BF_CPU_DATA cpu_data; +#endif +}; +#define OR1K_SIM_CPU(cpu) ((struct or1k_sim_cpu *) CPU_ARCH_DATA (cpu)) + #endif /* OR1K_SIM_H */ diff --git a/sim/or1k/sim-main.h b/sim/or1k/sim-main.h index 24c8ddb0e31a..7dd3e9a66550 100644 --- a/sim/or1k/sim-main.h +++ b/sim/or1k/sim-main.h @@ -21,42 +21,14 @@ #define WITH_SCACHE_PBB 1 -#include "ansidecl.h" #include "or1k-desc.h" #include "or1k-opc.h" #include "sim-basics.h" #include "arch.h" #include "sim-base.h" -#include "sim-fpu.h" - #include "cgen-sim.h" -#include "or1k-sim.h" -#define OR1K_DEFAULT_MEM_SIZE 0x800000 /* 8M */ - -struct or1k_sim_cpu -{ - OR1K_MISC_PROFILE or1k_misc_profile; -#define CPU_OR1K_MISC_PROFILE(cpu) (& OR1K_SIM_CPU (cpu)->or1k_misc_profile) - - /* CPU specific parts go here. - Note that in files that don't need to access these pieces WANT_CPU_FOO - won't be defined and thus these parts won't appear. This is ok in the - sense that things work. It is a source of bugs though. - One has to of course be careful to not take the size of this - struct and no structure members accessed in non-cpu specific files can - go after here. Oh for a better language. */ - UWI spr[NUM_SPR]; - - /* Next instruction will be in delay slot. */ - BI next_delay_slot; - /* Currently in delay slot. */ - BI delay_slot; - -#ifdef WANT_CPU_OR1K32BF - OR1K32BF_CPU_DATA cpu_data; -#endif -}; -#define OR1K_SIM_CPU(cpu) ((struct or1k_sim_cpu *) CPU_ARCH_DATA (cpu)) +/* TODO: Move this to the CGEN generated files instead. */ +#include "or1k-sim.h" #endif /* SIM_MAIN_H */ diff --git a/sim/or1k/traps.c b/sim/or1k/traps.c index 97e81f41e7da..6fe94d88abd6 100644 --- a/sim/or1k/traps.c +++ b/sim/or1k/traps.c @@ -23,6 +23,7 @@ #define WANT_CPU #include "sim-main.h" +#include "sim-fpu.h" #include "sim-signal.h" #include "cgen-ops.h" -- 2.39.0