Subject: Re: Saving to 32 bits of GPRs in signal context

From: Segher Boessenkool <[email-masked]>
Date: Wed, 30 May 2007 15:14:06 +0200

>>>  Anyway, please don't. It is *not* portable.
>> What are you talking about ? Really, I mean, I'm not sure I understand
>> what you mean :-)
> Segher stated that there is no portable way of detecting whether 64bit
> instructions are available, and said that just trying a 64bit insn (and
> catching the SIGILL if thre cpu is 32bit) is probably the most portable
> way to do so. (Or did i got *that* wrong? If so, please ignore.)

That is exactly what I said.  Note I didn't say it
is the *best* method, just the most portable one :-)

> Now my objection is that the "SIGILL"-way is not only ugly, but can be
> easily *wrong*, as there are certain possibilities (Book-E 64bit,
> non-64bit-aware OS, ...) when the CPU might not throw an exception.

All those cases would throw an exception.

> (My
> "ffmpeg with vmx"-experience shows this is a real world issue, although
> the situation is a bit different there, i agree, since vmx opcodes are
> not exclusively reserved for vmx)

Yeah nasty business.

Segher