arch: arm: error: fix ARMv6-M assembly for Z_ARCH_EXCEPT

As we are allowed to pass any integer value as as software
fatal exception reason, we need to fix the inline assembly
for ARMv6-M, to accept large immediate offsets. We do this
by changing the way we write the exception reason to R0.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit is contained in:
Ioannis Glaropoulos 2019-10-15 19:45:33 +02:00 committed by Carles Cufí
commit c86073cf6b

View file

@ -31,13 +31,14 @@ extern "C" {
* schedule a new thread until they are unlocked which is not what we want.
* Force them unlocked as well.
*/
#define Z_ARCH_EXCEPT(reason_p) do { \
#define Z_ARCH_EXCEPT(reason_p) \
register u32_t r0 __asm__("r0") = reason_p; \
do { \
__asm__ volatile ( \
"cpsie i\n\t" \
"movs r0, %[reason]\n\t" \
"svc %[id]\n\t" \
: \
: [reason] "i" (reason_p), [id] "i" (_SVC_CALL_RUNTIME_EXCEPT) \
: "r" (r0), [id] "i" (_SVC_CALL_RUNTIME_EXCEPT) \
: "memory"); \
CODE_UNREACHABLE; \
} while (false)