Splits x86 into 32 and 64 bit (XCC)
[akaros.git] / kern / arch / x86 / ros / syscall64.h
1 #ifndef ROS_INC_ARCH_SYSCALL64_H
2 #define ROS_INC_ARCH_SYSCALL64_H
3
4 #ifndef ROS_INC_ARCH_SYSCALL_H
5 #error "Do not include include ros/arch/syscall64.h directly"
6 #endif
7
8 #define T_SYSCALL       0x80
9
10 #ifndef ROS_KERNEL
11
12 #include <sys/types.h>
13 #include <stdint.h>
14 #include <ros/common.h>
15 #include <assert.h>
16
17 static inline intreg_t __syscall_sysenter(uintreg_t a0, uintreg_t a1)
18 {
19         /* The kernel clobbers ecx, so we save it manually. */
20         intreg_t ret = 0;
21         #if 0
22         asm volatile ("  pushl %%ecx;        "
23                       "  pushl %%edx;        "
24                       "  pushl %%ebp;        "
25                       "  movl %%esp, %%ebp;  "
26                       "  leal 1f, %%edx;     "
27                       "  sysenter;           "
28                       "1:                    "
29                       "  popl %%ebp;         "
30                       "  popl %%edx;         "
31                       "  popl %%ecx;         "
32                       : "=a" (ret)
33                       : "a" (a0),
34                         "S" (a1)
35                       : "cc", "memory");
36         #endif
37         return ret;
38 }
39
40 static inline intreg_t __syscall_trap(uintreg_t a0, uintreg_t a1)
41 {
42         intreg_t ret;
43
44         #if 0
45         /* If you change this, change pop_user_ctx() */
46         asm volatile("int %1"
47                      : "=a" (ret)
48                      : "i" (T_SYSCALL),
49                        "a" (a0),
50                        "d" (a1)
51                      : "cc", "memory");
52         #endif
53         return ret;
54 }
55
56 #endif
57
58 #endif /* ROS_INC_ARCH_SYSCALL64_H */