Work on magic numbers for aarch64

This commit is contained in:
Justine Tunney 2023-05-10 01:10:28 -07:00
parent 59766efd3e
commit 5a455eaa0b
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
2070 changed files with 4567 additions and 4200 deletions

View file

@ -47,13 +47,11 @@ typedef int init_f(int argc, char **argv, char **envp, unsigned long *auxv);
extern init_f __strace_init;
extern init_f *__init_array_start[] __attribute__((__weak__));
extern init_f *__init_array_end[] __attribute__((__weak__));
extern uintptr_t ape_idata_iat[] __attribute__((__weak__));
extern uintptr_t ape_idata_iatend[] __attribute__((__weak__));
extern pthread_mutex_t __mmi_lock_obj;
struct CosmoTib *tib;
void cosmo(long *sp) {
textstartup void cosmo(long *sp) {
int argc;
init_f **fp;
uintptr_t *pp;
@ -74,15 +72,11 @@ void cosmo(long *sp) {
// needed by kisdangerous()
__oldstack = (intptr_t)sp;
// make win32 imps noop
for (pp = ape_idata_iat; pp < ape_idata_iatend; ++pp) {
*pp = (uintptr_t)_missingno;
}
// initialize mmap() manager extremely early
_mmi.n = ARRAYLEN(_mmi.s);
_mmi.p = _mmi.s;
__mmi_lock_obj._type = PTHREAD_MUTEX_RECURSIVE;
InitializeFileDescriptors();
#ifdef SYSDEBUG
// initialize --strace functionality

View file

@ -90,7 +90,7 @@ _Alignas(TLS_ALIGNMENT) static char __static_tls[6016];
* arch_prctl() function. However, such programs might not be portable
* and your `errno` variable also won't be thread safe anymore.
*/
void __enable_tls(void) {
textstartup void __enable_tls(void) {
int tid;
size_t siz;
char *mem, *tls;

View file

@ -46,6 +46,7 @@ int __inflate(void *, size_t, const void *, size_t);
noasan void *_Mmap(void *addr, size_t size, int prot, int flags, int fd,
int64_t off) _Hide;
noasan int _Munmap(char *, size_t) _Hide;
void InitializeFileDescriptors(void);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

View file

@ -26,7 +26,7 @@
int sys_set_tls();
void __set_tls(struct CosmoTib *tib) {
textstartup void __set_tls(struct CosmoTib *tib) {
tib = __adj_tls(tib);
#ifdef __x86_64__
// ask the operating system to change the x86 segment register