]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/compiler-rt/lib/esan/esan.h
Merge ACPICA 20170929.
[FreeBSD/FreeBSD.git] / contrib / compiler-rt / lib / esan / esan.h
1 //===-- esan.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 EfficiencySanitizer, a family of performance tuners.
11 //
12 // Main internal esan header file.
13 //
14 // Ground rules:
15 //   - C++ run-time should not be used (static CTORs, RTTI, exceptions, static
16 //     function-scope locals)
17 //   - All functions/classes/etc reside in namespace __esan, except for those
18 //     declared in esan_interface_internal.h.
19 //   - Platform-specific files should be used instead of ifdefs (*).
20 //   - No system headers included in header files (*).
21 //   - Platform specific headers included only into platform-specific files (*).
22 //
23 //  (*) Except when inlining is critical for performance.
24 //===----------------------------------------------------------------------===//
25
26 #ifndef ESAN_H
27 #define ESAN_H
28
29 #include "interception/interception.h"
30 #include "sanitizer_common/sanitizer_common.h"
31 #include "esan_interface_internal.h"
32
33 namespace __esan {
34
35 extern bool EsanIsInitialized;
36 extern bool EsanDuringInit;
37 extern uptr VmaSize;
38
39 void initializeLibrary(ToolType Tool);
40 int finalizeLibrary();
41 void reportResults();
42 unsigned int getSampleCount();
43 // Esan creates the variable per tool per compilation unit at compile time
44 // and passes its pointer Ptr to the runtime library.
45 void processCompilationUnitInit(void *Ptr);
46 void processCompilationUnitExit(void *Ptr);
47 void processRangeAccess(uptr PC, uptr Addr, int Size, bool IsWrite);
48 void initializeInterceptors();
49
50 // Platform-dependent routines.
51 void verifyAddressSpace();
52 bool fixMmapAddr(void **Addr, SIZE_T Size, int Flags);
53 uptr checkMmapResult(uptr Addr, SIZE_T Size);
54 // The return value indicates whether to call the real version or not.
55 bool processSignal(int SigNum, void (*Handler)(int), void (**Result)(int));
56 bool processSigaction(int SigNum, const void *Act, void *OldAct);
57 bool processSigprocmask(int How, void *Set, void *OldSet);
58
59 } // namespace __esan
60
61 #endif // ESAN_H