Skip to content

Commit

Permalink
Added a block comment of description
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-nitro committed Nov 4, 2024
1 parent 311bb3d commit 35916e2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions programs/bpf_loader/src/syscalls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,14 @@ pub struct VmSlice<'a, T> {
resource_type: PhantomData<T>,
}

// The VmSlice class is used for cases when you need a slice that is stored in the BPF
// interpreter's virtual address space. Because this source code can be compiled with
// addresses of different bit depths, we cannot assume that the 64-bit BPF interpreter's
// pointer sizes can be mapped to physical pointer sizes. In particular, if you need a
// slice-of-slices in the virtual space, the inner slices will be different sizes in a
// 32-bit app build than in the 64-bit virtual space. Therefore instead of a slice-of-slices,
// you should implement a slice-of-VmSlices, which can then use VmSlice::translate() to
// map to the physical address.
impl<'a, T> VmSlice<'a, T> {
pub fn new(memory_mapping: &'a MemoryMapping, ptr: u64, len: u64) -> Self {
VmSlice {
Expand Down

0 comments on commit 35916e2

Please sign in to comment.