File Index
Files and directories
Sign in
FILE

syscall.h

File preview with syntax highlighting.

linux-6.19.14/arch/openrisc/include/asm/syscall.h C
 1/* SPDX-License-Identifier: GPL-2.0-or-later */
 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.
13 */
14
15#ifndef __ASM_OPENRISC_SYSCALL_H__
16#define __ASM_OPENRISC_SYSCALL_H__
17
18#include <uapi/linux/audit.h>
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{
25	return regs->orig_gpr11;
26}
27
28static inline void
29syscall_set_nr(struct task_struct *task, struct pt_regs *regs, int nr)
30{
31	regs->orig_gpr11 = nr;
32}
33
34static inline void
35syscall_rollback(struct task_struct *task, struct pt_regs *regs)
36{
37	regs->gpr[11] = regs->orig_gpr11;
38}
39
40static inline long
41syscall_get_error(struct task_struct *task, struct pt_regs *regs)
42{
43	return IS_ERR_VALUE(regs->gpr[11]) ? regs->gpr[11] : 0;
44}
45
46static inline long
47syscall_get_return_value(struct task_struct *task, struct pt_regs *regs)
48{
49	return regs->gpr[11];
50}
51
52static inline void
53syscall_set_return_value(struct task_struct *task, struct pt_regs *regs,
54			 int error, long val)
55{
56	regs->gpr[11] = (long) error ?: val;
57}
58
59static inline void
60syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
61		      unsigned long *args)
62{
63	memcpy(args, &regs->gpr[3], 6 * sizeof(args[0]));
64}
65
66static inline void
67syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
68		      const unsigned long *args)
69{
70	memcpy(&regs->gpr[3], args, 6 * sizeof(args[0]));
71}
72
73static inline int syscall_get_arch(struct task_struct *task)
74{
75	return AUDIT_ARCH_OPENRISC;
76}
77#endif
~/ Read-only file preview.