From bb55365b98d78a09c9dcf00f3b7d144c245d6990 Mon Sep 17 00:00:00 2001 From: Hyungwoo Yang Date: Tue, 29 Jan 2019 17:17:59 -0800 Subject: ish: move setting start_called to proper place Some functions(like enabling interrupt) should start after scheduler is ready and they use start_called which indicates if scheduler is ready or not. Currently start_called is set by the first task but it is away after the task did many things. So this patch moves the setting start_called to the place where the scheduler is ready. BRANCH=none BUG=none TEST=verified in Atlas platform Change-Id: I24d9cec411e91b7365f46fa8daf4a02fe43287dd Reviewed-on: https://chromium-review.googlesource.com/1444792 Commit-Ready: Hyungwoo Yang Tested-by: Hyungwoo Yang Reviewed-by: Hyungwoo Yang Reviewed-by: Jett Rink --- core/minute-ia/switch.S | 2 ++ core/minute-ia/task.c | 5 +---- core/minute-ia/task_defs.h | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/core/minute-ia/switch.S b/core/minute-ia/switch.S index b467a39c3c..52883671eb 100644 --- a/core/minute-ia/switch.S +++ b/core/minute-ia/switch.S @@ -29,11 +29,13 @@ .align 4 .func __task_start __task_start: + movl 0x4(%esp), %ebx movl current_task, %eax movl (%eax), %esp #ifdef CONFIG_FPU frstor 20(%eax) #endif + movl $0x1, (%ebx) # first task is ready. set start_called = 1 popa iret .endfunc diff --git a/core/minute-ia/task.c b/core/minute-ia/task.c index 7132813ac2..31d24734ec 100644 --- a/core/minute-ia/task.c +++ b/core/minute-ia/task.c @@ -386,9 +386,6 @@ void task_enable_all_tasks(void) /* Mark all tasks as ready and table to run. */ tasks_ready = tasks_enabled = (1 << TASK_ID_COUNT) - 1; - /* BUG: task_start() was likely already called */ - start_called = 1; - /* Reschedule the highest priority task. */ __schedule(0, 0); } @@ -628,5 +625,5 @@ int task_start(void) #ifdef CONFIG_TASK_PROFILING task_start_time = exc_end_time = get_time().val; #endif - return __task_start(); + return __task_start(&start_called); } diff --git a/core/minute-ia/task_defs.h b/core/minute-ia/task_defs.h index 6237f8aabd..2ec33e5c98 100644 --- a/core/minute-ia/task_defs.h +++ b/core/minute-ia/task_defs.h @@ -26,7 +26,7 @@ typedef union { }; } task_; -int __task_start(void); +int __task_start(int *start_called); void __switchto(void); /* Only the IF bit is set so tasks start with interrupts enabled. */ -- cgit v1.2.1