Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Jan 2016 01:03:48 +0000
From:      Brooks Davis <brooks@freebsd.org>
To:        Steven Hartland <steven.hartland@multiplay.co.uk>
Cc:        Ian Lepore <ian@freebsd.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r293775 - head/sys/boot/uboot/lib
Message-ID:  <20160113010348.GF79262@spindle.one-eyed-alien.net>
In-Reply-To: <56959D45.7070204@multiplay.co.uk>
References:  <201601121631.u0CGV7v6074494@repo.freebsd.org> <569582F6.4060108@multiplay.co.uk> <1452644710.46848.31.camel@freebsd.org> <56959D45.7070204@multiplay.co.uk>

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

--a+b56+3nqLzpiR9O
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Jan 13, 2016 at 12:41:41AM +0000, Steven Hartland wrote:
> Was this meant to be a full revert as you now have:
>=20
> subldr =3D rounddown2((uintptr_t)_start, KERN_ALIGN);
>=20
> vs the original:
>=20
> subldr =3D rounddown2((uint64_t)(uintptr_t)_start, KERN_ALIGN);
>=20
> i.e. missing the final conversion to uint64_t?

The cast through uint64_t isn't allowed by the standard if you want the
result to be a function pointer.  The implementation of rounddown2()
should work fine on an uintptr_t even for fairly radical implementations.

-- Brooks

>=20
>=20
>=20
> On 13/01/2016 00:25, Ian Lepore wrote:
> > On Tue, 2016-01-12 at 22:49 +0000, Steven Hartland wrote:
> >> I think this breaks arm arches:
> >> /usr/home/smh/freebsd/base/head1/sys/boot/uboot/lib/copy.c:103:24:
> >> error: use of undeclared identifier 'uintfptr_t'
> >>                   subldr =3D rounddown2((uintfptr_t)_start, KERN_ALIGN=
);
> >>                                        ^
> >> /usr/home/smh/freebsd/base/head1/sys/boot/uboot/lib/../../../sys/para
> >> m.h:295:28:
> >> note: expanded from macro 'rounddown2'
> >> #define rounddown2(x, y) ((x)&(~((y)-1)))          /* if y is power
> >> of
> >> two */
> >>
> > Ooops, sorry.  Should be fixed now.
> >
> > -- Ian
> >
> >> On 12/01/2016 16:31, Ian Lepore wrote:
> >>> Author: ian
> >>> Date: Tue Jan 12 16:31:07 2016
> >>> New Revision: 293775
> >>> URL: https://svnweb.freebsd.org/changeset/base/293775
> >>>
> >>> Log:
> >>>     Cast using uintfptr_t and eliminate the cast to uint64_t which
> >>> is uneeded
> >>>     because rounding down cannot increase the number of bits needed
> >>> to express
> >>>     the result.
> >>>    =20
> >>>     I had no idea there was such a thing as uintfptr_t.
> >>>    =20
> >>>     Requested by: bde
> >>>
> >>> Modified:
> >>>     head/sys/boot/uboot/lib/copy.c
> >>>
> >>> Modified: head/sys/boot/uboot/lib/copy.c
> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> >>> --- head/sys/boot/uboot/lib/copy.c	Tue Jan 12 16:21:34 2016=09
> >>> (r293774)
> >>> +++ head/sys/boot/uboot/lib/copy.c	Tue Jan 12 16:31:07 2016=09
> >>> (r293775)
> >>> @@ -100,7 +100,7 @@ uboot_loadaddr(u_int type, void *data, u
> >>>   =20
> >>>    		biggest_block =3D 0;
> >>>    		biggest_size =3D 0;
> >>> -		subldr =3D rounddown2((uint64_t)(uintptr_t)_start,
> >>> KERN_ALIGN);
> >>> +		subldr =3D rounddown2((uintfptr_t)_start,
> >>> KERN_ALIGN);
> >>>    		eubldr =3D roundup2((uint64_t)uboot_heap_end,
> >>> KERN_ALIGN);
> >>>    		for (i =3D 0; i < si->mr_no; i++) {
> >>>    			if (si->mr[i].flags !=3D MR_ATTR_DRAM)
> >>>
> >>
>=20
>=20

--a+b56+3nqLzpiR9O
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAEBAgAGBQJWlaJzAAoJEKzQXbSebgfA12gH/1Tf3ZSe6+pKCDzAPYX3Ab1r
yjPhwCvo2bXEw6gWoeNaU+l4uFwGmH+q97RQfdYwadJKZSx6YuG09fwZmBRvregZ
QgFD7zGPnXGSWW/zv7bamXwc/u72aMx40YLqzAt0ivyMs3pjQmhyw4ltQ3FYCYet
JDDHC7HJHuJ5Sw6Pnk931vq7VzGMnnPll2Y7agVucf7GlSf7zcOIFVzeaBg1aKm8
rf0JZW3NXvVSffQXAD2x9Z/6SVSVeyn+AcstwDUPWs/EWnijMun3G5qq71ZKkr7H
Dr/W5jbQ6fL7KDJHnUwapMr7N9lUcJpqmIUZDOMttAQRdzQfNXd5ASv62sHHq1Y=
=KySu
-----END PGP SIGNATURE-----

--a+b56+3nqLzpiR9O--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160113010348.GF79262>