Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: log vCPU diagnostics on triple fault and for some unhandled exit types #795

Merged
merged 11 commits into from
Oct 22, 2024
Prev Previous commit
Next Next commit
don't dump instr bytes if diag is disabled
gjcolombo committed Oct 18, 2024
commit f853b1db928d85076d0379cc46da25441ad7cf96
18 changes: 17 additions & 1 deletion lib/propolis/src/exits.rs
Original file line number Diff line number Diff line change
@@ -93,11 +93,27 @@ impl From<&bhyve_api::vm_exit_vmx> for VmxDetail {
}
}

#[derive(Copy, Clone, Debug)]
#[derive(Copy, Clone)]
pub struct InstEmul {
pub inst_data: [u8; 15],
pub len: u8,
}

impl std::fmt::Debug for InstEmul {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
#[cfg(feature = "omicron-build")]
let inst_data = "<redacted>";

#[cfg(not(feature = "omicron-build"))]
let inst_data = &self.inst_data;

f.debug_struct("InstEmul")
.field("inst_data", &inst_data)
.field("len", &self.len)
.finish()
}
}

impl InstEmul {
pub fn bytes(&self) -> &[u8] {
&self.inst_data[..usize::min(self.inst_data.len(), self.len as usize)]