From 301ac12d37c0cacb6df7c6771e0b8102ff2ece54 Mon Sep 17 00:00:00 2001 From: David Major Date: Wed, 30 Aug 2017 07:16:44 +1200 Subject: [PATCH] Bug 1392485: Add REX.R mov to the disassembler. r=handyman To mitigate risk for beta uplift, the logic here is limited to what we need for QueryDosDeviceW on Win7x64. A better long-term fix would be to combine this with the more general mov logic in the REX.W section. MozReview-Commit-ID: BykQSYY61Ua --- xpcom/build/nsWindowsDllInterceptor.h | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/xpcom/build/nsWindowsDllInterceptor.h b/xpcom/build/nsWindowsDllInterceptor.h index 462dbbd20c8f4..d97d1963f8dfd 100755 --- a/xpcom/build/nsWindowsDllInterceptor.h +++ b/xpcom/build/nsWindowsDllInterceptor.h @@ -909,7 +909,25 @@ class WindowsDllDetourPatcher MOZ_ASSERT_UNREACHABLE("Unrecognized opcode sequence"); return; } - } else if (origBytes[nOrigBytes] == 0x45) { + } else if (origBytes[nOrigBytes] == 0x44) { + // REX.R + COPY_CODES(1); + + // TODO: Combine with the "0x89" case below in the REX.W section + if (origBytes[nOrigBytes] == 0x89) { + // mov r/m32, r32 + COPY_CODES(1); + int len = CountModRmSib(origBytes + nOrigBytes); + if (len < 0) { + MOZ_ASSERT_UNREACHABLE("Unrecognized opcode sequence"); + return; + } + COPY_CODES(len); + } else { + MOZ_ASSERT_UNREACHABLE("Unrecognized opcode sequence"); + return; + } + } else if (origBytes[nOrigBytes] == 0x45) { // REX.R & REX.B COPY_CODES(1);