Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Jul 2014 08:46:49 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        John-Mark Gurney <jmg@funkthat.com>
Cc:        Tim Kientzle <tim@kientzle.com>, freebsd-arm <freebsd-arm@freebsd.org>, Fabien Thomas <fabient@freebsd.org>, Ian Lepore <ian@freebsd.org>, arch@freebsd.org
Subject:   Re: [CFR] mge driver / elf reloc
Message-ID:  <9464C309-B390-4A27-981A-E854921B1C98@bsdimp.com>
In-Reply-To: <20140720231056.GQ45513@funkthat.com>
References:  <14D22EA6-B73C-47BA-9A86-A957D24F23B8@freebsd.org> <1405810447.85788.41.camel@revolution.hippie.lan> <20140720220514.GP45513@funkthat.com> <F6D53A17-FED0-4F08-BB5B-9F66C5AF5EF6@kientzle.com> <20140720231056.GQ45513@funkthat.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_034E84E0-2852-49EA-AC44-CF120A14ECC5
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=windows-1252


On Jul 20, 2014, at 5:10 PM, John-Mark Gurney <jmg@funkthat.com> wrote:

> Tim Kientzle wrote this message on Sun, Jul 20, 2014 at 15:25 -0700:
>>=20
>> On Jul 20, 2014, at 3:05 PM, John-Mark Gurney <jmg@funkthat.com> =
wrote:
>>=20
>>> Ian Lepore wrote this message on Sat, Jul 19, 2014 at 16:54 -0600:
>>>> Sorry to take so long to reply to this, I'm trying to get caught =
up.  I
>>>> see you've already committed the mge fixes.  I think the ELF =
alignment
>>>> fix looks good and should also be committed.
>>>=20
>>> So, re the elf alignment...
>>>=20
>>> I think we should get a set of macros that handle load/stores =
to/from
>>> unaligned addresses that are transparent to the caller....  I need
>>> these for some other code I'm writing...=20
>>>=20
>>> I thought Open/Net had these available, but I can't seem to find =
them
>>> right now...
>>=20
>> $ man 9 byteorder
>>=20
>> is most of what you want, lacking only some aliases to pick
>> the correct macro for native byte order.
>=20
> Um, those doesn't help if you want native endian order=85

Ummm, yes they do. enc converts from native order. dec decodes to native =
byte
order. They are more general cases than the ntoh* functions that are =
more traditional
since they also work on byte streams that may not be completely aligned =
when
sitting in memory. Which is what you are asking for.

> Also, only the enc/dec functions are documented to work on non-aligned
> address, so that doesn't help in most cases=85

They work on all addresses. They are even documented to work on any =
address:

     The be16enc(), be16dec(), be32enc(), be32dec(), be64enc(), =
be64dec(),
     le16enc(), le16dec(), le32enc(), le32dec(), le64enc(), and =
le64dec()
     functions encode and decode integers to/from byte strings on any =
align-
     ment in big/little endian format.

So they are quite useful in general. Peeking under the covers at the =
implementation
also shows they will work for any alignment, so I=92m having trouble =
understanding
where this objection is really coming from.

Warner


--Apple-Mail=_034E84E0-2852-49EA-AC44-CF120A14ECC5
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - https://gpgtools.org

iQIcBAEBCgAGBQJTzSfZAAoJEGwc0Sh9sBEAtwQQANWF//KOUKKWQ4IVrQUwsOVf
BAGJz6ulwAR/lAt22Wx8jXyxGcl/uKql6nxmsakPSgOB/9Pb+iqkkYUmsAjlrK9J
iXYQ/QtkJmdht8VZUkabIovz/KRpP2r1qLwszVoo/lSUb5OBM9bI8zVmNaFCsvIS
SvUPzrz1VLjYlGSTVXvSXN+Qd46J750cs9Hb19CnbRZ5pZ0pRzUIufY/G+XdzJqX
TLAxasKDdYtXIUbOydNpucD9wA5tiiMajQRJyFaZuBv5SkfPH6BTac/XYrJz8uc7
bW1rkANW0THGVPQFjETh5VvkK/TlDDUIgJ/lFhwf/ZvtsAgT0mKTUK6twHc0N4Sn
EuJer92IuDfqCIdmlQ0eyzvgLCsGRM3Pr6OCZwYUmwQ4k8JQEF9hmM4o/RzUocue
HiG1NPwLZNVx84xr0+5wr9TC71hHBcG7goIAdoxY0cinJFiwK3E1zg4Dr8pRicf0
HJpsTq9lGHy7x6fEN25akJM0I3I3Eph8DgazazaSi0vMDSRqMOPsvjUgQ3e9Bzo2
/QGjI8miyXR8US341cS2VxugI0y2PSmwUYrFymbMKgSlTvJYXV2yKhPPoT7nVcpO
NDpnfDf5EHT2q9eYr1iKs5y09Ed1QyBnOA/6VLKDPVIjptYpcxZk/xGd7Vm61cOX
Ula38Jy3qNhbDLxuHzSQ
=IL3U
-----END PGP SIGNATURE-----

--Apple-Mail=_034E84E0-2852-49EA-AC44-CF120A14ECC5--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9464C309-B390-4A27-981A-E854921B1C98>