Hi! In comments to my bn_asm.sparc.v8plus.S recently posted to the list
I wrote:
> * Q. What about 64-bit kernels?
> * A. What about 'em? Just kidding:-) I unfortunately didn't have a
> * chance to test it yet, but the below code is 64-bit safe and you
> * shouldn't have any problem with it. What I probably am saying
> * here is that I appreciate feedback on the matter... And yes,
> * you have to feed compiler with -xarch=v9 command line option
> * instead of -xarch=v8plus.
It's wrong! The only thing that was explicitely made 64-bit safe is
frame allocation. I.e. you won't experience stack corruption during
context switches. Pointers don't cause any problem at no additional
cost. But trouble is that these two aren't the only ones you'll face
when compile the module and library with -xarch=v9 option. Indeed! What
'sizeof(BN_ULONG)' would be? As it's currently 'unsigned long' it would
be 8! And what's byte order? Big endian, i.e. 87654321. And the posted
code assumes 43218765 from 32-bit model:-( And there're other
problems... In either case the way I see it's possible to resolve 'em in
two ways:
- generate new bn_asm.sparc.v9.S;
- force the whole bignum library to 32-bit mode even under 64-bit
kernel, i.e. sizeof(BN_ULONG) should return 4, not 8 as it *would* right
now;
*Computationally* above two would be practically indistinguishable
because:
- as 64x64-bits multiplication does *not* produce 128-bits result the
amount of multiplications would be *exactly* the same;
- in the lack of addition with 64-bit carry amount of corresponding
operations to be scheduled won't get smaller;
The only kind of operations you can deduct is loads-n-stores, which is
good. But on the other hand in multiplicatio cases you'd have to
introduce a bunch of shift instructions. Well, there's of course a third
option, namely leave sizeof(BN_ULONG) to be 8, let the compiler do the
job and give up v9 assembler implementation. Performance difference
might be perfectly acceptable... In either case it sounds like time for
me to install 64-bits Solaris and corresponding WorkShop components on
some computer... Well, unless somebody else has already went through all
the way and have all the answers...
Cheers. Andy.
P.S. I'm not familiar with Alpha ISA. I just wonder if 64x64-bits
multiplication produce 128-bits result? MIPS3 and later does...
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]