1#ifndef WIRED_ARCH_X8664_H
2#define WIRED_ARCH_X8664_H
17#define SYS_newfstatat 262
20#define SYS_mprotect 10
22#define SYS_rt_sigaction 13
23#define SYS_rt_sigprocmask 14
24#define SYS_rt_sigreturn 15
25#define SYS_rt_sigtimedwait 128
29#define SYS_recvfrom 45
31#define SYS_recvmmsg 299
32#define SYS_setsockopt 54
37#define SYS_sched_setaffinity 203
38#define SYS_sched_getaffinity 204
39#define SYS_clock_gettime 228
41#define SYS_mkdirat 258
42#define SYS_getrandom 318
47#define SYS_getppid 110
49#define SYS_exit_group 231
51#define SYS_getsockopt 55
58#define SA_RESTORER 0x04000000u
79 register i64 r10 __asm__(
"r10") = d;
80 register i64 r8 __asm__(
"r8") = e;
81 register i64 r9 __asm__(
"r9") = f;
82 __asm__
volatile(
"syscall"
84 :
"a"(n),
"D"(a),
"S"(b),
"d"(c),
"r"(r10),
"r"(r8),
"r"(r9)
85 :
"rcx",
"r11",
"memory");
90#define syscall2(n, a, b) syscall6((n), (i64)(a), (i64)(b), 0, 0, 0, 0)
92#define syscall3(n, a, b, c) \
93 syscall6((n), (i64)(a), (i64)(b), (i64)(c), 0, 0, 0)
95#define syscall4(n, a, b, c, d) \
96 syscall6((n), (i64)(a), (i64)(b), (i64)(c), (i64)(d), 0, 0)
98#define syscall5(n, a, b, c, d, e) \
99 syscall6((n), (i64)(a), (i64)(b), (i64)(c), (i64)(d), (i64)(e), 0)
101#define syscall1(n, a) syscall6((n), (i64)(a), 0, 0, 0, 0, 0)
122 i64 flags,
u8* child_stack,
i32* parent_tid,
i32* child_tid,
i64 tls);
139#define WIRED_ARCH_START_ASM(entry) \
141 "mov (%rsp), %rdi\n" \
142 "lea 8(%rsp), %rsi\n" \
The SDK's fixed-width integer types (LP64 data model).
long i64
signed 64-bit integer
Definition types.h:14
int i32
signed 32-bit integer
Definition types.h:16
unsigned char u8
unsigned 8-bit integer / byte
Definition types.h:18
static i64 syscall6(i64 n, i64 a, i64 b, i64 c, i64 d, i64 e, i64 f)
Six-argument raw x86_64 Linux syscall.
Definition x8664.h:77
i64 wired_arch_clone_raw(i64 flags, u8 *child_stack, i32 *parent_tid, i32 *child_tid, i64 tls)
Raw clone(2) whose child starts on a new stack (assembly trampoline in clone.c; a C wrapper cannot be...
static void wired_arch_pause(void)
CPU spin-wait hint for busy-poll loops (x86 pause): tells the core a spin is in progress,...
Definition x8664.h:105
void wired_arch_sigreturn_restorer(void)
Signal-return trampoline for rt_sigaction(2)'s SA_RESTORER slot: the kernel jumps here when a handler...