summaryrefslogtreecommitdiff
path: root/firmware/target
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2023-03-23 18:16:15 +0000
committerAidan MacDonald <amachronic@protonmail.com>2023-03-23 18:16:33 +0000
commit58b2e457824dc93916233627b98614409e5f258d (patch)
tree67c485a7881745574d66ae10889c2da331ba68c0 /firmware/target
parent86429dbf1eca8ee0e08176997f508647c3abf6bd (diff)
downloadrockbox-58b2e457824dc93916233627b98614409e5f258d.tar.gz
rockbox-58b2e457824dc93916233627b98614409e5f258d.zip
Fix unified syntax in ARM inline assembly
GCC 4.9 always emits assembly with divided syntax. Setting unified syntax in inline assembly causes the assembler to complain about GCC's generated code, because the directive extends past the scope of the inline asm. Fix this by setting divided mode at the end of the inline assembly block. The assembler directives are hidden behind macros because later versions of GCC won't need this workaround: they can be told to use the unified syntax with -masm-syntax-unified. Change-Id: Ic09e729e5bbb6fd44d08dac348daf6f55c75d7d8
Diffstat (limited to 'firmware/target')
-rw-r--r--firmware/target/arm/pcm-telechips.c3
-rw-r--r--firmware/target/arm/pp/pcm-pp.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/firmware/target/arm/pcm-telechips.c b/firmware/target/arm/pcm-telechips.c
index 747765d8fb..45044bc664 100644
--- a/firmware/target/arm/pcm-telechips.c
+++ b/firmware/target/arm/pcm-telechips.c
@@ -218,7 +218,7 @@ void fiq_handler(void)
218 * r0-r3 and r12 is a working register. 218 * r0-r3 and r12 is a working register.
219 */ 219 */
220 asm volatile ( 220 asm volatile (
221 ".syntax unified \n" 221 BEGIN_ARM_ASM_SYNTAX_UNIFIED
222 "sub lr, lr, #4 \n" 222 "sub lr, lr, #4 \n"
223 "stmfd sp!, { r0-r3, lr } \n" /* stack scratch regs and lr */ 223 "stmfd sp!, { r0-r3, lr } \n" /* stack scratch regs and lr */
224 "mov r14, #0 \n" /* Was the callback called? */ 224 "mov r14, #0 \n" /* Was the callback called? */
@@ -274,6 +274,7 @@ void fiq_handler(void)
274 "bhi .fill_fifo \n" /* not stop and enough? refill */ 274 "bhi .fill_fifo \n" /* not stop and enough? refill */
275 "ldmfd sp!, { r0-r3, pc }^ \n" /* exit */ 275 "ldmfd sp!, { r0-r3, pc }^ \n" /* exit */
276 ".ltorg \n" 276 ".ltorg \n"
277 END_ARM_ASM_SYNTAX_UNIFIED
277 : : "i"(PCM_DMAST_OK), "i"(PCM_DMAST_STARTED) 278 : : "i"(PCM_DMAST_OK), "i"(PCM_DMAST_STARTED)
278 ); 279 );
279} 280}
diff --git a/firmware/target/arm/pp/pcm-pp.c b/firmware/target/arm/pp/pcm-pp.c
index fd798f0506..94b1c5ae10 100644
--- a/firmware/target/arm/pp/pcm-pp.c
+++ b/firmware/target/arm/pp/pcm-pp.c
@@ -327,7 +327,7 @@ void fiq_playback(void)
327 */ 327 */
328 asm volatile ( 328 asm volatile (
329 /* No external calls */ 329 /* No external calls */
330 ".syntax unified \n" 330 BEGIN_ARM_ASM_SYNTAX_UNIFIED
331 "sub lr, lr, #4 \n" /* Prepare return address */ 331 "sub lr, lr, #4 \n" /* Prepare return address */
332 "stmfd sp!, { lr } \n" /* stack lr so we can use it */ 332 "stmfd sp!, { lr } \n" /* stack lr so we can use it */
333 "ldr r12, =0xcf001040 \n" /* Some magic from iPodLinux ... */ 333 "ldr r12, =0xcf001040 \n" /* Some magic from iPodLinux ... */
@@ -395,6 +395,7 @@ void fiq_playback(void)
395 "bne 3b \n" /* no? -> go return */ 395 "bne 3b \n" /* no? -> go return */
396 "b 2b \n" /* yes -> get even more */ 396 "b 2b \n" /* yes -> get even more */
397 ".ltorg \n" 397 ".ltorg \n"
398 END_ARM_ASM_SYNTAX_UNIFIED
398 : /* These must only be integers! No regs */ 399 : /* These must only be integers! No regs */
399 : "i"(PCM_DMAST_OK), "i"(PCM_DMAST_STARTED)); 400 : "i"(PCM_DMAST_OK), "i"(PCM_DMAST_STARTED));
400} 401}