Re: [PATCH] MIPS,prctl: add PR_[GS]ET_FP_MODE prctl options for MIPS

From: Markos Chandras
Date: Fri Jan 16 2015 - 10:43:59 EST


On 01/13/2015 01:12 PM, Markos Chandras wrote:
> On 01/08/2015 12:17 PM, Paul Burton wrote:
>> Userland code may be built using an ABI which permits linking to objects
>> that have more restrictive floating point requirements. For example,
>> userland code may be built to target the O32 FPXX ABI. Such code may be
>> linked with other FPXX code, or code built for either one of the more
>> restrictive FP32 or FP64. When linking with more restrictive code, the
>> overall requirement of the process becomes that of the more restrictive
>> code. The kernel has no way to know in advance which mode the process
>> will need to be executed in, and indeed it may need to change during
>> execution. The dynamic loader is the only code which will know the
>> overall required mode, and so it needs to have a means to instruct the
>> kernel to switch the FP mode of the process.
>>
>> This patch introduces 2 new options to the prctl syscall which provide
>> such a capability. The FP mode of the process is represented as a
>> simple bitmask combining a number of mode bits mirroring those present
>> in the hardware. Userland can either retrieve the current FP mode of
>> the process:
>>
>> mode = prctl(PR_GET_FP_MODE);
>> [...]
>> +int mips_set_process_fp_mode(struct task_struct *task, unsigned int value)
>> +{
>> + const unsigned int known_bits = PR_FP_MODE_FR | PR_FP_MODE_FRE;
>> + unsigned long switch_count;
>> + struct task_struct *t;
>> +
>> + /* Check the value is valid */
>> + if (value & ~known_bits)
>> + return -EOPNOTSUPP;
>> +
>> + /* Avoid inadvertently triggering emulation */
>> + if ((value & PR_FP_MODE_FR) && cpu_has_fpu &&
>> + !(current_cpu_data.fpu_id & MIPS_FPIR_F64))
>> + return -EOPNOTSUPP;
>> + if ((value & PR_FP_MODE_FRE) && !cpu_has_fre)
>> + return -EOPNOTSUPP;
>> +

Hi Paul,

Do you think you can address this[1] suggestion by Matthew in this patch
since this hasn't been merged yet? Thanks

[1] http://www.linux-mips.org/archives/linux-mips/2015-01/msg00265.html

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