From patchwork Thu Jun 11 14:20:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 7117 X-Patchwork-Delegate: vapier@gentoo.org Received: (qmail 61651 invoked by alias); 11 Jun 2015 14:20:24 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 61642 invoked by uid 89); 11 Jun 2015 14:20:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: smtp.gentoo.org Received: from smtp.gentoo.org (HELO smtp.gentoo.org) (140.211.166.183) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 11 Jun 2015 14:20:22 +0000 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 87940340CE6 for ; Thu, 11 Jun 2015 14:20:20 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH] sim: m68hc11: switch to common sim_resume Date: Thu, 11 Jun 2015 10:20:18 -0400 Message-Id: <1434032418-30042-1-git-send-email-vapier@gentoo.org> X-IsSubscribed: yes This code already matched the common sim reusme logic, so we can simply drop it and pull in the common code. Committed. --- sim/m68hc11/ChangeLog | 5 ++++ sim/m68hc11/Makefile.in | 3 +- sim/m68hc11/interp.c | 76 ------------------------------------------------- 3 files changed, 7 insertions(+), 77 deletions(-) diff --git a/sim/m68hc11/ChangeLog b/sim/m68hc11/ChangeLog index ac228b8..8621ce4 100644 --- a/sim/m68hc11/ChangeLog +++ b/sim/m68hc11/ChangeLog @@ -1,5 +1,10 @@ 2015-06-11 Mike Frysinger + * Makefile.in (SIM_OBJS): Add sim-resume.o + * interp.c (has_stepped, sim_resume): Delete. + +2015-06-11 Mike Frysinger + * interp.c (INLINE): Delete define. 2015-04-29 Nick Clifton diff --git a/sim/m68hc11/Makefile.in b/sim/m68hc11/Makefile.in index 9b931a1..98b811a 100644 --- a/sim/m68hc11/Makefile.in +++ b/sim/m68hc11/Makefile.in @@ -25,7 +25,8 @@ SIM_OBJS = $(M68HC11_OBJS) \ sim-load.o \ sim-hload.o \ sim-stop.o \ - sim-reason.o + sim-reason.o \ + sim-resume.o SIM_PROFILE= -DPROFILE=1 -DWITH_PROFILE=-1 # We must use 32-bit addresses to support memory bank switching. diff --git a/sim/m68hc11/interp.c b/sim/m68hc11/interp.c index e9f3aab..14a8231 100644 --- a/sim/m68hc11/interp.c +++ b/sim/m68hc11/interp.c @@ -699,79 +699,3 @@ sim_store_register (SIM_DESC sd, int rn, unsigned char *memory, int length) return 2; } - -/* Halt the simulator after just one instruction */ - -static void -has_stepped (SIM_DESC sd, - void *data) -{ - ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER); - sim_engine_halt (sd, NULL, NULL, NULL_CIA, sim_stopped, SIM_SIGTRAP); -} - - -/* Generic resume - assumes the existance of sim_engine_run */ - -void -sim_resume (SIM_DESC sd, - int step, - int siggnal) -{ - sim_engine *engine = STATE_ENGINE (sd); - jmp_buf buf; - int jmpval; - - ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER); - - /* we only want to be single stepping the simulator once */ - if (engine->stepper != NULL) - { - sim_events_deschedule (sd, engine->stepper); - engine->stepper = NULL; - } - sim_module_resume (sd); - - /* run/resume the simulator */ - engine->jmpbuf = &buf; - jmpval = setjmp (buf); - if (jmpval == sim_engine_start_jmpval - || jmpval == sim_engine_restart_jmpval) - { - int last_cpu_nr = sim_engine_last_cpu_nr (sd); - int next_cpu_nr = sim_engine_next_cpu_nr (sd); - int nr_cpus = sim_engine_nr_cpus (sd); - - sim_events_preprocess (sd, last_cpu_nr >= nr_cpus, next_cpu_nr >= nr_cpus); - if (next_cpu_nr >= nr_cpus) - next_cpu_nr = 0; - - /* Only deliver the siggnal ]sic] the first time through - don't - re-deliver any siggnal during a restart. */ - if (jmpval == sim_engine_restart_jmpval) - siggnal = 0; - - /* Install the stepping event after having processed some - pending events. This is necessary for HC11/HC12 simulator - because the tick counter is incremented by the number of cycles - the instruction took. Some pending ticks to process can still - be recorded internally by the simulator and sim_events_preprocess - will handle them. If the stepping event is inserted before, - these pending ticks will raise the event and the simulator will - stop without having executed any instruction. */ - if (step) - engine->stepper = sim_events_schedule (sd, 0, has_stepped, sd); - -#ifdef SIM_CPU_EXCEPTION_RESUME - { - sim_cpu* cpu = STATE_CPU (sd, next_cpu_nr); - SIM_CPU_EXCEPTION_RESUME(sd, cpu, siggnal); - } -#endif - - sim_engine_run (sd, next_cpu_nr, nr_cpus, siggnal); - } - engine->jmpbuf = NULL; - - sim_module_suspend (sd); -}