.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) 2008-2009 Red Hat, Inc. All rights reserved. |
---|
3 | 4 | * Copyright 2010 Tilera Corporation. All Rights Reserved. |
---|
4 | 5 | * Copyright 2015 Regents of the University of California, Berkeley |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or |
---|
7 | | - * modify it under the terms of the GNU General Public License |
---|
8 | | - * as published by the Free Software Foundation, version 2. |
---|
9 | | - * |
---|
10 | | - * This program is distributed in the hope that it will be useful, |
---|
11 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
13 | | - * GNU General Public License for more details. |
---|
14 | 6 | * |
---|
15 | 7 | * See asm-generic/syscall.h for descriptions of what we must do here. |
---|
16 | 8 | */ |
---|
.. | .. |
---|
18 | 10 | #ifndef _ASM_RISCV_SYSCALL_H |
---|
19 | 11 | #define _ASM_RISCV_SYSCALL_H |
---|
20 | 12 | |
---|
| 13 | +#include <uapi/linux/audit.h> |
---|
21 | 14 | #include <linux/sched.h> |
---|
22 | 15 | #include <linux/err.h> |
---|
23 | 16 | |
---|
.. | .. |
---|
33 | 26 | struct pt_regs *regs) |
---|
34 | 27 | { |
---|
35 | 28 | return regs->a7; |
---|
36 | | -} |
---|
37 | | - |
---|
38 | | -static inline void syscall_set_nr(struct task_struct *task, |
---|
39 | | - struct pt_regs *regs, |
---|
40 | | - int sysno) |
---|
41 | | -{ |
---|
42 | | - regs->a7 = sysno; |
---|
43 | 29 | } |
---|
44 | 30 | |
---|
45 | 31 | static inline void syscall_rollback(struct task_struct *task, |
---|
.. | .. |
---|
71 | 57 | |
---|
72 | 58 | static inline void syscall_get_arguments(struct task_struct *task, |
---|
73 | 59 | struct pt_regs *regs, |
---|
74 | | - unsigned int i, unsigned int n, |
---|
75 | 60 | unsigned long *args) |
---|
76 | 61 | { |
---|
77 | | - BUG_ON(i + n > 6); |
---|
78 | | - if (i == 0) { |
---|
79 | | - args[0] = regs->orig_a0; |
---|
80 | | - args++; |
---|
81 | | - n--; |
---|
82 | | - } else { |
---|
83 | | - i--; |
---|
84 | | - } |
---|
85 | | - memcpy(args, ®s->a1 + i, n * sizeof(args[0])); |
---|
| 62 | + args[0] = regs->orig_a0; |
---|
| 63 | + args++; |
---|
| 64 | + memcpy(args, ®s->a1, 5 * sizeof(args[0])); |
---|
86 | 65 | } |
---|
87 | 66 | |
---|
88 | 67 | static inline void syscall_set_arguments(struct task_struct *task, |
---|
89 | 68 | struct pt_regs *regs, |
---|
90 | | - unsigned int i, unsigned int n, |
---|
91 | 69 | const unsigned long *args) |
---|
92 | 70 | { |
---|
93 | | - BUG_ON(i + n > 6); |
---|
94 | | - if (i == 0) { |
---|
95 | | - regs->orig_a0 = args[0]; |
---|
96 | | - args++; |
---|
97 | | - n--; |
---|
98 | | - } else { |
---|
99 | | - i--; |
---|
100 | | - } |
---|
101 | | - memcpy(®s->a1 + i, args, n * sizeof(regs->a1)); |
---|
| 71 | + regs->orig_a0 = args[0]; |
---|
| 72 | + args++; |
---|
| 73 | + memcpy(®s->a1, args, 5 * sizeof(regs->a1)); |
---|
| 74 | +} |
---|
| 75 | + |
---|
| 76 | +static inline int syscall_get_arch(struct task_struct *task) |
---|
| 77 | +{ |
---|
| 78 | +#ifdef CONFIG_64BIT |
---|
| 79 | + return AUDIT_ARCH_RISCV64; |
---|
| 80 | +#else |
---|
| 81 | + return AUDIT_ARCH_RISCV32; |
---|
| 82 | +#endif |
---|
102 | 83 | } |
---|
103 | 84 | |
---|
104 | 85 | #endif /* _ASM_RISCV_SYSCALL_H */ |
---|