]> git.ipfire.org Git - thirdparty/kernel/stable.git/blame - arch/ia64/include/asm/syscall.h
Merge tag 'audit-pr-20190507' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoor...
[thirdparty/kernel/stable.git] / arch / ia64 / include / asm / syscall.h
CommitLineData
cfb361f1
SL
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
ce5d1128 16#include <uapi/linux/audit.h>
cfb361f1
SL
17#include <linux/sched.h>
18#include <linux/err.h>
19
20static inline long syscall_get_nr(struct task_struct *task,
21 struct pt_regs *regs)
22{
cfb361f1
SL
23 if ((long)regs->cr_ifs < 0) /* Not a syscall */
24 return -1;
680973ed 25
cfb361f1
SL
26 return regs->r15;
27}
28
29static inline void syscall_rollback(struct task_struct *task,
30 struct pt_regs *regs)
31{
cfb361f1
SL
32 /* do nothing */
33}
34
35static inline long syscall_get_error(struct task_struct *task,
36 struct pt_regs *regs)
37{
cfb361f1
SL
38 return regs->r10 == -1 ? regs->r8:0;
39}
40
41static inline long syscall_get_return_value(struct task_struct *task,
42 struct pt_regs *regs)
43{
cfb361f1
SL
44 return regs->r8;
45}
46
47static inline void syscall_set_return_value(struct task_struct *task,
48 struct pt_regs *regs,
49 int error, long val)
50{
cfb361f1
SL
51 if (error) {
52 /* error < 0, but ia64 uses > 0 return value */
53 regs->r8 = -error;
54 regs->r10 = -1;
55 } else {
56 regs->r8 = val;
57 regs->r10 = 0;
58 }
59}
60
61extern void ia64_syscall_get_set_arguments(struct task_struct *task,
32d92586 62 struct pt_regs *regs, unsigned long *args, int rw);
cfb361f1
SL
63static inline void syscall_get_arguments(struct task_struct *task,
64 struct pt_regs *regs,
cfb361f1
SL
65 unsigned long *args)
66{
32d92586 67 ia64_syscall_get_set_arguments(task, regs, args, 0);
cfb361f1
SL
68}
69
70static inline void syscall_set_arguments(struct task_struct *task,
71 struct pt_regs *regs,
cfb361f1
SL
72 unsigned long *args)
73{
32d92586 74 ia64_syscall_get_set_arguments(task, regs, args, 1);
cfb361f1 75}
ce5d1128 76
16add411 77static inline int syscall_get_arch(struct task_struct *task)
ce5d1128
EP
78{
79 return AUDIT_ARCH_IA64;
80}
cfb361f1 81#endif /* _ASM_SYSCALL_H */