Commit 4084eb77 authored by Hendrik Brueckner's avatar Hendrik Brueckner Committed by Martin Schwidefsky

s390/kernel: use test_fp_ctl() to verify the floating-point control word

Use the test_fp_ctl() to test the floating-point control word
for validity and use restore_fp_ctl() to set it in load_sigregs.
Signed-off-by: default avatarHendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 2e54dc3c
...@@ -45,7 +45,6 @@ static inline int restore_fp_ctl(u32 *fpc) ...@@ -45,7 +45,6 @@ static inline int restore_fp_ctl(u32 *fpc)
" lfpc %1\n" " lfpc %1\n"
"0: la %0,0\n" "0: la %0,0\n"
"1:\n" "1:\n"
EX_TABLE(0b,1b)
: "=d" (rc) : "Q" (*fpc), "0" (-EINVAL)); : "=d" (rc) : "Q" (*fpc), "0" (-EINVAL));
return rc; return rc;
} }
......
...@@ -172,7 +172,7 @@ static void load_sigregs(void) ...@@ -172,7 +172,7 @@ static void load_sigregs(void)
int i; int i;
restore_access_regs(current->thread.acrs); restore_access_regs(current->thread.acrs);
/* restore_fp_ctl is done in restore_sigregs */ restore_fp_ctl(&current->thread.fp_regs.fpc);
if (current->thread.vxrs) { if (current->thread.vxrs) {
for (i = 0; i < __NUM_FPRS; i++) for (i = 0; i < __NUM_FPRS; i++)
*(freg_t *)(current->thread.vxrs + i) = *(freg_t *)(current->thread.vxrs + i) =
...@@ -217,8 +217,8 @@ static int restore_sigregs32(struct pt_regs *regs,_sigregs32 __user *sregs) ...@@ -217,8 +217,8 @@ static int restore_sigregs32(struct pt_regs *regs,_sigregs32 __user *sregs)
if (!is_ri_task(current) && (user_sregs.regs.psw.mask & PSW32_MASK_RI)) if (!is_ri_task(current) && (user_sregs.regs.psw.mask & PSW32_MASK_RI))
return -EINVAL; return -EINVAL;
/* Loading the floating-point-control word can fail. Do that first. */ /* Test the floating-point-control word. */
if (restore_fp_ctl(&user_sregs.fpregs.fpc)) if (test_fp_ctl(user_sregs.fpregs.fpc))
return -EINVAL; return -EINVAL;
/* Use regs->psw.mask instead of PSW_USER_BITS to preserve PER bit. */ /* Use regs->psw.mask instead of PSW_USER_BITS to preserve PER bit. */
......
...@@ -121,7 +121,7 @@ static void store_sigregs(void) ...@@ -121,7 +121,7 @@ static void store_sigregs(void)
static void load_sigregs(void) static void load_sigregs(void)
{ {
restore_access_regs(current->thread.acrs); restore_access_regs(current->thread.acrs);
/* restore_fp_ctl is done in restore_sigregs */ restore_fp_ctl(&current->thread.fp_regs.fpc);
if (current->thread.vxrs) { if (current->thread.vxrs) {
int i; int i;
...@@ -166,8 +166,8 @@ static int restore_sigregs(struct pt_regs *regs, _sigregs __user *sregs) ...@@ -166,8 +166,8 @@ static int restore_sigregs(struct pt_regs *regs, _sigregs __user *sregs)
if (!is_ri_task(current) && (user_sregs.regs.psw.mask & PSW_MASK_RI)) if (!is_ri_task(current) && (user_sregs.regs.psw.mask & PSW_MASK_RI))
return -EINVAL; return -EINVAL;
/* Loading the floating-point-control word can fail. Do that first. */ /* Test the floating-point-control word. */
if (restore_fp_ctl(&user_sregs.fpregs.fpc)) if (test_fp_ctl(user_sregs.fpregs.fpc))
return -EINVAL; return -EINVAL;
/* Use regs->psw.mask instead of PSW_USER_BITS to preserve PER bit. */ /* Use regs->psw.mask instead of PSW_USER_BITS to preserve PER bit. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment