14e98e3e1Schristos /* Generic simulator run. 2*88241920Schristos Copyright (C) 1997-2024 Free Software Foundation, Inc. 34e98e3e1Schristos Contributed by Cygnus Support. 44e98e3e1Schristos 54e98e3e1Schristos This file is part of GDB, the GNU debugger. 64e98e3e1Schristos 74e98e3e1Schristos This program is free software; you can redistribute it and/or modify 84e98e3e1Schristos it under the terms of the GNU General Public License as published by 94e98e3e1Schristos the Free Software Foundation; either version 3 of the License, or 104e98e3e1Schristos (at your option) any later version. 114e98e3e1Schristos 124e98e3e1Schristos This program is distributed in the hope that it will be useful, 134e98e3e1Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 144e98e3e1Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 154e98e3e1Schristos GNU General Public License for more details. 164e98e3e1Schristos 174e98e3e1Schristos You should have received a copy of the GNU General Public License 184e98e3e1Schristos along with this program. If not, see <http://www.gnu.org/licenses/>. */ 194e98e3e1Schristos 204b169a6bSchristos /* This must come before any other includes. */ 214b169a6bSchristos #include "defs.h" 224b169a6bSchristos 234e98e3e1Schristos #include "sim-main.h" 244e98e3e1Schristos #include "sim-assert.h" 254e98e3e1Schristos 264e98e3e1Schristos /* Generic implementation of sim_engine_run that works within the 274e98e3e1Schristos sim_engine setjmp/longjmp framework. */ 284e98e3e1Schristos 294e98e3e1Schristos #define IMEM XCONCAT 304e98e3e1Schristos 314e98e3e1Schristos void 324e98e3e1Schristos sim_engine_run (SIM_DESC sd, 334e98e3e1Schristos int next_cpu_nr, /* ignore */ 344e98e3e1Schristos int nr_cpus, /* ignore */ 354e98e3e1Schristos int siggnal) /* ignore */ 364e98e3e1Schristos { 374e98e3e1Schristos sim_cia cia; 384e98e3e1Schristos sim_cpu *cpu; 394e98e3e1Schristos SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER); 404e98e3e1Schristos cpu = STATE_CPU (sd, 0); 41212397c6Schristos cia = CPU_PC_GET (cpu); 424e98e3e1Schristos while (1) 434e98e3e1Schristos { 444e98e3e1Schristos instruction_word insn = IMEM32 (cia); 454e98e3e1Schristos cia = idecode_issue (sd, insn, cia); 464e98e3e1Schristos /* process any events */ 474e98e3e1Schristos if (sim_events_tick (sd)) 484e98e3e1Schristos { 49212397c6Schristos CPU_PC_SET (cpu, cia); 504e98e3e1Schristos sim_events_process (sd); 514e98e3e1Schristos } 524e98e3e1Schristos } 534e98e3e1Schristos } 54