mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-28 08:12:28 +00:00
Make improvements
- More timspec_*() and timeval_*() APIs have been introduced. - The copyfd() function is now simplified thanks to POSIX rules. - More Cosmo-specific APIs have been moved behind the COSMO define. - The setitimer() polyfill for Windows NT is now much higher quality. - Fixed build error for MODE=aarch64 due to -mstringop-strategy=loop. - This change introduces `make MODE=nox87 toolchain` which makes it possible to build programs using your cosmocc toolchain that don't have legacy fpu instructions. This is useful, for example, if you want to have a ~22kb tinier blink virtual machine.
This commit is contained in:
parent
8dc11afcf6
commit
c3440d040c
132 changed files with 539 additions and 587 deletions
|
@ -45,6 +45,7 @@ cosmo: push %rbp
|
|||
mov %eax,%r12d
|
||||
#endif /* SYSDEBUG */
|
||||
|
||||
#ifndef NOX87
|
||||
// Windows always initializes FPU to douuble precision.
|
||||
// WSL breaks Linux ABI by initializing FPU to double precision.
|
||||
// This code makes long double long again.
|
||||
|
@ -70,6 +71,7 @@ cosmo: push %rbp
|
|||
// d││││rr││││││
|
||||
1: .short 0b00000000000000000001101111111
|
||||
.previous
|
||||
#endif
|
||||
|
||||
#ifdef __FAST_MATH__
|
||||
push %rax
|
||||
|
|
|
@ -20,24 +20,9 @@ typedef unsigned long jmp_buf[26];
|
|||
|
||||
typedef long sigjmp_buf[12];
|
||||
|
||||
extern char **environ; /* CRT */
|
||||
extern int __argc; /* CRT */
|
||||
extern char **__argv; /* CRT */
|
||||
extern char **__envp; /* CRT */
|
||||
extern unsigned long *__auxv; /* CRT */
|
||||
extern intptr_t __oldstack; /* CRT */
|
||||
extern uint64_t __nosync; /* SYS */
|
||||
extern int __strace; /* SYS */
|
||||
extern int __ftrace; /* SYS */
|
||||
extern char *program_invocation_name; /* RII */
|
||||
extern char *program_invocation_short_name; /* RII */
|
||||
extern uint64_t __syscount; /* RII */
|
||||
extern uint64_t kStartTsc; /* RII */
|
||||
extern char kTmpPath[]; /* RII */
|
||||
extern const char kNtSystemDirectory[]; /* RII */
|
||||
extern const char kNtWindowsDirectory[]; /* RII */
|
||||
extern size_t __virtualmax;
|
||||
extern bool __isworker;
|
||||
extern char **environ;
|
||||
extern char *program_invocation_name;
|
||||
extern char *program_invocation_short_name;
|
||||
|
||||
void mcount(void);
|
||||
int daemon(int, int);
|
||||
|
@ -83,6 +68,21 @@ int sethostname(const char *, size_t);
|
|||
int acct(const char *);
|
||||
|
||||
#ifdef COSMO
|
||||
extern int __argc;
|
||||
extern char **__argv;
|
||||
extern char **__envp;
|
||||
extern unsigned long *__auxv;
|
||||
extern intptr_t __oldstack;
|
||||
extern uint64_t __nosync;
|
||||
extern int __strace;
|
||||
extern int __ftrace;
|
||||
extern uint64_t __syscount;
|
||||
extern uint64_t kStartTsc;
|
||||
extern char kTmpPath[];
|
||||
extern const char kNtSystemDirectory[];
|
||||
extern const char kNtWindowsDirectory[];
|
||||
extern size_t __virtualmax;
|
||||
extern bool __isworker;
|
||||
/* utilities */
|
||||
void _intsort(int *, size_t);
|
||||
void _longsort(long *, size_t);
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "libc/errno.h"
|
||||
#include "libc/nexgen32e/msr.internal.h"
|
||||
#include "libc/nt/thread.h"
|
||||
#include "libc/sysv/consts/arch.h"
|
||||
#include "libc/thread/tls.h"
|
||||
#include "libc/thread/tls2.h"
|
||||
|
||||
|
@ -60,8 +61,10 @@ textstartup void __set_tls(struct CosmoTib *tib) {
|
|||
: "c"(MSR_IA32_FS_BASE), "a"((uint32_t)val),
|
||||
"d"((uint32_t)(val >> 32)));
|
||||
}
|
||||
#else
|
||||
#elif defined(__aarch64__)
|
||||
register long x28 asm("x28") = (long)tib;
|
||||
asm volatile("" : "+r"(x28));
|
||||
#else
|
||||
#error "unsupported architecture"
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue