From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3003 invoked by alias); 18 Dec 2007 00:43:19 -0000 Received: (qmail 2984 invoked by uid 22791); 18 Dec 2007 00:43:18 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 18 Dec 2007 00:43:07 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 7A53D98100; Tue, 18 Dec 2007 00:43:05 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id 2529C98129; Tue, 18 Dec 2007 00:43:05 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.68) (envelope-from ) id 1J4QY4-0007oC-ED; Mon, 17 Dec 2007 19:43:04 -0500 Date: Tue, 18 Dec 2007 13:42:00 -0000 From: Daniel Jacobowitz To: "Maciej W. Rozycki" Cc: gdb-patches@sourceware.org, Chris Dearman , "Maciej W. Rozycki" Subject: Re: MIPS: Handle the DSP registers Message-ID: <20071218004304.GA29420@caradoc.them.org> Mail-Followup-To: "Maciej W. Rozycki" , gdb-patches@sourceware.org, Chris Dearman , "Maciej W. Rozycki" References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-12-11) 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/msg00285.txt.bz2 On Mon, Dec 10, 2007 at 03:51:55PM +0000, Maciej W. Rozycki wrote: > Hello, > > Here is code to support DSP registers as defined by the DSP ASE to the > MIPS Architecture. This piece of code handles Linux and provides for > adding such support to embedded targets. The ASE is optional (as are all > ASEs) and therefore some steps have been taken to handle this correctly. > > In particular, ptrace() calls may return a failure when called on a > system that does not support the ASE. In such a case the registers are > marked as unavailable in the cache which has the effect of them being > hardwired to zero (I have a patch in the queue that would mark them > specially in the output; I will submit it later). We have an even better way to handle this, nowadays. Take a look at arm-linux-nat.c:arm_linux_read_description. This lets the registers be completely hidden when they are not available. > +/* Names of Linux registers. */ > +static const char *mips_linux_reg_names[NUM_MIPS_PROCESSOR_REGS] = { > + "sr", "lo", "hi", "bad", "cause", "pc", > + "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", > + "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", > + "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", > + "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", > + "fsr", "fir", "hi1", "lo1", "hi2", "lo2", "hi3", "lo3", > + "dspctl", > +}; If you're using a target description wherever you support these registers, then you shouldn't need another copy of them here. > @@ -5270,11 +5341,11 @@ > > > valid_p &= tdesc_numbered_register (feature, tdesc_data, > - MIPS_EMBED_LO_REGNUM, "lo"); > + mips_regnum.lo, "lo"); I went to a bit of trouble to be able to use constants here, please don't go back the other direction. When all the raw registers use constant numbering, it's much easier to manage the GDB backend. > + if (mips_regnum.dspacc >= 0) > + { > + feature = tdesc_find_feature (info.target_desc, > + "org.gnu.gdb.mips.dsp"); Please add this to the manual section describing MIPS target features. > Index: binutils-quilt/src/gdb/inf-ptrace.c > =================================================================== > --- binutils-quilt.orig/src/gdb/inf-ptrace.c 2007-12-07 15:08:21.000000000 +0000 > +++ binutils-quilt/src/gdb/inf-ptrace.c 2007-12-07 15:13:02.000000000 +0000 Using a target description that accurately describes the target should eliminate the need for these. > Index: binutils-quilt/src/gdb/features/mips-linux.xml > =================================================================== > --- binutils-quilt.orig/src/gdb/features/mips-linux.xml 2007-12-07 15:08:21.000000000 +0000 > +++ binutils-quilt/src/gdb/features/mips-linux.xml 2007-12-07 15:13:02.000000000 +0000 > @@ -11,6 +11,7 @@ > > > > + And a corrolary of that is that we'll have two mips-linux descriptions, with and without the DSP registers. > Index: binutils-quilt/src/gdb/testsuite/gdb.xml/tdesc-regs.exp > =================================================================== > --- binutils-quilt.orig/src/gdb/testsuite/gdb.xml/tdesc-regs.exp 2007-12-07 17:01:40.000000000 +0000 > +++ binutils-quilt/src/gdb/testsuite/gdb.xml/tdesc-regs.exp 2007-12-07 17:02:17.000000000 +0000 > @@ -33,7 +33,7 @@ > set core-regs {arm-core.xml} > } > "mips*-*-*" { > - set core-regs {mips-cpu.xml mips-cp0.xml mips-fpu.xml} > + set core-regs {mips-cpu.xml mips-cp0.xml mips-fpu.xml mips-dsp.xml} > } > "powerpc*-*-*" { > set regdir "rs6000/" No need for this, since a MIPS target without the DSP registers is still valid. -- Daniel Jacobowitz CodeSourcery