class Allocation

Defined at line 25 of file ../../zircon/kernel/phys/include/phys/allocation.h

This object represents one memory allocation, and owns that allocation so

destroying this object frees the allocation. It acts as a smart pointer

that also knows the size so it can deliver a raw pointer or a span

<byte

>.

Public Methods

void Init (ktl::span<memalloc::Range> mem_ranges, ktl::span<memalloc::Range> special_ranges, memalloc::Pool::AccessCallback access_callback)

This must be called exactly once before using GetPool or New.

Defined at line 16 of file ../../zircon/kernel/phys/allocation-init.cc

void Allocation (const Allocation & )

Defined at line 31 of file ../../zircon/kernel/phys/include/phys/allocation.h

void Allocation (Allocation && other)

Defined at line 33 of file ../../zircon/kernel/phys/include/phys/allocation.h

void Init (ktl::span<memalloc::Range> mem_ranges, ktl::span<memalloc::Range> special_ranges, memalloc::Pool::AccessCallback access_callback)

This must be called exactly once before using GetPool or New.

void Init (ktl::span<memalloc::Range> mem_ranges, ktl::span<memalloc::Range> special_ranges, memalloc::Pool::AccessCallback access_callback)

This must be called exactly once before using GetPool or New.

Defined at line 16 of file ../../zircon/kernel/phys/allocation-init.cc

void Allocation ()

A default-constructed object is like a null pointer.

Allocation::New() must be called to create a non-null Allocation.

Defined at line 29 of file ../../zircon/kernel/phys/include/phys/allocation.h

void InitWithPool (memalloc::Pool & pool)

Alternatively, this can be called instead of Init() to install a

previously-initialized memalloc::Pool that was handed off.

Defined at line 33 of file ../../zircon/kernel/phys/allocation.cc

Allocation & operator= (const Allocation & )

Defined at line 35 of file ../../zircon/kernel/phys/include/phys/allocation.h

Allocation New (fbl::AllocChecker & ac, memalloc::Type type, size_t size, size_t alignment, ktl::optional<uint64_t> min_addr, ktl::optional<uint64_t> max_addr)

If allocation fails, operator bool will return false later.

The AllocChecker must be checked after construction, too.

Defined at line 35 of file ../../zircon/kernel/phys/efi/allocation.cc

Allocation & operator= (Allocation && other)

Defined at line 37 of file ../../zircon/kernel/phys/include/phys/allocation.h

Allocation New (fbl::AllocChecker & ac, memalloc::Type type, size_t size, size_t alignment, ktl::optional<uint64_t> min_addr, ktl::optional<uint64_t> max_addr)

If allocation fails, operator bool will return false later.

The AllocChecker must be checked after construction, too.

Defined at line 40 of file ../../zircon/kernel/phys/allocation.cc

Allocation New (fbl::AllocChecker & ac, memalloc::Type type, size_t size, size_t alignment, ktl::optional<uint64_t> min_addr, ktl::optional<uint64_t> max_addr)

If allocation fails, operator bool will return false later.

The AllocChecker must be checked after construction, too.

Defined at line 40 of file ../../zircon/kernel/phys/allocation.cc

memalloc::Pool & GetPool ()

Get the memalloc::Pool instance used to construct Allocation objects.

Every call returns the same object. Note that a separate `#include

<lib

/memalloc/pool.h>` is necessary to use the instance.

Defined at line 28 of file ../../zircon/kernel/phys/allocation.cc

void ~Allocation ()

Defined at line 44 of file ../../zircon/kernel/phys/include/phys/allocation.h

Allocation Adopt (memalloc::Range range)

Turns `range` into an allocation object, taking ownership of the allocation.

The range's base addr MUST BE page aligned, such that caller is required to guarantee

that the entire page belongs to the same allocation.

It is the caller's responsibility to ensure that there is not more than a single owner.

Defined at line 60 of file ../../zircon/kernel/phys/include/phys/allocation.h

void Resize (fbl::AllocChecker & ac, size_t new_size)

Defined at line 65 of file ../../zircon/kernel/phys/allocation.cc

void Resize (fbl::AllocChecker & ac, size_t new_size)

Defined at line 65 of file ../../zircon/kernel/phys/allocation.cc

void Resize (fbl::AllocChecker & ac, size_t new_size)

Defined at line 81 of file ../../zircon/kernel/phys/efi/allocation.cc

void Extend (fbl::AllocChecker & ac, size_t new_size)

Attempts to grow the allocation to `new_size`, by extending the tail of the

associated range.

`ac` will determined whether the allocation was successful or not.

Defined at line 91 of file ../../zircon/kernel/phys/allocation.cc

void Extend (fbl::AllocChecker & ac, size_t new_size)

Attempts to grow the allocation to `new_size`, by extending the tail of the

associated range.

`ac` will determined whether the allocation was successful or not.

Defined at line 91 of file ../../zircon/kernel/phys/allocation.cc

ktl::span<ktl::byte> data ()

Defined at line 98 of file ../../zircon/kernel/phys/include/phys/allocation.h

size_t size_bytes ()

Defined at line 100 of file ../../zircon/kernel/phys/include/phys/allocation.h

pointer get ()

Defined at line 102 of file ../../zircon/kernel/phys/include/phys/allocation.h

size_t alignment ()

Gives the intended minimal alignment.

Defined at line 105 of file ../../zircon/kernel/phys/include/phys/allocation.h

memalloc::Type type ()

Defined at line 107 of file ../../zircon/kernel/phys/include/phys/allocation.h

ktl::span<ktl::byte> release ()

This returns the span like data() but transfers ownership like a move.

Defined at line 112 of file ../../zircon/kernel/phys/include/phys/allocation.h

bool operator bool ()

Defined at line 128 of file ../../zircon/kernel/phys/include/phys/allocation.h

ktl::span<ktl::byte> operator* ()

Defined at line 130 of file ../../zircon/kernel/phys/include/phys/allocation.h

const ktl::span<ktl::byte> * operator-> ()

Defined at line 132 of file ../../zircon/kernel/phys/include/phys/allocation.h

size_t PageSize ()

Size of pages used by the underlying allocator.

Defined at line 155 of file ../../zircon/kernel/phys/efi/allocation.cc

void reset ()

This is where actual deallocation happens. The destructor just calls this.

Defined at line 158 of file ../../zircon/kernel/phys/efi/allocation.cc

void Extend (fbl::AllocChecker & ac, size_t new_size)

Attempts to grow the allocation to `new_size`, by extending the tail of the

associated range.

`ac` will determined whether the allocation was successful or not.

Defined at line 122 of file ../../zircon/kernel/phys/efi/allocation.cc