Initial sgen mips port.
authorPaolo Molaro <lupus@oddwiz.org>
Thu, 1 Dec 2011 08:56:28 +0000 (08:56 +0000)
committerPaolo Molaro <lupus@oddwiz.org>
Thu, 1 Dec 2011 08:58:08 +0000 (08:58 +0000)
configure.in
mono/metadata/sgen-archdep.h
mono/metadata/sgen-cardtable.c
mono/utils/mono-sigcontext.h

index 6cf9f416d4aa7c963aa4fda6de5379a44b4e1f49..a43d7aa1f1462d9d4a25b451fedd5a29fd15685e 100644 (file)
@@ -2173,6 +2173,7 @@ case "$host" in
        mips*)
                TARGET=MIPS;
                arch_target=mips;
+               sgen_supported=true
                ACCESS_UNALIGNED="no"
                JIT_SUPPORTED=yes
 
index d153b3d89d8ccd288c3bcfe738f0547e736974b4..4c558a418b294ec27821e65e859c4b3bd4a24e04 100644 (file)
        ((a)[13]) = (gpointer) (UCONTEXT_REG_LR((ctx)));        \
        } while (0)
 
+#elif defined(__mips__)
+
+#define REDZONE_SIZE   0
+
+/* register 0 is always 0, so we skip it */
+#define ARCH_NUM_REGS 31
+#define ARCH_STORE_REGS(ptr)           \
+       __asm__ __volatile__(   \
+               "sw $1,0(%0)\n\t"       \
+               "sw $2,4(%0)\n\t"       \
+               "sw $3,8(%0)\n\t"       \
+               "sw $4,12(%0)\n\t"      \
+               "sw $5,16(%0)\n\t"      \
+               "sw $6,20(%0)\n\t"      \
+               "sw $7,24(%0)\n\t"      \
+               "sw $8,28(%0)\n\t"      \
+               "sw $9,32(%0)\n\t"      \
+               "sw $10,36(%0)\n\t"     \
+               "sw $11,40(%0)\n\t"     \
+               "sw $12,44(%0)\n\t"     \
+               "sw $13,48(%0)\n\t"     \
+               "sw $14,52(%0)\n\t"     \
+               "sw $15,56(%0)\n\t"     \
+               "sw $16,60(%0)\n\t"     \
+               "sw $17,64(%0)\n\t"     \
+               "sw $18,68(%0)\n\t"     \
+               "sw $19,72(%0)\n\t"     \
+               "sw $20,76(%0)\n\t"     \
+               "sw $21,80(%0)\n\t"     \
+               "sw $22,84(%0)\n\t"     \
+               "sw $23,88(%0)\n\t"     \
+               "sw $24,92(%0)\n\t"     \
+               "sw $25,96(%0)\n\t"     \
+               "sw $26,100(%0)\n\t"    \
+               "sw $27,104(%0)\n\t"    \
+               "sw $28,108(%0)\n\t"    \
+               "sw $29,112(%0)\n\t"    \
+               "sw $30,116(%0)\n\t"    \
+               "sw $31,120(%0)\n\t"    \
+               :                       \
+               : "r" (ptr)             \
+               : "memory"                      \
+       )
+
+#define ARCH_SIGCTX_SP(ctx)    (UCONTEXT_GREGS((ctx))[29])
+#define ARCH_SIGCTX_IP(ctx)    (UCONTEXT_REG_PC((ctx)))
+#define ARCH_COPY_SIGCTX_REGS(a,ctx) do {                      \
+       int __regnum;   \
+       for (__regnum = 0; __regnum < 32; ++__regnum)   \
+               ((a)[__regnum]) = (gpointer) (UCONTEXT_GREGS((ctx))[__regnum]);         \
+       } while (0)
+
 #elif defined(__s390x__)
 
 #define REDZONE_SIZE   0
index ec4cbbcd1e6075ab2177014308844d809ee27e7c..5695e6669701d51a4cd5869d04c3250e413e9147 100644 (file)
@@ -345,16 +345,12 @@ find_card_offset (mword card)
 #elif defined(__s390x__)
        return (__builtin_ffsll (GUINT64_TO_LE(card)) - 1) / 8;
 #else
-       // FIXME:
-       g_assert_not_reached ();
-       /*
        int i;
        guint8 *ptr = (guint *) &card;
        for (i = 0; i < sizeof (mword); ++i) {
                if (ptr[i])
                        return i;
        }
-       */
        return 0;
 #endif
 }
index 0c525b9c92f90996b25b119dbfafa7679843a604..bde60d12970759e956cdb4c6da86874d906e220e 100644 (file)
@@ -354,6 +354,15 @@ typedef struct ucontext {
        #define UCONTEXT_REG_R12(ctx) (((arm_ucontext*)(ctx))->sig_ctx.arm_ip)
        #define UCONTEXT_REG_CPSR(ctx) (((arm_ucontext*)(ctx))->sig_ctx.arm_cpsr)
 #endif
+#elif defined(__mips__)
+
+# if HAVE_UCONTEXT_H
+#  include <ucontext.h>
+# endif
+
+# define UCONTEXT_GREGS(ctx)   (((ucontext_t *)(ctx))->uc_mcontext.gregs)
+# define UCONTEXT_REG_PC(ctx)  (((ucontext_t *)(ctx))->uc_mcontext.pc)
+
 #elif defined(__s390x__)
 
 # if HAVE_UCONTEXT_H