Re: [RFA] Altivec ABI patches

Kevin Buettner
2002-04-27T08:08:13Z

On Apr 26, 9:44pm, Elena Zannoni wrote:

> > Note that the subsequent memcpy() ends up overwriting the memory
> > zero'd by the assignment. If the assignment does serve some useful
> > purpose, I'd prefer to see memset() used instead.
> >
>
> It does seem odd, I actually just cut and pasted the code from a few
> lines above. I thought there was some reason for it, after all.
>
> {
> *(int *) &registers[REGISTER_BYTE (greg)] = 0;
> memcpy (&registers[REGISTER_BYTE (greg)], val_buf, 4);
> greg++;
> }
>
> Should this go as well, then?

Yes, definitely. As written, this code could yield some very
unexpected results on certain hosts.

Thanks for pointing this out. This is very likely a mistake that I
made a while back.

> Unless it always writes 4 bytes, but the
> size of the general register can be bigger?

Well, the code in question doesn't work for 64-bit ABIs, but then, as
I understand it, the 64-bit PowerPC SVR4 ABI resembles the old PowerOpen
ABI than it does the 32-bit SVR4 ABI. (Actually, I don't know that
much about it. If someone could give me a pointer to an ABI spec for
the 64-bit ABI, I would appreciate it very much.)

Kevin