From patchwork Sun Nov 22 05:54:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 9767 X-Patchwork-Delegate: vapier@gentoo.org Received: (qmail 22476 invoked by alias); 22 Nov 2015 05:57:31 -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 20819 invoked by uid 89); 22 Nov 2015 05:54:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS 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; Sun, 22 Nov 2015 05:54:43 +0000 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 6F95C340875 for ; Sun, 22 Nov 2015 05:54:38 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH] sim: avr: switch to common sim-reg [committed] Date: Sun, 22 Nov 2015 00:54:37 -0500 Message-Id: <1448171677-437-1-git-send-email-vapier@gentoo.org> X-IsSubscribed: yes This is not entirely useful as avr doesn't (yet) store its register state in the cpu state, but it does allow for switching to the common code for these functions. --- sim/avr/ChangeLog | 8 ++++++++ sim/avr/interp.c | 10 ++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/sim/avr/ChangeLog b/sim/avr/ChangeLog index 0f52474..410caca 100644 --- a/sim/avr/ChangeLog +++ b/sim/avr/ChangeLog @@ -1,3 +1,11 @@ +2015-11-21 Mike Frysinger + + * interp.c (sim_store_register): Rename to ... + (avr_reg_store): ... this. Adjust signature. + (sim_fetch_register): Rename to ... + (avr_reg_fetch): ... this. Adjust signature. + (sim_open): Call CPU_REG_FETCH and CPU_REG_STORE. + 2015-11-15 Mike Frysinger * Makefile.in (SIM_OBJS): Delete sim-reason.o and sim-stop.o. diff --git a/sim/avr/interp.c b/sim/avr/interp.c index 0b84c3b..48d2195 100644 --- a/sim/avr/interp.c +++ b/sim/avr/interp.c @@ -1604,8 +1604,8 @@ sim_read (SIM_DESC sd, SIM_ADDR addr, unsigned char *buffer, int size) } } -int -sim_store_register (SIM_DESC sd, int rn, unsigned char *memory, int length) +static int +avr_reg_store (SIM_CPU *cpu, int rn, unsigned char *memory, int length) { if (rn < 32 && length == 1) { @@ -1633,8 +1633,8 @@ sim_store_register (SIM_DESC sd, int rn, unsigned char *memory, int length) return 0; } -int -sim_fetch_register (SIM_DESC sd, int rn, unsigned char *memory, int length) +static int +avr_reg_fetch (SIM_CPU *cpu, int rn, unsigned char *memory, int length) { if (rn < 32 && length == 1) { @@ -1747,6 +1747,8 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb, struct bfd *abfd, char **argv) { SIM_CPU *cpu = STATE_CPU (sd, i); + CPU_REG_FETCH (cpu) = avr_reg_fetch; + CPU_REG_STORE (cpu) = avr_reg_store; CPU_PC_FETCH (cpu) = avr_pc_get; CPU_PC_STORE (cpu) = avr_pc_set; }