]> git.proxmox.com Git - rustc.git/blob - src/compiler-rt/lib/tsan/rtl/tsan_interface.h
Imported Upstream version 1.0.0~0alpha
[rustc.git] / src / compiler-rt / lib / tsan / rtl / tsan_interface.h
1 //===-- tsan_interface.h ----------------------------------------*- C++ -*-===//
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 // The functions declared in this header will be inserted by the instrumentation
13 // module.
14 // This header can be included by the instrumented program or by TSan tests.
15 //===----------------------------------------------------------------------===//
16 #ifndef TSAN_INTERFACE_H
17 #define TSAN_INTERFACE_H
18
19 #include <sanitizer_common/sanitizer_internal_defs.h>
20
21 // This header should NOT include any other headers.
22 // All functions in this header are extern "C" and start with __tsan_.
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 // This function should be called at the very beginning of the process,
29 // before any instrumented code is executed and before any call to malloc.
30 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_init();
31
32 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_read1(void *addr);
33 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_read2(void *addr);
34 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_read4(void *addr);
35 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_read8(void *addr);
36 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_read16(void *addr);
37
38 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_write1(void *addr);
39 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_write2(void *addr);
40 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_write4(void *addr);
41 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_write8(void *addr);
42 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_write16(void *addr);
43
44 SANITIZER_INTERFACE_ATTRIBUTE u16 __tsan_unaligned_read2(const uu16 *addr);
45 SANITIZER_INTERFACE_ATTRIBUTE u32 __tsan_unaligned_read4(const uu32 *addr);
46 SANITIZER_INTERFACE_ATTRIBUTE u64 __tsan_unaligned_read8(const uu64 *addr);
47 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_unaligned_write2(uu16 *addr, u16 v);
48 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_unaligned_write4(uu32 *addr, u32 v);
49 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_unaligned_write8(uu64 *addr, u64 v);
50
51 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_vptr_read(void **vptr_p);
52 SANITIZER_INTERFACE_ATTRIBUTE
53 void __tsan_vptr_update(void **vptr_p, void *new_val);
54
55 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_func_entry(void *call_pc);
56 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_func_exit();
57
58 SANITIZER_INTERFACE_ATTRIBUTE
59 void __tsan_read_range(void *addr, unsigned long size); // NOLINT
60 SANITIZER_INTERFACE_ATTRIBUTE
61 void __tsan_write_range(void *addr, unsigned long size); // NOLINT
62
63 #ifdef __cplusplus
64 } // extern "C"
65 #endif
66
67 #endif // TSAN_INTERFACE_H