Skip to content

Commit

Permalink
tool: allow specification of PD domain in SDF
Browse files Browse the repository at this point in the history
This commit adds a "domain" attribute to protection domains in the SDF
XML. If a PD has a certain domain set, then the loader will invoke the
domain cap to set the PDs domain at boot.

Signed-off-by: James Archer <j.archer@unsw.edu.au>
  • Loading branch information
JE-Archer committed Jul 17, 2024
1 parent aed4f3e commit 8bb6c54
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
8 changes: 8 additions & 0 deletions tool/microkit/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2339,6 +2339,14 @@ fn build_system(
}));
}

for (pd_idx, pd) in system.protection_domains.iter().enumerate() {
system_invocations.push(Invocation::new(InvocationArgs::DomainSetSet {
domain_set: DOMAIN_CAP_ADDRESS,
domain: pd.domain as u8,
tcb: pd_tcb_objs[pd_idx].cap_addr,
}));
}

// Set VSpace and CSpace
let num_set_space_invocations = system.protection_domains.len() + virtual_machines.len();
let mut set_space_invocation = Invocation::new(InvocationArgs::TcbSetSpace {
Expand Down
12 changes: 11 additions & 1 deletion tool/microkit/src/sysxml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ pub struct ProtectionDomain {
pub parent: Option<usize>,
/// Location in the parsed SDF file
text_pos: roxmltree::TextPos,
pub domain: u64,
}

#[derive(Debug, PartialEq, Eq, Hash)]
Expand Down Expand Up @@ -277,7 +278,9 @@ impl ProtectionDomain {
node: &roxmltree::Node,
is_child: bool,
) -> Result<ProtectionDomain, String> {
let mut attrs = vec!["name", "priority", "pp", "budget", "period", "passive"];
let mut attrs = vec![
"name", "priority", "pp", "budget", "period", "passive", "domain",
];
if is_child {
attrs.push("id");
}
Expand Down Expand Up @@ -346,6 +349,12 @@ impl ProtectionDomain {
false
};

let domain = if let Some(xml_domain) = node.attribute("domain") {
sdf_parse_number(xml_domain, node)?
} else {
0
};

let mut maps = Vec::new();
let mut irqs = Vec::new();
let mut setvars = Vec::new();
Expand Down Expand Up @@ -508,6 +517,7 @@ impl ProtectionDomain {
has_children,
parent: None,
text_pos: xml_sdf.doc.text_pos_at(node.range().start),
domain,
})
}
}
Expand Down

0 comments on commit 8bb6c54

Please sign in to comment.