]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/blob - arch/c6x/include/asm/syscall.h
Merge tag 'at91-5.2-defconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/at91...
[mirror_ubuntu-eoan-kernel.git] / arch / c6x / include / asm / syscall.h
1 /*
2 * Copyright (C) 2011 Texas Instruments Incorporated
3 * Author: Mark Salter <msalter@redhat.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 */
10
11 #ifndef __ASM_C6X_SYSCALL_H
12 #define __ASM_C6X_SYSCALL_H
13
14 #include <uapi/linux/audit.h>
15 #include <linux/err.h>
16 #include <linux/sched.h>
17
18 static inline int syscall_get_nr(struct task_struct *task,
19 struct pt_regs *regs)
20 {
21 return regs->b0;
22 }
23
24 static inline void syscall_rollback(struct task_struct *task,
25 struct pt_regs *regs)
26 {
27 /* do nothing */
28 }
29
30 static inline long syscall_get_error(struct task_struct *task,
31 struct pt_regs *regs)
32 {
33 return IS_ERR_VALUE(regs->a4) ? regs->a4 : 0;
34 }
35
36 static inline long syscall_get_return_value(struct task_struct *task,
37 struct pt_regs *regs)
38 {
39 return regs->a4;
40 }
41
42 static inline void syscall_set_return_value(struct task_struct *task,
43 struct pt_regs *regs,
44 int error, long val)
45 {
46 regs->a4 = error ?: val;
47 }
48
49 static inline void syscall_get_arguments(struct task_struct *task,
50 struct pt_regs *regs,
51 unsigned long *args)
52 {
53 *args++ = regs->a4;
54 *args++ = regs->b4;
55 *args++ = regs->a6;
56 *args++ = regs->b6;
57 *args++ = regs->a8;
58 *args = regs->b8;
59 }
60
61 static inline void syscall_set_arguments(struct task_struct *task,
62 struct pt_regs *regs,
63 const unsigned long *args)
64 {
65 regs->a4 = *args++;
66 regs->b4 = *args++;
67 regs->a6 = *args++;
68 regs->b6 = *args++;
69 regs->a8 = *args++;
70 regs->a9 = *args;
71 }
72
73 static inline int syscall_get_arch(struct task_struct *task)
74 {
75 return IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)
76 ? AUDIT_ARCH_C6XBE : AUDIT_ARCH_C6X;
77 }
78
79 #endif /* __ASM_C6X_SYSCALLS_H */