chore: root: log object slot

This commit is contained in:
Paul Pan 2024-06-15 17:44:59 +08:00
parent 2bf8e2341d
commit eb70cd7b73
2 changed files with 11 additions and 10 deletions

View File

@ -33,6 +33,7 @@ extern "C" {
} }
pub const PAGE_SIZE: usize = 4 * KIB; pub const PAGE_SIZE: usize = 4 * KIB;
pub const PAGE_BITS: usize = PAGE_SIZE.ilog2() as usize;
pub const PAGE_LAYOUT: Layout = unsafe { Layout::from_size_align_unchecked(PAGE_SIZE, PAGE_SIZE) }; pub const PAGE_LAYOUT: Layout = unsafe { Layout::from_size_align_unchecked(PAGE_SIZE, PAGE_SIZE) };
#[inline(always)] #[inline(always)]

View File

@ -86,10 +86,11 @@ fn create_untyped_memory(cnode_obj: &mut CNodeObject) -> usize {
} }
trace!( trace!(
"[root] creating untyped memory: {}: {:?} -> {:?}", "[root] creating untyped memory: {}: {:?} -> {:?}, slot #{}",
memory_idx, memory_idx,
start, start,
start + (1 << bits) start + (1 << bits),
memory_idx
); );
let cap = UntypedCap::mint(0, bits, false, start); let cap = UntypedCap::mint(0, bits, false, start);
@ -132,10 +133,11 @@ fn create_untyped_device(cnode_obj: &mut CNodeObject, fdt: &Fdt, memory_idx: usi
} }
trace!( trace!(
"[root] creating untyped device: {}: {:?} -> {:?}", "[root] creating untyped device: {}: {:?} -> {:?}, slot #{}",
device_idx, device_idx,
start, start,
start + (1 << bits) start + (1 << bits),
device_idx
); );
let cap = UntypedCap::mint(0, bits, true, start); let cap = UntypedCap::mint(0, bits, true, start);
@ -190,19 +192,17 @@ fn create_objects(cnode_obj: &mut CNodeObject, end_idx: usize) -> usize {
// tcb // tcb
{ {
trace!("[root] allocating tcb object");
let tcb_idx = CNodeSlot::TcbCap as usize; let tcb_idx = CNodeSlot::TcbCap as usize;
alloc::<TcbObject>(cnode_obj, end_idx, 0, tcb_idx..tcb_idx + 1); trace!("[root] allocating tcb object at slot #{}", tcb_idx);
alloc_objects::<TcbObject>(cnode_obj, end_idx, 0, tcb_idx..tcb_idx + 1);
} }
// vspace // vspace
{ {
trace!("[root] allocating vspace object");
let pagetable_bits = PAGE_SIZE.ilog2() as usize;
// root // root
let vspace_idx = CNodeSlot::VSpaceCap as usize; let vspace_idx = CNodeSlot::VSpaceCap as usize;
alloc::<TableObject>(cnode_obj, end_idx, pagetable_bits, vspace_idx..vspace_idx + 1); trace!("[root] allocating vspace object at slot #{}", vspace_idx);
alloc_objects::<TableObject>(cnode_obj, end_idx, PAGE_BITS, vspace_idx..vspace_idx + 1);
// copy pagetable // copy pagetable
let root = &cnode_obj[vspace_idx]; let root = &cnode_obj[vspace_idx];