Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2002-02-08 10:11:13 +0300
committerAlexandre Oliva <aoliva@redhat.com>2002-02-08 10:11:13 +0300
commit9f25eed9c96cb37ee58fcb65aafb44f9c6183dde (patch)
tree883185ab319291de419f4bba42754e7a71b23560 /newlib/libc/machine/sh
parent561486e7f1220b06414524d9b72eca3794a45dd3 (diff)
Contribute sh64-elf.
2001-03-13 Alexandre Oliva <aoliva@redhat.com> * configure.host (newlib_cflags) [sh*-*-*]: Enable long long support in printf. 2001-01-29 Alexandre Oliva <aoliva@redhat.com> * libc/machine/sh/setjmp.S [SH5]: Switch to SHmedia mode before any labels. 2001-01-24 Alexandre Oliva <aoliva@redhat.com> * libc/sys/sh/trap.S (___trap34) [SH5]: Don't trash r2. 2000-12-16 Alexandre Oliva <aoliva@redhat.com> * libc/machine/sh/configure.in: Rework conditionals. * libc/machine/sh/Makefile.am: Likewise. * libc/machine/sh/configure, libc/machine/sh/Makefile.in: Rebuilt. 2000-12-01 Alexandre Oliva <aoliva@redhat.com> * configure.host: Match `sh*'. * libc/include/machine/setjmp.h: Define for SH5. * libc/machine/sh/configure.in: Detect SH5. * libc/machine/sh/configure: Rebuilt. * libc/machine/sh/Makefile.am: Use only setjmp.S for SH5. * libc/machine/sh/Makefile.in: Rebuilt. * libc/machine/sh/asm.h: Adjust for SH5. * libc/machine/sh/setjmp.S: Implement in SHmedia. * libc/sys/sh/crt0.S: Likewise. * libc/sys/sh/trap.S: Likewise.
Diffstat (limited to 'newlib/libc/machine/sh')
-rw-r--r--newlib/libc/machine/sh/Makefile.am4
-rw-r--r--newlib/libc/machine/sh/Makefile.in8
-rw-r--r--newlib/libc/machine/sh/asm.h11
-rwxr-xr-xnewlib/libc/machine/sh/configure114
-rw-r--r--newlib/libc/machine/sh/configure.in7
-rw-r--r--newlib/libc/machine/sh/setjmp.S134
6 files changed, 274 insertions, 4 deletions
diff --git a/newlib/libc/machine/sh/Makefile.am b/newlib/libc/machine/sh/Makefile.am
index 1aab718dd..9cb529347 100644
--- a/newlib/libc/machine/sh/Makefile.am
+++ b/newlib/libc/machine/sh/Makefile.am
@@ -6,7 +6,11 @@ INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
noinst_LIBRARIES = lib.a
+if SH64
+lib_a_SOURCES = setjmp.S
+else
lib_a_SOURCES = memcpy.S memset.S setjmp.S strcpy.S strcmp.S
+endif
memcpy.o: asm.h
memset.o: asm.h
diff --git a/newlib/libc/machine/sh/Makefile.in b/newlib/libc/machine/sh/Makefile.in
index 5d4b826cd..e6998feec 100644
--- a/newlib/libc/machine/sh/Makefile.in
+++ b/newlib/libc/machine/sh/Makefile.in
@@ -83,8 +83,8 @@ AUTOMAKE_OPTIONS = cygnus
INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = memcpy.S memset.S setjmp.S strcpy.S strcmp.S
+@SH64_TRUE@lib_a_SOURCES = @SH64_TRUE@setjmp.S
+@SH64_FALSE@lib_a_SOURCES = @SH64_FALSE@memcpy.S memset.S setjmp.S strcpy.S strcmp.S
ACLOCAL_AMFLAGS = -I ../../..
CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
@@ -98,7 +98,9 @@ DEFS = @DEFS@ -I. -I$(srcdir)
CPPFLAGS = @CPPFLAGS@
LIBS = @LIBS@
lib_a_LIBADD =
-lib_a_OBJECTS = memcpy.o memset.o setjmp.o strcpy.o strcmp.o
+@SH64_TRUE@lib_a_OBJECTS = setjmp.o
+@SH64_FALSE@lib_a_OBJECTS = memcpy.o memset.o setjmp.o strcpy.o \
+@SH64_FALSE@strcmp.o
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
diff --git a/newlib/libc/machine/sh/asm.h b/newlib/libc/machine/sh/asm.h
index ed27fdb1e..cfdaa812b 100644
--- a/newlib/libc/machine/sh/asm.h
+++ b/newlib/libc/machine/sh/asm.h
@@ -5,8 +5,19 @@
#endif
#define _ASM_LABEL(x) x
+#if __SH5__
+# if __SH5__ == 32 && __SHMEDIA__
+# define TEXT .section .text..SHmedia32, "ax"
+# else
+# define TEXT .text
+# endif
+
+# define _ENTRY(name) \
+ TEXT; .align 4; .globl name; name:
+#else
#define _ENTRY(name) \
.text; .align 2; .globl name; name:
+#endif /* __SH5__ */
#define ENTRY(name) \
_ENTRY(_C_LABEL(name))
diff --git a/newlib/libc/machine/sh/configure b/newlib/libc/machine/sh/configure
index 6d988d60f..3dda65e59 100755
--- a/newlib/libc/machine/sh/configure
+++ b/newlib/libc/machine/sh/configure
@@ -1425,6 +1425,115 @@ fi
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:1430: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # This must be in double quotes, not single quotes, because CPP may get
+ # substituted into the Makefile and "${CC-cc}" will confuse make.
+ CPP="${CC-cc} -E"
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp.
+ cat > conftest.$ac_ext <<EOF
+#line 1445 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1451: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -E -traditional-cpp"
+ cat > conftest.$ac_ext <<EOF
+#line 1462 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1468: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -nologo -E"
+ cat > conftest.$ac_ext <<EOF
+#line 1479 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1485: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+ ac_cv_prog_CPP="$CPP"
+fi
+ CPP="$ac_cv_prog_CPP"
+else
+ ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+cat > conftest.$ac_ext <<EOF
+#line 1510 "configure"
+#include "confdefs.h"
+
+#if __SH5__
+ sh5
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "sh5" >/dev/null 2>&1; then
+ rm -rf conftest*
+ have_sh64=yes
+else
+ rm -rf conftest*
+ have_sh64=no
+fi
+rm -f conftest*
+
+
+
+if test $have_sh64 = yes; then
+ SH64_TRUE=
+ SH64_FALSE='#'
+else
+ SH64_TRUE='#'
+ SH64_FALSE=
+fi
+
trap '' 1 2 15
cat > confcache <<\EOF
# This file is a shell script that caches the results of configure
@@ -1608,6 +1717,9 @@ s%@aext@%$aext%g
s%@libm_machine_dir@%$libm_machine_dir%g
s%@machine_dir@%$machine_dir%g
s%@sys_dir@%$sys_dir%g
+s%@CPP@%$CPP%g
+s%@SH64_TRUE@%$SH64_TRUE%g
+s%@SH64_FALSE@%$SH64_FALSE%g
CEOF
EOF
@@ -1616,7 +1728,7 @@ cat >> $CONFIG_STATUS <<\EOF
# Split the substitutions into bite-sized pieces for seds with
# small command number limits, like on Digital OSF/1 and HP-UX.
-ac_max_sed_cmds=60 # Maximum number of lines to put in a sed script.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
ac_file=1 # Number of current file.
ac_beg=1 # First line for current file.
ac_end=$ac_max_sed_cmds # Line after last line for current file.
diff --git a/newlib/libc/machine/sh/configure.in b/newlib/libc/machine/sh/configure.in
index ffd27974d..7fb5afd0e 100644
--- a/newlib/libc/machine/sh/configure.in
+++ b/newlib/libc/machine/sh/configure.in
@@ -9,4 +9,11 @@ AC_CONFIG_AUX_DIR(../../../..)
NEWLIB_CONFIGURE(../../..)
+AC_EGREP_CPP([sh5], [
+#if __SH5__
+ sh5
+#endif
+], [have_sh64=yes], [have_sh64=no])
+AM_CONDITIONAL(SH64, [test $have_sh64 = yes])
+
AC_OUTPUT(Makefile)
diff --git a/newlib/libc/machine/sh/setjmp.S b/newlib/libc/machine/sh/setjmp.S
index 363e8f23b..9508496f1 100644
--- a/newlib/libc/machine/sh/setjmp.S
+++ b/newlib/libc/machine/sh/setjmp.S
@@ -1,6 +1,77 @@
+/* We want to pretend we're in SHmedia mode, even when assembling for
+ SHcompact. */
+#if __SH5__ == 32 && ! __SHMEDIA__
+# undef __SHMEDIA__
+# define __SHMEDIA__ 1
+#endif
+
+#if __SHMEDIA__
+ .mode SHmedia
+#endif
+
#include "asm.h"
ENTRY(setjmp)
+#if __SH5__
+ ptabs r18, tr0
+ gettr tr5, r5
+ gettr tr6, r6
+ gettr tr7, r7
+ st.q r2, 0*8, r18
+ st.q r2, 1*8, r10
+ st.q r2, 2*8, r11
+ st.q r2, 3*8, r12
+ st.q r2, 4*8, r13
+ st.q r2, 5*8, r14
+ st.q r2, 6*8, r15
+ st.q r2, 7*8, r28
+ st.q r2, 8*8, r29
+ st.q r2, 9*8, r30
+ st.q r2, 10*8, r31
+ st.q r2, 11*8, r32
+ st.q r2, 12*8, r33
+ st.q r2, 13*8, r34
+ st.q r2, 14*8, r35
+ st.q r2, 15*8, r44
+ st.q r2, 16*8, r45
+ st.q r2, 17*8, r46
+ st.q r2, 18*8, r47
+ st.q r2, 19*8, r48
+ st.q r2, 20*8, r49
+ st.q r2, 21*8, r50
+ st.q r2, 22*8, r51
+ st.q r2, 23*8, r52
+ st.q r2, 24*8, r53
+ st.q r2, 25*8, r54
+ st.q r2, 26*8, r55
+ st.q r2, 27*8, r56
+ st.q r2, 28*8, r57
+ st.q r2, 29*8, r58
+ st.q r2, 30*8, r59
+ st.q r2, 31*8, r5
+ st.q r2, 32*8, r6
+ st.q r2, 33*8, r7
+#if ! __SH4_NOFPU__
+ fst.d r2, 34*8, dr12
+ fst.d r2, 35*8, dr14
+ fst.d r2, 36*8, dr36
+ fst.d r2, 37*8, dr38
+ fst.d r2, 38*8, dr40
+ fst.d r2, 39*8, dr42
+ fst.d r2, 40*8, dr44
+ fst.d r2, 41*8, dr46
+ fst.d r2, 42*8, dr48
+ fst.d r2, 43*8, dr50
+ fst.d r2, 44*8, dr52
+ fst.d r2, 45*8, dr54
+ fst.d r2, 46*8, dr56
+ fst.d r2, 47*8, dr58
+ fst.d r2, 48*8, dr60
+ fst.d r2, 49*8, dr62
+#endif
+ movi 0, r2
+ blink tr0, r63
+#else
#if defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__)
add #(13*4),r4
#else
@@ -28,8 +99,70 @@ ENTRY(setjmp)
rts
mov #0,r0
+#endif /* __SH5__ */
ENTRY(longjmp)
+#if __SH5__
+ ld.q r2, 0*8, r18
+ ptabs r18, tr0
+ ld.q r2, 1*8, r10
+ ld.q r2, 2*8, r11
+ ld.q r2, 3*8, r12
+ ld.q r2, 4*8, r13
+ ld.q r2, 5*8, r14
+ ld.q r2, 6*8, r15
+ ld.q r2, 7*8, r28
+ ld.q r2, 8*8, r29
+ ld.q r2, 9*8, r30
+ ld.q r2, 10*8, r31
+ ld.q r2, 11*8, r32
+ ld.q r2, 12*8, r33
+ ld.q r2, 13*8, r34
+ ld.q r2, 14*8, r35
+ ld.q r2, 15*8, r44
+ ld.q r2, 16*8, r45
+ ld.q r2, 17*8, r46
+ ld.q r2, 18*8, r47
+ ld.q r2, 19*8, r48
+ ld.q r2, 20*8, r49
+ ld.q r2, 21*8, r50
+ ld.q r2, 22*8, r51
+ ld.q r2, 23*8, r52
+ ld.q r2, 24*8, r53
+ ld.q r2, 25*8, r54
+ ld.q r2, 26*8, r55
+ ld.q r2, 27*8, r56
+ ld.q r2, 28*8, r57
+ ld.q r2, 29*8, r58
+ ld.q r2, 30*8, r59
+ ld.q r2, 31*8, r5
+ ld.q r2, 32*8, r6
+ ld.q r2, 33*8, r7
+ ptabs r5, tr5
+ ptabs r6, tr6
+ ptabs r7, tr7
+#if ! __SH4_NOFPU__
+ fld.d r2, 34*8, dr12
+ fld.d r2, 35*8, dr14
+ fld.d r2, 36*8, dr36
+ fld.d r2, 37*8, dr38
+ fld.d r2, 38*8, dr40
+ fld.d r2, 39*8, dr42
+ fld.d r2, 40*8, dr44
+ fld.d r2, 41*8, dr46
+ fld.d r2, 42*8, dr48
+ fld.d r2, 43*8, dr50
+ fld.d r2, 44*8, dr52
+ fld.d r2, 45*8, dr54
+ fld.d r2, 46*8, dr56
+ fld.d r2, 47*8, dr58
+ fld.d r2, 48*8, dr60
+ fld.d r2, 49*8, dr62
+#endif
+ movi 1, r2
+ cmvne r3, r3, r2
+ blink tr0, r63
+#else
mov.l @r4+,r8
mov.l @r4+,r9
mov.l @r4+,r10
@@ -55,3 +188,4 @@ ENTRY(longjmp)
movt r0
retr4: rts
nop
+#endif /* __SH5__ */