Fixed TLS on i386
[akaros.git] / kern / arch / i686 / ros / syscall.h
1 #ifndef _ROS_ARCH_SYSCALL_H
2 #define _ROS_ARCH_SYSCALL_H
3
4 #define T_SYSCALL       0x80
5
6 #ifndef ROS_KERNEL
7
8 #include <ros/arch/bits/syscall.h>
9 #include <errno.h>
10
11 static inline intreg_t syscall_sysenter(uint16_t num, intreg_t a1,
12                                   intreg_t a2, intreg_t a3,
13                                   intreg_t a4, intreg_t a5)
14 {
15         return __syscall_sysenter(num, a1, a2, a3, a4, a5, &errno);
16 }
17 static inline intreg_t syscall_trap(uint16_t num, intreg_t a1,
18                                   intreg_t a2, intreg_t a3,
19                                   intreg_t a4, intreg_t a5)
20 {
21         return __syscall_trap(num, a1, a2, a3, a4, a5, &errno);
22 }
23
24 static inline long __attribute__((always_inline))
25 __ros_syscall(long _num, long _a0, long _a1, long _a2, long _a3, long _a4)
26 {
27         #ifndef SYSCALL_TRAP
28                 return syscall_sysenter(_num, _a0, _a1, _a2, _a3, _a4);
29         #else
30                 return syscall_trap(_num, _a0, _a1, _a2, _a3, _a4);
31         #endif
32 }
33
34 #endif
35
36 #endif
37