Fix clean build and remove object
This commit is contained in:
parent
17ca59abe0
commit
345624c745
@ -1,5 +1,6 @@
|
||||
#![no_std]
|
||||
|
||||
mod nanolibc;
|
||||
mod sys;
|
||||
|
||||
pub use sys::*;
|
||||
|
33
src/nanolibc.rs
Normal file
33
src/nanolibc.rs
Normal file
@ -0,0 +1,33 @@
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn memcpy(dest: *mut u8, src: *const u8, n: usize) -> *mut u8 {
|
||||
for i in 0..n {
|
||||
*dest.add(i) = *src.add(i);
|
||||
}
|
||||
|
||||
dest
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn memset(s: *mut u8, x: i32, n: usize) -> *mut u8 {
|
||||
for i in 0..n {
|
||||
*s.add(i) = x as u8;
|
||||
}
|
||||
|
||||
s
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn memcmp(s1: *mut u8, s2: *const u8, n: usize) -> i32 {
|
||||
for i in 0..n {
|
||||
let x = *s1.add(i);
|
||||
let y = *s2.add(i);
|
||||
if x == y {
|
||||
continue;
|
||||
}
|
||||
|
||||
let (x, y) = (i32::from(x), i32::from(y));
|
||||
return x - y;
|
||||
}
|
||||
|
||||
0
|
||||
}
|
BIN
src/syscalls.o
BIN
src/syscalls.o
Binary file not shown.
Loading…
Reference in New Issue
Block a user