Linux Audio

Check our new training course

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