Skip to content

Commit fc846fd

Browse files
committed
update
1 parent 92ed6a6 commit fc846fd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

os/src/batch.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,13 @@ pub fn run_next_app() -> ! {
142142
// before this we have to drop local variables related to resources manually
143143
// and release the resources
144144
extern "C" {
145-
fn __restore(cx_addr: usize); //出栈
145+
fn __restore(cx_addr: usize); // 声明外部函数__restore
146146
}
147+
// KERNEL_STACK.push_context压栈,应用启动所需的 “初始状态”(TrapContext)存入内核栈
148+
// 返回上下文信息(应用启动所需的 “初始状态”)TrapContext::app_init_context
149+
// _restore出栈恢复上下文,并跳转到用户态应用程序
147150
unsafe {
148-
__restore(KERNEL_STACK.push_context(TrapContext::app_init_context( // 压栈
151+
__restore(KERNEL_STACK.push_context(TrapContext::app_init_context(
149152
APP_BASE_ADDRESS,
150153
USER_STACK.get_sp(),
151154
)) as *const _ as usize);

0 commit comments

Comments
 (0)