From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 104435 invoked by alias); 14 Mar 2015 07:45:36 -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 104152 invoked by uid 89); 14 Mar 2015 07:45:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham 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; Sat, 14 Mar 2015 07:45:34 +0000 Received: from vapier (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with SMTP id 8DE203407E6; Sat, 14 Mar 2015 07:45:32 +0000 (UTC) Date: Sat, 14 Mar 2015 07:45:00 -0000 From: Mike Frysinger To: Jiri Gaisler Cc: gdb-patches@sourceware.org Subject: Re: [PATCH v3 03/14] sim/erc32: Switched emulated memory to host endian order. Message-ID: <20150314074532.GX877@vapier> Mail-Followup-To: Jiri Gaisler , gdb-patches@sourceware.org References: <1425244244-27709-1-git-send-email-jiri@gaisler.se> <1425244244-27709-4-git-send-email-jiri@gaisler.se> <20150302011342.GH19363@vapier> <55020453.9080502@gaisler.se> <20150312235507.GG877@vapier> <55029ED9.5070009@gaisler.se> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="FhxWStFQ84VXWhXs" Content-Disposition: inline In-Reply-To: <55029ED9.5070009@gaisler.se> X-IsSubscribed: yes X-SW-Source: 2015-03/txt/msg00415.txt.bz2 --FhxWStFQ84VXWhXs Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 2620 [ read gdb lists to cc ] On 13 Mar 2015 09:24, Jiri Gaisler wrote: > On 13/03/15 00:55, Mike Frysinger wrote: > > On 12 Mar 2015 22:25, Jiri Gaisler wrote: > >> On 02/03/15 02:13, Mike Frysinger wrote: > >>>> +#ifdef HOST_LITTLE_ENDIAN > >>>>> + for (i =3D 0; i < (count / 4); i++) wbuffer[i] =3D ntohl(wbu= ffer[i]); // endian swap > >>>>> +#endif > >>> > >>> sim-endian.h already provides a lot of helper funcs that i'm pretty s= ure you=20 > >>> can use here. > >> > >> I don't understand why ntohl() is a problem. It is a common Posix func= tion > >> that converts big endian to host endian, exactly what is needed. Using > >> sim-endian.h pulls in a lot of the sim-*.c files due to dependencies a= nd > >> makes the simulator larger than necessary .... > >=20 > > "network" has no meaning here. using it as a proxy for moving between = big=20 > > endian and native endian when there are clear functions that the sim ha= s=20 > > standardized on isn't correct. your code also (1) requires duplicating= branches=20 > > and (2) inline preprocessor checks. it also does not properly handle b= i-endian=20 > > builds. sim-endian does all of these for you. the whole point of comm= on/ is=20 > > to delete code from each sim rather than open coding it everywhere. > >=20 > > wrt size, i don't think that's a compelling argument. we're talking un= its of=20 > > KiB here, and i can't even count that low :P. > >=20 > > if you're having trouble converting the build over (compiling/linking e= rrors),=20 > > then we can discuss that. but it'd be a matter of "do we do it now or = later"=20 > > rather than "do we do ever convert". >=20 > Right. I tried to use the T2H_4 macro, but can't get it to compile. > I included and added sim-endian.o and sim-io.o to the > Makefile, but it complains about unresolved function etc. Do I really > need to create a sim-main.c and sim-main.h just to use T2H? i've pushed a patch to bury the sim-io.h include in sim-assert.h (since tha= t's=20 the header that actually uses the sim_io_xxx funcs). if you define your ow= n=20 ASSERT/SIM_ASSERT macros, it should be avoided for now. just make sure you= add=20 a note that they should get converted to sim-assert.h at some point. > Is there > any documentation whatsoever on how to use the sim/common interface? not really ... normally you'd use the nrun.c main which implies you'd write= the=20 overall sim in a certain way, so you'd get all the funcs in there for free.= but=20 for existing old sims (like the sparc one), it's harder to deal with. i've been very slowly converting things over -mike --FhxWStFQ84VXWhXs Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-length: 819 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJVA+ccAAoJEEFjO5/oN/WBEQ0QAIDPYAXEOH6m4CkpoWu6L6j7 w0HwCiPtRlGdO4mNP6VZlYvME0qLgd0T3jGpqFziu4Lk73P+OmJkhwhPpAQuUaNP /LuKe0YC9Onrd6bXcXzzlfmVYQs9khSAAgUT4SLfT8yZZtz90v8VErkZw33+bM0F o7X0s79AA6qZw7VRXm6e7qEEkL1PLabACvqDjbM9YdqTPUvDfNN/sCN2H2b/08hr Bh5Pi7MqeEU5suaxn5MdwxJqFjknRzZjxgBSoiWqT/KXyUxfky29JgywacIxEpQg ujsoFIXrx0ps8ulxZ6KLjpPr+bvRt08sYyAWDgUVg/QB/SyTILfGB5msIaGVQb/R 4exueHC2tIEbHUiF3stmzZ4S49ERZln5507lqJc/5nUP+39/qWujYruPFg1s/D82 HUKfReB+4KapbJSGwW98ssCuHyArfQXgQp2EwWNckMtQeYpgDlLs/p2rAwBe73uK XaGxxab9cHNIp6eeW/95a4Dk7j9U0Avm5TyyBxetsKiD9as30nRpEK1Q0Em7T1Zw 2QUci9qz7Xc3fYwnn4GaMESA4s+sDMvt5b4RC+FXXeyedHcGz9Zi6eUJgVU8vjgI E/6e81Ds7T0xVDs7aof4dKWx5cNHKVIOjhzfov6+oPF7yBOMp2atFFsz55uWTKm8 UA4Yi/XxhSrkPq37J629 =2xIL -----END PGP SIGNATURE----- --FhxWStFQ84VXWhXs--