modify interupt exception table

This commit is contained in:
Yan_yan 2020-11-10 11:35:35 +08:00
parent c4ecc9d04a
commit 16a42606a3
2 changed files with 7 additions and 2 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 KiB

View File

@ -55,9 +55,14 @@
+ mstatus(Machine Status Register):机器模式状态寄存器
mcause寄存器的Exception Code域标识是何种异常或者何种中断。定义如下图表格所示
![XiUOS EXCEPTION TABLE](./imagesrc/int_exception_table.png)
+ 退出异常时需要从异常服务程序中退出并返回主程序。RISC-V架构定义了一组专门的退出异常指令MRET、SRET、URET分别对应机器模式、监督模式、用户模式的退出。
| Interrupt/Exception<br/> mcause[XLEN-1] | Exception Code<br/> mcause[XLEN-2:0] | Description |
| :---: | :---: | --- |
| 1<br/>1<br/>1<br/>1<br/>1<br/>1 | 1<br/>3<br/>5<br/>7<br/>9<br/>11 | Supervisor software interrupt<br/>Machine software interrupt<br/>Supervisor timer interrupt<br/>Machine timer interrupt<br/>Supervisor external interrupt<br/>Machine external interrupt |
| 0<br/>0<br/>0<br/>0<br/>0<br/>0<br/>0<br/>0<br/>0<br/>0<br/>0<br/>0<br/>0<br/>0 | 0<br/>1<br/>2<br/>3<br/>4<br/>5<br/>6<br/>7<br/>8<br/>9<br/>11<br/>12<br/>13<br/>15 | Intruction address misaligned<br/>Instruction access fault<br/>Illegal instruction<br/>Breakpoint<br/>Load address misaligned<br/>Load access fault<br/>store address misaligned<br/>Store access fault<br/>Environment call from U-mode<br/>Environment call from S-mode<br/>Environment call from M-mode<br/>Instruction page fault<br/>Load page fault<br/>Store page fault |
+ 退出异常时需要从异常服务程序中退出并返回主程序。RISC-V架构定义了一组专images门的退出异常指令MRET、SRET、URET分别对应机器模式、监督模式、用户模式的退出。
以MRET为例当处理器执行MRET指令后硬件行为如下
1、当前程序执行流程停止执行跳转到mepc的地址运行
2、更新mstatus状态寄存器(具体情况可参考RISC-V架构介绍)