This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [SH][PATCH] SH4 NOFPU support


Kaz Kojima wrote:
Although the use of __SH_FPU_ANY__ looks good, it'd be
better to make the patch sh4 specific.  Could you please
change sysdeps/sh/sh4/dl-trampoline.S instead of generic
sysdeps/sh/dl-trampoline.S?

Ah, sorry, I see what you're getting at now.


Here's a new version. Is this one OK?

Andrew
2009-02-03  Andrew Stubbs  <ams@codesourcery.com>

	glibc/
	* sysdeps/sh/sh4/dl-trampoline.S: Only set HAVE_FPU if __SH_FPU_ANY__
	is set.
	* sysdeps/sh/sh4/setjmp.S: Support SH4-NOFPU.
	* sysdeps/sh/sh4/__longjmp.S: Likewise.
	* sysdeps/unix/sysv/linux/sh/sh4/getcontext.S: Likewise.
	* sysdeps/unix/sysv/linux/sh/sh4/setcontext.S: Likewise.
	* sysdeps/unix/sysv/linux/sh/sh4/swapcontext.S: Likewise.
	* sysdeps/unix/sysv/linux/sh/sh4/register-dump.h: Likewise.


---
 src/glibc-mainline/sysdeps/sh/sh4/__longjmp.S                     |    5 +++++
 src/glibc-mainline/sysdeps/sh/sh4/dl-trampoline.S                 |    4 +++-
 src/glibc-mainline/sysdeps/sh/sh4/setjmp.S                        |    2 ++
 src/glibc-mainline/sysdeps/unix/sysv/linux/sh/sh4/getcontext.S    |    2 ++
 src/glibc-mainline/sysdeps/unix/sysv/linux/sh/sh4/register-dump.h |    2 ++
 src/glibc-mainline/sysdeps/unix/sysv/linux/sh/sh4/setcontext.S    |    2 ++
 src/glibc-mainline/sysdeps/unix/sysv/linux/sh/sh4/swapcontext.S   |    4 ++++
 7 files changed, 20 insertions(+), 1 deletion(-)

Index: src/glibc-mainline/sysdeps/sh/sh4/__longjmp.S
===================================================================
--- src/glibc-mainline/sysdeps/sh/sh4/__longjmp.S.orig
+++ src/glibc-mainline/sysdeps/sh/sh4/__longjmp.S
@@ -52,6 +52,7 @@ ENTRY (__longjmp)
 	mov.l	@r4+, r15
 	lds.l	@r4+, pr
 #endif
+#ifdef __SH_FPU_ANY__
 	ldc.l	@r4+, gbr
 	lds.l	@r4+, fpscr
 	fmov.s	@r4+, fr12
@@ -59,4 +60,8 @@ ENTRY (__longjmp)
 	fmov.s	@r4+, fr14
 	rts
 	 fmov.s	@r4+, fr15
+#else
+	rts
+	 ldc.l	@r4+, gbr
+#endif  /* !__SH_FPU_ANY__ */
 END (__longjmp)
Index: src/glibc-mainline/sysdeps/sh/sh4/dl-trampoline.S
===================================================================
--- src/glibc-mainline/sysdeps/sh/sh4/dl-trampoline.S.orig
+++ src/glibc-mainline/sysdeps/sh/sh4/dl-trampoline.S
@@ -1,2 +1,4 @@
-#define HAVE_FPU
+#ifdef __SH_FPU_ANY__
+# define HAVE_FPU
+#endif
 #include <sysdeps/sh/dl-trampoline.S>
Index: src/glibc-mainline/sysdeps/sh/sh4/setjmp.S
===================================================================
--- src/glibc-mainline/sysdeps/sh/sh4/setjmp.S.orig
+++ src/glibc-mainline/sysdeps/sh/sh4/setjmp.S
@@ -23,11 +23,13 @@
 ENTRY (__sigsetjmp)
 	/* Save registers */
 	add	#JB_SIZE, r4
+#ifdef __SH_FPU_ANY__
 	fmov.s	fr15, @-r4
 	fmov.s	fr14, @-r4
 	fmov.s	fr13, @-r4
 	fmov.s	fr12, @-r4
 	sts.l	fpscr, @-r4
+#endif /* __SH_FPU_ANY__ */
 	stc.l	gbr, @-r4
 #ifdef PTR_MANGLE
 	sts	pr, r2
Index: src/glibc-mainline/sysdeps/unix/sysv/linux/sh/sh4/getcontext.S
===================================================================
--- src/glibc-mainline/sysdeps/unix/sysv/linux/sh/sh4/getcontext.S.orig
+++ src/glibc-mainline/sysdeps/unix/sysv/linux/sh/sh4/getcontext.S
@@ -61,6 +61,7 @@ ENTRY(__getcontext)
 	mov.l	r9, @-r0
 	mov.l	r8, @-r0
 
+#ifdef __SH_FPU_ANY__
 	mov	r4, r0
 	/* We need 2 add instruction because oFPUL+4 > 127.  */
 	add	#124,r0
@@ -101,6 +102,7 @@ ENTRY(__getcontext)
 	fmov.s	fr2, @-r0
 	fmov.s	fr1, @-r0
 	fmov.s	fr0, @-r0
+#endif /* __SH_FPU_ANY__ */
 
 	/* sigprocmask (SIG_BLOCK, NULL, &uc->uc_sigmask).  */
 	mov	r4, r6
Index: src/glibc-mainline/sysdeps/unix/sysv/linux/sh/sh4/register-dump.h
===================================================================
--- src/glibc-mainline/sysdeps/unix/sysv/linux/sh/sh4/register-dump.h.orig
+++ src/glibc-mainline/sysdeps/unix/sysv/linux/sh/sh4/register-dump.h
@@ -144,6 +144,7 @@ register_dump (int fd, struct sigcontext
 
   ADD_STRING ("\n");
 
+#ifdef __SH_FPU_ANY__
   if (ctx->sc_ownedfp != NULL)
     {
       hexvalue (ctx->sc_fpregs[0], fpregs[0], 8);
@@ -253,6 +254,7 @@ register_dump (int fd, struct sigcontext
 
       ADD_STRING ("\n");
     }
+#endif /* __SH_FPU_ANY__  */
 
   /* Write the stuff out.  */
   writev (fd, iov, nr);
Index: src/glibc-mainline/sysdeps/unix/sysv/linux/sh/sh4/setcontext.S
===================================================================
--- src/glibc-mainline/sysdeps/unix/sysv/linux/sh/sh4/setcontext.S.orig
+++ src/glibc-mainline/sysdeps/unix/sysv/linux/sh/sh4/setcontext.S
@@ -50,6 +50,7 @@ ENTRY(__setcontext)
 	 nop
 
 .Lsetcontext_restore:
+#ifdef __SH_FPU_ANY__
 	mov	r8, r0
 	add	#(oFR0),r0
 	fmov.s	@r0+, fr0
@@ -88,6 +89,7 @@ ENTRY(__setcontext)
 	frchg
 	lds.l	@r0+, fpscr
 	lds.l	@r0+, fpul
+#endif /* __SH_FPU_ANY__ */
 
 	mov	r8, r0
 	add	#(oPC), r0
Index: src/glibc-mainline/sysdeps/unix/sysv/linux/sh/sh4/swapcontext.S
===================================================================
--- src/glibc-mainline/sysdeps/unix/sysv/linux/sh/sh4/swapcontext.S.orig
+++ src/glibc-mainline/sysdeps/unix/sysv/linux/sh/sh4/swapcontext.S
@@ -61,6 +61,7 @@ ENTRY(__swapcontext)
 	mov.l	r9, @-r0
 	mov.l	r8, @-r0
 
+#ifdef __SH_FPU_ANY__
 	mov	r4, r0
 	/* We need 2 add instruction because oFPUL+4 >= 127.  */
 	add	#124,r0
@@ -101,6 +102,7 @@ ENTRY(__swapcontext)
 	fmov.s	fr2, @-r0
 	fmov.s	fr1, @-r0
 	fmov.s	fr0, @-r0
+#endif /* __SH_FPU_ANY__ */
 
 	mov	r5, r8
 
@@ -125,6 +127,7 @@ ENTRY(__swapcontext)
 	rts
 	 nop
 .Lswapcontext_restore:	
+#ifdef __SH_FPU_ANY__
 	mov	r8, r0
 	add	#(oFR0),r0
 	fmov.s	@r0+, fr0
@@ -163,6 +166,7 @@ ENTRY(__swapcontext)
 	frchg
 	lds.l	@r0+, fpscr
 	lds.l	@r0+, fpul
+#endif /* __SH_FPU_ANY__ */
 
 	mov	r8, r0
 	add	#(oPC), r0

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]