mirror of
https://github.com/yourtion/30dayMakeOS.git
synced 2026-02-02 17:49:01 +08:00
闲置任务
This commit is contained in:
@@ -76,7 +76,7 @@ void HariMain(void)
|
||||
task_b[i]->tss.fs = 1 * 8;
|
||||
task_b[i]->tss.gs = 1 * 8;
|
||||
*((int *) (task_b[i]->tss.esp + 4)) = (int) sht_win_b[i];
|
||||
task_run(task_b[i], 2, i + 1);
|
||||
/* task_run(task_b[i], 2, i + 1); */
|
||||
}
|
||||
|
||||
/* sht_win */
|
||||
|
||||
@@ -64,13 +64,21 @@ void task_switchsub(void)
|
||||
return;
|
||||
}
|
||||
|
||||
void task_idle(void)
|
||||
{
|
||||
for (;;) {
|
||||
io_hlt();
|
||||
}
|
||||
}
|
||||
|
||||
struct TASK *task_init(struct MEMMAN *memman)
|
||||
{
|
||||
int i;
|
||||
struct TASK *task;
|
||||
struct TASK *task, *idle;
|
||||
struct SEGMENT_DESCRIPTOR *gdt = (struct SEGMENT_DESCRIPTOR *) ADR_GDT;
|
||||
taskctl = (struct TASKCTL *) memman_alloc_4k(memman, sizeof (struct TASKCTL));
|
||||
|
||||
|
||||
taskctl = (struct TASKCTL *) memman_alloc_4k(memman, sizeof (struct TASKCTL));
|
||||
for (i = 0; i < MAX_TASKS; i++) {
|
||||
taskctl->tasks0[i].flags = 0;
|
||||
taskctl->tasks0[i].sel = (TASK_GDT0 + i) * 8;
|
||||
@@ -80,6 +88,7 @@ struct TASK *task_init(struct MEMMAN *memman)
|
||||
taskctl->level[i].running = 0;
|
||||
taskctl->level[i].now = 0;
|
||||
}
|
||||
|
||||
task = task_alloc();
|
||||
task->flags = 2; /*活动中标志*/
|
||||
task->priority = 2; /* 0.02秒*/
|
||||
@@ -89,6 +98,18 @@ struct TASK *task_init(struct MEMMAN *memman)
|
||||
load_tr(task->sel);
|
||||
task_timer = timer_alloc();
|
||||
timer_settime(task_timer, task->priority);
|
||||
|
||||
idle = task_alloc();
|
||||
idle->tss.esp = memman_alloc_4k(memman, 64 * 1024) + 64 * 1024;
|
||||
idle->tss.eip = (int) &task_idle;
|
||||
idle->tss.es = 1 * 8;
|
||||
idle->tss.cs = 2 * 8;
|
||||
idle->tss.ss = 1 * 8;
|
||||
idle->tss.ds = 1 * 8;
|
||||
idle->tss.fs = 1 * 8;
|
||||
idle->tss.gs = 1 * 8;
|
||||
task_run(idle, MAX_TASKLEVELS - 1, 1);
|
||||
|
||||
return task;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user