mm: make wait_on_page_writeback() wait for multiple pending writebacks
[linux/fpc-iii.git] / arch / s390 / include / asm / syscall.h
blobd9d5de0f67ffe7a23510587d16718f5857f2a5f5
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Access to user system call parameters and results
5 * Copyright IBM Corp. 2008
6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
7 */
9 #ifndef _ASM_SYSCALL_H
10 #define _ASM_SYSCALL_H 1
12 #include <uapi/linux/audit.h>
13 #include <linux/sched.h>
14 #include <linux/err.h>
15 #include <asm/ptrace.h>
17 extern const unsigned long sys_call_table[];
18 extern const unsigned long sys_call_table_emu[];
20 static inline long syscall_get_nr(struct task_struct *task,
21 struct pt_regs *regs)
23 return test_pt_regs_flag(regs, PIF_SYSCALL) ?
24 (regs->int_code & 0xffff) : -1;
27 static inline void syscall_rollback(struct task_struct *task,
28 struct pt_regs *regs)
30 regs->gprs[2] = regs->orig_gpr2;
33 static inline long syscall_get_error(struct task_struct *task,
34 struct pt_regs *regs)
36 unsigned long error = regs->gprs[2];
37 #ifdef CONFIG_COMPAT
38 if (test_tsk_thread_flag(task, TIF_31BIT)) {
40 * Sign-extend the value so (int)-EFOO becomes (long)-EFOO
41 * and will match correctly in comparisons.
43 error = (long)(int)error;
45 #endif
46 return IS_ERR_VALUE(error) ? error : 0;
49 static inline long syscall_get_return_value(struct task_struct *task,
50 struct pt_regs *regs)
52 return regs->gprs[2];
55 static inline void syscall_set_return_value(struct task_struct *task,
56 struct pt_regs *regs,
57 int error, long val)
59 regs->gprs[2] = error ? error : val;
62 static inline void syscall_get_arguments(struct task_struct *task,
63 struct pt_regs *regs,
64 unsigned long *args)
66 unsigned long mask = -1UL;
67 unsigned int n = 6;
69 #ifdef CONFIG_COMPAT
70 if (test_tsk_thread_flag(task, TIF_31BIT))
71 mask = 0xffffffff;
72 #endif
73 while (n-- > 0)
74 if (n > 0)
75 args[n] = regs->gprs[2 + n] & mask;
77 args[0] = regs->orig_gpr2 & mask;
80 static inline void syscall_set_arguments(struct task_struct *task,
81 struct pt_regs *regs,
82 const unsigned long *args)
84 unsigned int n = 6;
86 while (n-- > 0)
87 if (n > 0)
88 regs->gprs[2 + n] = args[n];
89 regs->orig_gpr2 = args[0];
92 static inline int syscall_get_arch(struct task_struct *task)
94 #ifdef CONFIG_COMPAT
95 if (test_tsk_thread_flag(task, TIF_31BIT))
96 return AUDIT_ARCH_S390;
97 #endif
98 return AUDIT_ARCH_S390X;
100 #endif /* _ASM_SYSCALL_H */