2 * Copyright (c) 2016 Apple Inc. All rights reserved.
12 struct vm_range s_range
;
13 native_segment_command_t s_segcmd
;
14 const struct libent
*s_libent
;
18 #define S_RANGE(s) (&(s)->s_range)
20 static __inline
void S_SETADDR(struct subregion
*s
, mach_vm_offset_t a
) {
21 V_SETADDR(S_RANGE(s
), a
);
24 static __inline
void S_SETSIZE(struct subregion
*s
, mach_vm_offset_t sz
) {
25 V_SETSIZE(S_RANGE(s
), sz
);
28 static __inline
const mach_vm_offset_t
S_ADDR(const struct subregion
*s
) {
29 return V_ADDR(S_RANGE(s
));
32 static __inline
const mach_vm_offset_t
S_SIZE(const struct subregion
*s
) {
33 return V_SIZE(S_RANGE(s
));
36 static __inline
const mach_vm_offset_t
S_ENDADDR(const struct subregion
*s
) {
37 return S_ADDR(s
) + S_SIZE(s
);
40 static __inline
const char *S_MACHO_TYPE(const struct subregion
*s
) {
41 return s
->s_segcmd
.segname
;
44 static __inline off_t
S_MACHO_FILEOFF(const struct subregion
*s
) {
45 return s
->s_segcmd
.fileoff
;
48 static __inline off_t
S_MACHO_FILESIZE(const struct subregion
*s
) {
49 return s
->s_segcmd
.filesize
;
52 static __inline
const struct libent
*S_LIBENT(const struct subregion
*s
) {
56 static __inline
const char *S_PATHNAME(const struct subregion
*s
) {
57 const struct libent
*le
= S_LIBENT(s
);
58 return le
? le
->le_pathname
: "(unknown)";
61 static __inline
const char *S_FILENAME(const struct subregion
*s
) {
62 const struct libent
*le
= S_LIBENT(s
);
63 return le
? le
->le_filename
: S_PATHNAME(s
);
66 extern bool issubregiontype(const struct subregion
*, const char *);
68 extern walk_region_cbfn_t decorate_memory_region
;
69 extern walk_region_cbfn_t undecorate_memory_region
;
70 extern walk_region_cbfn_t sparse_region_optimization
;
72 #endif /* _SPARSE_H */