From f03b093cd34bc352ad89334a43a34b00a5e5c60c Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Mon, 19 May 1997 03:42:33 +0000 Subject: o Implement generic halt/restart/abort module. Use in tic80 and d30v simulators. o Add signal hook to sim-core module --- sim/tic80/sim-calls.c | 44 +++++++------------------------------------- 1 file changed, 7 insertions(+), 37 deletions(-) (limited to 'sim/tic80/sim-calls.c') diff --git a/sim/tic80/sim-calls.c b/sim/tic80/sim-calls.c index dd54184..5b580bd 100644 --- a/sim/tic80/sim-calls.c +++ b/sim/tic80/sim-calls.c @@ -80,7 +80,13 @@ sim_open (SIM_OPEN_KIND kind, char **argv) return 0; } - engine_init(&simulation); + /* Initialize the main processor */ + memset (&STATE_CPU (&simulation, 0)->reg, 0, sizeof STATE_CPU (&simulation, 0)->reg); + memset (&STATE_CPU (&simulation, 0)->acc, 0, sizeof STATE_CPU (&simulation, 0)->acc); + memset (&STATE_CPU (&simulation, 0)->cr, 0, sizeof STATE_CPU (&simulation, 0)->cr); + STATE_CPU (&simulation, 0)->is_user_mode = 0; + memset (&STATE_CPU (&simulation, 0)->cia, 0, sizeof STATE_CPU (&simulation, 0)->cia); + CPU_STATE (STATE_CPU (&simulation, 0)) = &simulation; #define TIC80_MEM_START 0x2000000 #define TIC80_MEM_SIZE 0x100000 @@ -230,42 +236,6 @@ sim_create_inferior (SIM_DESC sd, } -volatile int keep_running = 1; - -void -sim_stop_reason (SIM_DESC sd, enum sim_stop *reason, int *sigrc) -{ - if (!keep_running) - { - *reason = sim_stopped; - *sigrc = SIGINT; - keep_running = 1; - } - else - { - *reason = simulation.reason; - *sigrc = simulation.siggnal; - } -} - - -int -sim_stop (SIM_DESC sd) -{ - keep_running = 0; - return 1; -} - -void -sim_resume (SIM_DESC sd, int step, int siggnal) -{ - /* keep_running = 1 - in sim_stop_reason */ - if (step) - engine_step (sd); - else - engine_run_until_stop (sd, &keep_running); -} - void sim_do_command (SIM_DESC sd, char *cmd) { -- cgit v1.1