Xenomai  3.0-rc6
syscall.h
1 /*
2  * Copyright (C) 2009 Philippe Gerum <rpm@xenomai.org>.
3  *
4  * Xenomai is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published
6  * by the Free Software Foundation; either version 2 of the License,
7  * or (at your option) any later version.
8  *
9  * Xenomai is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with Xenomai; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
17  * 02111-1307, USA.
18  */
19 #ifndef _COBALT_NIOS2_ASM_SYSCALL_H
20 #define _COBALT_NIOS2_ASM_SYSCALL_H
21 
22 #include <linux/errno.h>
23 #include <asm/uaccess.h>
24 #include <asm/ptrace.h>
25 #include <asm-generic/xenomai/syscall.h>
26 
27 #define __xn_reg_sys(__regs) ((__regs)->r2)
28 #define __xn_syscall_p(__regs) (__xn_reg_sys(__regs) & __COBALT_SYSCALL_BIT)
29 #define __xn_syscall(__regs) (__xn_reg_sys(__regs) & ~__COBALT_SYSCALL_BIT)
30 
31 #define __xn_reg_rval(__regs) ((__regs)->r2)
32 #define __xn_reg_arg1(__regs) ((__regs)->r4)
33 #define __xn_reg_arg2(__regs) ((__regs)->r5)
34 #define __xn_reg_arg3(__regs) ((__regs)->r6)
35 #define __xn_reg_arg4(__regs) ((__regs)->r7)
36 #define __xn_reg_arg5(__regs) ((__regs)->r8)
37 #define __xn_reg_pc(__regs) ((__regs)->ea)
38 #define __xn_reg_sp(__regs) ((__regs)->sp)
39 
40 static inline void __xn_error_return(struct pt_regs *regs, int v)
41 {
42  __xn_reg_rval(regs) = v;
43 }
44 
45 static inline void __xn_status_return(struct pt_regs *regs, long v)
46 {
47  __xn_reg_rval(regs) = v;
48 }
49 
50 static inline int __xn_interrupted_p(struct pt_regs *regs)
51 {
52  return __xn_reg_rval(regs) == -EINTR;
53 }
54 
55 int xnarch_local_syscall(unsigned long a1, unsigned long a2,
56  unsigned long a3, unsigned long a4,
57  unsigned long a5);
58 
59 #endif /* !_COBALT_NIOS2_ASM_SYSCALL_H */