Skip to content

Commit

Permalink
Add a comment about explicit_bzero's use of asm!.
Browse files Browse the repository at this point in the history
  • Loading branch information
sunfishcode committed Dec 20, 2023
1 parent 29a77e2 commit 53f29db
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions c-scape/src/mem/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ unsafe extern "C" fn explicit_bzero(dst: *mut c_void, len: size_t) {
libc!(libc::explicit_bzero(dst, len));

bzero(dst, len);

// Attempt to discourage compiler optimizations from thinking this `bzero`
// is unnecessary.
core::arch::asm!("# {}, {}", in(reg) dst, in(reg) len, options(nostack, preserves_flags));
}

Expand Down

0 comments on commit 53f29db

Please sign in to comment.