Fix wrapping memory reads for 64-bit addresses

This commit is contained in:
2025-01-05 13:54:53 -05:00
parent 84f2cf7ece
commit 2cf99dbc21
3 changed files with 12 additions and 10 deletions
+5 -3
View File
@@ -1,4 +1,4 @@
use std::{ffi::c_void, ops::Range, ptr, slice};
use std::{ffi::c_void, ptr, slice};
use anyhow::{anyhow, Result};
use bitflags::bitflags;
@@ -349,10 +349,12 @@ impl Sim {
}
}
pub fn read_memory(&mut self, addresses: Range<u32>, into: &mut Vec<u8>) {
for address in addresses {
pub fn read_memory(&mut self, start: u32, length: usize, into: &mut Vec<u8>) {
let mut address = start;
for _ in 0..length {
let byte = unsafe { vb_read(self.sim, address, VBDataType::U8) };
into.push(byte as u8);
address = address.wrapping_add(1);
}
}