diff options
Diffstat (limited to 'arch/powerpc/kernel/process.c')
-rw-r--r-- | arch/powerpc/kernel/process.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 3573d186505f..5fc5906ec337 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c | |||
@@ -1296,6 +1296,19 @@ int set_fpexc_mode(struct task_struct *tsk, unsigned int val) | |||
1296 | if (val & PR_FP_EXC_SW_ENABLE) { | 1296 | if (val & PR_FP_EXC_SW_ENABLE) { |
1297 | #ifdef CONFIG_SPE | 1297 | #ifdef CONFIG_SPE |
1298 | if (cpu_has_feature(CPU_FTR_SPE)) { | 1298 | if (cpu_has_feature(CPU_FTR_SPE)) { |
1299 | /* | ||
1300 | * When the sticky exception bits are set | ||
1301 | * directly by userspace, it must call prctl | ||
1302 | * with PR_GET_FPEXC (with PR_FP_EXC_SW_ENABLE | ||
1303 | * in the existing prctl settings) or | ||
1304 | * PR_SET_FPEXC (with PR_FP_EXC_SW_ENABLE in | ||
1305 | * the bits being set). <fenv.h> functions | ||
1306 | * saving and restoring the whole | ||
1307 | * floating-point environment need to do so | ||
1308 | * anyway to restore the prctl settings from | ||
1309 | * the saved environment. | ||
1310 | */ | ||
1311 | tsk->thread.spefscr_last = mfspr(SPRN_SPEFSCR); | ||
1299 | tsk->thread.fpexc_mode = val & | 1312 | tsk->thread.fpexc_mode = val & |
1300 | (PR_FP_EXC_SW_ENABLE | PR_FP_ALL_EXCEPT); | 1313 | (PR_FP_EXC_SW_ENABLE | PR_FP_ALL_EXCEPT); |
1301 | return 0; | 1314 | return 0; |
@@ -1327,9 +1340,22 @@ int get_fpexc_mode(struct task_struct *tsk, unsigned long adr) | |||
1327 | 1340 | ||
1328 | if (tsk->thread.fpexc_mode & PR_FP_EXC_SW_ENABLE) | 1341 | if (tsk->thread.fpexc_mode & PR_FP_EXC_SW_ENABLE) |
1329 | #ifdef CONFIG_SPE | 1342 | #ifdef CONFIG_SPE |
1330 | if (cpu_has_feature(CPU_FTR_SPE)) | 1343 | if (cpu_has_feature(CPU_FTR_SPE)) { |
1344 | /* | ||
1345 | * When the sticky exception bits are set | ||
1346 | * directly by userspace, it must call prctl | ||
1347 | * with PR_GET_FPEXC (with PR_FP_EXC_SW_ENABLE | ||
1348 | * in the existing prctl settings) or | ||
1349 | * PR_SET_FPEXC (with PR_FP_EXC_SW_ENABLE in | ||
1350 | * the bits being set). <fenv.h> functions | ||
1351 | * saving and restoring the whole | ||
1352 | * floating-point environment need to do so | ||
1353 | * anyway to restore the prctl settings from | ||
1354 | * the saved environment. | ||
1355 | */ | ||
1356 | tsk->thread.spefscr_last = mfspr(SPRN_SPEFSCR); | ||
1331 | val = tsk->thread.fpexc_mode; | 1357 | val = tsk->thread.fpexc_mode; |
1332 | else | 1358 | } else |
1333 | return -EINVAL; | 1359 | return -EINVAL; |
1334 | #else | 1360 | #else |
1335 | return -EINVAL; | 1361 | return -EINVAL; |