1 //===-- tsan_interface.cc -------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This file is a part of ThreadSanitizer (TSan), a race detector. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #include "tsan_interface.h" 15 #include "tsan_interface_ann.h" 16 #include "tsan_rtl.h" 17 18 #define CALLERPC ((uptr)__builtin_return_address(0)) 19 20 using namespace __tsan; // NOLINT 21 22 void __tsan_init() { 23 Initialize(cur_thread()); 24 } 25 26 void __tsan_read16(void *addr) { 27 MemoryRead(cur_thread(), CALLERPC, (uptr)addr, kSizeLog8); 28 MemoryRead(cur_thread(), CALLERPC, (uptr)addr + 8, kSizeLog8); 29 } 30 31 void __tsan_write16(void *addr) { 32 MemoryWrite(cur_thread(), CALLERPC, (uptr)addr, kSizeLog8); 33 MemoryWrite(cur_thread(), CALLERPC, (uptr)addr + 8, kSizeLog8); 34 } 35 36 void __tsan_acquire(void *addr) { 37 Acquire(cur_thread(), CALLERPC, (uptr)addr); 38 } 39 40 void __tsan_release(void *addr) { 41 Release(cur_thread(), CALLERPC, (uptr)addr); 42 } 43