aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Li <li.davidm96@gmail.com>2016-01-12 09:26:23 -0700
committerDavid Li <li.davidm96@gmail.com>2016-01-12 09:26:23 -0700
commitf4ecb2e56397365d8ea809b169df0734a1a6524c (patch)
tree00a6672dd3dd0af9171b8bd9f2bd81fc544af276 /src
parent6ee72c288121ffa611ad75a00682bf103acea1fe (diff)
Generate payload randomly
Diffstat (limited to 'src')
-rw-r--r--src/main.rs9
1 files changed, 7 insertions, 2 deletions
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::<u8>();
+ let payload2 = rand::random::<u8>();
+
+ 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);
}