Commit 3059e1fc authored by Marcus Shawcroft's avatar Marcus Shawcroft Committed by Kumar Gala
Browse files

arm: Refactor cortex-m4 irq_lock tmp handling.



Replace the use of a hardwired temporary register in the irq_lock()
implementation with a local variable.  This will allow the compiler
more flexibility in register allocation.

Change-Id: Ifbdb52fca1d40404d55934343ac2a8153df7e1a8
Signed-off-by: default avatarMarcus Shawcroft <marcus.shawcroft@arm.com>
parent 70c137d7
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -135,13 +135,15 @@ static ALWAYS_INLINE unsigned int _arch_irq_lock(void)
		:
		: "memory");
#else /* CONFIG_CPU_CORTEX_M3_M4 */
	unsigned int tmp;

	__asm__ volatile(
		"mov %%r1, %1;\n\t"
		"mov %1, %2;\n\t"
		"mrs %0, BASEPRI;\n\t"
		"msr BASEPRI, %%r1;\n\t"
		: "=r"(key)
		"msr BASEPRI, %1;\n\t"
		: "=r"(key), "=r"(tmp)
		: "i"(_EXC_IRQ_DEFAULT_PRIO)
		: "r1", "memory");
		: "memory");
#endif

	return key;