Changeset 113253 in webkit


Ignore:
Timestamp:
Apr 4, 2012 3:42:29 PM (12 years ago)
Author:
msaboff@apple.com
Message:

Constant Blinding for add/sub immediate crashes in ArmV7 when dest is SP
https://bugs.webkit.org/show_bug.cgi?id=83191

Reviewed by Oliver Hunt.

Make are that blinded constant pairs are similarly aligned to the
original immediate values so that instructions that expect that
alignment work correctly. One example is ARMv7 add/sub imm to SP.

  • assembler/ARMv7Assembler.h:

(JSC::ARMv7Assembler::add): Added ASSERT that immediate is word aligned.
(JSC::ARMv7Assembler::sub): Added ASSERT that immediate is word aligned.
(JSC::ARMv7Assembler::sub_S): Added ASSERT that immediate is word aligned.

  • assembler/MacroAssembler.h:

(JSC::MacroAssembler::additionBlindedConstant):

Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r113240 r113253  
     12012-04-04  Michael Saboff  <msaboff@apple.com>
     2
     3        Constant Blinding for add/sub immediate crashes in ArmV7 when dest is SP
     4        https://bugs.webkit.org/show_bug.cgi?id=83191
     5
     6        Reviewed by Oliver Hunt.
     7
     8        Make are that blinded constant pairs are similarly aligned to the
     9        original immediate values so that instructions that expect that
     10        alignment work correctly.  One example is ARMv7 add/sub imm to SP.
     11
     12        * assembler/ARMv7Assembler.h:
     13        (JSC::ARMv7Assembler::add): Added ASSERT that immediate is word aligned.
     14        (JSC::ARMv7Assembler::sub): Added ASSERT that immediate is word aligned.
     15        (JSC::ARMv7Assembler::sub_S): Added ASSERT that immediate is word aligned.
     16        * assembler/MacroAssembler.h:
     17        (JSC::MacroAssembler::additionBlindedConstant):
     18
    1192012-04-04  Filip Pizlo  <fpizlo@apple.com>
    220
  • trunk/Source/JavaScriptCore/assembler/ARMv7Assembler.h

    r109038 r113253  
    740740
    741741        if (rn == ARMRegisters::sp) {
     742            ASSERT(!(imm.getUInt16() & 3));
    742743            if (!(rd & 8) && imm.isUInt10()) {
    743744                m_formatter.oneWordOp5Reg3Imm8(OP_ADD_SP_imm_T1, rd, static_cast<uint8_t>(imm.getUInt10() >> 2));
     
    15121513
    15131514        if ((rn == ARMRegisters::sp) && (rd == ARMRegisters::sp) && imm.isUInt9()) {
     1515            ASSERT(!(imm.getUInt16() & 3));
    15141516            m_formatter.oneWordOp9Imm7(OP_SUB_SP_imm_T1, static_cast<uint8_t>(imm.getUInt9() >> 2));
    15151517            return;
     
    15731575
    15741576        if ((rn == ARMRegisters::sp) && (rd == ARMRegisters::sp) && imm.isUInt9()) {
     1577            ASSERT(!(imm.getUInt16() & 3));
    15751578            m_formatter.oneWordOp9Imm7(OP_SUB_SP_imm_T1, static_cast<uint8_t>(imm.getUInt9() >> 2));
    15761579            return;
  • trunk/Source/JavaScriptCore/assembler/MacroAssembler.h

    r110751 r113253  
    700700    BlindedImm32 additionBlindedConstant(Imm32 imm)
    701701    {
     702        // The addition immediate may be used as a pointer offset. Keep aligned based on "imm".
     703        static uint32_t maskTable[4] = { 0xfffffffc, 0xffffffff, 0xfffffffe, 0xffffffff };
     704
    702705        uint32_t baseValue = imm.asTrustedImm32().m_value;
    703         uint32_t key = keyForConstant(baseValue);
     706        uint32_t key = keyForConstant(baseValue) & maskTable[baseValue & 3];
    704707        if (key > baseValue)
    705708            key = key - baseValue;
Note: See TracChangeset for help on using the changeset viewer.