From 41b86cd4fad57d296d7474b1c87c19eda90333d0 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Sun, 18 Aug 2024 16:31:17 -0700 Subject: [PATCH] feature(hypervisor-dmesg): runtime: add read_hypervisor_console wrapper --- crates/runtime/src/lib.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/runtime/src/lib.rs b/crates/runtime/src/lib.rs index 9e957e5..f9fe270 100644 --- a/crates/runtime/src/lib.rs +++ b/crates/runtime/src/lib.rs @@ -297,4 +297,14 @@ impl Runtime { let context = RuntimeContext::new().await?; Ok(PowerManagementContext { context }) } + + pub async fn read_hypervisor_console(&self, clear: bool) -> Result> { + let index = 0 as u32; + let (rawbuf, newindex) = self.context + .xen + .call + .read_console_ring_raw(clear, index).await?; + let buf = std::str::from_utf8(&rawbuf[..newindex as usize])?; + Ok(Arc::from(buf)) + } }