#ifndef DFSAN_PLATFORM_H
#define DFSAN_PLATFORM_H
#include "sanitizer_common/sanitizer_common.h"
#include "sanitizer_common/sanitizer_platform.h"
namespace __dfsan {
uptr;
struct MappingDesc { … };
#if SANITIZER_LINUX && SANITIZER_WORDSIZE == 64
# if defined(__aarch64__)
const MappingDesc kMemoryLayout[] = {
{0X0000000000000, 0X0100000000000, MappingDesc::APP, "app-10-13"},
{0X0100000000000, 0X0200000000000, MappingDesc::SHADOW, "shadow-14"},
{0X0200000000000, 0X0300000000000, MappingDesc::INVALID, "invalid"},
{0X0300000000000, 0X0400000000000, MappingDesc::ORIGIN, "origin-14"},
{0X0400000000000, 0X0600000000000, MappingDesc::SHADOW, "shadow-15"},
{0X0600000000000, 0X0800000000000, MappingDesc::ORIGIN, "origin-15"},
{0X0800000000000, 0X0A00000000000, MappingDesc::INVALID, "invalid"},
{0X0A00000000000, 0X0B00000000000, MappingDesc::APP, "app-14"},
{0X0B00000000000, 0X0C00000000000, MappingDesc::SHADOW, "shadow-10-13"},
{0X0C00000000000, 0X0D00000000000, MappingDesc::INVALID, "invalid"},
{0X0D00000000000, 0X0E00000000000, MappingDesc::ORIGIN, "origin-10-13"},
{0X0E00000000000, 0X0E40000000000, MappingDesc::ALLOCATOR, "allocator"},
{0X0E40000000000, 0X1000000000000, MappingDesc::APP, "app-15"},
};
#define MEM_TO_SHADOW …
#define SHADOW_TO_ORIGIN …
# else
const MappingDesc kMemoryLayout[] = …;
#define MEM_TO_SHADOW(mem) …
#define SHADOW_TO_ORIGIN(mem) …
# endif
#else
# error "Unsupported platform"
#endif
const uptr kMemoryLayoutSize = …;
#define MEM_TO_ORIGIN(mem) …
#ifndef __clang__
__attribute__((optimize("unroll-loops")))
#endif
inline bool
addr_is_type(uptr addr, int mapping_types) { … }
#define MEM_IS_APP(mem) …
#define MEM_IS_SHADOW(mem) …
#define MEM_IS_ORIGIN(mem) …
}
#endif