feature(hypervisor-dmesg): xencall: add read_console_ring_raw hypercall wrapper

This commit is contained in:
Ariadne Conill
2024-08-18 16:05:18 -07:00
parent 85ca58ac85
commit 73c85dfe04
2 changed files with 47 additions and 2 deletions

View File

@ -0,0 +1,18 @@
use xencall::error::Result;
use xencall::XenCall;
#[tokio::main]
async fn main() -> Result<()> {
env_logger::init();
let call = XenCall::open(0)?;
let index = 0 as u32;
let (buf, newindex) = call.read_console_ring_raw(false, index).await?;
match std::str::from_utf8(&buf[..newindex as usize]) {
Ok(v) => print!("{}", v),
_ => panic!("unable to decode Xen console messages"),
};
Ok(())
}