]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/blame - arch/openrisc/include/asm/syscall.h
treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152
[mirror_ubuntu-eoan-kernel.git] / arch / openrisc / include / asm / syscall.h
CommitLineData
2874c5fd 1/* SPDX-License-Identifier: GPL-2.0-or-later */
09abb901
JB
2/*
3 * OpenRISC Linux
4 *
5 * Linux architectural port borrowing liberally from similar works of
6 * others. All original copyrights apply as per the original source
7 * declaration.
8 *
9 * OpenRISC implementation:
10 * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
11 * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
12 * et al.
09abb901
JB
13 */
14
15#ifndef __ASM_OPENRISC_SYSCALL_H__
16#define __ASM_OPENRISC_SYSCALL_H__
17
ce5d1128 18#include <uapi/linux/audit.h>
09abb901
JB
19#include <linux/err.h>
20#include <linux/sched.h>
21
22static inline int
23syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
24{
6cbe5e95 25 return regs->orig_gpr11;
09abb901
JB
26}
27
28static inline void
29syscall_rollback(struct task_struct *task, struct pt_regs *regs)
30{
31 regs->gpr[11] = regs->orig_gpr11;
32}
33
34static inline long
35syscall_get_error(struct task_struct *task, struct pt_regs *regs)
36{
37 return IS_ERR_VALUE(regs->gpr[11]) ? regs->gpr[11] : 0;
38}
39
40static inline long
41syscall_get_return_value(struct task_struct *task, struct pt_regs *regs)
42{
43 return regs->gpr[11];
44}
45
46static inline void
47syscall_set_return_value(struct task_struct *task, struct pt_regs *regs,
48 int error, long val)
49{
6cbe5e95 50 regs->gpr[11] = (long) error ?: val;
09abb901
JB
51}
52
53static inline void
54syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
b35f549d 55 unsigned long *args)
09abb901 56{
b35f549d 57 memcpy(args, &regs->gpr[3], 6 * sizeof(args[0]));
09abb901
JB
58}
59
60static inline void
61syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
32d92586 62 const unsigned long *args)
09abb901 63{
32d92586 64 memcpy(&regs->gpr[3], args, 6 * sizeof(args[0]));
09abb901
JB
65}
66
16add411 67static inline int syscall_get_arch(struct task_struct *task)
ce5d1128
EP
68{
69 return AUDIT_ARCH_OPENRISC;
70}
09abb901 71#endif