Namespaces
Enumerations
enum Type
| Name | Value |
|---|---|
| kFreeRam | ZBI_MEM_TYPE_RAM |
| kPeripheral | ZBI_MEM_TYPE_PERIPHERAL |
| kReserved | ZBI_MEM_TYPE_RESERVED |
| kPoolBookkeeping | kMinAllocatedTypeValue |
| kPhysKernel | 4294967297 |
| kPhysElf | 4294967298 |
| kPhysLog | 4294967299 |
| kKernel | 4294967300 |
| kKernelStorage | 4294967301 |
| kDataZbi | 4294967302 |
| kTemporaryPhysHandoff | 4294967303 |
| kPermanentPhysHandoff | 4294967304 |
| kVdso | 4294967305 |
| kUserboot | 4294967306 |
| kBootMachineStack | 4294967307 |
| kBootShadowCallStack | 4294967308 |
| kBootUnsafeStack | 4294967309 |
| kTrampolineStagingKernel | 4294967310 |
| kTrampolineStagingDataZbi | 4294967311 |
| kLegacyBootData | 4294967312 |
| kTemporaryIdentityPageTables | 4294967313 |
| kKernelPageTables | 4294967314 |
| kPhysDebugdata | 4294967315 |
| kDevicetreeBlob | 4294967316 |
| kPhysScratch | 4294967317 |
| kPoolTestPayload | 4294967318 |
| kZbiTestPayload | 4294967319 |
| kTestRamReserve | 4294967320 |
| kNvram | 4294967321 |
| kReservedLow | 4294967322 |
| kTruncatedRam | 4294967323 |
| kMaxAllocated | 4294967324 |
The type of a physical memory range. Represented by 64 bits, the lower 2^32
values in the space are reserved for memory range types defined in the ZBI
spec, the "base types"; the types in the upper half are referred to as
"allocated types", and increment from kMinAllocatedTypeValue in value.
As is detailed in the ZBI spec regarding overlaps, among the base types,
kReserved and kPeripheral ranges have the highest precedence, in that order.
Further, by definition here, an allocated type is only permitted to overlap
with kFreeRam or the same type.
Defined at line 36 of file ../../zircon/kernel/phys/lib/memalloc/include/lib/memalloc/range.h
Records
Functions
-
std::ostream & operator<< (std::ostream & stream, Range range)Enables Range auto-stringification in gtest error messages
Defined at line 23 of file ../../zircon/kernel/phys/lib/memalloc/include/lib/memalloc/testing/range.h
-
void FindNormalizedRamRanges (RangeStream ranges, RangeCallback cb)Say a range among a set is "normalized" if it does not intersect with any of
them and it is maximally contiguous. This routine finds the normalized RAM
ranges among a provided set with a degree of arbitrary intersection with one
another. The range is emitted by passing it to a callback for processing.
If the callback returns false, then the routine will exit early.
The span of ranges will be reordered, but otherwise will be preserved.
This function runs in O(n*log(n)) time, where n is the total number of given
ranges.
Defined at line 205 of file ../../zircon/kernel/phys/lib/memalloc/algorithm.cc
-
void FindNormalizedRamRanges (RangeStream ranges, RangeCallback cb)Say a range among a set is "normalized" if it does not intersect with any of
them and it is maximally contiguous. This routine finds the normalized RAM
ranges among a provided set with a degree of arbitrary intersection with one
another. The range is emitted by passing it to a callback for processing.
If the callback returns false, then the routine will exit early.
The span of ranges will be reordered, but otherwise will be preserved.
This function runs in O(n*log(n)) time, where n is the total number of given
ranges.
Defined at line 205 of file ../../zircon/kernel/phys/lib/memalloc/algorithm.cc
-
void FindNormalizedRamRanges (RangeStream ranges, RangeCallback cb)Say a range among a set is "normalized" if it does not intersect with any of
them and it is maximally contiguous. This routine finds the normalized RAM
ranges among a provided set with a degree of arbitrary intersection with one
another. The range is emitted by passing it to a callback for processing.
If the callback returns false, then the routine will exit early.
The span of ranges will be reordered, but otherwise will be preserved.
This function runs in O(n*log(n)) time, where n is the total number of given
ranges.
Defined at line 205 of file ../../zircon/kernel/phys/lib/memalloc/algorithm.cc
-
void FindNormalizedRamRanges (RangeStream ranges, RangeCallback cb)Say a range among a set is "normalized" if it does not intersect with any of
them and it is maximally contiguous. This routine finds the normalized RAM
ranges among a provided set with a degree of arbitrary intersection with one
another. The range is emitted by passing it to a callback for processing.
If the callback returns false, then the routine will exit early.
The span of ranges will be reordered, but otherwise will be preserved.
This function runs in O(n*log(n)) time, where n is the total number of given
ranges.
Defined at line 205 of file ../../zircon/kernel/phys/lib/memalloc/algorithm.cc
-
fit::result<fit::failed> FindNormalizedRanges (RangeStream ranges, std::span<void *> scratch, RangeCallback cb)A variant of the above algorithm that finds all of the normalized ranges in
order. It also runs in O(n*log(n)) time but with O(n) space. In particular,
a void* buffer of scratch of size `FindNormalizedRangesScratchSize()` must
be provided.
Ranges may overlap only if they are of the same type or one type is
kFreeRam; otherwise fit::failed is returned.
Defined at line 284 of file ../../zircon/kernel/phys/lib/memalloc/algorithm.cc
-
fit::result<fit::failed> FindNormalizedRanges (RangeStream ranges, std::span<void *> scratch, RangeCallback cb)A variant of the above algorithm that finds all of the normalized ranges in
order. It also runs in O(n*log(n)) time but with O(n) space. In particular,
a void* buffer of scratch of size `FindNormalizedRangesScratchSize()` must
be provided.
Ranges may overlap only if they are of the same type or one type is
kFreeRam; otherwise fit::failed is returned.
Defined at line 284 of file ../../zircon/kernel/phys/lib/memalloc/algorithm.cc
-
fit::result<fit::failed> FindNormalizedRanges (RangeStream ranges, std::span<void *> scratch, RangeCallback cb)A variant of the above algorithm that finds all of the normalized ranges in
order. It also runs in O(n*log(n)) time but with O(n) space. In particular,
a void* buffer of scratch of size `FindNormalizedRangesScratchSize()` must
be provided.
Ranges may overlap only if they are of the same type or one type is
kFreeRam; otherwise fit::failed is returned.
Defined at line 284 of file ../../zircon/kernel/phys/lib/memalloc/algorithm.cc
-
fit::result<fit::failed> FindNormalizedRanges (RangeStream ranges, std::span<void *> scratch, RangeCallback cb)A variant of the above algorithm that finds all of the normalized ranges in
order. It also runs in O(n*log(n)) time but with O(n) space. In particular,
a void* buffer of scratch of size `FindNormalizedRangesScratchSize()` must
be provided.
Ranges may overlap only if they are of the same type or one type is
kFreeRam; otherwise fit::failed is returned.
Defined at line 284 of file ../../zircon/kernel/phys/lib/memalloc/algorithm.cc
-
std::string_view ToString (Type type)Defined at line 31 of file ../../zircon/kernel/phys/lib/memalloc/range.cc
-
void FindNormalizedRamRanges (std::span<Range> ranges, RangeCallback cb)Used for streamlined testing.
Defined at line 74 of file ../../zircon/kernel/phys/lib/memalloc/algorithm.h
-
void FindNormalizedRamRanges (std::span<Range> ranges, RangeCallback cb)Used for streamlined testing.
Defined at line 74 of file ../../zircon/kernel/phys/lib/memalloc/algorithm.h
-
void FindNormalizedRamRanges (std::span<Range> ranges, RangeCallback cb)Used for streamlined testing.
Defined at line 74 of file ../../zircon/kernel/phys/lib/memalloc/algorithm.h
-
void FindNormalizedRamRanges (std::span<Range> ranges, RangeCallback cb)Used for streamlined testing.
Defined at line 74 of file ../../zircon/kernel/phys/lib/memalloc/algorithm.h
-
size_t FindNormalizedRangesScratchSize (size_t n)The size of tne void* scratch space needed for FindNormalizedRanges() below,
where `n` is the size of the input RangeStream.
Defined at line 81 of file ../../zircon/kernel/phys/lib/memalloc/algorithm.h
-
size_t FindNormalizedRangesScratchSize (size_t n)The size of tne void* scratch space needed for FindNormalizedRanges() below,
where `n` is the size of the input RangeStream.
Defined at line 81 of file ../../zircon/kernel/phys/lib/memalloc/algorithm.h
-
size_t FindNormalizedRangesScratchSize (size_t n)The size of tne void* scratch space needed for FindNormalizedRanges() below,
where `n` is the size of the input RangeStream.
Defined at line 81 of file ../../zircon/kernel/phys/lib/memalloc/algorithm.h
-
fit::result<fit::failed> FindNormalizedRanges (std::span<Range> ranges, std::span<void *> scratch, RangeCallback cb)Used for streamlined testing.
Defined at line 94 of file ../../zircon/kernel/phys/lib/memalloc/algorithm.h
-
fit::result<fit::failed> FindNormalizedRanges (std::span<Range> ranges, std::span<void *> scratch, RangeCallback cb)Used for streamlined testing.
Defined at line 94 of file ../../zircon/kernel/phys/lib/memalloc/algorithm.h
-
fit::result<fit::failed> FindNormalizedRanges (std::span<Range> ranges, std::span<void *> scratch, RangeCallback cb)Used for streamlined testing.
Defined at line 94 of file ../../zircon/kernel/phys/lib/memalloc/algorithm.h
-
fit::result<fit::failed> FindNormalizedRanges (std::span<Range> ranges, std::span<void *> scratch, RangeCallback cb)Used for streamlined testing.
Defined at line 94 of file ../../zircon/kernel/phys/lib/memalloc/algorithm.h
-
std::span<Range> AsRanges (std::span<zbi_mem_range_t> ranges)We have constrained Type so that the ZBI memory type's value space
identically embeds into the lower 2^32 values of Type; the upper 2^32 values
is reserved for Type's extensions. Accordingly, in order to coherently
recast a zbi_mem_range_t as a Range, the former's `reserved` field -
which, layout-wise, corresponds to the upper half of Type - must be zeroed
out.
Defined at line 103 of file ../../zircon/kernel/phys/lib/memalloc/range.cc
-
std::span<Range> AsRanges (std::span<zbi_mem_range_t> ranges)We have constrained Type so that the ZBI memory type's value space
identically embeds into the lower 2^32 values of Type; the upper 2^32 values
is reserved for Type's extensions. Accordingly, in order to coherently
recast a zbi_mem_range_t as a Range, the former's `reserved` field -
which, layout-wise, corresponds to the upper half of Type - must be zeroed
out.
Defined at line 103 of file ../../zircon/kernel/phys/lib/memalloc/range.cc
-
std::span<Range> AsRanges (std::span<zbi_mem_range_t> ranges)We have constrained Type so that the ZBI memory type's value space
identically embeds into the lower 2^32 values of Type; the upper 2^32 values
is reserved for Type's extensions. Accordingly, in order to coherently
recast a zbi_mem_range_t as a Range, the former's `reserved` field -
which, layout-wise, corresponds to the upper half of Type - must be zeroed
out.
Defined at line 103 of file ../../zircon/kernel/phys/lib/memalloc/range.cc
-
std::span<Range> AsRanges (std::span<zbi_mem_range_t> ranges)We have constrained Type so that the ZBI memory type's value space
identically embeds into the lower 2^32 values of Type; the upper 2^32 values
is reserved for Type's extensions. Accordingly, in order to coherently
recast a zbi_mem_range_t as a Range, the former's `reserved` field -
which, layout-wise, corresponds to the upper half of Type - must be zeroed
out.
Defined at line 103 of file ../../zircon/kernel/phys/lib/memalloc/range.cc
-
bool IsAllocatedType (Type type)Defined at line 157 of file ../../zircon/kernel/phys/lib/memalloc/include/lib/memalloc/range.h
-
bool IsRamType (Type type)Defined at line 161 of file ../../zircon/kernel/phys/lib/memalloc/include/lib/memalloc/range.h
-
template <class Ranges, typename RangeCallback, typename NormalizeTypeFn>void NormalizeRanges (Ranges && ranges, RangeCallback && cb, NormalizeTypeFn && normalize_type)Gives a custom, normalized view of a container of ranges, `Ranges`.
`NormalizeTypeFn` is a callable with signature `std::optional
<Type
>(Type)`:
std::nullopt indicates that ranges of this type should not be passed to the
callback; otherwise, the returned type is indicates how the input type should
be normalized. Adjacent ranges of the same normalized type are merged before
being passed to the callback.
The callback itself is expected to return a boolean indicating whether it
should continue to be called.
Defined at line 210 of file ../../zircon/kernel/phys/lib/memalloc/include/lib/memalloc/range.h
-
template <class Ranges, typename RangeCallback>void NormalizeRam (Ranges && ranges, RangeCallback && cb)Provides a callback with a normalized view of RAM ranges alone, reducing
any allocated types as kFreeRam.
Defined at line 246 of file ../../zircon/kernel/phys/lib/memalloc/include/lib/memalloc/range.h
-
template <class Ranges>void PrintRanges (Ranges && ranges, const char * prefix, FILE * f)Pretty-prints the contents in a given Range container.
Defined at line 264 of file ../../zircon/kernel/phys/lib/memalloc/include/lib/memalloc/range.h
-
template <class Ranges>void PrintRanges (Ranges && rangesconst char * prefixFILE * f)Pretty-prints the contents in a given Range container.
Defined at line 264 of file ../../zircon/kernel/phys/lib/memalloc/include/lib/memalloc/range.h