diff options
Diffstat (limited to 'libsanitizer/sanitizer_common/sanitizer_common.h')
-rw-r--r-- | libsanitizer/sanitizer_common/sanitizer_common.h | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/libsanitizer/sanitizer_common/sanitizer_common.h b/libsanitizer/sanitizer_common/sanitizer_common.h index cddefd7ea09..e565b93af29 100644 --- a/libsanitizer/sanitizer_common/sanitizer_common.h +++ b/libsanitizer/sanitizer_common/sanitizer_common.h @@ -19,14 +19,24 @@ namespace __sanitizer { // Constants. -const uptr kWordSize = __WORDSIZE / 8; +const uptr kWordSize = SANITIZER_WORDSIZE / 8; const uptr kWordSizeInBits = 8 * kWordSize; -const uptr kPageSizeBits = 12; -const uptr kPageSize = 1UL << kPageSizeBits; +#if defined(__powerpc__) || defined(__powerpc64__) +// Current PPC64 kernels use 64K pages sizes, but they can be +// configured with 4K or even other sizes. +// We may want to use getpagesize() or sysconf(_SC_PAGESIZE) here rather than +// hardcoding the values, but today these values need to be compile-time +// constants. +const uptr kPageSize = 1UL << 16; +const uptr kCacheLineSize = 128; +const uptr kMmapGranularity = kPageSize; +#elif !defined(_WIN32) +const uptr kPageSize = 1UL << 12; const uptr kCacheLineSize = 64; -#ifndef _WIN32 const uptr kMmapGranularity = kPageSize; #else +const uptr kPageSize = 1UL << 12; +const uptr kCacheLineSize = 64; const uptr kMmapGranularity = 1UL << 16; #endif @@ -96,6 +106,7 @@ void SetLowLevelAllocateCallback(LowLevelAllocateCallback callback); // IO void RawWrite(const char *buffer); +bool PrintsToTty(); void Printf(const char *format, ...); void Report(const char *format, ...); void SetPrintfAndReportCallback(void (*callback)(const char *)); @@ -114,6 +125,7 @@ void *MapFileToMemory(const char *file_name, uptr *buff_size); // OS void DisableCoreDumper(); void DumpProcessMap(); +bool FileExists(const char *filename); const char *GetEnv(const char *name); const char *GetPwd(); void ReExec(); @@ -170,7 +182,7 @@ INLINE int ToLower(int c) { return (c >= 'A' && c <= 'Z') ? (c + 'a' - 'A') : c; } -#if __WORDSIZE == 64 +#if SANITIZER_WORDSIZE == 64 # define FIRST_32_SECOND_64(a, b) (b) #else # define FIRST_32_SECOND_64(a, b) (a) |