From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:47407) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RUaQY-0005Zi-5a for qemu-devel@nongnu.org; Sun, 27 Nov 2011 03:49:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RUaQW-0006It-QF for qemu-devel@nongnu.org; Sun, 27 Nov 2011 03:49:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42329) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RUaQW-0006Io-9j for qemu-devel@nongnu.org; Sun, 27 Nov 2011 03:49:32 -0500 Message-ID: <4ED1F997.2090308@redhat.com> Date: Sun, 27 Nov 2011 10:49:27 +0200 From: Avi Kivity MIME-Version: 1.0 References: <1322230897-7470-1-git-send-email-benoit.canet@gmail.com> <1322230897-7470-2-git-send-email-benoit.canet@gmail.com> In-Reply-To: <1322230897-7470-2-git-send-email-benoit.canet@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 1/5] omap_sx1: convert to memory API List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?QmVub8OudCBDYW5ldA==?= Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org On 11/25/2011 04:21 PM, Beno=C3=AEt Canet wrote: > Signed-off-by: Beno=C3=AEt Canet > --- > hw/omap_sx1.c | 113 ++++++++++++++++++++++++++++++-------------------= -------- > 1 files changed, 59 insertions(+), 54 deletions(-) > > diff --git a/hw/omap_sx1.c b/hw/omap_sx1.c > index fe53545..b056bc9 100644 > --- a/hw/omap_sx1.c > +++ b/hw/omap_sx1.c > @@ -59,46 +59,42 @@ > * - 1 RTC > */ > =20 > -static uint32_t static_readb(void *opaque, target_phys_addr_t offset) > -{ > - uint32_t *val =3D (uint32_t *) opaque; > - > - return *val >> ((offset & 3) << 3); > -} > - > -static uint32_t static_readh(void *opaque, target_phys_addr_t offset) > -{ > - uint32_t *val =3D (uint32_t *) opaque; > - > - return *val >> ((offset & 1) << 3); > -} > - > -static uint32_t static_readw(void *opaque, target_phys_addr_t offset) > +static uint64_t static_read(void *opaque, target_phys_addr_t offset, > + unsigned size) > { > uint32_t *val =3D (uint32_t *) opaque; > + uint32_t mask =3D 0; > + > + switch (size) { > + case 1: > + mask =3D 3; > + break; > + case 2: > + mask =3D 1; > + break; > + case 4: > + mask =3D 0; > + break; > + default: > + mask =3D 0; > + } mask =3D (4 / size) - 1; > =20 > - return *val >> ((offset & 0) << 3); > + return *val >> ((offset & mask) << 3); > } > =20 > =20 > Could also be done by just implementing the length 4 operation (which just returns *val) and setting .impl.min_access_size =3D .impl.max_access_size =3D 4, but unfortunately that is not implemented. --=20 error compiling committee.c: too many arguments to function