From ba19cf89ed8f45ac86cc3eaec01b1918c07fea43 Mon Sep 17 00:00:00 2001 From: Simon Beaudoin Date: Sun, 19 Jul 2020 22:14:37 -0400 Subject: [PATCH] Update port.c Error on my part, this is the right inline asm code to retreive CPSR register --- portable/GCC/ARM_CR5/port.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/portable/GCC/ARM_CR5/port.c b/portable/GCC/ARM_CR5/port.c index 28144d0af..656d79a98 100644 --- a/portable/GCC/ARM_CR5/port.c +++ b/portable/GCC/ARM_CR5/port.c @@ -149,10 +149,14 @@ /* Adding the necessary stuff in order to be able to determine from C code wheter or not the IRQs are enabled at the processor level (not interrupt controller level) */ -#define GET_CPSR() __asm__ __volatile__(\ - "msr cpsr,%0\n"\ - : : "r" (v)\ - ) +#define GET_CPSR() ({u32 rval = 0U; \ + __asm__ __volatile__(\ + "mrs %0, cpsr\n"\ + : "=r" (rval)\ + );\ + rval;\ + }) + #define CPSR_IRQ_ENABLE_MASK 0x80U #define IS_IRQ_DISABLED() ({unsigned int val = 0; val = (GET_CPSR() & CPSR_IRQ_ENABLE_MASK) ? 1 : 0; val;})