Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Syscall support for the Hexagon architecture
4 *
5 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
6 */
7
8#ifndef _ASM_HEXAGON_SYSCALL_H
9#define _ASM_HEXAGON_SYSCALL_H
10
11#include <uapi/linux/audit.h>
12#include <linux/err.h>
13#include <asm/ptrace.h>
14
15typedef long (*syscall_fn)(unsigned long, unsigned long,
16 unsigned long, unsigned long,
17 unsigned long, unsigned long);
18
19#include <asm-generic/syscalls.h>
20
21extern void *sys_call_table[];
22
23static inline long syscall_get_nr(struct task_struct *task,
24 struct pt_regs *regs)
25{
26 return regs->r06;
27}
28
29static inline void syscall_set_nr(struct task_struct *task,
30 struct pt_regs *regs,
31 int nr)
32{
33 regs->r06 = nr;
34}
35
36static inline void syscall_get_arguments(struct task_struct *task,
37 struct pt_regs *regs,
38 unsigned long *args)
39{
40 memcpy(args, &(®s->r00)[0], 6 * sizeof(args[0]));
41}
42
43static inline void syscall_set_arguments(struct task_struct *task,
44 struct pt_regs *regs,
45 unsigned long *args)
46{
47 memcpy(&(®s->r00)[0], args, 6 * sizeof(args[0]));
48}
49
50static inline long syscall_get_error(struct task_struct *task,
51 struct pt_regs *regs)
52{
53 return IS_ERR_VALUE(regs->r00) ? regs->r00 : 0;
54}
55
56static inline long syscall_get_return_value(struct task_struct *task,
57 struct pt_regs *regs)
58{
59 return regs->r00;
60}
61
62static inline void syscall_set_return_value(struct task_struct *task,
63 struct pt_regs *regs,
64 int error, long val)
65{
66 regs->r00 = (long) error ?: val;
67}
68
69static inline int syscall_get_arch(struct task_struct *task)
70{
71 return AUDIT_ARCH_HEXAGON;
72}
73
74#endif