zephyr/arch/arm/core/thread_abort.c

54 lines
1.3 KiB
C
Raw Normal View History

unified/arm: add unified kernel support for ARM arch The ARM architecture port is fitted with support for the unified kernel, namely: - the interrupt/exception exit code now pends PendSV if the current thread is not a coop thread and if the scheduler is not locked - fiber_abort is replaced by k_thread_abort(), which takes a thread ID as a parameter (i.e. does not only operate on the current thread) - the _nanokernel.flags cache of _current.flags is not used anymore (could be a source of bugs) and is not needed in the scheduling algo - there is no 'task' field in the _nanokernel anymore: PendSV not calls _get_next_ready_thread instead - the _nanokernel.fiber field is replaced by a more sophisticated ready_q, based on the microkernel's priority-bitmap-based one - thread initialization initializes new fields in the tcs, and does not initialize obsolete ones - nano_private includes nano_internal.h from the unified directory - The FIBER, TASK and PREEMPTIBLE flags do not exist anymore: the thread priority drives the behaviour - the tcs uses a dlist for queuing in both ready and wait queues instead of a custom singly-linked list - other new fields in the tcs include a schedule-lock count, a back-pointer to init data (when the task is static) and a pointer to swap data, needed when a thread pending on _Swap() must be passed more then just one value (e.g. k_stack_pop() needs an error code and data) - the 'fiber' and 'task' fields of _nanokernel are replaced with an O(1) ready queue (taken from the microkernel) - fiberRtnValueSet() is aliased to _set_thread_return_value since it also operates on preempt threads now - _set_thread_return_value_with_data() sets the swap_data field in addition to a return value from _Swap() - convenience aliases are created for shorter names: - _current is defined as _nanokernel.current - _ready_q is defined as _nanokernel.ready_q - _Swap() sets the threads's return code to -EAGAIN before swapping out to prevent timeouts to have to set it (solves hard issues in some kernel objects). Change-Id: I36c03c362bc2908dae064ec67e6b8469fc573983 Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-03 04:20:19 +08:00
/*
* Copyright (c) 2016 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
unified/arm: add unified kernel support for ARM arch The ARM architecture port is fitted with support for the unified kernel, namely: - the interrupt/exception exit code now pends PendSV if the current thread is not a coop thread and if the scheduler is not locked - fiber_abort is replaced by k_thread_abort(), which takes a thread ID as a parameter (i.e. does not only operate on the current thread) - the _nanokernel.flags cache of _current.flags is not used anymore (could be a source of bugs) and is not needed in the scheduling algo - there is no 'task' field in the _nanokernel anymore: PendSV not calls _get_next_ready_thread instead - the _nanokernel.fiber field is replaced by a more sophisticated ready_q, based on the microkernel's priority-bitmap-based one - thread initialization initializes new fields in the tcs, and does not initialize obsolete ones - nano_private includes nano_internal.h from the unified directory - The FIBER, TASK and PREEMPTIBLE flags do not exist anymore: the thread priority drives the behaviour - the tcs uses a dlist for queuing in both ready and wait queues instead of a custom singly-linked list - other new fields in the tcs include a schedule-lock count, a back-pointer to init data (when the task is static) and a pointer to swap data, needed when a thread pending on _Swap() must be passed more then just one value (e.g. k_stack_pop() needs an error code and data) - the 'fiber' and 'task' fields of _nanokernel are replaced with an O(1) ready queue (taken from the microkernel) - fiberRtnValueSet() is aliased to _set_thread_return_value since it also operates on preempt threads now - _set_thread_return_value_with_data() sets the swap_data field in addition to a return value from _Swap() - convenience aliases are created for shorter names: - _current is defined as _nanokernel.current - _ready_q is defined as _nanokernel.ready_q - _Swap() sets the threads's return code to -EAGAIN before swapping out to prevent timeouts to have to set it (solves hard issues in some kernel objects). Change-Id: I36c03c362bc2908dae064ec67e6b8469fc573983 Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-03 04:20:19 +08:00
*/
/**
* @file
* @brief ARM Cortex-M k_thread_abort() routine
*
* The ARM Cortex-M architecture provides its own k_thread_abort() to deal
* with different CPU modes (handler vs thread) when a thread aborts. When its
* entry point returns or when it aborts itself, the CPU is in thread mode and
* must call _Swap() (which triggers a service call), but when in handler
* mode, the CPU must exit handler mode to cause the context switch, and thus
* must queue the PendSV exception.
*/
#include <kernel.h>
kernel/arch: consolidate tTCS and TNANO definitions There was a lot of duplication between architectures for the definition of threads and the "nanokernel" guts. These have been consolidated. Now, a common file kernel/unified/include/kernel_structs.h holds the common definitions. Architectures provide two files to complement it: kernel_arch_data.h and kernel_arch_func.h. The first one contains at least the struct _thread_arch and struct _kernel_arch data structures, as well as the struct _callee_saved and struct _caller_saved register layouts. The second file contains anything that needs what is provided by the common stuff in kernel_structs.h. Those two files are only meant to be included in kernel_structs.h in very specific locations. The thread data structure has been separated into three major parts: common struct _thread_base and struct k_thread, and arch-specific struct _thread_arch. The first and third ones are included in the second. The struct s_NANO data structure has been split into two: common struct _kernel and arch-specific struct _kernel_arch. The latter is included in the former. Offsets files have also changed: nano_offsets.h has been renamed kernel_offsets.h and is still included by the arch-specific offsets.c. Also, since the thread and kernel data structures are now made of sub-structures, offsets have to be added to make up the full offset. Some of these additions have been consolidated in shorter symbols, available from kernel/unified/include/offsets_short.h, which includes an arch-specific offsets_arch_short.h. Most of the code include offsets_short.h now instead of offsets.h. Change-Id: I084645cb7e6db8db69aeaaf162963fe157045d5a Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-11-08 23:36:50 +08:00
#include <kernel_structs.h>
unified/arm: add unified kernel support for ARM arch The ARM architecture port is fitted with support for the unified kernel, namely: - the interrupt/exception exit code now pends PendSV if the current thread is not a coop thread and if the scheduler is not locked - fiber_abort is replaced by k_thread_abort(), which takes a thread ID as a parameter (i.e. does not only operate on the current thread) - the _nanokernel.flags cache of _current.flags is not used anymore (could be a source of bugs) and is not needed in the scheduling algo - there is no 'task' field in the _nanokernel anymore: PendSV not calls _get_next_ready_thread instead - the _nanokernel.fiber field is replaced by a more sophisticated ready_q, based on the microkernel's priority-bitmap-based one - thread initialization initializes new fields in the tcs, and does not initialize obsolete ones - nano_private includes nano_internal.h from the unified directory - The FIBER, TASK and PREEMPTIBLE flags do not exist anymore: the thread priority drives the behaviour - the tcs uses a dlist for queuing in both ready and wait queues instead of a custom singly-linked list - other new fields in the tcs include a schedule-lock count, a back-pointer to init data (when the task is static) and a pointer to swap data, needed when a thread pending on _Swap() must be passed more then just one value (e.g. k_stack_pop() needs an error code and data) - the 'fiber' and 'task' fields of _nanokernel are replaced with an O(1) ready queue (taken from the microkernel) - fiberRtnValueSet() is aliased to _set_thread_return_value since it also operates on preempt threads now - _set_thread_return_value_with_data() sets the swap_data field in addition to a return value from _Swap() - convenience aliases are created for shorter names: - _current is defined as _nanokernel.current - _ready_q is defined as _nanokernel.ready_q - _Swap() sets the threads's return code to -EAGAIN before swapping out to prevent timeouts to have to set it (solves hard issues in some kernel objects). Change-Id: I36c03c362bc2908dae064ec67e6b8469fc573983 Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-03 04:20:19 +08:00
#include <toolchain.h>
#include <linker/sections.h>
#include <ksched.h>
#include <kswap.h>
unified/arm: add unified kernel support for ARM arch The ARM architecture port is fitted with support for the unified kernel, namely: - the interrupt/exception exit code now pends PendSV if the current thread is not a coop thread and if the scheduler is not locked - fiber_abort is replaced by k_thread_abort(), which takes a thread ID as a parameter (i.e. does not only operate on the current thread) - the _nanokernel.flags cache of _current.flags is not used anymore (could be a source of bugs) and is not needed in the scheduling algo - there is no 'task' field in the _nanokernel anymore: PendSV not calls _get_next_ready_thread instead - the _nanokernel.fiber field is replaced by a more sophisticated ready_q, based on the microkernel's priority-bitmap-based one - thread initialization initializes new fields in the tcs, and does not initialize obsolete ones - nano_private includes nano_internal.h from the unified directory - The FIBER, TASK and PREEMPTIBLE flags do not exist anymore: the thread priority drives the behaviour - the tcs uses a dlist for queuing in both ready and wait queues instead of a custom singly-linked list - other new fields in the tcs include a schedule-lock count, a back-pointer to init data (when the task is static) and a pointer to swap data, needed when a thread pending on _Swap() must be passed more then just one value (e.g. k_stack_pop() needs an error code and data) - the 'fiber' and 'task' fields of _nanokernel are replaced with an O(1) ready queue (taken from the microkernel) - fiberRtnValueSet() is aliased to _set_thread_return_value since it also operates on preempt threads now - _set_thread_return_value_with_data() sets the swap_data field in addition to a return value from _Swap() - convenience aliases are created for shorter names: - _current is defined as _nanokernel.current - _ready_q is defined as _nanokernel.ready_q - _Swap() sets the threads's return code to -EAGAIN before swapping out to prevent timeouts to have to set it (solves hard issues in some kernel objects). Change-Id: I36c03c362bc2908dae064ec67e6b8469fc573983 Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-03 04:20:19 +08:00
#include <wait_q.h>
#include <misc/__assert.h>
unified/arm: add unified kernel support for ARM arch The ARM architecture port is fitted with support for the unified kernel, namely: - the interrupt/exception exit code now pends PendSV if the current thread is not a coop thread and if the scheduler is not locked - fiber_abort is replaced by k_thread_abort(), which takes a thread ID as a parameter (i.e. does not only operate on the current thread) - the _nanokernel.flags cache of _current.flags is not used anymore (could be a source of bugs) and is not needed in the scheduling algo - there is no 'task' field in the _nanokernel anymore: PendSV not calls _get_next_ready_thread instead - the _nanokernel.fiber field is replaced by a more sophisticated ready_q, based on the microkernel's priority-bitmap-based one - thread initialization initializes new fields in the tcs, and does not initialize obsolete ones - nano_private includes nano_internal.h from the unified directory - The FIBER, TASK and PREEMPTIBLE flags do not exist anymore: the thread priority drives the behaviour - the tcs uses a dlist for queuing in both ready and wait queues instead of a custom singly-linked list - other new fields in the tcs include a schedule-lock count, a back-pointer to init data (when the task is static) and a pointer to swap data, needed when a thread pending on _Swap() must be passed more then just one value (e.g. k_stack_pop() needs an error code and data) - the 'fiber' and 'task' fields of _nanokernel are replaced with an O(1) ready queue (taken from the microkernel) - fiberRtnValueSet() is aliased to _set_thread_return_value since it also operates on preempt threads now - _set_thread_return_value_with_data() sets the swap_data field in addition to a return value from _Swap() - convenience aliases are created for shorter names: - _current is defined as _nanokernel.current - _ready_q is defined as _nanokernel.ready_q - _Swap() sets the threads's return code to -EAGAIN before swapping out to prevent timeouts to have to set it (solves hard issues in some kernel objects). Change-Id: I36c03c362bc2908dae064ec67e6b8469fc573983 Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-03 04:20:19 +08:00
extern void _k_thread_single_abort(struct k_thread *thread);
unified/arm: add unified kernel support for ARM arch The ARM architecture port is fitted with support for the unified kernel, namely: - the interrupt/exception exit code now pends PendSV if the current thread is not a coop thread and if the scheduler is not locked - fiber_abort is replaced by k_thread_abort(), which takes a thread ID as a parameter (i.e. does not only operate on the current thread) - the _nanokernel.flags cache of _current.flags is not used anymore (could be a source of bugs) and is not needed in the scheduling algo - there is no 'task' field in the _nanokernel anymore: PendSV not calls _get_next_ready_thread instead - the _nanokernel.fiber field is replaced by a more sophisticated ready_q, based on the microkernel's priority-bitmap-based one - thread initialization initializes new fields in the tcs, and does not initialize obsolete ones - nano_private includes nano_internal.h from the unified directory - The FIBER, TASK and PREEMPTIBLE flags do not exist anymore: the thread priority drives the behaviour - the tcs uses a dlist for queuing in both ready and wait queues instead of a custom singly-linked list - other new fields in the tcs include a schedule-lock count, a back-pointer to init data (when the task is static) and a pointer to swap data, needed when a thread pending on _Swap() must be passed more then just one value (e.g. k_stack_pop() needs an error code and data) - the 'fiber' and 'task' fields of _nanokernel are replaced with an O(1) ready queue (taken from the microkernel) - fiberRtnValueSet() is aliased to _set_thread_return_value since it also operates on preempt threads now - _set_thread_return_value_with_data() sets the swap_data field in addition to a return value from _Swap() - convenience aliases are created for shorter names: - _current is defined as _nanokernel.current - _ready_q is defined as _nanokernel.ready_q - _Swap() sets the threads's return code to -EAGAIN before swapping out to prevent timeouts to have to set it (solves hard issues in some kernel objects). Change-Id: I36c03c362bc2908dae064ec67e6b8469fc573983 Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-03 04:20:19 +08:00
void _impl_k_thread_abort(k_tid_t thread)
unified/arm: add unified kernel support for ARM arch The ARM architecture port is fitted with support for the unified kernel, namely: - the interrupt/exception exit code now pends PendSV if the current thread is not a coop thread and if the scheduler is not locked - fiber_abort is replaced by k_thread_abort(), which takes a thread ID as a parameter (i.e. does not only operate on the current thread) - the _nanokernel.flags cache of _current.flags is not used anymore (could be a source of bugs) and is not needed in the scheduling algo - there is no 'task' field in the _nanokernel anymore: PendSV not calls _get_next_ready_thread instead - the _nanokernel.fiber field is replaced by a more sophisticated ready_q, based on the microkernel's priority-bitmap-based one - thread initialization initializes new fields in the tcs, and does not initialize obsolete ones - nano_private includes nano_internal.h from the unified directory - The FIBER, TASK and PREEMPTIBLE flags do not exist anymore: the thread priority drives the behaviour - the tcs uses a dlist for queuing in both ready and wait queues instead of a custom singly-linked list - other new fields in the tcs include a schedule-lock count, a back-pointer to init data (when the task is static) and a pointer to swap data, needed when a thread pending on _Swap() must be passed more then just one value (e.g. k_stack_pop() needs an error code and data) - the 'fiber' and 'task' fields of _nanokernel are replaced with an O(1) ready queue (taken from the microkernel) - fiberRtnValueSet() is aliased to _set_thread_return_value since it also operates on preempt threads now - _set_thread_return_value_with_data() sets the swap_data field in addition to a return value from _Swap() - convenience aliases are created for shorter names: - _current is defined as _nanokernel.current - _ready_q is defined as _nanokernel.ready_q - _Swap() sets the threads's return code to -EAGAIN before swapping out to prevent timeouts to have to set it (solves hard issues in some kernel objects). Change-Id: I36c03c362bc2908dae064ec67e6b8469fc573983 Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-03 04:20:19 +08:00
{
unsigned int key;
key = irq_lock();
__ASSERT(!(thread->base.user_options & K_ESSENTIAL),
"essential thread aborted");
unified/arm: add unified kernel support for ARM arch The ARM architecture port is fitted with support for the unified kernel, namely: - the interrupt/exception exit code now pends PendSV if the current thread is not a coop thread and if the scheduler is not locked - fiber_abort is replaced by k_thread_abort(), which takes a thread ID as a parameter (i.e. does not only operate on the current thread) - the _nanokernel.flags cache of _current.flags is not used anymore (could be a source of bugs) and is not needed in the scheduling algo - there is no 'task' field in the _nanokernel anymore: PendSV not calls _get_next_ready_thread instead - the _nanokernel.fiber field is replaced by a more sophisticated ready_q, based on the microkernel's priority-bitmap-based one - thread initialization initializes new fields in the tcs, and does not initialize obsolete ones - nano_private includes nano_internal.h from the unified directory - The FIBER, TASK and PREEMPTIBLE flags do not exist anymore: the thread priority drives the behaviour - the tcs uses a dlist for queuing in both ready and wait queues instead of a custom singly-linked list - other new fields in the tcs include a schedule-lock count, a back-pointer to init data (when the task is static) and a pointer to swap data, needed when a thread pending on _Swap() must be passed more then just one value (e.g. k_stack_pop() needs an error code and data) - the 'fiber' and 'task' fields of _nanokernel are replaced with an O(1) ready queue (taken from the microkernel) - fiberRtnValueSet() is aliased to _set_thread_return_value since it also operates on preempt threads now - _set_thread_return_value_with_data() sets the swap_data field in addition to a return value from _Swap() - convenience aliases are created for shorter names: - _current is defined as _nanokernel.current - _ready_q is defined as _nanokernel.ready_q - _Swap() sets the threads's return code to -EAGAIN before swapping out to prevent timeouts to have to set it (solves hard issues in some kernel objects). Change-Id: I36c03c362bc2908dae064ec67e6b8469fc573983 Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-03 04:20:19 +08:00
_k_thread_single_abort(thread);
_thread_monitor_exit(thread);
unified/arm: add unified kernel support for ARM arch The ARM architecture port is fitted with support for the unified kernel, namely: - the interrupt/exception exit code now pends PendSV if the current thread is not a coop thread and if the scheduler is not locked - fiber_abort is replaced by k_thread_abort(), which takes a thread ID as a parameter (i.e. does not only operate on the current thread) - the _nanokernel.flags cache of _current.flags is not used anymore (could be a source of bugs) and is not needed in the scheduling algo - there is no 'task' field in the _nanokernel anymore: PendSV not calls _get_next_ready_thread instead - the _nanokernel.fiber field is replaced by a more sophisticated ready_q, based on the microkernel's priority-bitmap-based one - thread initialization initializes new fields in the tcs, and does not initialize obsolete ones - nano_private includes nano_internal.h from the unified directory - The FIBER, TASK and PREEMPTIBLE flags do not exist anymore: the thread priority drives the behaviour - the tcs uses a dlist for queuing in both ready and wait queues instead of a custom singly-linked list - other new fields in the tcs include a schedule-lock count, a back-pointer to init data (when the task is static) and a pointer to swap data, needed when a thread pending on _Swap() must be passed more then just one value (e.g. k_stack_pop() needs an error code and data) - the 'fiber' and 'task' fields of _nanokernel are replaced with an O(1) ready queue (taken from the microkernel) - fiberRtnValueSet() is aliased to _set_thread_return_value since it also operates on preempt threads now - _set_thread_return_value_with_data() sets the swap_data field in addition to a return value from _Swap() - convenience aliases are created for shorter names: - _current is defined as _nanokernel.current - _ready_q is defined as _nanokernel.ready_q - _Swap() sets the threads's return code to -EAGAIN before swapping out to prevent timeouts to have to set it (solves hard issues in some kernel objects). Change-Id: I36c03c362bc2908dae064ec67e6b8469fc573983 Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-03 04:20:19 +08:00
if (_current == thread) {
if ((SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk) == 0) {
unified/arm: add unified kernel support for ARM arch The ARM architecture port is fitted with support for the unified kernel, namely: - the interrupt/exception exit code now pends PendSV if the current thread is not a coop thread and if the scheduler is not locked - fiber_abort is replaced by k_thread_abort(), which takes a thread ID as a parameter (i.e. does not only operate on the current thread) - the _nanokernel.flags cache of _current.flags is not used anymore (could be a source of bugs) and is not needed in the scheduling algo - there is no 'task' field in the _nanokernel anymore: PendSV not calls _get_next_ready_thread instead - the _nanokernel.fiber field is replaced by a more sophisticated ready_q, based on the microkernel's priority-bitmap-based one - thread initialization initializes new fields in the tcs, and does not initialize obsolete ones - nano_private includes nano_internal.h from the unified directory - The FIBER, TASK and PREEMPTIBLE flags do not exist anymore: the thread priority drives the behaviour - the tcs uses a dlist for queuing in both ready and wait queues instead of a custom singly-linked list - other new fields in the tcs include a schedule-lock count, a back-pointer to init data (when the task is static) and a pointer to swap data, needed when a thread pending on _Swap() must be passed more then just one value (e.g. k_stack_pop() needs an error code and data) - the 'fiber' and 'task' fields of _nanokernel are replaced with an O(1) ready queue (taken from the microkernel) - fiberRtnValueSet() is aliased to _set_thread_return_value since it also operates on preempt threads now - _set_thread_return_value_with_data() sets the swap_data field in addition to a return value from _Swap() - convenience aliases are created for shorter names: - _current is defined as _nanokernel.current - _ready_q is defined as _nanokernel.ready_q - _Swap() sets the threads's return code to -EAGAIN before swapping out to prevent timeouts to have to set it (solves hard issues in some kernel objects). Change-Id: I36c03c362bc2908dae064ec67e6b8469fc573983 Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-03 04:20:19 +08:00
_Swap(key);
CODE_UNREACHABLE;
} else {
SCB->ICSR |= SCB_ICSR_PENDSVSET_Msk;
unified/arm: add unified kernel support for ARM arch The ARM architecture port is fitted with support for the unified kernel, namely: - the interrupt/exception exit code now pends PendSV if the current thread is not a coop thread and if the scheduler is not locked - fiber_abort is replaced by k_thread_abort(), which takes a thread ID as a parameter (i.e. does not only operate on the current thread) - the _nanokernel.flags cache of _current.flags is not used anymore (could be a source of bugs) and is not needed in the scheduling algo - there is no 'task' field in the _nanokernel anymore: PendSV not calls _get_next_ready_thread instead - the _nanokernel.fiber field is replaced by a more sophisticated ready_q, based on the microkernel's priority-bitmap-based one - thread initialization initializes new fields in the tcs, and does not initialize obsolete ones - nano_private includes nano_internal.h from the unified directory - The FIBER, TASK and PREEMPTIBLE flags do not exist anymore: the thread priority drives the behaviour - the tcs uses a dlist for queuing in both ready and wait queues instead of a custom singly-linked list - other new fields in the tcs include a schedule-lock count, a back-pointer to init data (when the task is static) and a pointer to swap data, needed when a thread pending on _Swap() must be passed more then just one value (e.g. k_stack_pop() needs an error code and data) - the 'fiber' and 'task' fields of _nanokernel are replaced with an O(1) ready queue (taken from the microkernel) - fiberRtnValueSet() is aliased to _set_thread_return_value since it also operates on preempt threads now - _set_thread_return_value_with_data() sets the swap_data field in addition to a return value from _Swap() - convenience aliases are created for shorter names: - _current is defined as _nanokernel.current - _ready_q is defined as _nanokernel.ready_q - _Swap() sets the threads's return code to -EAGAIN before swapping out to prevent timeouts to have to set it (solves hard issues in some kernel objects). Change-Id: I36c03c362bc2908dae064ec67e6b8469fc573983 Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-03 04:20:19 +08:00
}
}
/* The abort handler might have altered the ready queue. */
_reschedule_noyield(key);
unified/arm: add unified kernel support for ARM arch The ARM architecture port is fitted with support for the unified kernel, namely: - the interrupt/exception exit code now pends PendSV if the current thread is not a coop thread and if the scheduler is not locked - fiber_abort is replaced by k_thread_abort(), which takes a thread ID as a parameter (i.e. does not only operate on the current thread) - the _nanokernel.flags cache of _current.flags is not used anymore (could be a source of bugs) and is not needed in the scheduling algo - there is no 'task' field in the _nanokernel anymore: PendSV not calls _get_next_ready_thread instead - the _nanokernel.fiber field is replaced by a more sophisticated ready_q, based on the microkernel's priority-bitmap-based one - thread initialization initializes new fields in the tcs, and does not initialize obsolete ones - nano_private includes nano_internal.h from the unified directory - The FIBER, TASK and PREEMPTIBLE flags do not exist anymore: the thread priority drives the behaviour - the tcs uses a dlist for queuing in both ready and wait queues instead of a custom singly-linked list - other new fields in the tcs include a schedule-lock count, a back-pointer to init data (when the task is static) and a pointer to swap data, needed when a thread pending on _Swap() must be passed more then just one value (e.g. k_stack_pop() needs an error code and data) - the 'fiber' and 'task' fields of _nanokernel are replaced with an O(1) ready queue (taken from the microkernel) - fiberRtnValueSet() is aliased to _set_thread_return_value since it also operates on preempt threads now - _set_thread_return_value_with_data() sets the swap_data field in addition to a return value from _Swap() - convenience aliases are created for shorter names: - _current is defined as _nanokernel.current - _ready_q is defined as _nanokernel.ready_q - _Swap() sets the threads's return code to -EAGAIN before swapping out to prevent timeouts to have to set it (solves hard issues in some kernel objects). Change-Id: I36c03c362bc2908dae064ec67e6b8469fc573983 Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-03 04:20:19 +08:00
}