mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-01 00:38:31 +00:00
Improve dead code elimination
This commit is contained in:
parent
760db8c5ad
commit
0e36cb3ac4
6606 changed files with 9685 additions and 9854 deletions
|
@ -1,6 +1,5 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_BITS_EMMINTRIN_H_
|
||||
#define COSMOPOLITAN_LIBC_BITS_EMMINTRIN_H_
|
||||
#include "libc/bits/progn.internal.h"
|
||||
#include "libc/bits/xmmintrin.internal.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
|
||||
|
@ -170,13 +169,25 @@ struct thatispacked mayalias __usi128ma {
|
|||
})
|
||||
|
||||
#define _mm_add_sd(M128D_0, M128D_1) \
|
||||
PROGN((M128D_0)[0] += (M128D_1)[0], (M128D_0))
|
||||
({ \
|
||||
(M128D_0)[0] += (M128D_1)[0]; \
|
||||
(M128D_0); \
|
||||
})
|
||||
#define _mm_sub_sd(M128D_0, M128D_1) \
|
||||
PROGN((M128D_0)[0] -= (M128D_1)[0], (M128D_0))
|
||||
({ \
|
||||
(M128D_0)[0] -= (M128D_1)[0]; \
|
||||
(M128D_0); \
|
||||
})
|
||||
#define _mm_mul_sd(M128D_0, M128D_1) \
|
||||
PROGN((M128D_0)[0] *= (M128D_1)[0], (M128D_0))
|
||||
({ \
|
||||
(M128D_0)[0] *= (M128D_1)[0]; \
|
||||
(M128D_0); \
|
||||
})
|
||||
#define _mm_div_sd(M128D_0, M128D_1) \
|
||||
PROGN((M128D_0)[0] /= (M128D_1)[0], (M128D_0))
|
||||
({ \
|
||||
(M128D_0)[0] /= (M128D_1)[0]; \
|
||||
(M128D_0); \
|
||||
})
|
||||
|
||||
#define _mm_min_sd(M128D_0, M128D_1) \
|
||||
__builtin_ia32_minsd((__v2df)(M128D_0), (__v2df)(M128D_1))
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_BITS_PROGN_H_
|
||||
#define COSMOPOLITAN_LIBC_BITS_PROGN_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
/**
|
||||
* Evaluates args, returning value of last one.
|
||||
*
|
||||
* This API comes from LISP.
|
||||
*/
|
||||
#define PROGN(...) ({ __VA_ARGS__; })
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_BITS_PROGN_H_ */
|
|
@ -1,7 +1,6 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_BITS_XMMINTRIN_H_
|
||||
#define COSMOPOLITAN_LIBC_BITS_XMMINTRIN_H_
|
||||
#include "libc/bits/emmintrin.internal.h"
|
||||
#include "libc/bits/progn.internal.h"
|
||||
#include "libc/dce.h"
|
||||
|
||||
#define _MM_EXCEPT_MASK 0x003f
|
||||
|
|
|
@ -39,21 +39,23 @@ int close(int fd) {
|
|||
if (fd < 0) return einval();
|
||||
if (fd < g_fds.n && g_fds.p[fd].kind == kFdZip) {
|
||||
rc = weaken(__zipos_close)(fd);
|
||||
} else if (fd < g_fds.n && g_fds.p[fd].kind == kFdEpoll) {
|
||||
rc = weaken(sys_close_epoll)(fd);
|
||||
} else if (!IsWindows()) {
|
||||
rc = sys_close(fd);
|
||||
} else if (fd < g_fds.n && g_fds.p[fd].kind == kFdSocket) {
|
||||
rc = weaken(sys_closesocket_nt)(g_fds.p + fd);
|
||||
} else if (fd < g_fds.n &&
|
||||
(g_fds.p[fd].kind == kFdFile || g_fds.p[fd].kind == kFdConsole ||
|
||||
g_fds.p[fd].kind == kFdProcess)) {
|
||||
rc = sys_close_nt(g_fds.p + fd);
|
||||
} else {
|
||||
rc = ebadf();
|
||||
}
|
||||
if (!__vforked && fd < g_fds.n) {
|
||||
__releasefd(fd);
|
||||
if (!IsWindows()) {
|
||||
rc = sys_close(fd);
|
||||
} else {
|
||||
if (fd < g_fds.n && g_fds.p[fd].kind == kFdEpoll) {
|
||||
rc = weaken(sys_close_epoll_nt)(fd);
|
||||
} else if (fd < g_fds.n && g_fds.p[fd].kind == kFdSocket) {
|
||||
rc = weaken(sys_closesocket_nt)(g_fds.p + fd);
|
||||
} else if (fd < g_fds.n && (g_fds.p[fd].kind == kFdFile ||
|
||||
g_fds.p[fd].kind == kFdConsole ||
|
||||
g_fds.p[fd].kind == kFdProcess)) {
|
||||
rc = sys_close_nt(g_fds.p + fd);
|
||||
} else {
|
||||
rc = ebadf();
|
||||
}
|
||||
}
|
||||
}
|
||||
__releasefd(fd);
|
||||
return rc;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/bits/progn.internal.h"
|
||||
#include "libc/bits/safemacros.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
|
@ -74,8 +73,14 @@ char *commandv(const char *name, char pathbuf[hasatleast PATH_MAX]) {
|
|||
char *p;
|
||||
size_t namelen;
|
||||
int rc, olderr;
|
||||
if (!(namelen = strlen(name))) return PROGN(enoent(), NULL);
|
||||
if (namelen + 1 > PATH_MAX) return PROGN(enametoolong(), NULL);
|
||||
if (!(namelen = strlen(name))) {
|
||||
enoent();
|
||||
return NULL;
|
||||
}
|
||||
if (namelen + 1 > PATH_MAX) {
|
||||
enametoolong();
|
||||
return NULL;
|
||||
}
|
||||
if (strchr(name, '/') || strchr(name, '\\')) {
|
||||
if (AccessCommand(strcpy(pathbuf, ""), name, namelen, 0)) {
|
||||
return pathbuf;
|
||||
|
|
|
@ -50,7 +50,7 @@ int fallocate(int fd, int32_t mode, int64_t offset, int64_t length) {
|
|||
return rc;
|
||||
} else if (!IsWindows()) {
|
||||
return sys_posix_fallocate(fd, offset, length);
|
||||
} else if (IsWindows()) {
|
||||
} else {
|
||||
if (!__isfdkind(fd, kFdFile)) return ebadf();
|
||||
if (mode == FALLOC_FL_ZERO_RANGE) {
|
||||
if (DeviceIoControl(
|
||||
|
@ -70,7 +70,5 @@ int fallocate(int fd, int32_t mode, int64_t offset, int64_t length) {
|
|||
} else {
|
||||
return enosys();
|
||||
}
|
||||
} else {
|
||||
return enosys();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,12 +31,10 @@ int fstat(int fd, struct stat *st) {
|
|||
if (__isfdkind(fd, kFdZip)) {
|
||||
return weaken(__zipos_fstat)(
|
||||
(struct ZiposHandle *)(intptr_t)g_fds.p[fd].handle, st);
|
||||
} else if (!IsWindows()) {
|
||||
if (!IsMetal()) {
|
||||
return sys_fstat(fd, st);
|
||||
} else {
|
||||
return fstat_metal(fd, st);
|
||||
}
|
||||
} else if (!IsWindows() && !IsMetal()) {
|
||||
return sys_fstat(fd, st);
|
||||
} else if (IsMetal()) {
|
||||
return fstat_metal(fd, st);
|
||||
} else {
|
||||
if (!__isfdkind(fd, kFdFile)) return ebadf();
|
||||
return sys_fstat_nt(g_fds.p[fd].handle, st);
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/bits/initializer.internal.h"
|
||||
#include "libc/bits/pushpop.h"
|
||||
#include "libc/calls/internal.h"
|
||||
#include "libc/nt/runtime.h"
|
||||
|
@ -26,13 +25,21 @@ STATIC_YOINK("_init_g_fds");
|
|||
|
||||
hidden struct Fds g_fds;
|
||||
|
||||
hidden void InitializeFileDescriptors(void) {
|
||||
hidden textstartup void InitializeFileDescriptors(void) {
|
||||
struct Fds *fds;
|
||||
fds = VEIL("r", &g_fds);
|
||||
pushmov(&fds->f, 3ul);
|
||||
pushmov(&fds->n, ARRAYLEN(fds->__init_p));
|
||||
fds->p = fds->__init_p;
|
||||
if (!IsMetal()) {
|
||||
if (IsMetal()) {
|
||||
pushmov(&fds->f, 3ull);
|
||||
fds->__init_p[STDIN_FILENO].kind = pushpop(kFdSerial);
|
||||
fds->__init_p[STDOUT_FILENO].kind = pushpop(kFdSerial);
|
||||
fds->__init_p[STDERR_FILENO].kind = pushpop(kFdSerial);
|
||||
fds->__init_p[STDIN_FILENO].handle = VEIL("r", 0x3F8ull);
|
||||
fds->__init_p[STDOUT_FILENO].handle = VEIL("r", 0x3F8ull);
|
||||
fds->__init_p[STDERR_FILENO].handle = VEIL("r", 0x3F8ull);
|
||||
} else if (IsWindows()) {
|
||||
pushmov(&fds->f, 3ull);
|
||||
fds->__init_p[STDIN_FILENO].kind = pushpop(kFdFile);
|
||||
fds->__init_p[STDOUT_FILENO].kind = pushpop(kFdFile);
|
||||
fds->__init_p[STDERR_FILENO].kind = pushpop(kFdFile);
|
||||
|
@ -42,12 +49,5 @@ hidden void InitializeFileDescriptors(void) {
|
|||
GetStdHandle(pushpop(kNtStdOutputHandle));
|
||||
fds->__init_p[STDERR_FILENO].handle =
|
||||
GetStdHandle(pushpop(kNtStdErrorHandle));
|
||||
} else {
|
||||
fds->__init_p[STDIN_FILENO].kind = pushpop(kFdSerial);
|
||||
fds->__init_p[STDOUT_FILENO].kind = pushpop(kFdSerial);
|
||||
fds->__init_p[STDERR_FILENO].kind = pushpop(kFdSerial);
|
||||
fds->__init_p[STDIN_FILENO].handle = 0x3F8;
|
||||
fds->__init_p[STDOUT_FILENO].handle = 0x3F8;
|
||||
fds->__init_p[STDERR_FILENO].handle = 0x3F8;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
/*-*- 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 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/calls/internal.h"
|
||||
#include "libc/nt/startupinfo.h"
|
||||
#include "libc/nt/struct/startupinfo.h"
|
||||
|
||||
hidden struct NtStartupInfo __nt_startupinfo;
|
||||
|
||||
STATIC_YOINK("_init___nt_startupinfo");
|
|
@ -1,26 +0,0 @@
|
|||
/*-*- 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│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ 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.h"
|
||||
.source __FILE__
|
||||
|
||||
.init.start 400,_init___nt_startupinfo
|
||||
ezlea __nt_startupinfo,cx
|
||||
mov %rsp,%rbp
|
||||
ntcall __imp_GetStartupInfoW
|
||||
.init.end 400,_init___nt_startupinfo,globl,hidden
|
|
@ -1,25 +0,0 @@
|
|||
/*-*- 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 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/calls/internal.h"
|
||||
#include "libc/nt/struct/systeminfo.h"
|
||||
#include "libc/nt/systeminfo.h"
|
||||
|
||||
hidden struct NtSystemInfo __nt_systeminfo;
|
||||
|
||||
STATIC_YOINK("_init___nt_systeminfo");
|
|
@ -1,26 +0,0 @@
|
|||
/*-*- 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│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ 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.h"
|
||||
.source __FILE__
|
||||
|
||||
.init.start 400,_init___nt_systeminfo
|
||||
ezlea __nt_systeminfo,cx
|
||||
mov %rsp,%rbp
|
||||
ntcall __imp_GetSystemInfo
|
||||
.init.end 400,_init___nt_systeminfo,globl,hidden
|
|
@ -47,10 +47,10 @@ enum FdKind {
|
|||
};
|
||||
|
||||
struct Fd {
|
||||
enum FdKind kind;
|
||||
unsigned flags;
|
||||
int64_t handle;
|
||||
int64_t extra;
|
||||
int kind;
|
||||
unsigned flags;
|
||||
};
|
||||
|
||||
struct Fds {
|
||||
|
@ -66,8 +66,6 @@ hidden extern volatile bool __interrupted;
|
|||
hidden extern int __vforked;
|
||||
hidden extern unsigned __sighandrvas[NSIG];
|
||||
hidden extern struct Fds g_fds;
|
||||
hidden extern struct NtSystemInfo __nt_systeminfo;
|
||||
hidden extern struct NtStartupInfo __nt_startupinfo;
|
||||
hidden extern const struct NtSecurityAttributes kNtIsInheritable;
|
||||
|
||||
int __reservefd(void) hidden;
|
||||
|
@ -232,6 +230,7 @@ bool32 sys_isatty_nt(int) hidden;
|
|||
char *sys_getcwd_nt(char *, size_t) hidden;
|
||||
i64 sys_lseek_nt(int, i64, int) hidden;
|
||||
int sys_chdir_nt(const char *) hidden;
|
||||
int sys_close_epoll_nt(int) hidden;
|
||||
int sys_close_nt(struct Fd *) hidden;
|
||||
int sys_dup_nt(int, int, int) hidden;
|
||||
int sys_execve_nt(const char *, char *const[], char *const[]) hidden;
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "libc/calls/struct/winsize.h"
|
||||
#include "libc/nt/console.h"
|
||||
#include "libc/nt/enum/startf.h"
|
||||
#include "libc/nt/startupinfo.h"
|
||||
#include "libc/nt/struct/consolescreenbufferinfoex.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/errfuns.h"
|
||||
|
@ -29,8 +30,10 @@
|
|||
textwindows int ioctl_tiocgwinsz_nt(int fd, struct winsize *ws) {
|
||||
int i, fds[3];
|
||||
uint32_t mode;
|
||||
struct NtStartupInfo startinfo;
|
||||
struct NtConsoleScreenBufferInfoEx sbinfo;
|
||||
fds[0] = fd, fds[1] = 1, fds[2] = 0;
|
||||
GetStartupInfo(&startinfo);
|
||||
for (i = 0; i < ARRAYLEN(fds); ++i) {
|
||||
if (__isfdkind(fds[i], kFdFile) || __isfdkind(fds[i], kFdConsole)) {
|
||||
if (GetConsoleMode(g_fds.p[fds[i]].handle, &mode)) {
|
||||
|
@ -42,9 +45,9 @@ textwindows int ioctl_tiocgwinsz_nt(int fd, struct winsize *ws) {
|
|||
ws->ws_xpixel = 0;
|
||||
ws->ws_ypixel = 0;
|
||||
return 0;
|
||||
} else if (__nt_startupinfo.dwFlags & kNtStartfUsecountchars) {
|
||||
ws->ws_col = __nt_startupinfo.dwXCountChars;
|
||||
ws->ws_row = __nt_startupinfo.dwYCountChars;
|
||||
} else if (startinfo.dwFlags & kNtStartfUsecountchars) {
|
||||
ws->ws_col = startinfo.dwXCountChars;
|
||||
ws->ws_row = startinfo.dwYCountChars;
|
||||
ws->ws_xpixel = 0;
|
||||
ws->ws_ypixel = 0;
|
||||
return 0;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/dce.h"
|
||||
#include "libc/macros.h"
|
||||
.source __FILE__
|
||||
|
||||
|
@ -31,7 +32,11 @@ kNtSystemDirectory:
|
|||
.previous
|
||||
|
||||
.init.start 300,_init_kNtSystemDirectory
|
||||
#if SupportsWindows()
|
||||
pushpop BYTES,%rdx
|
||||
mov __imp_GetSystemDirectoryA(%rip),%rax
|
||||
call __getntsyspath
|
||||
#else
|
||||
add $BYTES,%rdi
|
||||
#endif
|
||||
.init.end 300,_init_kNtSystemDirectory
|
||||
|
|
|
@ -32,7 +32,11 @@ kNtWindowsDirectory:
|
|||
.previous
|
||||
|
||||
.init.start 300,_init_kNtWindowsDirectory
|
||||
#if SupportsWindows()
|
||||
pushpop BYTES,%rdx
|
||||
mov __imp_GetWindowsDirectoryA(%rip),%rax
|
||||
call __getntsyspath
|
||||
#else
|
||||
add $BYTES,%rdi
|
||||
#endif
|
||||
.init.end 300,_init_kNtWindowsDirectory
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/macros.h"
|
||||
|
||||
#define kTmpPathMax 80
|
||||
|
@ -34,8 +35,12 @@ kTmpPath:
|
|||
.init.start 300,_init_kTmpPath
|
||||
movl $'/|'t<<010|'m<<020|'p<<030,(%rdi)
|
||||
movw $'/,4(%rdi)
|
||||
#if SupportsWindows()
|
||||
pushpop kTmpPathMax,%rdx
|
||||
ezlea GetTempPathA_flunk,ax
|
||||
call __getntsyspath
|
||||
#else
|
||||
add $kTmpPathMax,%rdi
|
||||
#endif
|
||||
.init.end 300,_init_kTmpPath
|
||||
.source __FILE__
|
||||
|
|
|
@ -36,7 +36,7 @@ ssize_t readv(int fd, const struct iovec *iov, int iovlen) {
|
|||
if (fd < g_fds.n && g_fds.p[fd].kind == kFdZip) {
|
||||
return weaken(__zipos_read)(
|
||||
(struct ZiposHandle *)(intptr_t)g_fds.p[fd].handle, iov, iovlen, -1);
|
||||
} else if (fd < g_fds.n && g_fds.p[fd].kind == kFdSerial) {
|
||||
} else if (SupportsMetal() && fd < g_fds.n && g_fds.p[fd].kind == kFdSerial) {
|
||||
return readv_serial(&g_fds.p[fd], iov, iovlen);
|
||||
} else if (!IsWindows()) {
|
||||
return sys_readv(fd, iov, iovlen);
|
||||
|
|
|
@ -21,9 +21,11 @@
|
|||
|
||||
void __releasefd(int fd) {
|
||||
int x;
|
||||
g_fds.p[fd].kind = kFdEmpty;
|
||||
do {
|
||||
x = g_fds.f;
|
||||
if (fd >= x) break;
|
||||
} while (!cmpxchg(&g_fds.f, x, fd));
|
||||
if (!__vforked && 0 <= fd && fd < g_fds.n) {
|
||||
g_fds.p[fd].kind = kFdEmpty;
|
||||
do {
|
||||
x = g_fds.f;
|
||||
if (fd >= x) break;
|
||||
} while (!cmpxchg(&g_fds.f, x, fd));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,11 +25,13 @@
|
|||
|
||||
textwindows int sys_sysinfo_nt(struct sysinfo *info) {
|
||||
struct NtMemoryStatusEx memstat;
|
||||
struct NtSystemInfo sysinfo;
|
||||
GetSystemInfo(&sysinfo);
|
||||
memstat.dwLength = sizeof(struct NtMemoryStatusEx);
|
||||
if (GlobalMemoryStatusEx(&memstat)) {
|
||||
info->totalram = memstat.ullTotalPhys;
|
||||
info->freeram = memstat.ullAvailPhys;
|
||||
info->procs = __nt_systeminfo.dwNumberOfProcessors;
|
||||
info->procs = sysinfo.dwNumberOfProcessors;
|
||||
info->mem_unit = 1;
|
||||
return 0;
|
||||
} else {
|
||||
|
|
|
@ -39,7 +39,7 @@ ssize_t writev(int fd, const struct iovec *iov, int iovlen) {
|
|||
if (fd < g_fds.n && g_fds.p[fd].kind == kFdZip) {
|
||||
return weaken(__zipos_write)(
|
||||
(struct ZiposHandle *)(intptr_t)g_fds.p[fd].handle, iov, iovlen, -1);
|
||||
} else if (fd < g_fds.n && g_fds.p[fd].kind == kFdSerial) {
|
||||
} else if (SupportsMetal() && fd < g_fds.n && g_fds.p[fd].kind == kFdSerial) {
|
||||
return writev_serial(&g_fds.p[fd], iov, iovlen);
|
||||
} else if (!IsWindows()) {
|
||||
return sys_writev(fd, iov, iovlen);
|
||||
|
|
|
@ -21,19 +21,20 @@
|
|||
#include "libc/notice.inc"
|
||||
#include "libc/runtime/internal.h"
|
||||
.section .start,"ax",@progbits
|
||||
.source __FILE__
|
||||
|
||||
nop
|
||||
.align 16
|
||||
|
||||
/ System Five userspace program entrypoint.
|
||||
/
|
||||
/ @param rsp is [n,argv₀..argvₙ₋₁,0,envp₀..,0,auxv₀..,0,..]
|
||||
/ @note FreeBSD is special (see freebsd/lib/csu/amd64/...)
|
||||
/ @noreturn
|
||||
_start: test %rdi,%rdi
|
||||
_start:
|
||||
#if SupportsFreebsd()
|
||||
test %rdi,%rdi
|
||||
cmovnz %rdi,%rsp
|
||||
jz 0f
|
||||
movb $FREEBSD,__hostos(%rip)
|
||||
#endif
|
||||
0: mov (%rsp),%ebx # argc
|
||||
lea 8(%rsp),%rsi # argv
|
||||
lea 24(%rsp,%rbx,8),%rdx # envp
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
* Supported Platforms Tuning Knob (Runtime & Compile-Time)
|
||||
* Tuning this bitmask will remove platform polyfills at compile-time.
|
||||
*/
|
||||
#define SUPPORT_VECTOR 0b11111111
|
||||
#define SUPPORT_VECTOR 255
|
||||
#endif
|
||||
|
||||
#define LINUX 1
|
||||
|
@ -78,7 +78,7 @@
|
|||
#define SupportsNetbsd() ((SUPPORT_VECTOR & NETBSD) == NETBSD)
|
||||
#define SupportsBsd() (!!(SUPPORT_VECTOR & (XNU | FREEBSD | OPENBSD | NETBSD)))
|
||||
#define SupportsSystemv() \
|
||||
((SUPPORT_VECTOR & (LINUX | METAL | XNU | OPENBSD | FREEBSD | NETBSD)) != 0)
|
||||
(!!(SUPPORT_VECTOR & (LINUX | XNU | OPENBSD | FREEBSD | NETBSD)))
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
#define IsLinux() (SupportsLinux() && (__hostos & LINUX))
|
||||
|
|
215
libc/elf/elf.lds
215
libc/elf/elf.lds
|
@ -1,215 +0,0 @@
|
|||
/*-*- mode: ld-script; indent-tabs-mode: nil; tab-width: 2; coding: utf-8 -*-│
|
||||
│vi: set et sts=2 tw=2 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 "ape/relocations.h"
|
||||
#include "libc/macros.h"
|
||||
|
||||
/**
|
||||
* @fileoverview Cosmopolitan ELF-Normative Linker Script.
|
||||
*
|
||||
* This linker script is an alternative to αcτµαlly pδrταblε εxεcµταblε.
|
||||
* It's intended for host-only binaries that don't need to be able to run
|
||||
* without an operating system, and don't need to be distributed. These
|
||||
* are still static executables, and they start at roughly 1kb in size.
|
||||
*
|
||||
* @see ape/ape.lds
|
||||
*/
|
||||
|
||||
ENTRY(_start)
|
||||
|
||||
SECTIONS {
|
||||
. = SEGMENT_START("text-segment", IMAGE_BASE_VIRTUAL) + SIZEOF_HEADERS;
|
||||
|
||||
.real : {
|
||||
HIDDEN(_base = .);
|
||||
*(.text.real)
|
||||
HIDDEN(_ereal = .);
|
||||
}
|
||||
|
||||
.start : {
|
||||
*(.start)
|
||||
KEEP(*(.initprologue))
|
||||
KEEP(*(SORT_BY_NAME(.init.*)))
|
||||
KEEP(*(SORT_NONE(.init)))
|
||||
KEEP(*(.initepilogue))
|
||||
*(.text.startup)
|
||||
}
|
||||
|
||||
.exit : {
|
||||
*(.text.exit)
|
||||
}
|
||||
|
||||
.cold : {
|
||||
*(.text.unlikely)
|
||||
}
|
||||
|
||||
.windows : {
|
||||
*(.textwindowsprologue)
|
||||
*(.text.windows) /* ← you can flip the windows bit in -DSUPPORT_VECTOR */
|
||||
*(.textwindowsepilogue)
|
||||
}
|
||||
|
||||
.text : {
|
||||
*(SORT_BY_ALIGNMENT(.text.hot))
|
||||
KEEP(*(.keep.text))
|
||||
*(.text .text.*)
|
||||
KEEP(*(SORT_BY_NAME(.sort.text.*)))
|
||||
}
|
||||
|
||||
.test : {
|
||||
HIDDEN(__test_start = .);
|
||||
*(.test.unlikely)
|
||||
*(.test .test.*)
|
||||
}
|
||||
|
||||
.privileged : {
|
||||
. = ALIGN(DEFINED(ftrace_init) ? PAGESIZE : 1);
|
||||
HIDDEN(__privileged_start = .);
|
||||
*(.privileged)
|
||||
HIDDEN(__privileged_end = .);
|
||||
}
|
||||
|
||||
.rodata : {
|
||||
HIDDEN(__ro = .); /* ←for gdb readibility */
|
||||
|
||||
/* Read-Only Data */
|
||||
*(.rodata .rodata.*)
|
||||
KEEP(*(SORT_BY_NAME(.sort.rodata.*)))
|
||||
|
||||
/* DSO stuff */
|
||||
PROVIDE_HIDDEN(__got_plt = .);
|
||||
*(.got.plt)
|
||||
|
||||
/* Windows DLL Import Directory */
|
||||
HIDDEN(idata.ro = .);
|
||||
KEEP(*(SORT_BY_NAME(.idata.ro.*)))
|
||||
}
|
||||
|
||||
.initro : {
|
||||
/* Encoded Data Structures */
|
||||
KEEP(*(.initroprologue))
|
||||
KEEP(*(SORT_BY_NAME(.initro.*)))
|
||||
KEEP(*(.initroepilogue))
|
||||
}
|
||||
|
||||
.ubsan : {
|
||||
/* Undefined Behavior Sanitizer Types */
|
||||
PROVIDE_HIDDEN(__ubsan_types_start = .);
|
||||
*(.ubsan.types)
|
||||
PROVIDE_HIDDEN(__ubsan_types_end = .);
|
||||
PROVIDE_HIDDEN(__ubsan_data_start = .);
|
||||
*(.ubsan.data)
|
||||
PROVIDE_HIDDEN(__ubsan_data_end = .);
|
||||
}
|
||||
|
||||
HIDDEN(_etext = .);
|
||||
PROVIDE_HIDDEN(etext = .);
|
||||
|
||||
. = DATA_SEGMENT_ALIGN(CONSTANT(MAXPAGESIZE), CONSTANT(COMMONPAGESIZE));
|
||||
|
||||
.data : {
|
||||
*(.data .data.*)
|
||||
KEEP(*(SORT_BY_NAME(.sort.data.*)))
|
||||
SORT(CONSTRUCTORS)
|
||||
KEEP(*(.edata))
|
||||
. = ALIGN(__SIZEOF_POINTER__);
|
||||
HIDDEN(__piro_start = .);
|
||||
QUAD(IMAGE_BASE_VIRTUAL);
|
||||
PROVIDE_HIDDEN(__init_array_start = .);
|
||||
KEEP(*(.preinit_array))
|
||||
KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*)
|
||||
SORT_BY_INIT_PRIORITY(.ctors.*)))
|
||||
KEEP(*(SORT_NONE(.init_array)))
|
||||
KEEP(*(SORT_NONE(.ctors)))
|
||||
PROVIDE_HIDDEN(__init_array_end = .);
|
||||
PROVIDE_HIDDEN(__fini_array_start = .);
|
||||
KEEP(*(SORT_BY_INIT_PRIORITY(.fini_array.*)
|
||||
SORT_BY_INIT_PRIORITY(.dtors.*)))
|
||||
KEEP(*(SORT_NONE(.fini_array)))
|
||||
KEEP(*(SORT_NONE(.dtors)))
|
||||
PROVIDE_HIDDEN(__fini_array_end = .);
|
||||
KEEP(*(SORT_BY_NAME(.piro.relo.sort.*)))
|
||||
*(.data.rel.ro .data.rel.ro.*)
|
||||
PROVIDE_HIDDEN(__relo_end = .);
|
||||
KEEP(*(SORT_BY_NAME(.piro.data.sort.*)))
|
||||
}
|
||||
|
||||
HIDDEN(_edata = .);
|
||||
PROVIDE_HIDDEN(edata = .);
|
||||
|
||||
.bss : {
|
||||
KEEP(*(SORT_BY_NAME(.piro.bss.init.*)))
|
||||
*(.piro.bss)
|
||||
KEEP(*(SORT_BY_NAME(.piro.bss.sort.*)))
|
||||
HIDDEN(__piro_end = .);
|
||||
*(.bss .bss.*)
|
||||
*(COMMON)
|
||||
KEEP(*(SORT_BY_NAME(.sort.bss.*)))
|
||||
. = ALIGN(ABSOLUTE(.) - IMAGE_BASE_VIRTUAL > 0x80000000 ? 0x80000000 :
|
||||
ABSOLUTE(.) - IMAGE_BASE_VIRTUAL > 0x200000 ? 0x200000 : 0x1000);
|
||||
*(.xlm)
|
||||
. = ALIGN(ABSOLUTE(.) - IMAGE_BASE_VIRTUAL > 0x80000000 ? 0x80000000 :
|
||||
ABSOLUTE(.) - IMAGE_BASE_VIRTUAL > 0x200000 ? 0x200000 : 0x1000);
|
||||
. = ALIGN(. != 0 ? __SIZEOF_POINTER__ : 1);
|
||||
}
|
||||
|
||||
HIDDEN(_end = .);
|
||||
PROVIDE_HIDDEN(end = .);
|
||||
|
||||
.gnu_debuglink 0 : { *(.gnu_debuglink) }
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
.debug_pubtypes 0 : { *(.debug_pubtypes) }
|
||||
.debug_ranges 0 : { *(.debug_ranges) }
|
||||
.debug_macro 0 : { *(.debug_macro) }
|
||||
.debug_addr 0 : { *(.debug_addr) }
|
||||
.gnu.attributes 0 : { KEEP(*(.gnu.attributes)) }
|
||||
.GCC.command.line 0 : { *(.GCC.command.line) }
|
||||
|
||||
/DISCARD/ : {
|
||||
*(.comment)
|
||||
*(.discard)
|
||||
*(.yoink)
|
||||
*(.*)
|
||||
}
|
||||
}
|
||||
|
||||
HIDDEN(__privileged_addr = ROUNDDOWN(__privileged_start, PAGESIZE));
|
||||
HIDDEN(__privileged_size = (ROUNDUP(__privileged_end, PAGESIZE) -
|
||||
ROUNDDOWN(__privileged_start, PAGESIZE)));
|
|
@ -40,10 +40,6 @@ $(LIBC_ELF_A).pkg: \
|
|||
$(LIBC_ELF_A_OBJS) \
|
||||
$(foreach x,$(LIBC_ELF_A_DIRECTDEPS),$($(x)_A).pkg)
|
||||
|
||||
o/libc/elf/elf.lds: \
|
||||
libc/elf/elf.lds \
|
||||
ape/relocations.h
|
||||
|
||||
LIBC_ELF_LIBS = $(foreach x,$(LIBC_ELF_ARTIFACTS),$($(x)))
|
||||
LIBC_ELF_SRCS = $(foreach x,$(LIBC_ELF_ARTIFACTS),$($(x)_SRCS))
|
||||
LIBC_ELF_HDRS = $(foreach x,$(LIBC_ELF_ARTIFACTS),$($(x)_HDRS))
|
||||
|
|
|
@ -294,7 +294,7 @@ XDEV\000\
|
|||
XFULL\000\
|
||||
\000";
|
||||
|
||||
const char *geterrname(long code) {
|
||||
static const char *geterrname(long code) {
|
||||
const long *e;
|
||||
size_t i, n;
|
||||
e = &E2BIG;
|
||||
|
@ -313,17 +313,16 @@ const char *geterrname(long code) {
|
|||
*/
|
||||
int strerror_r(int err, char *buf, size_t size) {
|
||||
const char *s;
|
||||
char16_t buf16[100];
|
||||
int winstate, sysvstate;
|
||||
if (err == -1 || IsTiny()) {
|
||||
s = "?";
|
||||
} else {
|
||||
s = firstnonnull(geterrname(err), "?");
|
||||
}
|
||||
if (!SupportsWindows()) {
|
||||
DebugBreak();
|
||||
snprintf(buf, size, "E%s[%d]", s, err);
|
||||
} else {
|
||||
char16_t buf16[100];
|
||||
int winstate, sysvstate;
|
||||
winstate = GetLastError();
|
||||
sysvstate = errno;
|
||||
if (FormatMessage(
|
||||
|
|
|
@ -28,17 +28,17 @@ COSMOPOLITAN_C_START_
|
|||
╚────────────────────────────────────────────────────────────────────────────│*/
|
||||
|
||||
#define LZ4_MAGIC(FRAME) READ32LE(FRAME)
|
||||
#define LZ4_FRAME_VERSION(FRAME) ((_LZ4_FRAME_FLG(FRAME) >> 6) & 0b11)
|
||||
#define LZ4_FRAME_VERSION(FRAME) ((_LZ4_FRAME_FLG(FRAME) >> 6) & 3)
|
||||
#define LZ4_FRAME_BLOCKINDEPENDENCE(FRAME) ((_LZ4_FRAME_FLG(FRAME) >> 5) & 1)
|
||||
#define LZ4_FRAME_BLOCKCHECKSUMFLAG(FRAME) ((_LZ4_FRAME_FLG(FRAME) >> 4) & 1)
|
||||
#define LZ4_FRAME_BLOCKCONTENTSIZEFLAG(FRAME) ((_LZ4_FRAME_FLG(FRAME) >> 3) & 1)
|
||||
#define LZ4_FRAME_BLOCKCONTENTCHECKSUMFLAG(FRAME) \
|
||||
((_LZ4_FRAME_FLG(FRAME) >> 2) & 1)
|
||||
#define LZ4_FRAME_DICTIONARYIDFLAG(FRAME) ((_LZ4_FRAME_FLG(FRAME) >> 0) & 1)
|
||||
#define LZ4_FRAME_BLOCKMAXSIZE(FRAME) ((_LZ4_FRAME_BD(FRAME) >> 4) & 0b111)
|
||||
#define LZ4_FRAME_BLOCKMAXSIZE(FRAME) ((_LZ4_FRAME_BD(FRAME) >> 4) & 7)
|
||||
#define LZ4_FRAME_RESERVED1(FRAME) ((_LZ4_FRAME_FLG(FRAME) >> 1) & 1)
|
||||
#define LZ4_FRAME_RESERVED2(FRAME) ((_LZ4_FRAME_BD(FRAME) >> 7) & 1)
|
||||
#define LZ4_FRAME_RESERVED3(FRAME) ((_LZ4_FRAME_BD(FRAME) >> 0) & 0b1111)
|
||||
#define LZ4_FRAME_RESERVED3(FRAME) ((_LZ4_FRAME_BD(FRAME) >> 0) & 15)
|
||||
#define LZ4_FRAME_BLOCKCONTENTSIZE(FRAME) \
|
||||
(LZ4_FRAME_BLOCKCONTENTSIZEFLAG(FRAME) ? READ64LE((FRAME) + 4 + 1 + 1) : 0)
|
||||
#define LZ4_FRAME_DICTIONARYID(FRAME) \
|
||||
|
|
|
@ -110,7 +110,12 @@ MemCpy: .leafprologue
|
|||
.L1: mov (%rsi),%cl
|
||||
mov %cl,(%rdi)
|
||||
jmp .L0
|
||||
.Lerms: cmp kHalfCache3(%rip),%rdx
|
||||
.Lerms:
|
||||
#ifdef TINY
|
||||
cmp $1024*1024,%rdx
|
||||
#else
|
||||
cmp kHalfCache3(%rip),%rdx
|
||||
#endif
|
||||
ja .Lnts
|
||||
push %rdi
|
||||
push %rsi
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
#define COSMOPOLITAN_LIBC_NEXGEN32E_X86INFO_H_
|
||||
#include "libc/nexgen32e/kcpuids.h"
|
||||
|
||||
#define kX86CpuStepping ((KCPUIDS(1H, EAX) >> 0) & 0b1111)
|
||||
#define kX86CpuModelid ((KCPUIDS(1H, EAX) >> 4) & 0b1111)
|
||||
#define kX86CpuFamilyid ((KCPUIDS(1H, EAX) >> 8) & 0b1111)
|
||||
#define kX86CpuType ((KCPUIDS(1H, EAX) >> 12) & 0b11)
|
||||
#define kX86CpuExtmodelid ((KCPUIDS(1H, EAX) >> 16) & 0b1111)
|
||||
#define kX86CpuExtfamilyid ((KCPUIDS(1H, EAX) >> 20) & 0b11111111)
|
||||
#define kX86CpuStepping ((KCPUIDS(1H, EAX) >> 0) & 15)
|
||||
#define kX86CpuModelid ((KCPUIDS(1H, EAX) >> 4) & 15)
|
||||
#define kX86CpuFamilyid ((KCPUIDS(1H, EAX) >> 8) & 15)
|
||||
#define kX86CpuType ((KCPUIDS(1H, EAX) >> 12) & 3)
|
||||
#define kX86CpuExtmodelid ((KCPUIDS(1H, EAX) >> 16) & 15)
|
||||
#define kX86CpuExtfamilyid ((KCPUIDS(1H, EAX) >> 20) & 255)
|
||||
|
||||
#define kX86CpuFamily \
|
||||
(kX86CpuFamilyid + (kX86CpuFamily == 15 ? kX86CpuExtfamilyid : 0))
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "libc/sysv/consts/nr.h"
|
||||
#include "libc/macros.h"
|
||||
.privileged
|
||||
.source __FILE__
|
||||
|
||||
/ Terminates program abnormally.
|
||||
/
|
||||
|
@ -38,8 +37,10 @@ abort: push %rbp
|
|||
mov %rsp,%rbp
|
||||
and $-16,%rsp
|
||||
sub $16,%rsp
|
||||
#if SupportsWindows()
|
||||
testb IsWindows()
|
||||
jnz 2f
|
||||
jnz sys_abort_nt
|
||||
#endif
|
||||
mov SIG_SETMASK,%edi
|
||||
mov %rsp,%rsi
|
||||
push $0xffffffffffffffdf # all bits blocked but SIGABRT
|
||||
|
@ -56,5 +57,5 @@ abort: push %rbp
|
|||
mov SIGABRT,%esi
|
||||
mov __NR_kill,%eax
|
||||
syscall # avoid hook and less bt noise
|
||||
2: call sys_abort_nt
|
||||
call _Exit
|
||||
.endfn abort,globl,protected
|
||||
|
|
|
@ -30,23 +30,6 @@
|
|||
_construct:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
ezlea __init_array_start,ax # static ctors in forward order
|
||||
.weak __init_array_start # could be called multiple times
|
||||
ezlea __init_array_end,cx # idempotency recommended
|
||||
.weak __init_array_end # @see ape/ape.lds
|
||||
1: cmp %rax,%rcx
|
||||
je 2f
|
||||
push %rax
|
||||
push %rcx
|
||||
mov %r12,%rdi
|
||||
mov %r13,%rsi
|
||||
mov %r14,%rdx
|
||||
mov %r15,%rcx
|
||||
call *(%rax)
|
||||
pop %rcx
|
||||
pop %rax
|
||||
add $8,%rax
|
||||
jmp 1b
|
||||
2: pop %rbp
|
||||
pop %rbp
|
||||
ret
|
||||
.endfn _construct,globl
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "libc/sysv/consts/map.h"
|
||||
#include "libc/dce.h"
|
||||
.text.startup
|
||||
.source __FILE__
|
||||
|
||||
/ Cosmopolitan runtime.
|
||||
/
|
||||
|
@ -34,30 +33,48 @@
|
|||
/ @noreturn
|
||||
cosmo: push %rbp
|
||||
mov %rsp,%rbp
|
||||
ezlea _base,bx
|
||||
mov %edi,%r12d
|
||||
mov %rsi,%r13
|
||||
mov %rdx,%r14
|
||||
mov %rcx,%r15
|
||||
#ifdef __FAST_MATH__
|
||||
call __fast_math
|
||||
push %rax
|
||||
stmxcsr (%rsp)
|
||||
orl $0x8040,(%rsp)
|
||||
ldmxcsr (%rsp)
|
||||
pop %rax
|
||||
#endif
|
||||
call _init
|
||||
call _construct
|
||||
ezlea __init_array_start,ax # static ctors in forward order
|
||||
.weak __init_array_start # could be called multiple times
|
||||
ezlea __init_array_end,cx # idempotency recommended
|
||||
.weak __init_array_end # @see ape/ape.lds
|
||||
1: cmp %rax,%rcx
|
||||
je 2f
|
||||
push %rax
|
||||
push %rcx
|
||||
call .Largs
|
||||
call *(%rax)
|
||||
pop %rcx
|
||||
pop %rax
|
||||
add $8,%rax
|
||||
jmp 1b
|
||||
2: nop
|
||||
#if !IsTrustworthy()
|
||||
mov $PROT_READ,%edi
|
||||
call _piro
|
||||
#endif
|
||||
mov %r12d,%edi
|
||||
mov %r13,%rsi
|
||||
mov %r14,%rdx
|
||||
mov %r15,%rcx
|
||||
call .Largs
|
||||
.weak main
|
||||
call main
|
||||
xchg %eax,%edi
|
||||
call exit
|
||||
.endfn cosmo,weak,hidden
|
||||
ud2
|
||||
.Largs: mov %r12d,%edi
|
||||
mov %r13,%rsi
|
||||
mov %r14,%rdx
|
||||
mov %r15,%rcx
|
||||
ret
|
||||
.endfn cosmo,weak
|
||||
|
||||
#ifdef __PG__
|
||||
.init.start 800,_init_ftrace
|
||||
|
|
|
@ -1,45 +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.h"
|
||||
#include "libc/notice.inc"
|
||||
.text.startup
|
||||
.source __FILE__
|
||||
|
||||
/ Intel Manual V.1 §10.2.3 - MXCSR Control and Status Register
|
||||
#define MXCSR_DE (1 << 1) /* Denormal Flag */
|
||||
#define MXCSR_DAZ (1 << 6) /* Denormals Are Zeros */
|
||||
#define MXCSR_DM (1 << 8) /* Denormal Operation Mask */
|
||||
#define MXCSR_FTZ (1 << 15) /* Flush to Zero */
|
||||
|
||||
/ Initializes fast math.
|
||||
/
|
||||
/ “Seymour Cray didn't care that 81.0/3.0 did not give exactly
|
||||
/ 27.0 on the CDC 6000 class machines, and he was universally
|
||||
/ respected for making the fastest machines around.
|
||||
/ ──Linus Torvalds
|
||||
__fast_math:
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
push %rax
|
||||
stmxcsr (%rsp)
|
||||
orl $MXCSR_FTZ+MXCSR_DAZ,(%rsp)
|
||||
ldmxcsr (%rsp)
|
||||
leave
|
||||
ret
|
||||
.endfn __fast_math,globl
|
|
@ -16,7 +16,6 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/bits/progn.internal.h"
|
||||
#include "libc/bits/safemacros.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/runtime/interruptiblecall.h"
|
||||
|
@ -53,7 +52,8 @@ intptr_t interruptiblecall(struct InterruptibleCall *icall,
|
|||
icall->sa_new.sa_handler = interruptcall;
|
||||
icall->sa_new.sa_flags |= SA_RESTART | SA_RESETHAND;
|
||||
if ((rc = (sigaction)(icall->sig, &icall->sa_new, &icall->sa_old)) != -1) {
|
||||
g_interruptiblecall = PROGN((icall->prev = g_interruptiblecall), icall);
|
||||
icall->prev = g_interruptiblecall;
|
||||
g_interruptiblecall = icall;
|
||||
if (!setjmp(icall->jb)) {
|
||||
icall->returnval = rc = callback(p1, p2, p3, p4);
|
||||
} else {
|
||||
|
|
|
@ -69,7 +69,6 @@ int mprotect(void *, uint64_t, int) privileged;
|
|||
int msync(void *, size_t, int);
|
||||
void __print(const void *, size_t);
|
||||
void __print_string(const char *);
|
||||
void __fast_math(void);
|
||||
void *sbrk(intptr_t);
|
||||
int brk(void *);
|
||||
int NtGetVersion(void);
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/dce.h"
|
||||
#include "libc/macros.h"
|
||||
#include "libc/runtime/memtrack.h"
|
||||
|
||||
|
@ -23,5 +24,9 @@ int UntrackMemoryIntervals(void *addr, size_t size) {
|
|||
int a, b;
|
||||
a = ROUNDDOWN((intptr_t)addr, FRAMESIZE) >> 16;
|
||||
b = ROUNDDOWN((intptr_t)addr + size - 1, FRAMESIZE) >> 16;
|
||||
return ReleaseMemoryIntervals(&_mmi, a, b, ReleaseMemoryNt);
|
||||
if (SupportsWindows()) {
|
||||
return ReleaseMemoryIntervals(&_mmi, a, b, ReleaseMemoryNt);
|
||||
} else {
|
||||
return ReleaseMemoryIntervals(&_mmi, a, b, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1399,7 +1399,7 @@ err:
|
|||
return -1;
|
||||
}
|
||||
|
||||
static textwindows noinline int sys_close_epoll_nt(int fd) {
|
||||
textwindows int sys_close_epoll_nt(int fd) {
|
||||
struct PortState *port_state;
|
||||
struct TsTreeNode *tree_node;
|
||||
if (wepoll_init() < 0) return -1;
|
||||
|
@ -1417,14 +1417,6 @@ err:
|
|||
return -1;
|
||||
}
|
||||
|
||||
int sys_close_epoll(int fd) {
|
||||
if (!IsWindows()) {
|
||||
return sys_close(fd);
|
||||
} else {
|
||||
return sys_close_epoll_nt(fd);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates new epoll instance.
|
||||
*
|
||||
|
@ -1448,7 +1440,7 @@ int epoll_create1(int flags) {
|
|||
int fd;
|
||||
if (flags & ~O_CLOEXEC) return einval();
|
||||
if (!IsWindows()) {
|
||||
return __ensurefds(__fixupnewfd(sys_epoll_create(1337), flags));
|
||||
return __fixupnewfd(sys_epoll_create(1337), flags);
|
||||
} else {
|
||||
return sys_epoll_create1_nt(flags);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/bits/bits.h"
|
||||
#include "libc/bits/progn.internal.h"
|
||||
#include "libc/calls/internal.h"
|
||||
#include "libc/calls/struct/dirent.h"
|
||||
#include "libc/dce.h"
|
||||
|
@ -47,8 +46,8 @@
|
|||
* Directory stream object.
|
||||
*/
|
||||
struct dirstream {
|
||||
int64_t tell;
|
||||
int64_t fd;
|
||||
int64_t tell;
|
||||
struct dirent ent;
|
||||
union {
|
||||
struct {
|
||||
|
@ -98,24 +97,48 @@ struct dirent_netbsd {
|
|||
char d_name[512];
|
||||
};
|
||||
|
||||
static textwindows noinline DIR *opendir_nt(const char *name) {
|
||||
int len;
|
||||
static textwindows DIR *opendir_nt_impl(char16_t name[PATH_MAX], size_t len) {
|
||||
DIR *res;
|
||||
char16_t name16[PATH_MAX];
|
||||
if ((len = __mkntpath(name, name16)) == -1) return NULL;
|
||||
if (len + 2 + 1 > PATH_MAX) return PROGN(enametoolong(), NULL);
|
||||
while (name16[len - 1] == u'\\') name16[--len] = u'\0';
|
||||
name16[len++] = u'\\';
|
||||
name16[len++] = u'*';
|
||||
name16[len] = u'\0';
|
||||
if (!(res = calloc(1, sizeof(DIR)))) return NULL;
|
||||
if ((res->fd = FindFirstFile(name16, &res->windata)) != -1) {
|
||||
return res;
|
||||
if (len + 2 + 1 <= PATH_MAX) {
|
||||
if (name[len - 1] != u'\\') name[len++] = u'\\';
|
||||
name[len++] = u'*';
|
||||
name[len] = u'\0';
|
||||
if ((res = calloc(1, sizeof(DIR)))) {
|
||||
if ((res->fd = FindFirstFile(name, &res->windata)) != -1) {
|
||||
return res;
|
||||
} else {
|
||||
__winerr();
|
||||
}
|
||||
free(res);
|
||||
}
|
||||
} else {
|
||||
__winerr();
|
||||
free(res);
|
||||
return NULL;
|
||||
enametoolong();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static textwindows noinline DIR *opendir_nt(const char *path) {
|
||||
int len;
|
||||
char16_t name[PATH_MAX];
|
||||
if ((len = __mkntpath(path, name)) == -1) return NULL;
|
||||
return opendir_nt_impl(name, len);
|
||||
}
|
||||
|
||||
static textwindows noinline DIR *fdopendir_nt(int fd) {
|
||||
DIR *res;
|
||||
char16_t name[PATH_MAX];
|
||||
if (__isfdkind(fd, kFdFile)) {
|
||||
if ((res = opendir_nt_impl(
|
||||
name, GetFinalPathNameByHandle(
|
||||
g_fds.p[fd].handle, name, ARRAYLEN(name),
|
||||
kNtFileNameNormalized | kNtVolumeNameDos)))) {
|
||||
close(fd);
|
||||
return res;
|
||||
}
|
||||
} else {
|
||||
ebadf();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static textwindows noinline struct dirent *readdir_nt(DIR *dir) {
|
||||
|
@ -193,14 +216,12 @@ DIR *opendir(const char *name) {
|
|||
DIR *fdopendir(int fd) {
|
||||
DIR *dir;
|
||||
if (!IsWindows()) {
|
||||
if ((dir = calloc(1, sizeof(*dir)))) {
|
||||
dir->fd = fd;
|
||||
return dir;
|
||||
}
|
||||
if (!(dir = calloc(1, sizeof(*dir)))) return NULL;
|
||||
dir->fd = fd;
|
||||
return dir;
|
||||
} else {
|
||||
enosys(); /* TODO(jart): Implement me! */
|
||||
return fdopendir_nt(fd);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -221,7 +242,7 @@ struct dirent *readdir(DIR *dir) {
|
|||
struct dirent_openbsd *obsd;
|
||||
if (!IsWindows()) {
|
||||
if (dir->buf_pos >= dir->buf_end) {
|
||||
basep = dir->tell; /* <- what does xnu do */
|
||||
basep = dir->tell; /* TODO(jart): what does xnu do */
|
||||
rc = getdents(dir->fd, dir->buf, sizeof(dir->buf) - 256, &basep);
|
||||
if (!rc || rc == -1) return NULL;
|
||||
dir->buf_pos = 0;
|
||||
|
@ -295,5 +316,6 @@ long telldir(DIR *dir) {
|
|||
* Returns file descriptor associated with DIR object.
|
||||
*/
|
||||
int dirfd(DIR *dir) {
|
||||
if (IsWindows()) return eopnotsupp();
|
||||
return dir->fd;
|
||||
}
|
||||
|
|
2
libc/sysv/consts/ABDAY_1.S
Normal file
2
libc/sysv/consts/ABDAY_1.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon misc ABDAY_1 0x020000 14 14 13 13 0
|
|
@ -1,2 +0,0 @@
|
|||
.include "libc/sysv/consts/syscon.inc"
|
||||
.syscon misc ABDAY_1 0x020000 14 14 13 13 0
|
2
libc/sysv/consts/ABDAY_2.S
Normal file
2
libc/sysv/consts/ABDAY_2.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon misc ABDAY_2 0x020001 15 15 14 14 0
|
|
@ -1,2 +0,0 @@
|
|||
.include "libc/sysv/consts/syscon.inc"
|
||||
.syscon misc ABDAY_2 0x020001 15 15 14 14 0
|
2
libc/sysv/consts/ABDAY_3.S
Normal file
2
libc/sysv/consts/ABDAY_3.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon misc ABDAY_3 0x020002 0x10 0x10 15 15 0
|
|
@ -1,2 +0,0 @@
|
|||
.include "libc/sysv/consts/syscon.inc"
|
||||
.syscon misc ABDAY_3 0x020002 0x10 0x10 15 15 0
|
2
libc/sysv/consts/ABDAY_4.S
Normal file
2
libc/sysv/consts/ABDAY_4.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon misc ABDAY_4 0x020003 17 17 0x10 0x10 0
|
|
@ -1,2 +0,0 @@
|
|||
.include "libc/sysv/consts/syscon.inc"
|
||||
.syscon misc ABDAY_4 0x020003 17 17 0x10 0x10 0
|
2
libc/sysv/consts/ABDAY_5.S
Normal file
2
libc/sysv/consts/ABDAY_5.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon misc ABDAY_5 0x020004 18 18 17 17 0
|
|
@ -1,2 +0,0 @@
|
|||
.include "libc/sysv/consts/syscon.inc"
|
||||
.syscon misc ABDAY_5 0x020004 18 18 17 17 0
|
2
libc/sysv/consts/ABDAY_6.S
Normal file
2
libc/sysv/consts/ABDAY_6.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon misc ABDAY_6 0x020005 19 19 18 18 0
|
|
@ -1,2 +0,0 @@
|
|||
.include "libc/sysv/consts/syscon.inc"
|
||||
.syscon misc ABDAY_6 0x020005 19 19 18 18 0
|
2
libc/sysv/consts/ABDAY_7.S
Normal file
2
libc/sysv/consts/ABDAY_7.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon misc ABDAY_7 0x020006 20 20 19 19 0
|
|
@ -1,2 +0,0 @@
|
|||
.include "libc/sysv/consts/syscon.inc"
|
||||
.syscon misc ABDAY_7 0x020006 20 20 19 19 0
|
2
libc/sysv/consts/ABORTED_COMMAND.S
Normal file
2
libc/sysv/consts/ABORTED_COMMAND.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon misc ABORTED_COMMAND 11 0 0 0 0 0
|
|
@ -1,2 +0,0 @@
|
|||
.include "libc/sysv/consts/syscon.inc"
|
||||
.syscon misc ABORTED_COMMAND 11 0 0 0 0 0
|
2
libc/sysv/consts/ACCOUNTING.S
Normal file
2
libc/sysv/consts/ACCOUNTING.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon misc ACCOUNTING 9 9 0 0 0 0
|
|
@ -1,2 +0,0 @@
|
|||
.include "libc/sysv/consts/syscon.inc"
|
||||
.syscon misc ACCOUNTING 9 9 0 0 0 0
|
2
libc/sysv/consts/ACCT_BYTEORDER.S
Normal file
2
libc/sysv/consts/ACCT_BYTEORDER.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon misc ACCT_BYTEORDER 0 0 0 0 0 0
|
|
@ -1,2 +0,0 @@
|
|||
.include "libc/sysv/consts/syscon.inc"
|
||||
.syscon misc ACCT_BYTEORDER 0 0 0 0 0 0
|
2
libc/sysv/consts/ACCT_COMM.S
Normal file
2
libc/sysv/consts/ACCT_COMM.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon misc ACCT_COMM 0x10 0 0 0 0 0
|
|
@ -1,2 +0,0 @@
|
|||
.include "libc/sysv/consts/syscon.inc"
|
||||
.syscon misc ACCT_COMM 0x10 0 0 0 0 0
|
2
libc/sysv/consts/ACK.S
Normal file
2
libc/sysv/consts/ACK.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon misc ACK 4 4 4 4 4 0
|
|
@ -1,2 +0,0 @@
|
|||
.include "libc/sysv/consts/syscon.inc"
|
||||
.syscon misc ACK 4 4 4 4 4 0
|
2
libc/sysv/consts/ACORE.S
Normal file
2
libc/sysv/consts/ACORE.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon misc ACORE 0 8 8 8 8 0
|
|
@ -1,2 +0,0 @@
|
|||
.include "libc/sysv/consts/syscon.inc"
|
||||
.syscon misc ACORE 0 8 8 8 8 0
|
2
libc/sysv/consts/ADDR_COMPAT_LAYOUT.S
Normal file
2
libc/sysv/consts/ADDR_COMPAT_LAYOUT.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon prsnlty ADDR_COMPAT_LAYOUT 0x0200000 -1 -1 -1 -1 -1
|
|
@ -1,2 +0,0 @@
|
|||
.include "libc/sysv/consts/syscon.inc"
|
||||
.syscon prsnlty ADDR_COMPAT_LAYOUT 0x0200000 -1 -1 -1 -1 -1
|
2
libc/sysv/consts/ADDR_LIMIT_32BIT.S
Normal file
2
libc/sysv/consts/ADDR_LIMIT_32BIT.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon prsnlty ADDR_LIMIT_32BIT 0x0800000 -1 -1 -1 -1 -1
|
|
@ -1,2 +0,0 @@
|
|||
.include "libc/sysv/consts/syscon.inc"
|
||||
.syscon prsnlty ADDR_LIMIT_32BIT 0x0800000 -1 -1 -1 -1 -1
|
2
libc/sysv/consts/ADDR_LIMIT_3GB.S
Normal file
2
libc/sysv/consts/ADDR_LIMIT_3GB.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon prsnlty ADDR_LIMIT_3GB 0x8000000 -1 -1 -1 -1 -1
|
|
@ -1,2 +0,0 @@
|
|||
.include "libc/sysv/consts/syscon.inc"
|
||||
.syscon prsnlty ADDR_LIMIT_3GB 0x8000000 -1 -1 -1 -1 -1
|
2
libc/sysv/consts/ADDR_NO_RANDOMIZE.S
Normal file
2
libc/sysv/consts/ADDR_NO_RANDOMIZE.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon prsnlty ADDR_NO_RANDOMIZE 0x0040000 -1 -1 -1 -1 -1
|
|
@ -1,2 +0,0 @@
|
|||
.include "libc/sysv/consts/syscon.inc"
|
||||
.syscon prsnlty ADDR_NO_RANDOMIZE 0x0040000 -1 -1 -1 -1 -1
|
2
libc/sysv/consts/AFORK.S
Normal file
2
libc/sysv/consts/AFORK.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon misc AFORK 0 1 1 1 1 0
|
|
@ -1,2 +0,0 @@
|
|||
.include "libc/sysv/consts/syscon.inc"
|
||||
.syscon misc AFORK 0 1 1 1 1 0
|
2
libc/sysv/consts/AF_ALG.S
Normal file
2
libc/sysv/consts/AF_ALG.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon af AF_ALG 38 0 0 0 0 0
|
|
@ -1,2 +0,0 @@
|
|||
.include "libc/sysv/consts/syscon.inc"
|
||||
.syscon af AF_ALG 38 0 0 0 0 0
|
2
libc/sysv/consts/AF_APPLETALK.S
Normal file
2
libc/sysv/consts/AF_APPLETALK.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon af AF_APPLETALK 5 0x10 0x10 0x10 0x10 0x10
|
|
@ -1,2 +0,0 @@
|
|||
.include "libc/sysv/consts/syscon.inc"
|
||||
.syscon af AF_APPLETALK 5 0x10 0x10 0x10 0x10 0x10
|
2
libc/sysv/consts/AF_ASH.S
Normal file
2
libc/sysv/consts/AF_ASH.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon af AF_ASH 18 0 0 0 0 0
|
|
@ -1,2 +0,0 @@
|
|||
.include "libc/sysv/consts/syscon.inc"
|
||||
.syscon af AF_ASH 18 0 0 0 0 0
|
2
libc/sysv/consts/AF_ATMPVC.S
Normal file
2
libc/sysv/consts/AF_ATMPVC.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon af AF_ATMPVC 8 0 0 0 0 0
|
|
@ -1,2 +0,0 @@
|
|||
.include "libc/sysv/consts/syscon.inc"
|
||||
.syscon af AF_ATMPVC 8 0 0 0 0 0
|
2
libc/sysv/consts/AF_ATMSVC.S
Normal file
2
libc/sysv/consts/AF_ATMSVC.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon af AF_ATMSVC 20 0 0 0 0 0
|
|
@ -1,2 +0,0 @@
|
|||
.include "libc/sysv/consts/syscon.inc"
|
||||
.syscon af AF_ATMSVC 20 0 0 0 0 0
|
2
libc/sysv/consts/AF_AX25.S
Normal file
2
libc/sysv/consts/AF_AX25.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon af AF_AX25 3 0 0 0 0 0
|
|
@ -1,2 +0,0 @@
|
|||
.include "libc/sysv/consts/syscon.inc"
|
||||
.syscon af AF_AX25 3 0 0 0 0 0
|
2
libc/sysv/consts/AF_BLUETOOTH.S
Normal file
2
libc/sysv/consts/AF_BLUETOOTH.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon af AF_BLUETOOTH 31 0 36 0x20 31 0
|
|
@ -1,2 +0,0 @@
|
|||
.include "libc/sysv/consts/syscon.inc"
|
||||
.syscon af AF_BLUETOOTH 31 0 36 0x20 31 0
|
2
libc/sysv/consts/AF_BRIDGE.S
Normal file
2
libc/sysv/consts/AF_BRIDGE.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon af AF_BRIDGE 7 0 0 0 0 0
|
|
@ -1,2 +0,0 @@
|
|||
.include "libc/sysv/consts/syscon.inc"
|
||||
.syscon af AF_BRIDGE 7 0 0 0 0 0
|
2
libc/sysv/consts/AF_CAIF.S
Normal file
2
libc/sysv/consts/AF_CAIF.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon af AF_CAIF 37 0 0 0 0 0
|
|
@ -1,2 +0,0 @@
|
|||
.include "libc/sysv/consts/syscon.inc"
|
||||
.syscon af AF_CAIF 37 0 0 0 0 0
|
2
libc/sysv/consts/AF_CAN.S
Normal file
2
libc/sysv/consts/AF_CAN.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon af AF_CAN 29 0 0 0 35 0
|
|
@ -1,2 +0,0 @@
|
|||
.include "libc/sysv/consts/syscon.inc"
|
||||
.syscon af AF_CAN 29 0 0 0 35 0
|
2
libc/sysv/consts/AF_ECONET.S
Normal file
2
libc/sysv/consts/AF_ECONET.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon af AF_ECONET 19 0 0 0 0 0
|
|
@ -1,2 +0,0 @@
|
|||
.include "libc/sysv/consts/syscon.inc"
|
||||
.syscon af AF_ECONET 19 0 0 0 0 0
|
2
libc/sysv/consts/AF_FILE.S
Normal file
2
libc/sysv/consts/AF_FILE.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon af AF_FILE 1 0 0 0 0 0
|
|
@ -1,2 +0,0 @@
|
|||
.include "libc/sysv/consts/syscon.inc"
|
||||
.syscon af AF_FILE 1 0 0 0 0 0
|
2
libc/sysv/consts/AF_IB.S
Normal file
2
libc/sysv/consts/AF_IB.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon af AF_IB 27 0 0 0 0 0
|
|
@ -1,2 +0,0 @@
|
|||
.include "libc/sysv/consts/syscon.inc"
|
||||
.syscon af AF_IB 27 0 0 0 0 0
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue