From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id 8A32A3858D1E for ; Sun, 25 Dec 2022 07:14:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8A32A3858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org Received: by smtp.gentoo.org (Postfix, from userid 559) id 19FC1340F90; Sun, 25 Dec 2022 07:14:51 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH 6/9] sim: msp430: add basic SMP cpu init Date: Sun, 25 Dec 2022 02:14:31 -0500 Message-Id: <20221225071434.30014-6-vapier@gentoo.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20221225071434.30014-1-vapier@gentoo.org> References: <20221225071434.30014-1-vapier@gentoo.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00,GIT_PATCH_0,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: There's no need to assert there's only 1 CPU when setting them all up here is trivial. --- sim/msp430/msp430-sim.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/sim/msp430/msp430-sim.c b/sim/msp430/msp430-sim.c index d402be77eb40..e7b58bab1347 100644 --- a/sim/msp430/msp430-sim.c +++ b/sim/msp430/msp430-sim.c @@ -116,6 +116,7 @@ sim_open (SIM_OPEN_KIND kind, SIM_DESC sd = sim_state_alloc (kind, callback); struct msp430_cpu_state *msp430_cpu; char c; + int i; /* Initialise the simulator. */ @@ -141,11 +142,6 @@ sim_open (SIM_OPEN_KIND kind, return 0; } - CPU_PC_FETCH (STATE_CPU (sd, 0)) = msp430_pc_fetch; - CPU_PC_STORE (STATE_CPU (sd, 0)) = msp430_pc_store; - CPU_REG_FETCH (STATE_CPU (sd, 0)) = msp430_reg_fetch; - CPU_REG_STORE (STATE_CPU (sd, 0)) = msp430_reg_store; - /* Allocate memory if none specified by user. Note - these values match the memory regions in the libgloss/msp430/msp430[xl]-sim.ld scripts. */ if (sim_core_read_buffer (sd, STATE_CPU (sd, 0), read_map, &c, 0x2, 1) == 0) @@ -180,13 +176,21 @@ sim_open (SIM_OPEN_KIND kind, } /* CPU specific initialization. */ - assert (MAX_NR_PROCESSORS == 1); - - msp430_cpu = MSP430_SIM_CPU (STATE_CPU (sd, 0)); - msp430_cpu->cio_breakpoint = trace_sym_value (sd, "C$$IO$$"); - msp430_cpu->cio_buffer = trace_sym_value (sd, "__CIOBUF__"); - if (msp430_cpu->cio_buffer == -1) - msp430_cpu->cio_buffer = trace_sym_value (sd, "_CIOBUF_"); + for (i = 0; i < MAX_NR_PROCESSORS; ++i) + { + SIM_CPU *cpu = STATE_CPU (sd, i); + + CPU_PC_FETCH (cpu) = msp430_pc_fetch; + CPU_PC_STORE (cpu) = msp430_pc_store; + CPU_REG_FETCH (cpu) = msp430_reg_fetch; + CPU_REG_STORE (cpu) = msp430_reg_store; + + msp430_cpu = MSP430_SIM_CPU (cpu); + msp430_cpu->cio_breakpoint = trace_sym_value (sd, "C$$IO$$"); + msp430_cpu->cio_buffer = trace_sym_value (sd, "__CIOBUF__"); + if (msp430_cpu->cio_buffer == -1) + msp430_cpu->cio_buffer = trace_sym_value (sd, "_CIOBUF_"); + } return sd; } -- 2.39.0