From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36334) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZyiBa-0003nt-Ce for qemu-devel@nongnu.org; Tue, 17 Nov 2015 10:28:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZyiBV-0001wo-Ng for qemu-devel@nongnu.org; Tue, 17 Nov 2015 10:28:46 -0500 Received: from mail-lb0-x22f.google.com ([2a00:1450:4010:c04::22f]:34043) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZyiBV-0001wU-GF for qemu-devel@nongnu.org; Tue, 17 Nov 2015 10:28:41 -0500 Received: by lbbcs9 with SMTP id cs9so7691239lbb.1 for ; Tue, 17 Nov 2015 07:28:40 -0800 (PST) References: <5638B3E4.8020906@ispras.ru> <564B27CB.7010302@ispras.ru> From: Sergey Fedorov Message-ID: <564B47A7.4040003@gmail.com> Date: Tue, 17 Nov 2015 18:28:39 +0300 MIME-Version: 1.0 In-Reply-To: <564B27CB.7010302@ispras.ru> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] log every write to register List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sergey Smolov , Peter Crosthwaite , Peter Maydell , Richard Henderson Cc: QEMU Developers On 17.11.2015 16:12, Sergey Smolov wrote: > > 03.11.2015 20:29, Peter Crosthwaite пишет: >> On Tue, Nov 3, 2015 at 8:14 AM, Peter Maydell >> wrote: >>> On 3 November 2015 at 13:17, Sergey Smolov wrote: >>>> I have a collection of ARMv8 register names. I need to add special >>>> logging >>>> mode to QEMU so that every time it is enabled, every write access >>>> to any of >>>> the specified registers will produce a new record to log, including >>>> register >>>> name and a value to be written. >>>> >>>> Is it possible to accomplish such a task? If yes, where shall I find >>>> functions that implement "writing to register" functionality? >>> This is difficult, because we don't have a single convenient >>> location which all register accesses go through. (General purpose >>> registers and some system registers will be optimised so that >>> accesses are made directly from JIT generated code.) >>> >> You may be able to hack the TCG generation functions to call out to >> helper context (which implements your log) on each op that updates >> your specific regs. It will kill performance though if those registers >> are hot. > > Thank you for your answer! > Could you explain the idea in a more detailed way? > Which TCG generation functions should i hack for > write-to-specific-regs logging? As of general system/coprocessor registers you could first look at target-arm/translate-a64.c:handle_sys() and target-arm/translate.c:disas_coproc_insn(). Best regards, Sergey