Title: [236768] trunk/Source/_javascript_Core
Revision
236768
Author
[email protected]
Date
2018-10-02 15:53:26 -0700 (Tue, 02 Oct 2018)

Log Message

Fix Disassembler-output on ARM Thumb2
https://bugs.webkit.org/show_bug.cgi?id=190203

On ARMv7 with Thumb2 addresses have bit 0 set to 1 to force
execution in thumb mode for jumps and calls. The actual machine
instructions are still aligned to 2-bytes though. Use dataLocation() as
start address for disassembling since it unsets the thumb bit.
Until now the disassembler would start at the wrong address (off by 1),
resulting in the wrong disassembled machine instructions.

Patch by Dominik Infuehr <[email protected]> on 2018-10-02
Reviewed by Mark Lam.

* disassembler/CapstoneDisassembler.cpp:
(JSC::tryToDisassemble):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (236767 => 236768)


--- trunk/Source/_javascript_Core/ChangeLog	2018-10-02 22:34:09 UTC (rev 236767)
+++ trunk/Source/_javascript_Core/ChangeLog	2018-10-02 22:53:26 UTC (rev 236768)
@@ -1,3 +1,20 @@
+2018-10-02  Dominik Infuehr  <[email protected]>
+
+        Fix Disassembler-output on ARM Thumb2
+        https://bugs.webkit.org/show_bug.cgi?id=190203
+
+        On ARMv7 with Thumb2 addresses have bit 0 set to 1 to force
+        execution in thumb mode for jumps and calls. The actual machine
+        instructions are still aligned to 2-bytes though. Use dataLocation() as
+        start address for disassembling since it unsets the thumb bit.
+        Until now the disassembler would start at the wrong address (off by 1),
+        resulting in the wrong disassembled machine instructions.
+
+        Reviewed by Mark Lam.
+
+        * disassembler/CapstoneDisassembler.cpp:
+        (JSC::tryToDisassemble):
+
 2018-10-02  Yusuke Suzuki  <[email protected]>
 
         [JSC] Add stub of ExecutableAllocator used when JIT is disabled

Modified: trunk/Source/_javascript_Core/disassembler/CapstoneDisassembler.cpp (236767 => 236768)


--- trunk/Source/_javascript_Core/disassembler/CapstoneDisassembler.cpp	2018-10-02 22:34:09 UTC (rev 236767)
+++ trunk/Source/_javascript_Core/disassembler/CapstoneDisassembler.cpp	2018-10-02 22:53:26 UTC (rev 236768)
@@ -67,7 +67,7 @@
     }
 #endif
 
-    size_t count = cs_disasm(handle, codePtr.untaggedExecutableAddress<unsigned char*>(), size, codePtr.untaggedExecutableAddress<uintptr_t>(), 0, &instructions);
+    size_t count = cs_disasm(handle, codePtr.dataLocation<unsigned char*>(), size, codePtr.dataLocation<uintptr_t>(), 0, &instructions);
     if (count > 0) {
         for (size_t i = 0; i < count; ++i) {
             auto& instruction = instructions[i];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to