1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
// Copyright (C) 2024 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//! SIMICS version access and management APIs
use crate::{
sys::{SIM_copyright, SIM_version, SIM_version_base, SIM_version_major, SIM_vmxmon_version},
Result,
};
use std::ffi::CStr;
/// Get the current SIMICS version
///
/// # Contex
///
/// Global Context
pub fn version() -> Result<String> {
Ok(unsafe { CStr::from_ptr(SIM_version()) }
.to_str()?
.to_string())
}
/// Get the current SIMICS version base
///
/// # Contex
///
/// Global Context
pub fn version_base() -> Result<String> {
Ok(unsafe { CStr::from_ptr(SIM_version_base()) }
.to_str()?
.to_string())
}
/// Get the current SIMICS major version
///
/// # Contex
///
/// Global Context
pub fn version_major() -> Result<String> {
Ok(unsafe { CStr::from_ptr(SIM_version_major()) }
.to_str()?
.to_string())
}
/// Get the current SIMICS vmxmon version
///
/// # Contex
///
/// Global Context
pub fn vmxmon_version() -> Result<String> {
Ok(unsafe { CStr::from_ptr(SIM_vmxmon_version()) }
.to_str()?
.to_string())
}
/// Get the current copyright string
///
/// # Contex
///
/// Global Context
pub fn copyright() -> Result<String> {
Ok(unsafe { CStr::from_ptr(SIM_copyright()) }
.to_str()?
.to_string())
}