core/cortex-m0: Fix inline asm in in_interrupt_context
core/cortex-m0: Fix inline asm in in_interrupt_context

"lsl" is not a valid instruction for Cortex-M0:
https://developer.arm.com/documentation/ddi0432/c/CHDCICDF.

Instead of "lsl", gcc will silently emit the correct variant of the
instruction ("lsls" which updates condition codes).

However, when using clang, it fails to compile due to the invalid
instruction:

core/cortex-m0/task.c:178:7: error: invalid instruction, any one of the
following would fix this:

"lsl %0, #23\n" : "=r"(ret)); /* exception bits are the 9 LSB */
^

<inline asm>:2:1: note: instantiated into assembly here
lsl r0, #23
^
core/cortex-m0/task.c:178:7: note: instruction requires: thumb2

"lsl %0, #23\n" : "=r"(ret)); /* exception bits are the 9 LSB */
^

<inline asm>:2:1: note: instantiated into assembly here
lsl r0, #23
^
core/cortex-m0/task.c:178:7: note: no flag-preserving variant of this
instruction available

"lsl %0, #23\n" : "=r"(ret)); /* exception bits are the 9 LSB */
^

Instead of writing assembly to do the shifting, use C. The generated
code adds a few instructions since we're now returning a "bool" (0 or 1)
instead of the raw shifted value:

Before:

arm-none-eabi-objdump  -d build/servo_micro/RO/core/cortex-m0/task.o

00000000 <in_interrupt_context>:
   0:   f3ef 8005       mrs     r0, IPSR
   4:   05c0            lsls    r0, r0, #23
   6:   4770            bx      lr

After:

arm-none-eabi-objdump  -d build/servo_micro/RO/core/cortex-m0/task.o

00000000 <in_interrupt_context>:
   0:   f3ef 8005       mrs     r0, IPSR
   4:   05c0            lsls    r0, r0, #23
   6:   1e43            subs    r3, r0, #1
   8:   4198            sbcs    r0, r3
   a:   b2c0            uxtb    r0, r0
   c:   4770            bx      lr

BRANCH=none
BUG=b:172020503
TEST=CC=clang make BOARD=servo_micro -j
TEST=make buildall

Signed-off-by: Tom Hughes <fc5c12f30a5ed2baa0581f44ee14ad1eb7b20d83@chromium.org>
Change-Id: I530896186c2dbbd582f7c9973d1157ebe3601b34
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3197756
Reviewed-by: Keith Short <f6d578f97033c25f1206cb57d52f358974c82954@chromium.org>

coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec