diff --git a/src/snapshot2.rs b/src/snapshot2.rs index 7b7cc78c..0b76a314 100644 --- a/src/snapshot2.rs +++ b/src/snapshot2.rs @@ -117,8 +117,12 @@ impl> Snapshot2Context { id: &I, offset: u64, length: u64, + size_addr: u64, ) -> Result<(u64, u64), Error> { let (data, full_length) = self.load_data(id, offset, length)?; + machine + .memory_mut() + .store64(&M::REG::from_u64(size_addr), &M::REG::from_u64(full_length))?; self.untrack_pages(machine, addr, data.len() as u64)?; machine.memory_mut().store_bytes(addr, &data)?; self.track_pages(machine, addr, data.len() as u64, id, offset)?; diff --git a/tests/test_resume2.rs b/tests/test_resume2.rs index 3eb1fe19..be79b280 100644 --- a/tests/test_resume2.rs +++ b/tests/test_resume2.rs @@ -362,7 +362,7 @@ impl Syscalls for InsertDataSyscall { self.0 .lock() .unwrap() - .store_bytes(machine, addr, &DATA_ID, 0, size)?; + .store_bytes(machine, addr, &DATA_ID, 0, size, 0)?; machine.add_cycles_no_checking(100000)?; @@ -634,11 +634,11 @@ pub fn test_store_bytes_twice() { Machine::Asm(ref mut inner, ref ctx) => { ctx.lock() .unwrap() - .store_bytes(&mut inner.machine, 0, &DATA_ID, 2, 29186) + .store_bytes(&mut inner.machine, 0, &DATA_ID, 2, 29186, 0) .unwrap(); ctx.lock() .unwrap() - .store_bytes(&mut inner.machine, 0, &DATA_ID, 0, 11008) + .store_bytes(&mut inner.machine, 0, &DATA_ID, 0, 11008, 0) .unwrap(); } _ => unimplemented!(), @@ -667,7 +667,7 @@ pub fn test_mixing_snapshot2_writes_with_machine_raw_writes() { Machine::Asm(ref mut inner, ref ctx) => { ctx.lock() .unwrap() - .store_bytes(&mut inner.machine, 0, &DATA_ID, 0, 29186) + .store_bytes(&mut inner.machine, 0, &DATA_ID, 0, 29186, 0) .unwrap(); inner .machine