mirror of
https://github.com/AmbiML/sparrow-kata-full.git
synced 2025-07-15 06:51:49 +00:00
Merge "kata-os-model: make noisy logging feature-dependent"
GitOrigin-RevId: 86cc0e2c482146df56b58ec0a61e54d31c317d71
This commit is contained in:
parent
3bf4242a91
commit
6eb1d0537f
@ -27,6 +27,10 @@ CONFIG_KERNEL_MCS = []
|
|||||||
CONFIG_PRINTING = []
|
CONFIG_PRINTING = []
|
||||||
CONFIG_SMP_SUPPORT = []
|
CONFIG_SMP_SUPPORT = []
|
||||||
CONFIG_VTX = []
|
CONFIG_VTX = []
|
||||||
|
# Enable inclusion of noisy logging in various areas
|
||||||
|
CONFIG_NOISY_CREATE_OBJECT = []
|
||||||
|
CONFIG_NOISY_INIT_CNODE = []
|
||||||
|
CONFIG_NOISY_INIT_VSPACE = []
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "mod.rs"
|
path = "mod.rs"
|
||||||
|
@ -421,8 +421,9 @@ impl<'a> KataOsModel<'a> {
|
|||||||
// (find_device_object just does a retype_untyped).
|
// (find_device_object just does a retype_untyped).
|
||||||
if obj.is_device() {
|
if obj.is_device() {
|
||||||
let paddr = obj.paddr().unwrap();
|
let paddr = obj.paddr().unwrap();
|
||||||
// debug!(" find device frame/untyped {}, paddr {:#x}, size {}",
|
#[cfg(feature = "CONFIG_NOISY_CREATE_OBJECT")]
|
||||||
// obj.name(), paddr, obj_size);
|
debug!(" Find device frame/untyped {}, paddr {:#x}, size {}",
|
||||||
|
obj.name(), paddr, obj_size);
|
||||||
self.find_device_object(free_slot, untyped_slot, arch_type, obj_size, paddr, id)
|
self.find_device_object(free_slot, untyped_slot, arch_type, obj_size, paddr, id)
|
||||||
} else {
|
} else {
|
||||||
retype_untyped(free_slot, untyped_slot, arch_type, obj_size)
|
retype_untyped(free_slot, untyped_slot, arch_type, obj_size)
|
||||||
@ -500,7 +501,7 @@ impl<'a> KataOsModel<'a> {
|
|||||||
let vspace_copy = self.vspace_roots.clone();
|
let vspace_copy = self.vspace_roots.clone();
|
||||||
for obj in vspace_copy.iter() {
|
for obj in vspace_copy.iter() {
|
||||||
let sel4_page = self.get_orig_cap(*obj);
|
let sel4_page = self.get_orig_cap(*obj);
|
||||||
// debug!("Assign ASIDPool for {}", self.get_object(*obj).name());
|
debug!("Assign ASIDPool for {}", self.get_object(*obj).name());
|
||||||
unsafe { seL4_ASIDPool_Assign(seL4_CapInitThreadASIDPool, sel4_page) }?;
|
unsafe { seL4_ASIDPool_Assign(seL4_CapInitThreadASIDPool, sel4_page) }?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
@ -691,10 +692,11 @@ impl<'a> KataOsModel<'a> {
|
|||||||
let sel4_page = self.get_orig_cap(page_cap.obj_id);
|
let sel4_page = self.get_orig_cap(page_cap.obj_id);
|
||||||
let sel4_pd = self.get_orig_cap(pd_id);
|
let sel4_pd = self.get_orig_cap(pd_id);
|
||||||
|
|
||||||
// trace!(" Map PT {} into {} @{:#x}, vm_attribs={:#x}",
|
#[cfg(feature = "CONFIG_NOISY_INIT_VSPACE")]
|
||||||
// self.get_object(page_cap.obj_id).name(),
|
trace!(" Map PT {} into {} @{:#x}, vm_attribs={:#x}",
|
||||||
// self.get_object(pd_id).name(),
|
self.get_object(page_cap.obj_id).name(),
|
||||||
// vaddr, page_cap.vm_attribs());
|
self.get_object(pd_id).name(),
|
||||||
|
vaddr, page_cap.vm_attribs());
|
||||||
|
|
||||||
let vm_attribs: seL4_VMAttributes = page_cap.vm_attribs().into();
|
let vm_attribs: seL4_VMAttributes = page_cap.vm_attribs().into();
|
||||||
unsafe { seL4_PageTable_Map(sel4_page, sel4_pd, vaddr, vm_attribs) }
|
unsafe { seL4_PageTable_Map(sel4_page, sel4_pd, vaddr, vm_attribs) }
|
||||||
@ -760,15 +762,16 @@ impl<'a> KataOsModel<'a> {
|
|||||||
// the dup_cap entry (though shared pages never need fixup).
|
// the dup_cap entry (though shared pages never need fixup).
|
||||||
self.set_dup_cap(page, sel4_page);
|
self.set_dup_cap(page, sel4_page);
|
||||||
|
|
||||||
// trace!(" Map {} into {} @{:#x} with cap={} rights=(G: {}, R: {}, W: {}) vm_attribs={:#x}",
|
#[cfg(feature = "CONFIG_NOISY_INIT_VSPACE")]
|
||||||
// self.get_object(page_cap.obj_id).name(),
|
trace!(" Map {} into {} @{:#x} with cap={} rights=(G: {}, R: {}, W: {}) vm_attribs={:#x}",
|
||||||
// self.get_object(pd_id).name(),
|
self.get_object(page_cap.obj_id).name(),
|
||||||
// vaddr,
|
self.get_object(pd_id).name(),
|
||||||
// sel4_page,
|
vaddr,
|
||||||
// rights.get_capAllowGrant(),
|
sel4_page,
|
||||||
// rights.get_capAllowRead(),
|
rights.get_capAllowGrant(),
|
||||||
// rights.get_capAllowWrite(),
|
rights.get_capAllowRead(),
|
||||||
// page_cap.vm_attribs());
|
rights.get_capAllowWrite(),
|
||||||
|
page_cap.vm_attribs());
|
||||||
|
|
||||||
// FIXME: Add support for super-pages.
|
// FIXME: Add support for super-pages.
|
||||||
// NB: arch::seL4_Page_Map handles arch-specific work like
|
// NB: arch::seL4_Page_Map handles arch-specific work like
|
||||||
@ -921,9 +924,10 @@ impl<'a> KataOsModel<'a> {
|
|||||||
// Populate a CNode's slots using previously created objects.
|
// Populate a CNode's slots using previously created objects.
|
||||||
fn init_cnode(&self, mode: InitCnodeCmode, cnode: CDL_ObjID) -> seL4_Result {
|
fn init_cnode(&self, mode: InitCnodeCmode, cnode: CDL_ObjID) -> seL4_Result {
|
||||||
let cdl_cnode = self.get_object(cnode);
|
let cdl_cnode = self.get_object(cnode);
|
||||||
// trace!("Init {}: {} slots, orig {} dup {}", cdl_cnode.name(),
|
#[cfg(feature = "CONFIG_NOISY_INIT_CNODE")]
|
||||||
// cdl_cnode.num_slots(), self.get_orig_cap(cnode),
|
trace!("Init {}: {} slots, orig {} dup {}", cdl_cnode.name(),
|
||||||
// self.get_dup_cap(cnode));
|
cdl_cnode.num_slots(), self.get_orig_cap(cnode),
|
||||||
|
self.get_dup_cap(cnode));
|
||||||
for slot_index in 0..cdl_cnode.num_slots() {
|
for slot_index in 0..cdl_cnode.num_slots() {
|
||||||
self.init_cnode_slot(mode, cnode, &cdl_cnode.slot(slot_index))?;
|
self.init_cnode_slot(mode, cnode, &cdl_cnode.slot(slot_index))?;
|
||||||
}
|
}
|
||||||
@ -1048,26 +1052,29 @@ impl<'a> KataOsModel<'a> {
|
|||||||
_ => (false, self.get_orig_cap(target_cap_obj)),
|
_ => (false, self.get_orig_cap(target_cap_obj)),
|
||||||
};
|
};
|
||||||
let src_depth = seL4_WordBits as u8;
|
let src_depth = seL4_WordBits as u8;
|
||||||
// trace!("cap@{} has type {}", src_index, unsafe { seL4_DebugCapIdentify(src_index) });
|
#[cfg(feature = "CONFIG_NOISY_INIT_CNODE")]
|
||||||
|
debug!("cap@{} has type {}", src_index, sel4_sys::cap_identify(src_index));
|
||||||
|
|
||||||
if mode == InitCnodeCmode::MOVE && move_cap {
|
if mode == InitCnodeCmode::MOVE && move_cap {
|
||||||
if is_ep_cap || is_irq_handler_cap {
|
if is_ep_cap || is_irq_handler_cap {
|
||||||
// debug!(" Populate slot {} by moving {}:{}:{} -> {}:{}:{}",
|
#[cfg(feature = "CONFIG_NOISY_INIT_CNODE")]
|
||||||
// cnode_slot.slot,
|
debug!(" Populate slot {} by moving {}:{}:{} -> {}:{}:{}",
|
||||||
// src_root, src_index, src_depth,
|
cnode_slot.slot,
|
||||||
// dest_root, dest_index, dest_depth,
|
src_root, src_index, src_depth,
|
||||||
// );
|
dest_root, dest_index, dest_depth,
|
||||||
|
);
|
||||||
unsafe {
|
unsafe {
|
||||||
seL4_CNode_Move(
|
seL4_CNode_Move(
|
||||||
dest_root, dest_index, dest_depth, src_root, src_index, src_depth,
|
dest_root, dest_index, dest_depth, src_root, src_index, src_depth,
|
||||||
)
|
)
|
||||||
}?
|
}?
|
||||||
} else {
|
} else {
|
||||||
// debug!(" Populate slot {} by mutating {}:{}:{} -> {}:{}:{}",
|
#[cfg(feature = "CONFIG_NOISY_INIT_CNODE")]
|
||||||
// cnode_slot.slot,
|
debug!(" Populate slot {} by mutating {}:{}:{} -> {}:{}:{}",
|
||||||
// src_root, src_index, src_depth,
|
cnode_slot.slot,
|
||||||
// dest_root, dest_index, dest_depth,
|
src_root, src_index, src_depth,
|
||||||
// );
|
dest_root, dest_index, dest_depth,
|
||||||
|
);
|
||||||
unsafe {
|
unsafe {
|
||||||
seL4_CNode_Mutate(
|
seL4_CNode_Mutate(
|
||||||
dest_root,
|
dest_root,
|
||||||
@ -1098,11 +1105,12 @@ impl<'a> KataOsModel<'a> {
|
|||||||
assert_eq!(frame_cap.r#type(), CDL_FrameCap);
|
assert_eq!(frame_cap.r#type(), CDL_FrameCap);
|
||||||
// NB: the mapped frame cap is stored in the dup table.
|
// NB: the mapped frame cap is stored in the dup table.
|
||||||
let mapped_frame_cap = self.get_dup_cap(frame_cap.obj_id);
|
let mapped_frame_cap = self.get_dup_cap(frame_cap.obj_id);
|
||||||
// debug!(" Map slot {} by moving {}:{}:{} -> {}:{}:{}",
|
#[cfg(feature = "CONFIG_NOISY_INIT_CNODE")]
|
||||||
// cnode_slot.slot,
|
debug!(" Map slot {} by moving {}:{}:{} -> {}:{}:{}",
|
||||||
// src_root, mapped_frame_cap, src_depth,
|
cnode_slot.slot,
|
||||||
// dest_root, dest_index, dest_depth,
|
src_root, mapped_frame_cap, src_depth,
|
||||||
// );
|
dest_root, dest_index, dest_depth,
|
||||||
|
);
|
||||||
// Move the cap to the frame used for the mapping into the
|
// Move the cap to the frame used for the mapping into the
|
||||||
// destination slot.
|
// destination slot.
|
||||||
unsafe {
|
unsafe {
|
||||||
@ -1116,12 +1124,13 @@ impl<'a> KataOsModel<'a> {
|
|||||||
)
|
)
|
||||||
}?;
|
}?;
|
||||||
} else {
|
} else {
|
||||||
// debug!(" Populate slot {} by minting {}:{}:{} -> {}:{}:{} {:?} data {:#x}",
|
#[cfg(feature = "CONFIG_NOISY_INIT_CNODE")]
|
||||||
// cnode_slot.slot,
|
debug!(" Populate slot {} by minting {}:{}:{} -> {}:{}:{} {:?} data {:#x}",
|
||||||
// src_root, src_index, src_depth,
|
cnode_slot.slot,
|
||||||
// dest_root, dest_index, dest_depth,
|
src_root, src_index, src_depth,
|
||||||
// target_cap_rights, target_cap_data,
|
dest_root, dest_index, dest_depth,
|
||||||
// );
|
target_cap_rights, target_cap_data,
|
||||||
|
);
|
||||||
unsafe {
|
unsafe {
|
||||||
seL4_CNode_Mint(
|
seL4_CNode_Mint(
|
||||||
dest_root,
|
dest_root,
|
||||||
|
Loading…
Reference in New Issue
Block a user