Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mohanson committed Jul 14, 2023
1 parent 1c18cbe commit 7efa8f9
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/snapshot.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
use crate::instructions::Register;
use crate::memory::Memory;
use crate::memory::FLAG_DIRTY;
use crate::{
CoreMachine, Error, RISCV_GENERAL_REGISTER_NUMBER, RISCV_PAGES, RISCV_PAGESIZE,
RISCV_PAGE_SHIFTS,
};
use crate::{CoreMachine, Error, RISCV_GENERAL_REGISTER_NUMBER, RISCV_PAGESIZE, RISCV_PAGE_SHIFTS};
use serde::{Deserialize, Serialize};

// Snapshot provides a mechanism for suspending and resuming a virtual machine.
Expand Down Expand Up @@ -47,7 +44,7 @@ pub fn make_snapshot<T: CoreMachine>(machine: &mut T) -> Result<Snapshot, Error>
snap.registers[i] = v.to_u64();
}

for i in 0..RISCV_PAGES {
for i in 0..(machine.memory().memory_size() >> RISCV_PAGE_SHIFTS) {
let flag = machine.memory_mut().fetch_flag(i as u64)?;
if flag & FLAG_DIRTY != 0 {
let addr_from = i << RISCV_PAGE_SHIFTS;
Expand Down

0 comments on commit 7efa8f9

Please sign in to comment.