Get LIBC_RUNTIME and LIBC_CALLS building on aarch64

This commit is contained in:
Justine Tunney 2023-05-09 01:56:56 -07:00
parent 7e46645193
commit e5e3cdf447
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
1200 changed files with 5341 additions and 3677 deletions

View file

@ -126,7 +126,6 @@ include third_party/zlib/zlib.mk # │
include third_party/double-conversion/dc.mk # │
include libc/elf/elf.mk # │
include ape/ape.mk # │
include libc/aarch64/aarch64.mk # │
include libc/fmt/fmt.mk # │
include libc/vga/vga.mk #─┘
include libc/calls/calls.mk #─┐

698
ape/ape.S

File diff suppressed because it is too large Load diff

View file

@ -19,11 +19,21 @@ APE_FILES := $(wildcard ape/*.*)
APE_HDRS = $(filter %.h,$(APE_FILES))
APE_INCS = $(filter %.inc,$(APE_FILES))
ifneq ($(MODE), aarch64)
APE = o/$(MODE)/ape/ape.o \
o/$(MODE)/ape/ape.lds
ifeq ($(MODE), aarch64)
APE_SRCS = ape/ape.S
APE_OBJS = o/$(MODE)/ape/ape.o
APE_NO_MODIFY_SELF = $(APE)
APE_COPY_SELF = $(APE)
.PHONY: o/$(MODE)/ape
o/$(MODE)/ape: $(APE)
else
APE_NO_MODIFY_SELF = \
o/$(MODE)/ape/ape.lds \
o/$(MODE)/ape/ape-no-modify-self.o
@ -61,22 +71,6 @@ APE_SRCS = $(APE_SRCS_C) $(APE_SRCS_S)
APE_OBJS = $(APE_SRCS_S:%.S=o/$(MODE)/%.o)
APE_CHECKS = $(APE_HDRS:%=o/%.ok)
o/$(MODE)/ape/ape.lds: \
ape/ape.lds \
ape/macros.internal.h \
ape/relocations.h \
libc/intrin/bits.h \
libc/thread/tls.h \
libc/calls/struct/timespec.h \
libc/thread/thread.h \
libc/dce.h \
libc/elf/def.h \
libc/elf/pf2prot.internal.h \
libc/macros.internal.h \
libc/nt/pedef.internal.h \
libc/str/str.h \
libc/zip.h
o/$(MODE)/ape/public/ape.lds: OVERRIDE_CPPFLAGS += -UCOSMO
o/$(MODE)/ape/public/ape.lds: \
ape/public/ape.lds \
@ -99,10 +93,6 @@ o/ape/idata.inc: \
ape/idata.internal.h \
ape/relocations.h
o/$(MODE)/ape/ape.o: \
ape/blink-aarch64.gz \
ape/blink-darwin-arm64.gz
o/$(MODE)/ape/ape-no-modify-self.o: \
ape/ape.S \
ape/macros.internal.h \
@ -199,3 +189,27 @@ o/$(MODE)/ape: $(APE_CHECKS) \
o/$(MODE)/ape/ape-no-modify-self.o
endif
# these assembly files are safe to build on aarch64
o/$(MODE)/ape/ape.o: ape/ape.S
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
o/$(MODE)/ape/ape.o: \
ape/blink-aarch64.gz \
ape/blink-darwin-arm64.gz
o/$(MODE)/ape/ape.lds: \
ape/ape.lds \
ape/macros.internal.h \
ape/relocations.h \
libc/intrin/bits.h \
libc/thread/tls.h \
libc/calls/struct/timespec.h \
libc/thread/thread.h \
libc/dce.h \
libc/elf/def.h \
libc/elf/pf2prot.internal.h \
libc/macros.internal.h \
libc/nt/pedef.internal.h \
libc/str/str.h \
libc/zip.h

View file

@ -63,13 +63,10 @@
.size "\dll\().\actual",.-"\dll\().\actual"
.previous
#else
.section ".text.nt.\actual","ax",@progbits
.globl "\actual"
"\actual":
ret
.section ".data.nt.\actual","aw",@progbits
.globl "\fn"
.balign 8
.weak "\actual"
"\fn": .quad "\actual"
#endif
.endm

View file

@ -1,13 +0,0 @@
#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐
#───vi: set et ft=make ts=8 tw=8 fenc=utf-8 :vi───────────────────────┘
o/$(MODE)/libc/aarch64/%.o: libc/aarch64/%.S
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
o/$(MODE)/libc/aarch64/start.o: \
libc/aarch64/start.c \
libc/runtime/runtime.h
o/$(MODE)/libc/aarch64: \
o/$(MODE)/libc/aarch64/crt.o \
o/$(MODE)/libc/aarch64/start.o

View file

@ -0,0 +1,21 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
Copyright 2023 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/clock_gettime.internal.h"
clock_gettime_f *__clock_gettime = __clock_gettime_init;

View file

@ -51,7 +51,8 @@ LIBC_CALLS_A_DIRECTDEPS = \
LIBC_STR \
LIBC_STUBS \
LIBC_SYSV_CALLS \
LIBC_SYSV
LIBC_SYSV \
THIRD_PARTY_COMPILER_RT
LIBC_CALLS_A_DEPS := \
$(call uniq,$(foreach x,$(LIBC_CALLS_A_DIRECTDEPS),$($(x))))

View file

@ -17,7 +17,6 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/calls.h"
#include "libc/intrin/lockxadd.h"
#include "libc/nt/process.h"
static textwindows char16_t *UintToChar16Array(char16_t p[21], uint64_t x) {
@ -44,7 +43,7 @@ textwindows char16_t *CreatePipeName(char16_t *a) {
while (*q) *p++ = *q++;
p = UintToChar16Array(p, GetCurrentProcessId());
*p++ = '-';
p = UintToChar16Array(p, _lockxadd(&x, 1));
p = UintToChar16Array(p, (x += 1));
*p = 0;
return a;
}

View file

@ -18,6 +18,7 @@
*/
#include "libc/calls/calls.h"
#include "libc/calls/syscall-nt.internal.h"
#include "libc/calls/syscall-sysv.internal.h"
#include "libc/dce.h"
#include "libc/errno.h"
#include "libc/intrin/asmflag.h"
@ -74,21 +75,10 @@ privileged int getpriority(int which, unsigned who) {
} else {
rc = sys_getpriority_nt(which, who);
}
#elif defined(__aarch64__)
register long r0 asm("x0") = (long)which;
register long r1 asm("x1") = (long)who;
register long res_x0 asm("x0");
asm volatile("mov\tx8,%1\n\t"
"svc\t0"
: "=r"(res_x0)
: "i"(141), "r"(r0), "r"(r1)
: "x8", "memory");
rc = res_x0;
if (rc >= 0) {
#else
rc = sys_getpriority(which, who);
if (rc != -1) {
rc = NZERO - rc;
} else {
errno = -rc;
rc = -1;
}
#endif
STRACE("getpriority(%s, %u) → %d% m", DescribeWhichPrio(which), who, rc);

View file

@ -31,8 +31,8 @@
#include "libc/time/struct/timezone.h"
typedef axdx_t gettimeofday_f(struct timeval *, struct timezone *, void *);
extern gettimeofday_f *__gettimeofday;
static gettimeofday_f __gettimeofday_init;
static gettimeofday_f *__gettimeofday = __gettimeofday_init;
/**
* Returns system wall time in microseconds, e.g.
@ -97,8 +97,10 @@ gettimeofday_f *__gettimeofday_get(bool *opt_out_isfast) {
return res;
}
_Hide int __gettimeofday_init(struct timeval *tv, struct timezone *tz) {
static axdx_t __gettimeofday_init(struct timeval *tv, //
struct timezone *tz, //
void *arg) {
gettimeofday_f *gettime;
__gettimeofday = gettime = __gettimeofday_get(0);
return gettime(tv, tz, 0).ax;
return gettime(tv, tz, 0);
}

View file

@ -65,19 +65,8 @@ privileged void *sys_mremap(void *p, size_t n, size_t m, int f, void *q) {
res = enosys();
}
#elif defined(__aarch64__)
long res;
register long r0 asm("x0") = (long)p;
register long r1 asm("x1") = (long)n;
register long r2 asm("x2") = (long)m;
register long r3 asm("x3") = (long)f;
register long r4 asm("x4") = (long)q;
register long res_x0 asm("x0");
asm volatile("mov\tx8,%1\n\t"
"svc\t0"
: "=r"(res_x0)
: "i"(216), "r"(r0), "r"(r1), "r"(r2), "r"(r3), "r"(r4)
: "x8", "memory");
res = _sysret64(res_x0);
void *res;
res = __sys_mremap(p, n, m, f, q);
#else
#error "arch unsupported"
#endif

View file

@ -112,3 +112,5 @@ long double nowl_setup(void) {
}
return nowl();
}
long double (*nowl)(void) = nowl_setup;

View file

@ -28,6 +28,8 @@
#include "libc/thread/tls.h"
#include "libc/thread/tls2.h"
#ifdef __x86_64__
textwindows bool32 __onntconsoleevent(uint32_t dwCtrlType) {
struct CosmoTib tib;
struct StackFrame *fr;
@ -60,3 +62,5 @@ textwindows bool32 __onntconsoleevent(uint32_t dwCtrlType) {
return false;
}
}
#endif /* __x86_64__ */

View file

@ -35,6 +35,8 @@
#include "libc/sysv/errfuns.h"
#include "libc/zipos/zipos.internal.h"
#ifdef __x86_64__
int sys_openat_metal(int dirfd, const char *file, int flags, unsigned mode) {
int fd;
struct MetalFile *state;
@ -61,3 +63,5 @@ int sys_openat_metal(int dirfd, const char *file, int flags, unsigned mode) {
g_fds.p[fd].handle = (intptr_t)state;
return fd;
}
#endif /* __x86_64__ */

View file

@ -20,6 +20,8 @@
#include "libc/macros.internal.h"
#include "libc/str/str.h"
#ifdef __x86_64__
static int FindPromise(const char *name) {
int i;
for (i = 0; i < ARRAYLEN(kPledge); ++i) {
@ -64,3 +66,5 @@ int ParsePromises(const char *promises, unsigned long *out) {
}
return rc;
}
#endif /* __x86_64__ */

View file

@ -28,6 +28,8 @@
#include "libc/runtime/runtime.h"
#include "libc/sysv/errfuns.h"
#ifdef __x86_64__
/**
* Permits system operations, e.g.
*
@ -276,3 +278,5 @@ int pledge(const char *promises, const char *execpromises) {
STRACE("pledge(%#s, %#s) → %d% m", promises, execpromises, rc);
return rc;
}
#endif /* __x86_64__ */

View file

@ -41,6 +41,8 @@
#include "libc/sysv/consts/sig.h"
#include "libc/sysv/errfuns.h"
#ifdef __x86_64__
/*
* Polls on the New Technology.
*
@ -218,3 +220,5 @@ ReturnPath:
}
return rc;
}
#endif /* __x86_64__ */

View file

@ -66,7 +66,7 @@ privileged int prctl(int operation, ...) {
: "=r"(res_x0)
: "i"(167), "r"(r0), "r"(r1), "r"(r2), "r"(r3), "r"(r4)
: "x8", "memory");
rc = _sysret32(res_x0);
rc = _sysret(res_x0);
#else
#error "arch unsupported"
#endif

View file

@ -1,50 +0,0 @@
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
vi: set et ft=asm ts=8 sw=8 fenc=utf-8 :vi
Copyright 2020 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/macros.internal.h"
.initbss 400,_init_program_invocation_short_name
// Supplies basename(argv[0]) The GNU Way.
//
// If argv[0] isn't supplied, this value will be null.
//
// @see GetProgramExecutableName()
// @see program_invocation_name
program_invocation_short_name:
.quad 0
.endobj program_invocation_short_name,globl
.previous
.init.start 400,_init_program_invocation_short_name
push %rsi
xor %eax,%eax
test %r12d,%r12d # argc
jz 2f
mov (%r13),%rsi # argv[0]
mov %rsi,%rcx
1: lodsb
cmp $'/',%al
cmoveq %rsi,%rcx
cmp $'\\',%al
cmoveq %rsi,%rcx
test %al,%al
jnz 1b
xchg %rcx,%rax
pop %rsi
2: stosq
.init.end 400,_init_program_invocation_short_name

View file

@ -1,5 +1,5 @@
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
Copyright 2023 Justine Alexandra Roberts Tunney
@ -16,38 +16,19 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
.globl _start
.type _start,%function
_start: mov x29,#0
mov x30,#0
mov x0,sp
and sp,x0,#-16
b _start_c
.size _start,.-_start
char *program_invocation_short_name;
.section .initprologue
.global _init
.type _init,%function
_init: stp x29,x30,[sp,-16]!
mov x29,sp
.previous/*
...
decentralized content
...
*/.section .initepilogue
ldp x29,x30,[sp],#16
ret
.section .finiprologue
.global _fini
.type _fini,%function
_fini: stp x29,x30,[sp,-16]!
mov x29,sp
.previous/*
...
decentralized content
...
*/.section .finiepilogue
ldp x29,x30,[sp],#16
ret
__attribute__((__constructor__)) static void //
program_invocation_short_name_init(void) {
char *p, *r;
if (!__argc) return;
if ((p = strrchr(__argv[0], '/'))) {
r = p + 1;
} else {
r = __argv[0];
}
program_invocation_short_name = r;
}

View file

@ -26,6 +26,8 @@
#include "libc/sysv/errfuns.h"
#include "libc/vga/vga.internal.h"
#ifdef __x86_64__
ssize_t sys_readv_metal(struct Fd *fd, const struct iovec *iov, int iovlen) {
int i;
size_t got, toto;
@ -56,3 +58,5 @@ ssize_t sys_readv_metal(struct Fd *fd, const struct iovec *iov, int iovlen) {
return ebadf();
}
}
#endif /* __x86_64__ */

View file

@ -74,7 +74,7 @@ privileged int seccomp(unsigned operation, unsigned flags, void *args) {
: "=r"(res_x0)
: "i"(211), "r"(r0), "r"(r1), "r"(r2)
: "x8", "memory");
rc = _sysret32(res_x0);
rc = _sysret(res_x0);
#else
#error "arch unsupported"
#endif

View file

@ -41,6 +41,8 @@
#include "libc/sysv/errfuns.h"
#include "libc/time/time.h"
#ifdef __x86_64__
/**
* @fileoverview Heartbreaking polyfill for SIGALRM on NT.
*
@ -130,3 +132,5 @@ textwindows int sys_setitimer_nt(int which, const struct itimerval *newvalue,
return 0;
}
#endif /* __x86_64__ */

View file

@ -255,7 +255,9 @@ static int __sigaction(int sig, const struct sigaction *act,
if (act) {
__sighandrvas[sig] = rva;
__sighandflags[sig] = act->sa_flags;
__sig_check_ignore(sig, rva);
if (IsWindows()) {
__sig_check_ignore(sig, rva);
}
}
}
return rc;

View file

@ -32,6 +32,8 @@
#include "libc/sysv/consts/sicode.h"
#include "libc/sysv/consts/sig.h"
#ifdef __x86_64__
/**
* Checks to see if SIGCHLD should be raised on Windows.
* @return true if a signal was raised
@ -67,3 +69,5 @@ void _check_sigchld(void) {
__fds_unlock();
__sig_add(0, SIGCHLD, CLD_EXITED);
}
#endif /* __x86_64__ */

View file

@ -32,6 +32,8 @@
#include "libc/sysv/consts/sig.h"
#include "libc/thread/tls.h"
#ifdef __x86_64__
static struct winsize __ws;
textwindows void _check_sigwinch(struct Fd *fd) {
@ -58,3 +60,5 @@ textwindows void _check_sigwinch(struct Fd *fd) {
}
errno = e;
}
#endif /* __x86_64__ */

View file

@ -10,9 +10,6 @@ COSMOPOLITAN_C_START_
cosmopolitan § syscalls » system five » structless synthetic jump slots
*/
int _sysret32(long) asm("_sysret");
long _sysret64(long) asm("_sysret");
axdx_t __sys_fork(void) _Hide;
axdx_t __sys_pipe(i32[hasatleast 2], i32) _Hide;
axdx_t sys_getpid(void) _Hide;
@ -65,6 +62,7 @@ i32 sys_getresgid(u32 *, u32 *, u32 *) _Hide;
i32 sys_getresuid(u32 *, u32 *, u32 *) _Hide;
i32 sys_getsid(i32) _Hide;
i32 sys_gettid(void) _Hide;
i32 sys_ioctl(i32, u64, ...) _Hide;
i32 sys_ioctl_cp(i32, u64, ...) _Hide;
i32 sys_issetugid(void) _Hide;
i32 sys_kill(i32, i32, i32) _Hide;
@ -133,54 +131,18 @@ i64 sys_readlink(const char *, char *, u64) _Hide;
i64 sys_readlinkat(i32, const char *, char *, u64) _Hide;
i64 sys_sendfile(i32, i32, i64 *, u64) _Hide;
i64 sys_splice(i32, i64 *, i32, i64 *, u64, u32) _Hide;
i64 sys_write(i32, const void *, u64) _Hide;
u32 sys_getegid(void) _Hide;
u32 sys_geteuid(void) _Hide;
u32 sys_getgid(void) _Hide;
u32 sys_getuid(void) _Hide;
u32 sys_umask(u32) _Hide;
unsigned long _sysret(unsigned long) _Hide;
void *__sys_mmap(void *, u64, u32, u32, i64, i64, i64) _Hide;
void *__sys_mremap(void *, u64, u64, i32, void *) _Hide;
void *sys_mremap(void *, u64, u64, i32, void *) _Hide;
void sys_exit(i32) _Hide;
#ifdef __x86_64__
i64 sys_write(i32, const void *, u64) _Hide;
#elif defined(__aarch64__)
static inline ssize_t sys_write(int f, const void *b, size_t c) {
register long r0 asm("x0") = (long)f;
register long r1 asm("x1") = (long)b;
register long r2 asm("x2") = (long)c;
register long res_x0 asm("x0");
asm volatile("mov\tx8,%1\n\t"
"svc\t0"
: "=r"(res_x0)
: "i"(64), "r"(r0), "r"(r1), "r"(r2)
: "x8", "memory");
return _sysret64(res_x0);
}
#endif
#ifdef __x86_64__
i32 sys_ioctl(i32, u64, ...) _Hide;
#elif defined(__aarch64__)
static inline int sys_ioctl(int d, int r, ...) {
void *a;
va_list va;
va_start(va, r);
a = va_arg(va, void *);
va_end(va);
register long r0 asm("x0") = (long)d;
register long r1 asm("x1") = (long)r;
register long r2 asm("x2") = (long)a;
register long res_x0 asm("x0");
asm volatile("mov\tx8,%1\n\t"
"svc\t0"
: "=r"(res_x0)
: "i"(29), "r"(r0), "r"(r1), "r"(r2)
: "x8", "memory");
return _sysret32(res_x0);
}
#endif
#undef i32
#undef i64
#undef u32

View file

@ -48,6 +48,8 @@
#include "libc/sysv/errfuns.h"
#include "libc/thread/tls.h"
#ifdef __x86_64__
#define OFF(f) offsetof(struct seccomp_data, f)
#define UNVEIL_READ \
@ -400,3 +402,5 @@ int unveil(const char *path, const char *permissions) {
STRACE("unveil(%#s, %#s) → %d% m", path, permissions, rc);
return rc;
}
#endif /* __x86_64__ */

View file

@ -1,7 +1,7 @@
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
Copyright 2022 Justine Alexandra Roberts Tunney
Copyright 2023 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
@ -16,14 +16,9 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/macros.internal.h"
#include "libc/runtime/runtime.h"
#ifndef __x86_64__
.initbss 201,_init_nowl
nowl: .quad 0
.endobj nowl,globl
.previous
size_t __virtualmax = -1;
.init.start 201,_init_nowl
ezlea nowl_setup,ax
stosq
.init.end 201,_init_nowl
#endif /* __x86_64__ */

View file

@ -45,6 +45,8 @@
#include "libc/sysv/consts/w.h"
#include "libc/sysv/errfuns.h"
#ifdef __x86_64__
static textwindows int sys_wait4_nt_impl(int pid, int *opt_out_wstatus,
int options,
struct rusage *opt_out_rusage) {
@ -156,3 +158,5 @@ textwindows int sys_wait4_nt(int pid, int *opt_out_wstatus, int options,
__sig_mask(SIG_SETMASK, &oldmask, 0);
return rc;
}
#endif /* __x86_64__ */

View file

@ -34,6 +34,8 @@
#include "libc/thread/tls.h"
#include "libc/thread/tls2.h"
#ifdef __x86_64__
privileged unsigned __wincrash(struct NtExceptionPointers *ep) {
int64_t rip;
int sig, code;
@ -147,3 +149,5 @@ privileged unsigned __wincrash(struct NtExceptionPointers *ep) {
return kNtExceptionContinueExecution;
}
#endif /* __x86_64__ */

View file

@ -23,6 +23,8 @@
#include "libc/sysv/errfuns.h"
#include "libc/vga/vga.internal.h"
#ifdef __x86_64__
ssize_t sys_writev_metal(struct Fd *fd, const struct iovec *iov, int iovlen) {
switch (fd->kind) {
case kFdConsole:
@ -34,3 +36,5 @@ ssize_t sys_writev_metal(struct Fd *fd, const struct iovec *iov, int iovlen) {
return ebadf();
}
}
#endif /* __x86_64__ */

View file

@ -30,6 +30,7 @@
// @note ape.S and ape-loader both set RCX to XNU on Darwin
// @noreturn
_start:
#ifdef __x86_64__
#if SupportsXnu()
// Hack for detecting M1 Rosetta environment.
@ -63,9 +64,9 @@ _start:
mov %edx,4(%rbx)
// translates arguments from old stack abi
mov (%rsp),%ebx # argc
lea 8(%rsp),%rsi # argv
lea 16(%rsp,%rbx,8),%rdx # envp
mov (%rsp),%ebx // argc
lea 8(%rsp),%rsi // argv
lea 16(%rsp,%rbx,8),%rdx // envp
mov %rsp,__oldstack(%rip)
and $-16,%rsp
xor %ebp,%ebp
@ -87,19 +88,33 @@ _start:
or $-1,%ecx
mov %rdx,%rdi
repnz scasq
mov %rdi,%rcx # auxv
mov %rdi,%rcx // auxv
#if SupportsXnu()
// xnu doesn't have auxiliary values
testb IsXnu()
jz 1f # polyfill xnu auxv
push $0 # auxv[1][1]=0
push $0 # auxv[1][0]=0
mov %rsp,%rcx # auxv
jz 1f // polyfill xnu auxv
push $0 // auxv[1][1]=0
push $0 // auxv[1][0]=0
mov %rsp,%rcx // auxv
#endif
// enter cosmopolitan runtime
1: mov %ebx,%edi
call cosmo
9: .unreachable
////////////////////////////////////////////////////////////////////////////////
#elif defined(__aarch64__)
mov x29,#0
mov x30,#0
mov x0,sp
and sp,x0,#-16
b cosmo
////////////////////////////////////////////////////////////////////////////////
#else
#error "architecture unsupported"
#endif /* __x86_64__ */
.endfn _start,weak,hidden

View file

@ -26,5 +26,9 @@ CRT_SRCS = libc/crt/crt.S
CRT_OBJS = o/$(MODE)/libc/crt/crt.o
$(CRT_OBJS): $(BUILD_FILES) libc/crt/crt.mk
# these assembly files are safe to build on aarch64
o/$(MODE)/libc/crt/crt.o: libc/crt/crt.S
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
.PHONY: o/$(MODE)/libc/crt
o/$(MODE)/libc/crt: $(CRT)

View file

@ -5,11 +5,15 @@
*/
#ifndef SUPPORT_VECTOR
#ifdef __x86_64__
/**
* Supported Platforms Tuning Knob (Runtime & Compile-Time)
* Tuning this bitmask will remove platform polyfills at compile-time.
*/
#define SUPPORT_VECTOR 255
#else
#define SUPPORT_VECTOR _HOSTLINUX
#endif
#endif
#define _HOSTLINUX 1

View file

@ -68,6 +68,7 @@
#define EM_NONE 0
#define EM_M32 1
#define EM_386 3
#define EM_PPC64 21
#define EM_S390 22
#define EM_ARM 40
#define EM_NEXGEN32E 62

View file

@ -19,13 +19,9 @@
#include "libc/fmt/magnumstrs.internal.h"
#include "libc/intrin/describeflags.internal.h"
#ifdef DescribeClockName
#undef DescribeClockName
#endif
/**
* Describes clock_gettime() clock argument.
*/
const char *DescribeClockName(char buf[32], int x) {
const char *(DescribeClockName)(char buf[32], int x) {
return DescribeMagnum(buf, kClockNames, "CLOCK_", x);
}

View file

@ -21,10 +21,6 @@
#include "libc/nt/enum/processaccess.h"
#include "libc/sysv/consts/dn.h"
#ifdef DescribeDnotifyFlags
#undef DescribeDnotifyFlags
#endif
static const struct DescribeFlags kDnotifyFlags[] = {
{DN_ACCESS, "ACCESS"}, //
{DN_MODIFY, "MODIFY"}, //
@ -35,7 +31,7 @@ static const struct DescribeFlags kDnotifyFlags[] = {
{DN_MULTISHOT, "MULTISHOT"}, //
};
const char *DescribeDnotifyFlags(char buf[80], int x) {
const char *(DescribeDnotifyFlags)(char buf[80], int x) {
return DescribeFlags(buf, 80, kDnotifyFlags, ARRAYLEN(kDnotifyFlags), "DN_",
x);
}

View file

@ -20,11 +20,7 @@
#include "libc/intrin/describeflags.internal.h"
#include "libc/str/str.h"
#ifdef DescribeErrno
#undef DescribeErrno
#endif
const char *DescribeErrno(char buf[20], int ax) {
const char *(DescribeErrno)(char buf[20], int ax) {
char *p = buf;
const char *s;
if (ax < 0) {

View file

@ -19,11 +19,7 @@
#include "libc/fmt/itoa.h"
#include "libc/sysv/consts/f.h"
#ifdef DescribeFlockType
#undef DescribeFlockType
#endif
const char *DescribeFlockType(char buf[12], int x) {
const char *(DescribeFlockType)(char buf[12], int x) {
if (x == F_RDLCK) return "F_RDLCK";
if (x == F_WRLCK) return "F_WRLCK";
if (x == F_UNLCK) return "F_UNLCK";

View file

@ -21,11 +21,7 @@
#include "libc/str/str.h"
#include "libc/sysv/consts/futex.h"
#ifdef DescribeFutexOp
#undef DescribeFutexOp
#endif
const char *DescribeFutexOp(char buf[64], int x) {
const char *(DescribeFutexOp)(char buf[64], int x) {
bool priv = false;
if (x & FUTEX_PRIVATE_FLAG) {

View file

@ -22,11 +22,7 @@
#include "libc/sysv/consts/map.h"
#include "libc/sysv/consts/prot.h"
#ifdef DescribeMapFlags
#undef DescribeMapFlags
#endif
const char *DescribeMapFlags(char buf[64], int x) {
const char *(DescribeMapFlags)(char buf[64], int x) {
const struct DescribeFlags kMapFlags[] = {
{MAP_STACK, "STACK"}, // order matters
{MAP_PRIVATE, "PRIVATE"}, //

View file

@ -21,10 +21,6 @@
#include "libc/nt/enum/accessmask.h"
#include "libc/nt/enum/filesharemode.h"
#ifdef DescribeNtFileAccessFlags
#undef DescribeNtFileAccessFlags
#endif
static const struct DescribeFlags kFileAccessflags[] = {
{kNtFileAllAccess, "FileAllAccess"}, // order matters
{kNtFileGenericRead, "FileGenericRead"}, // order matters
@ -67,7 +63,7 @@ static const struct DescribeFlags kFileAccessflags[] = {
{kNtTokenAdjustSessionid, "TokenAdjustSessionid"}, //
};
const char *DescribeNtFileAccessFlags(char buf[512], uint32_t x) {
const char *(DescribeNtFileAccessFlags)(char buf[512], uint32_t x) {
return DescribeFlags(buf, 512, kFileAccessflags, ARRAYLEN(kFileAccessflags),
"kNt", x);
}

View file

@ -21,10 +21,6 @@
#include "libc/nt/enum/filemapflags.h"
#include "libc/nt/ipc.h"
#ifdef DescribeNtPipeModeFlags
#undef DescribeNtPipeModeFlags
#endif
static const struct DescribeFlags kPipeModeFlags[] = {
{kNtPipeNowait, "Nowait"}, // 0x0000000001
{kNtPipeReadmodeMessage, "ReadmodeMessage"}, // 0x0000000002
@ -36,7 +32,7 @@ static const struct DescribeFlags kPipeModeFlags[] = {
//{kNtPipeTypeByte, "TypeByte"}, // 0x00000000
};
const char *DescribeNtPipeModeFlags(char buf[64], uint32_t x) {
const char *(DescribeNtPipeModeFlags)(char buf[64], uint32_t x) {
return DescribeFlags(buf, 64, kPipeModeFlags, ARRAYLEN(kPipeModeFlags),
"kNtPipe", x);
}

View file

@ -23,16 +23,12 @@
#include "libc/macros.internal.h"
#include "libc/sysv/consts/sol.h"
#ifdef DescribeOpenFlags
#undef DescribeOpenFlags
#endif
#define N (PAGESIZE / 2 / sizeof(struct DescribeFlags))
/**
* Describes clock_gettime() clock argument.
*/
const char *DescribeOpenFlags(char buf[128], int x) {
const char *(DescribeOpenFlags)(char buf[128], int x) {
char *s;
int i, n;
struct DescribeFlags d[N];

View file

@ -21,14 +21,10 @@
#include "libc/intrin/describeflags.internal.h"
#include "libc/str/str.h"
#ifdef DescribeSchedParam
#undef DescribeSchedParam
#endif
/**
* Describes clock_gettime() clock argument.
*/
const char *DescribeSchedParam(char buf[32], const struct sched_param *x) {
const char *(DescribeSchedParam)(char buf[32], const struct sched_param *x) {
char *p;
if (!x) return "0";
p = buf;

View file

@ -26,15 +26,11 @@
#include "libc/str/str.h"
#include "libc/sysv/consts/sig.h"
#ifdef DescribeSiginfo
#undef DescribeSiginfo
#endif
#define N 300
#define append(...) i += ksnprintf(buf + i, N - i, __VA_ARGS__)
const char *DescribeSiginfo(char buf[N], int rc, const siginfo_t *si) {
const char *(DescribeSiginfo)(char buf[N], int rc, const siginfo_t *si) {
int i = 0;
if (rc == -1) return "n/a";

View file

@ -26,15 +26,11 @@
#include "libc/sysv/consts/limits.h"
#include "libc/sysv/consts/sig.h"
#ifdef DescribeSigset
#undef DescribeSigset
#endif
#define N 128
#define append(...) o += ksnprintf(buf + o, N - o, __VA_ARGS__)
const char *DescribeSigset(char buf[N], int rc, const sigset_t *ss) {
const char *(DescribeSigset)(char buf[N], int rc, const sigset_t *ss) {
bool gotsome;
const char *s;
int sig, o = 0;

View file

@ -21,14 +21,10 @@
#include "libc/intrin/describeflags.internal.h"
#include "libc/sysv/consts/timer.h"
#ifdef DescribeSleepFlags
#undef DescribeSleepFlags
#endif
/**
* Describes clock_nanosleep() flags argument.
*/
const char *DescribeSleepFlags(char buf[16], int x) {
const char *(DescribeSleepFlags)(char buf[16], int x) {
switch (x) {
case 0:
return "0";

View file

@ -22,15 +22,11 @@
#include "libc/intrin/asan.internal.h"
#include "libc/intrin/kprintf.h"
#ifdef DescribeStat
#undef DescribeStat
#endif
#define N 300
#define append(...) o += ksnprintf(buf + o, N - o, __VA_ARGS__)
const char *DescribeStat(char buf[N], int rc, const struct stat *st) {
const char *(DescribeStat)(char buf[N], int rc, const struct stat *st) {
int o = 0;
if (rc == -1) return "n/a";

View file

@ -20,11 +20,7 @@
#include "libc/fmt/itoa.h"
#include "libc/intrin/describeflags.internal.h"
#ifdef DescribeWhence
#undef DescribeWhence
#endif
const char *DescribeWhence(char buf[12], int whence) {
const char *(DescribeWhence)(char buf[12], int whence) {
if (whence == SEEK_SET) return "SEEK_SET";
if (whence == SEEK_CUR) return "SEEK_CUR";
if (whence == SEEK_END) return "SEEK_END";

View file

@ -20,11 +20,7 @@
#include "libc/intrin/describeflags.internal.h"
#include "libc/sysv/consts/prio.h"
#ifdef DescribeWhichPrio
#undef DescribeWhichPrio
#endif
const char *DescribeWhichPrio(char buf[12], int x) {
const char *(DescribeWhichPrio)(char buf[12], int x) {
if (x == PRIO_PROCESS) return "PRIO_PROCESS";
if (x == PRIO_PGRP) return "PRIO_PGRP";
if (x == PRIO_USER) return "PRIO_USER";

View file

@ -157,7 +157,7 @@ void *memset(void *p, int c, size_t n) {
} while (n);
}
return b;
#ifdef __x86_64__
#ifdef __x86__
} else if (IsTiny()) {
asm("rep stosb" : "+D"(b), "+c"(n), "=m"(*(char(*)[n])b) : "0"(p), "a"(c));
return p;

View file

@ -18,17 +18,13 @@
*/
#include "libc/intrin/psrad.h"
#ifdef psradv
#undef psradv
#endif
/**
* Divides shorts by two powers.
*
* @note arithmetic shift right will sign extend negatives
* @mayalias
*/
void psradv(int32_t a[4], const int32_t b[4], const uint64_t c[2]) {
void(psradv)(int32_t a[4], const int32_t b[4], const uint64_t c[2]) {
unsigned i;
unsigned char k;
k = c[0] > 31 ? 31 : c[0];

View file

@ -21,10 +21,6 @@
#include "libc/macros.internal.h"
#include "libc/str/str.h"
#ifdef psubusb
#undef psubusb
#endif
/**
* Subtracts unsigned 8-bit integers w/ saturation.
*
@ -33,7 +29,7 @@
* @param 𝑐 [r/o] supplies second input vector
* @mayalias
*/
void psubusb(uint8_t a[16], const uint8_t b[16], const uint8_t c[16]) {
void(psubusb)(uint8_t a[16], const uint8_t b[16], const uint8_t c[16]) {
unsigned i;
uint8_t r[16];
for (i = 0; i < 16; ++i) {

View file

@ -21,11 +21,7 @@
#include "libc/thread/thread.h"
#include "libc/thread/tls.h"
#ifdef pthread_cleanup_pop
#undef pthread_cleanup_pop
#endif
void pthread_cleanup_pop(struct _pthread_cleanup_buffer *cb, int execute) {
void(pthread_cleanup_pop)(struct _pthread_cleanup_buffer *cb, int execute) {
struct PosixThread *pt;
if (__tls_enabled && (pt = (struct PosixThread *)__get_tls()->tib_pthread)) {
_unassert(cb == pt->cleanup);

View file

@ -20,12 +20,8 @@
#include "libc/thread/thread.h"
#include "libc/thread/tls.h"
#ifdef pthread_cleanup_push
#undef pthread_cleanup_push
#endif
void pthread_cleanup_push(struct _pthread_cleanup_buffer *cb,
void (*routine)(void *), void *arg) {
void(pthread_cleanup_push)(struct _pthread_cleanup_buffer *cb,
void (*routine)(void *), void *arg) {
struct PosixThread *pt;
cb->__routine = routine;
cb->__arg = arg;

View file

@ -19,10 +19,6 @@
#include "libc/intrin/atomic.h"
#include "libc/thread/thread.h"
#ifdef pthread_spin_init
#undef pthread_spin_init
#endif
/**
* Initializes spin lock.
*
@ -32,7 +28,7 @@
* @see pthread_spin_destroy
* @see pthread_spin_lock
*/
errno_t pthread_spin_init(pthread_spinlock_t *spin, int pshared) {
errno_t(pthread_spin_init)(pthread_spinlock_t *spin, int pshared) {
atomic_store_explicit(&spin->_lock, 0, memory_order_relaxed);
return 0;
}

View file

@ -21,10 +21,6 @@
#include "libc/intrin/strace.internal.h"
#include "libc/thread/thread.h"
#ifdef pthread_spin_lock
#undef pthread_spin_lock
#endif
/**
* Acquires spin lock, e.g.
*
@ -43,7 +39,7 @@
* @see pthread_spin_unlock
* @see pthread_spin_init
*/
errno_t pthread_spin_lock(pthread_spinlock_t *spin) {
errno_t(pthread_spin_lock)(pthread_spinlock_t *spin) {
int x;
#if defined(SYSDEBUG) && _LOCKTRACE
for (;;) {

View file

@ -164,6 +164,17 @@
.previous
.endm
// Documents unreachable assembly code.
.macro .unreachable
#if !defined(NDEBUG) && defined(__x86_64__)
ud2 // crash if contract is broken
#elif !defined(NDEBUG) && defined(__aarch64__)
brk #1000
#elif defined(__FNO_OMIT_FRAME_POINTER__)
nop // avoid noreturn tail call backtrace ambiguity
#endif
.endm
#ifdef __x86_64__
#if __MNO_VZEROUPPER__ + 0
@ -447,15 +458,6 @@
#endif
.endm
// Documents unreachable assembly code.
.macro .unreachable
#ifndef NDEBUG
ud2 # crash if contract is broken
#elif defined(__FNO_OMIT_FRAME_POINTER__)
nop # avoid noreturn tail call backtrace ambiguity
#endif
.endm
// Inserts profiling hook in prologue if cc wants it.
//
// Cosmopolitan does this in a slightly different way from normal

View file

@ -1,7 +1,7 @@
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
Copyright 2022 Justine Alexandra Roberts Tunney
Copyright 2023 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
@ -16,15 +16,9 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/macros.internal.h"
#include "libc/runtime/runtime.h"
#ifndef __x86_64__
.initbss 301,_init___gettimeofday
__gettimeofday:
.quad 0
.endobj __gettimeofday,globl,hidden
.previous
int __argc;
.init.start 301,_init___gettimeofday
ezlea __gettimeofday_init,ax
stosq
.init.end 301,_init___gettimeofday
#endif /* __x86_64__ */

View file

@ -1,7 +1,7 @@
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
Copyright 2022 Justine Alexandra Roberts Tunney
Copyright 2023 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
@ -16,15 +16,9 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/macros.internal.h"
#include "libc/runtime/runtime.h"
#ifndef __x86_64__
.initbss 301,_init___clock_gettime
__clock_gettime:
.quad 0
.endobj __clock_gettime,globl,hidden
.previous
char **__argv;
.init.start 301,_init___clock_gettime
ezlea __clock_gettime_init,ax
stosq
.init.end 301,_init___clock_gettime
#endif /* __x86_64__ */

View file

@ -17,7 +17,8 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/runtime/runtime.h"
#ifndef __x86_64__
#ifdef __aarch64__
char **environ;
#endif
#endif /* __x86_64__ */

24
libc/nexgen32e/envp2.c Normal file
View file

@ -0,0 +1,24 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
Copyright 2023 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/runtime/runtime.h"
#ifndef __x86_64__
char **__envp;
#endif /* __x86_64__ */

View file

@ -0,0 +1,21 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
Copyright 2023 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/runtime/runtime.h"
char *program_invocation_name;

View file

@ -39,7 +39,6 @@ setjmp:
mov (%rsp),%rax
mov %rax,56(%rdi)
xor %eax,%eax
ret
#elif defined(__aarch64__)
stp x19,x20,[x0,#0]
stp x21,x22,[x0,#16]
@ -54,7 +53,7 @@ setjmp:
stp d12,d13,[x0,#144]
stp d14,d15,[x0,#160]
mov x0,#0
ret
#endif
ret
.endfn setjmp,globl
.alias setjmp,_setjmp

View file

@ -1,14 +1,17 @@
#include "libc/nt/codegen.h"
.imp API-MS-Win-Core-Synch-l1-2-0,__imp_WaitOnAddress,WaitOnAddress,111
#ifdef __x86_64__
.text.windows
WaitOnAddress:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_WaitOnAddress(%rip),%rax
jmp __sysv2nt
#elif defined(__aarch64__)
mov x0,#0
ret
#endif
.endfn WaitOnAddress,globl
.previous
#endif

View file

@ -1,9 +1,9 @@
#include "libc/nt/codegen.h"
.imp API-MS-Win-Core-Synch-l1-2-0,__imp_WakeByAddressAll,WakeByAddressAll,113
#ifdef __x86_64__
.text.windows
WakeByAddressAll:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
.profilable
@ -11,7 +11,9 @@ WakeByAddressAll:
sub $32,%rsp
call *__imp_WakeByAddressAll(%rip)
leave
#elif defined(__aarch64__)
mov x0,#0
#endif
ret
.endfn WakeByAddressAll,globl
.previous
#endif

View file

@ -1,9 +1,9 @@
#include "libc/nt/codegen.h"
.imp API-MS-Win-Core-Synch-l1-2-0,__imp_WakeByAddressSingle,WakeByAddressSingle,116
#ifdef __x86_64__
.text.windows
WakeByAddressSingle:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
.profilable
@ -11,7 +11,9 @@ WakeByAddressSingle:
sub $32,%rsp
call *__imp_WakeByAddressSingle(%rip)
leave
#elif defined(__aarch64__)
mov x0,#0
#endif
ret
.endfn WakeByAddressSingle,globl
.previous
#endif

View file

@ -1,14 +1,17 @@
#include "libc/nt/codegen.h"
.imp MsWSock,__imp_AcceptEx,AcceptEx,0
#ifdef __x86_64__
.text.windows
AcceptEx:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_AcceptEx(%rip),%rax
jmp __sysv2nt8
#elif defined(__aarch64__)
mov x0,#0
ret
#endif
.endfn AcceptEx,globl
.previous
#endif

View file

@ -1,14 +1,17 @@
#include "libc/nt/codegen.h"
.imp MsWSock,__imp_DisconnectEx,DisconnectEx,0
#ifdef __x86_64__
.text.windows
DisconnectEx:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_DisconnectEx(%rip),%rax
jmp __sysv2nt
#elif defined(__aarch64__)
mov x0,#0
ret
#endif
.endfn DisconnectEx,globl
.previous
#endif

View file

@ -1,14 +1,17 @@
#include "libc/nt/codegen.h"
.imp MsWSock,__imp_GetAcceptExSockaddrs,GetAcceptExSockaddrs,0
#ifdef __x86_64__
.text.windows
GetAcceptExSockaddrs:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_GetAcceptExSockaddrs(%rip),%rax
jmp __sysv2nt8
#elif defined(__aarch64__)
mov x0,#0
ret
#endif
.endfn GetAcceptExSockaddrs,globl
.previous
#endif

View file

@ -1,14 +1,17 @@
#include "libc/nt/codegen.h"
.imp MsWSock,__imp_TransmitFile,TransmitFile,0
#ifdef __x86_64__
.text.windows
TransmitFile:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_TransmitFile(%rip),%rax
jmp __sysv2nt8
#elif defined(__aarch64__)
mov x0,#0
ret
#endif
.endfn TransmitFile,globl
.previous
#endif

View file

@ -1,14 +1,17 @@
#include "libc/nt/codegen.h"
.imp MsWSock,__imp_WSARecvEx,WSARecvEx,0
#ifdef __x86_64__
.text.windows
WSARecvEx:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_WSARecvEx(%rip),%rax
jmp __sysv2nt
#elif defined(__aarch64__)
mov x0,#0
ret
#endif
.endfn WSARecvEx,globl
.previous
#endif

View file

@ -1,14 +1,17 @@
#include "libc/nt/codegen.h"
.imp PowrProf,__imp_SetSuspendState,SetSuspendState,0
#ifdef __x86_64__
.text.windows
SetSuspendState:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_SetSuspendState(%rip),%rax
jmp __sysv2nt
#elif defined(__aarch64__)
mov x0,#0
ret
#endif
.endfn SetSuspendState,globl
.previous
#endif

View file

@ -1,14 +1,17 @@
#include "libc/nt/codegen.h"
.imp advapi32,__imp_AccessCheck,AccessCheck,0
#ifdef __x86_64__
.text.windows
AccessCheck:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_AccessCheck(%rip),%rax
jmp __sysv2nt8
#elif defined(__aarch64__)
mov x0,#0
ret
#endif
.endfn AccessCheck,globl
.previous
#endif

View file

@ -1,14 +1,17 @@
#include "libc/nt/codegen.h"
.imp advapi32,__imp_AdjustTokenPrivileges,AdjustTokenPrivileges,0
#ifdef __x86_64__
.text.windows
AdjustTokenPrivileges:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_AdjustTokenPrivileges(%rip),%rax
jmp __sysv2nt6
#elif defined(__aarch64__)
mov x0,#0
ret
#endif
.endfn AdjustTokenPrivileges,globl
.previous
#endif

View file

@ -1,14 +1,17 @@
#include "libc/nt/codegen.h"
.imp advapi32,__imp_CreateProcessAsUserW,CreateProcessAsUserW,0
#ifdef __x86_64__
.text.windows
CreateProcessAsUser:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_CreateProcessAsUserW(%rip),%rax
jmp __sysv2nt12
#elif defined(__aarch64__)
mov x0,#0
ret
#endif
.endfn CreateProcessAsUser,globl
.previous
#endif

View file

@ -1,9 +1,9 @@
#include "libc/nt/codegen.h"
.imp advapi32,__imp_DeregisterEventSource,DeregisterEventSource,1239
#ifdef __x86_64__
.text.windows
DeregisterEventSource:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
.profilable
@ -11,7 +11,9 @@ DeregisterEventSource:
sub $32,%rsp
call *__imp_DeregisterEventSource(%rip)
leave
#elif defined(__aarch64__)
mov x0,#0
#endif
ret
.endfn DeregisterEventSource,globl
.previous
#endif

View file

@ -1,14 +1,17 @@
#include "libc/nt/codegen.h"
.imp advapi32,__imp_DuplicateToken,DuplicateToken,0
#ifdef __x86_64__
.text.windows
DuplicateToken:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_DuplicateToken(%rip),%rax
jmp __sysv2nt
#elif defined(__aarch64__)
mov x0,#0
ret
#endif
.endfn DuplicateToken,globl
.previous
#endif

View file

@ -1,14 +1,17 @@
#include "libc/nt/codegen.h"
.imp advapi32,__imp_DuplicateTokenEx,DuplicateTokenEx,0
#ifdef __x86_64__
.text.windows
DuplicateTokenEx:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_DuplicateTokenEx(%rip),%rax
jmp __sysv2nt6
#elif defined(__aarch64__)
mov x0,#0
ret
#endif
.endfn DuplicateTokenEx,globl
.previous
#endif

View file

@ -1,14 +1,17 @@
#include "libc/nt/codegen.h"
.imp advapi32,__imp_GetFileSecurityW,GetFileSecurityW,0
#ifdef __x86_64__
.text.windows
GetFileSecurity:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_GetFileSecurityW(%rip),%rax
jmp __sysv2nt6
#elif defined(__aarch64__)
mov x0,#0
ret
#endif
.endfn GetFileSecurity,globl
.previous
#endif

View file

@ -1,14 +1,17 @@
#include "libc/nt/codegen.h"
.imp advapi32,__imp_GetUserNameW,GetUserNameW,1381
#ifdef __x86_64__
.text.windows
GetUserName:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_GetUserNameW(%rip),%rax
jmp __sysv2nt
#elif defined(__aarch64__)
mov x0,#0
ret
#endif
.endfn GetUserName,globl
.previous
#endif

View file

@ -1,9 +1,9 @@
#include "libc/nt/codegen.h"
.imp advapi32,__imp_ImpersonateSelf,ImpersonateSelf,0
#ifdef __x86_64__
.text.windows
ImpersonateSelf:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
.profilable
@ -11,7 +11,9 @@ ImpersonateSelf:
sub $32,%rsp
call *__imp_ImpersonateSelf(%rip)
leave
#elif defined(__aarch64__)
mov x0,#0
#endif
ret
.endfn ImpersonateSelf,globl
.previous
#endif

View file

@ -1,14 +1,17 @@
#include "libc/nt/codegen.h"
.imp advapi32,__imp_InitiateShutdownW,InitiateShutdownW,1403
#ifdef __x86_64__
.text.windows
InitiateShutdown:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_InitiateShutdownW(%rip),%rax
jmp __sysv2nt6
#elif defined(__aarch64__)
mov x0,#0
ret
#endif
.endfn InitiateShutdown,globl
.previous
#endif

View file

@ -1,14 +1,17 @@
#include "libc/nt/codegen.h"
.imp advapi32,__imp_LookupPrivilegeValueW,LookupPrivilegeValueW,1432
#ifdef __x86_64__
.text.windows
LookupPrivilegeValue:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_LookupPrivilegeValueW(%rip),%rax
jmp __sysv2nt
#elif defined(__aarch64__)
mov x0,#0
ret
#endif
.endfn LookupPrivilegeValue,globl
.previous
#endif

View file

@ -1,14 +1,17 @@
#include "libc/nt/codegen.h"
.imp advapi32,__imp_MapGenericMask,MapGenericMask,0
#ifdef __x86_64__
.text.windows
MapGenericMask:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_MapGenericMask(%rip),%rax
jmp __sysv2nt
#elif defined(__aarch64__)
mov x0,#0
ret
#endif
.endfn MapGenericMask,globl
.previous
#endif

View file

@ -1,14 +1,17 @@
#include "libc/nt/codegen.h"
.imp advapi32,__imp_OpenProcessToken,OpenProcessToken,0
#ifdef __x86_64__
.text.windows
OpenProcessToken:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_OpenProcessToken(%rip),%rax
jmp __sysv2nt
#elif defined(__aarch64__)
mov x0,#0
ret
#endif
.endfn OpenProcessToken,globl
.previous
#endif

View file

@ -1,14 +1,17 @@
#include "libc/nt/codegen.h"
.imp advapi32,__imp_OpenThreadToken,OpenThreadToken,0
#ifdef __x86_64__
.text.windows
OpenThreadToken:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_OpenThreadToken(%rip),%rax
jmp __sysv2nt
#elif defined(__aarch64__)
mov x0,#0
ret
#endif
.endfn OpenThreadToken,globl
.previous
#endif

View file

@ -1,9 +1,9 @@
#include "libc/nt/codegen.h"
.imp advapi32,__imp_RegCloseKey,RegCloseKey,0
#ifdef __x86_64__
.text.windows
RegCloseKey:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
.profilable
@ -11,7 +11,9 @@ RegCloseKey:
sub $32,%rsp
call *__imp_RegCloseKey(%rip)
leave
#elif defined(__aarch64__)
mov x0,#0
#endif
ret
.endfn RegCloseKey,globl
.previous
#endif

View file

@ -1,14 +1,17 @@
#include "libc/nt/codegen.h"
.imp advapi32,__imp_RegConnectRegistryW,RegConnectRegistryW,1608
#ifdef __x86_64__
.text.windows
RegConnectRegistry:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_RegConnectRegistryW(%rip),%rax
jmp __sysv2nt
#elif defined(__aarch64__)
mov x0,#0
ret
#endif
.endfn RegConnectRegistry,globl
.previous
#endif

View file

@ -1,14 +1,17 @@
#include "libc/nt/codegen.h"
.imp advapi32,__imp_RegCreateKeyExW,RegCreateKeyExW,0
#ifdef __x86_64__
.text.windows
RegCreateKeyEx:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_RegCreateKeyExW(%rip),%rax
jmp __sysv2nt10
#elif defined(__aarch64__)
mov x0,#0
ret
#endif
.endfn RegCreateKeyEx,globl
.previous
#endif

View file

@ -1,14 +1,17 @@
#include "libc/nt/codegen.h"
.imp advapi32,__imp_RegCreateKeyW,RegCreateKeyW,1616
#ifdef __x86_64__
.text.windows
RegCreateKey:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_RegCreateKeyW(%rip),%rax
jmp __sysv2nt
#elif defined(__aarch64__)
mov x0,#0
ret
#endif
.endfn RegCreateKey,globl
.previous
#endif

View file

@ -1,14 +1,17 @@
#include "libc/nt/codegen.h"
.imp advapi32,__imp_RegDeleteKeyExW,RegDeleteKeyExW,0
#ifdef __x86_64__
.text.windows
RegDeleteKeyEx:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_RegDeleteKeyExW(%rip),%rax
jmp __sysv2nt
#elif defined(__aarch64__)
mov x0,#0
ret
#endif
.endfn RegDeleteKeyEx,globl
.previous
#endif

View file

@ -1,14 +1,17 @@
#include "libc/nt/codegen.h"
.imp advapi32,__imp_RegDeleteKeyW,RegDeleteKeyW,1624
#ifdef __x86_64__
.text.windows
RegDeleteKey:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_RegDeleteKeyW(%rip),%rax
jmp __sysv2nt
#elif defined(__aarch64__)
mov x0,#0
ret
#endif
.endfn RegDeleteKey,globl
.previous
#endif

View file

@ -1,14 +1,17 @@
#include "libc/nt/codegen.h"
.imp advapi32,__imp_RegDeleteTreeW,RegDeleteTreeW,0
#ifdef __x86_64__
.text.windows
RegDeleteTree:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_RegDeleteTreeW(%rip),%rax
jmp __sysv2nt
#elif defined(__aarch64__)
mov x0,#0
ret
#endif
.endfn RegDeleteTree,globl
.previous
#endif

View file

@ -1,14 +1,17 @@
#include "libc/nt/codegen.h"
.imp advapi32,__imp_RegDeleteValueW,RegDeleteValueW,0
#ifdef __x86_64__
.text.windows
RegDeleteValue:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_RegDeleteValueW(%rip),%rax
jmp __sysv2nt
#elif defined(__aarch64__)
mov x0,#0
ret
#endif
.endfn RegDeleteValue,globl
.previous
#endif

View file

@ -1,9 +1,9 @@
#include "libc/nt/codegen.h"
.imp advapi32,__imp_RegDisablePredefinedCache,RegDisablePredefinedCache,1629
#ifdef __x86_64__
.text.windows
RegDisablePredefinedCache:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
.profilable
@ -11,7 +11,9 @@ RegDisablePredefinedCache:
sub $32,%rsp
call *__imp_RegDisablePredefinedCache(%rip)
leave
#elif defined(__aarch64__)
mov x0,#0
#endif
ret
.endfn RegDisablePredefinedCache,globl
.previous
#endif

View file

@ -1,9 +1,9 @@
#include "libc/nt/codegen.h"
.imp advapi32,__imp_RegDisableReflectionKey,RegDisableReflectionKey,1631
#ifdef __x86_64__
.text.windows
RegDisableReflectionKey:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
.profilable
@ -11,7 +11,9 @@ RegDisableReflectionKey:
sub $32,%rsp
call *__imp_RegDisableReflectionKey(%rip)
leave
#elif defined(__aarch64__)
mov x0,#0
#endif
ret
.endfn RegDisableReflectionKey,globl
.previous
#endif

View file

@ -1,9 +1,9 @@
#include "libc/nt/codegen.h"
.imp advapi32,__imp_RegEnableReflectionKey,RegEnableReflectionKey,1632
#ifdef __x86_64__
.text.windows
RegEnableReflectionKey:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
.profilable
@ -11,7 +11,9 @@ RegEnableReflectionKey:
sub $32,%rsp
call *__imp_RegEnableReflectionKey(%rip)
leave
#elif defined(__aarch64__)
mov x0,#0
#endif
ret
.endfn RegEnableReflectionKey,globl
.previous
#endif

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