Implement vfs layer
[thunix.git] / include / syscall.h
blob5aab823505ae36b68e537a1bb1caa074a624b043
1 #ifndef SYSCALL_H
2 #define SYSCALL_H
4 extern void syscall_interrupt(void);
5 extern int syscall(int);
8 struct syscall_params {
9 unsigned long first;
10 unsigned long second;
11 unsigned long third;
14 extern struct syscall_params *scp;
16 #define _syscall0(type,name) \
17 type name(void) \
18 { \
19 long __res; \
20 __asm__ volatile ("int $0x80" \
21 : "=a" (__res) \
22 : "0" (__NR_##name)); \
23 if (__res >= 0) \
24 return (type) __res; \
25 return -1; \
28 #define _syscall1(type,name,atype,a) \
29 type name(atype a) \
30 { \
31 long __res; \
32 __asm__ volatile ("int $0x80" \
33 : "=a" (__res) \
34 : "0" (__NR_##name),"b" ((long)(a))); \
35 if (__res >= 0) \
36 return (type) __res; \
37 return -1; \
40 #define _syscall2(type,name,atype,a,btype,b) \
41 type name(atype a,btype b) \
42 { \
43 long __res; \
44 __asm__ volatile ("int $0x80" \
45 : "=a" (__res) \
46 : "0" (__NR_##name),"b" ((long)(a)),"c" ((long)(b))); \
47 if (__res >= 0) \
48 return (type) __res; \
49 return -1; \
52 #define _syscall3(type,name,atype,a,btype,b,ctype,c) \
53 type name(atype a,btype b,ctype c) \
54 { \
55 long __res; \
56 __asm__ volatile ("int $0x80" \
57 : "=a" (__res) \
58 : "a" (__NR_##name),"b" ((long)(a)),"c" ((long)(b)),"d" ((long)(c))); \
59 if (__res>=0) \
60 return (type) __res; \
61 return -1; \
64 #endif /* syscall.h */