108dbd0f8SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
2b9398a84SRichard Kuo /*
3b9398a84SRichard Kuo * Syscall support for the Hexagon architecture
4b9398a84SRichard Kuo *
5e1858b2aSRichard Kuo * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
6b9398a84SRichard Kuo */
7b9398a84SRichard Kuo
8b9398a84SRichard Kuo #ifndef _ASM_HEXAGON_SYSCALL_H
9b9398a84SRichard Kuo #define _ASM_HEXAGON_SYSCALL_H
10b9398a84SRichard Kuo
11d0931534SDmitry V. Levin #include <uapi/linux/audit.h>
12*6c132dd6SDmitry V. Levin #include <linux/err.h>
13*6c132dd6SDmitry V. Levin #include <asm/ptrace.h>
14d0931534SDmitry V. Levin
15b9398a84SRichard Kuo typedef long (*syscall_fn)(unsigned long, unsigned long,
16b9398a84SRichard Kuo unsigned long, unsigned long,
17b9398a84SRichard Kuo unsigned long, unsigned long);
18b9398a84SRichard Kuo
19b9398a84SRichard Kuo #include <asm-generic/syscalls.h>
20b9398a84SRichard Kuo
21b9398a84SRichard Kuo extern void *sys_call_table[];
22b9398a84SRichard Kuo
syscall_get_nr(struct task_struct * task,struct pt_regs * regs)23b9398a84SRichard Kuo static inline long syscall_get_nr(struct task_struct *task,
24b9398a84SRichard Kuo struct pt_regs *regs)
25b9398a84SRichard Kuo {
26b9398a84SRichard Kuo return regs->r06;
27b9398a84SRichard Kuo }
28b9398a84SRichard Kuo
syscall_get_arguments(struct task_struct * task,struct pt_regs * regs,unsigned long * args)29b9398a84SRichard Kuo static inline void syscall_get_arguments(struct task_struct *task,
30b9398a84SRichard Kuo struct pt_regs *regs,
31b9398a84SRichard Kuo unsigned long *args)
32b9398a84SRichard Kuo {
33b35f549dSSteven Rostedt (Red Hat) memcpy(args, &(®s->r00)[0], 6 * sizeof(args[0]));
34b9398a84SRichard Kuo }
35d0931534SDmitry V. Levin
syscall_get_error(struct task_struct * task,struct pt_regs * regs)36*6c132dd6SDmitry V. Levin static inline long syscall_get_error(struct task_struct *task,
37*6c132dd6SDmitry V. Levin struct pt_regs *regs)
38*6c132dd6SDmitry V. Levin {
39*6c132dd6SDmitry V. Levin return IS_ERR_VALUE(regs->r00) ? regs->r00 : 0;
40*6c132dd6SDmitry V. Levin }
41*6c132dd6SDmitry V. Levin
syscall_get_return_value(struct task_struct * task,struct pt_regs * regs)42*6c132dd6SDmitry V. Levin static inline long syscall_get_return_value(struct task_struct *task,
43*6c132dd6SDmitry V. Levin struct pt_regs *regs)
44*6c132dd6SDmitry V. Levin {
45*6c132dd6SDmitry V. Levin return regs->r00;
46*6c132dd6SDmitry V. Levin }
47*6c132dd6SDmitry V. Levin
syscall_get_arch(struct task_struct * task)4816add411SDmitry V. Levin static inline int syscall_get_arch(struct task_struct *task)
49d0931534SDmitry V. Levin {
50d0931534SDmitry V. Levin return AUDIT_ARCH_HEXAGON;
51d0931534SDmitry V. Levin }
52d0931534SDmitry V. Levin
53b9398a84SRichard Kuo #endif
54