Skip to content

Commit 583932d

Browse files
committed
Map memory as initialized unless track_uninitialized is enabled
Related to #9
1 parent ad481a2 commit 583932d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
use std::borrow::Cow;
22
use std::collections::HashMap;
33
use icicle_cpu::mem::{Mapping, MemError, perm};
4-
use icicle_cpu::{Cpu, ExceptionCode, ValueSource, VarSource, VmExit};
4+
use icicle_cpu::{Cpu, ExceptionCode, ValueSource, VmExit};
55
use pyo3::prelude::*;
66
use icicle_vm;
77
use pyo3::exceptions::*;
88
use target_lexicon;
99
use indexmap::IndexMap;
1010
use target_lexicon::Architecture;
11-
use icicle_cpu::lifter::InstructionSource;
1211
use sleigh_runtime::NamedRegister;
1312

1413
// References:
@@ -412,8 +411,9 @@ impl Icicle {
412411
}
413412

414413
pub fn mem_map(&mut self, address: u64, size: u64, protection: MemoryProtection) -> PyResult<()> {
414+
let init_perm = if self.vm.cpu.mem.track_uninitialized { perm::NONE } else { perm::INIT };
415415
let mapping = Mapping {
416-
perm: convert_protection(protection),
416+
perm: convert_protection(protection) | init_perm,
417417
value: 0,
418418
};
419419
if self.vm.cpu.mem.map_memory_len(address, size, mapping) {

0 commit comments

Comments
 (0)