Changeset 59037 in webkit for trunk/JavaScriptCore/assembler


Ignore:
Timestamp:
May 8, 2010, 12:51:23 PM (15 years ago)
Author:
[email protected]
Message:

2010-05-08 Gabor Loki <[email protected]>

Reviewed by Gavin Barraclough.

Fix spanning branch instruction on Cortex-A8 with Thumb-2 JIT
https://bugs.webkit.org/show_bug.cgi?id=38280

If the 32-bit Thumb-2 branch instruction spans two 4KiB regions and
the target of the branch falls within the first region it is
possible for the processor to incorrectly determine the branch
instruction, and it is also possible in some cases for the processor
to enter a deadlock state.

  • assembler/ARMv7Assembler.h: (JSC::ARMv7Assembler::linkJumpAbsolute):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/assembler/ARMv7Assembler.h

    r55834 r59037  
    17551755
    17561756        intptr_t relative = reinterpret_cast<intptr_t>(target) - (reinterpret_cast<intptr_t>(instruction));
    1757         if (((relative << 7) >> 7) == relative) {
     1757
     1758        // From Cortex-A8 errata:
     1759        // If the 32-bit Thumb-2 branch instruction spans two 4KiB regions and
     1760        // the target of the branch falls within the first region it is
     1761        // possible for the processor to incorrectly determine the branch
     1762        // instruction, and it is also possible in some cases for the processor
     1763        // to enter a deadlock state.
     1764        // The instruction is spanning two pages if it ends at an address ending 0x002
     1765        bool spansTwo4K = ((reinterpret_cast<intptr_t>(instruction) & 0xfff) == 0x002);
     1766        // The target is in the first page if the jump branch back by [3..0x1002] bytes
     1767        bool targetInFirstPage = (relative >= -0x1002) && (relative < -2);
     1768        bool wouldTriggerA8Errata = spansTwo4K && targetInFirstPage;
     1769
     1770        if (((relative << 7) >> 7) == relative && !wouldTriggerA8Errata) {
    17581771            // ARM encoding for the top two bits below the sign bit is 'peculiar'.
    17591772            if (relative >= 0)
Note: See TracChangeset for help on using the changeset viewer.