1 /* SPDX-License-Identifier: GPL-2.0-or-later */
5 * Linux architectural port borrowing liberally from similar works of
6 * others. All original copyrights apply as per the original source
9 * OpenRISC implementation:
10 * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
11 * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
15 #ifndef __ASM_OPENRISC_SYSCALL_H__
16 #define __ASM_OPENRISC_SYSCALL_H__
18 #include <uapi/linux/audit.h>
19 #include <linux/err.h>
20 #include <linux/sched.h>
23 syscall_get_nr(struct task_struct
*task
, struct pt_regs
*regs
)
25 return regs
->orig_gpr11
;
29 syscall_rollback(struct task_struct
*task
, struct pt_regs
*regs
)
31 regs
->gpr
[11] = regs
->orig_gpr11
;
35 syscall_get_error(struct task_struct
*task
, struct pt_regs
*regs
)
37 return IS_ERR_VALUE(regs
->gpr
[11]) ? regs
->gpr
[11] : 0;
41 syscall_get_return_value(struct task_struct
*task
, struct pt_regs
*regs
)
47 syscall_set_return_value(struct task_struct
*task
, struct pt_regs
*regs
,
50 regs
->gpr
[11] = (long) error
?: val
;
54 syscall_get_arguments(struct task_struct
*task
, struct pt_regs
*regs
,
57 memcpy(args
, ®s
->gpr
[3], 6 * sizeof(args
[0]));
61 syscall_set_arguments(struct task_struct
*task
, struct pt_regs
*regs
,
62 const unsigned long *args
)
64 memcpy(®s
->gpr
[3], args
, 6 * sizeof(args
[0]));
67 static inline int syscall_get_arch(struct task_struct
*task
)
69 return AUDIT_ARCH_OPENRISC
;