2002-11-28 Dietmar Maurer <dietmar@ximian.com>
authorDietmar Maurer <dietmar@mono-cvs.ximian.com>
Thu, 28 Nov 2002 10:02:07 +0000 (10:02 -0000)
committerDietmar Maurer <dietmar@mono-cvs.ximian.com>
Thu, 28 Nov 2002 10:02:07 +0000 (10:02 -0000)
* exception.c (x86_unwind_native_frame): support exceptions inside
native code using gcc generated exception tables (-fexception).

2002-11-19  Dietmar Maurer  <dietmar@ximian.com>

* exception.c: include some code from Zoltan Varga, but modified
it slightly.

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

25 files changed:
acconfig.h
configure.in
docs/exceptions
mono/jit/ChangeLog
mono/jit/exception.c
mono/jit/jit.c
mono/jit/jit.h
mono/jit/trampoline.c
mono/metadata/ChangeLog
mono/metadata/appdomain.c
mono/metadata/decimal.c
mono/metadata/exception.h
mono/metadata/file-io.c
mono/metadata/gc.c
mono/metadata/icall.c
mono/metadata/loader.c
mono/metadata/marshal.c
mono/metadata/object.c
mono/metadata/process.c
mono/metadata/reflection.c
mono/metadata/socket-io.c
mono/metadata/string-icalls.c
mono/metadata/sysmath.c
mono/metadata/threads.c
mono/metadata/unicode.c

index 05731dbde7d6be653a06a800c5757538abd6308f..b4b9baf2ccf161ae0b59c9b867f45dbb08245168 100644 (file)
@@ -19,3 +19,4 @@
 #undef MONO_SIZEOF_SUNPATH
 #undef NEED_LINK_UNLINK
 #undef PTHREAD_POINTER_ID
+#undef MONO_USE_EXC_TABLES
index a92b9f37df6afce23abb00f0cab8ccfc9e4d2a56..32fab6dadbb7628f21db0b48c99edbed3a110baa 100644 (file)
@@ -25,7 +25,8 @@ case "$host" in
                ;;
        *-*-linux*)
                platform_win32=no
-               CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT"
+               AC_DEFINE(MONO_USE_EXC_TABLES)
+               CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT -fexceptions"
                libdl="-ldl"
                ;;
        *-*-solaris*)
index 05f1be03bbaee7d31e0183410fd5d3d79e151d1d..e98202cf07b228750482d63e7df968d3cd6a4f2f 100644 (file)
@@ -68,3 +68,41 @@ code.
 
 catch handler: receives the exception object in ECX. They store that
 object into a local variable, so that rethrow can access the object.
+
+
+gcc support for Exceptions
+==========================
+
+gcc supports exceptions in files compiled with the -fexception option. gcc
+generates DWARF exceptions tables in that case, so it is possible to unwind the
+stack. The method to read those exception tables is contained in libgcc.a, and
+in newer versions of glibc (glibc 2.2.5 for example), and it is called
+__frame_state_for(). Another usable glibc function is backtrace_symbols() which
+returns the function name corresponding to a code address.
+
+We dynamically check if those features are available using g_module_symbol(),
+and we use them only when available. If not available we use the LMF as
+fallback.
+
+Using gcc exception information prevents us from saving the LMF at each native
+call, so this is a way to speed up native calls. This is especially valuable
+for internal calls, because we can make sure that all internal calls are
+compiled with -fexceptions (we compile the whole mono runtime with that
+option).
+
+All native function are able to call function without exception tables, and so
+we are unable to restore all caller saved registers if an exception is raised
+in such function. Well, its possible if the previous function already saves all
+registers. So we only omit the the LMF if a function has an exception table
+able to restore all caller saved registers.
+
+One problem is that gcc almost never saves all caller saved registers, because
+it is just unnecessary in normal situations. But there is a trick forcing gcc
+to save all register, we just need to call __builtin_unwind_init() at the
+beginning of a function. That way gcc generates code to save all caller saved
+register on the stack.
+
+
+
+
\ No newline at end of file
index 69b71ff7fba9a24498fb3c2d1ecbe3804c9c0553..4e9636827e3814494a61cd3b47aa565d85395693 100644 (file)
@@ -1,3 +1,13 @@
+2002-11-28  Dietmar Maurer  <dietmar@ximian.com>
+
+       * exception.c (x86_unwind_native_frame): support exceptions inside
+       native code using gcc generated exception tables (-fexception).
+
+2002-11-19  Dietmar Maurer  <dietmar@ximian.com>
+
+       * exception.c: include some code from Zoltan Varga, but modified
+       it slightly.
+
 2002-11-27  Dietmar Maurer  <dietmar@ximian.com>
 
        * exception.c: massive code cleanups. The code is still
index 99a56d597a7c692a93a676174e12572cb6e49ae3..73aa049705349cc6eb3c69754ea4194a7462335b 100644 (file)
@@ -52,6 +52,271 @@ typedef struct sigcontext MonoContext;
 #define MONO_CONTEXT_GET_IP(ctx) ((gpointer)((ctx)->SC_EIP))
 #define MONO_CONTEXT_GET_BP(ctx) ((gpointer)((ctx)->SC_EBP))
 
+#ifdef MONO_USE_EXC_TABLES
+
+/*************************************/
+/*    STACK UNWINDING STUFF          */
+/*************************************/
+
+/* These definitions are from unwind-dw2.c in glibc 2.2.5 */
+
+/* For x86 */
+#define DWARF_FRAME_REGISTERS 17
+
+typedef struct frame_state
+{
+  void *cfa;
+  void *eh_ptr;
+  long cfa_offset;
+  long args_size;
+  long reg_or_offset[DWARF_FRAME_REGISTERS+1];
+  unsigned short cfa_reg;
+  unsigned short retaddr_column;
+  char saved[DWARF_FRAME_REGISTERS+1];
+} frame_state;
+
+static long
+get_sigcontext_reg (struct sigcontext *ctx, int dwarf_regnum)
+{
+       switch (dwarf_regnum) {
+       case X86_EAX:
+               return ctx->eax;
+       case X86_EBX:
+               return ctx->ebx;
+       case X86_ECX:
+               return ctx->ecx;
+       case X86_EDX:
+               return ctx->edx;
+       case X86_ESI:
+               return ctx->esi;
+       case X86_EDI:
+               return ctx->edi;
+       case X86_EBP:
+               return ctx->ebp;
+       case X86_ESP:
+               return ctx->esp;
+       default:
+               g_assert_not_reached ();
+       }
+
+       return 0;
+}
+
+static void
+set_sigcontext_reg (struct sigcontext *ctx, int dwarf_regnum, long value)
+{
+       switch (dwarf_regnum) {
+       case X86_EAX:
+               ctx->eax = value;
+               break;
+       case X86_EBX:
+               ctx->ebx = value;
+               break;
+       case X86_ECX:
+               ctx->ecx = value;
+               break;
+       case X86_EDX:
+               ctx->edx = value;
+               break;
+       case X86_ESI:
+               ctx->esi = value;
+               break;
+       case X86_EDI:
+               ctx->edi = value;
+               break;
+       case X86_EBP:
+               ctx->ebp = value;
+               break;
+       case X86_ESP:
+               ctx->esp = value;
+               break;
+       case 8:
+               ctx->eip = value;
+               break;
+       default:
+               g_assert_not_reached ();
+       }
+}
+
+typedef struct frame_state * (*framesf) (void *, struct frame_state *);
+
+static framesf frame_state_for = NULL;
+
+static gboolean inited = FALSE;
+
+typedef char ** (*get_backtrace_symbols_type) (void *__const *__array, int __size);
+
+static get_backtrace_symbols_type get_backtrace_symbols = NULL;
+
+static void
+init_frame_state_for (void)
+{
+       GModule *module;
+
+       /*
+        * There are two versions of __frame_state_for: one in libgcc.a and the
+        * other in glibc.so. We need the version from glibc.
+        * For more info, see this:
+        * http://gcc.gnu.org/ml/gcc/2002-08/msg00192.html
+        */
+       if ((module = g_module_open ("libc.so.6", G_MODULE_BIND_LAZY))) {
+       
+               if (!g_module_symbol (module, "__frame_state_for", (gpointer*)&frame_state_for))
+                       frame_state_for = NULL;
+
+               if (!g_module_symbol (module, "backtrace_symbols", (gpointer*)&get_backtrace_symbols)) {
+                       get_backtrace_symbols = NULL;
+                       frame_state_for = NULL;
+               }
+
+               g_module_close (module);
+       }
+
+       inited = TRUE;
+}
+
+/* mono_has_unwind_info:
+ *
+ * Tests if a function has an DWARF exception table able to restore
+ * all caller saved registers. 
+ */
+gboolean
+mono_has_unwind_info (MonoMethod *method)
+{
+       struct frame_state state_in;
+       struct frame_state *res;
+
+       if (!inited) 
+               init_frame_state_for ();
+       
+       if (!frame_state_for)
+               return FALSE;
+
+       g_assert (method->addr);
+
+       memset (&state_in, 0, sizeof (state_in));
+
+       /* offset 10 is just a guess, but it works for all methods tested */
+       if ((res = frame_state_for ((char *)method->addr + 10, &state_in))) {
+
+               if (res->saved [X86_EBX] != 1 ||
+                   res->saved [X86_EDI] != 1 ||
+                   res->saved [X86_EBP] != 1 ||
+                   res->saved [X86_ESI] != 1) {
+                       return FALSE;
+               }
+               return TRUE;
+       } else 
+               return FALSE;
+}
+
+struct stack_frame
+{
+  void *next;
+  void *return_address;
+};
+
+static MonoJitInfo *
+x86_unwind_native_frame (MonoDomain *domain, MonoJitTlsData *jit_tls, struct sigcontext *ctx, 
+                        struct sigcontext *new_ctx, MonoLMF *lmf, char **trace)
+{
+       struct stack_frame *frame;
+       gpointer max_stack;
+       MonoJitInfo *ji;
+       struct frame_state state_in;
+       struct frame_state *res;
+
+       if (trace)
+               *trace = NULL;
+
+       if (!inited) 
+               init_frame_state_for ();
+
+       if (!frame_state_for)
+               return FALSE;
+
+       frame = MONO_CONTEXT_GET_BP (ctx);
+
+       max_stack = lmf ? lmf : jit_tls->end_of_stack;
+
+       *new_ctx = *ctx;
+
+       memset (&state_in, 0, sizeof (state_in));
+
+       while ((gpointer)frame->next < (gpointer)max_stack) {
+               gpointer ip, addr = frame->return_address;
+               void *cfa;
+               char *tmp, **symbols;
+
+               if (trace) {
+                       ip = MONO_CONTEXT_GET_IP (new_ctx);
+                       symbols = get_backtrace_symbols (&ip, 1);
+                       if (*trace)
+                               tmp = g_strdup_printf ("%s\nin (unmanaged) %s", *trace, symbols [0]);
+                       else
+                               tmp = g_strdup_printf ("in (unmanaged) %s", symbols [0]);
+
+                       free (symbols);
+                       g_free (*trace);
+                       *trace = tmp;
+               }
+
+               if ((res = frame_state_for (addr, &state_in))) {        
+                       int i;
+
+                       cfa = (gint8*) (get_sigcontext_reg (new_ctx, res->cfa_reg) + res->cfa_offset);
+                       frame = (struct stack_frame *)((gint8*)cfa - 8);
+                       for (i = 0; i < DWARF_FRAME_REGISTERS + 1; i++) {
+                               int how = res->saved[i];
+                               long val;
+                               g_assert ((how == 0) || (how == 1));
+                       
+                               if (how == 1) {
+                                       val = * (long*) ((gint8*)cfa + res->reg_or_offset[i]);
+                                       set_sigcontext_reg (new_ctx, i, val);
+                               }
+                       }
+                       new_ctx->esp = (long)cfa;
+
+                       if (res->saved [X86_EBX] == 1 &&
+                           res->saved [X86_EDI] == 1 &&
+                           res->saved [X86_EBP] == 1 &&
+                           res->saved [X86_ESI] == 1 &&
+                           (ji = mono_jit_info_table_find (domain, frame->return_address))) {
+                               //printf ("FRAME CFA %s\n", mono_method_full_name (ji->method, TRUE));
+                               return ji;
+                       }
+
+               } else {
+                       //printf ("FRAME %p %p %p\n", frame, MONO_CONTEXT_GET_IP (new_ctx), mono_jit_info_table_find (domain, MONO_CONTEXT_GET_IP (new_ctx)));
+
+                       MONO_CONTEXT_SET_IP (new_ctx, frame->return_address);
+                       frame = frame->next;
+                       MONO_CONTEXT_SET_BP (new_ctx, frame);
+
+                       /* stop if we detect an unexpected managed frame */
+                       if (mono_jit_info_table_find (domain, frame->return_address)) {
+                               if (trace) {
+                                       g_free (*trace);
+                                       *trace = NULL;
+                               }
+                               return NULL;
+                       }
+               }
+       }
+
+       if (!lmf)
+               g_assert_not_reached ();
+
+       if (trace) {
+               g_free (*trace);
+               *trace = NULL;
+       }
+       return NULL;
+}
+
+#endif
+
 /*
  * arch_get_restore_context:
  *
@@ -310,13 +575,13 @@ mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls, MonoContex
        if (native_offset)
                *native_offset = -1;
 
-       *new_ctx = *ctx;
-
        if (ji != NULL) {
                char *source_location, *tmpaddr, *fname;
                gint32 address, iloffset;
                int offset;
 
+               *new_ctx = *ctx;
+
                if (*lmf && (MONO_CONTEXT_GET_BP (ctx) >= (gpointer)(*lmf)->ebp)) {
                        /* remove any unused lmf */
                        *lmf = (*lmf)->previous_lmf;
@@ -371,9 +636,14 @@ mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls, MonoContex
                new_ctx->SC_EBP = *((int *)ctx->SC_EBP);
 
                return ji;
-
+#ifdef MONO_USE_EXC_TABLES
+       } else if ((ji = x86_unwind_native_frame (domain, jit_tls, ctx, new_ctx, *lmf, trace))) {
+               return ji;
+#endif
        } else if (*lmf) {
                
+               *new_ctx = *ctx;
+
                if (trace)
                        *trace = g_strdup_printf ("in (unmanaged) %s", mono_method_full_name ((*lmf)->method, TRUE));
                
@@ -393,13 +663,9 @@ mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls, MonoContex
 
                return ji;
                
-       } else {
-               /* no lmf available - usually a serious error? */
-               new_ctx->SC_EBP = (unsigned long)jit_tls->end_of_stack;
-               return NULL;
        }
 
-       g_assert_not_reached ();
+       return NULL;
 }
 
 MonoArray *
@@ -565,7 +831,10 @@ arch_handle_exception (MonoContext *ctx, gpointer obj, gboolean test_only)
                
                ji = mono_arch_find_jit_info (domain, jit_tls, ctx, &new_ctx, 
                                              test_only ? &trace : NULL, &lmf, NULL);
-               g_assert (ji);
+               if (!ji) {
+                       g_warning ("Exception insinde function without unwind info");
+                       g_assert_not_reached ();
+               }
 
                if (ji->method != mono_start_method) {
                        
index 95f40e527e4befda2b3d6baa36317bcf13870d49..a63f17aa52bab7456b215d12521fbfb4b386f09a 100644 (file)
@@ -302,6 +302,7 @@ mono_jit_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObjec
 {
        MonoMethod *invoke;
        MonoObject *(*runtime_invoke) (MonoObject *this, void **params, MonoObject **exc);
+
        invoke = mono_marshal_get_runtime_invoke (method);
        runtime_invoke = mono_compile_method (invoke);       
        return runtime_invoke (obj, params, exc);
@@ -812,6 +813,8 @@ mono_analyze_flow (MonoFlowGraph *cfg)
 static gpointer 
 ves_array_element_address (MonoArray *this, ...)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoClass *class;
        va_list ap;
        int i, ind, esize;
@@ -3727,6 +3730,68 @@ mono_get_runtime_method (MonoMethod* method)
        return NULL;
 }
 
+#ifdef MONO_USE_EXC_TABLES
+static gboolean
+mono_type_blittable (MonoType *type)
+{
+       if (type->byref)
+               return FALSE;
+
+       switch (type->type){
+       case MONO_TYPE_VOID:
+       case MONO_TYPE_I1:
+       case MONO_TYPE_U1:
+       case MONO_TYPE_I2:
+       case MONO_TYPE_U2:
+       case MONO_TYPE_I4:
+       case MONO_TYPE_U4:
+       case MONO_TYPE_I8:
+       case MONO_TYPE_U8:
+       case MONO_TYPE_R4:
+       case MONO_TYPE_R8:
+       case MONO_TYPE_I:
+       case MONO_TYPE_U:
+               return TRUE;
+       case MONO_TYPE_VALUETYPE:
+       case MONO_TYPE_CLASS:
+               return type->data.klass->blittable;
+               break;
+       default:
+               break;
+       }
+
+       return FALSE;
+}
+
+gboolean
+mono_method_blittable (MonoMethod *method)
+{
+       MonoMethodSignature *sig;
+       int i;
+
+       if (!method->addr)
+               return FALSE;
+
+       if (!mono_has_unwind_info (method)) {
+               return FALSE;
+       }
+
+       if (method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL)
+               return TRUE;
+
+       sig = method->signature;
+
+       if (!mono_type_blittable (sig->ret))
+               return FALSE;
+
+       for (i = 0; i < sig->param_count; i++)
+               if (!mono_type_blittable (sig->params [i]))
+                       return FALSE;
+
+       return TRUE;
+}
+#endif
+
 /**
  * mono_compile_method:
  * @method: pointer to the method info
@@ -3748,9 +3813,19 @@ mono_jit_compile_method (MonoMethod *method)
 
                if (!method->info) {
                        MonoMethod *nm;
-    
-                       nm = mono_marshal_get_native_wrapper (method);
-                       method->info = mono_compile_method (nm);
+
+                       if (!method->addr && (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL))
+                               mono_lookup_pinvoke_call (method);
+#ifdef MONO_USE_EXC_TABLES
+                       if (mono_method_blittable (method)) {
+                               method->info = method->addr;
+                       } else {
+#endif
+                               nm = mono_marshal_get_native_wrapper (method);
+                               method->info = mono_compile_method (nm);
+#ifdef MONO_USE_EXC_TABLES
+                       }
+#endif
                }
                return method->info;
        }
index cae767b0a3584099240bdbb0cee01de61f9432e0..397f3f705209a3ced5158db4066d2f47a8eb7e82 100644 (file)
@@ -320,4 +320,10 @@ arch_get_reg_name          (int regnum);
 int 
 arch_activation_frame_size (MonoMethodSignature *sig);
 
+gboolean
+mono_has_unwind_info       (MonoMethod *method);
+
+gboolean
+mono_method_blittable      (MonoMethod *method);
+
 #endif
index 6e987ddd4d7a050f7667fc38af887b767356ba81..16873e2e5850fbea48d0412f86745f530ca3f805 100644 (file)
@@ -228,8 +228,19 @@ arch_create_jit_trampoline (MonoMethod *method)
            (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL)) {
                MonoMethod *nm;
                
-               nm = mono_marshal_get_native_wrapper (method);
-               method->info = mono_compile_method (nm);
+               if (!method->addr && (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL))
+                       mono_lookup_pinvoke_call (method);
+
+#ifdef MONO_USE_EXC_TABLES
+               if (mono_method_blittable (method)) {
+                       method->info = method->addr;
+               } else {
+#endif
+                       nm = mono_marshal_get_native_wrapper (method);
+                       method->info = mono_compile_method (nm);
+#ifdef MONO_USE_EXC_TABLES
+               }
+#endif
                return method->info;
        }
 
index 8987baf0155cbdd4f96f71f581bd931639cc849f..832f9d4c731cad3b60a9e5299b687817109bf561 100644 (file)
@@ -1,3 +1,7 @@
+2002-11-28  Dietmar Maurer  <dietmar@ximian.com>
+
+       * loader.c (mono_get_method): set signature->pinvoke for native calls
+
 2002-11-20  Dick Porter  <dick@ximian.com>
 
        * threads.c (mono_thread_init): Set the main thread's handle
index bd6596276d913b893fc2e07093383c0a1d506040..1a018e6d5a3b5ed1e44dc3036c999f72547e2b60 100644 (file)
@@ -89,6 +89,8 @@ mono_runtime_cleanup (MonoDomain *domain)
 void
 ves_icall_System_AppDomainSetup_InitAppDomainSetup (MonoAppDomainSetup *setup)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain* domain = mono_domain_get ();
        MonoAssembly *assembly;
        gchar *str;
@@ -413,6 +415,8 @@ mono_domain_transfer_object (MonoDomain *src, MonoDomain *dst, MonoObject *obj)
 MonoObject *
 ves_icall_System_AppDomain_GetData (MonoAppDomain *ad, MonoString *name)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *add = ad->data;
        MonoDomain *cur = mono_domain_get ();
        MonoObject *o;
@@ -457,6 +461,8 @@ ves_icall_System_AppDomain_GetData (MonoAppDomain *ad, MonoString *name)
 void
 ves_icall_System_AppDomain_SetData (MonoAppDomain *ad, MonoString *name, MonoObject *data)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *add = ad->data;
        MonoDomain *cur = mono_domain_get ();
        MonoObject *o;
@@ -475,6 +481,8 @@ ves_icall_System_AppDomain_SetData (MonoAppDomain *ad, MonoString *name, MonoObj
 MonoAppDomainSetup *
 ves_icall_System_AppDomain_getSetup (MonoAppDomain *ad)
 {
+       MONO_ARCH_SAVE_REGS;
+
        g_assert (ad != NULL);
        g_assert (ad->data != NULL);
 
@@ -484,6 +492,8 @@ ves_icall_System_AppDomain_getSetup (MonoAppDomain *ad)
 MonoString *
 ves_icall_System_AppDomain_getFriendlyName (MonoAppDomain *ad)
 {
+       MONO_ARCH_SAVE_REGS;
+
        g_assert (ad != NULL);
        g_assert (ad->data != NULL);
 
@@ -493,6 +503,8 @@ ves_icall_System_AppDomain_getFriendlyName (MonoAppDomain *ad)
 MonoAppDomain *
 ves_icall_System_AppDomain_getCurDomain ()
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *add = mono_domain_get ();
        return add->domain;
 }
@@ -500,6 +512,8 @@ ves_icall_System_AppDomain_getCurDomain ()
 MonoAppDomain *
 ves_icall_System_AppDomain_createDomain (MonoString *friendly_name, MonoAppDomainSetup *setup)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain = mono_domain_get (); 
        MonoClass *adclass;
        MonoAppDomain *ad;
@@ -536,6 +550,8 @@ add_assembly (gpointer key, gpointer value, gpointer user_data)
 MonoArray *
 ves_icall_System_AppDomain_GetAssemblies (MonoAppDomain *ad)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain = ad->data; 
        static MonoClass *System_Reflection_Assembly;
        MonoArray *res;
@@ -643,6 +659,8 @@ mono_domain_fire_assembly_load (MonoAssembly *assembly, gpointer user_data)
 MonoReflectionAssembly *
 ves_icall_System_Reflection_Assembly_LoadFrom (MonoString *fname)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain = mono_domain_get ();
        char *name, *filename;
        MonoImageOpenStatus status = MONO_IMAGE_OK;
@@ -670,6 +688,8 @@ ves_icall_System_Reflection_Assembly_LoadFrom (MonoString *fname)
 MonoReflectionAssembly *
 ves_icall_System_AppDomain_LoadAssembly (MonoAppDomain *ad,  MonoReflectionAssemblyName *assRef, MonoObject *evidence)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain = ad->data; 
        char *name;
        MonoImageOpenStatus status = MONO_IMAGE_OK;
@@ -707,6 +727,8 @@ ves_icall_System_AppDomain_LoadAssembly (MonoAppDomain *ad,  MonoReflectionAssem
 void
 ves_icall_System_AppDomain_Unload (MonoAppDomain *ad)
 {
+       MONO_ARCH_SAVE_REGS;
+
        mono_domain_unload (ad->data, FALSE);
 }
 
@@ -714,6 +736,8 @@ gint32
 ves_icall_System_AppDomain_ExecuteAssembly (MonoAppDomain *ad, MonoString *file, 
                                            MonoObject *evidence, MonoArray *args)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *cdom = mono_domain_get ();
        MonoAssembly *assembly;
        MonoImage *image;
index a2bd4b28fd5eae38809cf8315c0add10f8ae632b..e9e17cbcf5afb558c4cc9eb87d878fd50fe1053b 100644 (file)
@@ -13,6 +13,7 @@
  * CSharp value type System.Decimal
  */
 
+#include <mono/metadata/exception.h>
 #include <stdio.h>
 #include <memory.h>
 #include <stdlib.h>
@@ -736,6 +737,8 @@ DECINLINE static int rescale128(guint64* pclo, guint64* pchi, int* pScale, int t
 /* performs a += b */
 gint32 mono_decimalIncr(/*[In, Out]*/decimal_repr* pA, /*[In]*/decimal_repr* pB)
 {
+    MONO_ARCH_SAVE_REGS;
+
     guint64 alo, ahi, blo, bhi;
     int log2A, log2B, log2Result, log10Result, rc;
     int subFlag, sign, scaleA, scaleB;
@@ -1048,6 +1051,8 @@ gint32 mono_string2decimal(/*[Out]*/decimal_repr* pA, MonoString* str, gint32 de
 gint32 mono_decimal2string(/*[In]*/decimal_repr* pA, gint32 digits, gint32 decimals,
                                    MonoArray* pArray, gint32 bufSize, gint32* pDecPos, gint32* pSign)
 {
+    MONO_ARCH_SAVE_REGS;
+
     guint16 tmp[41];
     guint16 *buf = (guint16*) mono_array_addr(pArray, guint16, 0);
     guint16 *q, *p = tmp;
@@ -1142,6 +1147,8 @@ gint32 mono_decimal2string(/*[In]*/decimal_repr* pA, gint32 digits, gint32 decim
  */
 gint32 mono_decimal2UInt64(/*[In]*/decimal_repr* pA, guint64* pResult)
 {
+    MONO_ARCH_SAVE_REGS;
+
     guint64 alo, ahi;
     int scale;
 
@@ -1163,6 +1170,8 @@ gint32 mono_decimal2UInt64(/*[In]*/decimal_repr* pA, guint64* pResult)
  */
 gint32 mono_decimal2Int64(/*[In]*/decimal_repr* pA, gint64* pResult)
 {
+    MONO_ARCH_SAVE_REGS;
+
     guint64 alo, ahi;
     int sign, scale;
 
@@ -1188,6 +1197,8 @@ gint32 mono_decimal2Int64(/*[In]*/decimal_repr* pA, gint64* pResult)
 
 void mono_decimalFloorAndTrunc(/*[In, Out]*/decimal_repr* pA, gint32 floorFlag)
 {
+    MONO_ARCH_SAVE_REGS;
+
     guint64 alo, ahi;
     guint32 factor, rest;
     int scale, sign, idx;
@@ -1216,6 +1227,8 @@ void mono_decimalFloorAndTrunc(/*[In, Out]*/decimal_repr* pA, gint32 floorFlag)
 
 void mono_decimalRound(/*[In, Out]*/decimal_repr* pA, gint32 decimals)
 {
+    MONO_ARCH_SAVE_REGS;
+
     guint64 alo, ahi;
     int scale, sign;
 
@@ -1232,6 +1245,8 @@ void mono_decimalRound(/*[In, Out]*/decimal_repr* pA, gint32 decimals)
 
 gint32 mono_decimalMult(/*[In, Out]*/decimal_repr* pA, /*[In]*/decimal_repr* pB)
 {
+    MONO_ARCH_SAVE_REGS;
+
     guint64 low, mid, high;
     guint32 factor;
     int scale, sign, rc;
@@ -1330,6 +1345,8 @@ static int decimalDivSub(/*[In]*/decimal_repr* pA, /*[In]*/decimal_repr* pB,
 
 gint32 mono_decimalDiv(/*[Out]*/decimal_repr* pC, /*[In]*/decimal_repr* pA, /*[In]*/decimal_repr* pB)
 {
+    MONO_ARCH_SAVE_REGS;
+
     guint64 clo, chi; /* result */
     int scale, texp, rc;
 
@@ -1351,6 +1368,8 @@ gint32 mono_decimalDiv(/*[Out]*/decimal_repr* pC, /*[In]*/decimal_repr* pA, /*[I
 
 gint32 mono_decimalIntDiv(/*[Out]*/decimal_repr* pC, /*[In]*/decimal_repr* pA, /*[In]*/decimal_repr* pB)
 {
+    MONO_ARCH_SAVE_REGS;
+
     guint64 clo, chi; /* result */
     int scale, texp, rc;
 
@@ -1395,6 +1414,8 @@ DECINLINE static int decimalIsZero(/*[In]*/decimal_repr* pA)
 
 gint32 mono_decimalCompare(/*[In]*/decimal_repr* pA, /*[In]*/decimal_repr* pB)
 {
+    MONO_ARCH_SAVE_REGS;
+
     int log2a, log2b, delta, sign;
     decimal_repr aa;
 
@@ -1433,6 +1454,8 @@ DECINLINE static void buildIEEE754Double(double* pd, int sign, int texp, guint64
 
 double mono_decimal2double(/*[In]*/decimal_repr* pA)
 {
+    MONO_ARCH_SAVE_REGS;
+
     double d;
     guint64 alo, ahi, mantisse;
     guint32 overhang, factor, roundBits;
@@ -1499,6 +1522,8 @@ double mono_decimal2double(/*[In]*/decimal_repr* pA)
 /* a *= 10^exp */
 gint32 mono_decimalSetExponent(/*[In, Out]*/decimal_repr* pA, gint32 texp)
 {
+    MONO_ARCH_SAVE_REGS;
+
     guint64 alo, ahi;
     int rc;
     int scale = pA->signscale.scale;
index 76c3d48dfb81979378e2a337f116d744db19f083..0fd0619d447527d08ae4c6e5900d1b4cff0c7e21 100644 (file)
@@ -1,6 +1,14 @@
 #ifndef _MONO_METADATA_EXCEPTION_H_
 #define _MONO_METADATA_EXCEPTION_H_
 
+#include <config.h>
+
+#ifdef MONO_USE_EXC_TABLES
+#define MONO_ARCH_SAVE_REGS __builtin_unwind_init ()
+#else
+#define MONO_ARCH_SAVE_REGS 
+#endif
+
 #include <mono/metadata/object.h>
 #include <mono/metadata/image.h>
 
index 0322c316c300cdd90b277205f71c08390726f60e..220d81b7bcbc49ebc2c7427f74b5048a34f91c53 100644 (file)
@@ -182,6 +182,8 @@ static void convert_win32_file_attribute_data (const WIN32_FILE_ATTRIBUTE_DATA *
 MonoBoolean
 ves_icall_System_IO_MonoIO_CreateDirectory (MonoString *path, gint32 *error)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gboolean ret;
        
        *error=ERROR_SUCCESS;
@@ -197,6 +199,8 @@ ves_icall_System_IO_MonoIO_CreateDirectory (MonoString *path, gint32 *error)
 MonoBoolean
 ves_icall_System_IO_MonoIO_RemoveDirectory (MonoString *path, gint32 *error)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gboolean ret;
        
        *error=ERROR_SUCCESS;
@@ -213,6 +217,8 @@ HANDLE
 ves_icall_System_IO_MonoIO_FindFirstFile (MonoString *path, MonoIOStat *stat,
                                          gint32 *error)
 {
+       MONO_ARCH_SAVE_REGS;
+
        WIN32_FIND_DATA data;
        HANDLE result;
 
@@ -236,6 +242,8 @@ MonoBoolean
 ves_icall_System_IO_MonoIO_FindNextFile (HANDLE find, MonoIOStat *stat,
                                         gint32 *error)
 {
+       MONO_ARCH_SAVE_REGS;
+
        WIN32_FIND_DATA data;
        gboolean result;
 
@@ -255,6 +263,8 @@ ves_icall_System_IO_MonoIO_FindNextFile (HANDLE find, MonoIOStat *stat,
 MonoBoolean
 ves_icall_System_IO_MonoIO_FindClose (HANDLE find, gint32 *error)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gboolean ret;
        
        *error=ERROR_SUCCESS;
@@ -270,6 +280,8 @@ ves_icall_System_IO_MonoIO_FindClose (HANDLE find, gint32 *error)
 MonoString *
 ves_icall_System_IO_MonoIO_GetCurrentDirectory (gint32 *error)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoString *result;
        gunichar2 *buf;
        int len;
@@ -298,6 +310,8 @@ MonoBoolean
 ves_icall_System_IO_MonoIO_SetCurrentDirectory (MonoString *path,
                                                gint32 *error)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gboolean ret;
        
        *error=ERROR_SUCCESS;
@@ -314,6 +328,8 @@ MonoBoolean
 ves_icall_System_IO_MonoIO_MoveFile (MonoString *path, MonoString *dest,
                                     gint32 *error)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gboolean ret;
        
        *error=ERROR_SUCCESS;
@@ -330,6 +346,8 @@ MonoBoolean
 ves_icall_System_IO_MonoIO_CopyFile (MonoString *path, MonoString *dest,
                                     MonoBoolean overwrite, gint32 *error)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gboolean ret;
        
        *error=ERROR_SUCCESS;
@@ -345,6 +363,8 @@ ves_icall_System_IO_MonoIO_CopyFile (MonoString *path, MonoString *dest,
 MonoBoolean
 ves_icall_System_IO_MonoIO_DeleteFile (MonoString *path, gint32 *error)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gboolean ret;
        
        *error=ERROR_SUCCESS;
@@ -360,6 +380,8 @@ ves_icall_System_IO_MonoIO_DeleteFile (MonoString *path, gint32 *error)
 gint32 
 ves_icall_System_IO_MonoIO_GetFileAttributes (MonoString *path, gint32 *error)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gint32 ret;
        
        *error=ERROR_SUCCESS;
@@ -376,6 +398,8 @@ MonoBoolean
 ves_icall_System_IO_MonoIO_SetFileAttributes (MonoString *path, gint32 attrs,
                                              gint32 *error)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gboolean ret;
        
        *error=ERROR_SUCCESS;
@@ -391,6 +415,8 @@ ves_icall_System_IO_MonoIO_SetFileAttributes (MonoString *path, gint32 attrs,
 gint32
 ves_icall_System_IO_MonoIO_GetFileType (HANDLE handle, gint32 *error)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gboolean ret;
        
        *error=ERROR_SUCCESS;
@@ -410,6 +436,8 @@ MonoBoolean
 ves_icall_System_IO_MonoIO_GetFileStat (MonoString *path, MonoIOStat *stat,
                                        gint32 *error)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gboolean result;
        WIN32_FILE_ATTRIBUTE_DATA data;
 
@@ -433,6 +461,8 @@ ves_icall_System_IO_MonoIO_Open (MonoString *filename, gint32 mode,
                                 gint32 access_mode, gint32 share,
                                 gint32 *error)
 {
+       MONO_ARCH_SAVE_REGS;
+
        HANDLE ret;
        
        *error=ERROR_SUCCESS;
@@ -451,6 +481,8 @@ ves_icall_System_IO_MonoIO_Open (MonoString *filename, gint32 mode,
 MonoBoolean
 ves_icall_System_IO_MonoIO_Close (HANDLE handle, gint32 *error)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gboolean ret;
        
        *error=ERROR_SUCCESS;
@@ -468,6 +500,8 @@ ves_icall_System_IO_MonoIO_Read (HANDLE handle, MonoArray *dest,
                                 gint32 dest_offset, gint32 count,
                                 gint32 *error)
 {
+       MONO_ARCH_SAVE_REGS;
+
        guchar *buffer;
        gboolean result;
        guint32 n;
@@ -493,6 +527,8 @@ ves_icall_System_IO_MonoIO_Write (HANDLE handle, MonoArray *src,
                                  gint32 src_offset, gint32 count,
                                  gint32 *error)
 {
+       MONO_ARCH_SAVE_REGS;
+
        guchar *buffer;
        gboolean result;
        guint32 n;
@@ -517,6 +553,8 @@ gint64
 ves_icall_System_IO_MonoIO_Seek (HANDLE handle, gint64 offset, gint32 origin,
                                 gint32 *error)
 {
+       MONO_ARCH_SAVE_REGS;
+
        guint32 offset_hi;
 
        *error=ERROR_SUCCESS;
@@ -535,6 +573,8 @@ ves_icall_System_IO_MonoIO_Seek (HANDLE handle, gint64 offset, gint32 origin,
 MonoBoolean
 ves_icall_System_IO_MonoIO_Flush (HANDLE handle, gint32 *error)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gboolean ret;
        
        *error=ERROR_SUCCESS;
@@ -550,6 +590,8 @@ ves_icall_System_IO_MonoIO_Flush (HANDLE handle, gint32 *error)
 gint64 
 ves_icall_System_IO_MonoIO_GetLength (HANDLE handle, gint32 *error)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gint64 length;
        guint32 length_hi;
 
@@ -567,6 +609,8 @@ MonoBoolean
 ves_icall_System_IO_MonoIO_SetLength (HANDLE handle, gint64 length,
                                      gint32 *error)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gint64 offset, offset_set;
        gint32 offset_hi;
        gint32 length_hi;
@@ -616,6 +660,8 @@ ves_icall_System_IO_MonoIO_SetFileTime (HANDLE handle, gint64 creation_time,
                                        gint64 last_access_time,
                                        gint64 last_write_time, gint32 *error)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gboolean ret;
        const FILETIME *creation_filetime;
        const FILETIME *last_access_filetime;
@@ -649,18 +695,24 @@ ves_icall_System_IO_MonoIO_SetFileTime (HANDLE handle, gint64 creation_time,
 HANDLE 
 ves_icall_System_IO_MonoIO_get_ConsoleOutput ()
 {
+       MONO_ARCH_SAVE_REGS;
+
        return GetStdHandle (STD_OUTPUT_HANDLE);
 }
 
 HANDLE 
 ves_icall_System_IO_MonoIO_get_ConsoleInput ()
 {
+       MONO_ARCH_SAVE_REGS;
+
        return GetStdHandle (STD_INPUT_HANDLE);
 }
 
 HANDLE 
 ves_icall_System_IO_MonoIO_get_ConsoleError ()
 {
+       MONO_ARCH_SAVE_REGS;
+
        return GetStdHandle (STD_ERROR_HANDLE);
 }
 
@@ -668,6 +720,8 @@ MonoBoolean
 ves_icall_System_IO_MonoIO_CreatePipe (HANDLE *read_handle,
                                       HANDLE *write_handle)
 {
+       MONO_ARCH_SAVE_REGS;
+
        SECURITY_ATTRIBUTES attr;
        gboolean ret;
        
@@ -687,6 +741,8 @@ ves_icall_System_IO_MonoIO_CreatePipe (HANDLE *read_handle,
 gunichar2 
 ves_icall_System_IO_MonoIO_get_VolumeSeparatorChar ()
 {
+       MONO_ARCH_SAVE_REGS;
+
 #if defined (PLATFORM_WIN32)
        return (gunichar2) 0x003a;      /* colon */
 #else
@@ -697,6 +753,8 @@ ves_icall_System_IO_MonoIO_get_VolumeSeparatorChar ()
 gunichar2 
 ves_icall_System_IO_MonoIO_get_DirectorySeparatorChar ()
 {
+       MONO_ARCH_SAVE_REGS;
+
 #if defined (PLATFORM_WIN32)
        return (gunichar2) 0x005c;      /* backslash */
 #else
@@ -707,6 +765,8 @@ ves_icall_System_IO_MonoIO_get_DirectorySeparatorChar ()
 gunichar2 
 ves_icall_System_IO_MonoIO_get_AltDirectorySeparatorChar ()
 {
+       MONO_ARCH_SAVE_REGS;
+
 #if defined (PLATFORM_WIN32)
        return (gunichar2) 0x002f;      /* forward slash */
 #else
@@ -717,6 +777,8 @@ ves_icall_System_IO_MonoIO_get_AltDirectorySeparatorChar ()
 gunichar2 
 ves_icall_System_IO_MonoIO_get_PathSeparator ()
 {
+       MONO_ARCH_SAVE_REGS;
+
 #if defined (PLATFORM_WIN32)
        return (gunichar2) 0x003b;      /* semicolon */
 #else
@@ -737,6 +799,8 @@ static gunichar2 invalid_path_chars [] = {
 MonoArray *
 ves_icall_System_IO_MonoIO_get_InvalidPathChars ()
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoArray *chars;
        MonoDomain *domain;
        int i, n;
index b00cfe14bab9056df887c5cf9001545dcf07e7ea..1ab090d32f35ec00b0882ec1208f6289cba0a637 100644 (file)
@@ -13,6 +13,7 @@
 #include <mono/metadata/gc.h>
 #include <mono/metadata/threads.h>
 #include <mono/metadata/tabledefs.h>
+#include <mono/metadata/exception.h>
 #define GC_I_HIDE_POINTERS
 #include <mono/os/gc_wrapper.h>
 
@@ -170,6 +171,8 @@ mono_domain_finalize (MonoDomain *domain) {
 void
 ves_icall_System_GC_InternalCollect (int generation)
 {
+       MONO_ARCH_SAVE_REGS;
+
 #if HAVE_BOEHM_GC
        GC_gcollect ();
 #endif
@@ -178,6 +181,8 @@ ves_icall_System_GC_InternalCollect (int generation)
 gint64
 ves_icall_System_GC_GetTotalMemory (MonoBoolean forceCollection)
 {
+       MONO_ARCH_SAVE_REGS;
+
 #if HAVE_BOEHM_GC
        if (forceCollection)
                GC_gcollect ();
@@ -190,6 +195,8 @@ ves_icall_System_GC_GetTotalMemory (MonoBoolean forceCollection)
 void
 ves_icall_System_GC_KeepAlive (MonoObject *obj)
 {
+       MONO_ARCH_SAVE_REGS;
+
        /*
         * Does nothing.
         */
@@ -198,18 +205,23 @@ ves_icall_System_GC_KeepAlive (MonoObject *obj)
 void
 ves_icall_System_GC_ReRegisterForFinalize (MonoObject *obj)
 {
+       MONO_ARCH_SAVE_REGS;
+
        object_register_finalizer (obj, run_finalize);
 }
 
 void
 ves_icall_System_GC_SuppressFinalize (MonoObject *obj)
 {
+       MONO_ARCH_SAVE_REGS;
+
        object_register_finalizer (obj, NULL);
 }
 
 void
 ves_icall_System_GC_WaitForPendingFinalizers (void)
 {
+       MONO_ARCH_SAVE_REGS;
 }
 
 /*static CRITICAL_SECTION handle_section;*/
@@ -238,6 +250,8 @@ typedef enum {
 MonoObject *
 ves_icall_System_GCHandle_GetTarget (guint32 handle)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoObject *obj;
        gint32 type;
 
@@ -259,6 +273,8 @@ ves_icall_System_GCHandle_GetTarget (guint32 handle)
 guint32
 ves_icall_System_GCHandle_GetTargetHandle (MonoObject *obj, guint32 handle, gint32 type)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gpointer val = obj;
        guint32 h, idx = next_handle++;
 
@@ -329,6 +345,8 @@ ves_icall_System_GCHandle_GetTargetHandle (MonoObject *obj, guint32 handle, gint
 void
 ves_icall_System_GCHandle_FreeHandle (guint32 handle)
 {
+       MONO_ARCH_SAVE_REGS;
+
        int idx = handle >> 2;
        int type = handle & 0x3;
 
@@ -349,6 +367,8 @@ ves_icall_System_GCHandle_FreeHandle (guint32 handle)
 gpointer
 ves_icall_System_GCHandle_GetAddrOfPinnedObject (guint32 handle)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoObject *obj;
        int type = handle & 0x3;
 
index 56fa789628649f3a6b7ca1364e2834bb102abb18..d735874c493943c82aecaad0fc1940c1e1cfabac 100644 (file)
@@ -49,6 +49,8 @@
 static MonoString *
 mono_double_ToStringImpl (double value)
 {
+       MONO_ARCH_SAVE_REGS;
+
        /* FIXME: Handle formats, etc. */
        MonoString *s;
        gchar *retVal;
@@ -64,18 +66,24 @@ mono_double_ToStringImpl (double value)
 static double
 mono_double_ParseImpl (char *ptr)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return bsd_strtod (ptr, NULL);
 }
 
 static MonoString *
 mono_float_ToStringImpl (float value)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return mono_double_ToStringImpl (value);
 }
 
 static MonoObject *
 ves_icall_System_Array_GetValueImpl (MonoObject *this, guint32 pos)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoClass *ac;
        MonoArray *ao;
        gint32 esize;
@@ -96,6 +104,8 @@ ves_icall_System_Array_GetValueImpl (MonoObject *this, guint32 pos)
 static MonoObject *
 ves_icall_System_Array_GetValue (MonoObject *this, MonoObject *idxs)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoClass *ac, *ic;
        MonoArray *ao, *io;
        gint32 i, pos, *ind;
@@ -137,6 +147,8 @@ ves_icall_System_Array_GetValue (MonoObject *this, MonoObject *idxs)
 static void
 ves_icall_System_Array_SetValueImpl (MonoArray *this, MonoObject *value, guint32 pos)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoClass *ac, *vc, *ec;
        gint32 esize, vsize;
        gpointer *ea, *va;
@@ -400,6 +412,8 @@ static void
 ves_icall_System_Array_SetValue (MonoArray *this, MonoObject *value,
                                 MonoArray *idxs)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoClass *ac, *ic;
        gint32 i, pos, *ind;
 
@@ -438,6 +452,8 @@ ves_icall_System_Array_SetValue (MonoArray *this, MonoObject *value,
 static MonoArray *
 ves_icall_System_Array_CreateInstanceImpl (MonoReflectionType *type, MonoArray *lengths, MonoArray *bounds)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoClass *aklass;
        MonoArray *array;
        gint32 *sizes, i;
@@ -472,12 +488,16 @@ ves_icall_System_Array_CreateInstanceImpl (MonoReflectionType *type, MonoArray *
 static gint32 
 ves_icall_System_Array_GetRank (MonoObject *this)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return this->vtable->klass->rank;
 }
 
 static gint32
 ves_icall_System_Array_GetLength (MonoArray *this, gint32 dimension)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gint32 rank = ((MonoObject *)this)->vtable->klass->rank;
        if ((dimension < 0) || (dimension >= rank))
                mono_raise_exception (mono_get_exception_index_out_of_range ());
@@ -491,6 +511,8 @@ ves_icall_System_Array_GetLength (MonoArray *this, gint32 dimension)
 static gint32
 ves_icall_System_Array_GetLowerBound (MonoArray *this, gint32 dimension)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gint32 rank = ((MonoObject *)this)->vtable->klass->rank;
        if ((dimension < 0) || (dimension >= rank))
                mono_raise_exception (mono_get_exception_index_out_of_range ());
@@ -504,6 +526,8 @@ ves_icall_System_Array_GetLowerBound (MonoArray *this, gint32 dimension)
 static void
 ves_icall_System_Array_FastCopy (MonoArray *source, int source_idx, MonoArray* dest, int dest_idx, int length)
 {
+       MONO_ARCH_SAVE_REGS;
+
        int element_size = mono_array_element_size (source->obj.vtable->klass);
        void * dest_addr = mono_array_addr_with_size (dest, element_size, dest_idx);
        void * source_addr = mono_array_addr_with_size (source, element_size, source_idx);
@@ -516,6 +540,8 @@ ves_icall_System_Array_FastCopy (MonoArray *source, int source_idx, MonoArray* d
 static void
 ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_InitializeArray (MonoArray *array, MonoClassField *field_handle)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoClass *klass = array->obj.vtable->klass;
        guint32 size = mono_array_element_size (klass);
        int i;
@@ -564,12 +590,16 @@ ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_InitializeArray (MonoAr
 static gint
 ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_GetOffsetToStringData (void)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return offsetof (MonoString, chars);
 }
 
 static MonoObject *
 ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_GetObjectValue (MonoObject *obj)
 {
+       MONO_ARCH_SAVE_REGS;
+
        if ((obj == NULL) || (! (obj->vtable->klass->valuetype)))
                return obj;
        else
@@ -579,6 +609,8 @@ ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_GetObjectValue (MonoObj
 static void
 ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_RunClassConstructor (MonoType *handle)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoClass *klass;
 
        MONO_CHECK_ARG_NULL (handle);
@@ -593,6 +625,8 @@ ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_RunClassConstructor (Mo
 static MonoObject *
 ves_icall_System_Object_MemberwiseClone (MonoObject *this)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return mono_object_clone (this);
 }
 
@@ -613,6 +647,8 @@ ves_icall_System_Object_MemberwiseClone (MonoObject *this)
 static gint32
 ves_icall_System_Object_GetHashCode (MonoObject *this)
 {
+       MONO_ARCH_SAVE_REGS;
+
        register guint32 key;
        key = (GPOINTER_TO_UINT (this) >> MONO_OBJECT_ALIGNMENT_SHIFT) * 2654435761u;
 
@@ -626,6 +662,8 @@ ves_icall_System_Object_GetHashCode (MonoObject *this)
 static gint32
 ves_icall_System_ValueType_GetHashCode (MonoObject *this)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gint32 i, size;
        const char *p;
        guint h = 0;
@@ -647,6 +685,8 @@ ves_icall_System_ValueType_GetHashCode (MonoObject *this)
 static MonoBoolean
 ves_icall_System_ValueType_Equals (MonoObject *this, MonoObject *that)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gint32 size;
        const char *p, *s;
 
@@ -666,12 +706,16 @@ ves_icall_System_ValueType_Equals (MonoObject *this, MonoObject *that)
 static MonoReflectionType *
 ves_icall_System_Object_GetType (MonoObject *obj)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return mono_type_get_object (mono_object_domain (obj), &obj->vtable->klass->byval_arg);
 }
 
 static void
 mono_type_type_from_obj (MonoReflectionType *mtype, MonoObject *obj)
 {
+       MONO_ARCH_SAVE_REGS;
+
        mtype->type = &obj->vtable->klass->byval_arg;
        g_assert (mtype->type->type);
 }
@@ -679,12 +723,16 @@ mono_type_type_from_obj (MonoReflectionType *mtype, MonoObject *obj)
 static gint32
 ves_icall_AssemblyBuilder_getToken (MonoReflectionAssemblyBuilder *assb, MonoObject *obj)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return mono_image_create_token (assb->dynamic_assembly, obj);
 }
 
 static gint32
 ves_icall_AssemblyBuilder_getDataChunk (MonoReflectionAssemblyBuilder *assb, MonoArray *buf, gint32 offset)
 {
+       MONO_ARCH_SAVE_REGS;
+
        int count;
        MonoDynamicAssembly *ass = assb->dynamic_assembly;
        char *p = mono_array_addr (buf, char, 0);
@@ -716,6 +764,8 @@ get_get_type_caller (MonoMethod *m, gint32 no, gint32 ilo, gpointer data) {
 static MonoReflectionType*
 ves_icall_type_from_name (MonoString *name)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoImage *image = NULL;
        MonoType *type;
        gchar *str;
@@ -734,6 +784,8 @@ ves_icall_type_from_name (MonoString *name)
 static MonoReflectionType*
 ves_icall_type_from_handle (MonoType *handle)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain = mono_domain_get (); 
        MonoClass *klass = mono_class_from_mono_type (handle);
 
@@ -744,6 +796,8 @@ ves_icall_type_from_handle (MonoType *handle)
 static guint32
 ves_icall_type_Equals (MonoReflectionType *type, MonoReflectionType *c)
 {
+       MONO_ARCH_SAVE_REGS;
+
        if (type->type && c->type)
                return mono_metadata_type_equal (type->type, c->type);
        g_print ("type equals\n");
@@ -775,6 +829,8 @@ typedef enum {
 static guint32
 ves_icall_type_GetTypeCode (MonoReflectionType *type)
 {
+       MONO_ARCH_SAVE_REGS;
+
        int t = type->type->type;
 handle_enum:
        switch (t) {
@@ -842,6 +898,8 @@ handle_enum:
 static guint32
 ves_icall_type_is_subtype_of (MonoReflectionType *type, MonoReflectionType *c, MonoBoolean check_interfaces)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain; 
        MonoClass *klass;
        MonoClass *klassc;
@@ -883,6 +941,8 @@ ves_icall_type_is_subtype_of (MonoReflectionType *type, MonoReflectionType *c, M
 static guint32
 ves_icall_get_attributes (MonoReflectionType *type)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoClass *klass = mono_class_from_mono_type (type->type);
 
        return klass->flags;
@@ -891,6 +951,8 @@ ves_icall_get_attributes (MonoReflectionType *type)
 static void
 ves_icall_get_method_info (MonoMethod *method, MonoMethodInfo *info)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain = mono_domain_get ();
 
        info->parent = mono_type_get_object (domain, &method->klass->byval_arg);
@@ -902,6 +964,8 @@ ves_icall_get_method_info (MonoMethod *method, MonoMethodInfo *info)
 static MonoArray*
 ves_icall_get_parameter_info (MonoMethod *method)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain = mono_domain_get (); 
        MonoArray *res;
        static MonoClass *System_Reflection_ParameterInfo;
@@ -922,6 +986,8 @@ ves_icall_get_parameter_info (MonoMethod *method)
 static void
 ves_icall_get_field_info (MonoReflectionField *field, MonoFieldInfo *info)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain = mono_object_domain (field); 
 
        info->parent = mono_type_get_object (domain, &field->klass->byval_arg);
@@ -933,6 +999,8 @@ ves_icall_get_field_info (MonoReflectionField *field, MonoFieldInfo *info)
 static MonoObject *
 ves_icall_MonoField_GetValueInternal (MonoReflectionField *field, MonoObject *obj)
 {      
+       MONO_ARCH_SAVE_REGS;
+
        MonoObject *o;
        MonoClassField *cf = field->field;
        MonoClass *klass;
@@ -1005,6 +1073,8 @@ ves_icall_MonoField_GetValueInternal (MonoReflectionField *field, MonoObject *ob
 static void
 ves_icall_FieldInfo_SetValueInternal (MonoReflectionField *field, MonoObject *obj, MonoObject *value)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoClassField *cf = field->field;
        gchar *v;
 
@@ -1053,6 +1123,8 @@ ves_icall_FieldInfo_SetValueInternal (MonoReflectionField *field, MonoObject *ob
 static void
 ves_icall_get_property_info (MonoReflectionProperty *property, MonoPropertyInfo *info)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain = mono_object_domain (property); 
 
        info->parent = mono_type_get_object (domain, &property->klass->byval_arg);
@@ -1069,6 +1141,8 @@ ves_icall_get_property_info (MonoReflectionProperty *property, MonoPropertyInfo
 static void
 ves_icall_get_event_info (MonoReflectionEvent *event, MonoEventInfo *info)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain = mono_object_domain (event); 
 
        info->parent = mono_type_get_object (domain, &event->klass->byval_arg);
@@ -1082,6 +1156,8 @@ ves_icall_get_event_info (MonoReflectionEvent *event, MonoEventInfo *info)
 static MonoArray*
 ves_icall_Type_GetInterfaces (MonoReflectionType* type)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain = mono_object_domain (type); 
        MonoArray *intf;
        int ninterf, i;
@@ -1106,6 +1182,8 @@ ves_icall_Type_GetInterfaces (MonoReflectionType* type)
 static MonoReflectionType*
 ves_icall_MonoType_GetElementType (MonoReflectionType *type)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoClass *class = mono_class_from_mono_type (type->type);
        if (class->enumtype && class->enum_basetype) /* types that are modifierd typebuilkders may not have enum_basetype set */
                return mono_type_get_object (mono_object_domain (type), class->enum_basetype);
@@ -1118,6 +1196,8 @@ ves_icall_MonoType_GetElementType (MonoReflectionType *type)
 static MonoReflectionType*
 ves_icall_get_type_parent (MonoReflectionType *type)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoClass *class = mono_class_from_mono_type (type->type);
        return class->parent ? mono_type_get_object (mono_object_domain (type), &class->parent->byval_arg): NULL;
 }
@@ -1125,18 +1205,24 @@ ves_icall_get_type_parent (MonoReflectionType *type)
 static MonoBoolean
 ves_icall_type_ispointer (MonoReflectionType *type)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return type->type->type == MONO_TYPE_PTR;
 }
 
 static MonoBoolean
 ves_icall_type_isbyref (MonoReflectionType *type)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return type->type->byref;
 }
 
 static MonoReflectionModule*
 ves_icall_MonoType_get_Module (MonoReflectionType *type)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoClass *class = mono_class_from_mono_type (type->type);
        return mono_module_get_object (mono_object_domain (type), class->image);
 }
@@ -1144,6 +1230,8 @@ ves_icall_MonoType_get_Module (MonoReflectionType *type)
 static void
 ves_icall_get_type_info (MonoType *type, MonoTypeInfo *info)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain = mono_domain_get (); 
        MonoClass *class = mono_class_from_mono_type (type);
 
@@ -1165,6 +1253,8 @@ ves_icall_get_type_info (MonoType *type, MonoTypeInfo *info)
 static MonoObject *
 ves_icall_InternalInvoke (MonoReflectionMethod *method, MonoObject *this, MonoArray *params) 
 {
+       MONO_ARCH_SAVE_REGS;
+
        /* 
         * Invoke from reflection is supposed to always be a virtual call (the API
         * is stupid), mono_runtime_invoke_*() calls the provided method, allowing
@@ -1180,6 +1270,8 @@ ves_icall_InternalInvoke (MonoReflectionMethod *method, MonoObject *this, MonoAr
 static MonoObject *
 ves_icall_InternalExecute (MonoReflectionMethod *method, MonoObject *this, MonoArray *params, MonoArray **outArgs) 
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain = mono_object_domain (method); 
        MonoMethod *m = method->method;
        MonoMethodSignature *sig = m->signature;
@@ -1279,6 +1371,8 @@ ves_icall_InternalExecute (MonoReflectionMethod *method, MonoObject *this, MonoA
 static MonoObject *
 ves_icall_System_Enum_ToObject (MonoReflectionType *type, MonoObject *obj)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain; 
        MonoClass *enumc, *objc;
        gint32 s1, s2;
@@ -1313,6 +1407,8 @@ ves_icall_System_Enum_ToObject (MonoReflectionType *type, MonoObject *obj)
 static MonoObject *
 ves_icall_System_Enum_get_value (MonoObject *this)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoObject *res;
        MonoClass *enumc;
        gpointer dst;
@@ -1338,6 +1434,8 @@ ves_icall_System_Enum_get_value (MonoObject *this)
 static void
 ves_icall_get_enum_info (MonoReflectionType *type, MonoEnumInfo *info)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain = mono_object_domain (type); 
        MonoClass *enumc = mono_class_from_mono_type (type->type);
        guint i, j, nvalues, crow;
@@ -1405,6 +1503,8 @@ enum {
 static MonoFieldInfo *
 ves_icall_Type_GetField (MonoReflectionType *type, MonoString *name, guint32 bflags)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain; 
        MonoClass *startklass, *klass;
        int i, match;
@@ -1460,6 +1560,8 @@ handle_parent:
 static MonoArray*
 ves_icall_Type_GetFields (MonoReflectionType *type, guint32 bflags)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain; 
        GSList *l = NULL, *tmp;
        MonoClass *startklass, *klass;
@@ -1513,6 +1615,8 @@ handle_parent:
 static MonoArray*
 ves_icall_Type_GetMethods (MonoReflectionType *type, guint32 bflags)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain; 
        GSList *l = NULL, *tmp;
        static MonoClass *System_Reflection_MethodInfo;
@@ -1580,6 +1684,8 @@ handle_parent:
 static MonoArray*
 ves_icall_Type_GetConstructors (MonoReflectionType *type, guint32 bflags)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain; 
        GSList *l = NULL, *tmp;
        static MonoClass *System_Reflection_ConstructorInfo;
@@ -1637,6 +1743,8 @@ ves_icall_Type_GetConstructors (MonoReflectionType *type, guint32 bflags)
 static MonoArray*
 ves_icall_Type_GetProperties (MonoReflectionType *type, guint32 bflags)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain; 
        GSList *l = NULL, *tmp;
        static MonoClass *System_Reflection_PropertyInfo;
@@ -1705,6 +1813,8 @@ handle_parent:
 static MonoReflectionEvent *
 ves_icall_MonoType_GetEvent (MonoReflectionType *type, MonoString *name, guint32 bflags)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain;
        MonoClass *klass;
        gint i;
@@ -1748,6 +1858,8 @@ handle_parent:
 static MonoArray*
 ves_icall_Type_GetEvents (MonoReflectionType *type, guint32 bflags)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain; 
        GSList *l = NULL, *tmp;
        static MonoClass *System_Reflection_EventInfo;
@@ -1808,6 +1920,8 @@ handle_parent:
 static MonoArray*
 ves_icall_Type_GetNestedTypes (MonoReflectionType *type, guint32 bflags)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain; 
        GSList *l = NULL, *tmp;
        GList *tmpn;
@@ -1848,6 +1962,8 @@ ves_icall_Type_GetNestedTypes (MonoReflectionType *type, guint32 bflags)
 static MonoReflectionType*
 ves_icall_System_Reflection_Assembly_InternalGetType (MonoReflectionAssembly *assembly, MonoString *name, MonoBoolean throwOnError, MonoBoolean ignoreCase)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gchar *str;
        MonoType *type;
        MonoTypeNameParse info;
@@ -1882,6 +1998,8 @@ ves_icall_System_Reflection_Assembly_InternalGetType (MonoReflectionAssembly *as
 static MonoString *
 ves_icall_System_Reflection_Assembly_get_code_base (MonoReflectionAssembly *assembly)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain = mono_object_domain (assembly); 
        MonoString *res;
        char *name = g_strconcat (
@@ -1895,6 +2013,8 @@ ves_icall_System_Reflection_Assembly_get_code_base (MonoReflectionAssembly *asse
 static MonoString *
 ves_icall_System_Reflection_Assembly_get_location (MonoReflectionAssembly *assembly)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain = mono_object_domain (assembly); 
        MonoString *res;
        char *name = g_strconcat (
@@ -1907,7 +2027,10 @@ ves_icall_System_Reflection_Assembly_get_location (MonoReflectionAssembly *assem
 }
 
 static MonoReflectionMethod*
-ves_icall_System_Reflection_Assembly_get_EntryPoint (MonoReflectionAssembly *assembly) {
+ves_icall_System_Reflection_Assembly_get_EntryPoint (MonoReflectionAssembly *assembly) 
+{
+       MONO_ARCH_SAVE_REGS;
+
        guint32 token = mono_image_get_entry_point (assembly->assembly->image);
        if (!token)
                return NULL;
@@ -1915,7 +2038,10 @@ ves_icall_System_Reflection_Assembly_get_EntryPoint (MonoReflectionAssembly *ass
 }
 
 static MonoArray*
-ves_icall_System_Reflection_Assembly_GetManifestResourceNames (MonoReflectionAssembly *assembly) {
+ves_icall_System_Reflection_Assembly_GetManifestResourceNames (MonoReflectionAssembly *assembly) 
+{
+       MONO_ARCH_SAVE_REGS;
+
        MonoTableInfo *table = &assembly->assembly->image->tables [MONO_TABLE_MANIFESTRESOURCE];
        MonoArray *result = mono_array_new (mono_object_domain (assembly), mono_defaults.string_class, table->rows);
        int i;
@@ -1929,7 +2055,10 @@ ves_icall_System_Reflection_Assembly_GetManifestResourceNames (MonoReflectionAss
 }
 
 static MonoArray*
-ves_icall_System_Reflection_Assembly_GetReferencedAssemblies (MonoReflectionAssembly *assembly) {
+ves_icall_System_Reflection_Assembly_GetReferencedAssemblies (MonoReflectionAssembly *assembly) 
+{
+       MONO_ARCH_SAVE_REGS;
+
        static MonoClass *System_Reflection_AssemblyName;
        MonoArray *result;
        MonoAssembly **ptr;
@@ -1980,7 +2109,10 @@ g_concat_dir_and_file (const char *dir, const char *file)
 }
 
 static MonoObject*
-ves_icall_System_Reflection_Assembly_GetManifestResourceInternal (MonoReflectionAssembly *assembly, MonoString *name) {
+ves_icall_System_Reflection_Assembly_GetManifestResourceInternal (MonoReflectionAssembly *assembly, MonoString *name) 
+{
+       MONO_ARCH_SAVE_REGS;
+
        char *n = mono_string_to_utf8 (name);
        MonoTableInfo *table = &assembly->assembly->image->tables [MONO_TABLE_MANIFESTRESOURCE];
        guint32 i;
@@ -2028,7 +2160,10 @@ ves_icall_System_Reflection_Assembly_GetManifestResourceInternal (MonoReflection
 }
 
 static MonoObject*
-ves_icall_System_Reflection_Assembly_GetFilesInternal (MonoReflectionAssembly *assembly, MonoString *name) {
+ves_icall_System_Reflection_Assembly_GetFilesInternal (MonoReflectionAssembly *assembly, MonoString *name) 
+{
+       MONO_ARCH_SAVE_REGS;
+
        MonoTableInfo *table = &assembly->assembly->image->tables [MONO_TABLE_FILE];
        MonoArray *result;
        int i;
@@ -2064,7 +2199,10 @@ ves_icall_System_Reflection_Assembly_GetFilesInternal (MonoReflectionAssembly *a
 }
 
 static MonoReflectionMethod*
-ves_icall_GetCurrentMethod (void) {
+ves_icall_GetCurrentMethod (void) 
+{
+       MONO_ARCH_SAVE_REGS;
+
        MonoMethod *m = mono_method_get_last_managed ();
        return mono_method_get_object (mono_domain_get (), m, NULL);
 }
@@ -2072,6 +2210,8 @@ ves_icall_GetCurrentMethod (void) {
 static MonoReflectionAssembly*
 ves_icall_System_Reflection_Assembly_GetExecutingAssembly (void)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoMethod *m = mono_method_get_last_managed ();
        return mono_assembly_get_object (mono_domain_get (), m->klass->image->assembly);
 }
@@ -2095,6 +2235,8 @@ get_caller (MonoMethod *m, gint32 no, gint32 ilo, gpointer data)
 static MonoReflectionAssembly*
 ves_icall_System_Reflection_Assembly_GetEntryAssembly (void)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain* domain = mono_domain_get ();
        g_assert (domain->entry_assembly);
        return mono_assembly_get_object (domain, domain->entry_assembly);
@@ -2104,6 +2246,8 @@ ves_icall_System_Reflection_Assembly_GetEntryAssembly (void)
 static MonoReflectionAssembly*
 ves_icall_System_Reflection_Assembly_GetCallingAssembly (void)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoMethod *m = mono_method_get_last_managed ();
        MonoMethod *dest = m;
        mono_stack_walk (get_caller, &dest);
@@ -2115,6 +2259,8 @@ ves_icall_System_Reflection_Assembly_GetCallingAssembly (void)
 static MonoString *
 ves_icall_System_MonoType_getFullName (MonoReflectionType *object)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain = mono_object_domain (object); 
        MonoString *res;
        gchar *name;
@@ -2129,6 +2275,8 @@ ves_icall_System_MonoType_getFullName (MonoReflectionType *object)
 static void
 ves_icall_System_Reflection_Assembly_FillName (MonoReflectionAssembly *assembly, MonoReflectionAssemblyName *aname)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoAssemblyName *name = &assembly->assembly->aname;
 
        if (strcmp (name->name, "corlib") == 0)
@@ -2141,6 +2289,8 @@ ves_icall_System_Reflection_Assembly_FillName (MonoReflectionAssembly *assembly,
 static MonoArray*
 ves_icall_System_Reflection_Assembly_GetTypes (MonoReflectionAssembly *assembly, MonoBoolean exportedOnly)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain = mono_object_domain (assembly); 
        MonoArray *res;
        MonoClass *klass;
@@ -2178,6 +2328,8 @@ ves_icall_System_Reflection_Assembly_GetTypes (MonoReflectionAssembly *assembly,
 static MonoReflectionType*
 ves_icall_ModuleBuilder_create_modified_type (MonoReflectionTypeBuilder *tb, MonoString *smodifiers)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoClass *klass;
        int isbyref = 0, rank;
        char *str = mono_string_to_utf8 (smodifiers);
@@ -2237,6 +2389,8 @@ static MonoObject *
 ves_icall_System_Delegate_CreateDelegate_internal (MonoReflectionType *type, MonoObject *target,
                                                   MonoReflectionMethod *info)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoClass *delegate_class = mono_class_from_mono_type (type->type);
        MonoObject *delegate;
        gpointer func;
@@ -2261,6 +2415,8 @@ ves_icall_System_Delegate_CreateDelegate_internal (MonoReflectionType *type, Mon
 static gint64
 ves_icall_System_DateTime_GetNow (void)
 {
+       MONO_ARCH_SAVE_REGS;
+
 #ifdef PLATFORM_WIN32
        SYSTEMTIME st;
        FILETIME ft;
@@ -2300,6 +2456,8 @@ ves_icall_System_DateTime_GetNow (void)
 static guint32
 ves_icall_System_CurrentTimeZone_GetTimeZoneData (guint32 year, MonoArray **data, MonoArray **names)
 {
+       MONO_ARCH_SAVE_REGS;
+
 #ifndef PLATFORM_WIN32
        MonoDomain *domain = mono_domain_get ();
        struct tm start, tt;
@@ -2413,14 +2571,20 @@ ves_icall_System_CurrentTimeZone_GetTimeZoneData (guint32 year, MonoArray **data
 }
 
 static gpointer
-ves_icall_System_Object_obj_address (MonoObject *this) {
+ves_icall_System_Object_obj_address (MonoObject *this) 
+{
+       MONO_ARCH_SAVE_REGS;
+
        return this;
 }
 
 /* System.Buffer */
 
 static gint32 
-ves_icall_System_Buffer_ByteLengthInternal (MonoArray *array) {
+ves_icall_System_Buffer_ByteLengthInternal (MonoArray *array) 
+{
+       MONO_ARCH_SAVE_REGS;
+
        MonoClass *klass;
        MonoTypeEnum etype;
        int length, esize;
@@ -2444,17 +2608,26 @@ ves_icall_System_Buffer_ByteLengthInternal (MonoArray *array) {
 }
 
 static gint8 
-ves_icall_System_Buffer_GetByteInternal (MonoArray *array, gint32 idx) {
+ves_icall_System_Buffer_GetByteInternal (MonoArray *array, gint32 idx) 
+{
+       MONO_ARCH_SAVE_REGS;
+
        return mono_array_get (array, gint8, idx);
 }
 
 static void 
-ves_icall_System_Buffer_SetByteInternal (MonoArray *array, gint32 idx, gint8 value) {
+ves_icall_System_Buffer_SetByteInternal (MonoArray *array, gint32 idx, gint8 value) 
+{
+       MONO_ARCH_SAVE_REGS;
+
        mono_array_set (array, gint8, idx, value);
 }
 
 static void 
-ves_icall_System_Buffer_BlockCopyInternal (MonoArray *src, gint32 src_offset, MonoArray *dest, gint32 dest_offset, gint32 count) {
+ves_icall_System_Buffer_BlockCopyInternal (MonoArray *src, gint32 src_offset, MonoArray *dest, gint32 dest_offset, gint32 count) 
+{
+       MONO_ARCH_SAVE_REGS;
+
        char *src_buf, *dest_buf;
 
        src_buf = (gint8 *)src->vector + src_offset;
@@ -2466,6 +2639,8 @@ ves_icall_System_Buffer_BlockCopyInternal (MonoArray *src, gint32 src_offset, Mo
 static MonoObject *
 ves_icall_Remoting_RealProxy_GetTransparentProxy (MonoObject *this)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain = mono_object_domain (this); 
        MonoObject *res;
        MonoRealProxy *rp = ((MonoRealProxy *)this);
@@ -2490,6 +2665,8 @@ ves_icall_Remoting_RealProxy_GetTransparentProxy (MonoObject *this)
 static MonoString *
 ves_icall_System_Environment_get_MachineName (void)
 {
+       MONO_ARCH_SAVE_REGS;
+
 #if defined (PLATFORM_WIN32)
        gunichar2 *buf;
        guint32 len;
@@ -2524,6 +2701,8 @@ ves_icall_System_Environment_get_MachineName (void)
 static int
 ves_icall_System_Environment_get_Platform (void)
 {
+       MONO_ARCH_SAVE_REGS;
+
 #if defined (PLATFORM_WIN32)
        /* Win32NT */
        return 2;
@@ -2536,6 +2715,8 @@ ves_icall_System_Environment_get_Platform (void)
 static MonoString *
 ves_icall_System_Environment_get_NewLine (void)
 {
+       MONO_ARCH_SAVE_REGS;
+
 #if defined (PLATFORM_WIN32)
        return mono_string_new (mono_domain_get (), "\r\n");
 #else
@@ -2546,6 +2727,8 @@ ves_icall_System_Environment_get_NewLine (void)
 static MonoString *
 ves_icall_System_Environment_GetEnvironmentVariable (MonoString *name)
 {
+       MONO_ARCH_SAVE_REGS;
+
        const gchar *value;
        gchar *utf8_name;
 
@@ -2570,6 +2753,8 @@ extern char **environ;
 static MonoArray *
 ves_icall_System_Environment_GetEnvironmentVariableNames (void)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoArray *names;
        MonoDomain *domain;
        MonoString *str;
@@ -2605,6 +2790,8 @@ ves_icall_System_Environment_GetEnvironmentVariableNames (void)
 static gint32
 ves_icall_System_Environment_get_TickCount (void)
 {
+       MONO_ARCH_SAVE_REGS;
+
 #if defined (PLATFORM_WIN32)
        return GetTickCount();
 #else
@@ -2624,12 +2811,17 @@ ves_icall_System_Environment_get_TickCount (void)
 static void
 ves_icall_System_Environment_Exit (int result)
 {
+       MONO_ARCH_SAVE_REGS;
+
        /* we may need to do some cleanup here... */
        exit (result);
 }
 
 static MonoString*
-ves_icall_System_Text_Encoding_InternalCodePage (void) {
+ves_icall_System_Text_Encoding_InternalCodePage (void) 
+{
+       MONO_ARCH_SAVE_REGS;
+
        const char *cset;
        g_get_charset (&cset);
        /* g_print ("charset: %s\n", cset); */
@@ -2648,12 +2840,16 @@ ves_icall_MonoMethodMessage_InitMessage (MonoMethodMessage *this,
                                         MonoReflectionMethod *method,
                                         MonoArray *out_args)
 {
+       MONO_ARCH_SAVE_REGS;
+
        mono_message_init (mono_object_domain (this), this, method, out_args);
 }
 
 static MonoBoolean
 ves_icall_IsTransparentProxy (MonoObject *proxy)
 {
+       MONO_ARCH_SAVE_REGS;
+
        if (!proxy)
                return 0;
 
@@ -2666,6 +2862,8 @@ ves_icall_IsTransparentProxy (MonoObject *proxy)
 static MonoObject *
 ves_icall_System_Runtime_Serialization_FormatterServices_GetUninitializedObject_Internal (MonoReflectionType *type)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoClass *klass;
        MonoObject *obj;
        MonoDomain *domain;
@@ -2686,18 +2884,24 @@ ves_icall_System_Runtime_Serialization_FormatterServices_GetUninitializedObject_
 static MonoString *
 ves_icall_System_IO_get_temp_path (void)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return mono_string_new (mono_domain_get (), g_get_tmp_dir ());
 }
 
 static gpointer
 ves_icall_RuntimeMethod_GetFunctionPointer (MonoMethod *method)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return mono_compile_method (method);
 }
 
 static MonoString *
 ves_icall_System_Configuration_DefaultConfig_get_machine_config_path (void)
 {
+       MONO_ARCH_SAVE_REGS;
+
        static MonoString *mcpath;
        gchar *path;
 
index a8f53d49d6fd220b5ebbd8a0fdf62a04edeebcf4..a46fb62cafab46c5f2b36cdeea523132afea9a50 100644 (file)
@@ -455,7 +455,9 @@ mono_get_method (MonoImage *image, guint32 token, MonoClass *klass)
                        result->string_ctor = 1;
 
                result->addr = mono_lookup_internal_call (result);
+               result->signature->pinvoke = 1;
        } else if (cols [2] & METHOD_ATTRIBUTE_PINVOKE_IMPL) {
+               result->signature->pinvoke = 1;
                ((MonoMethodPInvoke *)result)->implmap_idx = mono_metadata_implmap_from_method (image, idx - 1);
        } else {
                /* if this is a methodref from another module/assembly, this fails */
index 91aaadf62e9a5c0868d8ef47c96483b8b03f6425..8c1528471a8f1e81bebe05325f1a9997679cb996 100644 (file)
@@ -2513,12 +2513,18 @@ mono_marshal_get_ptr_to_struct (MonoClass *klass)
 
 /* FIXME: on win32 we should probably use GlobalAlloc(). */
 void*
-mono_marshal_alloc (gpointer size) {
+mono_marshal_alloc (gpointer size) 
+{
+       MONO_ARCH_SAVE_REGS;
+
        return g_try_malloc ((gulong)size);
 }
 
 void
-mono_marshal_free (gpointer ptr) {
+mono_marshal_free (gpointer ptr) 
+{
+       MONO_ARCH_SAVE_REGS;
+
        g_free (ptr);
 }
 
@@ -2532,7 +2538,10 @@ mono_marshal_free_array (gpointer *ptr, int size) {
 }
 
 void *
-mono_marshal_realloc (gpointer ptr, gpointer size) {
+mono_marshal_realloc (gpointer ptr, gpointer size) 
+{
+       MONO_ARCH_SAVE_REGS;
+
        return g_try_realloc (ptr, (gulong)size);
 }
 
@@ -2562,6 +2571,8 @@ void
 ves_icall_System_Runtime_InteropServices_Marshal_copy_to_unmanaged (MonoArray *src, gint32 start_index,
                                                                    gpointer dest, gint32 length)
 {
+       MONO_ARCH_SAVE_REGS;
+
        int element_size;
        void *source_addr;
 
@@ -2583,6 +2594,8 @@ void
 ves_icall_System_Runtime_InteropServices_Marshal_copy_from_unmanaged (gpointer src, gint32 start_index,
                                                                      MonoArray *dest, gint32 length)
 {
+       MONO_ARCH_SAVE_REGS;
+
        int element_size;
        void *dest_addr;
 
@@ -2603,6 +2616,8 @@ ves_icall_System_Runtime_InteropServices_Marshal_copy_from_unmanaged (gpointer s
 gpointer
 ves_icall_System_Runtime_InteropServices_Marshal_ReadIntPtr (gpointer ptr, gint32 offset)
 {
+       MONO_ARCH_SAVE_REGS;
+
        char *p = ptr;
        return *(gpointer*)(p + offset);
 }
@@ -2610,6 +2625,8 @@ ves_icall_System_Runtime_InteropServices_Marshal_ReadIntPtr (gpointer ptr, gint3
 unsigned char
 ves_icall_System_Runtime_InteropServices_Marshal_ReadByte (gpointer ptr, gint32 offset)
 {
+       MONO_ARCH_SAVE_REGS;
+
        char *p = ptr;
        return *(unsigned char*)(p + offset);
 }
@@ -2617,6 +2634,8 @@ ves_icall_System_Runtime_InteropServices_Marshal_ReadByte (gpointer ptr, gint32
 gint16
 ves_icall_System_Runtime_InteropServices_Marshal_ReadInt16 (gpointer ptr, gint32 offset)
 {
+       MONO_ARCH_SAVE_REGS;
+
        char *p = ptr;
        return *(gint16*)(p + offset);
 }
@@ -2624,6 +2643,8 @@ ves_icall_System_Runtime_InteropServices_Marshal_ReadInt16 (gpointer ptr, gint32
 gint32
 ves_icall_System_Runtime_InteropServices_Marshal_ReadInt32 (gpointer ptr, gint32 offset)
 {
+       MONO_ARCH_SAVE_REGS;
+
        char *p = ptr;
        return *(gint32*)(p + offset);
 }
@@ -2631,6 +2652,8 @@ ves_icall_System_Runtime_InteropServices_Marshal_ReadInt32 (gpointer ptr, gint32
 gint64
 ves_icall_System_Runtime_InteropServices_Marshal_ReadInt64 (gpointer ptr, gint32 offset)
 {
+       MONO_ARCH_SAVE_REGS;
+
        char *p = ptr;
        return *(gint64*)(p + offset);
 }
@@ -2638,6 +2661,8 @@ ves_icall_System_Runtime_InteropServices_Marshal_ReadInt64 (gpointer ptr, gint32
 void
 ves_icall_System_Runtime_InteropServices_Marshal_WriteByte (gpointer ptr, gint32 offset, unsigned char val)
 {
+       MONO_ARCH_SAVE_REGS;
+
        char *p = ptr;
        *(unsigned char*)(p + offset) = val;
 }
@@ -2645,6 +2670,8 @@ ves_icall_System_Runtime_InteropServices_Marshal_WriteByte (gpointer ptr, gint32
 void
 ves_icall_System_Runtime_InteropServices_Marshal_WriteIntPtr (gpointer ptr, gint32 offset, gpointer val)
 {
+       MONO_ARCH_SAVE_REGS;
+
        char *p = ptr;
        *(gpointer*)(p + offset) = val;
 }
@@ -2652,6 +2679,8 @@ ves_icall_System_Runtime_InteropServices_Marshal_WriteIntPtr (gpointer ptr, gint
 void
 ves_icall_System_Runtime_InteropServices_Marshal_WriteInt16 (gpointer ptr, gint32 offset, gint16 val)
 {
+       MONO_ARCH_SAVE_REGS;
+
        char *p = ptr;
        *(gint16*)(p + offset) = val;
 }
@@ -2659,6 +2688,8 @@ ves_icall_System_Runtime_InteropServices_Marshal_WriteInt16 (gpointer ptr, gint3
 void
 ves_icall_System_Runtime_InteropServices_Marshal_WriteInt32 (gpointer ptr, gint32 offset, gint32 val)
 {
+       MONO_ARCH_SAVE_REGS;
+
        char *p = ptr;
        *(gint32*)(p + offset) = val;
 }
@@ -2666,6 +2697,8 @@ ves_icall_System_Runtime_InteropServices_Marshal_WriteInt32 (gpointer ptr, gint3
 void
 ves_icall_System_Runtime_InteropServices_Marshal_WriteInt64 (gpointer ptr, gint32 offset, gint64 val)
 {
+       MONO_ARCH_SAVE_REGS;
+
        char *p = ptr;
        *(gint64*)(p + offset) = val;
 }
@@ -2673,18 +2706,24 @@ ves_icall_System_Runtime_InteropServices_Marshal_WriteInt64 (gpointer ptr, gint3
 MonoString *
 ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi (char *ptr)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return mono_string_new (mono_domain_get (), ptr);
 }
 
 MonoString *
 ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi_len (char *ptr, gint32 len)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return mono_string_new_len (mono_domain_get (), ptr, len);
 }
 
 MonoString *
 ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni (guint16 *ptr)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain = mono_domain_get (); 
        int len = 0;
        guint16 *t = ptr;
@@ -2698,6 +2737,8 @@ ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni (guint16 *ptr)
 MonoString *
 ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni_len (guint16 *ptr, gint32 len)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain = mono_domain_get (); 
 
        return mono_string_new_utf16 (domain, ptr, len);
@@ -2706,6 +2747,8 @@ ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni_len (guint16 *pt
 MonoString *
 ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringBSTR (gpointer ptr)
 {
+       MONO_ARCH_SAVE_REGS;
+
        g_warning ("PtrToStringBSTR not implemented");
        g_assert_not_reached ();
 
@@ -2715,12 +2758,16 @@ ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringBSTR (gpointer ptr)
 guint32 
 ves_icall_System_Runtime_InteropServices_Marshal_GetLastWin32Error (void)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return (GetLastError ());
 }
 
 guint32 
 ves_icall_System_Runtime_InteropServices_Marshal_SizeOf (MonoReflectionType *rtype)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoClass *klass;
 
        MONO_CHECK_ARG_NULL (rtype);
@@ -2733,6 +2780,8 @@ ves_icall_System_Runtime_InteropServices_Marshal_SizeOf (MonoReflectionType *rty
 void
 ves_icall_System_Runtime_InteropServices_Marshal_StructureToPtr (MonoObject *obj, gpointer dst, MonoBoolean delete_old)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoMethod *method;
        gpointer pa [3];
 
@@ -2751,6 +2800,8 @@ ves_icall_System_Runtime_InteropServices_Marshal_StructureToPtr (MonoObject *obj
 void
 ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure (gpointer src, MonoObject *dst)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoMethod *method;
        gpointer pa [2];
 
@@ -2768,6 +2819,8 @@ ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure (gpointer src, M
 MonoObject *
 ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure_type (gpointer src, MonoReflectionType *type)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain = mono_domain_get (); 
        MonoObject *res;
 
@@ -2784,6 +2837,8 @@ ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure_type (gpointer s
 int
 ves_icall_System_Runtime_InteropServices_Marshal_OffsetOf (MonoReflectionType *type, MonoString *field_name)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoMarshalType *info;
        MonoClass *klass;
        char *fname;
@@ -2812,12 +2867,16 @@ ves_icall_System_Runtime_InteropServices_Marshal_OffsetOf (MonoReflectionType *t
 gpointer
 ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalAnsi (MonoString *string)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return mono_string_to_utf8 (string);
 }
 
 gpointer
 ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalUni (MonoString *string)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return g_memdup (mono_string_chars (string), mono_string_length (string)*2);
 }
 
@@ -2867,6 +2926,8 @@ mono_struct_delete_old (MonoClass *klass, char *ptr)
 void
 ves_icall_System_Runtime_InteropServices_Marshal_DestroyStructure (gpointer src, MonoReflectionType *type)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoClass *klass;
 
        MONO_CHECK_ARG_NULL (src);
index bceac1061845c3c04a297dffe498745d0f0dbfa8..b7a1e58b0406e90a3aa4f3ca41f3d0c37b65d08a 100644 (file)
@@ -17,6 +17,7 @@
 #include <mono/metadata/loader.h>
 #include <mono/metadata/object.h>
 #include <mono/metadata/gc.h>
+#include <mono/metadata/exception.h>
 #include <mono/metadata/appdomain.h>
 #include <mono/metadata/assembly.h>
 #include <mono/metadata/threadpool.h>
@@ -879,6 +880,8 @@ mono_object_clone (MonoObject *obj)
 MonoArray*
 mono_array_clone (MonoArray *array)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoArray *o;
        int size, i;
        guint32 *sizes;
index 3563b12d0d00b41e2f029b86e2ac259264d4fb09..5a7a4576ff8defe442a5a42a92ed6b53236cf5d6 100644 (file)
 #include <mono/metadata/appdomain.h>
 #include <mono/metadata/image.h>
 #include <mono/metadata/cil-coff.h>
+#include <mono/metadata/exception.h>
 #include <mono/io-layer/io-layer.h>
 
 #undef DEBUG
 
 HANDLE ves_icall_System_Diagnostics_Process_GetProcess_internal (guint32 pid)
 {
+       MONO_ARCH_SAVE_REGS;
+
        HANDLE handle;
        
        /* GetCurrentProcess returns a pseudo-handle, so use
@@ -40,12 +43,16 @@ HANDLE ves_icall_System_Diagnostics_Process_GetProcess_internal (guint32 pid)
 
 guint32 ves_icall_System_Diagnostics_Process_GetPid_internal (void)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return(GetCurrentProcessId ());
 }
 
 void ves_icall_System_Diagnostics_Process_Process_free_internal (MonoObject *this,
                                                                 HANDLE process)
 {
+       MONO_ARCH_SAVE_REGS;
+
 #ifdef THREAD_DEBUG
        g_message (G_GNUC_PRETTY_FUNCTION ": Closing process %p, handle %p",
                   this, process);
@@ -597,6 +604,8 @@ static void process_scan_modules (gpointer data, gpointer user_data)
 /* Returns an array of System.Diagnostics.ProcessModule */
 MonoArray *ves_icall_System_Diagnostics_Process_GetModules_internal (MonoObject *this)
 {
+       MONO_ARCH_SAVE_REGS;
+
        /* I was going to use toolhelp for this, but then realised I
         * was being an idiot :)
         *
@@ -631,6 +640,8 @@ MonoArray *ves_icall_System_Diagnostics_Process_GetModules_internal (MonoObject
 
 void ves_icall_System_Diagnostics_FileVersionInfo_GetVersionInfo_internal (MonoObject *this, MonoString *filename)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoImage *image;
        guchar *filename_utf8;
        
@@ -657,6 +668,8 @@ void ves_icall_System_Diagnostics_FileVersionInfo_GetVersionInfo_internal (MonoO
 
 MonoBoolean ves_icall_System_Diagnostics_Process_Start_internal (MonoString *cmd, MonoString *dirname, HANDLE stdin_handle, HANDLE stdout_handle, HANDLE stderr_handle, MonoProcInfo *process_info)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gboolean ret;
        gunichar2 *dir;
        STARTUPINFO startinfo={0};
@@ -691,6 +704,8 @@ MonoBoolean ves_icall_System_Diagnostics_Process_Start_internal (MonoString *cmd
 
 MonoBoolean ves_icall_System_Diagnostics_Process_WaitForExit_internal (MonoObject *this, HANDLE process, gint32 ms)
 {
+       MONO_ARCH_SAVE_REGS;
+
        guint32 ret;
        
        if(ms<0) {
@@ -709,6 +724,8 @@ MonoBoolean ves_icall_System_Diagnostics_Process_WaitForExit_internal (MonoObjec
 
 gint64 ves_icall_System_Diagnostics_Process_ExitTime_internal (HANDLE process)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gboolean ret;
        gint64 ticks;
        FILETIME create_time, exit_time, kernel_time, user_time;
@@ -727,6 +744,8 @@ gint64 ves_icall_System_Diagnostics_Process_ExitTime_internal (HANDLE process)
 
 gint64 ves_icall_System_Diagnostics_Process_StartTime_internal (HANDLE process)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gboolean ret;
        gint64 ticks;
        FILETIME create_time, exit_time, kernel_time, user_time;
@@ -745,6 +764,8 @@ gint64 ves_icall_System_Diagnostics_Process_StartTime_internal (HANDLE process)
 
 gint32 ves_icall_System_Diagnostics_Process_ExitCode_internal (HANDLE process)
 {
+       MONO_ARCH_SAVE_REGS;
+
        guint32 code;
        
        GetExitCodeProcess (process, &code);
@@ -758,6 +779,8 @@ gint32 ves_icall_System_Diagnostics_Process_ExitCode_internal (HANDLE process)
 
 MonoString *ves_icall_System_Diagnostics_Process_ProcessName_internal (HANDLE process)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoString *string;
        gboolean ok;
        HMODULE mod;
@@ -788,6 +811,8 @@ MonoString *ves_icall_System_Diagnostics_Process_ProcessName_internal (HANDLE pr
 /* Returns an array of pids */
 MonoArray *ves_icall_System_Diagnostics_Process_GetProcesses_internal (void)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoArray *procs;
        gboolean ret;
        guint32 needed, count, i;
@@ -811,6 +836,8 @@ MonoArray *ves_icall_System_Diagnostics_Process_GetProcesses_internal (void)
 
 MonoBoolean ves_icall_System_Diagnostics_Process_GetWorkingSet_internal (HANDLE process, guint32 *min, guint32 *max)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gboolean ret;
        
        ret=GetProcessWorkingSetSize (process, min, max);
@@ -820,6 +847,8 @@ MonoBoolean ves_icall_System_Diagnostics_Process_GetWorkingSet_internal (HANDLE
 
 MonoBoolean ves_icall_System_Diagnostics_Process_SetWorkingSet_internal (HANDLE process, guint32 min, guint32 max, MonoBoolean use_min)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gboolean ret;
        guint32 ws_min;
        guint32 ws_max;
index 764da7c22d9b5e8a935c343aa9f9a5b2fd80599e..affb13f3b797a5b0362e85d1e0a53855f90d202e 100644 (file)
@@ -15,6 +15,7 @@
 #include "mono/metadata/tokentype.h"
 #include "mono/metadata/appdomain.h"
 #include "mono/metadata/opcodes.h"
+#include <mono/metadata/exception.h>
 #include <stdio.h>
 #include <glib.h>
 #include <errno.h>
@@ -2262,6 +2263,8 @@ mono_image_build_metadata (MonoReflectionAssemblyBuilder *assemblyb)
 guint32
 mono_image_insert_string (MonoReflectionAssemblyBuilder *assembly, MonoString *str)
 {
+       MONO_ARCH_SAVE_REGS;
+
        guint32 idx;
        char buf [16];
        char *b = buf;
@@ -2382,6 +2385,8 @@ typedef struct {
 void
 mono_image_basic_init (MonoReflectionAssemblyBuilder *assemblyb)
 {
+       MONO_ARCH_SAVE_REGS;
+
        static const guchar entrycode [16] = {0xff, 0x25, 0};
        MonoDynamicAssembly *assembly;
        MonoImage *image;
@@ -3746,6 +3751,8 @@ find_event_index (MonoClass *klass, MonoEvent *event) {
 MonoArray*
 mono_reflection_get_custom_attrs (MonoObject *obj)
 {
+       MONO_ARCH_SAVE_REGS;
+       
        guint32 idx, mtoken, i, len;
        guint32 cols [MONO_CUSTOM_ATTR_SIZE];
        MonoClass *klass;
@@ -4155,6 +4162,9 @@ handle_type:
  */
 MonoArray*
 mono_reflection_get_custom_attrs_blob (MonoObject *ctor, MonoArray *ctorArgs, MonoArray *properties, MonoArray *propValues, MonoArray *fields, MonoArray* fieldValues) {
+
+       MONO_ARCH_SAVE_REGS;
+
        MonoArray *result;
        MonoMethodSignature *sig;
        MonoObject *arg;
@@ -4244,6 +4254,8 @@ mono_reflection_get_custom_attrs_blob (MonoObject *ctor, MonoArray *ctorArgs, Mo
 void
 mono_reflection_setup_internal_class (MonoReflectionTypeBuilder *tb)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoClass *klass, *parent;
 
        klass = g_new0 (MonoClass, 1);
@@ -4298,6 +4310,8 @@ mono_reflection_setup_internal_class (MonoReflectionTypeBuilder *tb)
 void
 mono_reflection_create_internal_class (MonoReflectionTypeBuilder *tb)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoClass *klass;
 
        klass = my_mono_class_from_mono_type (tb->type.type);
@@ -4436,6 +4450,8 @@ typebuilder_setup_fields (MonoClass *klass)
 MonoReflectionType*
 mono_reflection_create_runtime_class (MonoReflectionTypeBuilder *tb)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoClass *klass;
        MonoReflectionType* res;
 
@@ -4480,6 +4496,8 @@ mono_reflection_create_runtime_class (MonoReflectionTypeBuilder *tb)
 MonoArray *
 mono_reflection_sighelper_get_signature_local (MonoReflectionSigHelper *sig)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDynamicAssembly *assembly = sig->module->assemblyb->dynamic_assembly;
        guint32 na = mono_array_length (sig->arguments);
        guint32 buflen, i;
@@ -4507,6 +4525,8 @@ mono_reflection_sighelper_get_signature_local (MonoReflectionSigHelper *sig)
 MonoArray *
 mono_reflection_sighelper_get_signature_field (MonoReflectionSigHelper *sig)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDynamicAssembly *assembly = sig->module->assemblyb->dynamic_assembly;
        guint32 na = mono_array_length (sig->arguments);
        guint32 buflen, i;
index da2770f4b7739a99a8ed1a8ab0d5fd21d0253e14..b9477f7fd7a364a9a25e62b89ae6284333e616f8 100644 (file)
@@ -466,6 +466,8 @@ static MonoException *get_socket_exception(guint32 error_code)
 
 gpointer ves_icall_System_Net_Sockets_Socket_Socket_internal(MonoObject *this, gint32 family, gint32 type, gint32 proto)
 {
+       MONO_ARCH_SAVE_REGS;
+
        SOCKET sock;
        gint32 sock_family;
        gint32 sock_proto;
@@ -515,6 +517,8 @@ gpointer ves_icall_System_Net_Sockets_Socket_Socket_internal(MonoObject *this, g
  */
 void ves_icall_System_Net_Sockets_Socket_Close_internal(SOCKET sock)
 {
+       MONO_ARCH_SAVE_REGS;
+
 #ifdef DEBUG
        g_message (G_GNUC_PRETTY_FUNCTION ": closing 0x%x", sock);
 #endif
@@ -524,6 +528,8 @@ void ves_icall_System_Net_Sockets_Socket_Close_internal(SOCKET sock)
 
 gint32 ves_icall_System_Net_Sockets_SocketException_WSAGetLastError_internal(void)
 {
+       MONO_ARCH_SAVE_REGS;
+
 #ifdef DEBUG
        g_message(G_GNUC_PRETTY_FUNCTION ": returning %d", WSAGetLastError());
 #endif
@@ -533,6 +539,8 @@ gint32 ves_icall_System_Net_Sockets_SocketException_WSAGetLastError_internal(voi
 
 gint32 ves_icall_System_Net_Sockets_Socket_Available_internal(SOCKET sock)
 {
+       MONO_ARCH_SAVE_REGS;
+
        int ret, amount;
        
        ret=ioctlsocket(sock, FIONREAD, &amount);
@@ -547,6 +555,8 @@ gint32 ves_icall_System_Net_Sockets_Socket_Available_internal(SOCKET sock)
 void ves_icall_System_Net_Sockets_Socket_Blocking_internal(SOCKET sock,
                                                           gboolean block)
 {
+       MONO_ARCH_SAVE_REGS;
+
        int ret;
        
        ret=ioctlsocket(sock, FIONBIO, &block);
@@ -557,6 +567,8 @@ void ves_icall_System_Net_Sockets_Socket_Blocking_internal(SOCKET sock,
 
 gpointer ves_icall_System_Net_Sockets_Socket_Accept_internal(SOCKET sock)
 {
+       MONO_ARCH_SAVE_REGS;
+
        SOCKET newsock;
        
        newsock=accept(sock, NULL, 0);
@@ -571,6 +583,8 @@ gpointer ves_icall_System_Net_Sockets_Socket_Accept_internal(SOCKET sock)
 void ves_icall_System_Net_Sockets_Socket_Listen_internal(SOCKET sock,
                                                         guint32 backlog)
 {
+       MONO_ARCH_SAVE_REGS;
+
        int ret;
        
        ret=listen(sock, backlog);
@@ -642,6 +656,8 @@ static MonoObject *create_object_from_sockaddr(struct sockaddr *saddr,
 
 extern MonoObject *ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal(SOCKET sock)
 {
+       MONO_ARCH_SAVE_REGS;
+
        struct sockaddr sa;
        int salen;
        int ret;
@@ -662,6 +678,8 @@ extern MonoObject *ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal(SO
 
 extern MonoObject *ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal(SOCKET sock)
 {
+       MONO_ARCH_SAVE_REGS;
+
        struct sockaddr sa;
        int salen;
        int ret;
@@ -727,6 +745,8 @@ static struct sockaddr *create_sockaddr_from_object(MonoObject *saddr_obj,
 
 extern void ves_icall_System_Net_Sockets_Socket_Bind_internal(SOCKET sock, MonoObject *sockaddr)
 {
+       MONO_ARCH_SAVE_REGS;
+
        struct sockaddr *sa;
        int sa_size;
        int ret;
@@ -747,6 +767,8 @@ extern void ves_icall_System_Net_Sockets_Socket_Bind_internal(SOCKET sock, MonoO
 
 extern void ves_icall_System_Net_Sockets_Socket_Connect_internal(SOCKET sock, MonoObject *sockaddr)
 {
+       MONO_ARCH_SAVE_REGS;
+
        struct sockaddr *sa;
        int sa_size;
        int ret;
@@ -767,6 +789,8 @@ extern void ves_icall_System_Net_Sockets_Socket_Connect_internal(SOCKET sock, Mo
 
 gint32 ves_icall_System_Net_Sockets_Socket_Receive_internal(SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags)
 {
+       MONO_ARCH_SAVE_REGS;
+
        int ret;
        guchar *buf;
        gint32 alen;
@@ -789,6 +813,8 @@ gint32 ves_icall_System_Net_Sockets_Socket_Receive_internal(SOCKET sock, MonoArr
 
 gint32 ves_icall_System_Net_Sockets_Socket_RecvFrom_internal(SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, MonoObject **sockaddr)
 {
+       MONO_ARCH_SAVE_REGS;
+
        int ret;
        guchar *buf;
        gint32 alen;
@@ -820,6 +846,8 @@ gint32 ves_icall_System_Net_Sockets_Socket_RecvFrom_internal(SOCKET sock, MonoAr
 
 gint32 ves_icall_System_Net_Sockets_Socket_Send_internal(SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags)
 {
+       MONO_ARCH_SAVE_REGS;
+
        int ret;
        guchar *buf;
        gint32 alen;
@@ -850,6 +878,8 @@ gint32 ves_icall_System_Net_Sockets_Socket_Send_internal(SOCKET sock, MonoArray
 
 gint32 ves_icall_System_Net_Sockets_Socket_SendTo_internal(SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, MonoObject *sockaddr)
 {
+       MONO_ARCH_SAVE_REGS;
+
        int ret;
        guchar *buf;
        gint32 alen;
@@ -897,6 +927,8 @@ static SOCKET Socket_to_SOCKET(MonoObject *sockobj)
 
 void ves_icall_System_Net_Sockets_Socket_Select_internal(MonoArray **read_socks, MonoArray **write_socks, MonoArray **err_socks, gint32 timeout)
 {
+       MONO_ARCH_SAVE_REGS;
+
        fd_set readfds, writefds, errfds;
        struct timeval tv;
        div_t divvy;
@@ -1018,6 +1050,8 @@ void ves_icall_System_Net_Sockets_Socket_Select_internal(MonoArray **read_socks,
 
 void ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal(SOCKET sock, gint32 level, gint32 name, MonoObject **obj_val)
 {
+       MONO_ARCH_SAVE_REGS;
+
        int system_level;
        int system_name;
        int ret;
@@ -1098,6 +1132,8 @@ void ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal(SOCKET soc
 
 void ves_icall_System_Net_Sockets_Socket_GetSocketOption_arr_internal(SOCKET sock, gint32 level, gint32 name, MonoArray **byte_val)
 {
+       MONO_ARCH_SAVE_REGS;
+
        int system_level;
        int system_name;
        int ret;
@@ -1137,6 +1173,8 @@ static struct in_addr ipaddress_to_struct_in_addr(MonoObject *ipaddr)
 
 void ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal(SOCKET sock, gint32 level, gint32 name, MonoObject *obj_val, MonoArray *byte_val, gint32 int_val)
 {
+       MONO_ARCH_SAVE_REGS;
+
        int system_level;
        int system_name;
        int ret;
@@ -1230,6 +1268,8 @@ void ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal(SOCKET sock, g
 void ves_icall_System_Net_Sockets_Socket_Shutdown_internal(SOCKET sock,
                                                           gint32 how)
 {
+       MONO_ARCH_SAVE_REGS;
+
        int ret;
        
        /* Currently, the values for how (recv=0, send=1, both=2) match
@@ -1296,6 +1336,8 @@ static gboolean hostent_to_IPHostEntry(struct hostent *he, MonoString **h_name,
 
 extern MonoBoolean ves_icall_System_Net_Dns_GetHostByName_internal(MonoString *host, MonoString **h_name, MonoArray **h_aliases, MonoArray **h_addr_list)
 {
+       MONO_ARCH_SAVE_REGS;
+
        char *hostname;
        struct hostent *he;
        
@@ -1351,6 +1393,8 @@ inet_pton (int family, const char *address, void *inaddrp)
 
 extern MonoBoolean ves_icall_System_Net_Dns_GetHostByAddr_internal(MonoString *addr, MonoString **h_name, MonoArray **h_aliases, MonoArray **h_addr_list)
 {
+       MONO_ARCH_SAVE_REGS;
+
        struct in_addr inaddr;
        struct hostent *he;
        char *address;
@@ -1370,6 +1414,8 @@ extern MonoBoolean ves_icall_System_Net_Dns_GetHostByAddr_internal(MonoString *a
 
 extern MonoBoolean ves_icall_System_Net_Dns_GetHostName_internal(MonoString **h_name)
 {
+       MONO_ARCH_SAVE_REGS;
+
        guchar hostname[256];
        int ret;
        
index 4b8f9f9a420935159260cfae571496299df1b3be..df93e5024031c5a5317b556ffe4be3000abf6cb8 100644 (file)
@@ -31,6 +31,8 @@ string_icall_cmp_char (gunichar2 c1, gunichar2 c2, gint16 mode);
 MonoString *
 ves_icall_System_String_ctor_charp (gpointer dummy, gunichar2 *value)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gint32 i, length;
        MonoDomain *domain;
 
@@ -49,6 +51,8 @@ ves_icall_System_String_ctor_charp (gpointer dummy, gunichar2 *value)
 MonoString *
 ves_icall_System_String_ctor_char_int (gpointer dummy, gunichar2 value, gint32 count)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain;
        MonoString *res;
        gunichar2 *chars;
@@ -67,6 +71,8 @@ ves_icall_System_String_ctor_char_int (gpointer dummy, gunichar2 value, gint32 c
 MonoString *
 ves_icall_System_String_ctor_charp_int_int (gpointer dummy, gunichar2 *value, gint32 sindex, gint32 length)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gunichar2 *begin;
        MonoDomain * domain;
        
@@ -91,6 +97,8 @@ ves_icall_System_String_ctor_charp_int_int (gpointer dummy, gunichar2 *value, gi
 MonoString *
 ves_icall_System_String_ctor_sbytep (gpointer dummy, gint8 *value)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain;
        
        domain = mono_domain_get ();
@@ -106,6 +114,8 @@ ves_icall_System_String_ctor_sbytep (gpointer dummy, gint8 *value)
 MonoString *
 ves_icall_System_String_ctor_sbytep_int_int (gpointer dummy, gint8 *value, gint32 sindex, gint32 length)
 {
+       MONO_ARCH_SAVE_REGS;
+
        char *begin;
        MonoDomain *domain;
        
@@ -125,6 +135,8 @@ ves_icall_System_String_ctor_sbytep_int_int (gpointer dummy, gint8 *value, gint3
 MonoString *
 ves_icall_System_String_ctor_chara (gpointer dummy, MonoArray *value)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain;
 
        MONO_CHECK_ARG_NULL (value);
@@ -138,6 +150,8 @@ MonoString *
 ves_icall_System_String_ctor_chara_int_int (gpointer dummy, MonoArray *value, 
                                         gint32 sindex, gint32 length)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoDomain *domain;
 
        MONO_CHECK_ARG_NULL (value);
@@ -151,6 +165,8 @@ MonoString *
 ves_icall_System_String_ctor_encoding (gpointer dummy, gint8 *value, gint32 sindex, 
                                    gint32 length, MonoObject *enc)
 {
+       MONO_ARCH_SAVE_REGS;
+
        g_warning("string.ctor with encoding obj unimplemented");
        g_assert_not_reached ();
        return NULL;
@@ -159,6 +175,8 @@ ves_icall_System_String_ctor_encoding (gpointer dummy, gint8 *value, gint32 sind
 MonoBoolean 
 ves_icall_System_String_InternalEquals (MonoString *str1, MonoString *str2)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gunichar2 *str1ptr;
        gunichar2 *str2ptr;
        gint32 str1len;
@@ -175,6 +193,8 @@ ves_icall_System_String_InternalEquals (MonoString *str1, MonoString *str2)
 MonoString * 
 ves_icall_System_String_InternalJoin (MonoString *separator, MonoArray * value, gint32 sindex, gint32 count)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoString * ret;
        gint32 length;
        gint32 pos;
@@ -218,6 +238,8 @@ ves_icall_System_String_InternalJoin (MonoString *separator, MonoArray * value,
 MonoString * 
 ves_icall_System_String_InternalInsert (MonoString *me, gint32 sindex, MonoString *value)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoString * ret;
        gunichar2 *src;
        gunichar2 *insertsrc;
@@ -244,6 +266,8 @@ ves_icall_System_String_InternalInsert (MonoString *me, gint32 sindex, MonoStrin
 MonoString * 
 ves_icall_System_String_InternalReplace_Char (MonoString *me, gunichar2 oldChar, gunichar2 newChar)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoString *ret;
        gunichar2 *src;
        gunichar2 *dest;
@@ -268,6 +292,8 @@ ves_icall_System_String_InternalReplace_Char (MonoString *me, gunichar2 oldChar,
 MonoString * 
 ves_icall_System_String_InternalReplace_Str (MonoString *me, MonoString *oldValue, MonoString *newValue)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoString *ret;
        gunichar2 *src;
        gunichar2 *dest;
@@ -328,6 +354,8 @@ ves_icall_System_String_InternalReplace_Str (MonoString *me, MonoString *oldValu
 MonoString * 
 ves_icall_System_String_InternalRemove (MonoString *me, gint32 sindex, gint32 count)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoString * ret;
        gint32 srclen;
        gunichar2 *dest;
@@ -348,6 +376,8 @@ ves_icall_System_String_InternalRemove (MonoString *me, gint32 sindex, gint32 co
 void
 ves_icall_System_String_InternalCopyTo (MonoString *me, gint32 sindex, MonoArray *dest, gint32 dindex, gint32 count)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gunichar2 *destptr = (gunichar2 *) mono_array_addr(dest, gunichar2, dindex);
        gunichar2 *src =  mono_string_chars(me);
 
@@ -357,6 +387,8 @@ ves_icall_System_String_InternalCopyTo (MonoString *me, gint32 sindex, MonoArray
 MonoArray * 
 ves_icall_System_String_InternalSplit (MonoString *me, MonoArray *separator, gint32 count)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoString * tmpstr;
        MonoArray * retarr;
        gunichar2 *src;
@@ -445,6 +477,8 @@ string_icall_is_in_array (MonoArray *chars, gint32 arraylength, gunichar2 chr)
 MonoString * 
 ves_icall_System_String_InternalTrim (MonoString *me, MonoArray *chars, gint32 typ)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoString * ret;
        gunichar2 *src, *dest;
        gint32 srclen, newlen, arrlen;
@@ -488,6 +522,8 @@ ves_icall_System_String_InternalTrim (MonoString *me, MonoArray *chars, gint32 t
 gint32 
 ves_icall_System_String_InternalIndexOf_Char (MonoString *me, gunichar2 value, gint32 sindex, gint32 count)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gint32 pos;
        gunichar2 *src;
 
@@ -503,6 +539,8 @@ ves_icall_System_String_InternalIndexOf_Char (MonoString *me, gunichar2 value, g
 gint32 
 ves_icall_System_String_InternalIndexOf_Str (MonoString *me, MonoString *value, gint32 sindex, gint32 count)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gint32 lencmpstr;
        gint32 pos, i;
        gunichar2 *src;
@@ -527,6 +565,8 @@ ves_icall_System_String_InternalIndexOf_Str (MonoString *me, MonoString *value,
 gint32 
 ves_icall_System_String_InternalIndexOfAny (MonoString *me, MonoArray *arr, gint32 sindex, gint32 count)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gint32 pos;
        gint32 loop;
        gint32 arraysize;
@@ -547,6 +587,8 @@ ves_icall_System_String_InternalIndexOfAny (MonoString *me, MonoArray *arr, gint
 gint32 
 ves_icall_System_String_InternalLastIndexOf_Char (MonoString *me, gunichar2 value, gint32 sindex, gint32 count)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gint32 pos;
        gunichar2 *src;
 
@@ -562,6 +604,8 @@ ves_icall_System_String_InternalLastIndexOf_Char (MonoString *me, gunichar2 valu
 gint32 
 ves_icall_System_String_InternalLastIndexOf_Str (MonoString *me, MonoString *value, gint32 sindex, gint32 count)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gint32 lencmpstr;
        gint32 pos;
        gunichar2 *src;
@@ -583,6 +627,8 @@ ves_icall_System_String_InternalLastIndexOf_Str (MonoString *me, MonoString *val
 gint32 
 ves_icall_System_String_InternalLastIndexOfAny (MonoString *me, MonoArray *anyOf, gint32 sindex, gint32 count)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gint32 pos;
        gint32 loop;
        gint32 arraysize;
@@ -603,6 +649,8 @@ ves_icall_System_String_InternalLastIndexOfAny (MonoString *me, MonoArray *anyOf
 MonoString *
 ves_icall_System_String_InternalPad (MonoString *me, gint32 width, gunichar2 chr, MonoBoolean right)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoString * ret;
        gunichar2 *src;
        gunichar2 *dest;
@@ -637,6 +685,8 @@ ves_icall_System_String_InternalPad (MonoString *me, gint32 width, gunichar2 chr
 MonoString *
 ves_icall_System_String_InternalToLower (MonoString *me)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoString * ret;
        gunichar2 *src; 
        gunichar2 *dest;
@@ -656,6 +706,8 @@ ves_icall_System_String_InternalToLower (MonoString *me)
 MonoString *
 ves_icall_System_String_InternalToUpper (MonoString *me)
 {
+       MONO_ARCH_SAVE_REGS;
+
        int i;
        MonoString * ret;
        gunichar2 *src; 
@@ -675,12 +727,16 @@ ves_icall_System_String_InternalToUpper (MonoString *me)
 MonoString *
 ves_icall_System_String_InternalAllocateStr (gint32 length)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return mono_string_new_size(mono_domain_get (), length);
 }
 
 void 
 ves_icall_System_String_InternalStrcpy_Str (MonoString *dest, gint32 destPos, MonoString *src)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gunichar2 *srcptr;
        gunichar2 *destptr;
 
@@ -693,6 +749,8 @@ ves_icall_System_String_InternalStrcpy_Str (MonoString *dest, gint32 destPos, Mo
 void 
 ves_icall_System_String_InternalStrcpy_StrN (MonoString *dest, gint32 destPos, MonoString *src, gint32 startPos, gint32 count)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gunichar2 *srcptr;
        gunichar2 *destptr;
 
@@ -704,18 +762,24 @@ ves_icall_System_String_InternalStrcpy_StrN (MonoString *dest, gint32 destPos, M
 MonoString  *
 ves_icall_System_String_InternalIntern (MonoString *str)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return mono_string_intern(str);
 }
 
 MonoString * 
 ves_icall_System_String_InternalIsInterned (MonoString *str)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return mono_string_is_interned(str);
 }
 
 gint32
 ves_icall_System_String_InternalCompareStr_N (MonoString *s1, gint32 i1, MonoString *s2, gint32 i2, gint32 length, MonoBoolean inCase)
 {
+       MONO_ARCH_SAVE_REGS;
+
        /* c translation of C# code from old string.cs.. :) */
        gint32 lenstr1;
        gint32 lenstr2;
@@ -769,6 +833,8 @@ ves_icall_System_String_InternalCompareStr_N (MonoString *s1, gint32 i1, MonoStr
 gint32
 ves_icall_System_String_GetHashCode (MonoString *me)
 {
+       MONO_ARCH_SAVE_REGS;
+
        int i, h = 0;
        gunichar2 *data = mono_string_chars (me);
 
@@ -781,6 +847,8 @@ ves_icall_System_String_GetHashCode (MonoString *me)
 gunichar2 
 ves_icall_System_String_get_Chars (MonoString *me, gint32 idx)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return mono_string_chars(me)[idx];
 }
 
index 8837c16a09514206dcb172b6289f8e1c8fdbfe6f..297737ddd69f81eee2c6df0f4c62e1da47184a01 100644 (file)
@@ -3,6 +3,7 @@
 #define __USE_ISOC99\r
 #include <math.h>\r
 #include <mono/metadata/sysmath.h>\r
+#include <mono/metadata/exception.h>\r
 \r
 #ifndef NAN\r
 # if G_BYTE_ORDER == G_BIG_ENDIAN\r
@@ -31,42 +32,56 @@ static __huge_val_t __huge_val = { __HUGE_VAL_bytes };
 gdouble \r
 ves_icall_System_Math_Sin (gdouble x)\r
 {\r
+       MONO_ARCH_SAVE_REGS;\r
+\r
        return sin (x);\r
 }\r
 \r
 gdouble \r
 ves_icall_System_Math_Cos (gdouble x)\r
 {\r
+       MONO_ARCH_SAVE_REGS;\r
+\r
        return cos (x);\r
 }\r
 \r
 gdouble \r
 ves_icall_System_Math_Tan (gdouble x)\r
 {\r
+       MONO_ARCH_SAVE_REGS;\r
+\r
        return tan (x);\r
 }\r
 \r
 gdouble \r
 ves_icall_System_Math_Sinh (gdouble x)\r
 {\r
+       MONO_ARCH_SAVE_REGS;\r
+\r
        return sinh (x);\r
 }\r
 \r
 gdouble \r
 ves_icall_System_Math_Cosh (gdouble x)\r
 {\r
+       MONO_ARCH_SAVE_REGS;\r
+\r
        return cosh (x);\r
 }\r
 \r
 gdouble \r
 ves_icall_System_Math_Tanh (gdouble x)\r
 {\r
+       MONO_ARCH_SAVE_REGS;\r
+\r
        return tanh (x);\r
 }\r
 \r
 gdouble \r
 ves_icall_System_Math_Acos (gdouble x)\r
 {\r
+       MONO_ARCH_SAVE_REGS;\r
+\r
        if (x < -1 || x > 1)\r
                return NAN;\r
 \r
@@ -76,6 +91,8 @@ ves_icall_System_Math_Acos (gdouble x)
 gdouble \r
 ves_icall_System_Math_Asin (gdouble x)\r
 {\r
+       MONO_ARCH_SAVE_REGS;\r
+\r
        if (x < -1 || x > 1)\r
                return NAN;\r
 \r
@@ -85,24 +102,32 @@ ves_icall_System_Math_Asin (gdouble x)
 gdouble \r
 ves_icall_System_Math_Atan (gdouble x)\r
 {\r
+       MONO_ARCH_SAVE_REGS;\r
+\r
        return atan (x);\r
 }\r
 \r
 gdouble \r
 ves_icall_System_Math_Atan2 (gdouble y, gdouble x)\r
 {\r
+       MONO_ARCH_SAVE_REGS;\r
+\r
        return atan2 (y, x);\r
 }\r
 \r
 gdouble \r
 ves_icall_System_Math_Exp (gdouble x)\r
 {\r
+       MONO_ARCH_SAVE_REGS;\r
+\r
        return exp (x);\r
 }\r
 \r
 gdouble \r
 ves_icall_System_Math_Log (gdouble x)\r
 {\r
+       MONO_ARCH_SAVE_REGS;\r
+\r
        if (x == 0)\r
                return -HUGE_VAL;\r
        else if (x < 0)\r
@@ -114,6 +139,8 @@ ves_icall_System_Math_Log (gdouble x)
 gdouble \r
 ves_icall_System_Math_Log10 (gdouble x)\r
 {\r
+       MONO_ARCH_SAVE_REGS;\r
+\r
        if (x == 0)\r
                return -HUGE_VAL;\r
        else if (x < 0)\r
@@ -125,12 +152,16 @@ ves_icall_System_Math_Log10 (gdouble x)
 gdouble \r
 ves_icall_System_Math_Pow (gdouble x, gdouble y)\r
 {\r
+       MONO_ARCH_SAVE_REGS;\r
+\r
        return pow (x, y);\r
 }\r
 \r
 gdouble \r
 ves_icall_System_Math_Sqrt (gdouble x)\r
 {\r
+       MONO_ARCH_SAVE_REGS;\r
+\r
        if (x < 0)\r
                return NAN;\r
 \r
index e54c0dfb9cacb704a408fe0c1dd778624b67e46b..828ea426b20d560cadfd086610a597cb5a4fd589 100644 (file)
@@ -268,6 +268,8 @@ mono_thread_attach (MonoDomain *domain)
 HANDLE ves_icall_System_Threading_Thread_Thread_internal(MonoThread *this,
                                                         MonoObject *start)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoMulticastDelegate *delegate = (MonoMulticastDelegate*)start;
        guint32 (*start_func)(void *);
        struct StartInfo *start_info;
@@ -325,6 +327,8 @@ HANDLE ves_icall_System_Threading_Thread_Thread_internal(MonoThread *this,
 void ves_icall_System_Threading_Thread_Thread_free_internal (MonoThread *this,
                                                             HANDLE thread)
 {
+       MONO_ARCH_SAVE_REGS;
+
 #ifdef THREAD_DEBUG
        g_message (G_GNUC_PRETTY_FUNCTION ": Closing thread %p, handle %p",
                   this, thread);
@@ -336,6 +340,8 @@ void ves_icall_System_Threading_Thread_Thread_free_internal (MonoThread *this,
 void ves_icall_System_Threading_Thread_Start_internal(MonoThread *this,
                                                      HANDLE thread)
 {
+       MONO_ARCH_SAVE_REGS;
+
 #ifdef THREAD_DEBUG
        g_message(G_GNUC_PRETTY_FUNCTION ": Launching thread %p", this);
 #endif
@@ -351,6 +357,8 @@ void ves_icall_System_Threading_Thread_Start_internal(MonoThread *this,
 
 void ves_icall_System_Threading_Thread_Sleep_internal(gint32 ms)
 {
+       MONO_ARCH_SAVE_REGS;
+
 #ifdef THREAD_DEBUG
        g_message(G_GNUC_PRETTY_FUNCTION ": Sleeping for %d ms", ms);
 #endif
@@ -361,12 +369,16 @@ void ves_icall_System_Threading_Thread_Sleep_internal(gint32 ms)
 gint32
 ves_icall_System_Threading_Thread_GetDomainID (void) 
 {
+       MONO_ARCH_SAVE_REGS;
+
        return mono_domain_get()->domain_id;
 }
 
 MonoThread *
 mono_thread_current (void)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoThread *thread;
        
        /* Find the current thread object */
@@ -382,6 +394,8 @@ mono_thread_current (void)
 gboolean ves_icall_System_Threading_Thread_Join_internal(MonoThread *this,
                                                         int ms, HANDLE thread)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gboolean ret;
        
        if(ms== -1) {
@@ -410,6 +424,8 @@ gboolean ves_icall_System_Threading_Thread_Join_internal(MonoThread *this,
 
 void ves_icall_System_Threading_Thread_SlotHash_store(MonoObject *data)
 {
+       MONO_ARCH_SAVE_REGS;
+
 #ifdef THREAD_DEBUG
        g_message(G_GNUC_PRETTY_FUNCTION ": Storing key %p", data);
 #endif
@@ -420,6 +436,8 @@ void ves_icall_System_Threading_Thread_SlotHash_store(MonoObject *data)
 
 MonoObject *ves_icall_System_Threading_Thread_SlotHash_lookup(void)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoObject *data;
 
        data=TlsGetValue(slothash_key);
@@ -481,6 +499,8 @@ static MonoThreadsSync *mon_new(void)
 gboolean ves_icall_System_Threading_Monitor_Monitor_try_enter(MonoObject *obj,
                                                              int ms)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoThreadsSync *mon;
        guint32 ret;
        
@@ -527,6 +547,8 @@ gboolean ves_icall_System_Threading_Monitor_Monitor_try_enter(MonoObject *obj,
 
 void ves_icall_System_Threading_Monitor_Monitor_exit(MonoObject *obj)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoThreadsSync *mon;
        
 #ifdef THREAD_LOCK_DEBUG
@@ -568,6 +590,8 @@ void ves_icall_System_Threading_Monitor_Monitor_exit(MonoObject *obj)
 
 gboolean ves_icall_System_Threading_Monitor_Monitor_test_owner(MonoObject *obj)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoThreadsSync *mon;
        gboolean ret=FALSE;
        
@@ -604,6 +628,8 @@ finished:
 
 gboolean ves_icall_System_Threading_Monitor_Monitor_test_synchronised(MonoObject *obj)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoThreadsSync *mon;
        gboolean ret=FALSE;
        
@@ -637,6 +663,8 @@ finished:
        
 void ves_icall_System_Threading_Monitor_Monitor_pulse(MonoObject *obj)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gboolean have_waiters;
        MonoThreadsSync *mon;
        
@@ -669,6 +697,8 @@ void ves_icall_System_Threading_Monitor_Monitor_pulse(MonoObject *obj)
 
 void ves_icall_System_Threading_Monitor_Monitor_pulse_all(MonoObject *obj)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gboolean have_waiters=FALSE;
        MonoThreadsSync *mon;
        
@@ -711,6 +741,8 @@ void ves_icall_System_Threading_Monitor_Monitor_pulse_all(MonoObject *obj)
 gboolean ves_icall_System_Threading_Monitor_Monitor_wait(MonoObject *obj,
                                                         int ms)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gboolean last_waiter;
        MonoThreadsSync *mon;
        guint32 save_count;
@@ -811,6 +843,8 @@ gboolean ves_icall_System_Threading_Monitor_Monitor_wait(MonoObject *obj,
 /* FIXME: exitContext isnt documented */
 gboolean ves_icall_System_Threading_WaitHandle_WaitAll_internal(MonoArray *mono_handles, gint32 ms, gboolean exitContext)
 {
+       MONO_ARCH_SAVE_REGS;
+
        HANDLE *handles;
        guint32 numhandles;
        guint32 ret;
@@ -850,6 +884,8 @@ gboolean ves_icall_System_Threading_WaitHandle_WaitAll_internal(MonoArray *mono_
 /* FIXME: exitContext isnt documented */
 gint32 ves_icall_System_Threading_WaitHandle_WaitAny_internal(MonoArray *mono_handles, gint32 ms, gboolean exitContext)
 {
+       MONO_ARCH_SAVE_REGS;
+
        HANDLE *handles;
        guint32 numhandles;
        guint32 ret;
@@ -880,6 +916,8 @@ gint32 ves_icall_System_Threading_WaitHandle_WaitAny_internal(MonoArray *mono_ha
 /* FIXME: exitContext isnt documented */
 gboolean ves_icall_System_Threading_WaitHandle_WaitOne_internal(MonoObject *this, HANDLE handle, gint32 ms, gboolean exitContext)
 {
+       MONO_ARCH_SAVE_REGS;
+
        guint32 ret;
        
 #ifdef THREAD_WAIT_DEBUG
@@ -909,35 +947,49 @@ gboolean ves_icall_System_Threading_WaitHandle_WaitOne_internal(MonoObject *this
        return(TRUE);
 }
 
-HANDLE ves_icall_System_Threading_Mutex_CreateMutex_internal (MonoBoolean owned,char *name) {    
-   return(CreateMutex(NULL,owned,name));                        
+HANDLE ves_icall_System_Threading_Mutex_CreateMutex_internal (MonoBoolean owned,char *name) { 
+       MONO_ARCH_SAVE_REGS;
+   
+       return(CreateMutex(NULL,owned,name));                    
 }                                                                   
 
 void ves_icall_System_Threading_Mutex_ReleaseMutex_internal (HANDLE handle ) { 
+       MONO_ARCH_SAVE_REGS;
+
        ReleaseMutex(handle);
 }
 
 HANDLE ves_icall_System_Threading_Events_CreateEvent_internal (MonoBoolean manual,
                                                                                                                          MonoBoolean initial,
                                                                                                                          char *name) {
+       MONO_ARCH_SAVE_REGS;
+
        return (CreateEvent(NULL,manual,initial,name));
 }
 
 gboolean ves_icall_System_Threading_Events_SetEvent_internal (HANDLE handle) {
+       MONO_ARCH_SAVE_REGS;
+
        return (SetEvent(handle));
 }
 
 gboolean ves_icall_System_Threading_Events_ResetEvent_internal (HANDLE handle) {
+       MONO_ARCH_SAVE_REGS;
+
        return (ResetEvent(handle));
 }
 
 gint32 ves_icall_System_Threading_Interlocked_Increment_Int (gint32 *location)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return InterlockedIncrement (location);
 }
 
 gint64 ves_icall_System_Threading_Interlocked_Increment_Long (gint64 *location)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gint32 lowret;
        gint32 highret;
 
@@ -956,11 +1008,15 @@ gint64 ves_icall_System_Threading_Interlocked_Increment_Long (gint64 *location)
 
 gint32 ves_icall_System_Threading_Interlocked_Decrement_Int (gint32 *location)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return InterlockedDecrement(location);
 }
 
 gint64 ves_icall_System_Threading_Interlocked_Decrement_Long (gint64 * location)
 {
+       MONO_ARCH_SAVE_REGS;
+
        gint32 lowret;
        gint32 highret;
 
@@ -979,16 +1035,22 @@ gint64 ves_icall_System_Threading_Interlocked_Decrement_Long (gint64 * location)
 
 gint32 ves_icall_System_Threading_Interlocked_Exchange_Int (gint32 *location1, gint32 value)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return InterlockedExchange(location1, value);
 }
 
 MonoObject * ves_icall_System_Threading_Interlocked_Exchange_Object (MonoObject **location1, MonoObject *value)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return (MonoObject *) InterlockedExchangePointer((gpointer *) location1, value);
 }
 
 gfloat ves_icall_System_Threading_Interlocked_Exchange_Single (gfloat *location1, gfloat value)
 {
+       MONO_ARCH_SAVE_REGS;
+
        IntFloatUnion val, ret;
 
        val.fval = value;
@@ -999,16 +1061,22 @@ gfloat ves_icall_System_Threading_Interlocked_Exchange_Single (gfloat *location1
 
 gint32 ves_icall_System_Threading_Interlocked_CompareExchange_Int(gint32 *location1, gint32 value, gint32 comparand)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return InterlockedCompareExchange(location1, value, comparand);
 }
 
 MonoObject * ves_icall_System_Threading_Interlocked_CompareExchange_Object (MonoObject **location1, MonoObject *value, MonoObject *comparand)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return (MonoObject *) InterlockedCompareExchangePointer((gpointer *) location1, value, comparand);
 }
 
 gfloat ves_icall_System_Threading_Interlocked_CompareExchange_Single (gfloat *location1, gfloat value, gfloat comparand)
 {
+       MONO_ARCH_SAVE_REGS;
+
        IntFloatUnion val, ret, cmp;
 
        val.fval = value;
@@ -1021,6 +1089,8 @@ gfloat ves_icall_System_Threading_Interlocked_CompareExchange_Single (gfloat *lo
 void
 ves_icall_System_Threading_Thread_Abort (MonoThread *thread, MonoObject *state)
 {
+       MONO_ARCH_SAVE_REGS;
+
        thread->abort_state = state;
        thread->abort_exc = mono_get_exception_thread_abort ();
 
@@ -1040,6 +1110,8 @@ ves_icall_System_Threading_Thread_Abort (MonoThread *thread, MonoObject *state)
 void
 ves_icall_System_Threading_Thread_ResetAbort (void)
 {
+       MONO_ARCH_SAVE_REGS;
+
        MonoThread *thread = mono_thread_current ();
        
        if (!thread->abort_exc) {
index 1f506e43e8f4ec00e10de1c79e8d0a79c21f9541..7e6ffba5278702e7e09a4539b1512cb39353a5d8 100644 (file)
@@ -13,6 +13,7 @@
 
 #include <mono/metadata/object.h>
 #include <mono/metadata/unicode.h>
+#include <mono/metadata/exception.h>
 
 static MonoUnicodeCategory catmap[] = {
        /* G_UNICODE_CONTROL = */              Control,
@@ -50,48 +51,64 @@ static MonoUnicodeCategory catmap[] = {
 double 
 ves_icall_System_Char_GetNumericValue (gunichar2 c)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return (double)g_unichar_digit_value (c);
 }
 
 MonoUnicodeCategory 
 ves_icall_System_Char_GetUnicodeCategory (gunichar2 c)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return catmap [g_unichar_type (c)];
 }
 
 gboolean 
 ves_icall_System_Char_IsControl (gunichar2 c)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return g_unichar_iscntrl (c);
 }
 
 gboolean 
 ves_icall_System_Char_IsDigit (gunichar2 c)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return g_unichar_isdigit (c);
 }
 
 gboolean 
 ves_icall_System_Char_IsLetter (gunichar2 c)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return g_unichar_isalpha (c);
 }
 
 gboolean 
 ves_icall_System_Char_IsLower (gunichar2 c)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return g_unichar_islower (c);
 }
 
 gboolean 
 ves_icall_System_Char_IsUpper (gunichar2 c)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return g_unichar_isupper (c);
 }
 
 gboolean 
 ves_icall_System_Char_IsNumber (gunichar2 c)
 {
+       MONO_ARCH_SAVE_REGS;
+
        GUnicodeType t = g_unichar_type (c);
        return t == G_UNICODE_DECIMAL_NUMBER ||
                t == G_UNICODE_LETTER_NUMBER ||
@@ -101,12 +118,16 @@ ves_icall_System_Char_IsNumber (gunichar2 c)
 gboolean 
 ves_icall_System_Char_IsPunctuation (gunichar2 c)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return g_unichar_ispunct (c);
 }
 
 gboolean 
 ves_icall_System_Char_IsSeparator (gunichar2 c)
 {
+       MONO_ARCH_SAVE_REGS;
+
        GUnicodeType t = g_unichar_type (c);
 
        return (t == G_UNICODE_LINE_SEPARATOR ||
@@ -117,12 +138,16 @@ ves_icall_System_Char_IsSeparator (gunichar2 c)
 gboolean 
 ves_icall_System_Char_IsSurrogate (gunichar2 c)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return (g_unichar_type (c) == G_UNICODE_SURROGATE);
 }
 
 gboolean 
 ves_icall_System_Char_IsSymbol (gunichar2 c)
 {
+       MONO_ARCH_SAVE_REGS;
+
        GUnicodeType t = g_unichar_type (c);
 
        return (t == G_UNICODE_CURRENCY_SYMBOL ||
@@ -134,18 +159,24 @@ ves_icall_System_Char_IsSymbol (gunichar2 c)
 gboolean 
 ves_icall_System_Char_IsWhiteSpace (gunichar2 c)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return g_unichar_isspace (c);
 }
 
 gunichar2
 ves_icall_System_Char_ToLower (gunichar2 c)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return g_unichar_tolower (c);
 }
 
 gunichar2
 ves_icall_System_Char_ToUpper (gunichar2 c)
 {
+       MONO_ARCH_SAVE_REGS;
+
        return g_unichar_toupper (c);
 }