Received: from eggs.gnu.org ([2001:4830:134:3::10]:51145) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b1R60-00032h-El for qemu-devel@nongnu.org; Sat, 14 May 2016 00:22:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b1R5w-0005te-6H for qemu-devel@nongnu.org; Sat, 14 May 2016 00:22:31 -0400 Received: from roura.ac.upc.es ([147.83.33.10]:51482) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b1R5v-0005t7-33 for qemu-devel@nongnu.org; Sat, 14 May 2016 00:22:28 -0400 From: =?utf-8?Q?Llu=C3=ADs_Vilanova?= References: <146299211689.22870.560211702371824674.stgit@localhost> <146299212974.22870.8908588314009190886.stgit@localhost> Date: Thu, 12 May 2016 17:36:37 +0200 In-Reply-To: <146299212974.22870.8908588314009190886.stgit@localhost> (=?utf-8?Q?=22Llu=C3=ADs?= Vilanova"'s message of "Wed, 11 May 2016 20:42:10 +0200") Message-ID: <87posrp9tm.fsf@fimbulvetr.bsc.es> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 2/2] trace: [all] Add "guest_mem_before" event List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Richard Henderson , Peter Crosthwaite , Stefan Hajnoczi , Paolo Bonzini Llu=C3=ADs Vilanova writes: [...] > diff --git a/trace/mem-internal.h b/trace/mem-internal.h > new file mode 100644 > index 0000000..970d525 > --- /dev/null > +++ b/trace/mem-internal.h > @@ -0,0 +1,46 @@ > +/* > + * Helper functions for guest memory tracing > + * > + * Copyright (C) 2016 Llu=C3=ADs Vilanova > + * > + * This work is licensed under the terms of the GNU GPL, version 2 or la= ter. > + * See the COPYING file in the top-level directory. > + */ > + > +#ifndef TRACE__MEM_INTERNAL_H > +#define TRACE__MEM_INTERNAL_H > + > +static inline uint8_t trace_mem_get_info(TCGMemOp op, bool store) > +{ > + uint8_t res =3D op; > + bool be =3D (op & MO_BSWAP) =3D=3D MO_BE; > + > + /* remove untraced fields */ > + res &=3D (~((1ULL << 4) - 1)); > + /* make endianness absolute */ > + res &=3D ~MO_BSWAP; > + if (be) { > + res |=3D 1ULL << 3; > + } > + /* add fields */ > + if (store) { > + res |=3D 1ULL << 4; > + } > + > + return res; > +} [...] I forgot to comment on the commit message/code why I'm ignoring the MO_ALIGN/MO_UNALN flag. In principle, these are plainly calculable from the virtual address and tar= get architecture, so I decided to not emit them on the trace to keep it as simp= le as possible. Cheers, Lluis