mailing list of musl libc
 help / color / mirror / code / Atom feed
99ce5f41f6be0969ef30ee68becb2e3c4f7fccba blob 2210 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
 
#include <stdint.h>
#include <elf.h>
#include "pthread_impl.h"
#include "libc.h"

#define HWCAP_TLS (1 << 15)

extern hidden const unsigned char
	__a_barrier_oldkuser[], __a_barrier_v6[], __a_barrier_v7[], __a_barrier_m[],
	__a_cas_v6[], __a_cas_v7[], __a_cas_m[], __a_cas_intmask_m[],
	__a_gettp_cp15[], __a_gettp_cp15_m[], __a_gettp_syscall_m[];

#define __a_barrier_kuser 0xffff0fa0
#define __a_barrier_oldkuser (uintptr_t)__a_barrier_oldkuser
#define __a_barrier_v6 (uintptr_t)__a_barrier_v6
#define __a_barrier_v7 (uintptr_t)__a_barrier_v7
#define __a_barrier_m (uintptr_t)__a_barrier_m

#define __a_cas_kuser 0xffff0fc0
#define __a_cas_v6 (uintptr_t)__a_cas_v6
#define __a_cas_v7 (uintptr_t)__a_cas_v7
#define __a_cas_m (uintptr_t)__a_cas_m
#define __a_cas_intmask_m (uintptr_t)__a_cas_intmask_m

#define __a_gettp_kuser 0xffff0fe0
#define __a_gettp_cp15 (uintptr_t)__a_gettp_cp15
#define __a_gettp_cp15_m (uintptr_t)__a_gettp_cp15_m
#define __a_gettp_syscall_m (uintptr_t)__a_gettp_syscall_m

extern hidden uintptr_t __a_barrier_ptr, __a_cas_ptr, __a_gettp_ptr;

int __set_thread_area(void *p)
{
#if __ARM_ARCH_PROFILE == 'M'
	__a_cas_ptr = __a_cas_m;
	__a_barrier_ptr = __a_barrier_m;

	if (__hwcap & HWCAP_TLS) {
		__a_gettp_ptr = __a_gettp_cp15_m;
	} else {
		size_t *aux;
		__a_gettp_ptr = __a_gettp_syscall_m;
		for (aux=libc.auxv; *aux; aux+=2) {
			if (*aux != AT_PLATFORM) continue;
			const char *s = (void *)aux[1];
			if (s[0]=='v' && s[1]=='6') {
				__a_cas_ptr = __a_cas_intmask_m;
				break;
			}
		}
	}
#elif !__ARM_ARCH_7A__ && !__ARM_ARCH_7R__ && __ARM_ARCH < 7
	if (__hwcap & HWCAP_TLS) {
		size_t *aux;
		__a_cas_ptr = __a_cas_v7;
		__a_barrier_ptr = __a_barrier_v7;
		for (aux=libc.auxv; *aux; aux+=2) {
			if (*aux != AT_PLATFORM) continue;
			const char *s = (void *)aux[1];
			if (s[0]!='v' || s[1]!='6' || s[2]-'0'<10u) break;
			__a_cas_ptr = __a_cas_v6;
			__a_barrier_ptr = __a_barrier_v6;
			break;
		}
	} else {
		int ver = *(int *)0xffff0ffc;
		__a_gettp_ptr = __a_gettp_kuser;
		__a_cas_ptr = __a_cas_kuser;
		__a_barrier_ptr = __a_barrier_kuser;
		if (ver < 2) a_crash();
		if (ver < 3) __a_barrier_ptr = __a_barrier_oldkuser;
	}
#endif
	return __syscall(0xf0005, p);
}
debug log:

solving 99ce5f41 ...
found 99ce5f41 in https://inbox.vuxu.org/musl/CALqyXLh0zwXPzvoBLaKx=jQx1eiQ22S2CSjsN47FntJAryst4w@mail.gmail.com/
found 09de65aa in https://git.vuxu.org/mirror/musl/
preparing index
index prepared:
100644 09de65aab04aa8a225d62515d74b61740a4ba8b7	src/thread/arm/__set_thread_area.c

applying [1/1] https://inbox.vuxu.org/musl/CALqyXLh0zwXPzvoBLaKx=jQx1eiQ22S2CSjsN47FntJAryst4w@mail.gmail.com/
diff --git a/src/thread/arm/__set_thread_area.c b/src/thread/arm/__set_thread_area.c
index 09de65aa..99ce5f41 100644

Checking patch src/thread/arm/__set_thread_area.c...
Applied patch src/thread/arm/__set_thread_area.c cleanly.

index at:
100644 99ce5f41f6be0969ef30ee68becb2e3c4f7fccba	src/thread/arm/__set_thread_area.c

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).