1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-15 09:33:50 +01:00

cpu/cortexm_common: Fix cpu_switch_context_exit()

- Use `irq_enable()` over `bl irq_enable`, as `irq_enable()` is an inline
  function and not a C function any more
- Drop `__attribute__((naked))` qualifier
    - It must be used with the declaration of the function, but there it is
      missing. (And it cannot be added there, as this function would need to
      be implemented as "naked" by every platform; which is impossible for
      platforms not supporting `__attribute__((naked))`.)
    - Only functions consisting completely of basic asm may be marked as naked.
      But both the assembly used to trigger the SVC interrupt as well as the
      assembly used in `irq_enable()` are extended asm, not basic asm
- Use ` UNREACHABLE();` over a custom asm construct
This commit is contained in:
Marian Buschsieweke 2020-07-03 12:48:42 +02:00
parent 339e3faf21
commit 056100c1ca
No known key found for this signature in database
GPG Key ID: 61F64C6599B1539F

View File

@ -265,15 +265,19 @@ void *thread_isr_stack_start(void)
return (void *)&_sstack;
}
__attribute__((naked)) void NORETURN cpu_switch_context_exit(void)
void NORETURN cpu_switch_context_exit(void)
{
/* enable IRQs to make sure the SVC interrupt is reachable */
irq_enable();
/* trigger the SVC interrupt */
__asm__ volatile (
"bl irq_enable \n" /* enable IRQs to make the SVC
* interrupt is reachable */
"svc #1 \n" /* trigger the SVC interrupt */
"unreachable%=: \n" /* this loop is unreachable */
"b unreachable%= \n" /* loop indefinitely */
:::);
"svc #1 \n"
: /* no outputs */
: /* no inputs */
: /* no clobbers */
);
UNREACHABLE();
}
void thread_yield_higher(void)