Skip to content

Commit c86073c

Browse files
ioannisgcarlescufi
authored andcommitted
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 <[email protected]>
1 parent c736de0 commit c86073c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

include/arch/arm/error.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,14 @@ extern "C" {
3131
* schedule a new thread until they are unlocked which is not what we want.
3232
* Force them unlocked as well.
3333
*/
34-
#define Z_ARCH_EXCEPT(reason_p) do { \
34+
#define Z_ARCH_EXCEPT(reason_p) \
35+
register u32_t r0 __asm__("r0") = reason_p; \
36+
do { \
3537
__asm__ volatile ( \
3638
"cpsie i\n\t" \
37-
"movs r0, %[reason]\n\t" \
3839
"svc %[id]\n\t" \
3940
: \
40-
: [reason] "i" (reason_p), [id] "i" (_SVC_CALL_RUNTIME_EXCEPT) \
41+
: "r" (r0), [id] "i" (_SVC_CALL_RUNTIME_EXCEPT) \
4142
: "memory"); \
4243
CODE_UNREACHABLE; \
4344
} while (false)

0 commit comments

Comments
 (0)