diff --git a/docs/.vuepress/public/images/arm_exception_table.png b/docs/doc/kernel/imagesrc/arm_exception_table.png similarity index 100% rename from docs/.vuepress/public/images/arm_exception_table.png rename to docs/doc/kernel/imagesrc/arm_exception_table.png diff --git a/docs/.vuepress/public/images/arm_int_type.png b/docs/doc/kernel/imagesrc/arm_int_type.png similarity index 100% rename from docs/.vuepress/public/images/arm_int_type.png rename to docs/doc/kernel/imagesrc/arm_int_type.png diff --git a/docs/doc/kernel/imagesrc/arm_nvic_controller.jpg b/docs/doc/kernel/imagesrc/arm_nvic_controller.jpg new file mode 100644 index 0000000..396504b Binary files /dev/null and b/docs/doc/kernel/imagesrc/arm_nvic_controller.jpg differ diff --git a/docs/.vuepress/public/images/arm_pensv_example.png b/docs/doc/kernel/imagesrc/arm_pensv_example.png similarity index 100% rename from docs/.vuepress/public/images/arm_pensv_example.png rename to docs/doc/kernel/imagesrc/arm_pensv_example.png diff --git a/docs/.vuepress/public/images/int_exception_table.png b/docs/doc/kernel/imagesrc/int_exception_table.png similarity index 100% rename from docs/.vuepress/public/images/int_exception_table.png rename to docs/doc/kernel/imagesrc/int_exception_table.png diff --git a/docs/.vuepress/public/images/int_isr.png b/docs/doc/kernel/imagesrc/int_isr.png similarity index 100% rename from docs/.vuepress/public/images/int_isr.png rename to docs/doc/kernel/imagesrc/int_isr.png diff --git a/docs/.vuepress/public/images/int_process.png b/docs/doc/kernel/imagesrc/int_process.png similarity index 100% rename from docs/.vuepress/public/images/int_process.png rename to docs/doc/kernel/imagesrc/int_process.png diff --git a/docs/.vuepress/public/images/int_riscv_controller.png b/docs/doc/kernel/imagesrc/int_riscv_controller.png similarity index 100% rename from docs/.vuepress/public/images/int_riscv_controller.png rename to docs/doc/kernel/imagesrc/int_riscv_controller.png diff --git a/docs/doc/kernel/int.md b/docs/doc/kernel/int.md index ea35cc9..d6f0f15 100644 --- a/docs/doc/kernel/int.md +++ b/docs/doc/kernel/int.md @@ -55,7 +55,7 @@ + mstatus(Machine Status Register):机器模式状态寄存器 mcause寄存器的Exception Code域标识是何种异常或者何种中断。定义如下图表格所示: - + + 退出异常时,需要从异常服务程序中退出,并返回主程序。RISC-V架构定义了一组专门的退出异常指令:MRET、SRET、URET,分别对应机器模式、监督模式、用户模式的退出。 以MRET为例,当处理器执行MRET指令后,硬件行为如下: @@ -80,7 +80,7 @@ CLINT 的全称为处理器核局部中断控制器(Core Local Interrupts Cont PLIC 全称为平台级别中断控制器(Platform Level Interrupt Controller),它是 RISC-V架构标准定义的系统中断控制器,主要用于多个外部中断源的优先级仲裁。 RISC-V中断控制器如下图所示: - + @@ -98,12 +98,12 @@ cortex-M提供了一个异常响应系统,支持为数众多的系统异常和 ### 异常处理机制 cortex-M支持的异常如下表所示: - + 表格中的SVCall异常属于系统服务调用,用于产生系统函数的调用请求,该异常必须得到响应,例如,操作系统不让用户程序直接操作硬件,通过一些系统服务函数发出SVC请求,触发一个SVC异常,然后通过SVC异常服务程序执行; PendSV异常属于可悬挂系统调用,它可以像普通中断一样被悬起,典型应用是提供线程切换服务。 - + 1. 任务 A 呼叫 SVC 来请求任务切换(例如,等待某些工作完成) 2. OS 接收到请求,做好上下文切换的准备,并且 pend 一个 PendSV 异常。 @@ -120,7 +120,7 @@ PendSV异常属于可悬挂系统调用,它可以像普通中断一样被悬 ### 中断类型 - + NVIC共支持1到240个外部中断输入(IRQs)。另外 ,NVIC还支持一个不可屏蔽输入中断,除了包含控制寄存器和中断控制逻辑外,还包含了MPU的控制寄存器、systick定时器以及调试控制。 @@ -128,7 +128,7 @@ NVIC共支持1到240个外部中断输入(IRQs)。另外 ,NVIC还支持一 ### 中断控制器 cortex-M系列包含一个NVIC(嵌套中断向量控制器)提供硬件嵌套中断服务。在中断发生时,NVIC自动取出对应的服务例程入口地址,并且直接调用,无需软件判定中断源。另外M系列包含一个基本的systick定时器,配合NVIC工作,用于系统计数。NVIC控制器如下图所示: - + @@ -141,7 +141,7 @@ cortex-M系列包含一个NVIC(嵌套中断向量控制器)提供硬件嵌