mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-08 20:28:30 +00:00
Get LIBC_RUNTIME and LIBC_CALLS building on aarch64
This commit is contained in:
parent
7e46645193
commit
e5e3cdf447
1200 changed files with 5341 additions and 3677 deletions
|
@ -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,6 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/calls/clock_gettime.internal.h"
|
||||
|
||||
.initbss 301,_init___gettimeofday
|
||||
__gettimeofday:
|
||||
.quad 0
|
||||
.endobj __gettimeofday,globl,hidden
|
||||
.previous
|
||||
|
||||
.init.start 301,_init___gettimeofday
|
||||
ezlea __gettimeofday_init,ax
|
||||
stosq
|
||||
.init.end 301,_init___gettimeofday
|
||||
clock_gettime_f *__clock_gettime = __clock_gettime_init;
|
|
@ -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))))
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -112,3 +112,5 @@ long double nowl_setup(void) {
|
|||
}
|
||||
return nowl();
|
||||
}
|
||||
|
||||
long double (*nowl)(void) = nowl_setup;
|
||||
|
|
|
@ -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__ */
|
||||
|
|
|
@ -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__ */
|
||||
|
|
|
@ -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__ */
|
||||
|
|
|
@ -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__ */
|
||||
|
|
|
@ -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__ */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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,19 @@
|
|||
│ 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"
|
||||
#include "libc/str/str.h"
|
||||
|
||||
.initbss 301,_init___clock_gettime
|
||||
__clock_gettime:
|
||||
.quad 0
|
||||
.endobj __clock_gettime,globl,hidden
|
||||
.previous
|
||||
char *program_invocation_short_name;
|
||||
|
||||
.init.start 301,_init___clock_gettime
|
||||
ezlea __clock_gettime_init,ax
|
||||
stosq
|
||||
.init.end 301,_init___clock_gettime
|
||||
__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;
|
||||
}
|
|
@ -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__ */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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__ */
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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__ */
|
||||
|
|
|
@ -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__ */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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__ */
|
||||
|
|
|
@ -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__ */
|
|
@ -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__ */
|
||||
|
|
|
@ -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__ */
|
||||
|
|
|
@ -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__ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue