Skip to content

Commit 8bb6c54

Browse files
committed
tool: allow specification of PD domain in SDF
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 <[email protected]>
1 parent aed4f3e commit 8bb6c54

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

tool/microkit/src/main.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2339,6 +2339,14 @@ fn build_system(
23392339
}));
23402340
}
23412341

2342+
for (pd_idx, pd) in system.protection_domains.iter().enumerate() {
2343+
system_invocations.push(Invocation::new(InvocationArgs::DomainSetSet {
2344+
domain_set: DOMAIN_CAP_ADDRESS,
2345+
domain: pd.domain as u8,
2346+
tcb: pd_tcb_objs[pd_idx].cap_addr,
2347+
}));
2348+
}
2349+
23422350
// Set VSpace and CSpace
23432351
let num_set_space_invocations = system.protection_domains.len() + virtual_machines.len();
23442352
let mut set_space_invocation = Invocation::new(InvocationArgs::TcbSetSpace {

tool/microkit/src/sysxml.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ pub struct ProtectionDomain {
168168
pub parent: Option<usize>,
169169
/// Location in the parsed SDF file
170170
text_pos: roxmltree::TextPos,
171+
pub domain: u64,
171172
}
172173

173174
#[derive(Debug, PartialEq, Eq, Hash)]
@@ -277,7 +278,9 @@ impl ProtectionDomain {
277278
node: &roxmltree::Node,
278279
is_child: bool,
279280
) -> Result<ProtectionDomain, String> {
280-
let mut attrs = vec!["name", "priority", "pp", "budget", "period", "passive"];
281+
let mut attrs = vec![
282+
"name", "priority", "pp", "budget", "period", "passive", "domain",
283+
];
281284
if is_child {
282285
attrs.push("id");
283286
}
@@ -346,6 +349,12 @@ impl ProtectionDomain {
346349
false
347350
};
348351

352+
let domain = if let Some(xml_domain) = node.attribute("domain") {
353+
sdf_parse_number(xml_domain, node)?
354+
} else {
355+
0
356+
};
357+
349358
let mut maps = Vec::new();
350359
let mut irqs = Vec::new();
351360
let mut setvars = Vec::new();
@@ -508,6 +517,7 @@ impl ProtectionDomain {
508517
has_children,
509518
parent: None,
510519
text_pos: xml_sdf.doc.text_pos_at(node.range().start),
520+
domain,
511521
})
512522
}
513523
}

0 commit comments

Comments
 (0)