ARM/THUMB PC Least Bit Set for Range Check
authorMyungJoo Ham <myungjoo.ham@samsung.com>
Thu, 19 May 2016 02:23:51 +0000 (11:23 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Mon, 30 May 2016 08:11:44 +0000 (17:11 +0900)
Fix #4859

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
src/pal/src/thread/context.cpp

index 384c7c8..d644e0d 100644 (file)
@@ -488,6 +488,12 @@ void CONTEXTFromNativeContext(const native_context_t *native, LPCONTEXT lpContex
     if ((contextFlags & CONTEXT_CONTROL) == CONTEXT_CONTROL)
     {
         ASSIGN_CONTROL_REGS
+#ifdef _ARM_
+        // WinContext assumes that the least bit of Pc is always 1 (denoting thumb)
+        // although the pc value retrived from native context might not have set the least bit.
+        // This becomes especially problematic if the context is on the JIT_WRITEBARRIER.
+        lpContext->Pc |= 0x1;
+#endif
     }
 
     if ((contextFlags & CONTEXT_INTEGER) == CONTEXT_INTEGER)