ART Runtime: Add movw $xx,yy fault handling
Handle a movw $xx,yy instruction in the segmentation violation fault
handler. This can be detected by a 0x66 prefix byte for the move
immediate instruction, using this to set the size of the immediate
value.
This test case shows up in 122-npe using my private backend changes.
Change-Id: If224a9dd0084f50c91da418808cbe2d491308600
Category: Device Enablement
Domain: AOSP.ART-Quick
Origin: Internal
Upstream-Candidate: yes
Signed-off-by: Mark Mendell <mark.p.mendell@intel.com>
diff --git a/runtime/arch/x86/fault_handler_x86.cc b/runtime/arch/x86/fault_handler_x86.cc
index ee005e8..7db84d0 100644
--- a/runtime/arch/x86/fault_handler_x86.cc
+++ b/runtime/arch/x86/fault_handler_x86.cc
@@ -104,11 +104,17 @@
bool two_byte = false;
uint32_t displacement_size = 0;
uint32_t immediate_size = 0;
+ bool operand_size_prefix = false;
// Prefixes.
while (true) {
bool prefix_present = false;
switch (opcode) {
+ // Group 3
+ case 0x66:
+ operand_size_prefix = true;
+ // fallthrough
+
// Group 1
case 0xf0:
case 0xf2:
@@ -122,9 +128,6 @@
case 0x64:
case 0x65:
- // Group 3
- case 0x66:
-
// Group 4
case 0x67:
opcode = *pc++;
@@ -189,7 +192,7 @@
case 0x81: // group 1, word immediate.
modrm = *pc++;
has_modrm = true;
- immediate_size = 4;
+ immediate_size = operand_size_prefix ? 2 : 4;
break;
default: