Add __rust_allocate_zeroed to work with newest nightly
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#![allocator]
|
||||
#![no_std]
|
||||
|
||||
use core::ptr;
|
||||
use spin::Mutex;
|
||||
use linked_list_allocator::Heap;
|
||||
|
||||
@@ -25,6 +26,15 @@ pub extern fn __rust_allocate(size: usize, align: usize) -> *mut u8 {
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern fn __rust_allocate_zeroed(size: usize, align: usize) -> *mut u8 {
|
||||
let ptr = __rust_allocate(size, align);
|
||||
unsafe {
|
||||
ptr::write_bytes(ptr, 0, size);
|
||||
}
|
||||
ptr
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern fn __rust_deallocate(ptr: *mut u8, size: usize, align: usize) {
|
||||
if let Some(ref mut heap) = *HEAP.lock() {
|
||||
|
||||
Reference in New Issue
Block a user