From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22484 invoked by alias); 9 Sep 2004 12:44:50 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 22458 invoked from network); 9 Sep 2004 12:44:41 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 9 Sep 2004 12:44:41 -0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx1.redhat.com (8.12.10/8.12.10) with ESMTP id i89CifS0009024 for ; Thu, 9 Sep 2004 08:44:41 -0400 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx2.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i89Cie703131 for ; Thu, 9 Sep 2004 08:44:40 -0400 Received: from cygbert.vinschen.de (vpn50-19.rdu.redhat.com [172.16.50.19]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id i89CidV09770 for ; Thu, 9 Sep 2004 05:44:39 -0700 Received: by cygbert.vinschen.de (Postfix, from userid 500) id A61385808D; Thu, 9 Sep 2004 14:45:16 +0200 (CEST) Date: Thu, 09 Sep 2004 12:44:00 -0000 From: Corinna Vinschen To: gdb-patches@sources.redhat.com Subject: [PATCH]: SH 2a - Part 3: Bank register handling Message-ID: <20040909124516.GA7886@cygbert.vinschen.de> Reply-To: gdb-patches@sources.redhat.com Mail-Followup-To: gdb-patches@sources.redhat.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2i X-SW-Source: 2004-09/txt/msg00141.txt.bz2 Hi, this is SH 2a patch 2. It handles the "bank" pseudo register so that reading and writing is performed on the correct register set inside of the register banks. Corinna * sh-tdep.c (sh_pseudo_register_read): Add PSEUDO_BANK_REGNUM handling. (sh_pseudo_register_write): Ditto. --- sh-tdep.c.2 2004-09-08 18:35:04.000000000 +0200 +++ sh-tdep.c 2004-09-08 18:35:31.000000000 +0200 @@ -1866,6 +1866,9 @@ sh_pseudo_register_read (struct gdbarch int base_regnum, portion; char temp_buffer[MAX_REGISTER_SIZE]; + if (reg_nr == PSEUDO_BANK_REGNUM) + regcache_raw_read (regcache, BANK_REGNUM, buffer); + else if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM) { base_regnum = dr_reg_base_num (reg_nr); @@ -1902,7 +1905,19 @@ sh_pseudo_register_write (struct gdbarch int base_regnum, portion; char temp_buffer[MAX_REGISTER_SIZE]; - if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM) + if (reg_nr == PSEUDO_BANK_REGNUM) + { + /* When the bank register is written to, the whole register bank + is switched and all values in the bank registers must be read + from the target/sim again. We're just invalidating the regcache + so that a re-read happens next time it's necessary. */ + int bregnum; + + regcache_raw_write (regcache, BANK_REGNUM, buffer); + for (bregnum = R0_BANK0_REGNUM; bregnum < MACLB_REGNUM; ++bregnum) + set_register_cached (bregnum, 0); + } + else if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM) { base_regnum = dr_reg_base_num (reg_nr); -- Corinna Vinschen Cygwin Project Co-Leader Red Hat, Inc.