From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:51355) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QNAK6-0000uT-43 for qemu-devel@nongnu.org; Thu, 19 May 2011 16:59:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QNAK5-0001pZ-4x for qemu-devel@nongnu.org; Thu, 19 May 2011 16:59:58 -0400 Received: from mail-gw0-f45.google.com ([74.125.83.45]:42536) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QNAK5-0001pN-2O for qemu-devel@nongnu.org; Thu, 19 May 2011 16:59:57 -0400 Received: by gwb19 with SMTP id 19so1253380gwb.4 for ; Thu, 19 May 2011 13:59:56 -0700 (PDT) Sender: Richard Henderson Message-ID: <4DD584C5.8080008@twiddle.net> Date: Thu, 19 May 2011 13:59:49 -0700 From: Richard Henderson MIME-Version: 1.0 References: <1305671572-5899-1-git-send-email-jcmvbkbc@gmail.com> <1305671572-5899-10-git-send-email-jcmvbkbc@gmail.com> In-Reply-To: <1305671572-5899-10-git-send-email-jcmvbkbc@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 09/26] target-xtensa: add special and user registers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Filippov Cc: qemu-devel@nongnu.org On 05/17/2011 03:32 PM, Max Filippov wrote: > +enum { > + THREADPTR = 231, > + FCR = 232, > + FSR = 233, > +}; > + > typedef struct XtensaConfig { > const char *name; > uint64_t options; > @@ -109,6 +115,7 @@ typedef struct CPUXtensaState { > uint32_t regs[16]; > uint32_t pc; > uint32_t sregs[256]; > + uint32_t uregs[256]; Is it really worthwhile allocating 2k worth of space in the CPUState when only several of the slots are actually used? I would think that it might be better to have a function to map between number to offset/register. E.g. int ur_offset(int ur) { switch (ur) { case THREADPTR: return offsetof(CPUState, ur_threadptr); case FCR: return offsetof(CPUState, ur_fcr); case FSR: return offsetof(CPUState, ur_fsr); } return -1; } where the individual slots are allocated by hand in the CPUState. The fact that they'll be named in the struct will also make it easier to dump the value inside gdb and see what the individual values are. r~