From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 4zv0Nuy5+l/mbAAAWB0awg (envelope-from ) for ; Sun, 10 Jan 2021 03:25:16 -0500 Received: by simark.ca (Postfix, from userid 112) id C4D771EE85; Sun, 10 Jan 2021 03:25:16 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_NONE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (unknown [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 EABC71EE1B for ; Sun, 10 Jan 2021 03:25:15 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D84333840C2B; Sun, 10 Jan 2021 08:25:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D84333840C2B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1610267114; bh=vEhWqbV0ek0dGdPUorlIK/JXuk+dsbeNe/7+IiEAlJU=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=uVT+Q0gLDozK2BFvwOjvC2ixleYjoOPV1qIwAhccEbKTClgfu3rhOuhUAvd88Ra2+ wJxEVqdwEWgJxaD+7EwbxZXJAeHClLQQ6rY0xbnsFXLYwLnMHDCj6WYw6oeyeurX4t FNhYYRUcZ7uCRHMDFIKt9Ia1CvPENcX99GcN1uNA= Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id 6FCE93858026 for ; Sun, 10 Jan 2021 08:25:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6FCE93858026 Received: from vapier.lan (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id A9FF633BDBE for ; Sun, 10 Jan 2021 08:25:07 +0000 (UTC) To: gdb-patches@sourceware.org Subject: [PATCH] sim: cgen: move cgen_cpu_max_extra_bytes logic into the common code Date: Sun, 10 Jan 2021 03:25:03 -0500 Message-Id: <20210110082503.20886-1-vapier@gentoo.org> X-Mailer: git-send-email 2.28.0 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@sourceware.org Sender: "Gdb-patches" Every arch handles this the same way, so move it to the common code. This will also make unifying the sim_cpu structure easier. --- sim/arm/wrapper.c | 2 +- sim/avr/interp.c | 2 +- sim/bfin/interp.c | 2 +- sim/bpf/sim-if.c | 3 +-- sim/common/sim-cpu.c | 4 ++++ sim/cr16/interp.c | 2 +- sim/cris/sim-if.c | 2 +- sim/d10v/interp.c | 2 +- sim/frv/sim-if.c | 2 +- sim/ft32/interp.c | 2 +- sim/h8300/compile.c | 2 +- sim/iq2000/sim-if.c | 2 +- sim/lm32/sim-if.c | 2 +- sim/m32r/sim-if.c | 2 +- sim/m68hc11/interp.c | 2 +- sim/mcore/interp.c | 2 +- sim/microblaze/interp.c | 2 +- sim/mips/interp.c | 2 +- sim/mn10300/interp.c | 2 +- sim/moxie/interp.c | 2 +- sim/msp430/msp430-sim.c | 2 +- sim/or1k/sim-if.c | 2 +- sim/pru/interp.c | 2 +- sim/sh/interp.c | 2 +- sim/v850/interp.c | 2 +- 25 files changed, 28 insertions(+), 25 deletions(-) diff --git a/sim/arm/wrapper.c b/sim/arm/wrapper.c index 5fc753a71af2..7f0e1a5a35ef 100644 --- a/sim/arm/wrapper.c +++ b/sim/arm/wrapper.c @@ -800,7 +800,7 @@ sim_open (SIM_OPEN_KIND kind, SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER); /* The cpu data is kept in a separately allocated chunk of memory. */ - if (sim_cpu_alloc_all (sd, 1, /*cgen_cpu_max_extra_bytes ()*/0) != SIM_RC_OK) + if (sim_cpu_alloc_all (sd, 1, 0) != SIM_RC_OK) { free_state (sd); return 0; diff --git a/sim/avr/interp.c b/sim/avr/interp.c index deaf711e1040..837cca6181cd 100644 --- a/sim/avr/interp.c +++ b/sim/avr/interp.c @@ -1685,7 +1685,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb, SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER); /* The cpu data is kept in a separately allocated chunk of memory. */ - if (sim_cpu_alloc_all (sd, 1, /*cgen_cpu_max_extra_bytes ()*/0) != SIM_RC_OK) + if (sim_cpu_alloc_all (sd, 1, 0) != SIM_RC_OK) { free_state (sd); return 0; diff --git a/sim/bfin/interp.c b/sim/bfin/interp.c index e26a8221b20a..0470991a40e7 100644 --- a/sim/bfin/interp.c +++ b/sim/bfin/interp.c @@ -723,7 +723,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback, SIM_DESC sd = sim_state_alloc (kind, callback); /* The cpu data is kept in a separately allocated chunk of memory. */ - if (sim_cpu_alloc_all (sd, 1, /*cgen_cpu_max_extra_bytes ()*/0) != SIM_RC_OK) + if (sim_cpu_alloc_all (sd, 1, 0) != SIM_RC_OK) { free_state (sd); return 0; diff --git a/sim/bpf/sim-if.c b/sim/bpf/sim-if.c index ad75ac4affa6..1d77c4f937d3 100644 --- a/sim/bpf/sim-if.c +++ b/sim/bpf/sim-if.c @@ -122,8 +122,7 @@ sim_open (SIM_OPEN_KIND kind, SIM_DESC sd = sim_state_alloc (kind, callback); - if (sim_cpu_alloc_all (sd, 1, cgen_cpu_max_extra_bytes ()) - != SIM_RC_OK) + if (sim_cpu_alloc_all (sd, 1, 0) != SIM_RC_OK) goto error; if (sim_pre_argv_init (sd, argv[0]) != SIM_RC_OK) diff --git a/sim/common/sim-cpu.c b/sim/common/sim-cpu.c index a00846cd4c6a..a7aa13e6fb2b 100644 --- a/sim/common/sim-cpu.c +++ b/sim/common/sim-cpu.c @@ -43,6 +43,10 @@ sim_cpu_alloc_all (SIM_DESC sd, int ncpus, int extra_bytes) sim_cpu * sim_cpu_alloc (SIM_DESC sd, int extra_bytes) { +#ifdef CGEN_ARCH + extra_bytes += cgen_cpu_max_extra_bytes (); +#endif + return zalloc (sizeof (sim_cpu) + extra_bytes); } diff --git a/sim/cr16/interp.c b/sim/cr16/interp.c index cff7b8857189..fb63b1954cc1 100644 --- a/sim/cr16/interp.c +++ b/sim/cr16/interp.c @@ -397,7 +397,7 @@ sim_open (SIM_OPEN_KIND kind, struct host_callback_struct *cb, SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER); /* The cpu data is kept in a separately allocated chunk of memory. */ - if (sim_cpu_alloc_all (sd, 1, /*cgen_cpu_max_extra_bytes ()*/0) != SIM_RC_OK) + if (sim_cpu_alloc_all (sd, 1, 0) != SIM_RC_OK) { free_state (sd); return 0; diff --git a/sim/cris/sim-if.c b/sim/cris/sim-if.c index b8c7cb2a96e7..3e1bff0de6c3 100644 --- a/sim/cris/sim-if.c +++ b/sim/cris/sim-if.c @@ -661,7 +661,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback, struct bfd *abfd, bfd_byte sp_init[4] = {0, 0, 0, 0}; /* The cpu data is kept in a separately allocated chunk of memory. */ - if (sim_cpu_alloc_all (sd, 1, cgen_cpu_max_extra_bytes ()) != SIM_RC_OK) + if (sim_cpu_alloc_all (sd, 1, 0) != SIM_RC_OK) { free_state (sd); return 0; diff --git a/sim/d10v/interp.c b/sim/d10v/interp.c index 5c70b38d9d8f..d0272e816213 100644 --- a/sim/d10v/interp.c +++ b/sim/d10v/interp.c @@ -760,7 +760,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb, SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER); /* The cpu data is kept in a separately allocated chunk of memory. */ - if (sim_cpu_alloc_all (sd, 1, /*cgen_cpu_max_extra_bytes ()*/0) != SIM_RC_OK) + if (sim_cpu_alloc_all (sd, 1, 0) != SIM_RC_OK) { free_state (sd); return 0; diff --git a/sim/frv/sim-if.c b/sim/frv/sim-if.c index 2eb6e6da5f3f..da41f1e97608 100644 --- a/sim/frv/sim-if.c +++ b/sim/frv/sim-if.c @@ -57,7 +57,7 @@ sim_open (kind, callback, abfd, argv) SIM_DESC sd = sim_state_alloc (kind, callback); /* The cpu data is kept in a separately allocated chunk of memory. */ - if (sim_cpu_alloc_all (sd, 1, cgen_cpu_max_extra_bytes ()) != SIM_RC_OK) + if (sim_cpu_alloc_all (sd, 1, 0) != SIM_RC_OK) { free_state (sd); return 0; diff --git a/sim/ft32/interp.c b/sim/ft32/interp.c index 1b3db9bc0082..ecf33054a17c 100644 --- a/sim/ft32/interp.c +++ b/sim/ft32/interp.c @@ -807,7 +807,7 @@ sim_open (SIM_OPEN_KIND kind, SIM_DESC sd = sim_state_alloc (kind, cb); /* The cpu data is kept in a separately allocated chunk of memory. */ - if (sim_cpu_alloc_all (sd, 1, /*cgen_cpu_max_extra_bytes ()*/0) != SIM_RC_OK) + if (sim_cpu_alloc_all (sd, 1, 0) != SIM_RC_OK) { free_state (sd); return 0; diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c index 3a3b2e7241bb..644da035694e 100644 --- a/sim/h8300/compile.c +++ b/sim/h8300/compile.c @@ -4712,7 +4712,7 @@ sim_open (SIM_OPEN_KIND kind, sd = sim_state_alloc (kind, callback); /* The cpu data is kept in a separately allocated chunk of memory. */ - if (sim_cpu_alloc_all (sd, 1, /*cgen_cpu_max_extra_bytes ()*/0) != SIM_RC_OK) + if (sim_cpu_alloc_all (sd, 1, 0) != SIM_RC_OK) { free_state (sd); return 0; diff --git a/sim/iq2000/sim-if.c b/sim/iq2000/sim-if.c index 238ec97e47db..95796704081b 100644 --- a/sim/iq2000/sim-if.c +++ b/sim/iq2000/sim-if.c @@ -61,7 +61,7 @@ sim_open (kind, callback, abfd, argv) SIM_DESC sd = sim_state_alloc (kind, callback); /* The cpu data is kept in a separately allocated chunk of memory. */ - if (sim_cpu_alloc_all (sd, 1, cgen_cpu_max_extra_bytes ()) != SIM_RC_OK) + if (sim_cpu_alloc_all (sd, 1, 0) != SIM_RC_OK) { free_state (sd); return 0; diff --git a/sim/lm32/sim-if.c b/sim/lm32/sim-if.c index cbe975113b3d..14d120545eb6 100644 --- a/sim/lm32/sim-if.c +++ b/sim/lm32/sim-if.c @@ -94,7 +94,7 @@ sim_open (kind, callback, abfd, argv) unsigned long base, limit; /* The cpu data is kept in a separately allocated chunk of memory. */ - if (sim_cpu_alloc_all (sd, 1, cgen_cpu_max_extra_bytes ()) != SIM_RC_OK) + if (sim_cpu_alloc_all (sd, 1, 0) != SIM_RC_OK) { free_state (sd); return 0; diff --git a/sim/m32r/sim-if.c b/sim/m32r/sim-if.c index c25d9a859c2c..3525259c328d 100644 --- a/sim/m32r/sim-if.c +++ b/sim/m32r/sim-if.c @@ -63,7 +63,7 @@ sim_open (kind, callback, abfd, argv) int i; /* The cpu data is kept in a separately allocated chunk of memory. */ - if (sim_cpu_alloc_all (sd, 1, cgen_cpu_max_extra_bytes ()) != SIM_RC_OK) + if (sim_cpu_alloc_all (sd, 1, 0) != SIM_RC_OK) { free_state (sd); return 0; diff --git a/sim/m68hc11/interp.c b/sim/m68hc11/interp.c index 26f2d1527beb..93641b2a205a 100644 --- a/sim/m68hc11/interp.c +++ b/sim/m68hc11/interp.c @@ -404,7 +404,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback, SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER); /* The cpu data is kept in a separately allocated chunk of memory. */ - if (sim_cpu_alloc_all (sd, 1, /*cgen_cpu_max_extra_bytes ()*/0) != SIM_RC_OK) + if (sim_cpu_alloc_all (sd, 1, 0) != SIM_RC_OK) { free_state (sd); return 0; diff --git a/sim/mcore/interp.c b/sim/mcore/interp.c index 9981517e1e69..5f17bbd88a53 100644 --- a/sim/mcore/interp.c +++ b/sim/mcore/interp.c @@ -1349,7 +1349,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb, SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER); /* The cpu data is kept in a separately allocated chunk of memory. */ - if (sim_cpu_alloc_all (sd, 1, /*cgen_cpu_max_extra_bytes ()*/0) != SIM_RC_OK) + if (sim_cpu_alloc_all (sd, 1, 0) != SIM_RC_OK) { free_state (sd); return 0; diff --git a/sim/microblaze/interp.c b/sim/microblaze/interp.c index 5b125a64da27..b3d1a849db1a 100644 --- a/sim/microblaze/interp.c +++ b/sim/microblaze/interp.c @@ -393,7 +393,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb, SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER); /* The cpu data is kept in a separately allocated chunk of memory. */ - if (sim_cpu_alloc_all (sd, 1, /*cgen_cpu_max_extra_bytes ()*/0) != SIM_RC_OK) + if (sim_cpu_alloc_all (sd, 1, 0) != SIM_RC_OK) { free_state (sd); return 0; diff --git a/sim/mips/interp.c b/sim/mips/interp.c index 9dbac8c58fc7..13fe58645236 100644 --- a/sim/mips/interp.c +++ b/sim/mips/interp.c @@ -357,7 +357,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb, SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER); /* The cpu data is kept in a separately allocated chunk of memory. */ - if (sim_cpu_alloc_all (sd, 1, /*cgen_cpu_max_extra_bytes ()*/0) != SIM_RC_OK) + if (sim_cpu_alloc_all (sd, 1, 0) != SIM_RC_OK) return 0; cpu = STATE_CPU (sd, 0); /* FIXME */ diff --git a/sim/mn10300/interp.c b/sim/mn10300/interp.c index 7f0655f3f472..376243edf0e4 100644 --- a/sim/mn10300/interp.c +++ b/sim/mn10300/interp.c @@ -103,7 +103,7 @@ sim_open (SIM_OPEN_KIND kind, SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER); /* The cpu data is kept in a separately allocated chunk of memory. */ - if (sim_cpu_alloc_all (sd, 1, /*cgen_cpu_max_extra_bytes ()*/0) != SIM_RC_OK) + if (sim_cpu_alloc_all (sd, 1, 0) != SIM_RC_OK) return 0; /* for compatibility */ diff --git a/sim/moxie/interp.c b/sim/moxie/interp.c index f895af6f1bb4..7d04bd22d1e4 100644 --- a/sim/moxie/interp.c +++ b/sim/moxie/interp.c @@ -1197,7 +1197,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb, SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER); /* The cpu data is kept in a separately allocated chunk of memory. */ - if (sim_cpu_alloc_all (sd, 1, /*cgen_cpu_max_extra_bytes ()*/0) != SIM_RC_OK) + if (sim_cpu_alloc_all (sd, 1, 0) != SIM_RC_OK) { free_state (sd); return 0; diff --git a/sim/msp430/msp430-sim.c b/sim/msp430/msp430-sim.c index ea7a157231cf..982fc9fd5c0d 100644 --- a/sim/msp430/msp430-sim.c +++ b/sim/msp430/msp430-sim.c @@ -110,7 +110,7 @@ sim_open (SIM_OPEN_KIND kind, /* Initialise the simulator. */ - if (sim_cpu_alloc_all (sd, 1, /*cgen_cpu_max_extra_bytes ()*/0) != SIM_RC_OK) + if (sim_cpu_alloc_all (sd, 1, 0) != SIM_RC_OK) { sim_state_free (sd); return 0; diff --git a/sim/or1k/sim-if.c b/sim/or1k/sim-if.c index 18f70387063f..e022c7eab61b 100644 --- a/sim/or1k/sim-if.c +++ b/sim/or1k/sim-if.c @@ -166,7 +166,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback, struct bfd *abfd, int i; /* The cpu data is kept in a separately allocated chunk of memory. */ - if (sim_cpu_alloc_all (sd, 1, cgen_cpu_max_extra_bytes ()) != SIM_RC_OK) + if (sim_cpu_alloc_all (sd, 1, 0) != SIM_RC_OK) { free_state (sd); return 0; diff --git a/sim/pru/interp.c b/sim/pru/interp.c index 2933075bd08f..090a28537d4b 100644 --- a/sim/pru/interp.c +++ b/sim/pru/interp.c @@ -744,7 +744,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb, SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER); /* The cpu data is kept in a separately allocated chunk of memory. */ - if (sim_cpu_alloc_all (sd, 1, /*cgen_cpu_max_extra_bytes ()*/0) != SIM_RC_OK) + if (sim_cpu_alloc_all (sd, 1, 0) != SIM_RC_OK) { free_state (sd); return 0; diff --git a/sim/sh/interp.c b/sim/sh/interp.c index c77cf3b1d3bf..2267bedfb8b8 100644 --- a/sim/sh/interp.c +++ b/sim/sh/interp.c @@ -2373,7 +2373,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb, SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER); /* The cpu data is kept in a separately allocated chunk of memory. */ - if (sim_cpu_alloc_all (sd, 1, /*cgen_cpu_max_extra_bytes ()*/0) != SIM_RC_OK) + if (sim_cpu_alloc_all (sd, 1, 0) != SIM_RC_OK) { free_state (sd); return 0; diff --git a/sim/v850/interp.c b/sim/v850/interp.c index daf961801768..7a9fabae2834 100644 --- a/sim/v850/interp.c +++ b/sim/v850/interp.c @@ -204,7 +204,7 @@ sim_open (SIM_OPEN_KIND kind, SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER); /* The cpu data is kept in a separately allocated chunk of memory. */ - if (sim_cpu_alloc_all (sd, 1, /*cgen_cpu_max_extra_bytes ()*/0) != SIM_RC_OK) + if (sim_cpu_alloc_all (sd, 1, 0) != SIM_RC_OK) return 0; /* for compatibility */ -- 2.28.0