Introduce FreeBSD ARM64 support

It's 100% passing test fleet. Solid as a rock.
This commit is contained in:
Justine Tunney 2023-12-29 20:11:23 -08:00
parent 43fe5956ad
commit 83107f78ed
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
455 changed files with 778 additions and 551 deletions

View file

@ -78,7 +78,8 @@ APE_LOADER_FLAGS = \
$< $<
o/$(MODE)/ape/ape.elf: o/$(MODE)/ape/ape.elf.dbg o/$(MODE)/ape/ape.elf: o/$(MODE)/ape/ape.elf.dbg
$(COMPILE) -AOBJCOPY -T$@ $(OBJCOPY) -g $< $@ @$(COMPILE) -AOBJCOPY -T$@ $(OBJCOPY) -g $< $@
@$(COMPILE) -AFIXUPOBJ -wT$@ $(FIXUPOBJ) $@
o/$(MODE)/ape/ape.elf.dbg: \ o/$(MODE)/ape/ape.elf.dbg: \
o/$(MODE)/ape/start.o \ o/$(MODE)/ape/start.o \
@ -88,7 +89,7 @@ o/$(MODE)/ape/ape.elf.dbg: \
@$(COMPILE) -ALINK.elf $(LD) $(APE_LOADER_LDFLAGS) -o $@ $(patsubst %.lds,-T %.lds,$^) @$(COMPILE) -ALINK.elf $(LD) $(APE_LOADER_LDFLAGS) -o $@ $(patsubst %.lds,-T %.lds,$^)
o/$(MODE)/ape/loader.o: ape/loader.c ape/ape.h o/$(MODE)/ape/loader.o: ape/loader.c ape/ape.h
@$(COMPILE) -AOBJECTIFY.c $(CC) -DSUPPORT_VECTOR=1 -g $(APE_LOADER_FLAGS) @$(COMPILE) -AOBJECTIFY.c $(CC) -DSUPPORT_VECTOR=33 -g $(APE_LOADER_FLAGS)
o/$(MODE)/ape/start.o: ape/start.S o/$(MODE)/ape/start.o: ape/start.S
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $< @$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
o/$(MODE)/ape/launch.o: ape/launch.S o/$(MODE)/ape/launch.o: ape/launch.S

View file

@ -87,7 +87,7 @@
#define MIN(X, Y) ((Y) > (X) ? (X) : (Y)) #define MIN(X, Y) ((Y) > (X) ? (X) : (Y))
#define MAX(X, Y) ((Y) < (X) ? (X) : (Y)) #define MAX(X, Y) ((Y) < (X) ? (X) : (Y))
#define PATH_MAX 1024 /* XXX verify */ #define PATH_MAX 1024 /* XXX verify */
#define SupportsLinux() (SUPPORT_VECTOR & LINUX) #define SupportsLinux() (SUPPORT_VECTOR & LINUX)
#define SupportsXnu() (SUPPORT_VECTOR & XNU) #define SupportsXnu() (SUPPORT_VECTOR & XNU)
@ -224,8 +224,8 @@ struct ApeLoader {
}; };
EXTERN_C long SystemCall(long, long, long, long, long, long, long, int); EXTERN_C long SystemCall(long, long, long, long, long, long, long, int);
EXTERN_C void EXTERN_C void Launch(void *, long, void *, void *, int)
Launch(void *, long, void *, void *, int) __attribute__((__noreturn__)); __attribute__((__noreturn__));
extern char __executable_start[]; extern char __executable_start[];
extern char _end[]; extern char _end[];

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -86,7 +86,7 @@ IGNORE := $(shell $(MKDIR) $(TMPDIR))
ifneq ($(findstring aarch64,$(MODE)),) ifneq ($(findstring aarch64,$(MODE)),)
ARCH = aarch64 ARCH = aarch64
HOSTS ?= pi studio HOSTS ?= pi studio freebsdarm
else else
ARCH = x86_64 ARCH = x86_64
HOSTS ?= freebsd rhel7 xnu win10 openbsd netbsd HOSTS ?= freebsd rhel7 xnu win10 openbsd netbsd

23
examples/crashreport2.cc Normal file
View file

@ -0,0 +1,23 @@
#if 0
/*─────────────────────────────────────────────────────────────────╗
To the extent possible under law, Justine Tunney has waived
all copyright and related or neighboring rights to this file,
as it is written in the following disclaimers:
http://unlicense.org/ │
http://creativecommons.org/publicdomain/zero/1.0/ │
*/
#endif
#include "libc/math.h"
#include "libc/runtime/runtime.h"
void crash(long x0, long x1, long x2, //
double v0, double v1, double v2) {
__builtin_trap();
}
void (*pCrash)(long, long, long, double, double, double) = crash;
int main(int argc, char *argv[]) {
ShowCrashReports();
pCrash(1, 2, 3, NAN, NAN, NAN);
}

View file

@ -16,8 +16,8 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/calls/struct/seccomp.internal.h"
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/calls/struct/seccomp.internal.h"
#include "libc/calls/syscall-sysv.internal.h" #include "libc/calls/syscall-sysv.internal.h"
#include "libc/dce.h" #include "libc/dce.h"
#include "libc/errno.h" #include "libc/errno.h"
@ -62,16 +62,20 @@ int seccomp(unsigned operation, unsigned flags, void *args) {
rc = -1; rc = -1;
} }
#elif defined(__aarch64__) #elif defined(__aarch64__)
register long r0 asm("x0") = (long)operation; if (IsLinux()) {
register long r1 asm("x1") = (long)flags; register long r0 asm("x0") = (long)operation;
register long r2 asm("x2") = (long)args; register long r1 asm("x1") = (long)flags;
register long res_x0 asm("x0"); register long r2 asm("x2") = (long)args;
asm volatile("mov\tx8,%1\n\t" register long res_x0 asm("x0");
"svc\t0" asm volatile("mov\tx8,%1\n\t"
: "=r"(res_x0) "svc\t0"
: "i"(211), "r"(r0), "r"(r1), "r"(r2) : "=r"(res_x0)
: "x8", "memory"); : "i"(211), "r"(r0), "r"(r1), "r"(r2)
rc = _sysret(res_x0); : "x8", "memory");
rc = _sysret(res_x0);
} else {
rc = enosys();
}
#else #else
#error "arch unsupported" #error "arch unsupported"
#endif #endif

View file

@ -20,6 +20,7 @@
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/calls/internal.h" #include "libc/calls/internal.h"
#include "libc/calls/state.internal.h" #include "libc/calls/state.internal.h"
#include "libc/calls/struct/aarch64.internal.h"
#include "libc/calls/struct/sigaction.h" #include "libc/calls/struct/sigaction.h"
#include "libc/calls/struct/siginfo-freebsd.internal.h" #include "libc/calls/struct/siginfo-freebsd.internal.h"
#include "libc/calls/struct/siginfo-meta.internal.h" #include "libc/calls/struct/siginfo-meta.internal.h"
@ -33,18 +34,18 @@
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/sysv/consts/sa.h" #include "libc/sysv/consts/sa.h"
#ifdef __x86_64__
privileged void __sigenter_freebsd(int sig, struct siginfo_freebsd *freebsdinfo, privileged void __sigenter_freebsd(int sig, struct siginfo_freebsd *freebsdinfo,
struct ucontext_freebsd *ctx) { struct ucontext_freebsd *ctx) {
#pragma GCC push_options #pragma GCC push_options
#pragma GCC diagnostic ignored "-Wframe-larger-than=" #pragma GCC diagnostic ignored "-Wframe-larger-than="
struct Goodies { struct {
ucontext_t uc; ucontext_t uc;
siginfo_t si; siginfo_t si;
} g; } g;
CheckLargeStackAllocation(&g, sizeof(g)); CheckLargeStackAllocation(&g, sizeof(g));
#pragma GCC pop_options #pragma GCC pop_options
int rva, flags; int rva, flags;
rva = __sighandrvas[sig]; rva = __sighandrvas[sig];
if (rva >= kSigactionMinRva) { if (rva >= kSigactionMinRva) {
@ -52,12 +53,20 @@ privileged void __sigenter_freebsd(int sig, struct siginfo_freebsd *freebsdinfo,
if (~flags & SA_SIGINFO) { if (~flags & SA_SIGINFO) {
((sigaction_f)(__executable_start + rva))(sig, 0, 0); ((sigaction_f)(__executable_start + rva))(sig, 0, 0);
} else { } else {
//
// TRANSLATE FREEBSD SIGNAL TO LINUX SIGNAL
//
__repstosb(&g, 0, sizeof(g)); __repstosb(&g, 0, sizeof(g));
g.uc.uc_mcontext.fpregs = &g.uc.__fpustate; __siginfo2cosmo(&g.si, (void *)freebsdinfo);
g.uc.uc_stack.ss_sp = ctx->uc_stack.ss_sp; g.uc.uc_stack.ss_sp = ctx->uc_stack.ss_sp;
g.uc.uc_stack.ss_size = ctx->uc_stack.ss_size; g.uc.uc_stack.ss_size = ctx->uc_stack.ss_size;
g.uc.uc_stack.ss_flags = ctx->uc_stack.ss_flags; g.uc.uc_stack.ss_flags = ctx->uc_stack.ss_flags;
g.uc.uc_sigmask = ctx->uc_sigmask[0] | (uint64_t)ctx->uc_sigmask[0] << 32; g.uc.uc_sigmask = ctx->uc_sigmask[0] | (uint64_t)ctx->uc_sigmask[0] << 32;
#ifdef __x86_64__
g.uc.uc_mcontext.fpregs = &g.uc.__fpustate;
g.uc.uc_mcontext.r8 = ctx->uc_mcontext.mc_r8; g.uc.uc_mcontext.r8 = ctx->uc_mcontext.mc_r8;
g.uc.uc_mcontext.r9 = ctx->uc_mcontext.mc_r9; g.uc.uc_mcontext.r9 = ctx->uc_mcontext.mc_r9;
g.uc.uc_mcontext.r10 = ctx->uc_mcontext.mc_r10; g.uc.uc_mcontext.r10 = ctx->uc_mcontext.mc_r10;
@ -81,14 +90,39 @@ privileged void __sigenter_freebsd(int sig, struct siginfo_freebsd *freebsdinfo,
g.uc.uc_mcontext.err = ctx->uc_mcontext.mc_err; g.uc.uc_mcontext.err = ctx->uc_mcontext.mc_err;
g.uc.uc_mcontext.trapno = ctx->uc_mcontext.mc_trapno; g.uc.uc_mcontext.trapno = ctx->uc_mcontext.mc_trapno;
__repmovsb(&g.uc.__fpustate, &ctx->uc_mcontext.mc_fpstate, 512); __repmovsb(&g.uc.__fpustate, &ctx->uc_mcontext.mc_fpstate, 512);
__siginfo2cosmo(&g.si, (void *)freebsdinfo); #endif /* __x86_64__ */
#ifdef __aarch64__
__memcpy(g.uc.uc_mcontext.regs, &ctx->uc_mcontext.mc_gpregs, 34 * 8);
if (ctx->uc_mcontext.mc_flags & _MC_FP_VALID) {
struct fpsimd_context *vc =
(struct fpsimd_context *)g.uc.uc_mcontext.__reserved;
vc->head.magic = FPSIMD_MAGIC;
vc->head.size = sizeof(*vc);
vc->fpsr = ctx->uc_mcontext.mc_fpregs.fp_sr;
vc->fpcr = ctx->uc_mcontext.mc_fpregs.fp_cr;
__memcpy(vc->vregs, ctx->uc_mcontext.mc_fpregs.fp_q, 32 * 16);
}
#endif /* __aarch64__ */
//
// INVOKE SIGNAL HANDLER
//
((sigaction_f)(__executable_start + rva))(sig, &g.si, &g.uc); ((sigaction_f)(__executable_start + rva))(sig, &g.si, &g.uc);
//
// TRANSLATE LINUX SIGNAL TO FREEBSD SIGNAL
//
ctx->uc_stack.ss_sp = g.uc.uc_stack.ss_sp; ctx->uc_stack.ss_sp = g.uc.uc_stack.ss_sp;
ctx->uc_stack.ss_size = g.uc.uc_stack.ss_size; ctx->uc_stack.ss_size = g.uc.uc_stack.ss_size;
ctx->uc_stack.ss_flags = g.uc.uc_stack.ss_flags; ctx->uc_stack.ss_flags = g.uc.uc_stack.ss_flags;
ctx->uc_flags = g.uc.uc_flags; ctx->uc_flags = g.uc.uc_flags;
ctx->uc_sigmask[0] = g.uc.uc_sigmask; ctx->uc_sigmask[0] = g.uc.uc_sigmask;
ctx->uc_sigmask[1] = g.uc.uc_sigmask >> 32; ctx->uc_sigmask[1] = g.uc.uc_sigmask >> 32;
#ifdef __x86_64__
ctx->uc_mcontext.mc_rdi = g.uc.uc_mcontext.rdi; ctx->uc_mcontext.mc_rdi = g.uc.uc_mcontext.rdi;
ctx->uc_mcontext.mc_rsi = g.uc.uc_mcontext.rsi; ctx->uc_mcontext.mc_rsi = g.uc.uc_mcontext.rsi;
ctx->uc_mcontext.mc_rdx = g.uc.uc_mcontext.rdx; ctx->uc_mcontext.mc_rdx = g.uc.uc_mcontext.rdx;
@ -112,13 +146,24 @@ privileged void __sigenter_freebsd(int sig, struct siginfo_freebsd *freebsdinfo,
ctx->uc_mcontext.mc_rip = g.uc.uc_mcontext.rip; ctx->uc_mcontext.mc_rip = g.uc.uc_mcontext.rip;
ctx->uc_mcontext.mc_rsp = g.uc.uc_mcontext.rsp; ctx->uc_mcontext.mc_rsp = g.uc.uc_mcontext.rsp;
__repmovsb(&ctx->uc_mcontext.mc_fpstate, &g.uc.__fpustate, 512); __repmovsb(&ctx->uc_mcontext.mc_fpstate, &g.uc.__fpustate, 512);
#endif /* __x86_64__ */
#ifdef __aarch64__
__memcpy(&ctx->uc_mcontext.mc_gpregs, g.uc.uc_mcontext.regs, 34 * 8);
struct fpsimd_context *vc =
(struct fpsimd_context *)g.uc.uc_mcontext.__reserved;
if (vc->head.magic == FPSIMD_MAGIC) {
ctx->uc_mcontext.mc_flags |= _MC_FP_VALID;
ctx->uc_mcontext.mc_fpregs.fp_sr = vc->fpsr;
ctx->uc_mcontext.mc_fpregs.fp_cr = vc->fpcr;
__memcpy(ctx->uc_mcontext.mc_fpregs.fp_q, vc->vregs, 32 * 16);
}
#endif /* __aarch64__ */
// done
} }
} }
/* // When the FreeBSD kernel invokes this signal handler it pushes a
* When the FreeBSD kernel invokes this signal handler it pushes a // trampoline on the stack which does two things: 1) it calls this
* trampoline on the stack which does two things: 1) it calls this // function, and 2) calls sys_sigreturn() once this returns.
* function, and 2) calls sys_sigreturn() once this returns.
*/
} }
#endif /* __x86_64__ */

View file

@ -2,6 +2,22 @@
#define COSMOPOLITAN_LIBC_CALLS_STRUCT_UCONTEXT_FREEBSD_INTERNAL_H_ #define COSMOPOLITAN_LIBC_CALLS_STRUCT_UCONTEXT_FREEBSD_INTERNAL_H_
COSMOPOLITAN_C_START_ COSMOPOLITAN_C_START_
struct gpregs_freebsd_aarch64 {
int64_t gp_x[30];
int64_t gp_lr;
int64_t gp_sp;
int64_t gp_elr; /* pc */
uint64_t gp_spsr; /* pstate or cpsr */
};
struct fpregs_freebsd_aarch64 {
uint128_t fp_q[32];
uint32_t fp_sr;
uint32_t fp_cr;
int fp_flags;
int fp_pad;
};
struct stack_freebsd { struct stack_freebsd {
void *ss_sp; void *ss_sp;
uint64_t ss_size; uint64_t ss_size;
@ -9,6 +25,7 @@ struct stack_freebsd {
}; };
struct mcontext_freebsd { struct mcontext_freebsd {
#ifdef __x86_64__
int64_t mc_onstack; int64_t mc_onstack;
int64_t mc_rdi; int64_t mc_rdi;
int64_t mc_rsi; int64_t mc_rsi;
@ -47,6 +64,14 @@ struct mcontext_freebsd {
int64_t mc_xfpustate; int64_t mc_xfpustate;
int64_t mc_xfpustate_len; int64_t mc_xfpustate_len;
int64_t mc_spare[4]; int64_t mc_spare[4];
#elif defined(__aarch64__)
struct gpregs_freebsd_aarch64 mc_gpregs;
struct fpregs_freebsd_aarch64 mc_fpregs;
int mc_flags;
#define _MC_FP_VALID 0x1 /* Set when mc_fpregs has valid data */
int mc_pad; /* Padding */
uint64_t mc_spare[8]; /* Space for expansion, set to zero */
#endif
}; };
struct ucontext_freebsd { struct ucontext_freebsd {

View file

@ -125,6 +125,11 @@ _start:
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#elif defined(__aarch64__) #elif defined(__aarch64__)
#if SupportsFreebsd()
// save first arg
mov x3,x0
#endif
// save original stack pointer // save original stack pointer
// this is the first argument to cosmo() below // this is the first argument to cosmo() below
mov x0,sp mov x0,sp

View file

@ -13,7 +13,7 @@
*/ */
#define SUPPORT_VECTOR 255 #define SUPPORT_VECTOR 255
#else #else
#define SUPPORT_VECTOR (_HOSTLINUX | _HOSTXNU) #define SUPPORT_VECTOR (_HOSTLINUX | _HOSTXNU | _HOSTFREEBSD)
#endif #endif
#endif #endif
@ -62,8 +62,10 @@
#endif #endif
#ifdef __aarch64__ #ifdef __aarch64__
#define IsAarch64() 1
#define IsXnuSilicon() IsXnu() #define IsXnuSilicon() IsXnu()
#else #else
#define IsAarch64() 0
#define IsXnuSilicon() 0 #define IsXnuSilicon() 0
#endif #endif

View file

@ -59,12 +59,12 @@ wontreturn void _Exit(int exitcode) {
: "rcx", "r11", "memory"); : "rcx", "r11", "memory");
#elif defined(__aarch64__) #elif defined(__aarch64__)
register long x0 asm("x0") = exitcode; register long x0 asm("x0") = exitcode;
asm volatile("mov\tx8,%0\n\t" register long x8 asm("x8") = IsLinux() ? 94 : 1;
"mov\tx16,%1\n\t" asm volatile("mov\tx16,%1\n\t"
"svc\t0" "svc\t0"
: /* no outputs */ : /* no outputs */
: "i"(94), "i"(1), "r"(x0) : "r"(x8), "i"(1), "r"(x0)
: "x8", "x16", "memory"); : "x16", "memory");
#else #else
#error "unsupported architecture" #error "unsupported architecture"
#endif #endif
@ -77,12 +77,12 @@ wontreturn void _Exit(int exitcode) {
: "rcx", "r11", "memory"); : "rcx", "r11", "memory");
#else #else
register long r0 asm("x0") = exitcode; register long r0 asm("x0") = exitcode;
asm volatile("mov\tx8,%0\n\t" register long x8 asm("x8") = IsLinux() ? 93 : 431;
"mov\tx16,%1\n\t" asm volatile("mov\tx16,%1\n\t"
"svc\t0" "svc\t0"
: /* no outputs */ : /* no outputs */
: "i"(93), "i"(0x169), "r"(r0) : "r"(x8), "i"(0x169), "r"(r0)
: "x8", "memory"); : "memory");
#endif #endif
} else if (IsWindows()) { } else if (IsWindows()) {
uint32_t waitstatus; uint32_t waitstatus;

View file

@ -74,13 +74,27 @@ wontreturn void _Exit1(int rc) {
} }
notpossible; notpossible;
#elif defined(__aarch64__) #elif defined(__aarch64__)
if (IsLinux()) { if (IsLinux() || IsFreebsd()) {
register long r0 asm("x0") = rc; register int x0 asm("x0") = rc;
asm volatile("mov\tx8,%0\n\t" register int x8 asm("x8");
"svc\t0" if (IsLinux()) {
: /* no outputs */ x8 = 93; // exit
: "i"(93), "r"(r0) } else if (IsFreebsd()) {
: "x8", "memory"); x8 = 431; // thr_exit
} else {
__builtin_unreachable();
}
asm volatile("svc\t0" : "+r"(x0) : "r"(x8) : "memory");
if (SupportsFreebsd()) {
// On FreeBSD, thr_exit() fails if the current thread is orphaned.
// In that case we're really better off just calling plain _exit()
x0 = rc;
asm volatile("mov\tx8,#1\n\t"
"svc\t0"
: /* no outputs */
: "r"(x0)
: "memory");
}
} else if (IsXnu()) { } else if (IsXnu()) {
__syslib->__pthread_exit(0); __syslib->__pthread_exit(0);
} }

View file

@ -32,10 +32,19 @@ _futex:
neg %eax neg %eax
1: pop %rbp 1: pop %rbp
#elif defined(__aarch64__) #elif defined(__aarch64__)
mov x8,#0x062 ldr x7,=__hostos
svc #0 ldr w7,[x7]
tst x7,1 // IsLinux()
mov x7,98 // futex (Linux)
mov x8,454 // _umtx_op (FreeBSD)
csel x8,x7,x8,ne // choose syscall magnum
mov x7,0 // clear carry (for Linux)
adds x7,x7,0 // clear carry
svc #0 // call kernel
bcc 1f // jump if not carry
neg x0,x0 // linux style errno
#else #else
#error "unsupported architecture" #error "unsupported architecture"
#endif /* __x86_64__ */ #endif /* __x86_64__ */
ret 1: ret
.endfn _futex,globl,hidden .endfn _futex,globl,hidden

View file

@ -79,7 +79,7 @@ static textwindows void SetupWinStd(struct Fds *fds, int i, uint32_t x) {
textstartup void __init_fds(int argc, char **argv, char **envp) { textstartup void __init_fds(int argc, char **argv, char **envp) {
struct Fds *fds; struct Fds *fds;
fds = __veil("r", &g_fds); fds = &g_fds;
fds->n = 4; fds->n = 4;
atomic_store_explicit(&fds->f, 3, memory_order_relaxed); atomic_store_explicit(&fds->f, 3, memory_order_relaxed);
if (_weaken(_extend)) { if (_weaken(_extend)) {

View file

@ -18,6 +18,7 @@
*/ */
#include "libc/calls/syscall-sysv.internal.h" #include "libc/calls/syscall-sysv.internal.h"
#include "libc/dce.h" #include "libc/dce.h"
#include "libc/intrin/kprintf.h"
#include "libc/nt/thread.h" #include "libc/nt/thread.h"
#include "libc/nt/thunk/msabi.h" #include "libc/nt/thunk/msabi.h"
#include "libc/runtime/internal.h" #include "libc/runtime/internal.h"
@ -25,9 +26,9 @@
__msabi extern typeof(GetCurrentThreadId) *const __imp_GetCurrentThreadId; __msabi extern typeof(GetCurrentThreadId) *const __imp_GetCurrentThreadId;
int sys_gettid(void) { int sys_gettid(void) {
int64_t wut;
#ifdef __x86_64__ #ifdef __x86_64__
int tid; int tid;
int64_t wut;
if (IsWindows()) { if (IsWindows()) {
tid = __imp_GetCurrentThreadId(); tid = __imp_GetCurrentThreadId();
} else if (IsLinux()) { } else if (IsLinux()) {
@ -65,11 +66,23 @@ int sys_gettid(void) {
#elif defined(__aarch64__) #elif defined(__aarch64__)
// this can't be used on xnu // this can't be used on xnu
register long res asm("x0"); register long res asm("x0");
asm volatile("mov\tx8,%1\n\t" if (IsLinux()) {
"svc\t0" asm volatile("mov\tx8,%1\n\t"
: "=r"(res) "svc\t0"
: "i"(178) : "=r"(res)
: "x8", "memory"); : "i"(178)
: "x8", "memory");
} else if (IsFreebsd()) {
res = (long)&wut;
asm volatile("mov\tx8,%2\n\t"
"svc\t0"
: "+r"(res), "=m"(wut)
: "i"(432) // thr_self()
: "x8", "memory");
res = wut;
} else {
res = __pid;
}
return res; return res;
#else #else
#error "arch unsupported" #error "arch unsupported"

View file

@ -19,7 +19,6 @@
#include "libc/atomic.h" #include "libc/atomic.h"
#include "libc/sysv/consts/clock.h" #include "libc/sysv/consts/clock.h"
#include "libc/thread/freebsd.internal.h" #include "libc/thread/freebsd.internal.h"
#ifdef __x86_64__
int sys_umtx_timedwait_uint_cp(atomic_int *, int, int, size_t, int sys_umtx_timedwait_uint_cp(atomic_int *, int, int, size_t,
struct _umtx_time *) asm("sys_futex_cp"); struct _umtx_time *) asm("sys_futex_cp");
@ -46,5 +45,3 @@ int sys_umtx_timedwait_uint(atomic_int *p, int expect, bool pshare,
} }
return sys_umtx_timedwait_uint_cp(p, op, expect, size, tm_p); return sys_umtx_timedwait_uint_cp(p, op, expect, size, tm_p);
} }
#endif

View file

@ -164,6 +164,7 @@ __funline void *__memset(void *a, int c, unsigned long n) {
char *d = a; char *d = a;
unsigned long i; unsigned long i;
for (i = 0; i < n; ++i) { for (i = 0; i < n; ++i) {
__asm__ volatile("" ::: "memory");
d[i] = c; d[i] = c;
} }
return d; return d;
@ -174,6 +175,7 @@ __funline void *__memcpy(void *a, const void *b, unsigned long n) {
unsigned long i; unsigned long i;
const char *s = b; const char *s = b;
for (i = 0; i < n; ++i) { for (i = 0; i < n; ++i) {
__asm__ volatile("" ::: "memory");
d[i] = s[i]; d[i] = s[i];
} }
return d; return d;
@ -185,10 +187,12 @@ __funline void *__memmove(void *a, const void *b, unsigned long n) {
const char *s = b; const char *s = b;
if (d > s) { if (d > s) {
for (i = n; i--;) { for (i = n; i--;) {
__asm__ volatile("" ::: "memory");
d[i] = s[i]; d[i] = s[i];
} }
} else { } else {
for (i = 0; i < n; ++i) { for (i = 0; i < n; ++i) {
__asm__ volatile("" ::: "memory");
d[i] = s[i]; d[i] = s[i];
} }
} }

View file

@ -221,7 +221,7 @@ static relegated void __oncrash_impl(int sig, struct siginfo *si,
Append(b, "%serror%s: Uncaught %G (%s) on %s pid %d tid %d\n", strong, reset, Append(b, "%serror%s: Uncaught %G (%s) on %s pid %d tid %d\n", strong, reset,
sig, kind, host, getpid(), gettid()); sig, kind, host, getpid(), gettid());
if (program_invocation_name) { if (program_invocation_name) {
Append(b, " %s\n", program_invocation_name); Append(b, " %s\n", __program_executable_name);
} }
if (errno) { if (errno) {
Append(b, " %s\n", strerror(errno)); Append(b, " %s\n", strerror(errno));

View file

@ -60,7 +60,11 @@ int sys_fork(void) {
} else if (__syslib) { } else if (__syslib) {
return _sysret(__syslib->__fork()); return _sysret(__syslib->__fork());
} else { } else {
return enosys(); int ax;
axdx_t ad;
ad = __sys_fork();
ax = ad.ax;
return ax;
} }
#else #else

View file

@ -87,9 +87,9 @@ vfork:
#elif defined(__aarch64__) #elif defined(__aarch64__)
adrp x0,__hostos adrp x8,__hostos
ldr w0,[x0,#:lo12:__hostos] ldr w8,[x8,#:lo12:__hostos]
tbz x0,3,1f // bit 3 is xnu tbz x8,3,1f // bit 3 is xnu
b fork // which doesn't support vfork() b fork // which doesn't support vfork()
1: 1:
@ -102,10 +102,19 @@ vfork:
ldp x29,x30,[sp],16 ldp x29,x30,[sp],16
#endif #endif
mov x8,#220 // __NR_clone tbnz w8,5,1f // bit 5 is freebsd
mov x8,#220 // clone (linux)
mov x0,#0x4111 // SIGCHLD | CLONE_VM | CLONE_VFORK mov x0,#0x4111 // SIGCHLD | CLONE_VM | CLONE_VFORK
mov x1,#0 mov x1,#0
svc 0 svc 0
b 2f
1: mov x8,#66 // vfork (freebsd)
svc 0 // call kernel
bcc 2f // jump if not carry
neg x0,x0 // linux style errno
2:
// if (!rc) { // if (!rc) {
// __get_tls()->tib_flags |= TIB_FLAG_VFORKED; // __get_tls()->tib_flags |= TIB_FLAG_VFORKED;

View file

@ -231,60 +231,6 @@ static errno_t CloneXnu(int (*fn)(void *), char *stk, size_t stksz, int flags,
return sys_clone_xnu(fn, arg, wt, 0, PTHREAD_START_CUSTOM_XNU); return sys_clone_xnu(fn, arg, wt, 0, PTHREAD_START_CUSTOM_XNU);
} }
////////////////////////////////////////////////////////////////////////////////
// FREE BESIYATA DISHMAYA
static wontreturn void FreebsdThreadMain(void *p) {
struct CloneArgs *wt = p;
*wt->ctid = wt->tid;
wt->func(wt->arg, wt->tid);
// we no longer use the stack after this point
// void thr_exit(%rdi = long *state);
asm volatile("movl\t$0,%0\n\t" // *wt->ztid = 0
"syscall\n\t" // _umtx_op(wt->ztid, WAKE, INT_MAX)
"movl\t$431,%%eax\n\t" // thr_exit(long *nonzeroes_and_wake)
"xor\t%%edi,%%edi\n\t" // sad we can't use this free futex op
"syscall\n\t" // exit1() fails if thread is orphaned
"movl\t$1,%%eax\n\t" // exit()
"syscall" //
: "=m"(*wt->ztid)
: "a"(454), "D"(wt->ztid), "S"(UMTX_OP_WAKE), "d"(INT_MAX)
: "rcx", "r8", "r9", "r10", "r11", "memory");
__builtin_unreachable();
}
static errno_t CloneFreebsd(int (*func)(void *, int), char *stk, size_t stksz,
int flags, void *arg, void *tls, int *ptid,
int *ctid) {
int ax;
bool failed;
int64_t tid;
struct CloneArgs *wt;
wt = AllocateCloneArgs(stk, stksz);
wt->ctid = flags & CLONE_CHILD_SETTID ? ctid : &wt->tid;
wt->ztid = flags & CLONE_CHILD_CLEARTID ? ctid : &wt->tid;
wt->tls = tls;
wt->func = func;
wt->arg = arg;
struct thr_param params = {
.start_func = FreebsdThreadMain,
.arg = wt,
.stack_base = stk,
.stack_size = (uintptr_t)wt - (uintptr_t)stk,
.tls_base = flags & CLONE_SETTLS ? tls : 0,
.tls_size = 64,
.child_tid = &wt->tid64,
.parent_tid = &tid,
};
asm volatile(CFLAG_ASM("syscall")
: CFLAG_CONSTRAINT(failed), "=a"(ax)
: "1"(__NR_thr_new), "D"(&params), "S"(sizeof(params))
: "rcx", "rdx", "r8", "r9", "r10", "r11", "memory");
if (failed) return ax;
if (flags & CLONE_PARENT_SETTID) *ptid = tid;
return 0;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// OPEN BESIYATA DISHMAYA // OPEN BESIYATA DISHMAYA
@ -441,6 +387,95 @@ static int CloneNetbsd(int (*func)(void *, int), char *stk, size_t stksz,
#endif /* __x86_64__ */ #endif /* __x86_64__ */
////////////////////////////////////////////////////////////////////////////////
// FREE BESIYATA DISHMAYA
void bone(struct CloneArgs *wt) {
*wt->ztid = 0;
}
static wontreturn void FreebsdThreadMain(void *p) {
struct CloneArgs *wt = p;
#ifdef __aarch64__
asm volatile("mov\tx28,%0" : /* no outputs */ : "r"(wt->tls));
#endif
*wt->ctid = wt->tid;
wt->func(wt->arg, wt->tid);
// we no longer use the stack after this point
// void thr_exit(%rdi = long *state);
#ifdef __x86_64__
asm volatile("movl\t$0,%0\n\t" // *wt->ztid = 0
"syscall\n\t" // _umtx_op(wt->ztid, WAKE, INT_MAX)
"movl\t$431,%%eax\n\t" // thr_exit(long *nonzeroes_and_wake)
"xor\t%%edi,%%edi\n\t" // sad we can't use this free futex op
"syscall\n\t" // thr_exit() fails if thread is orphaned
"movl\t$1,%%eax\n\t" // _exit()
"syscall" //
: "=m"(*wt->ztid)
: "a"(454), "D"(wt->ztid), "S"(UMTX_OP_WAKE), "d"(INT_MAX)
: "rcx", "r8", "r9", "r10", "r11", "memory");
#elif defined(__aarch64__)
register long x0 asm("x0") = (long)wt->ztid;
register long x1 asm("x1") = UMTX_OP_WAKE;
register long x2 asm("x2") = INT_MAX;
register long x8 asm("x8") = 454; // _umtx_op
asm volatile("str\twzr,%0\n\t" // *wt->ztid = 0
"svc\t0\n\t" // _umtx_op(wt->ztid, WAKE, INT_MAX)
"mov\tx0,#0\n\t" // arg0 = 0
"mov\tx8,#431\n\t" // thr_exit
"svc\t0\n\t" // thr_exit(long *nonzeroes_and_wake = 0)
"mov\tx8,#1\n\t" // _exit
"svc\t0" // _exit(long *nonzeroes_and_wake = 0)
: "=m"(*wt->ztid)
: "r"(x0), "r"(x1), "r"(x2), "r"(x8));
#else
#error "unsupported architecture"
#endif
__builtin_unreachable();
}
static errno_t CloneFreebsd(int (*func)(void *, int), char *stk, size_t stksz,
int flags, void *arg, void *tls, int *ptid,
int *ctid) {
int64_t tid;
struct CloneArgs *wt;
wt = AllocateCloneArgs(stk, stksz);
wt->ctid = flags & CLONE_CHILD_SETTID ? ctid : &wt->tid;
wt->ztid = flags & CLONE_CHILD_CLEARTID ? ctid : &wt->tid;
wt->tls = tls;
wt->func = func;
wt->arg = arg;
struct thr_param params = {
.start_func = FreebsdThreadMain,
.arg = wt,
.stack_base = stk,
.stack_size = (uintptr_t)wt - (uintptr_t)stk,
.tls_base = flags & CLONE_SETTLS ? tls : 0,
.tls_size = 64,
.child_tid = &wt->tid64,
.parent_tid = &tid,
};
#ifdef __x86_64__
int ax;
bool failed;
asm volatile(CFLAG_ASM("syscall")
: CFLAG_CONSTRAINT(failed), "=a"(ax)
: "1"(__NR_thr_new), "D"(&params), "S"(sizeof(params))
: "rcx", "rdx", "r8", "r9", "r10", "r11", "memory");
if (failed) return ax;
#elif defined(__aarch64__)
register long x0 asm("x0") = (long)&params;
register long x1 asm("x1") = sizeof(params);
register int x8 asm("x8") = 0x1c7; // thr_new
asm volatile("svc\t0" : "+r"(x0) : "r"(x1), "r"(x8) : "memory");
if (x0) return x0;
#else
#error "unsupported architecture"
#endif
if (flags & CLONE_PARENT_SETTID) *ptid = tid;
return 0;
}
#ifdef __aarch64__ #ifdef __aarch64__
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -675,9 +710,9 @@ errno_t clone(void *func, void *stk, size_t stksz, int flags, void *arg,
#else #else
#error "unsupported architecture" #error "unsupported architecture"
#endif #endif
#ifdef __x86_64__
} else if (IsFreebsd()) { } else if (IsFreebsd()) {
rc = CloneFreebsd(func, stk, stksz, flags, arg, tls, ptid, ctid); rc = CloneFreebsd(func, stk, stksz, flags, arg, tls, ptid, ctid);
#ifdef __x86_64__
} else if (IsNetbsd()) { } else if (IsNetbsd()) {
rc = CloneNetbsd(func, stk, stksz, flags, arg, tls, ptid, ctid); rc = CloneNetbsd(func, stk, stksz, flags, arg, tls, ptid, ctid);
} else if (IsOpenbsd()) { } else if (IsOpenbsd()) {

View file

@ -78,7 +78,8 @@ static const char *DecodeMagnum(const char *p, long *r) {
return *r = x, p; return *r = x, p;
} }
wontreturn textstartup void cosmo(long *sp, struct Syslib *m1, char *exename) { wontreturn textstartup void cosmo(long *sp, struct Syslib *m1, char *exename,
long *is_freebsd) {
// get startup timestamp as early as possible // get startup timestamp as early as possible
// its used by --strace and also kprintf() %T // its used by --strace and also kprintf() %T
@ -95,6 +96,11 @@ wontreturn textstartup void cosmo(long *sp, struct Syslib *m1, char *exename) {
}; };
__set_tls(&tib); __set_tls(&tib);
// check for freebsd
if (is_freebsd) {
sp = is_freebsd;
}
// extracts arguments from old sysv stack abi // extracts arguments from old sysv stack abi
int argc = *sp; int argc = *sp;
char **argv = (char **)(sp + 1); char **argv = (char **)(sp + 1);
@ -114,7 +120,10 @@ wontreturn textstartup void cosmo(long *sp, struct Syslib *m1, char *exename) {
// detect apple m1 environment // detect apple m1 environment
const char *magnums; const char *magnums;
if (SupportsXnu() && (__syslib = m1)) { if (SupportsFreebsd() && is_freebsd) {
hostos = _HOSTFREEBSD;
magnums = syscon_freebsd;
} else if (SupportsXnu() && (__syslib = m1)) {
hostos = _HOSTXNU; hostos = _HOSTXNU;
magnums = syscon_xnu; magnums = syscon_xnu;
} else if (SupportsLinux()) { } else if (SupportsLinux()) {

View file

@ -58,6 +58,8 @@ $(LIBC_SOCK_A).pkg: \
# these assembly files are safe to build on aarch64 # these assembly files are safe to build on aarch64
o/$(MODE)/libc/sock/sys_sendfile_xnu.o: libc/sock/sys_sendfile_xnu.S o/$(MODE)/libc/sock/sys_sendfile_xnu.o: libc/sock/sys_sendfile_xnu.S
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $< @$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
o/$(MODE)/libc/sock/sys_sendfile_freebsd.o: libc/sock/sys_sendfile_freebsd.S
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
LIBC_SOCK_LIBS = $(foreach x,$(LIBC_SOCK_ARTIFACTS),$($(x))) LIBC_SOCK_LIBS = $(foreach x,$(LIBC_SOCK_ARTIFACTS),$($(x)))
LIBC_SOCK_SRCS = $(foreach x,$(LIBC_SOCK_ARTIFACTS),$($(x)_SRCS)) LIBC_SOCK_SRCS = $(foreach x,$(LIBC_SOCK_ARTIFACTS),$($(x)_SRCS))

View file

@ -96,6 +96,7 @@ o/$(MODE)/libc/sysv/sysv.o: private \
-ffixed-x4 \ -ffixed-x4 \
-ffixed-x5 \ -ffixed-x5 \
-ffixed-x8 \ -ffixed-x8 \
-ffixed-x9 \
-ffixed-x16 \ -ffixed-x16 \
-fomit-frame-pointer \ -fomit-frame-pointer \
-foptimize-sibling-calls \ -foptimize-sibling-calls \

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall __bsd_setegid,0xfff0b60b620b6fff,4095,182,globl,hidden .scall __bsd_setegid,0xfff0b60b620b6fff,4095,182,182,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall __bsd_seteuid,0xfff0b70b720b7fff,4095,183,globl,hidden .scall __bsd_seteuid,0xfff0b70b720b7fff,4095,183,183,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall __sys_accept,0x81e81ea1d281e82b,2250,2078,globl,hidden .scall __sys_accept,0x81e81ea1d281e82b,2250,2078,2589,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall __sys_accept4,0xfff85da1dffff920,2290,4095,globl,hidden .scall __sys_accept4,0xfff85da1dffff920,2290,4095,2589,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall __sys_bind,0x0680680682068031,200,104,globl,hidden .scall __sys_bind,0x0680680682068031,200,104,104,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall __sys_clock_nanosleep,0x9ddfff8f4ffff8e6,2163,4095,globl,hidden .scall __sys_clock_nanosleep,0x9ddfff8f4ffff8e6,2163,4095,2292,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall __sys_connect,0x862862862286282a,2251,2146,globl,hidden .scall __sys_connect,0x862862862286282a,2251,2146,2146,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall __sys_dup3,0x1c6066fffffff124,24,4095,globl,hidden .scall __sys_dup3,0x1c6066fffffff124,24,4095,4095,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall __sys_execve,0x03b03b03b203b03b,221,59,globl,hidden .scall __sys_execve,0x03b03b03b203b03b,221,59,59,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall __sys_fcntl,0x05c05c05c205c048,25,92,globl,hidden .scall __sys_fcntl,0x05c05c05c205c048,25,92,92,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall __sys_fcntl_cp,0x85c85c85c285c848,2073,2140,globl,hidden .scall __sys_fcntl_cp,0x85c85c85c285c848,2073,2140,2140,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall __sys_fork,0x0020020022002039,4095,2,globl,hidden .scall __sys_fork,0x0020020022002039,4095,2,2,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall __sys_fstat,0x1b80352272153005,80,339,globl,hidden .scall __sys_fstat,0x1b80352272153005,80,339,551,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall __sys_fstatat,0x1d202a22821d6106,79,470,globl,hidden .scall __sys_fstatat,0x1d202a22821d6106,79,470,552,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall __sys_getpeername,0x01f01f08d201f034,205,31,globl,hidden .scall __sys_getpeername,0x01f01f08d201f034,205,31,141,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall __sys_getrusage,0x1bd0130752075062,165,117,globl,hidden .scall __sys_getrusage,0x1bd0130752075062,165,117,117,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall __sys_getsockname,0x0200200202020033,204,32,globl,hidden .scall __sys_getsockname,0x0200200202020033,204,32,32,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall __sys_gettid,0x13712b1b0101b0ba,178,27,globl,hidden .scall __sys_gettid,0x13712b1b0101b0ba,178,27,432,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall __sys_lstat,0x1b90280282154006,4095,340,globl,hidden .scall __sys_lstat,0x1b90280282154006,4095,340,40,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall __sys_mmap,0x0c50311dd20c5009,222,197,globl,hidden .scall __sys_mmap,0x0c50311dd20c5009,222,197,477,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall __sys_mprotect,0x04a04a04a204a00a,226,74,globl,hidden .scall __sys_mprotect,0x04a04a04a204a00a,226,74,74,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall __sys_mremap,0x19bffffffffff019,216,4095,globl,hidden .scall __sys_mremap,0x19bffffffffff019,216,4095,4095,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall __sys_munmap,0x049049049204900b,215,73,globl,hidden .scall __sys_munmap,0x049049049204900b,215,73,73,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall __sys_openat,0x9d49419f329cf901,2104,2511,globl,hidden .scall __sys_openat,0x9d49419f329cf901,2104,2511,2547,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall __sys_openat_nc,0x1d41411f321d0101,56,464,globl,hidden .scall __sys_openat_nc,0x1d41411f321d0101,56,464,499,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall __sys_pipe,0x02a10721e202a016,59,42,globl,hidden .scall __sys_pipe,0x02a10721e202a016,59,42,542,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall __sys_pipe2,0x1c506521effff125,59,4095,globl,hidden .scall __sys_pipe2,0x1c506521effff125,59,4095,542,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall __sys_poll,0x8d18fc8d128e6807,4095,2278,globl,hidden .scall __sys_poll,0x8d18fc8d128e6807,4095,2278,2257,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall __sys_ptrace,0x01a01a01a201a065,117,26,globl,hidden .scall __sys_ptrace,0x01a01a01a201a065,117,26,26,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall __sys_sigprocmask,0x125030154214900e,135,329,globl,hidden .scall __sys_sigprocmask,0x125030154214900e,135,329,340,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall __sys_socket,0x18a0610612061029,198,97,globl,hidden .scall __sys_socket,0x18a0610612061029,198,97,97,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall __sys_socketpair,0x0870870872087035,199,135,globl,hidden .scall __sys_socketpair,0x0870870872087035,199,135,135,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall __sys_stat,0x1b7026fff2152004,79,338,globl,hidden .scall __sys_stat,0x1b7026fff2152004,79,338,4095,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall __sys_utimensat,0x1d3054223ffff118,88,4095,globl,hidden .scall __sys_utimensat,0x1d3054223ffff118,88,4095,547,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall __sys_wait4,0x9c180b807280783d,2308,2055,globl,hidden .scall __sys_wait4,0x9c180b807280783d,2308,2055,2055,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall get_mempolicy,0xfffffffffffff0ef,236,4095,globl .scall get_mempolicy,0xfffffffffffff0ef,236,4095,4095,globl

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall getpagesize_freebsd,0xffffff040fffffff,4095,4095,globl,hidden .scall getpagesize_freebsd,0xffffff040fffffff,4095,4095,64,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall set_mempolicy,0xfffffffffffff0ee,237,4095,globl .scall set_mempolicy,0xfffffffffffff0ee,237,4095,4095,globl

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall sys_acct,0x03303303320330a3,89,51,globl .scall sys_acct,0x03303303320330a3,89,51,51,globl

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall sys_add_key,0xfffffffffffff0f8,217,4095,globl .scall sys_add_key,0xfffffffffffff0f8,217,4095,4095,globl

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall sys_adjtime,0x1a508c08c208cfff,4095,140,globl .scall sys_adjtime,0x1a508c08c208cfff,4095,140,140,globl

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall sys_adjtimex,0xfffffffffffff09f,171,4095,globl .scall sys_adjtimex,0xfffffffffffff09f,171,4095,4095,globl

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall sys_aio_cancel,0x18ffff13c213cfff,4095,316,globl .scall sys_aio_cancel,0x18ffff13c213cfff,4095,316,316,globl

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall sys_aio_error,0x190fff13d213dfff,4095,317,globl .scall sys_aio_error,0x190fff13d213dfff,4095,317,317,globl

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall sys_aio_fsync,0x191fff1d12139fff,4095,313,globl .scall sys_aio_fsync,0x191fff1d12139fff,4095,313,465,globl

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall sys_aio_mlock,0xffffff21ffffffff,4095,4095,globl .scall sys_aio_mlock,0xffffff21ffffffff,4095,4095,543,globl

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall sys_aio_read,0x192fff13e213efff,4095,318,globl .scall sys_aio_read,0x192fff13e213efff,4095,318,318,globl

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall sys_aio_return,0x193fff13a213afff,4095,314,globl .scall sys_aio_return,0x193fff13a213afff,4095,314,314,globl

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall sys_aio_suspend,0x1b6fff13b213bfff,4095,315,globl .scall sys_aio_suspend,0x1b6fff13b213bfff,4095,315,315,globl

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall sys_aio_suspend_nocancel,0xfffffffff21a5fff,4095,421,globl .scall sys_aio_suspend_nocancel,0xfffffffff21a5fff,4095,421,4095,globl

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall sys_aio_waitcomplete,0xffffff167fffffff,4095,4095,globl .scall sys_aio_waitcomplete,0xffffff167fffffff,4095,4095,359,globl

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall sys_aio_write,0x195fff13f213ffff,4095,319,globl .scall sys_aio_write,0x195fff13f213ffff,4095,319,319,globl

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall sys_alarm,0xfffffffffffff025,4095,4095,globl,hidden .scall sys_alarm,0xfffffffffffff025,4095,4095,4095,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall sys_arch_prctl,0x0a50a50a5ffff09e,4095,4095,globl,hidden .scall sys_arch_prctl,0x0a50a50a5ffff09e,4095,4095,165,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall sys_audit,0xffffff1bd215efff,4095,350,globl .scall sys_audit,0xffffff1bd215efff,4095,350,445,globl

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall sys_auditctl,0xffffff1c52167fff,4095,359,globl .scall sys_auditctl,0xffffff1c52167fff,4095,359,453,globl

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall sys_auditon,0xffffff1be215ffff,4095,351,globl .scall sys_auditon,0xffffff1be215ffff,4095,351,446,globl

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall sys_bogus,0x00b5005002500500,1280,1280,globl .scall sys_bogus,0x00b5005002500500,1280,1280,1280,globl

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall sys_bpf,0xfffffffffffff141,280,4095,globl .scall sys_bpf,0xfffffffffffff141,280,4095,4095,globl

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall sys_bsdthread_register,0xfffffffff216efff,4095,366,globl,hidden .scall sys_bsdthread_register,0xfffffffff216efff,4095,366,4095,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall sys_cachestat,0xfffffffffffff1c3,451,4095,globl .scall sys_cachestat,0xfffffffffffff1c3,451,4095,4095,globl

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall sys_capget,0xfffffffffffff07d,90,4095,globl .scall sys_capget,0xfffffffffffff07d,90,4095,4095,globl

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall sys_capset,0xfffffffffffff07e,91,4095,globl .scall sys_capset,0xfffffffffffff07e,91,4095,4095,globl

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall sys_chdir,0x00c00c00c200c050,49,12,globl,hidden .scall sys_chdir,0x00c00c00c200c050,49,12,12,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall sys_chflags,0x0220220222022fff,4095,34,globl .scall sys_chflags,0x0220220222022fff,4095,34,34,globl

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall sys_chflagsat,0xfff06b21cfffffff,4095,4095,globl .scall sys_chflagsat,0xfff06b21cfffffff,4095,4095,540,globl

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall sys_chroot,0x03d03d03d203d0a1,51,61,globl,hidden .scall sys_chroot,0x03d03d03d203d0a1,51,61,61,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall sys_clock_adjtime,0xfffffffffffff131,266,4095,globl .scall sys_clock_adjtime,0xfffffffffffff131,266,4095,4095,globl

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall sys_clock_getres,0x1ad0590eaffff0e5,114,4095,globl,hidden .scall sys_clock_getres,0x1ad0590eaffff0e5,114,4095,234,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall sys_clock_settime,0x1ac0580e9ffff0e3,112,4095,globl,hidden .scall sys_clock_settime,0x1ac0580e9ffff0e3,112,4095,233,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall sys_clone,0x11fffffffffff038,220,4095,globl,hidden .scall sys_clone,0x11fffffffffff038,220,4095,4095,globl,hidden

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall sys_clone3,0xfffffffffffff1b3,435,4095,globl .scall sys_clone3,0xfffffffffffff1b3,435,4095,4095,globl

View file

@ -1,2 +1,2 @@
#include "libc/sysv/macros.internal.h" #include "libc/sysv/macros.internal.h"
.scall sys_close,0x0060060062006003,57,6,globl,hidden .scall sys_close,0x0060060062006003,57,6,6,globl,hidden

Some files were not shown because too many files have changed in this diff Show more