+
+gboolean lmf_addr_key_inited = FALSE;
+
+#ifdef MONO_SPARC_THR_TLS
+thread_key_t lmf_addr_key;
+#else
+pthread_key_t lmf_addr_key;
+#endif
+
+gpointer
+mono_arch_get_lmf_addr (void)
+{
+ /* This is perf critical so we bypass the IO layer */
+ /* The thr_... functions seem to be somewhat faster */
+#ifdef MONO_SPARC_THR_TLS
+ gpointer res;
+ thr_getspecific (lmf_addr_key, &res);
+ return res;
+#else
+ return pthread_getspecific (lmf_addr_key);
+#endif
+}
+
+#ifdef MONO_ARCH_SIGSEGV_ON_ALTSTACK
+
+/*
+ * There seems to be no way to determine stack boundaries under solaris,
+ * so it's not possible to determine whenever a SIGSEGV is caused by stack
+ * overflow or not.
+ */
+#error "--with-sigaltstack=yes not supported on solaris"
+
+static void
+setup_stack (MonoJitTlsData *tls)
+{
+#ifdef __linux__
+ struct sigaltstack sa;
+#else
+ stack_t sigstk;
+#endif
+
+ /* Setup an alternate signal stack */
+ tls->signal_stack = mmap (0, SIGNAL_STACK_SIZE, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
+ tls->signal_stack_size = SIGNAL_STACK_SIZE;
+
+#ifdef __linux__
+ sa.ss_sp = tls->signal_stack;
+ sa.ss_size = SIGNAL_STACK_SIZE;
+ sa.ss_flags = 0;
+ g_assert (sigaltstack (&sa, NULL) == 0);
+#else
+ sigstk.ss_sp = tls->signal_stack;
+ sigstk.ss_size = SIGNAL_STACK_SIZE;
+ sigstk.ss_flags = 0;
+ g_assert (sigaltstack (&sigstk, NULL) == 0);
+#endif
+}
+
+#endif
+
+void
+mono_arch_setup_jit_tls_data (MonoJitTlsData *tls)
+{
+ if (!lmf_addr_key_inited) {
+ int res;
+
+ lmf_addr_key_inited = TRUE;
+
+#ifdef MONO_SPARC_THR_TLS
+ res = thr_keycreate (&lmf_addr_key, NULL);
+#else
+ res = pthread_key_create (&lmf_addr_key, NULL);
+#endif
+ g_assert (res == 0);
+
+ }
+
+#ifdef MONO_SPARC_THR_TLS
+ thr_setspecific (lmf_addr_key, &tls->lmf);
+#else
+ pthread_setspecific (lmf_addr_key, &tls->lmf);
+#endif
+
+#ifdef MONO_ARCH_SIGSEGV_ON_ALTSTACK
+ setup_stack (tls);
+#endif
+}
+
+void
+mono_arch_free_jit_tls_data (MonoJitTlsData *tls)
+{
+}
+
+void
+mono_arch_emit_this_vret_args (MonoCompile *cfg, MonoCallInst *call, int this_reg, int this_type, int vt_reg)
+{
+ int this_out_reg = sparc_o0;
+
+ if (vt_reg != -1) {
+#ifdef SPARCV9
+ MonoInst *ins;
+ MONO_INST_NEW (cfg, ins, OP_SETREG);
+ ins->sreg1 = vt_reg;
+ ins->dreg = mono_regstate_next_int (cfg->rs);
+ mono_bblock_add_inst (cfg->cbb, ins);
+
+ mono_call_inst_add_outarg_reg (call, ins->dreg, sparc_o0, FALSE);
+
+ this_out_reg = sparc_o1;
+#else
+ /* Set the 'struct/union return pointer' location on the stack */
+ MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STOREI4_MEMBASE_REG, sparc_sp, 64, vt_reg);
+#endif
+ }
+
+ /* add the this argument */
+ if (this_reg != -1) {
+ MonoInst *this;
+ MONO_INST_NEW (cfg, this, OP_SETREG);
+ this->type = this_type;
+ this->sreg1 = this_reg;
+ this->dreg = mono_regstate_next_int (cfg->rs);
+ mono_bblock_add_inst (cfg->cbb, this);
+
+ mono_call_inst_add_outarg_reg (call, this->dreg, this_out_reg, FALSE);
+ }
+}
+
+
+MonoInst*
+mono_arch_get_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args)
+{
+ return NULL;
+}
+
+/*
+ * mono_arch_get_argument_info:
+ * @csig: a method signature
+ * @param_count: the number of parameters to consider
+ * @arg_info: an array to store the result infos
+ *
+ * Gathers information on parameters such as size, alignment and
+ * padding. arg_info should be large enought to hold param_count + 1 entries.
+ *
+ * Returns the size of the activation frame.
+ */
+int
+mono_arch_get_argument_info (MonoMethodSignature *csig, int param_count, MonoJitArgumentInfo *arg_info)
+{
+ int k, align;
+ CallInfo *cinfo;
+ ArgInfo *ainfo;
+
+ cinfo = get_call_info (csig, FALSE);
+
+ if (csig->hasthis) {
+ ainfo = &cinfo->args [0];
+ arg_info [0].offset = ARGS_OFFSET - MONO_SPARC_STACK_BIAS + ainfo->offset;
+ }
+
+ for (k = 0; k < param_count; k++) {
+ ainfo = &cinfo->args [k + csig->hasthis];
+
+ arg_info [k + 1].offset = ARGS_OFFSET - MONO_SPARC_STACK_BIAS + ainfo->offset;
+ arg_info [k + 1].size = mono_type_size (csig->params [k], &align);
+ }
+
+ g_free (cinfo);
+
+ return 0;
+}
+
+gboolean
+mono_arch_print_tree (MonoInst *tree, int arity)
+{
+ return 0;
+}
+
+MonoInst* mono_arch_get_domain_intrinsic (MonoCompile* cfg)
+{
+ return NULL;
+}
+
+MonoInst* mono_arch_get_thread_intrinsic (MonoCompile* cfg)
+{
+ return NULL;
+}