From: acevest Date: Sat, 11 May 2024 13:05:52 +0000 (+0800) Subject: RUNNING改为RUN X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/doc/mdoc.3.txt?a=commitdiff_plain;h=90c0d73ac87873c0ceab96deffde8c19ee089133;p=kernel.git RUNNING改为RUN --- diff --git a/include/task.h b/include/task.h index 30f96de..eebbf8d 100644 --- a/include/task.h +++ b/include/task.h @@ -26,7 +26,7 @@ enum { TASK_UNUSED, - TASK_RUNNING, + TASK_RUN, TASK_READY, TASK_WAIT, TASK_INITING, diff --git a/kernel/sched.c b/kernel/sched.c index 86d9105..b74cbe6 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -153,8 +153,8 @@ task_t *find_task(pid_t pid) { } const char *task_state(unsigned int state) { - static const char s[][16] = { - " ERROR", "RUNNING", " READY", " WAIT", " INIT", " EXIT", + static const char s[][8] = { + " ERROR", "\x10RUN\x07\x07", " READY", " WAIT ", " INIT ", " EXIT ", }; if (state >= TASK_END) { @@ -167,12 +167,11 @@ const char *task_state(unsigned int state) { void debug_print_all_tasks() { task_t *p = 0; list_head_t *pos = 0, *t = 0; - printl(MPL_TASK_TITLE, " NAME STATE TK/PI REASON SCHED KEEP TURN"); + printl(MPL_TASK_TITLE, " NAME STATE TK/PI REASON SCHED KEEP TURN"); list_for_each_safe(pos, t, &all_tasks) { p = list_entry(pos, task_t, list); - printl(MPL_TASK_0 + p->pid, "%08x%s%-6s:%u %s %02u/%02u %-10s %-10u %-10u %-10u", p, - p->state == TASK_RUNNING ? ">" : " ", p->name, p->pid, task_state(p->state), p->ticks, p->priority, - p->reason, p->sched_cnt, p->sched_keep_cnt, p->turn); + printl(MPL_TASK_0 + p->pid, "%08x %-6s:%u %s %02u/%02u %-10s %-10u %-10u %-10u", p, p->name, p->pid, + task_state(p->state), p->ticks, p->priority, p->reason, p->sched_cnt, p->sched_keep_cnt, p->turn); } } @@ -188,7 +187,7 @@ void schedule() { unsigned long iflags; irq_save(iflags); - if (current->state == TASK_RUNNING) { + if (current->state == TASK_RUN) { current->state = TASK_READY; } @@ -199,7 +198,7 @@ void schedule() { continue; } - assert(p->state != TASK_RUNNING); + assert(p->state != TASK_RUN); if (TASK_READY != p->state) { continue; @@ -230,7 +229,7 @@ void schedule() { prev->need_resched = 0; - next->state = TASK_RUNNING; + next->state = TASK_RUN; next->reason = ""; if (prev != next) { @@ -243,7 +242,7 @@ void schedule() { next->sched_keep_cnt++; } - assert(current->state == TASK_RUNNING); + assert(current->state == TASK_RUN); irq_restore(iflags); } diff --git a/kernel/task_disk.c b/kernel/task_disk.c index ae22190..43697e5 100644 --- a/kernel/task_disk.c +++ b/kernel/task_disk.c @@ -59,7 +59,7 @@ void disk_task_entry(void *arg) { int channel = (int)arg; ide_pci_controller_t *ide_ctrl = ide_pci_controller + channel; - // 为了在DEBUG时看到RUNNING + // 为了在DEBUG时看到RUN int cnt = 2; for (int i = 0; i < cnt; i++) { asm("hlt;");