template <class Elf, class AbiTraits>
class RemoteAbiHeap
Defined at line 200 of file ../../sdk/lib/ld/include/lib/ld/remote-abi-heap.h
RemoteAbiHeap represents the heap during the data phase. Creating it
consumes a RemoteAbiHeapLayout, and also takes the same value passed to the
RemoteAbiHeapLayout constructor from RemoteAbiStub::data_size() and a
mutable RemoteLoadModule describing the same stub dynamic linker ELF file
presented to RemoteAbiStub::Init.
Public Methods
void RemoteAbiHeap<Elf, AbiTraits> (RemoteAbiHeap<RemoteModule, AbiTraits> && )
Defined at line 214 of file ../../sdk/lib/ld/include/lib/ld/remote-abi-heap.h
RemoteAbiHeap<RemoteModule, AbiTraits> & operator= (RemoteAbiHeap<RemoteModule, AbiTraits> && )
Defined at line 215 of file ../../sdk/lib/ld/include/lib/ld/remote-abi-heap.h
template <class Diagnostics>
zx::result<RemoteAbiHeap<RemoteModule, AbiTraits>> Create (Diagnostics & diagnostics, size_type stub_data_size, RemoteModule & stub_module, RemoteAbiHeapLayout layout)
Create the RemoteAbiHeap by modifying the RemoteLoadModule for the stub
dynamic linker, using the same original data segment size passed to the
RemoteAbiHeapLayout constructor from RemoteAbiStub::data_size(). This
both modifies the RemoteLoadModule's final segment and references that
segment's VMO, so that RemoteLoadModule must remain live for the lifetime
of the RemoteAbiHeap object.
Defined at line 224 of file ../../sdk/lib/ld/include/lib/ld/remote-abi-heap.h
size_type size_bytes ()
The heap size is fixed when the Buffer is created. It can be used to
size a mapping location whose vaddr will be passed into Remote calls.
Defined at line 275 of file ../../sdk/lib/ld/include/lib/ld/remote-abi-heap.h
size_type HeapVaddr (const RemoteModule & stub_module)
After the stub module's load_bias() has been fixed, this yields the
runtime vaddr of the stub module's heap segment: the vaddr argument for
the Remote() methods below.
This should only be called on a stub_module that was previously modified
by a successful Create() call, and has since had its load_bias() set.
Defined at line 283 of file ../../sdk/lib/ld/include/lib/ld/remote-abi-heap.h
template <typename T>
T & Local (size_type offset)
Return a local mutable reference to a global of type T at a known offset
in the stub data segment.
Defined at line 293 of file ../../sdk/lib/ld/include/lib/ld/remote-abi-heap.h
std::span<const char> Local (RemoteAbiString str)
The string table is already written, so each RemoteAbiString yields a
constant span of the image where that NUL-terminated string already lies
in the table.
Defined at line 306 of file ../../sdk/lib/ld/include/lib/ld/remote-abi-heap.h
template <typename T>
std::span<T> Local (RemoteAbiSpan<T> span)
The local span
<T
> contents in the RemoteAbiHeap can now be filled in.
The return span remains valid until Commit() is called (see below).
Defined at line 322 of file ../../sdk/lib/ld/include/lib/ld/remote-abi-heap.h
AbiSpan<char> Remote (size_type vaddr, RemoteAbiString str)
Given the remote virtual address where the segment will be mapped,
RemoteAbiString and RemoteAbiSpan placeholders can be turned into remote
AbiSpan objects ready to be copied into place.
Defined at line 332 of file ../../sdk/lib/ld/include/lib/ld/remote-abi-heap.h
template <typename T>
AbiSpan<T> Remote (size_type vaddr, RemoteAbiSpan<T> span)
Defined at line 348 of file ../../sdk/lib/ld/include/lib/ld/remote-abi-heap.h
template <class Diagnostics, class Segment>
zx::result<StubConstantSegment> ReplaceSegment (Diagnostics & diagnostics, Segment && old_segment, const zx::vmo & file_vmo, size_type segment_size)
Remove the original mutable segment and turn it into the larger
read-only segment. It can be either a DataWithZeroFillSegment that
might have an existing VMO, or a ZeroFillSegment that never does.
Private subroutine of Create; public only for unit testing.
Defined at line 361 of file ../../sdk/lib/ld/include/lib/ld/remote-abi-heap.h
zx::result<> Commit ()
When a RemoteAbiHeap has been filled and is ready to be mapped into a
process, Commit() yields the VMO. It should then be mapped at the same
vaddr that was used in Remote calls when filling pointers in the data.
This must be the last method called and must be called using std::move.
This invalidates all previous return values from Local.
Defined at line 467 of file ../../sdk/lib/ld/include/lib/ld/remote-abi-heap.h