如果原因寄存器中的值是,例如,
0x00000100
,我如何获取生成该代码的异常类型?(参见下表)
0 Int interrupt (hardware)
4 AdEL address error exception (load or instruction fetch)
5 AdES address error exception (store)
6 IBE bus error on instruction fetch
7 DBE bus error on data load or store
8 Sys syscall exception
9 Bp breakpoint exception
10 RI reserved instruction exception
11 CpU coprocessor unimplemented
12 Ov arithmetic overfl ow exception
13 Tr trap
15 FPE fl oating point
这在MIPS32™ 程序员架构中的6.16 原因寄存器(CP0 寄存器 13,选择 0) 一节中进行了描述 第三卷:MIPS32™ 特权资源 建筑.
原因寄存器格式
31 | 30 | 29 28 | 27 24 | 23 | 22 | 21 16 | 15 8 | 7 | 6 2 | 1 0
------------------------------------------------------------------------
BD | 0 | CE | 0 | IV | WP | 0 | IP | 0 | ExcCode | 0
IP[1:0] Controls the request for software interrupts
在 0x100 的示例中,这意味着仅设置了原因寄存器的
IP0
(位 8),这意味着原因是软件中断请求(具体为软件中断 0)。