diff options
Diffstat (limited to 'include/unistd.h')
| -rw-r--r-- | include/unistd.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/include/unistd.h b/include/unistd.h new file mode 100644 index 0000000..c63ac6a --- /dev/null +++ b/include/unistd.h @@ -0,0 +1,28 @@ +#ifndef _UNISTD_H +#define _UNISTD_H + +#define __SYS_print 0 + +#define _syscall0(type, name) \ + type name(void) { \ + type __res; \ + __asm__ volatile ( \ + "int $0x80" \ + : "=a" (__res) \ + : "a" (__SYS_##name) \ + :); \ + return __res; \ + } + +#define _syscall1(type, name, atype, a) \ + type name(atype a) { \ + type __res; \ + __asm__ volatile ( \ + "int $0x80" \ + : "=a" (__res) \ + : "a" (__SYS_##name), "b" (a) \ + :); \ + return __res; \ + } + +#endif |
