Creates a new contiguous DMA buffer of size bytes (rounded up to the system page size)
mapped in the root VMAR with default alignment and CPU caching enabled.
Creates a new contiguous DMA buffer of size bytes (rounded up to the system page size)
mapped in vmar with the specified alignment_log2 and cache_options.
Read up to dst.len() bytes from the buffer, returning how many bytes
were read. The only thing that can cause fewer bytes to be read than
requested is if dst is larger than the buffer itself.
A call to read is only guaranteed to happen after an operation in
another thread or process if the mechanism used to signal the other
process has well-defined memory ordering semantics. Otherwise, the
acquire_writes method must be called before read and after receiving
a signal from the other process in order to provide such ordering
guarantees. In practice, this means that acquire_writes should be the
first read operation that happens after receiving a signal from another
process that the memory may be read. See the acquire_writes
documentation for more details.
Read up to dst.len() bytes starting at offset into the buffer,
returning how many bytes were read. The only thing that can cause fewer
bytes to be read than requested is if there are fewer than dst.len()
bytes available starting at offset within the buffer.
A call to read_at is only guaranteed to happen after an operation in
another thread or process if the mechanism used to signal the other
process has well-defined memory ordering semantics. Otherwise, the
acquire_writes method must be called before read_at and after
receiving a signal from the other process in order to provide such
ordering guarantees. In practice, this means that acquire_writes
should be the first read operation that happens after receiving a signal
from another process that the memory may be read. See the
acquire_writes documentation for more details.
Write up to src.len() bytes into the buffer, returning how many bytes
were written. The only thing that can cause fewer bytes to be written
than requested is if src is larger than the buffer itself.
A call to write is only guaranteed to happen before an operation in
another thread or process if the mechanism used to signal the other
process has well-defined memory ordering semantics. Otherwise, the
release_writes method must be called after write and before
signalling the other process in order to provide such ordering
guarantees. In practice, this means that release_writes should be the
last write operation that happens before signalling another process that
the memory may be read. See the release_writes documentation for more
details.
Write up to src.len() bytes starting at offset into the buffer,
returning how many bytes were written. The only thing that can cause
fewer bytes to be written than requested is if there are fewer than
src.len() bytes available starting at offset within the buffer.
A call to write_at is only guaranteed to happen before an operation in
another thread or process if the mechanism used to signal the other
process has well-defined memory ordering semantics. Otherwise, the
release_writes method must be called after write_at and before
signalling the other process in order to provide such ordering
guarantees. In practice, this means that release_writes should be the
last write operation that happens before signalling another process that
the memory may be read. See the release_writes documentation for more
details.
Copy bytes from a SharedBuffer or slice into this buffer at an offset.
Copy up to len bytes starting at src_offset in src into self
starting at dst_offset, returning how many bytes were copied. src
may refer to the same underlying memory as self (overlapping regions
are handled safely). The only thing that can cause fewer bytes to be
copied than requested is if there are fewer than len bytes available
starting at dst_offset in self or starting at src_offset in src.
Since copy_from_at reads from src and writes to self, a call to
copy_from_at is only guaranteed to happen after an operation on src
or before an operation on self in another thread or process if the
mechanism used to signal the other process has well-defined memory
ordering semantics. Otherwise, src.acquire_writes() must be called
before copy_from_at (after receiving a signal from the other process
that src may be read) and self.release_writes() must be called after
copy_from_at (before signalling the other process that self may be
read). See the acquire_writes and release_writes documentation for
more details.
Acquire all writes performed by the other process.
On some systems (such as Fuchsia, currently), the communication
mechanism used for signalling a process that memory is readable does not
have well-defined synchronization semantics. On those systems, this
method MUST be called after receiving such a signal, or else writes
performed before that signal are not guaranteed to be observed by this
process.
acquire_writes acquires any writes performed on this buffer or any
slice within the buffer.
Zircon, the Fuchsia kernel, will likely eventually have well-defined
semantics around the synchronization behavior of various syscalls. Once
that happens, calling this method in Fuchsia programs may become
optional. This work is tracked in https://fxbug.dev/42107145.
Just like the slicing operation on array and slice references, slice
constructs a SharedBufferSlice which points to the same memory as the
original SharedBuffer, but starting and index from (inclusive) and
ending at index to (exclusive).
Create two non-overlapping slices of the original SharedBuffer.
Just like the split_at method on array and slice references,
split_at constructs one SharedBufferSlice which represents bytes
[0, idx), and one which represents bytes [idx, len), where len is
the length of the buffer.