From: Mike Frysinger <vapier@gentoo.org>
To: Jiri Gaisler <jiri@gaisler.se>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v3 03/14] sim/erc32: Switched emulated memory to host endian order.
Date: Tue, 17 Mar 2015 08:06:00 -0000 [thread overview]
Message-ID: <20150317080653.GD8109@vapier> (raw)
In-Reply-To: <55049DBE.5080204@gaisler.se>
[-- Attachment #1: Type: text/plain, Size: 4556 bytes --]
On 14 Mar 2015 21:44, Jiri Gaisler wrote:
> On 14/03/15 11:23, Mike Frysinger wrote:
> > On 14 Mar 2015 10:23, Jiri Gaisler wrote:
> >> On 14/03/15 08:45, Mike Frysinger wrote:
> >>> 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 = 0; i < (count / 4); i++) wbuffer[i] = ntohl(wbuffer[i]); // endian swap
> >>>>>>>>> +#endif
> >>>>>>>
> >>>>>>> sim-endian.h already provides a lot of helper funcs that i'm pretty sure you
> >>>>>>> can use here.
> >>>>>>
> >>>>>> I don't understand why ntohl() is a problem. It is a common Posix function
> >>>>>> 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 and
> >>>>>> makes the simulator larger than necessary ....
> >>>>>
> >>>>> "network" has no meaning here. using it as a proxy for moving between big
> >>>>> endian and native endian when there are clear functions that the sim has
> >>>>> standardized on isn't correct. your code also (1) requires duplicating branches
> >>>>> and (2) inline preprocessor checks. it also does not properly handle bi-endian
> >>>>> builds. sim-endian does all of these for you. the whole point of common/ is
> >>>>> to delete code from each sim rather than open coding it everywhere.
> >>>>>
> >>>>> wrt size, i don't think that's a compelling argument. we're talking units of
> >>>>> KiB here, and i can't even count that low :P.
> >>>>>
> >>>>> if you're having trouble converting the build over (compiling/linking errors),
> >>>>> then we can discuss that. but it'd be a matter of "do we do it now or later"
> >>>>> rather than "do we do ever convert".
> >>>>
> >>>> Right. I tried to use the T2H_4 macro, but can't get it to compile.
> >>>> I included <sim-basics.h> 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 that's
> >>> the header that actually uses the sim_io_xxx funcs). if you define your own
> >>> ASSERT/SIM_ASSERT macros, it should be avoided for now. just make sure you add
> >>> a note that they should get converted to sim-assert.h at some point.
> >>
> >> I'm not sure this helps. sim-endian.c includes sim-assert.h, so I get the
> >> same problem even after your patch:
> >>
> >> gcc -DHAVE_CONFIG_H -DPROFILE=1 -DWITH_PROFILE=-1 -DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN -DDEFAULT_INLINE=0 -DFAST_UART -I../../../../../ibm/src/gdb/binutils-gdb/sim/erc32/../.. -I. -I../../../../../ibm/src/gdb/binutils-gdb/sim/erc32 -I../common
> >> -I../../../../../ibm/src/gdb/binutils-gdb/sim/erc32/../common -I../../include -I../../../../../ibm/src/gdb/binutils-gdb/sim/erc32/../../include -I../../bfd -I../../../../../ibm/src/gdb/binutils-gdb/sim/erc32/../../bfd -I../../opcodes
> >> -I../../../../../ibm/src/gdb/binutils-gdb/sim/erc32/../../opcodes -g -O2 -static-libstdc++ -static-libgcc -o run \
> >> run.o libsim.a ../../bfd/libbfd.a ../../opcodes/libopcodes.a ../../libiberty/libiberty.a -ltermcap -ldl -lz -lnsl ../../readline/libreadline.a -ltermcap -lm
> >> libsim.a(sim-endian.o): In function `offset_1':
> >> /home/jiri/src/gdb/v4/sim/erc32/../../../../../ibm/src/gdb/binutils-gdb/sim/erc32/../common/sim-n-endian.h:145: undefined reference to `sim_io_error'
> >
> > did you define ASSERT/SIM_ASSERT before including sim-endian.h ?
>
> No, I included sim-basic.h in my code. Including sim-endian.h only will not
> work due to dependencies on other include files. I don't see how this will
> change how sim-endian.o is built though, as it is compiled separately.
>
> I did manage to compile the code by including sim-endian.c directly into my
> own code (func.c) rather then building it separately:
>
> #include <sim-assert.h>
> #undef ASSERT
> #define ASSERT(x) if (0) {}
> #include <sim-endian.c>
>
> Is this acceptable ...?
lets go with your first patch with some /* TODO */ added in these areas. we
need to some more clean up in this sim and lay some basic ground work before we
can have it start using common/. i didn't realize just how disconnected erc32
was from everything else.
-mike
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-03-17 8:06 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-01 21:10 [PATCH v3 00/14] Update of the SPARC SIS simulator Jiri Gaisler
2015-03-01 21:10 ` [PATCH v3 02/14] sim/erc32: Removed type mismatch compiler warnings Jiri Gaisler
2015-03-02 1:04 ` Mike Frysinger
2015-03-01 21:10 ` [PATCH v3 05/14] sim/erc32: Use memory_iread() function for instruction fetching Jiri Gaisler
2015-03-02 1:15 ` Mike Frysinger
[not found] ` <55020795.4080009@gaisler.se>
2015-03-13 0:15 ` Mike Frysinger
2015-03-01 21:10 ` [PATCH v3 06/14] sim/erc32: Fix a few compiler warnings Jiri Gaisler
2015-03-02 1:18 ` Mike Frysinger
2015-03-01 21:10 ` [PATCH v3 03/14] sim/erc32: Switched emulated memory to host endian order Jiri Gaisler
2015-03-02 1:13 ` Mike Frysinger
2015-03-12 21:25 ` Jiri Gaisler
2015-03-12 23:55 ` Mike Frysinger
[not found] ` <55029ED9.5070009@gaisler.se>
2015-03-14 7:45 ` Mike Frysinger
[not found] ` <5503FDF9.8000109@gaisler.se>
2015-03-14 10:24 ` Mike Frysinger
2015-03-14 20:44 ` Jiri Gaisler
2015-03-17 8:06 ` Mike Frysinger [this message]
2015-03-21 20:40 ` Jiri Gaisler
2015-03-01 21:11 ` [PATCH v3 13/14] sim/erc32: Add data watchpoint support Jiri Gaisler
2015-03-01 21:11 ` [PATCH v3 11/14] sim/erc32: Add support for LEON2 processor emulation Jiri Gaisler
2015-03-01 21:11 ` [PATCH v3 10/14] sim/erc32: Add support for LEON3 " Jiri Gaisler
2015-03-05 17:35 ` Mike Frysinger
2015-03-05 17:49 ` Joel Brobecker
2015-03-05 18:20 ` Mike Frysinger
2015-03-01 21:11 ` [PATCH v3 07/14] sim/erc32: Use gdb callback for UART I/O when linked with gdb Jiri Gaisler
2015-03-02 1:19 ` Mike Frysinger
2015-03-01 21:11 ` [PATCH v3 14/14] Add watchpoint support to gdb simulator interface Jiri Gaisler
2015-03-01 21:11 ` [PATCH v3 04/14] sim/erc32: use SIM_AC_OPTION_HOSTENDIAN to probe for host endianess Jiri Gaisler
2015-03-16 5:19 ` Mike Frysinger
2015-03-01 21:11 ` [PATCH v3 09/14] sim/erc32: Move local extern declarations into sis.h Jiri Gaisler
2015-03-01 21:11 ` [PATCH v3 01/14] sim/erc32: Added -v command line switch for verbose output Jiri Gaisler
2015-03-02 0:59 ` Mike Frysinger
2015-03-01 21:11 ` [PATCH v3 08/14] sim/erc32: Access memory subsystem through struct memsys Jiri Gaisler
2015-03-02 1:20 ` Mike Frysinger
2015-03-01 21:11 ` [PATCH v3 12/14] sim/erc32: Updated documentation Jiri Gaisler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150317080653.GD8109@vapier \
--to=vapier@gentoo.org \
--cc=gdb-patches@sourceware.org \
--cc=jiri@gaisler.se \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox