microkernel: add task pointer list

Due to similar padding issue as pipe, the list of task object
may not be used directly. As mentioned before, some compiler/linker
may pad the large struct. For example, compiling under gcc and
march=i686 pads the struct to 32-byte alignment (march=atom to
64-byte alignment). This causes issue with sizeof() and pointer
arithmetic because they have no idea about the padding.
When the stars align in a certain way, these task structs may be
corrupted. So add a task pointer list and use it for task
manipulation. The task list remains as it is beneficial to group
them together to take advantage of cache locality.

Change-Id: I0e86bfe05742040f4540d7854c1ac14e76162776
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2015-09-16 09:35:22 -07:00 committed by Anas Nashif
commit 8253b90cfc
5 changed files with 37 additions and 6 deletions

View file

@ -42,8 +42,8 @@
#include <nano_private.h>
#include <start_task_arch.h>
extern struct k_task _k_task_list_start[];
extern struct k_task _k_task_list_end[];
extern ktask_t _k_task_ptr_start[];
extern ktask_t _k_task_ptr_end[];
ktask_t task_id_get(void)
@ -342,6 +342,7 @@ void _k_task_group_op(struct k_args *A)
ktask_group_t grp = A->args.g1.group;
int opt = A->args.g1.opt;
struct k_task *X;
ktask_t *task_id;
#ifdef CONFIG_TASK_DEBUG
if (opt == TASK_GROUP_BLOCK)
@ -350,7 +351,9 @@ void _k_task_group_op(struct k_args *A)
_k_debug_halt = 0;
#endif
for (X = _k_task_list_start; X < _k_task_list_end; X++) {
for (task_id = _k_task_ptr_start; task_id < _k_task_ptr_end;
task_id++) {
X = (struct k_task *)(*task_id);
if (X->group & grp) {
switch (opt) {
case TASK_GROUP_START: