You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by gs...@apache.org on 2007/12/25 15:51:30 UTC
svn commit: r606790 - in /harmony/enhanced/drlvm/trunk/vm:
port/src/encoder/ia32_em64t/dec_base.cpp
vmcore/src/jvmti/jvmti_break_intf.cpp
Author: gshimansky
Date: Tue Dec 25 06:51:28 2007
New Revision: 606790
URL: http://svn.apache.org/viewvc?rev=606790&view=rev
Log:
Fixed bug HARMONY-5342. The change makes parsing of REX prefixes more flexible. All possible
REX combinations should now be allowed including those not mentioned in instruction opcodes
of encoder tables.
Also patch fixes a bug when a return is made from "noreturn" function
VMBreakPoints::process_native_breakpoint. It cannot return because its return address is
undefined in the stack. Instead it should transfer control back to original register context.
Modified:
harmony/enhanced/drlvm/trunk/vm/port/src/encoder/ia32_em64t/dec_base.cpp
harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp
Modified: harmony/enhanced/drlvm/trunk/vm/port/src/encoder/ia32_em64t/dec_base.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/port/src/encoder/ia32_em64t/dec_base.cpp?rev=606790&r1=606789&r2=606790&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/port/src/encoder/ia32_em64t/dec_base.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/port/src/encoder/ia32_em64t/dec_base.cpp Tue Dec 25 06:51:28 2007
@@ -255,19 +255,39 @@
#endif
*pbuf = save_pbuf;
- if (opcode_len != 0) {
#ifdef _EM64T_
- // Match REX prefixes
- if (((*pbuf)[0] & 0xf0) == 0x40 && opcode_ptr[0] == 0x48)
+ // Match REX prefixes
+ unsigned char rex_byte = (*pbuf)[0];
+ if ((rex_byte & 0xf0) == 0x40)
+ {
+ if ((rex_byte & 0x08) != 0)
+ {
+ // Have REX.W
+ if (opcode_len > 0 && opcode_ptr[0] == 0x48)
+ {
+ // Have REX.W in opcode. All mnemonics that allow
+ // REX.W have to have specified it in opcode,
+ // otherwise it is not allowed
+ rex = *(Rex *)*pbuf;
+ prex = &rex;
+ (*pbuf)++;
+ opcode_ptr++;
+ opcode_len--;
+ }
+ }
+ else
{
+ // No REX.W, so it doesn't have to be in opcode. We
+ // have REX.B, REX.X, REX.R or their combination, but
+ // not in opcode, they may extend any part of the
+ // instruction
rex = *(Rex *)*pbuf;
prex = &rex;
(*pbuf)++;
- opcode_ptr++;
- opcode_len--;
}
+ }
#endif
-
+ if (opcode_len != 0) {
if (memcmp(*pbuf, opcode_ptr, opcode_len)) {
continue;
}
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp?rev=606790&r1=606789&r2=606790&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp Tue Dec 25 06:51:28 2007
@@ -605,11 +605,21 @@
TRACE2("jvmti.break", "Native breakpoint occured: " << addr);
+ M2nFrame* m2nf = m2n_push_suspended_frame(®s);
+
VMBreakPoint* bp = find_breakpoint(addr);
if (NULL == bp) {
// breakpoint could be deleted by another thread
+ assert(*((unsigned char *)addr) != INSTRUMENTATION_BYTE);
unlock();
- return;
+ // Transfer execution back to the original register
+ // context. In case the target location happens to be
+ // instrumented, it means that another breakpoint has been set
+ // there right after unlock was done.
+ StackIterator* si = (StackIterator*) STD_ALLOCA(si_size());
+ si_fill_from_registers(si, ®s, false, m2n_get_previous_frame(m2nf));
+
+ si_transfer_control(si);
}
assert(bp->addr == addr);
TRACE2("jvmti.break", "Process native breakpoint: "
@@ -619,8 +629,6 @@
<< (bp->method ? method_get_name((Method*)bp->method) : "(nil)")
<< (bp->method ? method_get_descriptor((Method*)bp->method) : "")
<< " :" << bp->location << " :" << bp->addr);
-
- M2nFrame* m2nf = m2n_push_suspended_frame(®s);
jbyte *instruction_buffer;
BEGIN_RAISE_AREA;