Re: [PATCH, RFC] x86-64: properly handle FPU code/data selectors

From: H. Peter Anvin
Date: Wed Oct 16 2013 - 13:14:31 EST


On 10/16/2013 09:07 AM, Jan Beulich wrote:
>
>> Furthermore, you define X86_FEATURE_NO_FPU_SEL, but you don't set it
>> anywhere. At least that bit needs to be factored out into a separate patch.
>
> That's already being done in get_cpu_cap(), as it's part of
> x86_capability[9].
>

Ah, sorry, my bad. For some reason I thought you added it to word 3,
but this is a hardware-provided CPUID bit. I, if anyone, should have
known :)

>> + if (config_enabled(CONFIG_IA32_EMULATION) &&
>> + test_tsk_thread_flag(tsk, TIF_IA32))
>>
>> is_ia32_task()?
>
> That'd imply that "tsk == current" in all cases, which I don't
> think is right here.

True. It wold be good to have an equivalent predicate function for
another task, though.

This assumes the process doesn't switch modes on us, which it is allowed
to do. For that it really would be better to look at the CS.L bit,
which can be done with the LAR instruction for the current task;
otherwise we'd have to walk the descriptor tables.

-hpa

--
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/