hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/sysroot/usr/include/sys/syscall.h
blob: eecd257c582a30e7ee7f9e0ef20014e69ed430fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef _SYS_SYSCALL_H
#define _SYS_SYSCALL_H

#define SYS_exit  0
#define SYS_write 1
#define SYS_read  2
#define SYS_open  7
#define SYS_close 8
#define SYS_lseek 9
#define SYS_brk    10
#define SYS_sbrk   11
#define SYS_fork   12
#define SYS_exec   13
#define SYS_wait   14
#define SYS_getpid 15

static inline long __syscall0(long number)
{
    long result;
    __asm__ volatile("int $0x80" : "=a"(result) : "a"(number) : "memory");
    return result;
}

static inline long __syscall1(long number, long a1)
{
    long result;
    __asm__ volatile("int $0x80" : "=a"(result) : "a"(number), "D"(a1) : "memory");
    return result;
}

static inline long __syscall2(long number, long a1, long a2)
{
    long result;
    __asm__ volatile("int $0x80" : "=a"(result) : "a"(number), "D"(a1), "S"(a2) : "memory");
    return result;
}

static inline long __syscall3(long number, long a1, long a2, long a3)
{
    long result;
    __asm__ volatile("int $0x80" : "=a"(result) : "a"(number), "D"(a1), "S"(a2), "d"(a3) : "memory");
    return result;
}

#endif