From 7a50a1a5611250028db3fd1f73a22f430d50202f Mon Sep 17 00:00:00 2001 From: ZimingYuan <6514145+ZimingYuan@user.noreply.gitee.com> Date: Thu, 17 Dec 2020 09:50:21 +0800 Subject: [PATCH] update chapter2.md. --- chapter2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapter2.md b/chapter2.md index f68d002..4dab229 100644 --- a/chapter2.md +++ b/chapter2.md @@ -539,7 +539,7 @@ typedef struct { 221 } ``` -​ 在enter_supervisor_mode函数中,将 mstatus的MPP域设置为1,表示中断发生之前的模式是Supervisor,将mstatus的MPIE域设置为0,表示中段发生前MIE的值为0。随即将机器模式的内核栈顶写入mscratch寄存器中,设置mepc为rest_of_boot_loader的地址,并将kernel_stack_top与0作为参数存入a0和a1。 +​ 在enter_supervisor_mode函数中,将 mstatus的MPP域设置为1,表示中断发生之前的模式是Supervisor,将mstatus的MPIE域设置为0,表示中断发生前MIE的值为0。随即将机器模式的内核栈顶写入mscratch寄存器中,设置mepc为rest_of_boot_loader的地址,并将kernel_stack_top与0作为参数存入a0和a1。 ​ 最后,执行mret指令,该指令执行时,程序从机器模式的异常返回,将程序计数器pc设置为mepc,即rest_of_boot_loader的地址;将特权级设置为mstatus寄存器的MPP域,即方才所设置的代表Supervisor的1,MPP设置为0;将mstatus寄存器的MIE域设置为MPIE,即方才所设置的表示中断关闭的0,MPIE设置为1。