audit: fix a memory leak bug
[sfrench/cifs-2.6.git] / arch / h8300 / include / asm / syscall.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __ASM_H8300_SYSCALLS_32_H
3 #define __ASM_H8300_SYSCALLS_32_H
4
5 #ifdef __KERNEL__
6
7 #include <linux/compiler.h>
8 #include <linux/linkage.h>
9 #include <linux/types.h>
10 #include <linux/ptrace.h>
11 #include <uapi/linux/audit.h>
12
13 static inline int
14 syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
15 {
16         return regs->orig_er0;
17 }
18
19 static inline void
20 syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
21                       unsigned int i, unsigned int n, unsigned long *args)
22 {
23         BUG_ON(i + n > 6);
24
25         while (n > 0) {
26                 switch (i) {
27                 case 0:
28                         *args++ = regs->er1;
29                         break;
30                 case 1:
31                         *args++ = regs->er2;
32                         break;
33                 case 2:
34                         *args++ = regs->er3;
35                         break;
36                 case 3:
37                         *args++ = regs->er4;
38                         break;
39                 case 4:
40                         *args++ = regs->er5;
41                         break;
42                 case 5:
43                         *args++ = regs->er6;
44                         break;
45                 }
46                 i++;
47                 n--;
48         }
49 }
50
51 static inline int
52 syscall_get_arch(struct task_struct *task)
53 {
54         return AUDIT_ARCH_H8300;
55 }
56
57
58 /* Misc syscall related bits */
59 asmlinkage long do_syscall_trace_enter(struct pt_regs *regs);
60 asmlinkage void do_syscall_trace_leave(struct pt_regs *regs);
61
62 #endif /* __KERNEL__ */
63 #endif /* __ASM_H8300_SYSCALLS_32_H */