|
@@ -1,5 +1,5 @@
|
|
|
//! strings implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/strings.h.html
|
|
|
-
|
|
|
+#![feature(llvm_asm)]
|
|
|
use core::ptr;
|
|
|
|
|
|
use crate::{
|
|
@@ -22,6 +22,14 @@ pub unsafe extern "C" fn bzero(dst: *mut c_void, n: size_t) {
|
|
|
ptr::write_bytes(dst as *mut u8, 0, n);
|
|
|
}
|
|
|
|
|
|
+#[no_mangle]
|
|
|
+pub unsafe extern "C" fn explicit_bzero(s: *mut c_void, n: size_t) {
|
|
|
+ for i in 0..n {
|
|
|
+ *(s as *mut u8).add(i) = 0 as u8;
|
|
|
+ }
|
|
|
+ llvm_asm!("" :: "r"(s) : "memory")
|
|
|
+}
|
|
|
+
|
|
|
#[no_mangle]
|
|
|
pub extern "C" fn ffs(i: c_int) -> c_int {
|
|
|
if i == 0 {
|