aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorDavid Li <li.davidm96@gmail.com>2016-01-04 14:19:56 -0700
committerDavid Li <li.davidm96@gmail.com>2016-01-04 14:19:56 -0700
commitbb8162c22e34ac588f92b4d3783c39d04a67ec2c (patch)
tree08d7b613bd201a9524e3fef36c99dc3fcafcff17 /src/lib.rs
parentf71937d4bb74ad0ba8937da94643ddfe403ea346 (diff)
Fix cache sharing bug
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lib.rs b/src/lib.rs
index c3fa51b..35951c2 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -51,14 +51,16 @@ fn test_elfloader() {
let (data, data_offset) = data.unwrap();
let mmu = memory::IdentityMmu::new();
+ // TODO: make this a method; have it accept a MMU
let memory = memory::Memory::new_from_text_and_data(
0x8000,
text, text_offset as usize,
data, data_offset as usize);
let memory_ref = Rc::new(RefCell::new(Box::new(memory) as Box<memory::MemoryInterface>));
let cache = Rc::new( RefCell::new( Box::new( memory::DirectMappedCache::new(4, 4, memory_ref.clone())) as Box<memory::MemoryInterface>) );
- let core = simulator::Core::new(start, cache.clone(), Box::new(mmu));
- let mut simulator = simulator::Simulator::new(vec![core], memory_ref.clone());
+ let core = simulator::Core::new(start, 0x1000, cache.clone(), Box::new(mmu));
+ let core2 = simulator::Core::new(start, 0x3000, cache.clone(), Box::new(memory::IdentityMmu::new()));
+ let mut simulator = simulator::Simulator::new(vec![core, core2], memory_ref.clone());
simulator.run();
}