void mono_arch_exceptions_init (void) { guint8 *tramp; if (mono_aot_only) { signal_exception_trampoline = mono_aot_get_trampoline ("x86_signal_exception_trampoline"); return; } /* LLVM needs different throw trampolines */ tramp = get_throw_trampoline ("llvm_throw_exception_trampoline", FALSE, TRUE, FALSE, FALSE, FALSE, NULL, FALSE); mono_register_jit_icall (tramp, "llvm_throw_exception_trampoline", NULL, TRUE); tramp = get_throw_trampoline ("llvm_rethrow_exception_trampoline", FALSE, TRUE, FALSE, FALSE, FALSE, NULL, FALSE); mono_register_jit_icall (tramp, "llvm_rethrow_exception_trampoline", NULL, TRUE); tramp = get_throw_trampoline ("llvm_throw_corlib_exception_trampoline", FALSE, TRUE, TRUE, FALSE, FALSE, NULL, FALSE); mono_register_jit_icall (tramp, "llvm_throw_corlib_exception_trampoline", NULL, TRUE); tramp = get_throw_trampoline ("llvm_throw_corlib_exception_abs_trampoline", FALSE, TRUE, TRUE, TRUE, FALSE, NULL, FALSE); mono_register_jit_icall (tramp, "llvm_throw_corlib_exception_abs_trampoline", NULL, TRUE); tramp = get_throw_trampoline ("llvm_resume_unwind_trampoline", FALSE, FALSE, FALSE, FALSE, TRUE, NULL, FALSE); mono_register_jit_icall (tramp, "llvm_resume_unwind_trampoline", NULL, TRUE); signal_exception_trampoline = mono_x86_get_signal_exception_trampoline (NULL, FALSE); }
void mono_arch_exceptions_init (void) { guint8 *tramp; MonoTrampInfo *tinfo; /* * If we're running WoW64, we need to set the usermode exception policy * for SEHs to behave. This requires hotfix http://support.microsoft.com/kb/976038 * or (eventually) Windows 7 SP1. */ #ifdef TARGET_WIN32 DWORD flags; FARPROC getter; FARPROC setter; HMODULE kernel32 = LoadLibraryW (L"kernel32.dll"); if (kernel32) { getter = GetProcAddress (kernel32, "GetProcessUserModeExceptionPolicy"); setter = GetProcAddress (kernel32, "SetProcessUserModeExceptionPolicy"); if (getter && setter) { if (getter (&flags)) setter (flags & ~PROCESS_CALLBACK_FILTER_ENABLED); } } #endif if (mono_aot_only) { signal_exception_trampoline = mono_aot_get_trampoline ("x86_signal_exception_trampoline"); return; } /* LLVM needs different throw trampolines */ tramp = get_throw_trampoline ("llvm_throw_exception_trampoline", FALSE, TRUE, FALSE, FALSE, FALSE, &tinfo, FALSE); mono_register_jit_icall (tramp, "llvm_throw_exception_trampoline", NULL, TRUE); mono_tramp_info_register (tinfo, NULL); tramp = get_throw_trampoline ("llvm_rethrow_exception_trampoline", TRUE, TRUE, FALSE, FALSE, FALSE, &tinfo, FALSE); mono_register_jit_icall (tramp, "llvm_rethrow_exception_trampoline", NULL, TRUE); mono_tramp_info_register (tinfo, NULL); tramp = get_throw_trampoline ("llvm_throw_corlib_exception_trampoline", FALSE, TRUE, TRUE, FALSE, FALSE, &tinfo, FALSE); mono_register_jit_icall (tramp, "llvm_throw_corlib_exception_trampoline", NULL, TRUE); mono_tramp_info_register (tinfo, NULL); tramp = get_throw_trampoline ("llvm_throw_corlib_exception_abs_trampoline", FALSE, TRUE, TRUE, TRUE, FALSE, &tinfo, FALSE); mono_register_jit_icall (tramp, "llvm_throw_corlib_exception_abs_trampoline", NULL, TRUE); mono_tramp_info_register (tinfo, NULL); tramp = get_throw_trampoline ("llvm_resume_unwind_trampoline", FALSE, FALSE, FALSE, FALSE, TRUE, &tinfo, FALSE); mono_register_jit_icall (tramp, "llvm_resume_unwind_trampoline", NULL, TRUE); mono_tramp_info_register (tinfo, NULL); signal_exception_trampoline = mono_x86_get_signal_exception_trampoline (&tinfo, FALSE); mono_tramp_info_register (tinfo, NULL); }