diff options
Diffstat (limited to 'core/minute-ia')
-rw-r--r-- | core/minute-ia/panic.c | 4 | ||||
-rw-r--r-- | core/minute-ia/task.c | 16 |
2 files changed, 16 insertions, 4 deletions
diff --git a/core/minute-ia/panic.c b/core/minute-ia/panic.c index 442a69464a..9b0cf68c69 100644 --- a/core/minute-ia/panic.c +++ b/core/minute-ia/panic.c @@ -76,6 +76,7 @@ void panic_data_print(const struct panic_data *pdata) panic_printf("EDX = 0x%08X\n", pdata->x86.edx); panic_printf("ESI = 0x%08X\n", pdata->x86.esi); panic_printf("EDI = 0x%08X\n", pdata->x86.edi); + panic_printf("EC Task = %s\n", task_get_name(pdata->x86.task_id)); } /** @@ -133,6 +134,9 @@ __attribute__((noreturn)) void __keep exception_panic( PANIC_DATA_PTR->x86.cs = cs; PANIC_DATA_PTR->x86.eflags = eflags; + /* Save task information */ + PANIC_DATA_PTR->x86.task_id = task_get_current(); + /* Initialize panic data */ PANIC_DATA_PTR->arch = PANIC_ARCH_X86; PANIC_DATA_PTR->struct_version = 2; diff --git a/core/minute-ia/task.c b/core/minute-ia/task.c index 18c23f5515..fe00340994 100644 --- a/core/minute-ia/task.c +++ b/core/minute-ia/task.c @@ -90,7 +90,7 @@ static void task_exit_trap(void) { int i = task_get_current(); - cprints(CC_TASK, "Task %d (%s) exited!", i, task_names[i]); + cprints(CC_TASK, "Task %d (%s) exited!", i, task_get_name(i)); /* Exited tasks simply sleep forever */ while (1) task_wait_event(-1); @@ -187,6 +187,14 @@ task_id_t task_get_current(void) return current_task - tasks; } +const char *task_get_name(task_id_t tskid) +{ + if (tskid < ARRAY_SIZE(task_names)) + return task_names[tskid]; + + return "<< unknown >>"; +} + uint32_t *task_get_event_bitmap(task_id_t tskid) { task_ *tsk = __task_id_to_ptr(tskid); @@ -211,7 +219,7 @@ uint32_t switch_handler(int desched, task_id_t resched) #ifdef CONFIG_DEBUG_STACK_OVERFLOW if (*current->stack != STACK_UNUSED_VALUE) { panic_printf("\n\nStack overflow in %s task!\n", - task_names[current - tasks]); + task_get_name(current - tasks)); #ifdef CONFIG_SOFTWARE_PANIC software_panic(PANIC_SW_STACK_OVERFLOW, current - tasks); #endif @@ -512,11 +520,11 @@ void task_print_list(void) #ifdef CONFIG_FPU ccprintf("%4d %c %-16s %08x %11.6ld %3d/%3d %c\n", i, is_ready, - task_names[i], tasks[i].events, tasks[i].runtime, + task_get_name(i), tasks[i].events, tasks[i].runtime, stackused, tasks_init[i].stack_size, use_fpu); #else ccprintf("%4d %c %-16s %08x %11.6ld %3d/%3d\n", i, is_ready, - task_names[i], tasks[i].events, tasks[i].runtime, + task_get_name(i), tasks[i].events, tasks[i].runtime, stackused, tasks_init[i].stack_size); #endif |