1*7c3d14c8STreehugger Robot //===-- esan.h --------------------------------------------------*- C++ -*-===// 2*7c3d14c8STreehugger Robot // 3*7c3d14c8STreehugger Robot // The LLVM Compiler Infrastructure 4*7c3d14c8STreehugger Robot // 5*7c3d14c8STreehugger Robot // This file is distributed under the University of Illinois Open Source 6*7c3d14c8STreehugger Robot // License. See LICENSE.TXT for details. 7*7c3d14c8STreehugger Robot // 8*7c3d14c8STreehugger Robot //===----------------------------------------------------------------------===// 9*7c3d14c8STreehugger Robot // 10*7c3d14c8STreehugger Robot // This file is a part of EfficiencySanitizer, a family of performance tuners. 11*7c3d14c8STreehugger Robot // 12*7c3d14c8STreehugger Robot // Main internal esan header file. 13*7c3d14c8STreehugger Robot // 14*7c3d14c8STreehugger Robot // Ground rules: 15*7c3d14c8STreehugger Robot // - C++ run-time should not be used (static CTORs, RTTI, exceptions, static 16*7c3d14c8STreehugger Robot // function-scope locals) 17*7c3d14c8STreehugger Robot // - All functions/classes/etc reside in namespace __esan, except for those 18*7c3d14c8STreehugger Robot // declared in esan_interface_internal.h. 19*7c3d14c8STreehugger Robot // - Platform-specific files should be used instead of ifdefs (*). 20*7c3d14c8STreehugger Robot // - No system headers included in header files (*). 21*7c3d14c8STreehugger Robot // - Platform specific headers included only into platform-specific files (*). 22*7c3d14c8STreehugger Robot // 23*7c3d14c8STreehugger Robot // (*) Except when inlining is critical for performance. 24*7c3d14c8STreehugger Robot //===----------------------------------------------------------------------===// 25*7c3d14c8STreehugger Robot 26*7c3d14c8STreehugger Robot #ifndef ESAN_H 27*7c3d14c8STreehugger Robot #define ESAN_H 28*7c3d14c8STreehugger Robot 29*7c3d14c8STreehugger Robot #include "interception/interception.h" 30*7c3d14c8STreehugger Robot #include "sanitizer_common/sanitizer_common.h" 31*7c3d14c8STreehugger Robot #include "esan_interface_internal.h" 32*7c3d14c8STreehugger Robot 33*7c3d14c8STreehugger Robot namespace __esan { 34*7c3d14c8STreehugger Robot 35*7c3d14c8STreehugger Robot extern bool EsanIsInitialized; 36*7c3d14c8STreehugger Robot extern bool EsanDuringInit; 37*7c3d14c8STreehugger Robot 38*7c3d14c8STreehugger Robot void initializeLibrary(ToolType Tool); 39*7c3d14c8STreehugger Robot int finalizeLibrary(); 40*7c3d14c8STreehugger Robot void reportResults(); 41*7c3d14c8STreehugger Robot // Esan creates the variable per tool per compilation unit at compile time 42*7c3d14c8STreehugger Robot // and passes its pointer Ptr to the runtime library. 43*7c3d14c8STreehugger Robot void processCompilationUnitInit(void *Ptr); 44*7c3d14c8STreehugger Robot void processCompilationUnitExit(void *Ptr); 45*7c3d14c8STreehugger Robot void processRangeAccess(uptr PC, uptr Addr, int Size, bool IsWrite); 46*7c3d14c8STreehugger Robot void initializeInterceptors(); 47*7c3d14c8STreehugger Robot 48*7c3d14c8STreehugger Robot // Platform-dependent routines. 49*7c3d14c8STreehugger Robot void verifyAddressSpace(); 50*7c3d14c8STreehugger Robot bool fixMmapAddr(void **Addr, SIZE_T Size, int Flags); 51*7c3d14c8STreehugger Robot uptr checkMmapResult(uptr Addr, SIZE_T Size); 52*7c3d14c8STreehugger Robot // The return value indicates whether to call the real version or not. 53*7c3d14c8STreehugger Robot bool processSignal(int SigNum, void (*Handler)(int), void (**Result)(int)); 54*7c3d14c8STreehugger Robot bool processSigaction(int SigNum, const void *Act, void *OldAct); 55*7c3d14c8STreehugger Robot bool processSigprocmask(int How, void *Set, void *OldSet); 56*7c3d14c8STreehugger Robot 57*7c3d14c8STreehugger Robot } // namespace __esan 58*7c3d14c8STreehugger Robot 59*7c3d14c8STreehugger Robot #endif // ESAN_H 60