.. | .. |
---|
6 | 6 | |
---|
7 | 7 | #include <asm/cachectl.h> |
---|
8 | 8 | #include <asm/proc-fns.h> |
---|
| 9 | +#include <asm/fpu.h> |
---|
| 10 | +#include <asm/fp_udfiex_crtl.h> |
---|
9 | 11 | |
---|
10 | 12 | SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len, |
---|
11 | 13 | unsigned long, prot, unsigned long, flags, |
---|
.. | .. |
---|
48 | 50 | |
---|
49 | 51 | return 0; |
---|
50 | 52 | } |
---|
| 53 | + |
---|
| 54 | +SYSCALL_DEFINE2(fp_udfiex_crtl, unsigned int, cmd, unsigned int, act) |
---|
| 55 | +{ |
---|
| 56 | +#if IS_ENABLED(CONFIG_SUPPORT_DENORMAL_ARITHMETIC) |
---|
| 57 | + int old_udf_iex; |
---|
| 58 | + |
---|
| 59 | + if (!used_math()) { |
---|
| 60 | + load_fpu(&init_fpuregs); |
---|
| 61 | + current->thread.fpu.UDF_IEX_trap = init_fpuregs.UDF_IEX_trap; |
---|
| 62 | + set_used_math(); |
---|
| 63 | + } |
---|
| 64 | + |
---|
| 65 | + old_udf_iex = current->thread.fpu.UDF_IEX_trap; |
---|
| 66 | + act &= (FPCSR_mskUDFE | FPCSR_mskIEXE); |
---|
| 67 | + |
---|
| 68 | + switch (cmd) { |
---|
| 69 | + case DISABLE_UDF_IEX_TRAP: |
---|
| 70 | + current->thread.fpu.UDF_IEX_trap &= ~act; |
---|
| 71 | + break; |
---|
| 72 | + case ENABLE_UDF_IEX_TRAP: |
---|
| 73 | + current->thread.fpu.UDF_IEX_trap |= act; |
---|
| 74 | + break; |
---|
| 75 | + case GET_UDF_IEX_TRAP: |
---|
| 76 | + break; |
---|
| 77 | + default: |
---|
| 78 | + return -EINVAL; |
---|
| 79 | + } |
---|
| 80 | + return old_udf_iex; |
---|
| 81 | +#else |
---|
| 82 | + return -ENOTSUPP; |
---|
| 83 | +#endif |
---|
| 84 | +} |
---|