mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 05:42:29 +00:00
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:
parent
91791e9f38
commit
550b52abf6
158 changed files with 6018 additions and 3499 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue