From 2c99270910735c51aa578403c3456b3eaf9ebcf8 Mon Sep 17 00:00:00 2001 From: pointer-to-bios Date: Mon, 23 Sep 2024 12:55:00 +0800 Subject: [PATCH] imprive at alloc failed --- src/rust_mm.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/rust_mm.rs b/src/rust_mm.rs index 409fc9f..018d5de 100644 --- a/src/rust_mm.rs +++ b/src/rust_mm.rs @@ -1,10 +1,11 @@ use core::{ alloc::{GlobalAlloc, Layout}, ops::BitAnd, - ptr::{addr_of_mut, null_mut}, + ptr::addr_of_mut, }; use nonx_api::nonx_api; +#[repr(align(4096))] struct PreInitializeAllocator { base: [u128; 1024], inited: bool, @@ -42,7 +43,8 @@ impl PreInitializeAllocator { } } if start == 0 { - null_mut() + panic!("PreInitializeAllocator runs out. Bit map:\n{:#x}\n{:#x}\n{:#x}\n{:#x}\n{:#x}\n{:#x}\n{:#x}\n{:#x}", + self.base[0], self.base[1], self.base[2], self.base[3], self.base[4], self.base[5], self.base[6], self.base[7]); } else { addr_of_mut!(self.base[start]) as *mut u8 }