Re: [PATCH 02/11] x86: Merge fpu_init()

From: Brian Gerst
Date: Sun Aug 29 2010 - 20:44:12 EST


On Sun, Aug 29, 2010 at 2:29 PM, Pekka Enberg <penberg@xxxxxxxxxx> wrote:
> On Sat, Aug 28, 2010 at 7:04 PM, Brian Gerst <brgerst@xxxxxxxxx> wrote:
>> @@ -80,7 +80,6 @@ static void __cpuinit init_thread_xstate(void)
>> Â#endif
>> Â}
>>
>> -#ifdef CONFIG_X86_64
>> Â/*
>> Â* Called at bootup to set up the initial FPU state that is later cloned
>> Â* into all processes.
>> @@ -88,12 +87,20 @@ static void __cpuinit init_thread_xstate(void)
>>
>> Âvoid __cpuinit fpu_init(void)
>> Â{
>> - Â Â Â unsigned long oldcr0 = read_cr0();
>> + Â Â Â unsigned long cr0;
>> + Â Â Â unsigned long cr4_mask = 0;
>>
>> - Â Â Â set_in_cr4(X86_CR4_OSFXSR);
>> - Â Â Â set_in_cr4(X86_CR4_OSXMMEXCPT);
>> + Â Â Â if (cpu_has_fxsr)
>> + Â Â Â Â Â Â Â cr4_mask |= X86_CR4_OSFXSR;
>> + Â Â Â if (cpu_has_xmm)
>> + Â Â Â Â Â Â Â cr4_mask |= X86_CR4_OSXMMEXCPT;
>> + Â Â Â set_in_cr4(cr4_mask);
>
> Is calling set_in_cr4() unconditionally safe for 32-bit CPUs that
> don't have cr4? AFAICT, no, because it uses read_cr4().
>

Good catch, will fix.
--
Brian Gerst
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/