Move the helper signatures along with their init function to method-to-ir.c.
[mono.git] / mono / mini / exceptions-alpha.c
index 7cf17ffc5d853dfeda747f85d7c00cd69e668513..598cc2587328364882d6083b482b6b7e4433a213 100644 (file)
@@ -19,9 +19,6 @@
 /*------------------------------------------------------------------*/
 /*                 D e f i n e s                                    */
 /*------------------------------------------------------------------*/
-#define NOT_IMPLEMENTED(x) \
-        g_error ("FIXME: %s is not yet implemented.", x);
-
 #define ALPHA_DEBUG(x) \
   if (mini_alpha_verbose_level)        \
     g_debug ("ALPHA_DEBUG: %s is called.", x);
@@ -310,6 +307,7 @@ get_throw_trampoline (gboolean rethrow)
   /* Exception is in a0 already */
   alpha_mov1(code, alpha_ra, alpha_a1);  // Return address
   alpha_mov1(code, alpha_sp, alpha_a2);  // Stack pointer
+
   if (rethrow)
     alpha_lda(code, alpha_a3, alpha_zero, 1);
   else
@@ -746,6 +744,7 @@ mono_arch_get_throw_exception_by_name (void)
 {
   static guint8 *start;
   static int inited = 0;
+  unsigned int *code;
   
   if (inited)
     return start;
@@ -754,6 +753,10 @@ mono_arch_get_throw_exception_by_name (void)
   //        get_throw_exception_generic (start, SZ_THROW, TRUE, FALSE);
   inited = 1;
 
+  code = (unsigned int *)start;
+
+  alpha_call_pal(code, 0x80);
+
   return start;
 }
 /*========================= End of Function ========================*/
@@ -777,9 +780,9 @@ mono_arch_get_throw_exception_by_name (void)
 MonoJitInfo *
 mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls,
                          MonoJitInfo *res, MonoJitInfo *prev_ji,
-                        MonoContext *ctx,
-                         MonoContext *new_ctx, char **trace, MonoLMF **lmf,
-                         int *native_offset, gboolean *managed)
+                                                MonoContext *ctx,
+                         MonoContext *new_ctx, MonoLMF **lmf,
+                         gboolean *managed)
 {
   MonoJitInfo *ji;
   int i;
@@ -793,7 +796,7 @@ mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls,
        ((guint8*)ip < ((guint8*)prev_ji->code_start) + prev_ji->code_size)))
     ji = prev_ji;
   else
-    ji = mono_jit_info_table_find (domain, ip);
+         ji = mini_jit_info_table_find (domain, ip, NULL);
 
   if (managed)
     *managed = FALSE;
@@ -912,9 +915,12 @@ mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls,
          /* Some how we should find size of frame. One way:
           read 3rd instruction (alpha_lda(alpha_sp, alpha_sp, -stack_size ))
           and extract "stack_size" from there
+          read 4th and 5th insts to get offsets to saved RA & FP
          */
          unsigned int *code = (unsigned int *)ji->code_start;
          short stack_size = -((short)(code[2] & 0xFFFF));
+         short ra_off = code[3] & 0xFFFF;
+         short fp_off = code[4] & 0xFFFF;
 
          /* Restore stack - value of FP reg + stack_size */
          new_ctx->uc_mcontext.sc_regs[alpha_sp] =
@@ -923,11 +929,11 @@ mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls,
          /* we substract 1, so that the IP points into the call instruction */
          /* restore PC - @FP + 0 */
          new_ctx->uc_mcontext.sc_pc = 
-           *((guint64 *)ctx->uc_mcontext.sc_regs[alpha_r15]);
+           *((guint64 *)(ctx->uc_mcontext.sc_regs[alpha_r15] + ra_off));
          
          /* Restore FP reg - @FP + 8 */
          new_ctx->uc_mcontext.sc_regs[alpha_r15] = 
-           *((guint64 *)(ctx->uc_mcontext.sc_regs[alpha_r15] + 8));
+           *((guint64 *)(ctx->uc_mcontext.sc_regs[alpha_r15] + fp_off));
 
          /* Restore GP - read two insts that restore GP from sc_pc and */
          /* do the same. Use sc_pc as RA */
@@ -945,7 +951,10 @@ mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls,
            }
        }
 
+#if 0
       /* Pop arguments off the stack */
+      // No poping args off stack on Alpha
+      // We use fixed place
       {
        MonoJitArgumentInfo *arg_info =
          g_newa (MonoJitArgumentInfo,
@@ -957,7 +966,7 @@ mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls,
                                       arg_info);
        new_ctx->uc_mcontext.sc_regs[alpha_sp] += stack_to_pop;
       }
-
+#endif
       return ji;
     }
   else if (*lmf)
@@ -966,9 +975,9 @@ mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls,
       if (!(*lmf)->method)
        return (gpointer)-1;
 
-      if ((ji = mono_jit_info_table_find (domain, (gpointer)(*lmf)->eip))) {
+      if ((ji = mini_jit_info_table_find (domain, (gpointer)(*lmf)->eip, NULL))) {
       } else {
-       memset (res, 0, sizeof (MonoJitInfo));
+       memset (res, 0, MONO_SIZEOF_JIT_INFO);
        res->method = (*lmf)->method;
       }