Path: blob/master/arch/microblaze/include/asm/syscall.h
26442 views
/* SPDX-License-Identifier: GPL-2.0 */1#ifndef __ASM_MICROBLAZE_SYSCALL_H2#define __ASM_MICROBLAZE_SYSCALL_H34#include <uapi/linux/audit.h>5#include <linux/kernel.h>6#include <linux/sched.h>7#include <asm/ptrace.h>89/* The system call number is given by the user in R12 */10static inline long syscall_get_nr(struct task_struct *task,11struct pt_regs *regs)12{13return regs->r12;14}1516static inline void syscall_set_nr(struct task_struct *task,17struct pt_regs *regs,18int nr)19{20regs->r12 = nr;21}2223static inline void syscall_rollback(struct task_struct *task,24struct pt_regs *regs)25{26/* TODO. */27}2829static inline long syscall_get_error(struct task_struct *task,30struct pt_regs *regs)31{32return IS_ERR_VALUE(regs->r3) ? regs->r3 : 0;33}3435static inline long syscall_get_return_value(struct task_struct *task,36struct pt_regs *regs)37{38return regs->r3;39}4041static inline void syscall_set_return_value(struct task_struct *task,42struct pt_regs *regs,43int error, long val)44{45if (error)46regs->r3 = -error;47else48regs->r3 = val;49}5051static inline microblaze_reg_t microblaze_get_syscall_arg(struct pt_regs *regs,52unsigned int n)53{54switch (n) {55case 5: return regs->r10;56case 4: return regs->r9;57case 3: return regs->r8;58case 2: return regs->r7;59case 1: return regs->r6;60case 0: return regs->r5;61default:62BUG();63}64return ~0;65}6667static inline void syscall_get_arguments(struct task_struct *task,68struct pt_regs *regs,69unsigned long *args)70{71unsigned int i = 0;72unsigned int n = 6;7374while (n--)75*args++ = microblaze_get_syscall_arg(regs, i++);76}7778asmlinkage unsigned long do_syscall_trace_enter(struct pt_regs *regs);79asmlinkage void do_syscall_trace_leave(struct pt_regs *regs);8081static inline int syscall_get_arch(struct task_struct *task)82{83return AUDIT_ARCH_MICROBLAZE;84}85#endif /* __ASM_MICROBLAZE_SYSCALL_H */868788