From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 115803 invoked by alias); 22 Mar 2015 22:46:05 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 115793 invoked by uid 89); 22 Mar 2015 22:46:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.3 required=5.0 tests=AWL,BAYES_00,DATE_IN_FUTURE_03_06,SPF_PASS,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: smtp.gentoo.org Received: from smtp.gentoo.org (HELO smtp.gentoo.org) (140.211.166.183) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Sun, 22 Mar 2015 22:46:04 +0000 Received: from vapier (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with SMTP id ACDA834095B; Sun, 22 Mar 2015 22:46:01 +0000 (UTC) Date: Sun, 22 Mar 2015 22:46:00 -0000 From: Mike Frysinger To: Jiri Gaisler Cc: gdb-patches@sourceware.org Subject: Re: [PATCH v4 03/13] sim/erc32: Switched emulated memory to host endian order. Message-ID: <20150323024519.GB8039@vapier> Mail-Followup-To: Jiri Gaisler , gdb-patches@sourceware.org References: <1426626170-21401-1-git-send-email-jiri@gaisler.se> <1426626170-21401-4-git-send-email-jiri@gaisler.se> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="3lcZGd9BuhuYXNfi" Content-Disposition: inline In-Reply-To: <1426626170-21401-4-git-send-email-jiri@gaisler.se> X-IsSubscribed: yes X-SW-Source: 2015-03/txt/msg00703.txt.bz2 --3lcZGd9BuhuYXNfi Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 1884 On 17 Mar 2015 22:02, Jiri Gaisler wrote: > --- a/sim/erc32/erc32.c > +++ b/sim/erc32/erc32.c >=20=20 > static void > -fetch_bytes (asi, mem, data, sz) > +store_bytes (mem, waddr, data, sz, ws) as some point we'll want to switch over to sim-core.c and then all these=20 accessor funcs you have would go away. but we don't need to do that now. > +#ifdef HOST_LITTLE_ENDIAN > + waddr ^=3D 3; > +#endif > + mem[waddr] =3D *data & 0x0ff; doesn't this assume the target is big endian ? this shows up a few times i= n=20 the changes to this file. > + memcpy(&mem[waddr], data, 2); space before the (. this shows up a few times in the changes to this file. > + *data =3D *((uint32 *) & (romb[addr & ~3])); broken indentation, and you need to use the union/memcpy logic. this shows= up a=20 few times in the changes to this file. > + mexc =3D memory_read(asi, address, ddata, 2, &ws); you should scan the whole change for new lines that are missing the space b= efore=20 the ( > sregs.freq =3D freq ? freq : 15; > termsave =3D fcntl(0, F_GETFL, 0); > INIT_DISASSEMBLE_INFO(dinfo, stdout,(fprintf_ftype)fprintf); > +#ifdef HOST_LITTLE_ENDIAN > + dinfo.endian =3D BFD_ENDIAN_LITTLE; > +#else > dinfo.endian =3D BFD_ENDIAN_BIG; > +#endif can't you get the target endian info via the bfd library ? > +#ifdef HOST_LITTLE_ENDIAN > + int *ibufp =3D (int *) buf; needs a union > + int ibuf[8192]; > + int i, len; > + > + if (length >=3D 4) > + for (i =3D 0; i < length; i +=3D 4) { > + ibuf[i] =3D T2H_4(ibufp[i]); > + } > + return (sis_memory_write(mem, (char *) ibuf, length)); > +#else > return (sis_memory_write(mem, buf, length)); > +#endif the point of using sim-endian is that you wouldn't have any ifdefs. code t= he=20 loop and let gcc optimize away the "nothing to do" case. -mike --3lcZGd9BuhuYXNfi Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-length: 819 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJVD34/AAoJEEFjO5/oN/WB9hIP/Rhl/EY3830R3nNUqHfFkuBM TarAVh9IPZe/n7WPAIatiJELtXxbn7IqsL0+6WVcr9b042TufGdITcDMza6Ol9Vy OYYScchw5pmxUJqwtKqzKvT+co9AyH1en0dIy1XSi7VRpTjOuEYKG7xZjtZMiMoj x+2QhmDtR5q/JsVVq2UCpPPRskxo9s4oAzQZWex3GkSfJ6euM37hwPqZMpmFNNUH wJcgrDqikeCuMXIYrhl8XdFVB6DzgcZdHDABWZU7S6hjZ44NqGKh6EPFHrBJwqkh jsywDvosFfDDhozGblZ5F8pTA3a2JLqgEMy3Zo3EXnlLknCzj5sXeySpw0ZJNYr9 xbMWXFKnW14CAx7NgHSU+vJV8rpfpHxxoYXrQ7v9akXiOD/WGw4x6Fzf61S6Zw5h dLLO2hKRlSmITD9BP6OOxUDr1fdfAgyHYT9++Nei/Rp3R3S0+y9eaxHrioqn7bht u9KHYq9TUbai9uJtO9WaCRrAigOR/5kQDlMh9Drpcl/tEVq51OEHaDZcXStJeaAW 0GFlSAxENeeqkpiqQvDOFezC4kMhUaHREMoqoQovAjOKEIaOXm0VfFeS2xFFcffz UCtNi9HSakvXUsfLn5KCnA4EJOQL5mKX+GzUYSOtkNFQYth96ttw4h4GwamyKpJg blLQsk+3/3GsQO7MtlVQ =ua5A -----END PGP SIGNATURE----- --3lcZGd9BuhuYXNfi--