Skip to content

Commit

Permalink
Bump simulator bindings version and update cfg for simics_version (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
novafacing authored Sep 17, 2024
1 parent e412fc4 commit ae67b0d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ yaxpeax-riscv = { git = "https://github.com/DrChat/yaxpeax-riscv", version = "0.
"serde",
], rev = "5973ff8" }
crc32fast = "1.4.2"
simics = "0.1.1"
simics = "0.1.2"
indoc = "2.0.5"
serde = { version = "1.0.210", features = ["derive"] }
serde_json = "1.0.128"
Expand Down Expand Up @@ -105,16 +105,16 @@ thiserror = "1.0.63"
lcov2 = "0.1.0"

[dev-dependencies]
simics-test = "0.1.0"
simics-test = "0.1.1"
anyhow = "1.0.86"
command-ext = "0.1.2"
indoc = "2.0.5"
ispm-wrapper = "0.1.0"
ispm-wrapper = "0.1.1"
versions = { version = "6.2.0", features = ["serde"] }

[build-dependencies]
simics = "0.1.1"
simics-build-utils = "0.1.0"
simics = "0.1.2"
simics-build-utils = "0.1.1"

[profile.release]
lto = true
Expand Down
18 changes: 9 additions & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

use crate::interfaces::{config::config, fuzz::fuzz};
use crate::state::SolutionKind;
#[cfg(simics_version_6)]
#[cfg(simics_version = "6")]
use crate::util::Utils;
use anyhow::{anyhow, Result};
use arch::{Architecture, ArchitectureHint, ArchitectureOperations};
Expand All @@ -55,11 +55,11 @@ use simics::{
CoreSimulationStoppedHap, CpuInstrumentationSubscribeInterface, Event, EventClassFlag,
FromConfObject, HapHandle, Interface,
};
#[cfg(simics_version_6)]
#[cfg(simics_version = "6")]
use simics::{
discard_future, restore_micro_checkpoint, save_micro_checkpoint, MicroCheckpointFlags,
};
#[cfg(simics_version_7)]
#[cfg(simics_version = "7")]
// NOTE: save_snapshot used because it is a stable alias for both save_snapshot and take_snapshot
// which is necessary because this module is compatible with base versions which cross the
// deprecation boundary
Expand Down Expand Up @@ -735,7 +735,7 @@ impl Tsffs {

self.log(LogMessage::startup())?;

#[cfg(simics_version_7)]
#[cfg(simics_version = "7")]
{
if self.pre_snapshot_checkpoint {
debug!(
Expand All @@ -759,7 +759,7 @@ impl Tsffs {
.map_err(|_| anyhow!("Snapshot name already set"))?;
}

#[cfg(simics_version_6)]
#[cfg(simics_version = "6")]
{
if self.pre_snapshot_checkpoint {
debug!(
Expand Down Expand Up @@ -805,9 +805,9 @@ impl Tsffs {
/// Restore the initial snapshot using the configured method (either rev-exec micro checkpoints
/// or snapshots)
pub fn restore_initial_snapshot(&mut self) -> Result<()> {
#[cfg(simics_version_7)]
#[cfg(simics_version = "7")]
restore_snapshot(Self::SNAPSHOT_NAME)?;
#[cfg(simics_version_6)]
#[cfg(simics_version = "6")]
{
restore_micro_checkpoint(*self.micro_checkpoint_index.get().ok_or_else(|| {
anyhow!("Not using snapshots and no micro checkpoint index present")
Expand All @@ -821,9 +821,9 @@ impl Tsffs {

/// Whether an initial snapshot has been saved
pub fn have_initial_snapshot(&self) -> bool {
let have = if cfg!(simics_version_7) {
let have = if cfg!(simics_version = "7") {
self.snapshot_name.get().is_some()
} else if cfg!(simics_version_6) {
} else if cfg!(simics_version = "6") {
self.snapshot_name.get().is_some() && self.micro_checkpoint_index.get().is_some()
} else {
error!(self.as_conf_object(), "Unsupported SIMICS version");
Expand Down

0 comments on commit ae67b0d

Please sign in to comment.