зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1382251: Part 1 - Add x64 opcodes to nsWindowsDllInterceptor needed for plugin process SSL brokering; r=aklotz
Adds "LEA reg, opcode", "mov word ptr [reg+disp8], reg", "and [reg+disp8], imm8" and "MOV r/m8, imm8" to DLLInterceptor.
This commit is contained in:
Родитель
5b2f441cf2
Коммит
6e41063d30
|
@ -1043,6 +1043,31 @@ protected:
|
|||
MOZ_ASSERT_UNREACHABLE("Unrecognized opcode sequence");
|
||||
return;
|
||||
}
|
||||
} else if (origBytes[nOrigBytes] == 0x8d) {
|
||||
// LEA reg, addr
|
||||
if ((origBytes[nOrigBytes + 1] & kMaskMod) == 0x0 &&
|
||||
(origBytes[nOrigBytes + 1] & kMaskRm) == 0x5) {
|
||||
// [rip+disp32]
|
||||
// convert 32bit offset to 64bit direct and convert instruction
|
||||
// to a simple 64-bit mov
|
||||
BYTE reg = (origBytes[nOrigBytes + 1] & kMaskReg) >> kRegFieldShift;
|
||||
intptr_t absAddr =
|
||||
reinterpret_cast<intptr_t>(origBytes + nOrigBytes + 6 +
|
||||
*reinterpret_cast<int32_t*>(origBytes + nOrigBytes + 2));
|
||||
nOrigBytes += 6;
|
||||
tramp[nTrampBytes] = 0xb8 + reg; // mov
|
||||
++nTrampBytes;
|
||||
intptr_t* trampOperandPtr = reinterpret_cast<intptr_t*>(tramp + nTrampBytes);
|
||||
*trampOperandPtr = absAddr;
|
||||
nTrampBytes += 8;
|
||||
} else {
|
||||
// Above we dealt with RIP-relative instructions. Any other
|
||||
// operand form can simply be copied.
|
||||
int len = CountModRmSib(origBytes + nOrigBytes + 1);
|
||||
// We handled the kModOperand64 -- ie RIP-relative -- case above
|
||||
MOZ_ASSERT(len > 0);
|
||||
COPY_CODES(len + 1);
|
||||
}
|
||||
} else if (origBytes[nOrigBytes] == 0x63 &&
|
||||
(origBytes[nOrigBytes + 1] & kMaskMod) == kModReg) {
|
||||
// movsxd r64, r32 (move + sign extend)
|
||||
|
@ -1077,6 +1102,17 @@ protected:
|
|||
MOZ_ASSERT_UNREACHABLE("Unrecognized MOV opcode sequence");
|
||||
return;
|
||||
}
|
||||
} else if (origBytes[nOrigBytes] == 0x44 &&
|
||||
origBytes[nOrigBytes+1] == 0x89) {
|
||||
// mov word ptr [reg+disp8], reg
|
||||
COPY_CODES(2);
|
||||
int len = CountModRmSib(origBytes + nOrigBytes);
|
||||
if (len < 0) {
|
||||
// no way to support this yet.
|
||||
MOZ_ASSERT_UNREACHABLE("Unrecognized opcode sequence");
|
||||
return;
|
||||
}
|
||||
COPY_CODES(len);
|
||||
}
|
||||
} else if ((origBytes[nOrigBytes] & 0xf0) == 0x50) {
|
||||
// 1-byte push/pop
|
||||
|
@ -1222,6 +1258,19 @@ protected:
|
|||
MOZ_ASSERT_UNREACHABLE("Unrecognized opcode sequence");
|
||||
return;
|
||||
}
|
||||
} else if (origBytes[nOrigBytes] == 0x83 &&
|
||||
(origBytes[nOrigBytes + 1] & 0xf8) == 0x60) {
|
||||
// and [r+d], imm8
|
||||
COPY_CODES(5);
|
||||
} else if (origBytes[nOrigBytes] == 0xc6) {
|
||||
// mov [r+d], imm8
|
||||
int len = CountModRmSib(&origBytes[nOrigBytes + 1]);
|
||||
if (len < 0) {
|
||||
// RIP-relative not yet supported
|
||||
MOZ_ASSERT_UNREACHABLE("Unrecognized opcode sequence");
|
||||
return;
|
||||
}
|
||||
COPY_CODES(len + 1);
|
||||
} else {
|
||||
MOZ_ASSERT_UNREACHABLE("Unrecognized opcode sequence");
|
||||
return;
|
||||
|
|
Загрузка…
Ссылка в новой задаче