Skip to content

Commit 70e6eed

Browse files
Arch swap fixes (zephyrproject-rtos#35)
* swap: fix thread swap logic Description: Adding fixes for thread swap logic unified main thread creation and thread swap logic Signed-off-by: Muhammed Zamroodh <muhammed.zamroodh@ignitarium.com> * swap,arch: Fix arch specific irq lock/unlock Description: * logic for arch_irq_lock/unlock/unlocked was incorrect, modified the APIs to produce correct behavior * arch_swap should release the lock after swap, missed the logic Added fix for that Signed-off-by: Muhammed Zamroodh <muhammed.zamroodh@ignitarium.com> * swap,thread: Fix swap from ISR and IRQ exit Description: * Fix for thread swap from ISR * Fix for IRQ exit Signed-off-by: Muhammed Zamroodh <muhammed.zamroodh@ignitarium.com> --------- Signed-off-by: Muhammed Zamroodh <muhammed.zamroodh@ignitarium.com>
1 parent ced6afe commit 70e6eed

File tree

8 files changed

+316
-360
lines changed

8 files changed

+316
-360
lines changed

arch/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ config DSPIC
171171
bool
172172
select ARCH_IS_SET
173173
select STACK_GROWS_UP
174-
select ARCH_HAS_CUSTOM_SWAP_TO_MAIN
175174
select LITTLE_ENDIAN
176175
select ARCH_HAS_THREAD_LOCAL_STORAGE
177176
select TOOLCHAIN_SUPPORTS_THREAD_LOCAL_STORAGE

arch/dspic/core/isr_wrapper.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
#include <zephyr/irq.h>
88
#include <zephyr/pm/pm.h>
99
#include <kernel_arch_func.h>
10+
#include <kernel_arch_swap.h>
1011

1112
/* dsPIC33A interrtup exit routine. Will check if a context
1213
* switch is required. If so, z_dspic_do_swap() will be called
1314
* to affect the context switch
1415
*/
15-
void __attribute__((naked)) z_dspic_exc_exit(void)
16+
static inline __attribute__((always_inline)) void z_dspic_exc_exit(void)
1617
{
1718
#ifdef CONFIG_PREEMPT_ENABLED
1819
if ((_current_cpu->nested == 0) && (_kernel.ready_q.cache != _current)) {
@@ -27,7 +28,7 @@ void __attribute__((naked)) z_dspic_exc_exit(void)
2728
return;
2829
}
2930

30-
void __attribute__((naked)) _isr_wrapper(void)
31+
void __attribute__((interrupt)) _isr_wrapper(void)
3132
{
3233
#ifdef CONFIG_TRACING_ISR
3334
sys_trace_isr_enter();
@@ -44,5 +45,4 @@ void __attribute__((naked)) _isr_wrapper(void)
4445
#endif /* CONFIG_TRACING_ISR */
4546

4647
z_dspic_exc_exit();
47-
__asm__ volatile("retfie");
4848
}

0 commit comments

Comments
 (0)