mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-10 13:56:48 +00:00
Use mutable pointer for kernel heap
Co-authored-by: Chen Chengjun <chenchengjun.ccj@antgroup.com>
This commit is contained in:
parent
87ee88da8c
commit
16862a2024
@ -41,7 +41,7 @@ pub unsafe fn init() {
|
|||||||
// SAFETY: The HEAP_SPACE is a static memory range, so it's always valid.
|
// SAFETY: The HEAP_SPACE is a static memory range, so it's always valid.
|
||||||
unsafe {
|
unsafe {
|
||||||
#[allow(static_mut_refs)]
|
#[allow(static_mut_refs)]
|
||||||
HEAP_ALLOCATOR.init(HEAP_SPACE.0.as_ptr(), INIT_KERNEL_HEAP_SIZE);
|
HEAP_ALLOCATOR.init(HEAP_SPACE.0.as_mut_ptr(), INIT_KERNEL_HEAP_SIZE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ impl LockedHeapWithRescue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// SAFETY: The range [start, start + size) must be a valid memory region.
|
/// SAFETY: The range [start, start + size) must be a valid memory region.
|
||||||
pub unsafe fn init(&self, start: *const u8, size: usize) {
|
pub unsafe fn init(&self, start: *mut u8, size: usize) {
|
||||||
self.heap
|
self.heap
|
||||||
.call_once(|| SpinLock::new(Heap::new(start as usize, size)));
|
.call_once(|| SpinLock::new(Heap::new(start as usize, size)));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user