about summary refs log tree commit diff
path: root/sysdeps/sh
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/sh')
-rw-r--r--sysdeps/sh/bits/setjmp.h11
-rw-r--r--sysdeps/sh/jmpbuf-offsets.h20
-rw-r--r--sysdeps/sh/jmpbuf-unwind.h47
-rw-r--r--sysdeps/sh/sh3/__longjmp.S17
-rw-r--r--sysdeps/sh/sh3/setjmp.S17
-rw-r--r--sysdeps/sh/sh4/__longjmp.S17
-rw-r--r--sysdeps/sh/sh4/fpu/libm-test-ulps4
-rw-r--r--sysdeps/sh/sh4/setjmp.S17
8 files changed, 116 insertions, 34 deletions
diff --git a/sysdeps/sh/bits/setjmp.h b/sysdeps/sh/bits/setjmp.h
index 8ebb5c598e..7e3fbd3394 100644
--- a/sysdeps/sh/bits/setjmp.h
+++ b/sysdeps/sh/bits/setjmp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000, 2003, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1999,2000,2003,2005,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -44,13 +44,4 @@ typedef struct
   } __jmp_buf[1];
 #endif
 
-#if defined __USE_MISC || defined _ASM
-# define JB_SIZE		(4 * 15)
-#endif
-
-/* Test if longjmp to JMPBUF would unwind the frame
-   containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address, demangle)		\
-  ((void *) (address) < (void *) demangle ((jmpbuf)[0].__regs[7]))
-
 #endif  /* bits/setjmp.h */
diff --git a/sysdeps/sh/jmpbuf-offsets.h b/sysdeps/sh/jmpbuf-offsets.h
new file mode 100644
index 0000000000..312051e7eb
--- /dev/null
+++ b/sysdeps/sh/jmpbuf-offsets.h
@@ -0,0 +1,20 @@
+/* Private macros for accessing __jmp_buf contents.  SH version.
+   Copyright (C) 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#define JB_SIZE		(4 * 15)
diff --git a/sysdeps/sh/jmpbuf-unwind.h b/sysdeps/sh/jmpbuf-unwind.h
new file mode 100644
index 0000000000..a69a465efc
--- /dev/null
+++ b/sysdeps/sh/jmpbuf-unwind.h
@@ -0,0 +1,47 @@
+/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <setjmp.h>
+#include <stdint.h>
+#include <unwind.h>
+#include <sysdep.h>
+
+/* Test if longjmp to JMPBUF would unwind the frame
+   containing a local variable at ADDRESS.  */
+#define _JMPBUF_UNWINDS(jmpbuf, address, demangle)		\
+  ((void *) (address) < (void *) demangle ((jmpbuf)[0].__regs[7]))
+
+#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
+  _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
+
+static inline uintptr_t __attribute__ ((unused))
+_jmpbuf_sp (__jmp_buf regs)
+{
+  uintptr_t sp = regs[0].__regs[7];
+#ifdef PTR_DEMANGLE
+  PTR_DEMANGLE (sp);
+#endif
+  return sp;
+}
+
+#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
+  ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj))
+
+/* We use the normal longjmp for unwinding.  */
+#define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val)
diff --git a/sysdeps/sh/sh3/__longjmp.S b/sysdeps/sh/sh3/__longjmp.S
index 08d39d02dd..c6d8a3214c 100644
--- a/sysdeps/sh/sh3/__longjmp.S
+++ b/sysdeps/sh/sh3/__longjmp.S
@@ -1,5 +1,5 @@
 /* longjmp for SH.
-   Copyright (C) 1999, 2000, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -30,19 +30,26 @@ ENTRY (__longjmp)
 	mov.l	@r4+, r10
 	mov.l	@r4+, r11
 	mov.l	@r4+, r12
-	mov.l	@r4+, r13
-	mov.l	@r4+, r14
 	mov	r5, r0		/* get the return value in place */
 	tst	r0, r0
 	bf.s	1f
-	 mov.l	@r4+, r15
+	 mov.l	@r4+, r13
 	mov	#1,r0		/* can't let setjmp() return zero! */
 1:
 #ifdef PTR_DEMANGLE
 	mov.l	@r4+, r2
-	PTR_DEMANGLE (r2)
+	PTR_DEMANGLE (r2, r1)
+	mov	r2, r14
+	mov.l	@r4+, r2
+	PTR_DEMANGLE2 (r2, r1)
+	mov	r2, r15
+	mov.l	@r4+, r2
+	PTR_DEMANGLE2 (r2, r1)
 	lds	r2, pr
+	mov	#0, r1
 #else
+	mov.l	@r4+, r14
+	mov.l	@r4+, r15
 	lds.l	@r4+, pr
 #endif
 	rts
diff --git a/sysdeps/sh/sh3/setjmp.S b/sysdeps/sh/sh3/setjmp.S
index f60ca874cf..d04e4b851f 100644
--- a/sysdeps/sh/sh3/setjmp.S
+++ b/sysdeps/sh/sh3/setjmp.S
@@ -1,5 +1,5 @@
 /* setjmp for SH3.
-   Copyright (C) 1999, 2000, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -18,9 +18,7 @@
    02111-1307 USA.  */
 
 #include <sysdep.h>
-#define _SETJMP_H
-#define _ASM
-#include <bits/setjmp.h>
+#include <jmpbuf-offsets.h>
 
 ENTRY (__sigsetjmp)
 	/* Save registers */
@@ -28,13 +26,20 @@ ENTRY (__sigsetjmp)
 	stc.l	gbr, @-r4
 #ifdef PTR_MANGLE
 	sts	pr, r2
-	PTR_MANGLE (r2)
+	PTR_MANGLE (r2, r1)
 	mov.l	r2, @-r4
+	mov	r15, r2
+	PTR_MANGLE2 (r2, r1)
+	mov.l	r2, @-r4
+	mov	r14, r2
+	PTR_MANGLE2 (r2, r1)
+	mov.l	r2, @-r4
+	mov	#0, r1
 #else
 	sts.l	pr, @-r4
-#endif
 	mov.l	r15, @-r4
 	mov.l	r14, @-r4
+#endif
 	mov.l	r13, @-r4
 	mov.l	r12, @-r4
 	mov.l	r11, @-r4
diff --git a/sysdeps/sh/sh4/__longjmp.S b/sysdeps/sh/sh4/__longjmp.S
index cc525952f7..320a7d11f7 100644
--- a/sysdeps/sh/sh4/__longjmp.S
+++ b/sysdeps/sh/sh4/__longjmp.S
@@ -1,5 +1,5 @@
 /* longjmp for SH.
-   Copyright (C) 1999, 2000, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -30,19 +30,26 @@ ENTRY (__longjmp)
 	mov.l	@r4+, r10
 	mov.l	@r4+, r11
 	mov.l	@r4+, r12
-	mov.l	@r4+, r13
-	mov.l	@r4+, r14
 	mov	r5, r0		/* get the return value in place */
 	tst	r0, r0
 	bf.s	1f
-	 mov.l	@r4+, r15
+	 mov.l	@r4+, r13
 	mov	#1,r0		/* can't let setjmp() return zero! */
 1:
 #ifdef PTR_DEMANGLE
 	mov.l	@r4+, r2
-	PTR_DEMANGLE (r2)
+	PTR_DEMANGLE (r2, r1)
+	mov	r2, r14
+	mov.l	@r4+, r2
+	PTR_DEMANGLE2 (r2, r1)
+	mov	r2, r15
+	mov.l	@r4+, r2
+	PTR_DEMANGLE2 (r2, r1)
 	lds	r2, pr
+	mov	#0, r1
 #else
+	mov.l	@r4+, r14
+	mov.l	@r4+, r15
 	lds.l	@r4+, pr
 #endif
 	ldc.l	@r4+, gbr
diff --git a/sysdeps/sh/sh4/fpu/libm-test-ulps b/sysdeps/sh/sh4/fpu/libm-test-ulps
index 3dd37f1309..4831f4849b 100644
--- a/sysdeps/sh/sh4/fpu/libm-test-ulps
+++ b/sysdeps/sh/sh4/fpu/libm-test-ulps
@@ -60,12 +60,12 @@ float: 1
 ifloat: 1
 
 # cacosh
-Test "Real part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
 double: 1
 float: 7
 idouble: 1
 ifloat: 7
-Test "Imaginary part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
 double: 1
 float: 3
 idouble: 1
diff --git a/sysdeps/sh/sh4/setjmp.S b/sysdeps/sh/sh4/setjmp.S
index b8853496f1..f9a4f0a8ce 100644
--- a/sysdeps/sh/sh4/setjmp.S
+++ b/sysdeps/sh/sh4/setjmp.S
@@ -1,5 +1,5 @@
 /* setjmp for SH4.
-   Copyright (C) 1999, 2000, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -18,9 +18,7 @@
    02111-1307 USA.  */
 
 #include <sysdep.h>
-#define _SETJMP_H
-#define _ASM
-#include <bits/setjmp.h>
+#include <jmpbuf-offsets.h>
 
 ENTRY (__sigsetjmp)
 	/* Save registers */
@@ -33,13 +31,20 @@ ENTRY (__sigsetjmp)
 	stc.l	gbr, @-r4
 #ifdef PTR_MANGLE
 	sts	pr, r2
-	PTR_MANGLE (r2)
+	PTR_MANGLE (r2, r1)
 	mov.l	r2, @-r4
+	mov	r15, r2
+	PTR_MANGLE2 (r2, r1)
+	mov.l	r2, @-r4
+	mov	r14, r2
+	PTR_MANGLE2 (r2, r1)
+	mov.l	r2, @-r4
+	mov	#0, r1
 #else
 	sts.l	pr, @-r4
-#endif
 	mov.l	r15, @-r4
 	mov.l	r14, @-r4
+#endif
 	mov.l	r13, @-r4
 	mov.l	r12, @-r4
 	mov.l	r11, @-r4