无为 2006-05-20 11:38:55 请教<<Arm architecture reference manual>>上计算PC偏移的问题
下面是<<Arm architecture reference manual>>上使用的方法,最后它认为R0中得到的就是PC和当前执行指令的偏移量。可是我觉得不妥,因为刚开始它就认为是8个byte的偏移。
SUB R1, PC, #4 ; R1 = address of following STR instruction
STR PC, [R0] ; Store address of STR instruction + offset,
LDR R0, [R0] ; then reload it
SUB R0, R0, R1 ; Calculate the offset as the difference