From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17495 invoked by alias); 12 Dec 2007 19:42:22 -0000 Received: (qmail 17485 invoked by uid 22791); 12 Dec 2007 19:42:21 -0000 X-Spam-Check-By: sourceware.org Received: from bluesmobile.specifix.com (HELO bluesmobile.specifix.com) (216.129.118.140) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 12 Dec 2007 19:42:17 +0000 Received: from [127.0.0.1] (bluesmobile.specifix.com [216.129.118.140]) by bluesmobile.specifix.com (Postfix) with ESMTP id DF7C83BD86; Wed, 12 Dec 2007 11:42:14 -0800 (PST) Subject: [RFA] mipsnbsd-tdep.c, fill/supply_reg 32/64 bit From: Michael Snyder To: gdb-patches@sourceware.org Cc: dueling@de.ibm.com, uweigand@de.ibm.com Content-Type: text/plain Date: Thu, 13 Dec 2007 02:02:00 -0000 Message-Id: <1197487581.32169.101.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.10.3 (2.10.3-4.fc7) Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-12/txt/msg00168.txt.bz2 This patch is meant to allow these functions to work when mips_isa_regsize != mips_abi_regsize. I don't actually have a NetBSD system on which to test it -- I'm working on a port of FreeBSD, borrowing heavily from this code. There's nothing OS-specific about the method, though, which I actually borrowed from mips-linux-tdep.c. Yes, I do know that the same needs to be done for the fill/supply_fpreg functions... 2007-12-12 Michael Snyder * mipsnbsd-tdep.c (mipsnbsd_supply_reg): Convert 32/64 bits, for targets in which mips_abi_size != mips_isa_size. (mipsnbsd_fill_reg): Ditto. Index: mipsnbsd-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/mipsnbsd-tdep.c,v retrieving revision 1.32 diff -u -p -r1.32 mipsnbsd-tdep.c --- mipsnbsd-tdep.c 16 Nov 2007 04:56:45 -0000 1.32 +++ mipsnbsd-tdep.c 12 Dec 2007 19:27:58 -0000 @@ -152,8 +152,19 @@ mipsnbsd_supply_reg (struct regcache *re if (gdbarch_cannot_fetch_register (gdbarch, i)) regcache_raw_supply (regcache, i, NULL); else - regcache_raw_supply (regcache, i, - regs + (i * mips_isa_regsize (gdbarch))); + { + /* Convert between abi (input) and isa (output). + Required in case abi regsize != isa regsize. */ + size_t abisize = mips_abi_regsize (gdbarch); + size_t isasize = register_size (gdbarch, i); + void *addr = regs + i * abisize; + gdb_byte buf[MAX_REGISTER_SIZE]; + LONGEST val; + + val = extract_signed_integer (addr, abisize); + store_signed_integer (buf, isasize, val); + regcache_raw_supply (current_regcache, i, buf); + } } } } @@ -167,8 +178,19 @@ mipsnbsd_fill_reg (const struct regcache for (i = 0; i <= gdbarch_pc_regnum (gdbarch); i++) if ((regno == i || regno == -1) && ! gdbarch_cannot_store_register (gdbarch, i)) - regcache_raw_collect (regcache, i, - regs + (i * mips_isa_regsize (gdbarch))); + { + /* Convert between isa (input) and abi (output). + Required in case abi regsize != isa regsize. */ + size_t abisize = mips_abi_regsize (gdbarch); + size_t isasize = register_size (gdbarch, i); + void *addr = regs + i * abisize; + gdb_byte buf[MAX_REGISTER_SIZE]; + LONGEST val; + + regcache_raw_collect (current_regcache, i, buf); + val = extract_signed_integer (buf, isasize); + store_signed_integer (addr, abisize, val); + } } void