From a00d2722b6e776f074c4dc70b5c84aceb8fae311 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Tue, 26 Nov 2013 19:58:19 +0000 Subject: [PATCH] 2013-11-26 Matheus Almeida * libc/include/machine/setjmp.h: Add support for __mips_fpr being 64 and treat it the same as if __mips64 is set. * libc/machine/mips/setjmp.S: Ditto, plus add checks for _MIPS_SIM being _ABIN32 and _ABI64. --- newlib/ChangeLog | 7 ++++++ newlib/libc/include/machine/setjmp.h | 16 +++++++------- newlib/libc/machine/mips/setjmp.S | 33 ++++++++++++++++++++++++---- 3 files changed, 44 insertions(+), 12 deletions(-) diff --git a/newlib/ChangeLog b/newlib/ChangeLog index edd470a5d..f17173ce0 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,10 @@ +2013-11-26 Matheus Almeida + + * libc/include/machine/setjmp.h: Add support for __mips_fpr being + 64 and treat it the same as if __mips64 is set. + * libc/machine/mips/setjmp.S: Ditto, plus add checks for _MIPS_SIM + being _ABIN32 and _ABI64. + 2013-11-26 Joel Sherrill * libc/machine/powerpc/vfscanf.c, libc/stdio/fgetpos.c, diff --git a/newlib/libc/include/machine/setjmp.h b/newlib/libc/include/machine/setjmp.h index fee409cd7..73ccd94be 100644 --- a/newlib/libc/include/machine/setjmp.h +++ b/newlib/libc/include/machine/setjmp.h @@ -106,14 +106,14 @@ _BEGIN_STD_C #endif #ifdef __mips__ -#ifdef __mips64 -#define _JBTYPE long long -#endif -#ifdef __mips_soft_float -#define _JBLEN 11 -#else -#define _JBLEN 23 -#endif +# if defined(__mips64) || (__mips_fpr == 64) +# define _JBTYPE long long +# endif +# ifdef __mips_soft_float +# define _JBLEN 11 +# else +# define _JBLEN 23 +# endif #endif #ifdef __m88000__ diff --git a/newlib/libc/machine/mips/setjmp.S b/newlib/libc/machine/mips/setjmp.S index 268cb1862..f2155ca04 100644 --- a/newlib/libc/machine/mips/setjmp.S +++ b/newlib/libc/machine/mips/setjmp.S @@ -23,6 +23,24 @@ #define NUM_GPRS_SAVED 11 #ifdef __mips_hard_float +#if _MIPS_SIM == _ABIN32 + FPR_OFFSET ($f20, 0); \ + FPR_OFFSET ($f22, 1); \ + FPR_OFFSET ($f24, 2); \ + FPR_OFFSET ($f26, 3); \ + FPR_OFFSET ($f28, 4); \ + FPR_OFFSET ($f30, 5); +#elif _MIPS_SIM == _ABI64 +#define FPR_LAYOUT \ + FPR_OFFSET ($f24, 0); \ + FPR_OFFSET ($f25, 1); \ + FPR_OFFSET ($f26, 2); \ + FPR_OFFSET ($f27, 3); \ + FPR_OFFSET ($f28, 4); \ + FPR_OFFSET ($f29, 5); \ + FPR_OFFSET ($f30, 6); \ + FPR_OFFSET ($f31, 7); +#else /* Assuming _MIPS_SIM == _ABIO32 */ #define FPR_LAYOUT \ FPR_OFFSET ($f20, 0); \ FPR_OFFSET ($f21, 1); \ @@ -35,11 +53,12 @@ FPR_OFFSET ($f28, 8); \ FPR_OFFSET ($f29, 9); \ FPR_OFFSET ($f30, 10); \ - FPR_OFFSET ($f31, 11) + FPR_OFFSET ($f31, 11); +#endif #else #define FPR_LAYOUT #endif - + #ifdef __mips64 #define BYTES_PER_WORD 8 #define LOAD_GPR ld @@ -47,12 +66,18 @@ #define STORE_GPR sd #define STORE_FPR sdc1 #else -#define BYTES_PER_WORD 4 #define LOAD_GPR lw -#define LOAD_FPR lwc1 #define STORE_GPR sw +#if __mips_fpr == 64 +#define BYTES_PER_WORD 8 +#define LOAD_FPR l.d +#define STORE_FPR s.d +#else +#define BYTES_PER_WORD 4 +#define LOAD_FPR lwc1 #define STORE_FPR swc1 #endif +#endif #define GPOFF(INDEX) (INDEX * BYTES_PER_WORD) #define FPOFF(INDEX) ((INDEX + NUM_GPRS_SAVED) * BYTES_PER_WORD)