From 4ab96b42a086031a273c78fdf9ad273852e8400e Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Mon, 10 Apr 2017 20:20:53 -0700 Subject: [PATCH] DS Memory: Ensure DS9 I/O is 8-byte aligned --- CHANGES | 1 + include/mgba-util/common.h | 2 ++ include/mgba/internal/ds/memory.h | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 67c307f25..68e2bcc44 100644 --- a/CHANGES +++ b/CHANGES @@ -8,6 +8,7 @@ Bugfixes: - DS GX: Fix 4-color texture coordinates Misc: - DS: Set boot complete bit in RAM on boot (fixes mgba.io/i/576, mgba.io/i/580, mgba.io/i/586) + - DS Memory: Ensure DS9 I/O is 8-byte aligned 0.6.0: (Future) Features: diff --git a/include/mgba-util/common.h b/include/mgba-util/common.h index 4f36c0a17..6f3b0695b 100644 --- a/include/mgba-util/common.h +++ b/include/mgba-util/common.h @@ -153,9 +153,11 @@ typedef intptr_t ssize_t; #ifdef _MSC_VER #define ATTRIBUTE_UNUSED +#define ATTRIBUTE_ALIGN(X) #define ATTRIBUTE_FORMAT(X, Y, Z) #else #define ATTRIBUTE_UNUSED __attribute__((unused)) +#define ATTRIBUTE_ALIGN(X) __attribute__((aligned(X))) #define ATTRIBUTE_FORMAT(X, Y, Z) __attribute__((format(X, Y, Z))) #endif diff --git a/include/mgba/internal/ds/memory.h b/include/mgba/internal/ds/memory.h index 048f0bee0..1ec48a86e 100644 --- a/include/mgba/internal/ds/memory.h +++ b/include/mgba/internal/ds/memory.h @@ -90,7 +90,7 @@ struct DSMemory { uint32_t* wram7; uint32_t* rom; uint16_t io7[DS7_REG_MAX >> 1]; - uint16_t io9[DS9_REG_MAX >> 1]; + uint16_t io9[DS9_REG_MAX >> 1] ATTRIBUTE_ALIGN(8); struct DSSlot1 slot1; struct DSSPIBus spiBus;