[patch] Misc fixes for Cbe bindings

Jules Bergmann jules at codesourcery.com
Fri Apr 13 21:33:15 UTC 2007


This patch fixes two bugs:

* First, the vmul was not updating the length processed by the main DMA 
loop properly, which caused the cleanup code to get a bogus length. 
Fixed, and added regression to cover this.

* Second, using reinterpret cast to convert pointers to 64-bit unsigned 
long longs does not work properly if the high-order bit of the pointer 
was set.  A 32-bit pointer like 0x8000000 is converted to a 64-bit value 
0xffffffff80000000.  I.e. even though both the pointer and the result 
are unsigned, sign extension was going on.

Don't know if that is the right behavior from a C/C++ point of view.  It 
does not seem intuitive to sign-extend when the result is unsigned.

Regardless, this patch adds a new function 'ea_from_ptr()' that should 
convert 32-bit and 64-bit pointers to unsigned long longs.

This bug showed up when the weights for vmmul were allocated in a huge 
page, which had the high-order address bit set.  The sign extended 
address caused mfc_get to hang.

However, we've been giving sign extended addresses to ALF for a while 
now, and it "works" OK.  Something in ALF must be broken when dealing 
with 64-bit addresses that causes it to ignore the high-order 32-bits.

Ok to commit?

Don, if you would like to commit the fastconv patch first, then I can 
merge this in.

				-- Jules


-- 
Jules Bergmann
CodeSourcery
jules at codesourcery.com
(650) 331-3385 x705
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cbe.diff
URL: <http://sourcerytools.com/pipermail/vsipl++/attachments/20070413/f258d882/attachment.ksh>


More information about the vsipl++ mailing list