Xenomai  3.0.5
syscall.h
1 /*
2  * Copyright (C) 2001-2014 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_X86_ASM_SYSCALL_H
20 #define _COBALT_X86_ASM_SYSCALL_H
21 
22 #include <linux/errno.h>
23 #include <asm/ptrace.h>
24 #include <asm-generic/xenomai/syscall.h>
25 
26 #define __xn_reg_sys(regs) ((regs)->orig_ax)
27 #define __xn_reg_rval(regs) ((regs)->ax)
28 #ifdef __i386__
29 #define __xn_reg_arg1(regs) ((regs)->bx)
30 #define __xn_reg_arg2(regs) ((regs)->cx)
31 #define __xn_reg_arg3(regs) ((regs)->dx)
32 #define __xn_reg_arg4(regs) ((regs)->si)
33 #define __xn_reg_arg5(regs) ((regs)->di)
34 #else /* x86_64 */
35 #define __xn_reg_arg1(regs) ((regs)->di)
36 #define __xn_reg_arg2(regs) ((regs)->si)
37 #define __xn_reg_arg3(regs) ((regs)->dx)
38 #define __xn_reg_arg4(regs) ((regs)->r10)
39 #define __xn_reg_arg5(regs) ((regs)->r8)
40 #endif /* x86_64 */
41 #define __xn_reg_pc(regs) ((regs)->ip)
42 #define __xn_reg_sp(regs) ((regs)->sp)
43 
44 #define __xn_syscall_p(regs) (__xn_reg_sys(regs) & __COBALT_SYSCALL_BIT)
45 #ifdef CONFIG_XENO_ARCH_SYS3264
46 #define __xn_syscall(regs) __COBALT_CALL32_SYSNR(__xn_reg_sys(regs) \
47  & ~__COBALT_SYSCALL_BIT)
48 #else
49 #define __xn_syscall(regs) (__xn_reg_sys(regs) & ~__COBALT_SYSCALL_BIT)
50 #endif
51 
52 static inline void __xn_error_return(struct pt_regs *regs, int v)
53 {
54  __xn_reg_rval(regs) = v;
55 }
56 
57 static inline void __xn_status_return(struct pt_regs *regs, long v)
58 {
59  __xn_reg_rval(regs) = v;
60 }
61 
62 static inline int __xn_interrupted_p(struct pt_regs *regs)
63 {
64  return __xn_reg_rval(regs) == -EINTR;
65 }
66 
67 static inline
68 int xnarch_local_syscall(unsigned long a1, unsigned long a2,
69  unsigned long a3, unsigned long a4,
70  unsigned long a5)
71 {
72  return -ENOSYS;
73 }
74 
75 #endif /* !_COBALT_X86_ASM_SYSCALL_H */