From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4936 invoked by alias); 8 Nov 2007 21:55:36 -0000 Received: (qmail 4927 invoked by uid 22791); 8 Nov 2007 21:55:35 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate3.de.ibm.com (HELO mtagate3.de.ibm.com) (195.212.29.152) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 08 Nov 2007 21:55:29 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate3.de.ibm.com (8.13.8/8.13.8) with ESMTP id lA8LtRNP161776 for ; Thu, 8 Nov 2007 21:55:27 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v8.6) with ESMTP id lA8LtQWX2310204 for ; Thu, 8 Nov 2007 22:55:26 +0100 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id lA8LtPsJ001823 for ; Thu, 8 Nov 2007 22:55:26 +0100 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id lA8LtPjO001820; Thu, 8 Nov 2007 22:55:25 +0100 Message-Id: <200711082155.lA8LtPjO001820@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Thu, 8 Nov 2007 22:55:25 +0100 Subject: Re: [rfc] [05/05] Get rid of current_gdbarch in xtensa To: deuling@de.ibm.com (Markus Deuling) Date: Thu, 08 Nov 2007 21:55:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org (GDB Patches) In-Reply-To: <47319D50.50709@de.ibm.com> from "Markus Deuling" at Nov 07, 2007 12:11:12 PM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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-11/txt/msg00182.txt.bz2 Markus Deuling wrote: > -#define AREG_NUMBER(r, wb) \ > - ((((r) - (gdbarch_tdep (current_gdbarch)->a0_base + 0) + (((wb) \ > - & ((gdbarch_tdep (current_gdbarch)->num_aregs - 1) >> 2)) << WB_SHIFT)) & \ > - (gdbarch_tdep (current_gdbarch)->num_aregs - 1)) \ > - + gdbarch_tdep (current_gdbarch)->ar_base) > +/* Convert a live Ax register number to the corresponding Areg number. */ > +static int > +areg_number (struct gdbarch *gdbarch, int regnum, ULONGEST wb) > +{ > + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); > + int areg; > + > + areg = regnum - tdep->a0_base + tdep->ar_base; > + areg += (wb & ((tdep->num_aregs - 1) >> 2)) << WB_SHIFT; > + areg &= tdep->num_aregs - 1; > + > + return areg; > +} The function does not look equivalent to the macro, that should be areg = regnum - tdep->a0_base; areg += (wb & ((tdep->num_aregs - 1) >> 2)) << WB_SHIFT; areg &= tdep->num_aregs - 1; return areg + tdep->ar_base; > + regnum = areg_number(gdbarch, regnum, extract_unsigned_integer (buf, 4)); Space before '('. Otherwise, I didn't see anything wrong. But I agree that it would be good to test a change of this complexity; can you set up a simulator test environment for xtensa? Bye, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com