Received: from eggs.gnu.org ([2001:4830:134:3::10]:56023) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwbFo-0007DD-Tf for qemu-devel@nongnu.org; Tue, 18 Oct 2016 16:44:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwbFl-0002a6-RU for qemu-devel@nongnu.org; Tue, 18 Oct 2016 16:44:56 -0400 Received: from mail-it0-x243.google.com ([2607:f8b0:4001:c0b::243]:36858) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1bwbFl-0002ZS-LK for qemu-devel@nongnu.org; Tue, 18 Oct 2016 16:44:53 -0400 Received: by mail-it0-x243.google.com with SMTP id 66so506396itl.3 for ; Tue, 18 Oct 2016 13:44:53 -0700 (PDT) Sender: Richard Henderson References: <20160927233049.5429-1-marex@denx.de> <20160927233049.5429-2-marex@denx.de> <20d61df8-b345-b097-8d9b-4a619849d86c@twiddle.net> <82ddeb82-768b-57d1-5962-a6940e5001c7@denx.de> <496742f4-af10-e029-62a2-f2c5054c9303@twiddle.net> <15816d97-1ea9-44df-01d0-10ee10430af2@denx.de> From: Richard Henderson Message-ID: Date: Tue, 18 Oct 2016 13:44:49 -0700 MIME-Version: 1.0 In-Reply-To: <15816d97-1ea9-44df-01d0-10ee10430af2@denx.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/7] nios2: Add architecture emulation support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marek Vasut , qemu-devel@nongnu.org Cc: Jeff Da Silva , Chris Wulff , Sandra Loosemore , Yves Vandervennet , Ley Foon Tan On 10/18/2016 11:32 AM, Marek Vasut wrote: > But the instruction encoding does, so I can use the field from the > instruction to directly index the register array. Well, no, you can't. In fact, it would be cleaner to have multiple arrays -- one for general registers and one for control registers -- that you *could* actually directly index. There are only two instructions that touch the control registers, rdctl and wrctl. In those instructions you're having to explicitly add 32. > Thanks, I hope this is fixed now, although I mostly special-case the > R_ZERO handling throughout the code. Any writes to R_ZERO are now > ignored and any usage is converted to mov/movi instructions where > applicable. We've done that in the past, but in the end it is much cleaner to minimize the number of places in which you have to check for R_ZERO. r~