diff options
author | David Li <li.davidm96@gmail.com> | 2016-01-04 18:30:23 -0700 |
---|---|---|
committer | David Li <li.davidm96@gmail.com> | 2016-01-04 18:30:23 -0700 |
commit | 6b3d1df04776406a39b3fd0fab18e49b92c84190 (patch) | |
tree | da3e8ca5c302342661f966d2ebec2c242e92530c /src/lib.rs | |
parent | bb8162c22e34ac588f92b4d3783c39d04a67ec2c (diff) |
Make memory construction from segments a method instead
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -52,10 +52,9 @@ fn test_elfloader() { 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 mut memory = memory::Memory::new(0x8000); + memory.write_segment(text, text_offset as usize); + memory.write_segment(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, 0x1000, cache.clone(), Box::new(mmu)); |