Linux Audio

Check our new training course

Loading...
v5.9
 1/* SPDX-License-Identifier: GPL-2.0-only */
 2/*
 3 * Access to user system call parameters and results
 4 *
 5 * Copyright (C) 2008 Intel Corp.  Shaohua Li <shaohua.li@intel.com>
 6 *
 
 
 
 
 7 * See asm-generic/syscall.h for descriptions of what we must do here.
 8 */
 9
10#ifndef _ASM_SYSCALL_H
11#define _ASM_SYSCALL_H	1
12
13#include <uapi/linux/audit.h>
14#include <linux/sched.h>
15#include <linux/err.h>
16
17static inline long syscall_get_nr(struct task_struct *task,
18				  struct pt_regs *regs)
19{
20	if ((long)regs->cr_ifs < 0) /* Not a syscall */
21		return -1;
22
23	return regs->r15;
24}
25
26static inline void syscall_rollback(struct task_struct *task,
27				    struct pt_regs *regs)
28{
29	/* do nothing */
30}
31
32static inline long syscall_get_error(struct task_struct *task,
33				     struct pt_regs *regs)
34{
35	return regs->r10 == -1 ? regs->r8:0;
36}
37
38static inline long syscall_get_return_value(struct task_struct *task,
39					    struct pt_regs *regs)
40{
41	return regs->r8;
42}
43
44static inline void syscall_set_return_value(struct task_struct *task,
45					    struct pt_regs *regs,
46					    int error, long val)
47{
48	if (error) {
49		/* error < 0, but ia64 uses > 0 return value */
50		regs->r8 = -error;
51		regs->r10 = -1;
52	} else {
53		regs->r8 = val;
54		regs->r10 = 0;
55	}
56}
57
58extern void ia64_syscall_get_set_arguments(struct task_struct *task,
59	struct pt_regs *regs, unsigned long *args, int rw);
 
60static inline void syscall_get_arguments(struct task_struct *task,
61					 struct pt_regs *regs,
 
62					 unsigned long *args)
63{
64	ia64_syscall_get_set_arguments(task, regs, args, 0);
 
 
65}
66
67static inline void syscall_set_arguments(struct task_struct *task,
68					 struct pt_regs *regs,
 
69					 unsigned long *args)
70{
71	ia64_syscall_get_set_arguments(task, regs, args, 1);
72}
73
74static inline int syscall_get_arch(struct task_struct *task)
75{
76	return AUDIT_ARCH_IA64;
77}
78#endif	/* _ASM_SYSCALL_H */
v3.1
 
 1/*
 2 * Access to user system call parameters and results
 3 *
 4 * Copyright (C) 2008 Intel Corp.  Shaohua Li <shaohua.li@intel.com>
 5 *
 6 * This copyrighted material is made available to anyone wishing to use,
 7 * modify, copy, or redistribute it subject to the terms and conditions
 8 * of the GNU General Public License v.2.
 9 *
10 * See asm-generic/syscall.h for descriptions of what we must do here.
11 */
12
13#ifndef _ASM_SYSCALL_H
14#define _ASM_SYSCALL_H	1
15
 
16#include <linux/sched.h>
17#include <linux/err.h>
18
19static inline long syscall_get_nr(struct task_struct *task,
20				  struct pt_regs *regs)
21{
22	if ((long)regs->cr_ifs < 0) /* Not a syscall */
23		return -1;
24
25	return regs->r15;
26}
27
28static inline void syscall_rollback(struct task_struct *task,
29				    struct pt_regs *regs)
30{
31	/* do nothing */
32}
33
34static inline long syscall_get_error(struct task_struct *task,
35				     struct pt_regs *regs)
36{
37	return regs->r10 == -1 ? regs->r8:0;
38}
39
40static inline long syscall_get_return_value(struct task_struct *task,
41					    struct pt_regs *regs)
42{
43	return regs->r8;
44}
45
46static inline void syscall_set_return_value(struct task_struct *task,
47					    struct pt_regs *regs,
48					    int error, long val)
49{
50	if (error) {
51		/* error < 0, but ia64 uses > 0 return value */
52		regs->r8 = -error;
53		regs->r10 = -1;
54	} else {
55		regs->r8 = val;
56		regs->r10 = 0;
57	}
58}
59
60extern void ia64_syscall_get_set_arguments(struct task_struct *task,
61	struct pt_regs *regs, unsigned int i, unsigned int n,
62	unsigned long *args, int rw);
63static inline void syscall_get_arguments(struct task_struct *task,
64					 struct pt_regs *regs,
65					 unsigned int i, unsigned int n,
66					 unsigned long *args)
67{
68	BUG_ON(i + n > 6);
69
70	ia64_syscall_get_set_arguments(task, regs, i, n, args, 0);
71}
72
73static inline void syscall_set_arguments(struct task_struct *task,
74					 struct pt_regs *regs,
75					 unsigned int i, unsigned int n,
76					 unsigned long *args)
77{
78	BUG_ON(i + n > 6);
 
79
80	ia64_syscall_get_set_arguments(task, regs, i, n, args, 1);
 
 
81}
82#endif	/* _ASM_SYSCALL_H */