diff options
author | David Li <li.davidm96@gmail.com> | 2016-01-04 14:19:56 -0700 |
---|---|---|
committer | David Li <li.davidm96@gmail.com> | 2016-01-04 14:19:56 -0700 |
commit | bb8162c22e34ac588f92b4d3783c39d04a67ec2c (patch) | |
tree | 08d7b613bd201a9524e3fef36c99dc3fcafcff17 /src/lib.rs | |
parent | f71937d4bb74ad0ba8937da94643ddfe403ea346 (diff) |
Fix cache sharing bug
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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(); } |