Revert "Revert "x86/x86-64: Avoid temporary for read barrier field load.""
Fixed the fault handler recognizing the TEST instruction and
fault address within the lock word. Added tests to 439-npe.
Bug: 29966877
Bug: 12687968
Test: Tested with ART_USE_READ_BARRIER=true on host.
Test: Tested with ART_USE_READ_BARRIER=true ART_HEAP_POISONING=true on host.
This reverts commit ccf15bca330f9a23337b1a4b5850f7fcc6c1bf15.
Change-Id: I8990def5f719c9205bf6e5fdba32027fa82bec50
diff --git a/runtime/arch/x86/fault_handler_x86.cc b/runtime/arch/x86/fault_handler_x86.cc
index 3efeb40..c7af249 100644
--- a/runtime/arch/x86/fault_handler_x86.cc
+++ b/runtime/arch/x86/fault_handler_x86.cc
@@ -191,6 +191,27 @@
immediate_size = operand_size_prefix ? 2 : 4;
break;
+ case 0xf6:
+ case 0xf7:
+ modrm = *pc++;
+ has_modrm = true;
+ switch ((modrm >> 3) & 7) { // Extract "reg/opcode" from "modr/m".
+ case 0: // test
+ immediate_size = (opcode == 0xf6) ? 1 : (operand_size_prefix ? 2 : 4);
+ break;
+ case 2: // not
+ case 3: // neg
+ case 4: // mul
+ case 5: // imul
+ case 6: // div
+ case 7: // idiv
+ break;
+ default:
+ unhandled_instruction = true;
+ break;
+ }
+ break;
+
default:
unhandled_instruction = true;
break;