在C程序中安装异常中断处理程序:
unsigned Install_Handler( unsigned routine, unsigned *vector )
{
unsigned vec, old_vec;
vec = (routine - (unsigned)vector - 8) >> 2;
if (vec & 0xff000000)
{
printf("Handler greater than 32MBytes from vector");
}
vec = 0xea000000 | vec; /* OR in 'branch always' code */
old_vec = *vector;
*vector = vec;
return (old_vec);
}
其中第5行 vec = (routine - (unsigned)vector - 8) >> 2;
为什么要减8呢,书上说是为了允许指令预取,可我还是不明白,那位大虾能给我详细的解释一下?