Received: from eggs.gnu.org ([2001:4830:134:3::10]:39067) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpIVG-0001PV-Ig for qemu-devel@nongnu.org; Wed, 28 Sep 2016 13:18:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bpIVC-00080u-Gt for qemu-devel@nongnu.org; Wed, 28 Sep 2016 13:18:42 -0400 Received: from mail-it0-x234.google.com ([2607:f8b0:4001:c0b::234]:38216) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpIVC-00080d-CD for qemu-devel@nongnu.org; Wed, 28 Sep 2016 13:18:38 -0400 Received: by mail-it0-x234.google.com with SMTP id n143so36118107ita.1 for ; Wed, 28 Sep 2016 10:18:38 -0700 (PDT) Sender: Richard Henderson References: <874m50yxbk.fsf@fimbulvetr.bsc.es> From: Richard Henderson Message-ID: <3cf0876d-6163-254d-68dd-601a713baccf@twiddle.net> Date: Wed, 28 Sep 2016 10:18:35 -0700 MIME-Version: 1.0 In-Reply-To: <874m50yxbk.fsf@fimbulvetr.bsc.es> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [RFC] Tracing guest register usage List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, Paolo Bonzini , Peter Crosthwaite On 09/28/2016 06:21 AM, Lluís Vilanova wrote: > Hi! I've kept working on extending the guest instruction tracing features, and > added support to trace which registers are read/written by guest instructions > (when executing with TCG). > > I've basically extended "tcg_global_mem_new_*" to associate global TCG registers > with a guest (vCPU) register number (*), and track all TCG opcodes that access > the values of these global TCG registers. > > (*) This "mapping" is necessary because targets like i386 have multiple global > TCG registers (cc_dst, cc_src, ...) that correspond to a single guest > register (eflags). Is tracing all changes to a register something that's actually going to be useful? If I were to log all changes to EAX, what would that tell me? As for the CC register split, there will be (1) groups of assignments that correspond to a single change of the register and (2) an internal state change to DisasContext, reflected in INDEX_op_insn_start, with no changes to any TCG registers. So you'll not actually be tracking eflags at all. This seems like something that should actually apply to cpu internal registers, such as CR4, which are never TCG registers (and moreover are never manipulated from TCG code at all). r~