From 883be197745c9a9ea626cf0671e8bb0109d21a36 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sun, 25 Dec 2022 00:53:25 -0500 Subject: sim: cpu: change default init to handle all cpus All the runtimes were only initializing a single CPU. When SMP is enabled, things quickly crash as none of the other CPU structs are setup. Change the default from 0 to the compile time value. --- sim/common/sim-cpu.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'sim/common') diff --git a/sim/common/sim-cpu.c b/sim/common/sim-cpu.c index 024bd05..9f64d9d 100644 --- a/sim/common/sim-cpu.c +++ b/sim/common/sim-cpu.c @@ -35,8 +35,13 @@ sim_cpu_alloc_all_extra (SIM_DESC sd, int ncpus, size_t extra_bytes) { int c; + /* TODO: This should be a command line option for users to control. */ + if (ncpus == 0) + ncpus = MAX_NR_PROCESSORS; + for (c = 0; c < ncpus; ++c) STATE_CPU (sd, c) = sim_cpu_alloc_extra (sd, extra_bytes); + return SIM_RC_OK; } -- cgit v1.1