On 02/14/2011 10:16 PM, Ulrich Weigand wrote: > I think this is wrong: the "pipeline offset" of 8 bytes is already > added to the PC value when it is retrieved by displaced_read_reg > (this applies to any use of PC as source operand in any instruction). > > The special case relating to STR PC is about an optional *additional* > offset of 4 bytes (such that PC + 12 instead of PC + 8 is stored); > the "offset" value computed by this routine should therefore be > 0 or 4 (not 8 or 12). Thanks for the explanation. > Maybe it would be good to add a test that verifies the value > stored under displaced stepping is identical to the value > stored when running the instruction natively? In my new patch, the test case is revised to execute instructions below twice, str pc, [sp, #-4] ldr rN, [sp, #-4] sub rN, rN, pc the first `str' instruction is executed with displaced stepping, while the second `str' is executed without displaced stepping. Then, values of two registers are compared to make sure they should be the same. -- Yao (齐尧)