Hi All,

The attached patch fixes a crash when running a 64 bit build of Mono on
windows. I simply modified the code to conform to the calling convention
described here:
http://msdn.microsoft.com/en-us/library/ms235286%28v=vs.80%29.aspx

Regards,

Mark

This message and any attachments are solely for the intended recipient and may 
contain confidential or privileged information. If you are not the intended 
recipient, any disclosure, copying, use, or distribution of the information 
included in this message and any attachments is prohibited. If you have 
received this communication in error, please notify us by reply e-mail and 
immediately and permanently delete this message and any attachments. Thank you.
--- mono-2.10/mono/mini/exceptions-amd64.c
+++ mono-local/mono/mini/exceptions-amd64.c
@@ -414,13 +414,19 @@
        guint8 *code;
        MonoJumpInfo *ji = NULL;
        GSList *unwind_ops = NULL;
-       int i, stack_size, arg_offsets [16], regs_offset;
+       int i, stack_size, arg_offsets [16], regs_offset, dummy_stack_space;
        const guint kMaxCodeSize = NACL_SIZE (256, 512);
 
+#ifdef TARGET_WIN32
+       dummy_stack_space = 6 * sizeof(mgreg_t);        /* Windows expects 
stack space allocated for all 6 dummy args. */
+#else
+       dummy_stack_space = 0;
+#endif
+
        start = code = mono_global_codeman_reserve (kMaxCodeSize);
 
        /* The stack is unaligned on entry */
-       stack_size = 192 + 8;
+       stack_size = 192 + 8 + dummy_stack_space;
 
        code = start;
 
@@ -437,11 +443,11 @@
         * the stack by passing 6 dummy values in registers.
         */
 
-       arg_offsets [0] = 0;
-       arg_offsets [1] = sizeof(mgreg_t);
-       arg_offsets [2] = sizeof(mgreg_t) * 2;
-       arg_offsets [3] = sizeof(mgreg_t) * 3;
-       regs_offset = sizeof(mgreg_t) * 4;
+       arg_offsets [0] = dummy_stack_space + 0;
+       arg_offsets [1] = dummy_stack_space + sizeof(mgreg_t);
+       arg_offsets [2] = dummy_stack_space + sizeof(mgreg_t) * 2;
+       arg_offsets [3] = dummy_stack_space + sizeof(mgreg_t) * 3;
+       regs_offset = dummy_stack_space + sizeof(mgreg_t) * 4;
 
        /* Save registers */
        for (i = 0; i < AMD64_NREG; ++i)

_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to