~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/sparc/kernel/sigutil_64.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/sparc/kernel/sigutil_64.c (Architecture m68k) and /arch/sparc/kernel/sigutil_64.c (Architecture sparc)


  1 // SPDX-License-Identifier: GPL-2.0                 1 // SPDX-License-Identifier: GPL-2.0
  2 #include <linux/kernel.h>                           2 #include <linux/kernel.h>
  3 #include <linux/types.h>                            3 #include <linux/types.h>
  4 #include <linux/thread_info.h>                      4 #include <linux/thread_info.h>
  5 #include <linux/uaccess.h>                          5 #include <linux/uaccess.h>
  6 #include <linux/errno.h>                            6 #include <linux/errno.h>
  7                                                     7 
  8 #include <asm/sigcontext.h>                         8 #include <asm/sigcontext.h>
  9 #include <asm/fpumacro.h>                           9 #include <asm/fpumacro.h>
 10 #include <asm/ptrace.h>                            10 #include <asm/ptrace.h>
 11 #include <asm/switch_to.h>                         11 #include <asm/switch_to.h>
 12                                                    12 
 13 #include "sigutil.h"                               13 #include "sigutil.h"
 14                                                    14 
 15 int save_fpu_state(struct pt_regs *regs, __sig     15 int save_fpu_state(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
 16 {                                                  16 {
 17         unsigned long *fpregs = current_thread     17         unsigned long *fpregs = current_thread_info()->fpregs;
 18         unsigned long fprs;                        18         unsigned long fprs;
 19         int err = 0;                               19         int err = 0;
 20                                                    20         
 21         fprs = current_thread_info()->fpsaved[     21         fprs = current_thread_info()->fpsaved[0];
 22         if (fprs & FPRS_DL)                        22         if (fprs & FPRS_DL)
 23                 err |= copy_to_user(&fpu->si_f     23                 err |= copy_to_user(&fpu->si_float_regs[0], fpregs,
 24                                     (sizeof(un     24                                     (sizeof(unsigned int) * 32));
 25         if (fprs & FPRS_DU)                        25         if (fprs & FPRS_DU)
 26                 err |= copy_to_user(&fpu->si_f     26                 err |= copy_to_user(&fpu->si_float_regs[32], fpregs+16,
 27                                     (sizeof(un     27                                     (sizeof(unsigned int) * 32));
 28         err |= __put_user(current_thread_info(     28         err |= __put_user(current_thread_info()->xfsr[0], &fpu->si_fsr);
 29         err |= __put_user(current_thread_info(     29         err |= __put_user(current_thread_info()->gsr[0], &fpu->si_gsr);
 30         err |= __put_user(fprs, &fpu->si_fprs)     30         err |= __put_user(fprs, &fpu->si_fprs);
 31                                                    31 
 32         return err;                                32         return err;
 33 }                                                  33 }
 34                                                    34 
 35 int restore_fpu_state(struct pt_regs *regs, __     35 int restore_fpu_state(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
 36 {                                                  36 {
 37         unsigned long *fpregs = current_thread     37         unsigned long *fpregs = current_thread_info()->fpregs;
 38         unsigned long fprs;                        38         unsigned long fprs;
 39         int err;                                   39         int err;
 40                                                    40 
 41         if (((unsigned long) fpu) & 7)             41         if (((unsigned long) fpu) & 7)
 42                 return -EFAULT;                    42                 return -EFAULT;
 43                                                    43 
 44         err = get_user(fprs, &fpu->si_fprs);       44         err = get_user(fprs, &fpu->si_fprs);
 45         fprs_write(0);                             45         fprs_write(0);
 46         regs->tstate &= ~TSTATE_PEF;               46         regs->tstate &= ~TSTATE_PEF;
 47         if (fprs & FPRS_DL)                        47         if (fprs & FPRS_DL)
 48                 err |= copy_from_user(fpregs,      48                 err |= copy_from_user(fpregs, &fpu->si_float_regs[0],
 49                                (sizeof(unsigne     49                                (sizeof(unsigned int) * 32));
 50         if (fprs & FPRS_DU)                        50         if (fprs & FPRS_DU)
 51                 err |= copy_from_user(fpregs+1     51                 err |= copy_from_user(fpregs+16, &fpu->si_float_regs[32],
 52                                (sizeof(unsigne     52                                (sizeof(unsigned int) * 32));
 53         err |= __get_user(current_thread_info(     53         err |= __get_user(current_thread_info()->xfsr[0], &fpu->si_fsr);
 54         err |= __get_user(current_thread_info(     54         err |= __get_user(current_thread_info()->gsr[0], &fpu->si_gsr);
 55         current_thread_info()->fpsaved[0] |= f     55         current_thread_info()->fpsaved[0] |= fprs;
 56         return err;                                56         return err;
 57 }                                                  57 }
 58                                                    58 
 59 int save_rwin_state(int wsaved, __siginfo_rwin     59 int save_rwin_state(int wsaved, __siginfo_rwin_t __user *rwin)
 60 {                                                  60 {
 61         int i, err = __put_user(wsaved, &rwin-     61         int i, err = __put_user(wsaved, &rwin->wsaved);
 62                                                    62 
 63         for (i = 0; i < wsaved; i++) {             63         for (i = 0; i < wsaved; i++) {
 64                 struct reg_window *rp = &curre     64                 struct reg_window *rp = &current_thread_info()->reg_window[i];
 65                 unsigned long fp = current_thr     65                 unsigned long fp = current_thread_info()->rwbuf_stkptrs[i];
 66                                                    66 
 67                 err |= copy_to_user(&rwin->reg     67                 err |= copy_to_user(&rwin->reg_window[i], rp,
 68                                     sizeof(str     68                                     sizeof(struct reg_window));
 69                 err |= __put_user(fp, &rwin->r     69                 err |= __put_user(fp, &rwin->rwbuf_stkptrs[i]);
 70         }                                          70         }
 71         return err;                                71         return err;
 72 }                                                  72 }
 73                                                    73 
 74 int restore_rwin_state(__siginfo_rwin_t __user     74 int restore_rwin_state(__siginfo_rwin_t __user *rp)
 75 {                                                  75 {
 76         struct thread_info *t = current_thread     76         struct thread_info *t = current_thread_info();
 77         int i, wsaved, err;                        77         int i, wsaved, err;
 78                                                    78 
 79         if (((unsigned long) rp) & 7)              79         if (((unsigned long) rp) & 7)
 80                 return -EFAULT;                    80                 return -EFAULT;
 81                                                    81 
 82         get_user(wsaved, &rp->wsaved);             82         get_user(wsaved, &rp->wsaved);
 83         if (wsaved > NSWINS)                       83         if (wsaved > NSWINS)
 84                 return -EFAULT;                    84                 return -EFAULT;
 85                                                    85 
 86         err = 0;                                   86         err = 0;
 87         for (i = 0; i < wsaved; i++) {             87         for (i = 0; i < wsaved; i++) {
 88                 err |= copy_from_user(&t->reg_     88                 err |= copy_from_user(&t->reg_window[i],
 89                                       &rp->reg     89                                       &rp->reg_window[i],
 90                                       sizeof(s     90                                       sizeof(struct reg_window));
 91                 err |= __get_user(t->rwbuf_stk     91                 err |= __get_user(t->rwbuf_stkptrs[i],
 92                                   &rp->rwbuf_s     92                                   &rp->rwbuf_stkptrs[i]);
 93         }                                          93         }
 94         if (err)                                   94         if (err)
 95                 return err;                        95                 return err;
 96                                                    96 
 97         set_thread_wsaved(wsaved);                 97         set_thread_wsaved(wsaved);
 98         synchronize_user_stack();                  98         synchronize_user_stack();
 99         if (get_thread_wsaved())                   99         if (get_thread_wsaved())
100                 return -EFAULT;                   100                 return -EFAULT;
101         return 0;                                 101         return 0;
102 }                                                 102 }
103                                                   103 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php