Skip to content

Commit

Permalink
arch: arm: cortex_m: add ip & lr to the clobber list
Browse files Browse the repository at this point in the history
Calls to other function may clobber ip & lr too so these register need to
be added to the clobberlist.
r3 is not actually used in z_arm_switch_to_main_no_multithreading so it is
also removed from the clobber list.

Signed-off-by: Wilfried Chauveau <[email protected]>
  • Loading branch information
ithinuel authored and nashif committed Jul 10, 2024
1 parent 5d76353 commit 1b820df
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/arm/core/cortex_m/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ void arch_switch_to_main_thread(struct k_thread *main_thread, char *stack_ptr,
"bx r4\n" /* We don’t intend to return, so there is no need to link. */
: "+r" (_main)
: "r" (stack_ptr)
: "r0", "r1", "r2", "r3", "r4");
: "r0", "r1", "r2", "r3", "r4", "ip", "lr");

CODE_UNREACHABLE;
}
Expand Down Expand Up @@ -659,7 +659,7 @@ FUNC_NORETURN void z_arm_switch_to_main_no_multithreading(
#ifdef CONFIG_BUILTIN_STACK_GUARD
, [_psplim]"r" (psplim)
#endif
: "r0", "r1", "r2", "r3"
: "r0", "r1", "r2", "ip", "lr"
);

CODE_UNREACHABLE; /* LCOV_EXCL_LINE */
Expand Down

0 comments on commit 1b820df

Please sign in to comment.