hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/sysroot/usr/include/sys/syscall.h
blob: 4a23a535d11ed01548e20b0e599be6ff6878b4ed (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
#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

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