svn commit: r293775 - head/sys/boot/uboot/lib

Brooks Davis brooks at freebsd.org
Wed Jan 13 01:03:57 UTC 2016


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:
> 
> subldr = rounddown2((uintptr_t)_start, KERN_ALIGN);
> 
> vs the original:
> 
> subldr = rounddown2((uint64_t)(uintptr_t)_start, KERN_ALIGN);
> 
> 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

> 
> 
> 
> 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 = 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.
> >>>     
> >>>     I had no idea there was such a thing as uintfptr_t.
> >>>     
> >>>     Requested by: bde
> >>>
> >>> Modified:
> >>>     head/sys/boot/uboot/lib/copy.c
> >>>
> >>> Modified: head/sys/boot/uboot/lib/copy.c
> >>> ===================================================================
> >>> ===========
> >>> --- head/sys/boot/uboot/lib/copy.c	Tue Jan 12 16:21:34 2016	
> >>> (r293774)
> >>> +++ head/sys/boot/uboot/lib/copy.c	Tue Jan 12 16:31:07 2016	
> >>> (r293775)
> >>> @@ -100,7 +100,7 @@ uboot_loadaddr(u_int type, void *data, u
> >>>    
> >>>    		biggest_block = 0;
> >>>    		biggest_size = 0;
> >>> -		subldr = rounddown2((uint64_t)(uintptr_t)_start,
> >>> KERN_ALIGN);
> >>> +		subldr = rounddown2((uintfptr_t)_start,
> >>> KERN_ALIGN);
> >>>    		eubldr = roundup2((uint64_t)uboot_heap_end,
> >>> KERN_ALIGN);
> >>>    		for (i = 0; i < si->mr_no; i++) {
> >>>    			if (si->mr[i].flags != MR_ATTR_DRAM)
> >>>
> >>
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/svn-src-head/attachments/20160113/10698531/attachment.sig>


More information about the svn-src-head mailing list