Xenomai
3.1
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
/*
27
* Cobalt and Linux syscall numbers can be fetched from ORIG_AX,
28
* masking out the __COBALT_SYSCALL_BIT marker. Make sure to offset
29
* the number by __COBALT_X32_BASE for Cobalt 32-bit compat syscalls
30
* only.
31
*/
32
#define __xn_reg_sys(regs) ((regs)->orig_ax)
33
#define __xn_reg_rval(regs) ((regs)->ax)
34
#ifdef __i386__
35
#define __xn_reg_arg1(regs) ((regs)->bx)
36
#define __xn_reg_arg2(regs) ((regs)->cx)
37
#define __xn_reg_arg3(regs) ((regs)->dx)
38
#define __xn_reg_arg4(regs) ((regs)->si)
39
#define __xn_reg_arg5(regs) ((regs)->di)
40
#else
/* x86_64 */
41
#define __xn_reg_arg1(regs) ((regs)->di)
42
#define __xn_reg_arg2(regs) ((regs)->si)
43
#define __xn_reg_arg3(regs) ((regs)->dx)
44
#define __xn_reg_arg4(regs) ((regs)->r10)
45
#define __xn_reg_arg5(regs) ((regs)->r8)
46
#endif
/* x86_64 */
47
#define __xn_reg_pc(regs) ((regs)->ip)
48
#define __xn_reg_sp(regs) ((regs)->sp)
49
50
#define __xn_syscall_p(regs) (__xn_reg_sys(regs) & __COBALT_SYSCALL_BIT)
51
#ifdef CONFIG_XENO_ARCH_SYS3264
52
#define __xn_syscall(regs) __COBALT_CALL32_SYSNR(__xn_reg_sys(regs) \
53
& ~__COBALT_SYSCALL_BIT)
54
#else
55
#define __xn_syscall(regs) (__xn_reg_sys(regs) & ~__COBALT_SYSCALL_BIT)
56
#endif
57
58
/*
59
* Root syscall number with predicate (valid only if
60
* !__xn_syscall_p(__regs)).
61
*/
62
#define __xn_rootcall_p(__regs, __code) \
63
({ \
64
*(__code) = __xn_reg_sys(__regs); \
65
*(__code) < ipipe_root_nr_syscalls(current_thread_info()); \
66
})
67
68
static
inline
void
__xn_error_return(
struct
pt_regs *regs,
int
v)
69
{
70
__xn_reg_rval(regs) = v;
71
}
72
73
static
inline
void
__xn_status_return(
struct
pt_regs *regs,
long
v)
74
{
75
__xn_reg_rval(regs) = v;
76
}
77
78
static
inline
int
__xn_interrupted_p(
struct
pt_regs *regs)
79
{
80
return
__xn_reg_rval(regs) == -EINTR;
81
}
82
83
static
inline
84
int
xnarch_local_syscall(
unsigned
long
a1,
unsigned
long
a2,
85
unsigned
long
a3,
unsigned
long
a4,
86
unsigned
long
a5)
87
{
88
return
-ENOSYS;
89
}
90
91
#endif
/* !_COBALT_X86_ASM_SYSCALL_H */
kernel
cobalt
arch
x86
include
asm
xenomai
syscall.h
Generated by
1.8.14