Skip to content

Commit

Permalink
Initial sgen mips port.
Browse files Browse the repository at this point in the history
  • Loading branch information
illupus committed Dec 1, 2011
1 parent 08bf9c5 commit 45b28d0
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 4 deletions.
1 change: 1 addition & 0 deletions configure.in
Expand Up @@ -2173,6 +2173,7 @@ case "$host" in
mips*)
TARGET=MIPS;
arch_target=mips;
sgen_supported=true
ACCESS_UNALIGNED="no"
JIT_SUPPORTED=yes

Expand Down
52 changes: 52 additions & 0 deletions mono/metadata/sgen-archdep.h
Expand Up @@ -134,6 +134,58 @@
((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
Expand Down
4 changes: 0 additions & 4 deletions mono/metadata/sgen-cardtable.c
Expand Up @@ -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
}
Expand Down
9 changes: 9 additions & 0 deletions mono/utils/mono-sigcontext.h
Expand Up @@ -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
Expand Down

0 comments on commit 45b28d0

Please sign in to comment.