Skip to content

Commit

Permalink
Merge pull request #58 from madisongh/master
Browse files Browse the repository at this point in the history
Re-code the saving of the gp register for MIPS64 so it compiles
  • Loading branch information
snaury committed Sep 20, 2014
2 parents e13c4db + 4d8bc09 commit 1eef4bf
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions platform/switch_mips_unix.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,19 @@

#define STACK_MAGIC 0

#ifdef __mips64
#define REGS_TO_SAVE "$16", "$17", "$18", "$19", "$20", "$21", "$22", \
"$23", "$28", "$30"
#else
#define REGS_TO_SAVE "$16", "$17", "$18", "$19", "$20", "$21", "$22", \
"$23", "$30"
#endif
static int
slp_switch(void)
{
register int *stackref, stsizediff;
#ifdef __mips64
uint64_t gpsave;
#endif
__asm__ __volatile__ ("" : : : REGS_TO_SAVE);
#ifdef __mips64
__asm__ __volatile__ ("sd $28,%0" : "=m" (gpsave) : : );
#endif
__asm__ ("move %0, $29" : "=r" (stackref) : );
{
SLP_SAVE_STATE(stackref, stsizediff);
Expand All @@ -38,6 +39,9 @@ slp_switch(void)
);
SLP_RESTORE_STATE();
}
#ifdef __mips64
__asm__ __volatile__ ("ld $28,%0" : : "m" (gpsave) : );
#endif
__asm__ __volatile__ ("" : : : REGS_TO_SAVE);
return 0;
}
Expand Down

0 comments on commit 1eef4bf

Please sign in to comment.