From 40e306349cdc2bf4bfe6bb26c7dc62ee51f317ea Mon Sep 17 00:00:00 2001 From: Michel Heily Date: Fri, 23 Oct 2020 01:31:58 +0300 Subject: [PATCH] core: arm7tdmi: Force address alignment in memory accesses Fixes #148 Former-commit-id: 36f33c599cd9a3c51115bf20037bfdce9f581912 Former-commit-id: 24130ddb51ae3dff2c576289b74a8cbd7519593f --- core/src/arm7tdmi/memory.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/src/arm7tdmi/memory.rs b/core/src/arm7tdmi/memory.rs index 0147011..3ac86f3 100644 --- a/core/src/arm7tdmi/memory.rs +++ b/core/src/arm7tdmi/memory.rs @@ -88,12 +88,12 @@ impl MemoryInterface for Core { #[inline] fn load_16(&mut self, addr: u32, access: MemoryAccess) -> u16 { - self.bus.load_16(addr, access) + self.bus.load_16(addr & !1, access) } #[inline] fn load_32(&mut self, addr: u32, access: MemoryAccess) -> u32 { - self.bus.load_32(addr, access) + self.bus.load_32(addr & !3, access) } #[inline] @@ -102,12 +102,12 @@ impl MemoryInterface for Core { } #[inline] fn store_16(&mut self, addr: u32, value: u16, access: MemoryAccess) { - self.bus.store_16(addr, value, access); + self.bus.store_16(addr & !1, value, access); } #[inline] fn store_32(&mut self, addr: u32, value: u32, access: MemoryAccess) { - self.bus.store_32(addr, value, access); + self.bus.store_32(addr & !3, value, access); } #[inline]