root/arch/sh/include/asm/syscall_64.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. syscall_get_nr
  2. syscall_rollback
  3. syscall_get_error
  4. syscall_get_return_value
  5. syscall_set_return_value
  6. syscall_get_arguments
  7. syscall_set_arguments
  8. syscall_get_arch

   1 /* SPDX-License-Identifier: GPL-2.0 */
   2 #ifndef __ASM_SH_SYSCALL_64_H
   3 #define __ASM_SH_SYSCALL_64_H
   4 
   5 #include <uapi/linux/audit.h>
   6 #include <linux/kernel.h>
   7 #include <linux/sched.h>
   8 #include <asm/ptrace.h>
   9 
  10 /* The system call number is given by the user in R9 */
  11 static inline long syscall_get_nr(struct task_struct *task,
  12                                   struct pt_regs *regs)
  13 {
  14         return (regs->syscall_nr >= 0) ? regs->regs[9] : -1L;
  15 }
  16 
  17 static inline void syscall_rollback(struct task_struct *task,
  18                                     struct pt_regs *regs)
  19 {
  20         /*
  21          * XXX: This needs some thought. On SH we don't
  22          * save away the original R9 value anywhere.
  23          */
  24 }
  25 
  26 static inline long syscall_get_error(struct task_struct *task,
  27                                      struct pt_regs *regs)
  28 {
  29         return IS_ERR_VALUE(regs->regs[9]) ? regs->regs[9] : 0;
  30 }
  31 
  32 static inline long syscall_get_return_value(struct task_struct *task,
  33                                             struct pt_regs *regs)
  34 {
  35         return regs->regs[9];
  36 }
  37 
  38 static inline void syscall_set_return_value(struct task_struct *task,
  39                                             struct pt_regs *regs,
  40                                             int error, long val)
  41 {
  42         if (error)
  43                 regs->regs[9] = -error;
  44         else
  45                 regs->regs[9] = val;
  46 }
  47 
  48 static inline void syscall_get_arguments(struct task_struct *task,
  49                                          struct pt_regs *regs,
  50                                          unsigned long *args)
  51 {
  52         memcpy(args, &regs->regs[2], 6 * sizeof(args[0]));
  53 }
  54 
  55 static inline void syscall_set_arguments(struct task_struct *task,
  56                                          struct pt_regs *regs,
  57                                          const unsigned long *args)
  58 {
  59         memcpy(&regs->regs[2], args, 6 * sizeof(args[0]));
  60 }
  61 
  62 static inline int syscall_get_arch(struct task_struct *task)
  63 {
  64         int arch = AUDIT_ARCH_SH;
  65 
  66 #ifdef CONFIG_64BIT
  67         arch |= __AUDIT_ARCH_64BIT;
  68 #endif
  69 #ifdef CONFIG_CPU_LITTLE_ENDIAN
  70         arch |= __AUDIT_ARCH_LE;
  71 #endif
  72 
  73         return arch;
  74 }
  75 #endif /* __ASM_SH_SYSCALL_64_H */

/* [<][>][^][v][top][bottom][index][help] */