[panda-users] pc in PANDA_CB_BEFORE_BLOCK_EXEC

Brendan Dolan-Gavitt brendandg at gatech.edu
Thu May 7 14:58:21 EDT 2015


Ah, sorry, I didn't see that you were getting disagreement between the
two. I think this can occur because the sequence of events is:

[update panda_guest_pc for insn A]
[run insn A]
[end of block]
[call before_block_exec]
[new block]
[update panda_guest_pc for insn B]
[run insn B]

So when before_block_exec is called, I believe that panda_guest_pc may
point to the program counter of the last instruction that was
executed, not the instruction that is about to execute.

-Brendan

On Thu, May 7, 2015 at 2:14 PM, Igor R <boost.lists at gmail.com> wrote:
>> TranslationBlock::pc is updated at the start of a block, and also if
>> an exception occurs mid-block (so that exceptions can have the correct
>> program counter).
>>
>> CPUState::panda_guest_pc is updated every instruction. So, for
>> example, you can check its value in the middle of a memory callback
>> without worrying whether the program counter is updated correctly.
>
>
> But PANDA_CB_BEFORE_BLOCK_EXEC gets invoked just before the BB is
> executed, right? So, within this callback CPUState::panda_guest_pc
> should point either to the very same instruction, or to the last
> instruction of the previous bb (if it's updated after instruction),
> shouldn't it?
> _______________________________________________
> panda-users mailing list
> panda-users at mit.edu
> http://mailman.mit.edu/mailman/listinfo/panda-users


More information about the panda-users mailing list