1 //===-- asan_mapping_myriad.h -----------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file is a part of AddressSanitizer, an address sanity checker.
11 // Myriad-specific definitions for ASan memory mapping.
12 //===----------------------------------------------------------------------===//
13 #ifndef ASAN_MAPPING_MYRIAD_H
14 #define ASAN_MAPPING_MYRIAD_H
16 #define RAW_ADDR(mem) ((mem) & ~kMyriadCacheBitMask32)
17 #define MEM_TO_SHADOW(mem) \
18 (((RAW_ADDR(mem) - kLowMemBeg) >> SHADOW_SCALE) + (SHADOW_OFFSET))
20 #define kLowMemBeg kMyriadMemoryOffset32
21 #define kLowMemEnd (SHADOW_OFFSET - 1)
23 #define kLowShadowBeg SHADOW_OFFSET
24 #define kLowShadowEnd MEM_TO_SHADOW(kLowMemEnd)
28 #define kHighShadowBeg 0
29 #define kHighShadowEnd 0
31 #define kMidShadowBeg 0
32 #define kMidShadowEnd 0
34 #define kShadowGapBeg (kLowShadowEnd + 1)
35 #define kShadowGapEnd kMyriadMemoryEnd32
37 #define kShadowGap2Beg 0
38 #define kShadowGap2End 0
40 #define kShadowGap3Beg 0
41 #define kShadowGap3End 0
45 static inline bool AddrIsInLowMem(uptr a
) {
46 PROFILE_ASAN_MAPPING();
48 return a
>= kLowMemBeg
&& a
<= kLowMemEnd
;
51 static inline bool AddrIsInLowShadow(uptr a
) {
52 PROFILE_ASAN_MAPPING();
54 return a
>= kLowShadowBeg
&& a
<= kLowShadowEnd
;
57 static inline bool AddrIsInMidMem(uptr a
) {
58 PROFILE_ASAN_MAPPING();
62 static inline bool AddrIsInMidShadow(uptr a
) {
63 PROFILE_ASAN_MAPPING();
67 static inline bool AddrIsInHighMem(uptr a
) {
68 PROFILE_ASAN_MAPPING();
72 static inline bool AddrIsInHighShadow(uptr a
) {
73 PROFILE_ASAN_MAPPING();
77 static inline bool AddrIsInShadowGap(uptr a
) {
78 PROFILE_ASAN_MAPPING();
80 return a
>= kShadowGapBeg
&& a
<= kShadowGapEnd
;
85 #endif // ASAN_MAPPING_MYRIAD_H