[Mono-dev] Patch: Stack alignment on x86
Mark Probst
mark.probst at gmail.com
Fri Oct 17 13:06:33 EDT 2008
Hi Zoltan,
> Looks good. Why is this part needed:
>
> + if (cfg->method->wrapper_type ==
> MONO_WRAPPER_NATIVE_TO_MANAGED ||
> + cfg->method->wrapper_type ==
> MONO_WRAPPER_RUNTIME_INVOKE) {
> + x86_pop_reg (code, X86_ESP);
> + }
>
> Those wrappers are never called from managed code.
They are entry points from unmanaged code to managed code, and since
we can't rely on stack alignment in unmanaged code we have to align
the stack in those entry points. What I do in those two wrappers is
to put stack alignment instructions around each call. This is the
part after the call which restores the stack pointer. The part that
goes before the call is in mono_arch_emit_call().
Mark
More information about the Mono-devel-list
mailing list