Skip to content

Commit

Permalink
Merge pull request aya-rs#245 from alessandrod/memcpy
Browse files Browse the repository at this point in the history
ebpf: add fallback memcpy
  • Loading branch information
alessandrod committed Apr 16, 2022
2 parents a1d4499 + 29d5397 commit 7d08783
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bpf/aya-bpf/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,12 @@ pub unsafe extern "C" fn memset(s: *mut u8, c: c_int, n: usize) {
*((base + i) as *mut u8) = c as u8;
}
}

#[no_mangle]
pub unsafe extern "C" fn memcpy(dest: *mut u8, src: *mut u8, n: usize) {
let dest_base = dest as usize;
let src_base = src as usize;
for i in 0..n {
*((dest_base + i) as *mut u8) = *((src_base + i) as *mut u8);
}
}

0 comments on commit 7d08783

Please sign in to comment.