class BootZbi

Defined at line 31 of file ../../zircon/kernel/phys/include/phys/boot-zbi.h

BootZbi represents a bootable ZBI and manages the memory allocation and ZBI

protocol details for getting its kernel image and data ZBI in place and

handing off control.

BootZbi is a move-only object that can only be created by BootZbi::Create

from a valid input ZBI. After construction yields information about the

kernel's load requirements before doing anything. Then Load() does any

necessary allocations via Allocation::New and/or reuses the input ZBI's

storage() space. DataZbi() can then be amended before calling Boot().

Public Methods

Size GetKernelAllocationSize (Zbi::iterator kernel_item)

Returns the allocation size required for a kernel item.

Defined at line 113 of file ../../zircon/kernel/phys/boot-zbi.cc

Size GetKernelAllocationSize (Zbi::iterator kernel_item)

Returns the allocation size required for a kernel item.

Defined at line 113 of file ../../zircon/kernel/phys/boot-zbi.cc

Size GetKernelAllocationSize (Zbi::iterator kernel_item)

Returns the allocation size required for a kernel item.

Defined at line 113 of file ../../zircon/kernel/phys/boot-zbi.cc

Size SuggestedAllocation (uint32_t zbi_size_bytes)

Suggest allocation parameters for a whole bootable ZBI image whose

incoming size is known but whose contents haven't been seen yet. A

conforming allocation will be optimal for reuse by Load().

Defined at line 109 of file ../../zircon/kernel/phys/boot-zbi.cc

fit::result<Error> Init (InputZbi zbi)

This initializes a new BootZbi object representing the input ZBI. This is

to be called on a default-constructed object, which should not otherwise

be used before calling Init() or being moved-into from a BootZbi object on

which Init() has been called. The initialized object describes the kernel

image in place before loading.

Defined at line 136 of file ../../zircon/kernel/phys/boot-zbi.cc

fit::result<Error> Init (InputZbi zbi)

This initializes a new BootZbi object representing the input ZBI. This is

to be called on a default-constructed object, which should not otherwise

be used before calling Init() or being moved-into from a BootZbi object on

which Init() has been called. The initialized object describes the kernel

image in place before loading.

Defined at line 136 of file ../../zircon/kernel/phys/boot-zbi.cc

fit::result<Error> Init (InputZbi zbi)

This initializes a new BootZbi object representing the input ZBI. This is

to be called on a default-constructed object, which should not otherwise

be used before calling Init() or being moved-into from a BootZbi object on

which Init() has been called. The initialized object describes the kernel

image in place before loading.

Defined at line 136 of file ../../zircon/kernel/phys/boot-zbi.cc

fit::result<Error> Init (InputZbi zbi, InputZbi::iterator kernel_item)

This does the same, but with a preselected kernel item.

Defined at line 173 of file ../../zircon/kernel/phys/boot-zbi.cc

fit::result<Error> Init (InputZbi zbi, InputZbi::iterator kernel_item)

This does the same, but with a preselected kernel item.

Defined at line 173 of file ../../zircon/kernel/phys/boot-zbi.cc

fit::result<Error> Init (InputZbi zbi, InputZbi::iterator kernel_item)

This does the same, but with a preselected kernel item.

Defined at line 173 of file ../../zircon/kernel/phys/boot-zbi.cc

fit::result<Error> Load (uint32_t extra_data_capacity, ktl::optional<uintptr_t> kernel_load_address, ktl::optional<uintptr_t> data_load_address)

Load the kernel and data ZBIs from the input ZBI. The data ZBI will have

at least extra_data_capacity bytes of space available to Append() items to

it. The input ZBI's memory may be reused for the kernel or data images,

so it should not be referenced afterwards.

After Load(), the kernel and data images are both in place in memory and

ready for Boot(). The data image can be modified in place between Load

and Boot but no more shuffling of memory is expected after Load succeeds.

Defined at line 219 of file ../../zircon/kernel/phys/boot-zbi.cc

fit::result<Error> Load (uint32_t extra_data_capacity, ktl::optional<uintptr_t> kernel_load_address, ktl::optional<uintptr_t> data_load_address)

Load the kernel and data ZBIs from the input ZBI. The data ZBI will have

at least extra_data_capacity bytes of space available to Append() items to

it. The input ZBI's memory may be reused for the kernel or data images,

so it should not be referenced afterwards.

After Load(), the kernel and data images are both in place in memory and

ready for Boot(). The data image can be modified in place between Load

and Boot but no more shuffling of memory is expected after Load succeeds.

Defined at line 219 of file ../../zircon/kernel/phys/boot-zbi.cc

fit::result<Error> Load (uint32_t extra_data_capacity, ktl::optional<uintptr_t> kernel_load_address, ktl::optional<uintptr_t> data_load_address)

Load the kernel and data ZBIs from the input ZBI. The data ZBI will have

at least extra_data_capacity bytes of space available to Append() items to

it. The input ZBI's memory may be reused for the kernel or data images,

so it should not be referenced afterwards.

After Load(), the kernel and data images are both in place in memory and

ready for Boot(). The data image can be modified in place between Load

and Boot but no more shuffling of memory is expected after Load succeeds.

Defined at line 219 of file ../../zircon/kernel/phys/boot-zbi.cc

void Log ()

Log the address and size details. This is meant to be nearly the very

last thing done before Boot(), perhaps before final handoff details that

render it impossible to print later.

Defined at line 476 of file ../../zircon/kernel/phys/boot-zbi.cc

void Boot (ktl::optional<void *> argument)

Boot into the kernel loaded by Load(), which must have been called first.

This cannot fail and never returns. If the optional pointer argument is

supplied it is given to the new kernel instead of DataLoadAddress().

Defined at line 481 of file ../../zircon/kernel/phys/boot-zbi.cc

bool KernelCanLoadInPlace ()

If this returns true, then instead of using Load() it works to just assign

to DataZbi().storage() with a different data location and use the kernel

image already in place after construction by Init().

Defined at line 192 of file ../../zircon/kernel/phys/boot-zbi.cc

void BootZbi ()

Default-constructible and move-only.

Defined at line 46 of file ../../zircon/kernel/phys/include/phys/boot-zbi.h

void BootZbi (BootZbi && )

Defined at line 47 of file ../../zircon/kernel/phys/include/phys/boot-zbi.h

BootZbi & operator= (BootZbi && )

Defined at line 48 of file ../../zircon/kernel/phys/include/phys/boot-zbi.h

bool Relocating ()

These are overridden in TrampolineBoot (see x86/phys/boot-shim).

Defined at line 51 of file ../../zircon/kernel/phys/include/phys/boot-zbi.h

bool MustRelocateDataZbi ()

Defined at line 52 of file ../../zircon/kernel/phys/include/phys/boot-zbi.h

const ZbiKernelImage * KernelImage ()

The Kernel* methods can be used at any time, even before Load().

Defined at line 93 of file ../../zircon/kernel/phys/include/phys/boot-zbi.h

const zbi_kernel_t * KernelHeader ()

Defined at line 95 of file ../../zircon/kernel/phys/include/phys/boot-zbi.h

uint64_t KernelLoadAddress ()

Defined at line 97 of file ../../zircon/kernel/phys/include/phys/boot-zbi.h

uint32_t KernelLoadSize ()

Defined at line 99 of file ../../zircon/kernel/phys/include/phys/boot-zbi.h

uint64_t KernelMemorySize ()

Defined at line 104 of file ../../zircon/kernel/phys/include/phys/boot-zbi.h

uint64_t KernelEntryAddress ()

Defined at line 108 of file ../../zircon/kernel/phys/include/phys/boot-zbi.h

InputZbi input_zbi ()

The Data* methods can be used after a successful Load() or if a valid data

ZBI has been installed directly into DataZbi(). The data ZBI can be

modified in place up to its capacity. Assigning to DataZbi() or its

storage() after Load() is allowed if the new address is properly aligned.

Defined at line 120 of file ../../zircon/kernel/phys/include/phys/boot-zbi.h

Zbi & DataZbi ()

Defined at line 121 of file ../../zircon/kernel/phys/include/phys/boot-zbi.h

uint64_t DataLoadAddress ()

Defined at line 123 of file ../../zircon/kernel/phys/include/phys/boot-zbi.h

uint64_t DataLoadSize ()

Defined at line 125 of file ../../zircon/kernel/phys/include/phys/boot-zbi.h

Protected Methods

void LogAddresses ()

Defined at line 488 of file ../../zircon/kernel/phys/boot-zbi.cc

void LogBoot (uint64_t entry)

Defined at line 499 of file ../../zircon/kernel/phys/boot-zbi.cc

void LogBoot (uint64_t entry)

Defined at line 499 of file ../../zircon/kernel/phys/boot-zbi.cc

bool FixedKernelOverlapsData (uint64_t kernel_load_address)

Defined at line 211 of file ../../zircon/kernel/phys/boot-zbi.cc

bool FixedKernelOverlapsData (uint64_t kernel_load_address)

Defined at line 211 of file ../../zircon/kernel/phys/boot-zbi.cc

void InitKernel (Allocation kernel)

Defined at line 123 of file ../../zircon/kernel/phys/boot-zbi.cc

void InitData (Allocation data)

Defined at line 131 of file ../../zircon/kernel/phys/boot-zbi.cc

void ZbiBoot (uintptr_t entry, void * data)

Defined at line 9 of file ../../zircon/kernel/arch/x86/phys/arch-boot-zbi-64.cc

void ZbiBoot (uintptr_t entry, void * data)

Defined at line 9 of file ../../zircon/kernel/arch/x86/phys/arch-boot-zbi-64.cc

void ZbiBoot (uintptr_t entry, void * data)

Defined at line 11 of file ../../zircon/kernel/arch/x86/phys/arch-boot-zbi-32.cc

Records