[PTLsim-devel] self-modifying code

Luk Van Ertvelde
Fri Jun 22 10:48:24 EDT 2007


Hello Matt,

First of all, thank you for sharing your well-written simulator.  
However, I have a question.

I have a binary which executes without a problem on native hardware,  
but which executes forever in PTLsim. It has something to do with  
self-modifying code...

Consider the following code-snippet:


  8057890:      a1 c6 79 05 08          mov    0x80579c6,%eax
  8057895:      d1 e0                   shl    %eax
  8057897:      a3 c6 79 05 08          mov    %eax,0x80579c6

  80579c5:      b8 00 00 00 70          mov    $0x70000000,%eax

As one can see, I modify the first operand of instruction 80579c5 at  
runtime (original 0x70000000). If I simulate the total program, PTLsim  
executes instruction 8057897 forever (trace: 8057890 - 8057895 -  
8057897 - 8057897 - 8057897 - 8057897 - ...). This problem doesn't  
exist on native hardware.

I also have a smaller program with the same problem running an old  
version of PTLsim (version from more than one year ago), which runs  
fine under the newer versions. I really don't have a clue of the  
problem as PTLsim should support self-modifying code, as stated in the  
manual.

If you want, I can deliver a small testcase to show you the problem.  
In short: I have programs running fine on native hardware, but giving  
problems in PTLsim (one instruction is repeating forever). The  
instruction with the problem is an instruction modifying an operand of  
another instruction (also shown in the example).

Any ideas?

Kind regards,
Luk.


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


More information about the PTLsim-devel mailing list