Port a lot more code to AARCH64

- Introduce epoll_pwait()
- Rewrite -ftrapv and ffs() libraries in C code
- Use more FreeBSD code in math function library
- Get significantly more tests passing on qemu-aarch64
- Fix many Musl long double functions that were broken on AARCH64
This commit is contained in:
Justine Tunney 2023-05-14 09:32:15 -07:00
parent 91791e9f38
commit 550b52abf6
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
158 changed files with 6018 additions and 3499 deletions

View file

@ -1,5 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_NT_SYNCHRONIZATION_H_
#define COSMOPOLITAN_LIBC_NT_SYNCHRONIZATION_H_
#include "libc/intrin/atomic.h"
#include "libc/nt/struct/criticalsection.h"
#include "libc/nt/struct/filetime.h"
#include "libc/nt/struct/linkedlist.h"
@ -33,20 +34,13 @@ COSMOPOLITAN_C_START_
cosmopolitan § new technology » synchronization
*/
#define InterlockedAdd(PTR, VAL) \
({ \
typeof(*(PTR)) Res; \
typeof(Res) Val = (VAL); \
asm volatile("lock xadd\t%0,%1" : "=r"(Res), "+m"(*(PTR)) : "0"(Val)); \
Res + Val; \
})
static inline int32_t InterlockedAdd(int32_t volatile *p, int32_t x) {
return atomic_fetch_add((_Atomic(int32_t) *)p, x) + x;
}
#define InterlockedExchange(PTR, VAL) \
({ \
typeof(*(PTR)) Res = (VAL); \
asm volatile("xchg\t%0,%1" : "+r"(Res), "+m"(*(PTR))); \
Res; \
})
static inline int32_t InterlockedExchange(int32_t volatile *p, int32_t x) {
return atomic_exchange((_Atomic(int32_t) *)p, x);
}
typedef void (*NtTimerapcroutine)(void *lpArgToCompletionRoutine,
uint32_t dwTimerLowValue,