2018-09-28 20:35:51 +02:00
|
|
|
/*******************************************************************************/
|
|
|
|
/* COS2000 - Compatible Operating System - LGPL v3 - Hordé Nicolas */
|
|
|
|
/* */
|
2018-12-04 00:05:55 +01:00
|
|
|
|
2018-12-05 16:42:25 +01:00
|
|
|
#define sysexit() asm volatile ("sysexit"::);
|
|
|
|
|
|
|
|
|
|
|
|
#define syscall0(syscall) ({ \
|
|
|
|
u32 _v; \
|
|
|
|
asm volatile (\
|
|
|
|
"mov %%esp,%%ecx;\
|
|
|
|
mov $1f,%%edx;\
|
|
|
|
sysenter;\
|
|
|
|
1:" : "=a" (_v) : "a" (syscall): "ecx","edx","memory"); \
|
|
|
|
_v; \
|
|
|
|
})
|
|
|
|
|
|
|
|
#define syscall1(syscall,arg1) ({ \
|
|
|
|
u32 _v; \
|
|
|
|
asm volatile (\
|
|
|
|
"mov %%esp,%%ecx;\
|
|
|
|
mov $1f,%%edx;\
|
|
|
|
sysenter;\
|
|
|
|
1:" : "=a" (_v) : "a" (syscall), "b" (arg1) : "ecx","edx","memory"); \
|
|
|
|
_v; \
|
|
|
|
})
|
|
|
|
|
|
|
|
#define syscall2(syscall,arg1,arg2) ({ \
|
|
|
|
u32 _v; \
|
|
|
|
asm volatile (\
|
|
|
|
"mov %%esp,%%ecx;\
|
|
|
|
mov $1f,%%edx;\
|
|
|
|
sysenter;\
|
|
|
|
1:" : "=a" (_v) : "a" (syscall), "b" (arg1), "S" (arg2) : "ecx","edx","memory"); \
|
|
|
|
_v; \
|
|
|
|
})
|
|
|
|
|
|
|
|
#define syscall3(syscall,arg1,arg2,arg3) ({ \
|
|
|
|
u32 _v; \
|
|
|
|
asm volatile (\
|
|
|
|
"mov %%esp,%%ecx;\
|
|
|
|
mov $1f,%%edx;\
|
|
|
|
sysenter;\
|
|
|
|
1:" : "=a" (_v) : "a" (syscall), "b" (arg1), "S" (arg2), "D" (arg3) : "ecx","edx","memory"); \
|
|
|
|
_v; \
|
|
|
|
})
|
2018-12-04 00:05:55 +01:00
|
|
|
|
2018-12-04 21:57:44 +01:00
|
|
|
/* Vers 6 arguments maximum */
|
2018-09-18 14:29:35 +02:00
|
|
|
void initsyscall(void);
|
|
|
|
void sysenter_handler(void);
|