关于的CP0 Hazards,官方定义是:
Each instruction in the program sees the results of the previous instruction.
There are some deviations to this model. These deviations are referred to as hazards.
举个关中断的例子:
mfc0 v0, CP0_STATUS
ori v0, v0, M_SR_IE
xori v0, v0, M_SR_IE
mtc0 v0, CP0_STATUS
lw t0,schedule_checkfuntionnum
beqz t0,Schedule_Check_End
nop
...
我们期望下面这条lw语句是在关中断的上下文运行,但是mtc0写入cp0_status寄存器不能在一下pipeline step马上有效。
就是说lw指令到底执行阶段是中断还可能开这的。
为了解决类似的CP0 Hazards问题。需要在mtc0这种可能会导致CP0 Hazards的指令后面插入一些指令。
在MIP Release1通常插入一些SSNOP来解决。到了MIPS Release2提供了EHB这类的指令来解决。
在MIPS Release2 CPU中如果软件还是Releas1中使用SSNOP,可能会有问题。
因为PipeLine越来越长,原来固定加的几个SSNOP可能不够用。而EHB指令会让PipeLine停止取指,直到instruction buffer为空。
从Release1升级到Release2,与arch和kernel相关的代码
Each instruction in the program sees the results of the previous instruction.
There are some deviations to this model. These deviations are referred to as hazards.
举个关中断的例子:
mfc0 v0, CP0_STATUS
ori v0, v0, M_SR_IE
xori v0, v0, M_SR_IE
mtc0 v0, CP0_STATUS
lw t0,schedule_checkfuntionnum
beqz t0,Schedule_Check_End
nop
...
我们期望下面这条lw语句是在关中断的上下文运行,但是mtc0写入cp0_status寄存器不能在一下pipeline step马上有效。
就是说lw指令到底执行阶段是中断还可能开这的。
为了解决类似的CP0 Hazards问题。需要在mtc0这种可能会导致CP0 Hazards的指令后面插入一些指令。
在MIP Release1通常插入一些SSNOP来解决。到了MIPS Release2提供了EHB这类的指令来解决。
在MIPS Release2 CPU中如果软件还是Releas1中使用SSNOP,可能会有问题。
因为PipeLine越来越长,原来固定加的几个SSNOP可能不够用。而EHB指令会让PipeLine停止取指,直到instruction buffer为空。
从Release1升级到Release2,与arch和kernel相关的代码