summaryrefslogtreecommitdiff
path: root/core/nds32/task.c
diff options
context:
space:
mode:
authorDino Li <Dino.Li@ite.com.tw>2019-12-23 10:17:32 +0800
committerCommit Bot <commit-bot@chromium.org>2020-09-15 06:45:03 +0000
commitb99fd2e38f0710d11f09e42ab35b7f0745c6912e (patch)
tree99c8f8e4d7f90dd7e83ceaef7486f1025451d948 /core/nds32/task.c
parent16176c70547ef9777cc04db3d201ccadf900639f (diff)
downloadchrome-ec-b99fd2e38f0710d11f09e42ab35b7f0745c6912e.tar.gz
core/nds32: remove unnecessary condition
In the previous implementation, we added conditions to prevent stack overflow panic or memory get overwritten at first context switch. Actually, we won't hit these two situation if scratchpad size is correct. Let's remove them. BUG=none BRANCH=none TEST=EC boots, and the "runtime" is saved in scratchpad at first context switch. Change-Id: I647e1ebb01dbb8fe24adc9f22b6581bb8f8f97fb Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1980097 Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'core/nds32/task.c')
-rw-r--r--core/nds32/task.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/core/nds32/task.c b/core/nds32/task.c
index 74b7501acc..f034c53f48 100644
--- a/core/nds32/task.c
+++ b/core/nds32/task.c
@@ -134,7 +134,8 @@ uint8_t task_stacks[0
#undef TASK
/* Reserve space to discard context on first context switch. */
-uint32_t scratchpad[19];
+uint32_t scratchpad[TASK_SCRATCHPAD_SIZE] __attribute__
+ ((section(".bss.task_scratchpad")));
task_ *current_task = (task_ *)scratchpad;
@@ -294,10 +295,8 @@ task_ *next_sched_task(void)
#ifdef CONFIG_TASK_PROFILING
if (current_task != new_task) {
- if ((current_task - tasks) < TASK_ID_COUNT) {
- current_task->runtime +=
+ current_task->runtime +=
(exc_start_time - exc_end_time - exc_sub_time);
- }
task_will_switch = 1;
}
#endif
@@ -305,13 +304,11 @@ task_ *next_sched_task(void)
#ifdef CONFIG_DEBUG_STACK_OVERFLOW
if (*current_task->stack != STACK_UNUSED_VALUE) {
int i = task_get_current();
- if (i < TASK_ID_COUNT) {
- panic_printf("\n\nStack overflow in %s task!\n",
- task_names[i]);
+
+ panic_printf("\n\nStack overflow in %s task!\n", task_names[i]);
#ifdef CONFIG_SOFTWARE_PANIC
software_panic(PANIC_SW_STACK_OVERFLOW, i);
#endif
- }
}
#endif