From: Mike Frysinger <vapier@gentoo.org>
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 [thread overview]
Message-ID: <20221225071434.30014-6-vapier@gentoo.org> (raw)
In-Reply-To: <20221225071434.30014-1-vapier@gentoo.org>
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
next prev parent reply other threads:[~2022-12-25 7:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-25 7:14 [PATCH 1/9] sim: cpu: fix SMP msg prefix helper Mike Frysinger
2022-12-25 7:14 ` [PATCH 2/9] sim: mn10300: fix SMP compile Mike Frysinger
2022-12-25 7:14 ` [PATCH 3/9] sim: or1k: fix iterator typo when setting up cpus Mike Frysinger
2022-12-25 7:14 ` [PATCH 4/9] sim: v850: fix SMP compile Mike Frysinger
2022-12-25 7:14 ` [PATCH 5/9] sim: m32r: fix iterator typo when setting up cpus Mike Frysinger
2022-12-25 7:14 ` Mike Frysinger [this message]
2022-12-25 7:14 ` [PATCH 7/9] sim: cpu: change default init to handle all cpus Mike Frysinger
2022-12-25 7:14 ` [PATCH 8/9] sim: smp: make option available again Mike Frysinger
2022-12-25 7:14 ` [PATCH 9/9] sim: smp: plumb igen flag down to all users Mike Frysinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221225071434.30014-6-vapier@gentoo.org \
--to=vapier@gentoo.org \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).