Ignore:
Timestamp:
Jul 2, 2010, 11:45:47 PM (15 years ago)
Author:
[email protected]
Message:

Bug 41565 - Repatching in ARMv7Assembler::repatchLoadPtrToLEA is broken

Reviewed by Oliver Hunt.

This method tried to repatch a LDR (T2) into an ADD (T3) - but it only
repatches the first instruction word. The layout of the fields in the
second word is different, and also needs repatching.

  • assembler/ARMv7Assembler.h:

(JSC::ARMv7Assembler::repatchLoadPtrToLEA):

File:
1 edited

Legend:

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

    r62419 r62437  
    17281728    {
    17291729        ASSERT(!(reinterpret_cast<intptr_t>(where) & 1));
    1730 
    17311730        uint16_t* loadOp = reinterpret_cast<uint16_t*>(where) + 4;
    1732         ASSERT((*loadOp & 0xfff0) == OP_LDR_reg_T2);
    1733 
    1734         *loadOp = OP_ADD_reg_T3 | (*loadOp & 0xf);
    1735         ExecutableAllocator::cacheFlush(loadOp, sizeof(uint16_t));
     1731
     1732        ASSERT((loadOp[0] & 0xfff0) == OP_LDR_reg_T2);
     1733        ASSERT((loadOp[1] & 0x0ff0) == 0);
     1734        int rn = loadOp[0] & 0xf;
     1735        int rt = loadOp[1] >> 12;
     1736        int rm = loadOp[1] & 0xf;
     1737
     1738        loadOp[0] = OP_ADD_reg_T3 | rn;
     1739        loadOp[1] = rt << 8 | rm;
     1740        ExecutableAllocator::cacheFlush(loadOp, sizeof(uint32_t));
    17361741    }
    17371742
Note: See TracChangeset for help on using the changeset viewer.