feature(hypervisor-dmesg): runtime: add read_hypervisor_console wrapper

This commit is contained in:
Ariadne Conill 2024-08-18 16:31:17 -07:00
parent 363ff3010f
commit 41b86cd4fa
No known key found for this signature in database

View File

@ -297,4 +297,14 @@ impl Runtime {
let context = RuntimeContext::new().await?;
Ok(PowerManagementContext { context })
}
pub async fn read_hypervisor_console(&self, clear: bool) -> Result<Arc<str>> {
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))
}
}