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 2006/12/15 16:47:19 UTC
svn commit: r487582 - in /harmony/enhanced/drlvm/trunk/vm/vmcore:
include/jvmti_break_intf.h src/jni/jni_utils.cpp
src/jvmti/jvmti_break_intf.cpp src/util/win/ia32/nt_exception_filter.cpp
Author: gshimansky
Date: Fri Dec 15 07:47:17 2006
New Revision: 487582
URL: http://svn.apache.org/viewvc?view=rev&rev=487582
Log:
Applied HARMONY-2693 [drlvm][jvmti] Incorrect direction flag value leads stack corruption
Tests passed on Ubuntu6, WindowsXP and SuSE9 x86_64
Modified:
harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_break_intf.h
harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni_utils.cpp
harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp
harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32/nt_exception_filter.cpp
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_break_intf.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_break_intf.h?view=diff&rev=487582&r1=487581&r2=487582
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_break_intf.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_break_intf.h Fri Dec 15 07:47:17 2006
@@ -220,7 +220,7 @@
};
// Address of this function is used for stack unwinding througn breakpoint
-void process_native_breakpoint_event();
+void __cdecl process_native_breakpoint_event();
// Callback function for native breakpoint processing
bool jvmti_jit_breakpoint_handler(Registers *regs);
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni_utils.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni_utils.cpp?view=diff&rev=487582&r1=487581&r2=487582
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni_utils.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni_utils.cpp Fri Dec 15 07:47:17 2006
@@ -106,6 +106,9 @@
jvalue *get_jvalue_arg_array(Method *method, va_list args)
{
unsigned num_args = method->get_num_args();
+ if(!num_args) {
+ return NULL;
+ }
jvalue *jvalue_args = (jvalue *)STD_MALLOC(num_args * sizeof(jvalue));
Arg_List_Iterator iter = method->get_argument_list();
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?view=diff&rev=487582&r1=487581&r2=487582
==============================================================================
--- 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 Fri Dec 15 07:47:17 2006
@@ -1321,12 +1321,30 @@
// Native breakpoints
//////////////////////////////////////////////////////////////////////////////
-void process_native_breakpoint_event()
+
+void __cdecl process_native_breakpoint_event()
{
DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
ti->vm_brpt->process_native_breakpoint();
}
+#ifdef _WIN32
+static void __declspec(naked)
+asm_process_native_breakpoint_event()
+{
+ __asm {
+ push ebp
+ mov ebp,esp
+ pushfd
+ cld
+ call process_native_breakpoint_event
+ popfd
+ pop ebp
+ ret
+ }
+}
+#endif // _WIN32
+
bool jvmti_jit_breakpoint_handler(Registers *regs)
{
#if PLATFORM_POSIX && INSTRUMENTATION_BYTE == INSTRUMENTATION_BYTE_INT3
@@ -1351,7 +1369,12 @@
// Copy original registers to TLS
vm_thread->jvmti_saved_exception_registers = *regs;
// Set return address for exception handler
+#if PLATFORM_POSIX
regs->set_ip((void*)process_native_breakpoint_event);
+#else // PLATFORM_POSIX
+ regs->set_ip((void*)asm_process_native_breakpoint_event);
+#endif //PLATFORM_POSIX
+
return true;
}
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32/nt_exception_filter.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32/nt_exception_filter.cpp?view=diff&rev=487582&r1=487581&r2=487582
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32/nt_exception_filter.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32/nt_exception_filter.cpp Fri Dec 15 07:47:17 2006
@@ -279,7 +279,7 @@
}
static LONG NTAPI vectored_exception_handler_internal(LPEXCEPTION_POINTERS nt_exception);
-static void __cdecl c_exception_handler(Class*, bool);
+void __cdecl asm_c_exception_handler(Class *exn_class, bool in_java);
LONG __declspec(naked) NTAPI vectored_exception_handler(LPEXCEPTION_POINTERS nt_exception)
{
@@ -444,11 +444,32 @@
context->Esp -= 4;
// set up the real exception handler address
- context->Eip = (uint32)c_exception_handler;
+ context->Eip = (uint32)asm_c_exception_handler;
// exit NT exception handler and transfer
// control to VM exception handler
return EXCEPTION_CONTINUE_EXECUTION;
+}
+
+static void __cdecl c_exception_handler(Class*, bool);
+
+void __declspec(naked) __cdecl asm_c_exception_handler(Class *exn_class, bool in_java)
+{
+ __asm {
+ push ebp
+ mov ebp,esp
+ pushfd
+ cld
+ mov eax, [ebp + 12]
+ push eax
+ mov eax, [ebp + 8]
+ push eax
+ call c_exception_handler
+ add esp, 8
+ popfd
+ pop ebp
+ ret
+ }
}