• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
12 static inline int
syscall_get_nr(struct task_struct * task,struct pt_regs * regs)13 syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
14 {
15 	return regs->orig_er0;
16 }
17 
18 static inline void
syscall_get_arguments(struct task_struct * task,struct pt_regs * regs,unsigned int i,unsigned int n,unsigned long * args)19 syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
20 		      unsigned int i, unsigned int n, unsigned long *args)
21 {
22 	BUG_ON(i + n > 6);
23 
24 	while (n > 0) {
25 		switch (i) {
26 		case 0:
27 			*args++ = regs->er1;
28 			break;
29 		case 1:
30 			*args++ = regs->er2;
31 			break;
32 		case 2:
33 			*args++ = regs->er3;
34 			break;
35 		case 3:
36 			*args++ = regs->er4;
37 			break;
38 		case 4:
39 			*args++ = regs->er5;
40 			break;
41 		case 5:
42 			*args++ = regs->er6;
43 			break;
44 		}
45 		i++;
46 		n--;
47 	}
48 }
49 
50 
51 
52 /* Misc syscall related bits */
53 asmlinkage long do_syscall_trace_enter(struct pt_regs *regs);
54 asmlinkage void do_syscall_trace_leave(struct pt_regs *regs);
55 
56 #endif /* __KERNEL__ */
57 #endif /* __ASM_H8300_SYSCALLS_32_H */
58