Index: vm/port/src/lil/em64t/pim/stack_iterator_em64t.cpp =================================================================== --- vm/port/src/lil/em64t/pim/stack_iterator_em64t.cpp (revision 515614) +++ vm/port/src/lil/em64t/pim/stack_iterator_em64t.cpp (working copy) @@ -334,9 +334,8 @@ Global_Env *env = VM_Global_State::loader_env; // Setup current frame + // It's possible that registers represent native code and res->cci==NULL si->cci = env->vm_methods->find((NativeCodePtr)regs->rip, is_ip_past); - assert(si->cci); - init_context_from_registers(si->jit_frame_context, *regs, is_ip_past); si->m2n_frame = lm2nf; Index: vm/vmcore/src/util/win/em64t/nt_exception_filter.cpp =================================================================== --- vm/vmcore/src/util/win/em64t/nt_exception_filter.cpp (revision 515614) +++ vm/vmcore/src/util/win/em64t/nt_exception_filter.cpp (working copy) @@ -106,8 +106,28 @@ return (void*)pregs->rsp; } -void regs_push_param_onto_stack(Registers* pregs, POINTER_SIZE_INT param) +// Max. 4 arguments can be set up +void regs_push_param(Registers* pregs, POINTER_SIZE_INT param, int num) +{ // RCX, RDX, R8, R9 + switch (num) + { + case 0: + pregs->rcx = param; + return; + case 1: + pregs->rdx = param; + return; + case 2: + pregs->r8 = param; + return; + case 3: + pregs->r9 = param; + return; + } +} + +void regs_push_return_address(Registers* pregs, void* ret_addr) { pregs->rsp = pregs->rsp - 8; - *((uint64*)pregs->rsp) = param; + *((void**)pregs->rsp) = ret_addr; } Index: vm/vmcore/src/util/win/include/exception_filter.h =================================================================== --- vm/vmcore/src/util/win/include/exception_filter.h (revision 515614) +++ vm/vmcore/src/util/win/include/exception_filter.h (working copy) @@ -62,7 +62,8 @@ // Fuctions to manipulate with Registers structure void* regs_get_sp(Registers* pregs); -void regs_push_param_onto_stack(Registers* pregs, POINTER_SIZE_INT param); +void regs_push_param(Registers* pregs, POINTER_SIZE_INT param, int num); +void regs_push_return_address(Registers* pregs, void* ret_addr); #endif // nt_exception_filter_h Index: vm/vmcore/src/util/win/ia32_em64t/nt_exception_filter_common.cpp =================================================================== --- vm/vmcore/src/util/win/ia32_em64t/nt_exception_filter_common.cpp (revision 515614) +++ vm/vmcore/src/util/win/ia32_em64t/nt_exception_filter_common.cpp (working copy) @@ -321,12 +321,12 @@ // __cdecl <=> push parameters in the reversed order // push in_java argument onto stack - regs_push_param_onto_stack(®s, in_java); + regs_push_param(®s, in_java, 1/*2nd arg */); // push the exn_class argument onto stack assert(exn_class); - regs_push_param_onto_stack(®s, (POINTER_SIZE_INT)exn_class); + regs_push_param(®s, (POINTER_SIZE_INT)exn_class, 0/* 1st arg */); // imitate return IP on stack - regs_push_param_onto_stack(®s, 0); + regs_push_return_address(®s, NULL); // set up the real exception handler address regs.set_ip(asm_c_exception_handler); @@ -356,12 +356,12 @@ if (ti->get_global_capability(DebugUtilsTI::TI_GC_ENABLE_EXCEPTION_EVENT)) { // Set return address to current IP - regs_push_param_onto_stack(®s, (POINTER_SIZE_INT)regs.get_ip()); + regs_push_return_address(®s, regs.get_ip()); // Set IP to callback address regs.set_ip(asm_jvmti_exception_catch_callback); } else if (p_TLS_vmthread->restore_guard_page) { // Set return address to current IP - regs_push_param_onto_stack(®s, (POINTER_SIZE_INT)regs.get_ip()); + regs_push_return_address(®s, regs.get_ip()); // Set IP to callback address regs.set_ip(asm_exception_catch_callback); } Index: vm/vmcore/src/util/win/ia32/nt_exception_filter.cpp =================================================================== --- vm/vmcore/src/util/win/ia32/nt_exception_filter.cpp (revision 515614) +++ vm/vmcore/src/util/win/ia32/nt_exception_filter.cpp (working copy) @@ -155,8 +155,14 @@ return (void*)pregs->esp; } -void regs_push_param_onto_stack(Registers* pregs, POINTER_SIZE_INT param) +void regs_push_param(Registers* pregs, POINTER_SIZE_INT param, int UNREF num) { pregs->esp = pregs->esp - 4; *((uint32*)pregs->esp) = param; } + +void regs_push_return_address(Registers* pregs, void* ret_addr) +{ + pregs->esp = pregs->esp - 4; + *((void**)pregs->esp) = ret_addr; +}