11use std:: borrow:: Cow ;
22use std:: collections:: HashMap ;
33use icicle_cpu:: mem:: { Mapping , MemError , perm} ;
4- use icicle_cpu:: { Cpu , ExceptionCode , ValueSource , VarSource , VmExit } ;
4+ use icicle_cpu:: { Cpu , ExceptionCode , ValueSource , VmExit } ;
55use pyo3:: prelude:: * ;
66use icicle_vm;
77use pyo3:: exceptions:: * ;
88use target_lexicon;
99use indexmap:: IndexMap ;
1010use target_lexicon:: Architecture ;
11- use icicle_cpu:: lifter:: InstructionSource ;
1211use sleigh_runtime:: NamedRegister ;
1312
1413// References:
@@ -270,7 +269,7 @@ impl Icicle {
270269
271270 #[ getter]
272271 pub fn get_icount ( & mut self ) -> u64 {
273- return self . vm . cpu . icount ;
272+ self . vm . cpu . icount
274273 }
275274
276275 #[ setter]
@@ -352,7 +351,7 @@ impl Icicle {
352351 }
353352 }
354353
355- // Setup the CPU state for the target triple
354+ // Set up the CPU state for the target triple
356355 let mut config = icicle_vm:: cpu:: Config :: from_target_triple (
357356 format ! ( "{architecture}-none" ) . as_str ( )
358357 ) ;
@@ -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) {
@@ -465,7 +465,7 @@ impl Icicle {
465465 e,
466466 )
467467 } ) ?;
468- return Ok ( Cow :: Owned ( buffer) ) ;
468+ Ok ( Cow :: Owned ( buffer) )
469469 }
470470
471471 pub fn mem_write ( & mut self , address : u64 , data : Vec < u8 > ) -> PyResult < ( ) > {
@@ -486,7 +486,7 @@ impl Icicle {
486486 let name = sleigh. get_str ( reg. name ) ;
487487 result. insert ( name. to_string ( ) , ( reg. offset , reg. var . size ) ) ;
488488 }
489- return Ok ( result) ;
489+ Ok ( result)
490490 }
491491
492492 pub fn reg_offset ( & self , name : & str ) -> PyResult < u32 > {
0 commit comments