Thu Dec 20 20:13:07 CET 2001 Paolo Molaro <lupus@ximian.com>
authorPaolo Molaro <lupus@oddwiz.org>
Thu, 20 Dec 2001 15:20:42 +0000 (15:20 -0000)
committerPaolo Molaro <lupus@oddwiz.org>
Thu, 20 Dec 2001 15:20:42 +0000 (15:20 -0000)
* x86/tramp.c: fix create_method_pointer() to pass the arguments
correctly and add check for overflow.

svn path=/trunk/mono/; revision=1656

mono/arch/ChangeLog
mono/arch/x86/tramp.c

index 9e48bebc1c3e5e0dd4790a83e6523a89f9b84f97..ef76e0de35a66681a309e66996dfa76507fbb1f8 100644 (file)
@@ -1,4 +1,9 @@
 
+Thu Dec 20 20:13:07 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+       * x86/tramp.c: fix create_method_pointer() to pass the arguments
+       correctly and add check for overflow.
+
 Thu Dec 13 15:56:53 CET 2001 Paolo Molaro <lupus@ximian.com>
 
        * x86/x86-codegen.h: x86_mov_memindex_imm() added.
index ef34118e874f14a2d28608e10ff9c4cabe716cd0..aa2155d0eac59922ed5b21ab1a9e094847badcfb 100644 (file)
@@ -375,6 +375,8 @@ mono_create_method_pointer (MonoMethod *method)
         * arg_pos is the offset from EBP to the incoming arg on the stack.
         * We just call stackval_from_data to handle all the (nasty) issues....
         */
+       x86_lea_membase (p, X86_EAX, X86_EBP, stackval_pos);
+       x86_mov_membase_reg (p, X86_EBP, (MINV_POS + G_STRUCT_OFFSET (MonoInvocation, stack_args)), X86_EAX, 4);
        for (i = 0; i < sig->param_count; ++i) {
                x86_mov_reg_imm (p, X86_ECX, stackval_from_data);
                x86_lea_membase (p, X86_EDX, X86_EBP, arg_pos);
@@ -455,6 +457,7 @@ mono_create_method_pointer (MonoMethod *method)
        x86_leave (p);
        x86_ret (p);
 
+       g_assert (p - code_buffer < 512);
        return g_memdup (code_buffer, p - code_buffer);
 }