MCPcopy Create free account
hub / github.com/dmtcp/dmtcp / TLSInfo_HaveThreadSysinfoOffset

Function TLSInfo_HaveThreadSysinfoOffset

src/tls.cpp:429–456  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

427#define DEFAULT_SYSINFO_OFFSET "0x10"
428
429int
430TLSInfo_HaveThreadSysinfoOffset()
431{
432#ifdef RESET_THREAD_SYSINFO
433 static int result = -1; // Reset to 0 or 1 on first call.
434#else /* ifdef RESET_THREAD_SYSINFO */
435 static int result = 0;
436#endif /* ifdef RESET_THREAD_SYSINFO */
437 if (result == -1) {
438 void *sysinfo;
439#if defined(__i386__) || defined(__x86_64__)
440 asm volatile (CLEAN_FOR_64_BIT(mov %%
441 gs:) DEFAULT_SYSINFO_OFFSET ", %0\n\t"
442 : "=r" (sysinfo));
443#elif defined(__arm__)
444 asm volatile ("mrc p15, 0, %0, c13, c0, 3 @ load_tp_hard\n\t"
445 : "=r" (sysinfo));
446#elif defined(__aarch64__)
447 asm volatile ("mrs %0, tpidr_el0" : "=r" (sysinfo));
448#elif defined(__riscv)
449 asm volatile("addi %0, tp, 0" : "=r" (sysinfo));
450#else /* if defined(__i386__) || defined(__x86_64__) */
451# error "current architecture not supported"
452#endif /* if defined(__i386__) || defined(__x86_64__) */
453 result = (sysinfo == get_at_sysinfo());
454 }
455 return result;
456}
457
458// AT_SYSINFO is what kernel calls sysenter address in vdso segment.
459// Kernel saves it for each thread in %gs:SYSINFO_OFFSET ??

Callers 3

writeCkptMethod · 0.85
postRestartWorkMethod · 0.85
restarthreadFunction · 0.85

Calls 1

get_at_sysinfoFunction · 0.70

Tested by

no test coverage detected