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

TOMOYO Linux Cross Reference
Linux/arch/frv/include/asm/syscall.h

Version: ~ [ linux-5.2-rc1 ] ~ [ linux-5.1.2 ] ~ [ linux-5.0.16 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.43 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.119 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.176 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.179 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.139 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.67 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.39.4 ] ~ [ linux-2.6.38.8 ] ~ [ linux-2.6.37.6 ] ~ [ linux-2.6.36.4 ] ~ [ linux-2.6.35.14 ] ~ [ linux-2.6.34.15 ] ~ [ linux-2.6.33.20 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* syscall parameter access functions
  2  *
  3  * Copyright (C) 2009 Red Hat, Inc. All Rights Reserved.
  4  * Written by David Howells (dhowells@redhat.com)
  5  *
  6  * This program is free software; you can redistribute it and/or
  7  * modify it under the terms of the GNU General Public Licence
  8  * as published by the Free Software Foundation; either version
  9  * 2 of the Licence, or (at your option) any later version.
 10  */
 11 
 12 #ifndef _ASM_SYSCALL_H
 13 #define _ASM_SYSCALL_H
 14 
 15 #include <linux/err.h>
 16 #include <asm/ptrace.h>
 17 
 18 /*
 19  * Get the system call number or -1
 20  */
 21 static inline long syscall_get_nr(struct task_struct *task,
 22                                   struct pt_regs *regs)
 23 {
 24         return regs->syscallno;
 25 }
 26 
 27 /*
 28  * Restore the clobbered GR8 register
 29  * (1st syscall arg was overwritten with syscall return or error)
 30  */
 31 static inline void syscall_rollback(struct task_struct *task,
 32                                     struct pt_regs *regs)
 33 {
 34         regs->gr8 = regs->orig_gr8;
 35 }
 36 
 37 /*
 38  * See if the syscall return value is an error, returning it if it is and 0 if
 39  * not
 40  */
 41 static inline long syscall_get_error(struct task_struct *task,
 42                                      struct pt_regs *regs)
 43 {
 44         return IS_ERR_VALUE(regs->gr8) ? regs->gr8 : 0;
 45 }
 46 
 47 /*
 48  * Get the syscall return value
 49  */
 50 static inline long syscall_get_return_value(struct task_struct *task,
 51                                             struct pt_regs *regs)
 52 {
 53         return regs->gr8;
 54 }
 55 
 56 /*
 57  * Set the syscall return value
 58  */
 59 static inline void syscall_set_return_value(struct task_struct *task,
 60                                             struct pt_regs *regs,
 61                                             int error, long val)
 62 {
 63         if (error)
 64                 regs->gr8 = -error;
 65         else
 66                 regs->gr8 = val;
 67 }
 68 
 69 /*
 70  * Retrieve the system call arguments
 71  */
 72 static inline void syscall_get_arguments(struct task_struct *task,
 73                                          struct pt_regs *regs,
 74                                          unsigned int i, unsigned int n,
 75                                          unsigned long *args)
 76 {
 77         /*
 78          * Do this simply for now. If we need to start supporting
 79          * fetching arguments from arbitrary indices, this will need some
 80          * extra logic. Presently there are no in-tree users that depend
 81          * on this behaviour.
 82          */
 83         BUG_ON(i);
 84 
 85         /* Argument pattern is: GR8, GR9, GR10, GR11, GR12, GR13 */
 86         switch (n) {
 87         case 6: args[5] = regs->gr13;
 88         case 5: args[4] = regs->gr12;
 89         case 4: args[3] = regs->gr11;
 90         case 3: args[2] = regs->gr10;
 91         case 2: args[1] = regs->gr9;
 92         case 1: args[0] = regs->gr8;
 93                 break;
 94         default:
 95                 BUG();
 96         }
 97 }
 98 
 99 /*
100  * Alter the system call arguments
101  */
102 static inline void syscall_set_arguments(struct task_struct *task,
103                                          struct pt_regs *regs,
104                                          unsigned int i, unsigned int n,
105                                          const unsigned long *args)
106 {
107         /* Same note as above applies */
108         BUG_ON(i);
109 
110         switch (n) {
111         case 6: regs->gr13 = args[5];
112         case 5: regs->gr12 = args[4];
113         case 4: regs->gr11 = args[3];
114         case 3: regs->gr10 = args[2];
115         case 2: regs->gr9  = args[1];
116         case 1: regs->gr8  = args[0];
117                 break;
118         default:
119                 BUG();
120         }
121 }
122 
123 #endif /* _ASM_SYSCALL_H */
124 

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

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | 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.

osdn.jp