Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRodrigo Kumpera <kumpera@gmail.com>2013-07-15 20:30:03 +0400
committerRodrigo Kumpera <kumpera@gmail.com>2013-07-15 20:31:29 +0400
commit74639ebf72c6d4efed5c1dfe98d6118828b396df (patch)
tree062285d3590aad51430f3a7845216a7f76850705
parent588d52e20513b669f01370ff30c92bfaf8082042 (diff)
[runtime] Add a fallback on the TLS probing code that does a range scan in the pthread structure.
-rw-r--r--mono/utils/mach-support-arm.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/mono/utils/mach-support-arm.c b/mono/utils/mach-support-arm.c
index b30fc3e54d0..eb5fd603514 100644
--- a/mono/utils/mach-support-arm.c
+++ b/mono/utils/mach-support-arm.c
@@ -30,6 +30,11 @@ static const int known_tls_offsets[] = {
#define TLS_PROBE_COUNT (sizeof (known_tls_offsets) / sizeof (int))
+/* This is 2 slots less than the known low */
+#define TLS_PROBE_LOW_WATERMARK 0x40
+/* This is 24 slots above the know high, which is the same diff as the knowns high-low*/
+#define TLS_PROBE_HIGH_WATERMARK 0x108
+
static int tls_vector_offset;
void *
@@ -135,6 +140,15 @@ mono_mach_init (pthread_key_t key)
goto ok;
}
+ /*Fallback to scanning a large range of offsets*/
+ for (i = TLS_PROBE_LOW_WATERMARK; i <= TLS_PROBE_HIGH_WATERMARK; i += 4) {
+ tls_vector_offset = i;
+ if (mono_mach_arch_get_tls_value_from_thread (pthread_self (), key) == canary) {
+ g_warning ("Found new TLS offset at %d", i);
+ goto ok;
+ }
+ }
+
g_error ("could not discover the mach TLS offset");
ok:
pthread_setspecific (key, old_value);