Skip to content

Commit

Permalink
s390/kernel: use test_fp_ctl() to verify the floating-point control word
Browse files Browse the repository at this point in the history
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: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
  • Loading branch information
Hendrik Brueckner authored and Martin Schwidefsky committed Jul 22, 2015
1 parent 2e54dc3 commit 4084eb7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion arch/s390/include/asm/switch_to.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ static inline int restore_fp_ctl(u32 *fpc)
" lfpc %1\n"
"0: la %0,0\n"
"1:\n"
EX_TABLE(0b,1b)
: "=d" (rc) : "Q" (*fpc), "0" (-EINVAL));
return rc;
}
Expand Down
6 changes: 3 additions & 3 deletions arch/s390/kernel/compat_signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ static void load_sigregs(void)
int i;

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) {
for (i = 0; i < __NUM_FPRS; i++)
*(freg_t *)(current->thread.vxrs + i) =
Expand Down Expand Up @@ -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))
return -EINVAL;

/* Loading the floating-point-control word can fail. Do that first. */
if (restore_fp_ctl(&user_sregs.fpregs.fpc))
/* Test the floating-point-control word. */
if (test_fp_ctl(user_sregs.fpregs.fpc))
return -EINVAL;

/* Use regs->psw.mask instead of PSW_USER_BITS to preserve PER bit. */
Expand Down
6 changes: 3 additions & 3 deletions arch/s390/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ static void store_sigregs(void)
static void load_sigregs(void)
{
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) {
int i;

Expand Down Expand Up @@ -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))
return -EINVAL;

/* Loading the floating-point-control word can fail. Do that first. */
if (restore_fp_ctl(&user_sregs.fpregs.fpc))
/* Test the floating-point-control word. */
if (test_fp_ctl(user_sregs.fpregs.fpc))
return -EINVAL;

/* Use regs->psw.mask instead of PSW_USER_BITS to preserve PER bit. */
Expand Down

0 comments on commit 4084eb7

Please sign in to comment.