[Mono-dev] [PATCH] Managed code abort trampoline

Rodrigo Kumpera kumpera at gmail.com
Tue May 20 17:16:49 EDT 2008


Hey,

The attached patch implements managed code thread abort by installing a
trampoline on signal return.

This patch introduces two new arch specific functions, that I'll port to arm
and amd64 once the current patch
is committed:

void mono_arch_set_ip_in_context (void *sigctx, void *new_ip) MONO_INTERNAL;
gpointer mono_arch_get_call_interrupt_trampoline (gpointer
process_interrup_function) MONO_INTERNAL;

The first one is used to hijack the managed code execution and call the
trampoline.
The second one fix the callstack, build a MonoContext and call
process_interrup_function. The trampoline
must allow to resume execution of the managed method as it could be inside a
protected wrapper.

I've moved this check out of the signal handler to reduce the amount of
signal safe code we need, which
improves reliability and gives us more freedom on the implementation.

This patch doesn't tackle mono_thread_request_interruption yet. The plan is
to split it into three parts:

-Managed code interrupt, called from the abort trampoline
-Alertable-wait wake up, called as part of Thread::Abort
-Unmanaged code interrupt, called from the signal handler - this should end
been just incrementing thread_interruption_requested.

This doesn't handle the windows situation, which is something I'll do next.

Thanks,
Rodrigo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080520/bf10c239/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: managed_code_thread_abort.diff
Type: text/x-patch
Size: 5142 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080520/bf10c239/attachment.bin 


More information about the Mono-devel-list mailing list