lkml.org 
[lkml]   [2009]   [Jun]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC 6/7] x86: Move kernel_fpu_using to asm/i387.h
Ingo Molnar wrote:
>>
>> +static inline int kernel_fpu_using(void)
>> +{
>> + if (in_interrupt() && !(read_cr0() & X86_CR0_TS))
>> + return 1;
>> + return 0;
>> +}
>> +
>
> Looks sane to me. Herbert, do you ack it?
>

Although I have to say, the structure of:

if (boolean test)
return 1;
return 0;

... truly was hit with the ugly stick. It really should be:

static inline bool kernel_fpu_using(void)
{
return in_interrupt() && !(read_cr0() && C86_CR0_TS);
}

Huang: if I recall correctly, these functions were originally designed
to deal with the fact that VIA processors generate spurious #TS faults
due to broken design of the Padlock instructions. The AES and PCLMUL
instructions actually use SSE registers and so will require different
structure.

-hpa

--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.



\
 
 \ /
  Last update: 2009-06-17 19:29    [W:0.059 / U:0.320 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site