Compare commits

...

2 Commits

2 changed files with 5 additions and 2 deletions

View File

@ -12,7 +12,7 @@ pub struct Semaphore {
}
impl Semaphore {
pub fn new(value: i32, max: i32) -> Self {
pub const fn new(value: i32, max: i32) -> Self {
Semaphore { value: AtomicI32::new(value), max}
}

View File

@ -34,7 +34,10 @@ unsafe impl GlobalAlloc for CortexA9Alloc {
}
unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
if cfg!(not(feature = "alloc_core")) || MPIDR.read().cpu_id() == 0 {
if cfg!(not(feature = "alloc_core"))
|| ((&__heap0_start as *const usize as usize <= ptr as usize)
&& ((ptr as usize) < &__heap0_end as *const usize as usize))
{
&self.0
} else {
&self.1