summaryrefslogtreecommitdiffstats
path: root/arch/h8300/include/asm/syscall.h
blob: d316c3d40d4e3fce2830df039876d96b81594145 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __ASM_H8300_SYSCALLS_32_H
#define __ASM_H8300_SYSCALLS_32_H

#ifdef __KERNEL__

#include <linux/compiler.h>
#include <linux/linkage.h>
#include <linux/types.h>
#include <linux/ptrace.h>
#include <uapi/linux/audit.h>

static inline int
syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
{
	return regs->orig_er0;
}

static inline void
syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
		      unsigned int i, unsigned int n, unsigned long *args)
{
	BUG_ON(i + n > 6);

	while (n > 0) {
		switch (i) {
		case 0:
			*args++ = regs->er1;
			break;
		case 1:
			*args++ = regs->er2;
			break;
		case 2:
			*args++ = regs->er3;
			break;
		case 3:
			*args++ = regs->er4;
			break;
		case 4:
			*args++ = regs->er5;
			break;
		case 5:
			*args++ = regs->er6;
			break;
		}
		i++;
		n--;
	}
}

static inline int
syscall_get_arch(struct task_struct *task)
{
	return AUDIT_ARCH_H8300;
}


/* Misc syscall related bits */
asmlinkage long do_syscall_trace_enter(struct pt_regs *regs);
asmlinkage void do_syscall_trace_leave(struct pt_regs *regs);

#endif /* __KERNEL__ */
#endif /* __ASM_H8300_SYSCALLS_32_H */