On Mon, 2014-04-07 at 18:22 +0200, Albert ARIBAUD wrote:
> Hi Charles,
> 
> On Wed, 5 Mar 2014 11:30:26 +1300, Charles Manning
> <cdhmann...@gmail.com> wrote:
> 
> > Hello All
> > 
> > I am currently reworking a socfpga signer patch which is part of mkimage.
> > 
> > One thing I need to do is to stuff some bytes into a header ensuring the
> > endianism is correct.
> > 
> > This is a trivial thing to do in C, but I have been instructed to use the
> > existing functions put_unaligned_le32() etc.
> > 
> > These are part of Linux in linux/unaligned/access_ok.h. But this includes
> > <asm/*>
> > 
> > It seems to me that this mixing of host space and target space is
> > potentially problematic.
> 
> Hmm... Where exactly is there a mixing of host and target?

arch/<whatever>/include/asm are target-specific headers.  I suppose the
headers in arch/sandbox would work, but is that currently what will be
used if a host tool references an asm/ header?  Plus, it's
Linux-specific.

Or if you mean to include the host's asm/ headers, that's also
Linux-specific.

> > Is this a safe thing to do?

In tools/relocate-rela.c I open-coded endian swapping because I didn't
see a better way to do so portably (outside of the networking functions
which didn't do what I needed).  Perhaps that could be factored out (and
extended to other sizes) to somewhere common.

-Scott


_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to