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
+3 -4
View File
@@ -3,7 +3,6 @@ use std::{
fmt::Display,
fs::{self, File},
io::{Read, Seek, SeekFrom, Write},
ops::Range,
path::{Path, PathBuf},
sync::{
atomic::{AtomicBool, Ordering},
@@ -529,11 +528,11 @@ impl Emulator {
let value = sim.read_register(register);
let _ = done.send(value);
}
EmulatorCommand::ReadMemory(sim_id, addresses, mut buffer, done) => {
EmulatorCommand::ReadMemory(sim_id, start, length, mut buffer, done) => {
let Some(sim) = self.sims.get_mut(sim_id.to_index()) else {
return;
};
sim.read_memory(addresses, &mut buffer);
sim.read_memory(start, length, &mut buffer);
let _ = done.send(buffer);
}
EmulatorCommand::AddBreakpoint(sim_id, address) => {
@@ -611,7 +610,7 @@ pub enum EmulatorCommand {
DebugContinue(SimId),
DebugStep(SimId),
ReadRegister(SimId, VBRegister, oneshot::Sender<u32>),
ReadMemory(SimId, Range<u32>, Vec<u8>, oneshot::Sender<Vec<u8>>),
ReadMemory(SimId, u32, usize, Vec<u8>, oneshot::Sender<Vec<u8>>),
AddBreakpoint(SimId, u32),
RemoveBreakpoint(SimId, u32),
SetAudioEnabled(bool, bool),