#include <config.h>
#include <glib.h>
-#include <signal.h>
#include <string.h>
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif
#ifdef HAVE_UCONTEXT_H
#include <ucontext.h>
#endif
}
#endif
- mono_handle_native_sigsegv (SIGSEGV, NULL);
+ mono_handle_native_sigsegv (SIGSEGV, NULL, NULL);
return EXCEPTION_CONTINUE_SEARCH;
}
nacl_global_codeman_validate(&start, 256, &code);
mono_arch_flush_icache (start, code - start);
+ mono_profiler_code_buffer_new (start, code - start, MONO_PROFILER_CODE_BUFFER_EXCEPTION_HANDLING, NULL);
if (info)
*info = mono_tramp_info_create ("restore_context", start, code - start, ji, unwind_ops);
amd64_mov_reg_membase (code, AMD64_RDI, AMD64_ARG_REG1, MONO_STRUCT_OFFSET (MonoContext, rdi), 8);
amd64_mov_reg_membase (code, AMD64_RSI, AMD64_ARG_REG1, MONO_STRUCT_OFFSET (MonoContext, rsi), 8);
#endif
+ /* load exc register */
+ amd64_mov_reg_membase (code, AMD64_RAX, AMD64_ARG_REG1, MONO_STRUCT_OFFSET (MonoContext, rax), 8);
/* call the handler */
amd64_call_reg (code, AMD64_ARG_REG2);
nacl_global_codeman_validate(&start, kMaxCodeSize, &code);
mono_arch_flush_icache (start, code - start);
+ mono_profiler_code_buffer_new (start, code - start, MONO_PROFILER_CODE_BUFFER_EXCEPTION_HANDLING, NULL);
if (info)
*info = mono_tramp_info_create ("call_filter", start, code - start, ji, unwind_ops);
if (mono_object_isinst (exc, mono_defaults.exception_class)) {
MonoException *mono_ex = (MonoException*)exc;
- if (!rethrow)
+ if (!rethrow) {
mono_ex->stack_trace = NULL;
+ mono_ex->trace_ips = NULL;
+ }
}
/* adjust eip so that it point into the call instruction */
g_assert ((code - start) < kMaxCodeSize);
nacl_global_codeman_validate(&start, kMaxCodeSize, &code);
+ mono_profiler_code_buffer_new (start, code - start, MONO_PROFILER_CODE_BUFFER_EXCEPTION_HANDLING, NULL);
if (info)
*info = mono_tramp_info_create (tramp_name, start, code - start, ji, unwind_ops);
guint8 *cfa;
guint32 unwind_info_len;
guint8 *unwind_info;
- guint8 *epilog;
+ guint8 *epilog = NULL;
frame->type = FRAME_TYPE_MANAGED;
printf ("%s %p %p\n", ji->d.method->name, ji->code_start, ip);
mono_print_unwind_info (unwind_info, unwind_info_len);
*/
- epilog = (guint8*)ji->code_start + ji->code_size - mono_jinfo_get_epilog_size (ji);
+ /* LLVM compiled code doesn't have this info */
+ if (ji->has_arch_eh_info)
+ epilog = (guint8*)ji->code_start + ji->code_size - mono_jinfo_get_epilog_size (ji);
regs [AMD64_RAX] = new_ctx->rax;
regs [AMD64_RBX] = new_ctx->rbx;
mono_unwind_frame (unwind_info, unwind_info_len, ji->code_start,
(guint8*)ji->code_start + ji->code_size,
- ip, &epilog, regs, MONO_MAX_IREGS + 1,
+ ip, epilog ? &epilog : NULL, regs, MONO_MAX_IREGS + 1,
save_locations, MONO_MAX_IREGS, &cfa);
new_ctx->rax = regs [AMD64_RAX];
MonoJitTlsData *jit_tls = mono_native_tls_get_value (mono_jit_tls_id);
/* Pass the ctx parameter in TLS */
- mono_arch_sigctx_to_monoctx (sigctx, &jit_tls->ex_ctx);
+ mono_sigctx_to_monoctx (sigctx, &jit_tls->ex_ctx);
mctx = jit_tls->ex_ctx;
mono_arch_setup_async_callback (&mctx, handle_signal_exception, obj);
#else
MonoContext mctx;
- mono_arch_sigctx_to_monoctx (sigctx, &mctx);
+ mono_sigctx_to_monoctx (sigctx, &mctx);
mono_handle_exception (&mctx, obj);
- mono_arch_monoctx_to_sigctx (&mctx, sigctx);
+ mono_monoctx_to_sigctx (&mctx, sigctx);
return TRUE;
#endif
}
-void
-mono_arch_sigctx_to_monoctx (void *sigctx, MonoContext *mctx)
-{
- mono_sigctx_to_monoctx (sigctx, mctx);
-}
-
-void
-mono_arch_monoctx_to_sigctx (MonoContext *mctx, void *sigctx)
-{
- mono_monoctx_to_sigctx (mctx, sigctx);
-}
-
gpointer
mono_arch_ip_from_context (void *sigctx)
{
}
void
-mono_arch_handle_altstack_exception (void *sigctx, gpointer fault_addr, gboolean stack_ovf)
+mono_arch_handle_altstack_exception (void *sigctx, MONO_SIG_HANDLER_INFO_TYPE *siginfo, gpointer fault_addr, gboolean stack_ovf)
{
#if defined(MONO_ARCH_USE_SIGACTION)
MonoException *exc = NULL;
if (stack_ovf)
exc = mono_domain_get ()->stack_overflow_ex;
if (!ji)
- mono_handle_native_sigsegv (SIGSEGV, sigctx);
+ mono_handle_native_sigsegv (SIGSEGV, sigctx, siginfo);
/* setup a call frame on the real stack so that control is returned there
* and exception handling can continue.
/* Call the throw trampoline */
if (aot) {
- ji = mono_patch_info_list_prepend (ji, code - start, MONO_PATCH_INFO_JIT_ICALL_ADDR, "mono_amd64_throw_exception");
+ ji = mono_patch_info_list_prepend (ji, code - start, MONO_PATCH_INFO_JIT_ICALL_ADDR, "mono_throw_exception");
amd64_mov_reg_membase (code, AMD64_R11, AMD64_RIP, 0, 8);
} else {
throw_trampoline = mono_get_throw_exception ();
g_assert ((code - start) < kMaxCodeSize);
nacl_global_codeman_validate(&start, kMaxCodeSize, &code);
+ mono_arch_flush_icache (start, code - start);
+ mono_profiler_code_buffer_new (start, code - start, MONO_PROFILER_CODE_BUFFER_EXCEPTION_HANDLING, NULL);
if (info)
*info = mono_tramp_info_create ("throw_pending_exception", start, code - start, ji, unwind_ops);
* exception.
*/
void
-mono_arch_notify_pending_exc (void)
+mono_arch_notify_pending_exc (MonoThreadInfo *info)
{
MonoLMF *lmf = mono_get_lmf ();
+ if (!info) {
+ lmf = mono_get_lmf ();
+ } else {
+ g_assert (mono_thread_info_get_suspend_state (info)->valid);
+ lmf = mono_thread_info_get_suspend_state (info)->unwind_data [MONO_UNWIND_DATA_LMF];
+ }
+
if (!lmf)
/* Not yet started */
return;
g_assert ((code - start) <= kMaxCodeSize);
nacl_global_codeman_validate(&start, kMaxCodeSize, &code);
+ mono_arch_flush_icache (start, code - start);
+ mono_profiler_code_buffer_new (start, code - start, MONO_PROFILER_CODE_BUFFER_EXCEPTION_HANDLING, NULL);
saved = start;
return (MonoContinuationRestore)saved;