From owner-freebsd-arch@FreeBSD.ORG Mon Jul 21 14:46:41 2014 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7DED4119 for ; Mon, 21 Jul 2014 14:46:41 +0000 (UTC) Received: from mail-ie0-f182.google.com (mail-ie0-f182.google.com [209.85.223.182]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 40A5F2DE8 for ; Mon, 21 Jul 2014 14:46:40 +0000 (UTC) Received: by mail-ie0-f182.google.com with SMTP id y20so6918395ier.27 for ; Mon, 21 Jul 2014 07:46:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:content-type:mime-version:subject:from :in-reply-to:date:cc:message-id:references:to; bh=A5erOhAY4+GeP9su/j+jYVNuXCwQ35/Ztm9Cc2Qi4mk=; b=F4qOwBfkllfOCNHcXUEIP+60FqvfFbva0WofIyb1vqDyD2pf6ZQx2dsvDpjqM4GdC/ U5nqoD4tvY9FPfguMQy3vGpt+1NcP/kxuyLhicb7Pm8FXhZTysqSO5T7C2ZNYVN2yde3 W1BeEeqr/DKOmagLKyae+W8AVoYCY8n7I6FZE/Ia5dl+2Agx9w20RKnvNi9qHjYMrNCz j2KbGfm6CvcId+HRxeDHEkV4M0ZabxczNCo1mnP4C0BPGfFbpARW/UaCBz71qCrayvyg jTYNZTv29xmx/jLIjITmPg3rbUaFu863NwHwfjDaUzp1JF5PLyEGJplHMTNTy3urR3IG bmPQ== X-Gm-Message-State: ALoCoQmvAqbanXNEYCdLPOqAl3itO6NNivbpBY85rLs88TySgiTb1MT+hS9O5JQSIn7U95tsOAKi X-Received: by 10.50.43.202 with SMTP id y10mr5984003igl.10.1405953999771; Mon, 21 Jul 2014 07:46:39 -0700 (PDT) Received: from bsdimp.bsdimp.com (50-78-194-198-static.hfc.comcastbusiness.net. [50.78.194.198]) by mx.google.com with ESMTPSA id hu5sm18932790igb.16.2014.07.21.07.46.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 21 Jul 2014 07:46:39 -0700 (PDT) Sender: Warner Losh Content-Type: multipart/signed; boundary="Apple-Mail=_034E84E0-2852-49EA-AC44-CF120A14ECC5"; protocol="application/pgp-signature"; micalg=pgp-sha512 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: [CFR] mge driver / elf reloc From: Warner Losh In-Reply-To: <20140720231056.GQ45513@funkthat.com> Date: Mon, 21 Jul 2014 08:46:49 -0600 Message-Id: <9464C309-B390-4A27-981A-E854921B1C98@bsdimp.com> References: <14D22EA6-B73C-47BA-9A86-A957D24F23B8@freebsd.org> <1405810447.85788.41.camel@revolution.hippie.lan> <20140720220514.GP45513@funkthat.com> <20140720231056.GQ45513@funkthat.com> To: John-Mark Gurney X-Mailer: Apple Mail (2.1878.6) Cc: Tim Kientzle , freebsd-arm , Fabien Thomas , Ian Lepore , arch@freebsd.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jul 2014 14:46:41 -0000 --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 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 = 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--