| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright Altera Corporation (C) <2014>. All rights reserved |
|---|
| 3 | | - * |
|---|
| 4 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 5 | | - * under the terms and conditions of the GNU General Public License, |
|---|
| 6 | | - * version 2, as published by the Free Software Foundation. |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is distributed in the hope it will be useful, but WITHOUT |
|---|
| 9 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 10 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|---|
| 11 | | - * more details. |
|---|
| 12 | | - * |
|---|
| 13 | | - * You should have received a copy of the GNU General Public License along with |
|---|
| 14 | | - * this program. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 15 | 4 | */ |
|---|
| 16 | 5 | |
|---|
| 17 | 6 | #ifndef __ASM_NIOS2_SYSCALL_H__ |
|---|
| 18 | 7 | #define __ASM_NIOS2_SYSCALL_H__ |
|---|
| 19 | 8 | |
|---|
| 9 | +#include <uapi/linux/audit.h> |
|---|
| 20 | 10 | #include <linux/err.h> |
|---|
| 21 | 11 | #include <linux/sched.h> |
|---|
| 22 | 12 | |
|---|
| .. | .. |
|---|
| 58 | 48 | } |
|---|
| 59 | 49 | |
|---|
| 60 | 50 | static inline void syscall_get_arguments(struct task_struct *task, |
|---|
| 61 | | - struct pt_regs *regs, unsigned int i, unsigned int n, |
|---|
| 62 | | - unsigned long *args) |
|---|
| 51 | + struct pt_regs *regs, unsigned long *args) |
|---|
| 63 | 52 | { |
|---|
| 64 | | - BUG_ON(i + n > 6); |
|---|
| 65 | | - |
|---|
| 66 | | - switch (i) { |
|---|
| 67 | | - case 0: |
|---|
| 68 | | - if (!n--) |
|---|
| 69 | | - break; |
|---|
| 70 | | - *args++ = regs->r4; |
|---|
| 71 | | - case 1: |
|---|
| 72 | | - if (!n--) |
|---|
| 73 | | - break; |
|---|
| 74 | | - *args++ = regs->r5; |
|---|
| 75 | | - case 2: |
|---|
| 76 | | - if (!n--) |
|---|
| 77 | | - break; |
|---|
| 78 | | - *args++ = regs->r6; |
|---|
| 79 | | - case 3: |
|---|
| 80 | | - if (!n--) |
|---|
| 81 | | - break; |
|---|
| 82 | | - *args++ = regs->r7; |
|---|
| 83 | | - case 4: |
|---|
| 84 | | - if (!n--) |
|---|
| 85 | | - break; |
|---|
| 86 | | - *args++ = regs->r8; |
|---|
| 87 | | - case 5: |
|---|
| 88 | | - if (!n--) |
|---|
| 89 | | - break; |
|---|
| 90 | | - *args++ = regs->r9; |
|---|
| 91 | | - case 6: |
|---|
| 92 | | - if (!n--) |
|---|
| 93 | | - break; |
|---|
| 94 | | - default: |
|---|
| 95 | | - BUG(); |
|---|
| 96 | | - } |
|---|
| 53 | + *args++ = regs->r4; |
|---|
| 54 | + *args++ = regs->r5; |
|---|
| 55 | + *args++ = regs->r6; |
|---|
| 56 | + *args++ = regs->r7; |
|---|
| 57 | + *args++ = regs->r8; |
|---|
| 58 | + *args = regs->r9; |
|---|
| 97 | 59 | } |
|---|
| 98 | 60 | |
|---|
| 99 | 61 | static inline void syscall_set_arguments(struct task_struct *task, |
|---|
| 100 | | - struct pt_regs *regs, unsigned int i, unsigned int n, |
|---|
| 101 | | - const unsigned long *args) |
|---|
| 62 | + struct pt_regs *regs, const unsigned long *args) |
|---|
| 102 | 63 | { |
|---|
| 103 | | - BUG_ON(i + n > 6); |
|---|
| 64 | + regs->r4 = *args++; |
|---|
| 65 | + regs->r5 = *args++; |
|---|
| 66 | + regs->r6 = *args++; |
|---|
| 67 | + regs->r7 = *args++; |
|---|
| 68 | + regs->r8 = *args++; |
|---|
| 69 | + regs->r9 = *args; |
|---|
| 70 | +} |
|---|
| 104 | 71 | |
|---|
| 105 | | - switch (i) { |
|---|
| 106 | | - case 0: |
|---|
| 107 | | - if (!n--) |
|---|
| 108 | | - break; |
|---|
| 109 | | - regs->r4 = *args++; |
|---|
| 110 | | - case 1: |
|---|
| 111 | | - if (!n--) |
|---|
| 112 | | - break; |
|---|
| 113 | | - regs->r5 = *args++; |
|---|
| 114 | | - case 2: |
|---|
| 115 | | - if (!n--) |
|---|
| 116 | | - break; |
|---|
| 117 | | - regs->r6 = *args++; |
|---|
| 118 | | - case 3: |
|---|
| 119 | | - if (!n--) |
|---|
| 120 | | - break; |
|---|
| 121 | | - regs->r7 = *args++; |
|---|
| 122 | | - case 4: |
|---|
| 123 | | - if (!n--) |
|---|
| 124 | | - break; |
|---|
| 125 | | - regs->r8 = *args++; |
|---|
| 126 | | - case 5: |
|---|
| 127 | | - if (!n--) |
|---|
| 128 | | - break; |
|---|
| 129 | | - regs->r9 = *args++; |
|---|
| 130 | | - case 6: |
|---|
| 131 | | - if (!n) |
|---|
| 132 | | - break; |
|---|
| 133 | | - default: |
|---|
| 134 | | - BUG(); |
|---|
| 135 | | - } |
|---|
| 72 | +static inline int syscall_get_arch(struct task_struct *task) |
|---|
| 73 | +{ |
|---|
| 74 | + return AUDIT_ARCH_NIOS2; |
|---|
| 136 | 75 | } |
|---|
| 137 | 76 | |
|---|
| 138 | 77 | #endif |
|---|