-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmain_linux_i686.c
More file actions
48 lines (42 loc) · 923 Bytes
/
Copy pathmain_linux_i686.c
File metadata and controls
48 lines (42 loc) · 923 Bytes
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
46
47
48
// libc-free platform layer for x86-32 Linux
// This is free and unencumbered software released into the public domain.
#include "src/u-config.c"
enum {
SYS_close = 6,
SYS_exit = 1,
SYS_openat = 295,
SYS_read = 3,
SYS_write = 4,
SYS_getdents64 = 220,
O_DIRECTORY = 0x10000,
};
#include "src/linux_noarch.c"
asm (
" .globl _start\n"
"_start: mov %esp, %eax\n"
" sub $12, %esp\n"
" push %eax\n"
" call entrypoint\n"
);
static long syscall1(long n, long a)
{
long r;
asm volatile (
"int $0x80"
: "=a"(r)
: "a"(n), "b"(a)
: "memory"
);
return r;
}
static long syscall3(long n, long a, long b, long c)
{
long r;
asm volatile (
"int $0x80"
: "=a"(r)
: "a"(n), "b"(a), "c"(b), "d"(c)
: "memory"
);
return r;
}