From f4ecb2e56397365d8ea809b169df0734a1a6524c Mon Sep 17 00:00:00 2001 From: David Li Date: Tue, 12 Jan 2016 09:26:23 -0700 Subject: Generate payload randomly --- src/main.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index 7d17d48..0667401 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,7 @@ extern crate docopt; #[macro_use] extern crate log; extern crate env_logger; +extern crate rand; extern crate rustc_serialize; extern crate rustv; extern crate time; @@ -77,7 +78,10 @@ fn main() { let start1 = load_program(&mut memory, &mmu, &args.arg_program1); let start2 = load_program(&mut memory, &mmu2, &args.arg_program2); - let memory = MemoryTracker::new(memory, 0x43, 0x42); + let payload1 = rand::random::(); + let payload2 = rand::random::(); + + let memory = MemoryTracker::new(memory, payload1, payload2); let memory_ref = Rc::new(RefCell::new(memory)); let cache = memory::DirectMappedCache::new(2, 64, memory_ref.clone()); @@ -85,7 +89,6 @@ fn main() { let cache2 = memory::DirectMappedCache::new(2, 64, memory_ref.clone()); let cache2_ref = Rc::new(RefCell::new(cache2)); - let mut cores = vec![]; let mut core_caches = vec![]; @@ -98,6 +101,7 @@ fn main() { Box::new(memory::IdentityMmu::new()) ); core.registers().write_word(isa::Register::X10, i as isa::Word); + core.registers().write_word(isa::Register::X11, payload1 as isa::Word); cores.push(core); } @@ -110,6 +114,7 @@ fn main() { Box::new(memory::ReverseMmu::new(0x4000000)) ); core.registers().write_word(isa::Register::X10, (i - 4) as isa::Word); + core.registers().write_word(isa::Register::X11, payload2 as isa::Word); cores.push(core); } -- cgit v1.2.3