mailing list of musl libc
 help / color / mirror / code / Atom feed
9da04059bbf94b12ac4dedb00e5548caddc70876 blob 1869 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
 
#include <stdint.h>

#define a_ctz_l a_ctz_l
static inline int a_ctz_l(unsigned long x)
{
  return __builtin_ctzl(x);
}

#define a_ctz_64 a_ctz_64
static inline int a_ctz_64(uint64_t x)
{
  return __builtin_ctzll(x);
}

#define a_and_64 a_and_64
static inline void a_and_64(volatile uint64_t *p, uint64_t v)
{
  // TODO use a WebAssembly CAS builtin, when those arrive with the threads feature
  //__atomic_fetch_and(p, v, __ATOMIC_SEQ_CST);
  *p &= v;
}

#define a_or_64 a_or_64
static inline void a_or_64(volatile uint64_t *p, uint64_t v)
{
  // TODO use a WebAssembly CAS builtin, when those arrive with the threads feature
  //__atomic_fetch_or(p, v, __ATOMIC_SEQ_CST);
  *p |= v;
}

#define a_cas a_cas
static inline int a_cas(volatile int *p, int t, int s)
{
  // TODO use a WebAssembly CAS builtin, when those arrive with the threads feature
  //__atomic_compare_exchange_n(p, &t, s, 0, __ATOMIC_SEQ_CST,
  //                            __ATOMIC_SEQ_CST);
  //return t;
  int old = *p;
  if (old == t)
    *p = s;
  return old;
}

#define a_swap a_swap
static inline int a_swap(volatile int *p, int v)
{
  // TODO use a WebAssembly CAS builtin, when those arrive with the threads feature
  //return __atomic_exchange_n(p, v, __ATOMIC_SEQ_CST);
  int old = *p;
  *p = v;
  return old;
}

#define a_store a_store
static inline void a_store(volatile int *p, int x)
{
  // TODO use a WebAssembly CAS builtin, when those arrive with the threads feature
  //__atomic_store(p, x, __ATOMIC_RELEASE);
  *p = x;
}

#define a_barrier a_barrier
static inline void a_barrier()
{
  // TODO use a WebAssembly CAS builtin, when those arrive with the threads feature
  //__atomic_thread_fence(__ATOMIC_SEQ_CST);
}

#define a_crash a_crash
static inline void a_crash()
{
  // This generates the Wasm "unreachable" instruction which traps when reached
  __builtin_unreachable();
}
debug log:

solving 9da04059 ...
found 9da04059 in https://inbox.vuxu.org/musl/VI1PR0502MB38851CB41BB1DA99B673004EE73A0@VI1PR0502MB3885.eurprd05.prod.outlook.com/

applying [1/1] https://inbox.vuxu.org/musl/VI1PR0502MB38851CB41BB1DA99B673004EE73A0@VI1PR0502MB3885.eurprd05.prod.outlook.com/
diff --git a/arch/wasm/atomic_arch.h b/arch/wasm/atomic_arch.h
new file mode 100644
index 00000000..9da04059

Checking patch arch/wasm/atomic_arch.h...
Applied patch arch/wasm/atomic_arch.h cleanly.

index at:
100644 9da04059bbf94b12ac4dedb00e5548caddc70876	arch/wasm/atomic_arch.h

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).