mirror of
https://github.com/AmbiML/sparrow-kata-full.git
synced 2025-07-15 23:06:03 +00:00
Add SeL4Debug component to expose sel4 debug syscalls.
- add a SeL4Debug component that wraps seL4DebugPutString and seL4DumpScheduler system calls that are marked static inline (so not callable from rust) - connect seL4Debug to the DebugConsole and add a "ps" command to the shell that uses sel4DumpScheduler to print the tcb's on the console; e.g. KATA_PROMPT> ps Dumping all tcbs! Name State IP Prio Core -------------------------------------------------------------------------------------- sel4debug:sel4debug running 0x1017e 254 0 sel4debug:fault_handler blocked on recv 0x1046e 255 0 sel4debug:control blocked on recv 0x1046e 254 0 drv:uart blocked on recv 0x11dc4 254 0 drv:fault_handler blocked on recv 0x105d4 255 0 drv:control blocked on recv 0x105d4 254 0 debug_console:fault_handler blocked on recv 0x10840 255 0 debug_console:control blocked on reply 0x12808 254 0 idle_thread idle 0 0 0 rootserver inactive 0x10558 255 0 Change-Id: I48496ec0002e3307aaeb5c779319d4beb87ae56b GitOrigin-RevId: 8665f609bdb7efd3b814b4f40abf08c5dd1e863d
This commit is contained in:
parent
d602aa29d5
commit
c61d7890a7
@ -14,6 +14,8 @@ cmake_minimum_required(VERSION 3.7.2)
|
||||
|
||||
project(system)
|
||||
|
||||
CAmkESAddImportPath(interfaces)
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/rust.cmake)
|
||||
|
||||
RustAddLibrary(
|
||||
@ -31,4 +33,8 @@ DeclareCAmkESComponent(UartDriver
|
||||
SOURCES components/UartDriver/src/driver.c
|
||||
)
|
||||
|
||||
DeclareCAmkESComponent(SeL4Debug
|
||||
SOURCES components/SeL4Debug/src/wrappers.c
|
||||
)
|
||||
|
||||
DeclareCAmkESRootserver(system.camkes)
|
||||
|
@ -1,6 +1,10 @@
|
||||
import <SeL4DebugInterface.camkes>;
|
||||
|
||||
component DebugConsole {
|
||||
control;
|
||||
uses uart_inf uart;
|
||||
dataport Buf tx_dataport;
|
||||
dataport Buf rx_dataport;
|
||||
|
||||
uses SeL4DebugInterface sel4debug;
|
||||
}
|
||||
|
@ -74,6 +74,7 @@ fn dispatch_command(cmdline: &str, output: &mut dyn io::Write) {
|
||||
"echo" => echo_command(cmdline, output),
|
||||
"add" => add_command(&mut args, output),
|
||||
"clear" => clear_command(output),
|
||||
"ps" => ps_command(),
|
||||
_ => Err(CommandError::UnknownCommand),
|
||||
};
|
||||
if let Err(e) = result {
|
||||
@ -100,6 +101,13 @@ fn echo_command(cmdline: &str, output: &mut dyn io::Write) -> Result<(), Command
|
||||
}
|
||||
}
|
||||
|
||||
/// Implements a "ps" command that dumps seL4 scheduler state to the console.
|
||||
fn ps_command() -> Result<(), CommandError> {
|
||||
extern "C" { fn sel4debug_dump_scheduler(); }
|
||||
unsafe { sel4debug_dump_scheduler(); }
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Implements a binary float addition command.
|
||||
///
|
||||
/// This is a toy to demonstrate that the CLI can operate on some very basic
|
||||
|
5
apps/system/components/SeL4Debug/SeL4Debug.camkes
Normal file
5
apps/system/components/SeL4Debug/SeL4Debug.camkes
Normal file
@ -0,0 +1,5 @@
|
||||
import <SeL4DebugInterface.camkes>;
|
||||
|
||||
component SeL4Debug {
|
||||
provides SeL4DebugInterface sel4debug;
|
||||
}
|
14
apps/system/components/SeL4Debug/src/wrappers.c
Normal file
14
apps/system/components/SeL4Debug/src/wrappers.c
Normal file
@ -0,0 +1,14 @@
|
||||
#include <camkes.h>
|
||||
#include <sel4/syscalls.h>
|
||||
|
||||
void sel4debug_put_string(const char* msg) {
|
||||
#ifdef CONFIG_PRINTING
|
||||
seL4_DebugPutString((char*) msg);
|
||||
#endif
|
||||
}
|
||||
|
||||
void sel4debug_dump_scheduler() {
|
||||
#ifdef CONFIG_PRINTING
|
||||
seL4_DebugDumpScheduler();
|
||||
#endif
|
||||
}
|
4
apps/system/interfaces/SeL4DebugInterface.camkes
Normal file
4
apps/system/interfaces/SeL4DebugInterface.camkes
Normal file
@ -0,0 +1,4 @@
|
||||
procedure SeL4DebugInterface {
|
||||
void put_string(in string msg);
|
||||
void dump_scheduler();
|
||||
}
|
@ -15,6 +15,7 @@ import <std_connector.camkes>;
|
||||
import "interfaces/uart.idl4";
|
||||
import "components/UartDriver/UartDriver.camkes";
|
||||
import "components/DebugConsole/DebugConsole.camkes";
|
||||
import "components/SeL4Debug/SeL4Debug.camkes";
|
||||
|
||||
component UART {
|
||||
hardware;
|
||||
@ -28,6 +29,7 @@ assembly {
|
||||
component UART uart;
|
||||
component UartDriver drv;
|
||||
component DebugConsole debug_console;
|
||||
component SeL4Debug sel4debug;
|
||||
|
||||
connection seL4HardwareMMIO uart_mem(from drv.mem, to uart.mem);
|
||||
// TODO(mattharvey): Make receives wait on interrupt.
|
||||
@ -35,6 +37,10 @@ assembly {
|
||||
// from uart.interrupt, to drv.interrupt);
|
||||
connection seL4RPCCall uart_inf(from debug_console.uart, to drv.uart);
|
||||
|
||||
// Connect the SeL4Debug interface of each component that needs access.
|
||||
connection seL4RPCCall SeL4DebugInterface(from debug_console.sel4debug,
|
||||
to sel4debug.sel4debug);
|
||||
|
||||
connection seL4SharedData tx_channel(
|
||||
from debug_console.tx_dataport, to drv.tx_dataport);
|
||||
connection seL4SharedData rx_channel(
|
||||
|
Loading…
Reference in New Issue
Block a user