armwrestler-fix: Fix post indexed LDR_STR when rd==rn

Former-commit-id: b886c969c2d570fbb831eeeddc0f65ad575cfccb
This commit is contained in:
Michel Heily 2019-07-27 21:28:43 +03:00
parent 477b4f45fd
commit df48f307f0

View file

@ -209,9 +209,6 @@ impl Core {
/// For LDR, add y=1S+1N if Rd=R15. /// For LDR, add y=1S+1N if Rd=R15.
fn exec_ldr_str(&mut self, bus: &mut Bus, insn: ArmInstruction) -> CpuExecResult { fn exec_ldr_str(&mut self, bus: &mut Bus, insn: ArmInstruction) -> CpuExecResult {
let mut writeback = insn.write_back_flag(); let mut writeback = insn.write_back_flag();
if writeback && insn.rd() == insn.rn() {
writeback = false;
}
let mut addr = self.get_reg(insn.rn()); let mut addr = self.get_reg(insn.rn());
if insn.rn() == REG_PC { if insn.rn() == REG_PC {
@ -227,6 +224,9 @@ impl Core {
writeback = true; writeback = true;
addr addr
}; };
if writeback && insn.rd() == insn.rn() {
writeback = false;
}
if insn.load_flag() { if insn.load_flag() {
let data = if insn.transfer_size() == 1 { let data = if insn.transfer_size() == 1 {
@ -265,9 +265,6 @@ impl Core {
fn exec_ldr_str_hs(&mut self, bus: &mut Bus, insn: ArmInstruction) -> CpuExecResult { fn exec_ldr_str_hs(&mut self, bus: &mut Bus, insn: ArmInstruction) -> CpuExecResult {
let mut writeback = insn.write_back_flag(); let mut writeback = insn.write_back_flag();
if writeback && insn.rd() == insn.rn() {
writeback = false;
}
let mut addr = self.get_reg(insn.rn()); let mut addr = self.get_reg(insn.rn());
if insn.rn() == REG_PC { if insn.rn() == REG_PC {
@ -283,7 +280,9 @@ impl Core {
writeback = true; writeback = true;
addr addr
}; };
if writeback && insn.rd() == insn.rn() {
writeback = false;
}
if insn.load_flag() { if insn.load_flag() {
let data = match insn.halfword_data_transfer_type().unwrap() { let data = match insn.halfword_data_transfer_type().unwrap() {
ArmHalfwordTransferType::SignedByte => self.load_8(addr, bus) as u8 as i8 as u32, ArmHalfwordTransferType::SignedByte => self.load_8(addr, bus) as u8 as i8 as u32,