mirror of
https://github.com/AmbiML/sparrow-kata-full.git
synced 2025-07-14 06:24:14 +00:00
kata-os-model: stop dup'ing TCB's and CNode's
capdl-loader-app duplicated the TCB & CNode caps. The only possible reason to do this is if a cap is Move'd (e.g. when constructing the CSpace for each component) and then later referenced. But this does not appear to happen so remove in prep for memory reclamation changes. Change-Id: I8c9bd1f4f2fa1535da330f782ba978b460b0cf00 GitOrigin-RevId: 7d950dee814705b13b95831b39b7626d4210599b
This commit is contained in:
parent
70b4072428
commit
772bd6040a
@ -202,7 +202,6 @@ impl<'a> KataOsModel<'a> {
|
||||
|
||||
self.create_irq_caps()?;
|
||||
self.init_sched_ctrl()?; // scheduler::init_sched_ctrl
|
||||
self.duplicate_caps()?;
|
||||
self.init_irqs()?;
|
||||
self.init_pd_asids()?;
|
||||
|
||||
@ -413,20 +412,6 @@ impl<'a> KataOsModel<'a> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// Duplicate CNode & TCB capabilities.
|
||||
// XXX why?
|
||||
pub fn duplicate_caps(&mut self) -> seL4_Result {
|
||||
for (obj_id, obj) in self.spec.obj_slice().iter().enumerate() {
|
||||
match obj.r#type() {
|
||||
CDL_CNode | CDL_TCB => {
|
||||
self.dup_cap(obj_id)?;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn init_irqs(&mut self) -> seL4_Result {
|
||||
for (irq, irq_num) in self.spec.irq_slice().iter()
|
||||
.enumerate()
|
||||
@ -764,9 +749,9 @@ impl<'a> KataOsModel<'a> {
|
||||
pub fn init_tcbs(&mut self) -> seL4_Result {
|
||||
let iter = self.spec.obj_slice().iter();
|
||||
for (obj_id, obj) in iter.enumerate().filter(|(_, obj)| obj.r#type() == CDL_TCB) {
|
||||
self.init_tcb(obj, self.get_orig_cap(obj_id))?;
|
||||
// XXX why dup?
|
||||
self.configure_tcb(obj, self.get_dup_cap(obj_id))?;
|
||||
let sel4_tcb = self.get_orig_cap(obj_id);
|
||||
self.init_tcb(obj, sel4_tcb)?;
|
||||
self.configure_tcb(obj, sel4_tcb)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@ -893,7 +878,7 @@ impl<'a> KataOsModel<'a> {
|
||||
#[cfg(feature = "CONFIG_NOISY_INIT_CNODE")]
|
||||
trace!("Init {}: {} slots, orig {} dup {}", cdl_cnode.name(),
|
||||
cdl_cnode.num_slots(), self.get_orig_cap(cnode),
|
||||
self.get_dup_cap(cnode));
|
||||
self.get_orig_cap(cnode));
|
||||
for slot_index in 0..cdl_cnode.num_slots() {
|
||||
self.init_cnode_slot(mode, cnode, &cdl_cnode.slot(slot_index))?;
|
||||
}
|
||||
@ -935,8 +920,7 @@ impl<'a> KataOsModel<'a> {
|
||||
let src_root = seL4_CapInitThreadCNode;
|
||||
let src_depth = seL4_WordBits as u8;
|
||||
|
||||
// Blindly use the dup'd cap a la init_cnode_slot.
|
||||
let dest_root = self.get_dup_cap(cnode_obj_id);
|
||||
let dest_root = self.get_orig_cap(cnode_obj_id);
|
||||
let dest_depth: u8 = cnode.size_bits.try_into().unwrap();
|
||||
|
||||
unsafe {
|
||||
@ -982,10 +966,7 @@ impl<'a> KataOsModel<'a> {
|
||||
let dest_obj = self.get_object(cnode_id);
|
||||
let dest_size = dest_obj.size_bits;
|
||||
|
||||
// Use a copy of the cap to reference the CNode in case
|
||||
// the original has already been moved.
|
||||
// XXX when does this happen?
|
||||
let dest_root = self.get_dup_cap(cnode_id);
|
||||
let dest_root = self.get_orig_cap(cnode_id);
|
||||
let dest_index = cnode_slot.slot;
|
||||
let dest_depth: u8 = dest_size.try_into().unwrap();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user