mirror of
https://github.com/AmbiML/sparrow-kata-full.git
synced 2025-09-11 01:59:19 +00:00
Add capscan suport.
Add support to output the contents of the top-level CNode of a CAmkES service or KataOS application to the serial console. This is dependent on kernel support that is enabled with CONFIG_PRINTING. Applications must be running; otherwise there is no CSpace to dump. Specific changes: - add a "capscan" shell command - add capscan method to each CAmkES interface - add capscan_bundle method to the ProcessControlInterface - add Camkes::capscan() to dump the top-level CNode - add ProcessManager support to dump the CNode for a bundle TODO: fix syscall wrapper error return Change-Id: If6ca222decdb4c40a1d3a63e69792eb3feb30f6a GitOrigin-RevId: 504c0182ccccf287b5d58cd8e33981c11d7539d7
This commit is contained in:
@@ -19,6 +19,7 @@ default = [
|
||||
"TEST_TIMER_SERVICE",
|
||||
]
|
||||
CONFIG_DEBUG_BUILD = []
|
||||
CONFIG_PRINTING = []
|
||||
CONFIG_KERNEL_MCS = []
|
||||
# Commands that are likely not useful
|
||||
FRINGE_CMDS = []
|
||||
|
@@ -119,6 +119,7 @@ pub fn repl<T: io::BufRead>(
|
||||
cmds.extend([
|
||||
("builtins", builtins_command as CmdFn),
|
||||
("bundles", bundles_command as CmdFn),
|
||||
("capscan", capscan_command as CmdFn),
|
||||
("kvdelete", kvdelete_command as CmdFn),
|
||||
("kvread", kvread_command as CmdFn),
|
||||
("kvwrite", kvwrite_command as CmdFn),
|
||||
@@ -231,12 +232,12 @@ fn ps_command(
|
||||
) -> Result<(), CommandError> {
|
||||
#[cfg(feature = "CONFIG_DEBUG_BUILD")]
|
||||
unsafe {
|
||||
kata_os_common::sel4_sys::seL4_DebugDumpScheduler();
|
||||
sel4_sys::seL4_DebugDumpScheduler();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "CONFIG_DEBUG_BUILD"))]
|
||||
Ok(writeln!(output, "Kernel support not configured!")?)
|
||||
Ok(writeln!(output, "Kernel support not configured with CONFIG_DEBUG_BUILD!")?)
|
||||
}
|
||||
|
||||
fn bundles_command(
|
||||
@@ -258,6 +259,47 @@ fn bundles_command(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Implements a "capscan" command that dumps seL4 capabilities to the console.
|
||||
#[allow(unused_variables)]
|
||||
fn capscan_command(
|
||||
args: &mut dyn Iterator<Item = &str>,
|
||||
_input: &mut dyn io::BufRead,
|
||||
output: &mut dyn io::Write,
|
||||
_builtin_cpio: &[u8],
|
||||
) -> Result<(), CommandError> {
|
||||
#[cfg(feature = "CONFIG_PRINTING")]
|
||||
match args.next() {
|
||||
Some("console") => unsafe { sel4_sys::seL4_DebugDumpCNode(SELF_CNODE); }
|
||||
Some("memory") => { let _ = kata_memory_interface::kata_memory_capscan(); }
|
||||
Some("process") => { let _ = kata_proc_interface::kata_proc_ctrl_capscan(); }
|
||||
Some("mlcoord") => { let _ = kata_mlcoord_capscan(); }
|
||||
Some("security") => { let _ = kata_security_interface::kata_security_capscan(); }
|
||||
Some("storage") => { let _ = kata_storage_interface::kata_storage_capscan(); }
|
||||
Some("timer") => { let _ = kata_timer_interface::timer_service_capscan(); }
|
||||
Some(bundle_id) => {
|
||||
if let Err(e) = kata_proc_interface::kata_proc_ctrl_capscan_bundle(bundle_id) {
|
||||
writeln!(output, "{}: {:?}", bundle_id, e)?;
|
||||
}
|
||||
}
|
||||
None => {
|
||||
writeln!(output, "capscan <target>, where <target> is one of:")?;
|
||||
writeln!(output, " console (DebugConsole)")?;
|
||||
writeln!(output, " memory (MemoryManager)")?;
|
||||
writeln!(output, " process (ProcessManager)")?;
|
||||
writeln!(output, " mlcoord (MlCoordinator)")?;
|
||||
writeln!(output, " securiy (SecurityCoordinator)")?;
|
||||
writeln!(output, " storage (StorageManager)")?;
|
||||
writeln!(output, " timer (TimerService)")?;
|
||||
writeln!(output, "anything else is treated as a bundle_id")?;
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "CONFIG_PRINTING"))]
|
||||
writeln!(output, "Kernel not configured with CONFIG_PRINTING!")?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn collect_from_cpio(
|
||||
filename: &str,
|
||||
cpio: &[u8],
|
||||
|
Reference in New Issue
Block a user