2018-09-05 02:25:08 -04:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
|
|
|
|
#ifndef __ASM_SYSCALL_H
|
|
|
|
#define __ASM_SYSCALL_H
|
|
|
|
|
|
|
|
#include <linux/sched.h>
|
|
|
|
#include <linux/err.h>
|
|
|
|
#include <abi/regdef.h>
|
2018-12-13 12:22:07 -05:00
|
|
|
#include <uapi/linux/audit.h>
|
2018-09-05 02:25:08 -04:00
|
|
|
|
2019-03-20 06:27:27 -04:00
|
|
|
extern void *sys_call_table[];
|
|
|
|
|
2018-09-05 02:25:08 -04:00
|
|
|
static inline int
|
|
|
|
syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
|
|
|
|
{
|
|
|
|
return regs_syscallid(regs);
|
|
|
|
}
|
|
|
|
|
2019-04-22 02:46:44 -04:00
|
|
|
static inline void
|
|
|
|
syscall_set_nr(struct task_struct *task, struct pt_regs *regs,
|
|
|
|
int sysno)
|
|
|
|
{
|
|
|
|
regs_syscallid(regs) = sysno;
|
|
|
|
}
|
|
|
|
|
2018-09-05 02:25:08 -04:00
|
|
|
static inline void
|
|
|
|
syscall_rollback(struct task_struct *task, struct pt_regs *regs)
|
|
|
|
{
|
|
|
|
regs->a0 = regs->orig_a0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline long
|
|
|
|
syscall_get_error(struct task_struct *task, struct pt_regs *regs)
|
|
|
|
{
|
|
|
|
unsigned long error = regs->a0;
|
|
|
|
|
|
|
|
return IS_ERR_VALUE(error) ? error : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline long
|
|
|
|
syscall_get_return_value(struct task_struct *task, struct pt_regs *regs)
|
|
|
|
{
|
|
|
|
return regs->a0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
syscall_set_return_value(struct task_struct *task, struct pt_regs *regs,
|
|
|
|
int error, long val)
|
|
|
|
{
|
|
|
|
regs->a0 = (long) error ?: val;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
|
2016-11-07 16:26:37 -05:00
|
|
|
unsigned long *args)
|
2018-09-05 02:25:08 -04:00
|
|
|
{
|
2016-11-07 16:26:37 -05:00
|
|
|
args[0] = regs->orig_a0;
|
|
|
|
args++;
|
|
|
|
memcpy(args, ®s->a1, 5 * sizeof(args[0]));
|
2018-09-05 02:25:08 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
|
2019-03-27 20:07:31 -04:00
|
|
|
const unsigned long *args)
|
2018-09-05 02:25:08 -04:00
|
|
|
{
|
2019-03-27 20:07:31 -04:00
|
|
|
regs->orig_a0 = args[0];
|
|
|
|
args++;
|
|
|
|
memcpy(®s->a1, args, 5 * sizeof(regs->a1));
|
2018-09-05 02:25:08 -04:00
|
|
|
}
|
|
|
|
|
2018-12-13 12:22:07 -05:00
|
|
|
static inline int
|
2019-03-17 19:30:18 -04:00
|
|
|
syscall_get_arch(struct task_struct *task)
|
2018-12-13 12:22:07 -05:00
|
|
|
{
|
|
|
|
return AUDIT_ARCH_CSKY;
|
|
|
|
}
|
|
|
|
|
2018-09-05 02:25:08 -04:00
|
|
|
#endif /* __ASM_SYSCALL_H */
|