From 7b6d48f78398389f7d170b3a2d1fbecf87ce33cb Mon Sep 17 00:00:00 2001 From: zhangxinyu <840317537@qq.com> Date: Wed, 24 May 2023 15:32:01 +0800 Subject: [PATCH] =?UTF-8?q?"=E5=A7=8B=E5=88=9D=E9=BE=99"=E5=8D=8F=E4=BD=9C?= =?UTF-8?q?=E5=BC=8F=E6=93=8D=E4=BD=9C=E7=B3=BB=E7=BB=9F=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ch3/os/src/task/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ch3/os/src/task/mod.rs b/ch3/os/src/task/mod.rs index f680a3f..915a4d7 100644 --- a/ch3/os/src/task/mod.rs +++ b/ch3/os/src/task/mod.rs @@ -129,18 +129,18 @@ lazy_static!{ ]; // 初始化用户的应用对应的 TCB - for i in 0..num_app { + for app_idx in 0..num_app { // 初始化用户应用的内核栈 - let kernel_app_stack_ptr = init_app_cx(i); + let kernel_app_stack_ptr = init_app_cx(app_idx); // 从 初始内核栈的栈顶(保存 trap_context的位置) 创建 任务context let task_context = TaskContext::from(kernel_app_stack_ptr); // 把内核栈的信息保存到 TCB中 - tasks[i].task_cx = task_context; + tasks[app_idx].task_cx = task_context; // 初始为 准备好的状态 - tasks[i].task_status = TaskStatus::Ready + tasks[app_idx].task_status = TaskStatus::Ready }; TaskManager { // 直接返回即可, 所有字段都是sync的, 那这个结构体也是sync