mailing list of musl libc
 help / color / mirror / code / Atom feed
262ad6a8d85827050307dfc32802df85eeb0a74a blob 3649 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
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
 
#define a_ctz_32 a_ctz_32
static inline int a_ctz_32(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_clz_64 a_clz_64
static inline int a_clz_64(uint64_t x)
{
	return __builtin_clzll(x);
}

#define a_cas a_cas
static inline int a_cas(volatile int *p, int t, int s)
{
	int dummy;
	__asm__ __volatile__(
		"1:	%0 = memw_locked(%1)\n\t"
		"	{ p0 = cmp.eq(%0, %2)\n\t"
		"	  if (!p0.new) jump:nt 2f }\n\t"
		"	memw_locked(%1, p0) = %3\n\t"
		"	if (!p0) jump 1b\n\t"
		"2:	\n\t"
		: "=&r"(dummy)
		: "r"(p), "r"(t), "r"(s)
		: "p0", "memory" );
        return dummy;
}

#define a_cas_p a_cas_p
static inline void *a_cas_p(volatile void *p, void *t, void *s)
{
	return (void *)a_cas(p, (int)t, (int)s);
}

#define a_swap a_swap
static inline int a_swap(volatile int *x, int v)
{
	int old, dummy;
	__asm__ __volatile__(
		"	%1 = %3\n\t"
		"1:	%0 = memw_locked(%2)\n\t"
		"	memw_locked(%2, p0) = %1\n\t"
		"	if (!p0) jump 1b\n\t"
		: "=&r"(old), "=&r"(dummy)
		: "r"(x), "r"(v)
		: "p0", "memory" );
        return old;
}

#define a_fetch_add a_fetch_add
static inline int a_fetch_add(volatile int *x, int v)
{
	int old, dummy;
	__asm__ __volatile__(
		"1:	%0 = memw_locked(%2)\n\t"
		"	%1 = add(%0, %3)\n\t"
		"	memw_locked(%2, p0) = %1\n\t"
		"	if (!p0) jump 1b\n\t"
		: "=&r"(old), "=&r"(dummy)
		: "r"(x), "r"(v)
		: "p0", "memory" );
        return old;
}

#define a_inc a_inc
static inline void a_inc(volatile int *x)
{
	a_fetch_add(x, 1);
}

#define a_dec a_dec
static inline void a_dec(volatile int *x)
{
	int dummy;
	__asm__ __volatile__(
		"1:	%0 = memw_locked(%1)\n\t"
		"	%0 = add(%0, #-1)\n\t"
		"	memw_locked(%1, p0) = %0\n\t"
		"	if (!p0) jump 1b\n\t"
		: "=&r"(dummy)
		: "r"(x)
		: "p0", "memory" );
}

#define a_store a_store
static inline void a_store(volatile int *p, int x)
{
	int dummy;
	__asm__ __volatile__(
		"1:	%0 = memw_locked(%1)\n\t"
		"	memw_locked(%1, p0) = %2\n\t"
		"	if (!p0) jump 1b\n\t"
		: "=&r"(dummy)
		: "r"(p), "r"(x)
		: "p0", "memory" );
}

#define a_barrier a_barrier
static inline void a_barrier()
{
	__asm__ __volatile__ ("barrier" ::: "memory");
}
#define a_spin a_spin
static inline void a_spin()
{
	__asm__ __volatile__ ("pause(#255)" :::);
}

#define a_crash a_crash
static inline void a_crash()
{
	*(volatile char *)0=0;
}

#define a_and a_and
static inline void a_and(volatile int *p, int v)
{
	int dummy;
	__asm__ __volatile__(
		"1:	%0 = memw_locked(%1)\n\t"
		"	%0 = and(%0, %2)\n\t"
		"	memw_locked(%1, p0) = %0\n\t"
		"	if (!p0) jump 1b\n\t"
		: "=&r"(dummy)
		: "r"(p), "r"(v)
		: "p0", "memory" );
}

#define  a_or a_or
static inline void a_or(volatile int *p, int v)
{
	int dummy;
	__asm__ __volatile__(
		"1:	%0 = memw_locked(%1)\n\t"
		"	%0 = or(%0, %2)\n\t"
		"	memw_locked(%1, p0) = %0\n\t"
		"	if (!p0) jump 1b\n\t"
		: "=&r"(dummy)
		: "r"(p), "r"(v)
		: "p0", "memory" );
}

#define a_or_l a_or_l
static inline void a_or_l(volatile void *p, long v)
{
	a_or(p, v);
}

#define a_and_64 a_and_64
static inline void a_and_64(volatile uint64_t *p, uint64_t v)
{
	uint64_t dummy;
	__asm__ __volatile__(
		"1:	%0 = memd_locked(%1)\n\t"
		"	%0 = and(%0, %2)\n\t"
		"	memd_locked(%1, p0) = %0\n\t"
		"	if (!p0) jump 1b\n\t"
		: "=&r"(dummy)
		: "r"(p), "r"(v)
		: "p0", "memory" );
}

#define  a_or_64 a_or_64
static inline void a_or_64(volatile uint64_t *p, uint64_t v)
{
	uint64_t dummy;
	__asm__ __volatile__(
		"1:	%0 = memd_locked(%1)\n\t"
		"	%0 = or(%0, %2)\n\t"
		"	memd_locked(%1, p0) = %0\n\t"
		"	if (!p0) jump 1b\n\t"
		: "=&r"(dummy)
		: "r"(p), "r"(v)
		: "p0", "memory" );
}

debug log:

solving 262ad6a8 ...
found 262ad6a8 in https://inbox.vuxu.org/musl/073501d68d42$4a8c6080$dfa52180$@codeaurora.org/

applying [1/1] https://inbox.vuxu.org/musl/073501d68d42$4a8c6080$dfa52180$@codeaurora.org/
diff --git a/arch/hexagon/atomic_arch.h b/arch/hexagon/atomic_arch.h
new file mode 100644
index 00000000..262ad6a8

Checking patch arch/hexagon/atomic_arch.h...
1:188: new blank line at EOF.
+
Applied patch arch/hexagon/atomic_arch.h cleanly.
warning: 1 line adds whitespace errors.

index at:
100644 262ad6a8d85827050307dfc32802df85eeb0a74a	arch/hexagon/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).