Menu

#60 Where Time Stood Still crashes before the intro starts

PPCJITBETA05
wont-fix
2-med
2014-09-13
2014-08-05
No

Where Time Stood Still crashes before the intro starts when the JIT compiling is enabled.

Thanks to Costantino Damilakis (Cass) for the report.

Discussion

  • Almos Rajnai

    Almos Rajnai - 2014-08-20
    • status: open --> accepted
     
  • Almos Rajnai

    Almos Rajnai - 2014-09-13

    After spending lot of time on this bug it turned out that it is the typical problem with self-modifying code.

    A code block starting from $1050 (waiting loop for button click) is compiled by the JIT then later on this block is overwritten with a completely different piece of code. When the new code is executed then instead of the new code the previously compiled code is used, which causes a wrong jump to an illegal instruction -> crash.

    The problem is: modifying memory areas without flushing the instruction cache of the 68k processor.
    This kind of behavior is not uncommon, many of the old games and demos are doing it. It might work on certain processors because of the size of the instruction cache, but that is just a coincidence. The program will crash on a processor where the cache is large enough to preserve the original copy of the code.

    It is impossible to fix in the JIT compiling without doing checksums before each block is executed or doing some tricky MMU-based detection. Both are way too expensive regarding the performance.

    Sorry, this is a no-fix.

     
  • Almos Rajnai

    Almos Rajnai - 2014-09-13
    • status: accepted --> wont-fix
    • assigned_to: Almos Rajnai
     

Log in to post a comment.

MongoDB Logo MongoDB