diff options
author | Geoffrey Keating <geoffk@geoffk.org> | 2001-12-22 22:47:58 +0000 |
---|---|---|
committer | Geoffrey Keating <geoffk@geoffk.org> | 2001-12-22 22:47:58 +0000 |
commit | f6eff1c04649af4f2a18c434d9be2870c24cc668 (patch) | |
tree | ce025040088849a3c238acf2892ae64a14bf7727 /libgloss | |
parent | a3e320f3c9759b2ad6267daca68e24952f27d59c (diff) | |
download | newlib-f6eff1c04649af4f2a18c434d9be2870c24cc668.zip newlib-f6eff1c04649af4f2a18c434d9be2870c24cc668.tar.gz newlib-f6eff1c04649af4f2a18c434d9be2870c24cc668.tar.bz2 |
In newlib/:
2001-12-22 Geoffrey Keating <geoffk@redhat.com>
Catherine Moore <clm@redhat.com>
Richard Henderson <rth@redhat.com>
Corinna Vinschen <vinschen@redhat.com>
* configure.host: Add support for xstormy16.
* libc/include/machine/ieeefp.h: Add support for xstormy16.
* libc/include/machine/setjmp.h: Add support for xstormy16.
* libc/include/sys/config.h: Add support for xstormy16.
* libc/machine/xstormy16/Makefile.am: New file.
* libc/machine/xstormy16/Makefile.in: New file.
* libc/machine/xstormy16/aclocal.m4: New file.
* libc/machine/xstormy16/configure: New file.
* libc/machine/xstormy16/configure.in: New file.
* libc/machine/xstormy16/setjmp.S: New file.
In libgloss/:
2001-12-22 Geoffrey Keating <geoffk@redhat.com>
Mark Salter <msalter@redhat.com>
Catherine Moore <clm@redhat.com>
Richard Henderson <rth@redhat.com>
* configure.in: Add xstormy16.
* libnosys/configure.in: Add xstormy16.
* configure: Regenerated.
* libnosys/configure: Regenerated.
* xstormy16/Makefile.in: New file.
* xstormy16/close.c: New file.
* xstormy16/configure: New file.
* xstormy16/configure.in: New file.
* xstormy16/crt0.s: New file.
* xstormy16/crt0_stub.s: New file.
* xstormy16/crti.s: New file.
* xstormy16/crtn.s: New file.
* xstormy16/eva_app.c: New file.
* xstormy16/eva_app.ld: New file.
* xstormy16/eva_stub.ld: New file.
* xstormy16/fstat.c: New file.
* xstormy16/getpid.c: New file.
* xstormy16/kill.c: New file.
* xstormy16/lseek.c: New file.
* xstormy16/open.c: New file.
* xstormy16/sbrk.c: New file.
* xstormy16/sim_high.ld: New file.
* xstormy16/stat.c: New file.
* xstormy16/syscalls.S: New file.
* xstormy16/syscalls.m4: New file.
* xstormy16/unlink.c: New file.
* xstormy16/xstormy16_stub.c: New file.
Diffstat (limited to 'libgloss')
28 files changed, 3581 insertions, 28 deletions
diff --git a/libgloss/ChangeLog b/libgloss/ChangeLog index 60fcc7f..23938dc 100644 --- a/libgloss/ChangeLog +++ b/libgloss/ChangeLog @@ -1,3 +1,36 @@ +2001-12-22 Geoffrey Keating <geoffk@redhat.com> + Mark Salter <msalter@redhat.com> + Catherine Moore <clm@redhat.com> + Richard Henderson <rth@redhat.com> + + * configure.in: Add xstormy16. + * libnosys/configure.in: Add xstormy16. + * configure: Regenerated. + * libnosys/configure: Regenerated. + * xstormy16/Makefile.in: New file. + * xstormy16/close.c: New file. + * xstormy16/configure: New file. + * xstormy16/configure.in: New file. + * xstormy16/crt0.s: New file. + * xstormy16/crt0_stub.s: New file. + * xstormy16/crti.s: New file. + * xstormy16/crtn.s: New file. + * xstormy16/eva_app.c: New file. + * xstormy16/eva_app.ld: New file. + * xstormy16/eva_stub.ld: New file. + * xstormy16/fstat.c: New file. + * xstormy16/getpid.c: New file. + * xstormy16/kill.c: New file. + * xstormy16/lseek.c: New file. + * xstormy16/open.c: New file. + * xstormy16/sbrk.c: New file. + * xstormy16/sim_high.ld: New file. + * xstormy16/stat.c: New file. + * xstormy16/syscalls.S: New file. + * xstormy16/syscalls.m4: New file. + * xstormy16/unlink.c: New file. + * xstormy16/xstormy16_stub.c: New file. + 2001-10-31 Jeff Johnston <jjohnstn@redhat.com> * m32r/Makefile.in: Use gdb stub set by configure. diff --git a/libgloss/configure b/libgloss/configure index 17845c9..bce09d7 100755 --- a/libgloss/configure +++ b/libgloss/configure @@ -788,6 +788,9 @@ case "${target}" in mcore-*-*) configdirs="${configdirs} mcore testsuite" ;; + xstormy16-*-*) + configdirs="${configdirs} xstormy16 testsuite" + ;; esac # temporarily strip out testsuite @@ -807,7 +810,7 @@ subdirs="$configdirs" # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:826: checking for $ac_word" >&5 +echo "configure:814: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -837,7 +840,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:856: checking for $ac_word" >&5 +echo "configure:844: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -886,7 +889,7 @@ fi fi echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:905: checking whether we are using GNU C" >&5 +echo "configure:893: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -895,7 +898,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:914: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:902: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -910,7 +913,7 @@ if test $ac_cv_prog_gcc = yes; then ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:929: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:917: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -942,7 +945,7 @@ AS=${AS-as} # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:961: checking for $ac_word" >&5 +echo "configure:949: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -976,7 +979,7 @@ LD=${LD-ld} # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:995: checking for $ac_word" >&5 +echo "configure:983: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else diff --git a/libgloss/configure.in b/libgloss/configure.in index 9d9edd0..1f6f977 100644 --- a/libgloss/configure.in +++ b/libgloss/configure.in @@ -88,6 +88,9 @@ case "${target}" in mcore-*-*) configdirs="${configdirs} mcore testsuite" ;; + xstormy16-*-*) + configdirs="${configdirs} xstormy16 testsuite" + ;; esac # temporarily strip out testsuite diff --git a/libgloss/libnosys/configure b/libgloss/libnosys/configure index 944d970..76ee44e 100755 --- a/libgloss/libnosys/configure +++ b/libgloss/libnosys/configure @@ -28,6 +28,7 @@ program_suffix=NONE program_transform_name=s,x,x, silent= site= +sitefile= srcdir= target=NONE verbose= @@ -142,6 +143,7 @@ Configuration: --help print this message --no-create do not create output files --quiet, --silent do not print \`checking...' messages + --site-file=FILE use FILE as the site file --version print the version of autoconf that created configure Directory and file names: --prefix=PREFIX install architecture-independent files in PREFIX @@ -312,6 +314,11 @@ EOF -site=* | --site=* | --sit=*) site="$ac_optarg" ;; + -site-file | --site-file | --site-fil | --site-fi | --site-f) + ac_prev=sitefile ;; + -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*) + sitefile="$ac_optarg" ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) @@ -477,12 +484,16 @@ fi srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` # Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" +if test -z "$sitefile"; then + if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi fi +else + CONFIG_SITE="$sitefile" fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then @@ -584,7 +595,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:588: checking host system type" >&5 +echo "configure:599: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -605,7 +616,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:609: checking target system type" >&5 +echo "configure:620: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -623,7 +634,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$target" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:627: checking build system type" >&5 +echo "configure:638: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -677,7 +688,7 @@ test "$program_transform_name" = "" && program_transform_name="s,x,x," # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:681: checking for a BSD compatible install" >&5 +echo "configure:692: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -787,6 +798,8 @@ case "${target}" in ;; w65-*-*) ;; + xstormy16-*-*) + ;; z8k-*-*) ;; *) @@ -805,7 +818,7 @@ EOF echo $ac_n "checking for .previous assembler directive""... $ac_c" 1>&6 -echo "configure:813: checking for .previous assembler directive" >&5 +echo "configure:822: checking for .previous assembler directive" >&5 if eval "test \"`echo '$''{'libc_cv_asm_previous_directive'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -813,7 +826,7 @@ else .section foo_section .previous EOF - if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:821: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:830: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then cat >> confdefs.h <<\EOF #define HAVE_ASM_PREVIOUS_DIRECTIVE 1 EOF @@ -824,7 +837,7 @@ fi echo "$ac_t""$libc_cv_asm_previous_directive" 1>&6 echo $ac_n "checking for .popsection assembler directive""... $ac_c" 1>&6 -echo "configure:832: checking for .popsection assembler directive" >&5 +echo "configure:841: checking for .popsection assembler directive" >&5 if eval "test \"`echo '$''{'libc_cv_asm_popsection_directive'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -832,7 +845,7 @@ else .pushsection foo_section .popsection EOF - if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:840: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:849: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then cat >> confdefs.h <<\EOF #define HAVE_ASM_POPSECTION_DIRECTIVE 1 EOF @@ -847,14 +860,14 @@ echo "$ac_t""$libc_cv_asm_popsection_directive" 1>&6 esac echo $ac_n "checking for function prefix""... $ac_c" 1>&6 -echo "configure:855: checking for function prefix" >&5 +echo "configure:864: checking for function prefix" >&5 if eval "test \"`echo '$''{'libc_dollar_prefix'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <<\EOF foo () { } EOF -if { ac_try='${CC-cc} -S conftest.c -o - | fgrep "\$foo" > /dev/null'; { (eval echo configure:862: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; +if { ac_try='${CC-cc} -S conftest.c -o - | fgrep "\$foo" > /dev/null'; { (eval echo configure:871: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_dollar_prefix=yes else @@ -879,7 +892,7 @@ fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:887: checking for $ac_word" >&5 +echo "configure:896: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -909,7 +922,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:917: checking for $ac_word" >&5 +echo "configure:926: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -958,7 +971,7 @@ fi fi echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:966: checking whether we are using GNU C" >&5 +echo "configure:975: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -967,7 +980,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:975: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:984: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -982,7 +995,7 @@ if test $ac_cv_prog_gcc = yes; then ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:990: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:999: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1018,7 +1031,7 @@ LD=${LD-ld} # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1026: checking for $ac_word" >&5 +echo "configure:1035: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else diff --git a/libgloss/libnosys/configure.in b/libgloss/libnosys/configure.in index 45cbfdd..a93133b 100644 --- a/libgloss/libnosys/configure.in +++ b/libgloss/libnosys/configure.in @@ -121,6 +121,8 @@ case "${target}" in ;; w65-*-*) ;; + xstormy16-*-*) + ;; z8k-*-*) ;; *) diff --git a/libgloss/xstormy16/Makefile.in b/libgloss/xstormy16/Makefile.in new file mode 100644 index 0000000..12b551e --- /dev/null +++ b/libgloss/xstormy16/Makefile.in @@ -0,0 +1,130 @@ +# +# + +VPATH = @srcdir@ @srcdir@/.. +srcdir = @srcdir@ +objdir = . +srcroot = $(srcdir)/../.. +objroot = $(objdir)/../.. + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +host_alias = @host_alias@ +target_alias = @target_alias@ + +bindir = @bindir@ +libdir = @libdir@ +tooldir = $(exec_prefix)/$(target_alias) + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +# Multilib support variables. +# TOP is used instead of MULTI{BUILD,SRC}TOP. +MULTIDIRS = +MULTISUBDIR = + +SHELL = /bin/sh + +CC = @CC@ + +AS = @AS@ +AR = @AR@ +LD = @LD@ +RANLIB = @RANLIB@ + +# Yuk. +OBJCOPY = $(subst ranlib,objcopy,$(RANLIB)) + +OBJS = isatty.o +CFLAGS = -g -O2 +ASFLAGS = --gdwarf2 +SCRIPTS = +CRT = crt0.o crti.o crtn.o + +# Here is all of the simulator stuff +SIM_SCRIPTS = sim_high.ld +SIM_LDFLAGS = +SIM_BSP = libsim.a +SIM_OBJS = syscalls.o sbrk.o + +# Here is stuff for building apps for GDB on the EVA board +EVA_APP_BSP = libeva_app.a +EVA_APP_OBJS = close.o fstat.o getpid.o kill.o lseek.o open.o \ + stat.o unlink.o eva_app.o +EVA_APP_SCRIPTS = eva_app.ld + +# Stub stuff +EVA_STUB_HEX = eva_stub.hex +EVA_STUB = eva_stub +EVA_STUB_OBJS = xstormy16_stub.o crt0_stub.o + +# Host specific makefile fragment comes in here. +@host_makefile_frag@ + +# +# build a test program for each target board. Just trying to get +# it to link is a good test, so we ignore all the errors for now. +# +# all: ${MON_CRT0} ${MON_BSP} +all: ${CRT} ${SIM_BSP} ${EVA_APP_BSP} ${EVA_STUB_HEX} + +# +# here's where we build the board support packages for each target +# +${SIM_BSP}: ${OBJS} ${SIM_OBJS} + ${AR} ${ARFLAGS} ${SIM_BSP} ${SIM_OBJS} ${OBJS} + ${RANLIB} ${SIM_BSP} + +${EVA_APP_BSP}: ${OBJS} ${EVA_APP_OBJS} + ${AR} ${ARFLAGS} ${EVA_APP_BSP} ${EVA_APP_OBJS} ${OBJS} + ${RANLIB} ${EVA_APP_BSP} + +${EVA_STUB_HEX}: ${EVA_STUB} + ${OBJCOPY} -O ihex $< $@ + +${EVA_STUB}: ${EVA_STUB_OBJS} ${srcdir}/eva_stub.ld + ${CC} -g -Os -nostartfiles -T${srcdir}/eva_stub.ld ${EVA_STUB_OBJS} -o $@ + + +# +# here's where we build the test programs for each target +# +.PHONY: test +test: + true + +# +# +# +.c.S: + ${CC} ${CFLAGS_FOR_TARGET} -c $< + +clean mostlyclean: + rm -f a.out core *.i *.o *-test *.srec *.dis *.x *.hex $(SIM_BSP) $(EVA_APP_BSP) $(EVA_STUB} + +distclean maintainer-clean realclean: clean + rm -f Makefile config.status *~ + +.PHONY: install info install-info clean-info +install: + set -e; for x in ${SIM_BSP} ${CRT} ${EVA_APP_BSP} ${EVA_STUB_HEX}; do\ + ${INSTALL_DATA} $$x ${tooldir}/lib${MULTISUBDIR}/$$x; \ + done + @for script in ${SCRIPTS} ${SIM_SCRIPTS} ${EVA_APP_SCRIPTS}; do\ + ${INSTALL_DATA} ${srcdir}/$${script} ${tooldir}/lib${MULTISUBDIR}/$${script}; \ + done + + +doc: +info: +install-info: +clean-info: + +Makefile: Makefile.in config.status @host_makefile_frag_path@ + $(SHELL) config.status + +config.status: configure + $(SHELL) config.status --recheck diff --git a/libgloss/xstormy16/close.c b/libgloss/xstormy16/close.c new file mode 100644 index 0000000..5fcfbf5 --- /dev/null +++ b/libgloss/xstormy16/close.c @@ -0,0 +1,25 @@ +/* close.c -- close a file descriptor. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include "glue.h" + +/* + * close -- We don't need to do anything, but pretend we did. + */ +int +_DEFUN (_close ,(fd), + int fd) +{ + return (0); +} diff --git a/libgloss/xstormy16/configure b/libgloss/xstormy16/configure new file mode 100755 index 0000000..d0e7f7c --- /dev/null +++ b/libgloss/xstormy16/configure @@ -0,0 +1,1219 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.12.1 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.12.1" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=crt0.s + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + +# Do some error checking and defaulting for the host and target type. +# The inputs are: +# configure --host=HOST --target=TARGET --build=BUILD NONOPT +# +# The rules are: +# 1. You are not allowed to specify --host, --target, and nonopt at the +# same time. +# 2. Host defaults to nonopt. +# 3. If nonopt is not specified, then host defaults to the current host, +# as determined by config.guess. +# 4. Target and build default to nonopt. +# 5. If nonopt is not specified, then target and build default to host. + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +case $host---$target---$nonopt in +NONE---*---* | *---NONE---* | *---*---NONE) ;; +*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; +esac + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:571: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + +echo $ac_n "checking target system type""... $ac_c" 1>&6 +echo "configure:592: checking target system type" >&5 + +target_alias=$target +case "$target_alias" in +NONE) + case $nonopt in + NONE) target_alias=$host_alias ;; + *) target_alias=$nonopt ;; + esac ;; +esac + +target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` +target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$target" 1>&6 + +echo $ac_n "checking build system type""... $ac_c" 1>&6 +echo "configure:610: checking build system type" >&5 + +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac + +build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$build" 1>&6 + +test "$host_alias" != "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + + +if test "$srcdir" = "." ; then + mdir=`echo "${with_multisubdir}/" \ + | sed -e 's,\([^/][^/]*\),..,g' -e 's,^/$,,'` + ac_aux_dir= +for ac_dir in ${mdir}../../.. $srcdir/${mdir}../../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in ${mdir}../../.. $srcdir/${mdir}../../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +else + ac_aux_dir= +for ac_dir in ${srcdir}/../.. $srcdir/${srcdir}/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in ${srcdir}/../.. $srcdir/${srcdir}/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +fi + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:708: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are probably using a cross compiler, which will not be able to fully +# link an executable. This should really be fixed in autoconf +# itself. + + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:770: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:799: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + ac_prog_rejected=no + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:847: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:856: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:871: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + +AS=${AS-as} + +AR=${AR-ar} + +LD=${LD-ld} + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:907: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +host_makefile_frag=${srcdir}/../config/default.mh + +host_makefile_frag_path=$host_makefile_frag + + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.12.1" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@target@%$target%g +s%@target_alias@%$target_alias%g +s%@target_cpu@%$target_cpu%g +s%@target_vendor@%$target_vendor%g +s%@target_os@%$target_os%g +s%@build@%$build%g +s%@build_alias@%$build_alias%g +s%@build_cpu@%$build_cpu%g +s%@build_vendor@%$build_vendor%g +s%@build_os@%$build_os%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@CC@%$CC%g +s%@AS@%$AS%g +s%@AR@%$AR%g +s%@LD@%$LD%g +s%@RANLIB@%$RANLIB%g +s%@host_makefile_frag_path@%$host_makefile_frag_path%g +/@host_makefile_frag@/r $host_makefile_frag +s%@host_makefile_frag@%%g + +CEOF +EOF + +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=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. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"Makefile"} +EOF +cat >> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <<EOF + +EOF +cat >> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/libgloss/xstormy16/configure.in b/libgloss/xstormy16/configure.in new file mode 100644 index 0000000..5824402 --- /dev/null +++ b/libgloss/xstormy16/configure.in @@ -0,0 +1,75 @@ +dnl Process this file with autoconf to produce a configure script. +AC_PREREQ(2.5)dnl +AC_INIT(crt0.s) + +AC_CANONICAL_SYSTEM +AC_ARG_PROGRAM + +if test "$srcdir" = "." ; then + mdir=`echo "${with_multisubdir}/" \ + | sed -e 's,\([[^/]][[^/]]*\),..,g' -e 's,^/$,,'` + AC_CONFIG_AUX_DIR(${mdir}../../..) +else + AC_CONFIG_AUX_DIR(${srcdir}/../..) +fi + +AC_PROG_INSTALL + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are probably using a cross compiler, which will not be able to fully +# link an executable. This should really be fixed in autoconf +# itself. + +AC_DEFUN(LIB_AC_PROG_CC, +[AC_BEFORE([$0], [AC_PROG_CPP])dnl +AC_CHECK_PROG(CC, gcc, gcc) +if test -z "$CC"; then + AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) + test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) +fi + +AC_PROG_CC_GNU + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +dnl Check whether -g works, even if CFLAGS is set, in case the package +dnl plays around with CFLAGS (such as to build both debugging and +dnl normal versions of a library), tasteless as that idea is. + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + AC_PROG_CC_G + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi +]) + +LIB_AC_PROG_CC +AS=${AS-as} +AC_SUBST(AS) +AR=${AR-ar} +AC_SUBST(AR) +LD=${LD-ld} +AC_SUBST(LD) +AC_PROG_RANLIB + +host_makefile_frag=${srcdir}/../config/default.mh + +dnl We have to assign the same value to other variables because autoconf +dnl doesn't provide a mechanism to substitute a replacement keyword with +dnl arbitrary data or pathnames. +dnl +host_makefile_frag_path=$host_makefile_frag +AC_SUBST(host_makefile_frag_path) +AC_SUBST_FILE(host_makefile_frag) + +AC_OUTPUT(Makefile) diff --git a/libgloss/xstormy16/crt0.s b/libgloss/xstormy16/crt0.s new file mode 100644 index 0000000..28f8c8a --- /dev/null +++ b/libgloss/xstormy16/crt0.s @@ -0,0 +1,94 @@ +# XSTORMY16 startup code + +# Interrupt vectors at 0x8000. + .section .int_vec,"ax" + .global _start + .align 1 +_start: + ;; Reset, watchdog timer interrupt + jmpf _int_reset + ;; base timer interrupt + jmpf _int_basetimer + ;; timer 0 + jmpf _int_timer0 + ;; timer 1 + jmpf _int_timer1 + ;; SIO0 interrupt + jmpf _int_sio0 + ;; SIO1 interrupt + jmpf _int_sio1 + ;; port0 interrupt + jmpf _int_port0 + ;; port1 interrupt + jmpf _int_port1 + + .text +# Reset code, set up memory and call main. +_int_reset: + ;; Set up the stack pointer. + mov r0,#__stack + bz r0,#0,0f + mov sp,r0 +0: + ;; Zero the data space + mov r0,#_edata + mov r1,#_end + mov r2,#0 +0: mov.w (r0++),r2 + blt r0,r1,0b + ;; Call hardware init routine + callf _hwinit + ;; Call initialization routines + callf _init + ;; Set up fini routines to be called from exit + mov r2,#@fptr(_fini) + callf atexit + ;; Call main() with empty argc/argv/envp + mov r2,#0 + mov r3,#0 + mov r4,#0 + callf main + ;; Exit. + callf exit + ;; Should never reach this code. + halt +1: .size _int_reset,1b-_int_reset + +# Stub interrupt routines. + .globl _int_timer0 + .weak _int_timer0 + .globl _int_timer1 + .weak _int_timer1 + .globl _int_sio0 + .weak _int_sio0 + .globl _int_sio1 + .weak _int_sio1 + .globl _int_port0 + .weak _int_port0 + .globl _int_port1 + .weak _int_port1 + .globl _int_basetimer + .weak _int_basetimer +_int_timer0: +_int_timer1: +_int_sio0: +_int_sio1: +_int_port0: +_int_port1: +_int_basetimer: + iret +1: .size _int_timer0,1b-_int_timer0 + +# Stub hardware init + .globl _hwinit + .weak _hwinit +_hwinit: + ret +1: .size _int_hwinit,1b-_int_hwinit + +# The first word in .data has address 0, so it's not a good +# idea to use it as its address conflicts with NULL. +# Place a HALT instruction there to try to catch NULL pointer +# dereferences. + .data + halt diff --git a/libgloss/xstormy16/crt0_stub.s b/libgloss/xstormy16/crt0_stub.s new file mode 100644 index 0000000..ce3ad36 --- /dev/null +++ b/libgloss/xstormy16/crt0_stub.s @@ -0,0 +1,178 @@ +# XSTORMY16 startup code for GDB stub. + +# CPU Data for Sanyo EVA debugger at 0x7F00 + .section .cpudata,"ax" + .byte 0x00,0x02,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .byte 0x44,0x35,0x39,0x52,0x30,0x30,0x30,0x30,0x2E,0x4F,0x50,0x54,0x00,0x00,0x00,0x00 + .byte 0x4c,0x43,0x35,0x39,0x52,0x30,0x30,0x30,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x80,0x00,0x20,0x48,0x00,0x00,0x00 + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x20,0x01,0x12,0x31,0x23,0x59 + +# Interrupt vectors at 0x8000. + .section .int_vec,"ax" + .global _start + .align 1 +_start: + ;; Reset, watchdog timer interrupt + jmpf _int_reset + ;; base timer interrupt + jmpf _int_basetimer + ;; timer 0 + jmpf _int_timer0 + ;; timer 1 + jmpf _int_timer1 + ;; SIO0 interrupt + jmpf _int_sio0 + ;; SIO1 interrupt + jmpf _int_sio1 + ;; port0 interrupt + jmpf _int_port0 + ;; port1 interrupt + jmpf _int_port1 + + .org 0x80 + ;; sys interrupt (0x8080) + jmpf _int_sys + + ;; Application void write(char *buf, int nbytes) + ;; This jmps to a stub function to packetize the buf for GDB + jmpf gdb_write + ;; Application int read(char *buf, int nbytes) + jmpf gdb_read + + .text +# Reset code, set up memory and call main. +_int_reset: + ;; Set up the application stack pointer. + mov sp,#0x002 + + ;; Zero the data space + mov r0,#_edata + mov r1,#_end + mov r2,#0 +0: mov.w (r0++),r2 + blt r0,r1,0b + + ;; Init the UART + callf uart_init + + ;; Turn on illegal insn trap + mov r0,r14 + set1 r0,#11 + mov r14,r0 + mov.b 0x7f08,#0x11 + mov.b 0x7f09,#0x10 + + ;; "breakpoint" sends us into stub. +0: + .hword 0x0006 + br 0b + +1: .size _int_reset,1b-_int_reset + +# Stub interrupt routines. + .globl _int_timer0 + .weak _int_timer0 + .globl _int_timer1 + .weak _int_timer1 + .globl _int_sio0 + .weak _int_sio0 + .globl _int_sio1 + .weak _int_sio1 + .globl _int_port0 + .weak _int_port0 + .globl _int_port1 + .weak _int_port1 + .globl _int_basetimer + .weak _int_basetimer +_int_timer0: +_int_timer1: +_int_sio0: +_int_sio1: +_int_port0: +_int_port1: +_int_basetimer: + iret +1: .size _int_timer0,1b-_int_timer0 + +_int_sys: + push r13 + mov r13,#registers + mov.w (r13++),r0 + mov.w (r13++),r1 + mov.w (r13++),r2 + mov.w (r13++),r3 + mov.w (r13++),r4 + mov.w (r13++),r5 + mov.w (r13++),r6 + mov.w (r13++),r7 + mov r0,r8 + mov.w (r13++),r0 + mov r0,r9 + mov.w (r13++),r0 + mov r0,r10 + mov.w (r13++),r0 + mov r0,r11 + mov.w (r13++),r0 + mov r0,r12 + mov.w (r13++),r0 + pop r0 + mov.w (r13++),r0 ; R13 + pop r0 + mov.w (r13++),r0 ; PSW + mov r0,r15 + sub r0,#4 + mov.w (r13++),r0 ; SP + pop r0 + pop r1 + mov.w (r13++),r1 ; PCL + mov.w (r13++),r0 ; PCH + + ;; switch to stub stack and invoke stub + mov sp,#0x700 + callf handle_exception + + mov r0,#registers+34 + mov.w r1,(r0) ; PCH + mov.w r2,(--r0) ; PCL + mov.w r3,(--r0) ; SP + mov r15,r3 + push r2 + push r1 + mov.w r1,(--r0) ; PSW + push r1 + mov.w r1,(--r0) + mov r13,r1 + mov.w r1,(--r0) + mov r12,r1 + mov.w r1,(--r0) + mov r11,r1 + mov.w r1,(--r0) + mov r10,r1 + mov.w r1,(--r0) + mov r9,r1 + mov.w r1,(--r0) + mov r8,r1 + mov.w r7,(--r0) + mov.w r6,(--r0) + mov.w r5,(--r0) + mov.w r4,(--r0) + mov.w r3,(--r0) + mov.w r2,(--r0) + mov.w r1,(--r0) + mov.w r0,(--r0) + iret +1: .size _int_sys,1b-_int_sys + + diff --git a/libgloss/xstormy16/crti.s b/libgloss/xstormy16/crti.s new file mode 100644 index 0000000..3713ba3 --- /dev/null +++ b/libgloss/xstormy16/crti.s @@ -0,0 +1,9 @@ + .section .init,"ax" + .align 1 + .globl _init +_init: + + .section .fini,"ax" + .align 1 + .globl _fini +_fini: diff --git a/libgloss/xstormy16/crtn.s b/libgloss/xstormy16/crtn.s new file mode 100644 index 0000000..22d71b8 --- /dev/null +++ b/libgloss/xstormy16/crtn.s @@ -0,0 +1,5 @@ + .section .init,"ax" + ret + + .section .fini,"ax" + ret diff --git a/libgloss/xstormy16/eva_app.c b/libgloss/xstormy16/eva_app.c new file mode 100644 index 0000000..f6069fc --- /dev/null +++ b/libgloss/xstormy16/eva_app.c @@ -0,0 +1,78 @@ +/* eva_app.c -- Glue code for linking apps to run under GDB debugger control. + * + * Copyright (c) 2001 Red Hat, Inc. + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include "glue.h" + +typedef void (*write_proc_t)(char *buf, int nbytes); +typedef int (*read_proc_t)(char *buf, int nbytes); + +/* There is no "syscall", so we just call directly into the stub code + at fixed addresses. */ +#define STUB_WRITE(p,n) ((write_proc_t)0x8084)((p),(n)) +#define STUB_READ(p,n) ((read_proc_t)0x8088)((p),(n)) + +/* + * print -- do a raw print of a string + */ +void +print(char *ptr) +{ + STUB_WRITE(ptr, strlen(ptr)); +} + +/* + * write -- write bytes to the serial port. Ignore fd, since + * stdout and stderr are the same. Since we have no filesystem, + * open will only return an error. + */ +int +_write (int fd, char *buf, int nbytes) +{ + STUB_WRITE(buf, nbytes); + return (nbytes); +} + +int +_read (int fd, char *buf, int nbytes) +{ + return STUB_READ(buf, nbytes); +} + +extern char _end[]; +#define HEAP_LIMIT ((char *)0xffff) + +void * +_sbrk(int inc) +{ + static char *heap_ptr = _end; + void *base; + + if (inc > (HEAP_LIMIT - heap_ptr)) + return (void *)-1; + + base = heap_ptr; + heap_ptr += inc; + + return base; +} + +void +_exit(int n) +{ + while (1) + { + asm volatile ("nop"); + asm volatile (".hword 0x0006"); /* breakpoint (special illegal insn) */ + } +} diff --git a/libgloss/xstormy16/eva_app.ld b/libgloss/xstormy16/eva_app.ld new file mode 100644 index 0000000..b95526d --- /dev/null +++ b/libgloss/xstormy16/eva_app.ld @@ -0,0 +1,128 @@ +OUTPUT_FORMAT("elf32-xstormy16", "elf32-xstormy16", + "elf32-xstormy16") +OUTPUT_ARCH(xstormy16) +ENTRY(_start) +GROUP(-lc -leva_app -lgcc) + +MEMORY +{ + RAM (w) : ORIGIN = 0x9000, LENGTH = 0x7000 + ROM (!w) : ORIGIN = 0x10000, LENGTH = 0x70000 +} + +SECTIONS +{ + __stack = 2 ; + .data : + { + *(.data) + *(.data.*) + *(.gnu.linkonce.d.*) + SORT(CONSTRUCTORS) + } > RAM + /* Read-only sections */ + .rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r.*) } > RAM + .ctors : + { + /* gcc uses crtbegin.o to find the start of + the constructors, so we make sure it is + first. Because this is a wildcard, it + doesn't matter if the user does not + actually link against crtbegin.o; the + linker won't look for a file to match a + wildcard. The wildcard also means that it + doesn't matter which directory crtbegin.o + is in. */ + KEEP (*crtbegin.o(.ctors)) + /* We don't want to include the .ctor section from + from the crtend.o file until after the sorted ctors. + The .ctor section from the crtend file contains the + end of ctors marker and it must be last */ + KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + } > RAM + .dtors : + { + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + } > RAM + .eh_frame : { KEEP (*(.eh_frame)) } > RAM + .gcc_except_table : { *(.gcc_except_table) } > RAM + .plt : { *(.plt) } > RAM + _edata = .; + PROVIDE (edata = .); + __bss_start = .; + .bss : + { + *(.dynbss) + *(.bss) + *(.bss.*) + *(.gnu.linkonce.b.*) + *(COMMON) + /* Align here to ensure that the .bss section occupies space up to + _end. Align after .bss to ensure correct alignment even if the + .bss section disappears because there are no input sections. */ + . = ALIGN(2); + } > RAM + . = ALIGN(2); + _end = .; + PROVIDE (end = .); + .text : + { + *(.int_vec) + *(.text) + *(.text.*) + *(.stub) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + *(.gnu.linkonce.t.*) + } > ROM =0 + .init : + { + KEEP (*(.init)) + } > ROM =0 + .fini : + { + KEEP (*(.fini)) + } > ROM =0 + PROVIDE (__etext = .); + PROVIDE (_etext = .); + PROVIDE (etext = .); + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* These must appear regardless of . */ +} diff --git a/libgloss/xstormy16/eva_stub.ld b/libgloss/xstormy16/eva_stub.ld new file mode 100644 index 0000000..1105c26 --- /dev/null +++ b/libgloss/xstormy16/eva_stub.ld @@ -0,0 +1,129 @@ +OUTPUT_FORMAT("elf32-xstormy16", "elf32-xstormy16", + "elf32-xstormy16") +OUTPUT_ARCH(xstormy16) +ENTRY(_start) + +MEMORY +{ + CPUDATA (!w) : ORIGIN = 0x7F00, LENGTH = 0x100 + ROM (w) : ORIGIN = 0x8000, LENGTH = 0x1000 +} + +SECTIONS +{ + /* CPU data for Sanyo debugger */ + .cpudata : { KEEP (*(.cpudata)) } > CPUDATA + /* Read-only sections in ROM. */ + .int_vec : { *(.int_vec) } > ROM + .rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r.*) } > ROM + .ctors : + { + /* gcc uses crtbegin.o to find the start of + the constructors, so we make sure it is + first. Because this is a wildcard, it + doesn't matter if the user does not + actually link against crtbegin.o; the + linker won't look for a file to match a + wildcard. The wildcard also means that it + doesn't matter which directory crtbegin.o + is in. */ + KEEP (*crtbegin.o(.ctors)) + /* We don't want to include the .ctor section from + from the crtend.o file until after the sorted ctors. + The .ctor section from the crtend file contains the + end of ctors marker and it must be last */ + KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + } > ROM + .dtors : + { + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + } > ROM + .eh_frame : { KEEP (*(.eh_frame)) } > ROM + .gcc_except_table : { *(.gcc_except_table) } > ROM + .plt : { *(.plt) } > ROM + .text : + { + *(.text) + *(.text.*) + *(.stub) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + *(.gnu.linkonce.t.*) + } > ROM =0 + .init : + { + KEEP (*(.init)) + } > ROM =0 + .fini : + { + KEEP (*(.fini)) + } > ROM =0 + PROVIDE (__etext = .); + PROVIDE (_etext = .); + PROVIDE (etext = .); + .data : + { + *(.data) + *(.data.*) + *(.gnu.linkonce.d.*) + SORT(CONSTRUCTORS) + } > ROM + _edata = .; + PROVIDE (edata = .); + __bss_start = .; + .bss : + { + *(.dynbss) + *(.bss) + *(.bss.*) + *(.gnu.linkonce.b.*) + *(COMMON) + /* Align here to ensure that the .bss section occupies space up to + _end. Align after .bss to ensure correct alignment even if the + .bss section disappears because there are no input sections. */ + . = ALIGN(2); + } > ROM + . = ALIGN(2); + _end = .; + PROVIDE (end = .); + + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* These must appear regardless of . */ +} diff --git a/libgloss/xstormy16/fstat.c b/libgloss/xstormy16/fstat.c new file mode 100644 index 0000000..982d578 --- /dev/null +++ b/libgloss/xstormy16/fstat.c @@ -0,0 +1,30 @@ +/* fstat.c -- get status of a file. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include <sys/stat.h> +#include "glue.h" + +/* + * fstat -- Since we have no file system, we just return an error. + */ +int +_DEFUN (_fstat, (fd, buf), + int fd _AND + struct stat *buf) +{ + buf->st_mode = S_IFCHR; /* Always pretend to be a tty */ + buf->st_blksize = 0; + + return (0); +} diff --git a/libgloss/xstormy16/getpid.c b/libgloss/xstormy16/getpid.c new file mode 100644 index 0000000..0f081a1 --- /dev/null +++ b/libgloss/xstormy16/getpid.c @@ -0,0 +1,25 @@ +/* getpid.c -- get the current process id. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include "glue.h" + +/* + * getpid -- only one process, so just return 1. + */ +int +_DEFUN (_getpid, (), + ) +{ + return __MYPID; +} diff --git a/libgloss/xstormy16/kill.c b/libgloss/xstormy16/kill.c new file mode 100644 index 0000000..0bbc014 --- /dev/null +++ b/libgloss/xstormy16/kill.c @@ -0,0 +1,28 @@ +/* kill.c -- remove a process. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include "glue.h" + +/* + * kill -- go out via exit... + */ +int +_DEFUN (_kill, (pid, sig), + int pid _AND + int sig) +{ + if(pid == __MYPID) + _exit(sig); + return 0; +} diff --git a/libgloss/xstormy16/lseek.c b/libgloss/xstormy16/lseek.c new file mode 100644 index 0000000..640a96e --- /dev/null +++ b/libgloss/xstormy16/lseek.c @@ -0,0 +1,31 @@ +/* lseek.c -- move read/write pointer. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include <sys/types.h> +#include <errno.h> +#include "glue.h" + +/* + * lseek -- Since a serial port is non-seekable, we return an error. + */ +off_t +_DEFUN (_lseek, (fd, offset, whence), + int fd _AND + off_t offset _AND + int whence) +{ + errno = ESPIPE; + return ((off_t)-1); +} + diff --git a/libgloss/xstormy16/open.c b/libgloss/xstormy16/open.c new file mode 100644 index 0000000..a2c318e --- /dev/null +++ b/libgloss/xstormy16/open.c @@ -0,0 +1,31 @@ +/* open.c -- open a file. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include <errno.h> +#include "glue.h" + +/* + * open -- open a file descriptor. We don't have a filesystem, so + * we return an error. + */ +int +_DEFUN (_open, (buf, flags, mode), + const char *buf _AND + int flags _AND + int mode) +{ + errno = EIO; + return (-1); +} + diff --git a/libgloss/xstormy16/sbrk.c b/libgloss/xstormy16/sbrk.c new file mode 100644 index 0000000..cb18d68 --- /dev/null +++ b/libgloss/xstormy16/sbrk.c @@ -0,0 +1,55 @@ +/* sbrk.c -- allocate memory dynamically. + * + * Copyright (c) 1995,1996 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include <errno.h> +#include "glue.h" + +/* just in case, most boards have at least some memory */ +#ifndef RAMSIZE +# define RAMSIZE (caddr_t)0x100000 +#endif + +char *heap_ptr; + +/* + * sbrk -- changes heap size size. Get nbytes more + * RAM. We just increment a pointer in what's + * left of memory on the board. + */ +char * +_sbrk (nbytes) + int nbytes; +{ + char *base; + + if (!heap_ptr) + heap_ptr = (char *)&_end; + base = heap_ptr; + heap_ptr += nbytes; + + return base; +/* FIXME: We really want to make sure we don't run out of RAM, but this + * isn't very portable. + */ +#if 0 + if ((RAMSIZE - heap_ptr - nbytes) >= 0) { + base = heap_ptr; + heap_ptr += nbytes; + return (base); + } else { + errno = ENOMEM; + return ((char *)-1); + } +#endif +} diff --git a/libgloss/xstormy16/sim_high.ld b/libgloss/xstormy16/sim_high.ld new file mode 100644 index 0000000..7a3ae97 --- /dev/null +++ b/libgloss/xstormy16/sim_high.ld @@ -0,0 +1,132 @@ +/* A modified version of the basic linker script, for testing purposes, + which puts all code above 0x10000. */ +OUTPUT_FORMAT("elf32-xstormy16", "elf32-xstormy16", + "elf32-xstormy16") +OUTPUT_ARCH(xstormy16) +ENTRY(_start) + SEARCH_DIR(/es/scratch/geoffk/objs/mainline-sX/H-i686-pc-linux-gnulibc2.2/xstormy16-elf/lib); +/* There are two memory regions we care about, one from 0 through 0x7F00 + that is RAM and one from 0x8000 up which is ROM. */ +MEMORY +{ + RAM (w) : ORIGIN = 0, LENGTH = 0x7F00 + LOROM (!w) : ORIGIN = 0x8000, LENGTH = 0x8000 + HIROM (!w) : ORIGIN = 0x10000, LENGTH = 0xFF0000 +} +SECTIONS +{ + .data : + { + *(.data) + *(.data.*) + *(.gnu.linkonce.d.*) + SORT(CONSTRUCTORS) + } > RAM + _edata = .; + PROVIDE (edata = .); + __bss_start = .; + .bss : + { + *(.dynbss) + *(.bss) + *(.bss.*) + *(.gnu.linkonce.b.*) + *(COMMON) + /* Align here to ensure that the .bss section occupies space up to + _end. Align after .bss to ensure correct alignment even if the + .bss section disappears because there are no input sections. */ + . = ALIGN(2); + } > RAM + . = ALIGN(2); + __stack = .; + . = . + 4096; + _end = .; + PROVIDE (end = .); + /* Read-only sections in ROM. */ + .int_vec : { *(.int_vec) } > LOROM + .rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r.*) } > LOROM + .ctors : + { + /* gcc uses crtbegin.o to find the start of + the constructors, so we make sure it is + first. Because this is a wildcard, it + doesn't matter if the user does not + actually link against crtbegin.o; the + linker won't look for a file to match a + wildcard. The wildcard also means that it + doesn't matter which directory crtbegin.o + is in. */ + KEEP (*crtbegin.o(.ctors)) + /* We don't want to include the .ctor section from + from the crtend.o file until after the sorted ctors. + The .ctor section from the crtend file contains the + end of ctors marker and it must be last */ + KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + } > LOROM + .dtors : + { + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + } > LOROM + .eh_frame : { KEEP (*(.eh_frame)) } > LOROM + .gcc_except_table : { *(.gcc_except_table) } > LOROM + .plt : { *(.plt) } > LOROM + .text : + { + *(.text) + *(.text.*) + *(.stub) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + *(.gnu.linkonce.t.*) + } > HIROM =0 + .init : + { + KEEP (*(.init)) + } > HIROM =0 + .fini : + { + KEEP (*(.fini)) + } > HIROM =0 + PROVIDE (__etext = .); + PROVIDE (_etext = .); + PROVIDE (etext = .); + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* These must appear regardless of . */ +} diff --git a/libgloss/xstormy16/stat.c b/libgloss/xstormy16/stat.c new file mode 100644 index 0000000..c766a34 --- /dev/null +++ b/libgloss/xstormy16/stat.c @@ -0,0 +1,30 @@ +/* stat.c -- Get the status of a file. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include <sys/stat.h> +#include <errno.h> +#include "glue.h" + +/* + * stat -- Since we have no file system, we just return an error. + */ +int +_DEFUN (_stat, (path, buf), + const char *path _AND + struct stat *buf) +{ + errno = EIO; + return (-1); +} + diff --git a/libgloss/xstormy16/syscalls.S b/libgloss/xstormy16/syscalls.S new file mode 100644 index 0000000..8f4175f --- /dev/null +++ b/libgloss/xstormy16/syscalls.S @@ -0,0 +1,162 @@ +# xstormy16 system calls for the simulator + +#include <syscall.h> + + .text + + .globl _exit +_exit: + mov r1,#SYS_exit + .hword 0x0001 + bnz r1,#0,syscall_error + ret +0: .size exit,0b-_exit + + .globl _open +_open: + mov r1,#SYS_open + .hword 0x0001 + bnz r1,#0,syscall_error + ret +0: .size open,0b-_open + + .globl _close +_close: + mov r1,#SYS_close + .hword 0x0001 + bnz r1,#0,syscall_error + ret +0: .size close,0b-_close + + .globl _read +_read: + mov r1,#SYS_read + .hword 0x0001 + bnz r1,#0,syscall_error + ret +0: .size read,0b-_read + + .globl _write +_write: + mov r1,#SYS_write + .hword 0x0001 + bnz r1,#0,syscall_error + ret +0: .size write,0b-_write + + .globl _lseek +_lseek: + mov r1,#SYS_lseek + .hword 0x0001 + bnz r1,#0,syscall_error + ret +0: .size lseek,0b-_lseek + + .globl _unlink +_unlink: + mov r1,#SYS_unlink + .hword 0x0001 + bnz r1,#0,syscall_error + ret +0: .size unlink,0b-_unlink + + .globl _getpid +_getpid: + mov r1,#SYS_getpid + .hword 0x0001 + bnz r1,#0,syscall_error + ret +0: .size getpid,0b-_getpid + + .globl _kill +_kill: + mov r1,#SYS_kill + .hword 0x0001 + bnz r1,#0,syscall_error + ret +0: .size kill,0b-_kill + + .globl _fstat +_fstat: + mov r1,#SYS_fstat + .hword 0x0001 + bnz r1,#0,syscall_error + ret +0: .size fstat,0b-_fstat + + .globl _chdir +_chdir: + mov r1,#SYS_chdir + .hword 0x0001 + bnz r1,#0,syscall_error + ret +0: .size chdir,0b-_chdir + + .globl _stat +_stat: + mov r1,#SYS_stat + .hword 0x0001 + bnz r1,#0,syscall_error + ret +0: .size stat,0b-_stat + + .globl _chmod +_chmod: + mov r1,#SYS_chmod + .hword 0x0001 + bnz r1,#0,syscall_error + ret +0: .size chmod,0b-_chmod + + .globl _utime +_utime: + mov r1,#SYS_utime + .hword 0x0001 + bnz r1,#0,syscall_error + ret +0: .size utime,0b-_utime + + .globl _time +_time: + mov r1,#SYS_time + .hword 0x0001 + bnz r1,#0,syscall_error + ret +0: .size time,0b-_time + + .globl _gettimeofday +_gettimeofday: + mov r1,#SYS_gettimeofday + .hword 0x0001 + bnz r1,#0,syscall_error + ret +0: .size gettimeofday,0b-_gettimeofday + + .globl _times +_times: + mov r1,#SYS_times + .hword 0x0001 + bnz r1,#0,syscall_error + ret +0: .size times,0b-_times + + .globl _link +_link: + mov r1,#SYS_link + .hword 0x0001 + bnz r1,#0,syscall_error + ret +0: .size link,0b-_link + +syscall_error: +# Return value for the syscall is in r2. Save it here, as +# _errno will overwrite it with the address of the errno +# variable. r0 is the errno. + push r2 + push r0 + callf __errno + pop r0 + mov.w (r2),r0 + pop r2 + ret +0: .size syscall_error,0b-syscall_error diff --git a/libgloss/xstormy16/syscalls.m4 b/libgloss/xstormy16/syscalls.m4 new file mode 100644 index 0000000..ab71fc6 --- /dev/null +++ b/libgloss/xstormy16/syscalls.m4 @@ -0,0 +1,40 @@ +# xstormy16 system calls for the simulator + +#include <syscall.h> + + .text + +define(`syscall',`.globl _`'$1 +_`'$1`': + mov r1,#SYS_$1 + .hword 0x0001 + bnz r1,#0,syscall_error + ret +0: .size $1,0b-_$1 +')dnl + syscall(exit) + syscall(open) + syscall(close) + syscall(read) + syscall(write) + syscall(lseek) + syscall(unlink) + syscall(getpid) + syscall(kill) + syscall(fstat) + syscall(chdir) + syscall(stat) + syscall(chmod) + syscall(utime) + syscall(time) + syscall(gettimeofday) + syscall(times) + syscall(link) +dnl +syscall_error: + push r0 + callf __errno + pop r0 + mov.w (r2),r0 + ret +0: .size syscall_error,0b-syscall_error diff --git a/libgloss/xstormy16/unlink.c b/libgloss/xstormy16/unlink.c new file mode 100644 index 0000000..1c56663 --- /dev/null +++ b/libgloss/xstormy16/unlink.c @@ -0,0 +1,28 @@ +/* unlink.c -- remove a file. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include <errno.h> +#include "glue.h" + +/* + * unlink -- since we have no file system, + * we just return an error. + */ +int +_DEFUN (_unlink, (path), + char * path) +{ + errno = EIO; + return (-1); +} diff --git a/libgloss/xstormy16/xstormy16_stub.c b/libgloss/xstormy16/xstormy16_stub.c new file mode 100644 index 0000000..7706031 --- /dev/null +++ b/libgloss/xstormy16/xstormy16_stub.c @@ -0,0 +1,837 @@ +/**************************************************************************** + + THIS SOFTWARE IS NOT COPYRIGHTED + + HP offers the following for use in the public domain. HP makes no + warranty with regard to the software or it's performance and the + user accepts the software "AS IS" with all faults. + + HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD + TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +****************************************************************************/ + +/**************************************************************************** + * Header: remcom.c,v 1.34 91/03/09 12:29:49 glenne Exp $ + * + * Module name: remcom.c $ + * Revision: 1.34 $ + * Date: 91/03/09 12:29:49 $ + * Contributor: Lake Stevens Instrument Division$ + * + * Description: low level support for gdb debugger. $ + * + * Considerations: only works on target hardware $ + * + * Written by: Glenn Engel $ + * ModuleState: Experimental $ + * + * NOTES: See Below $ + * + * Heavily modified for XStormy16 by Mark Salter, Red Hat. + * Optimisations and 'X' support by Geoff Keating, Red Hat. + * + * To enable debugger support, two things need to happen. One, a + * call to set_debug_traps() is necessary in order to allow any breakpoints + * or error conditions to be properly intercepted and reported to gdb. + * Two, a breakpoint needs to be generated to begin communication. This + * is most easily accomplished by a call to breakpoint(). Breakpoint() + * simulates a breakpoint by executing a trap #1. + * + * Because gdb will sometimes write to the stack area to execute function + * calls, this program cannot rely on using the inferior stack so it uses + * it's own stack area. + * + ************* + * + * The following gdb commands are supported: + * + * command function Return value + * + * g return the value of the CPU registers hex data or ENN + * G set the value of the CPU registers OK or ENN + * + * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN + * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN + * XAA..AA,LLLL: Write LLLL binary bytes at address OK or ENN + * AA..AA + * + * c Resume at current address SNN ( signal NN) + * cAA..AA Continue at address AA..AA SNN + * + * s Step one instruction SNN + * sAA..AA Step one instruction from AA..AA SNN + * + * k kill + * + * ? What was the last sigval ? SNN (signal NN) + * + * All commands and responses are sent with a packet which includes a + * checksum. A packet consists of + * + * $<packet info>#<checksum>. + * + * where + * <packet info> :: <characters representing the command or response> + * <checksum> :: <two hex digits computed as modulo 256 sum of <packetinfo>> + * + * When a packet is received, it is first acknowledged with either '+' or '-'. + * '+' indicates a successful transfer. '-' indicates a failed transfer. + * + * Example: + * + * Host: Reply: + * $m0,10#2a +$00010203040506070809101112131415#42 + * + ****************************************************************************/ + +/* Local functions: + */ +static void putDebugChar(unsigned ch); +static unsigned char getDebugChar(void); +static void putPacket(unsigned char *); +static void putHex (char c, unsigned long mem_arg, int count); +static unsigned char *getpacket(void); +static void hex2mem(unsigned char *, unsigned long, int); +static int valid_addr_range (unsigned long mem, int count); +static int hexToInt(unsigned char **, long *); +static void prepare_to_step(void); +static void finish_from_step(void); + +/* breakpoint opcode */ +#define BREAKPOINT_OPCODE 0x0006 + +/* Error Detection Register */ +#define ERR_DETECT_REG (*(volatile unsigned *)0x7f08) +#define UNDEF_INSN_ENA 0x01 +#define UNDEF_INSN_FLAG 0x02 +#define ODD_ADDR_ENA 0x04 +#define ODD_ADDR_FLAG 0x08 +#define BAD_ADDR_ENA 0x10 +#define BAD_ADDR_FLAG 0x20 +#define SER0_IRQ_ENA 0x1000 +#define SER0_IRQ_FLAG 0x2000 + +/***************************************************************************** + * BUFMAX defines the maximum number of characters in inbound/outbound buffers + * at least NUMREGBYTES*2 are needed for register packets + */ +#define BUFMAX 80 + +static const unsigned char hexchars[]="0123456789abcdef"; + +#define NUMREGS 17 + +/* Number of bytes of registers (extra 2 bytes is for 4 byte PC). */ +#define NUMREGBYTES ((NUMREGS * 2) + 2) +enum regnames { R0, R1, R2, R3, R4, R5, R6, R7, + R8, R9, R10, R11, R12, R13, R14, R15, + PC }; + +#define FP R13 +#define PSW R14 +#define SP R15 + +struct regs { + int r[16]; + long pc; +} registers; + +static struct regs orig_registers; + +static unsigned char remcomBuffer[BUFMAX]; + +/* Indicate whether inferior is running. Used to decide whether or not to + send T packet when stub is entered. */ +static char is_running; + +static inline unsigned char +get_char(unsigned long addr) +{ + unsigned int msw, lsw; + unsigned char ret; + + msw = addr >> 16; + lsw = addr & 0xffff; + + asm("movf.b %0,(%2)\n" + : "=e"(ret) : "d"(msw), "r"(lsw) : "memory"); + + return ret; +} + +static inline void +set_char(unsigned long addr, unsigned int val) +{ + unsigned int msw, lsw; + + msw = addr >> 16; + lsw = addr & 0xffff; + + asm("movf.b (%1),%2\n" + : /* none */ : "d"(msw), "r"(lsw), "e"(val) : "memory" ); +} + +static inline unsigned int +get_word(unsigned long addr) +{ + unsigned int ret, msw, lsw; + + msw = addr >> 16; + lsw = addr & 0xffff; + + asm("movf.w %0,(%2)\n" + : "=e"(ret) : "d"(msw), "r"(lsw) : "memory" ); + + return ret; +} + +static inline void +set_word(unsigned long addr, unsigned int val) +{ + unsigned int msw, lsw; + + msw = addr >> 16; + lsw = addr & 0xffff; + + asm("movf.w (%1),%2\n" + : /* none */ : "d"(msw), "r"(lsw), "e"(val) : "memory" ); +} + +static void +assign_regs (struct regs *dest, const struct regs *src) +{ + int i; + char *d = (char *)dest, *s = (char *)src; + for (i = 0; i < sizeof (struct regs); i++) + *d++ = *s++; +} + +/* Write out a register for a 'T' packet. */ + +static unsigned char * +putreg (unsigned char *buf, int regnum, void *mem_p, int count) +{ + int i; + unsigned char ch; + char *mem = (char *)mem_p; + + *buf++ = hexchars[regnum >> 4]; + *buf++ = hexchars[regnum % 16]; + *buf++ = ':'; + + for (i=0;i<count;i++) + { + ch = *mem++; + *buf++ = hexchars[ch >> 4]; + *buf++ = hexchars[ch % 16]; + } + *buf++ = ';'; + return(buf); +} + +/* + * This function does all command procesing for interfacing to gdb. + */ +void +handle_exception(void) +{ + char sigval; + unsigned char *ptr; + long addr, length; + + /* reply to host that an exception has occurred */ + sigval = 5; /* SIGTRAP is default */ + if (ERR_DETECT_REG & UNDEF_INSN_FLAG) + { + ERR_DETECT_REG &= ~UNDEF_INSN_FLAG; + registers.pc -= 2; + if (get_word(registers.pc) != BREAKPOINT_OPCODE) + sigval = 4; /* SIGILL */ + } + if (ERR_DETECT_REG & BAD_ADDR_FLAG) + { + ERR_DETECT_REG &= ~BAD_ADDR_FLAG; + sigval = 11; /* SIGSEGV */ + } + if (ERR_DETECT_REG & SER0_IRQ_FLAG) + { + unsigned char ch; + + ch = getDebugChar(); + ERR_DETECT_REG &= ~SER0_IRQ_FLAG; + if (ch != 0x03) + return; + sigval = 2; /* SIGINT */ + } + + finish_from_step(); + + /* save original context so it can be restored as a result of + a kill packet. */ + if (orig_registers.pc == 0L) + assign_regs (&orig_registers, ®isters); + + if (is_running) + { + ptr = remcomBuffer; + + *ptr++ = 'T'; /* notify gdb with signo, PC, FP and SP */ + *ptr++ = hexchars[sigval >> 4]; + *ptr++ = hexchars[sigval & 0xf]; + + ptr = putreg (ptr, PC, ®isters.pc, 4); + ptr = putreg (ptr, FP, ®isters.r[FP], 2); + ptr = putreg (ptr, SP, ®isters.r[SP], 2); + + *ptr++ = 0; + + putPacket(remcomBuffer); + } + + while (1) { + char kind; + + ptr = getpacket(); + kind = *ptr++; + if (kind == 'M' || kind == 'X') + { + /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */ + /* TRY TO READ '%x,%x:'. IF SUCCEED, SET PTR = 0 */ + if (hexToInt(&ptr,&addr) + && *(ptr++) == ',' + && hexToInt(&ptr,&length) + && *(ptr++) == ':') + { + if (valid_addr_range (addr, length)) + { + if (kind == 'M') + hex2mem(ptr, addr, length); + else + { + int i; + for (i = 0; i < length; i++) + if (*ptr++ == 0x7d) + set_char (addr++, *ptr++ ^ 0x20); + else + set_char (addr++, ptr[-1]); + + } + putPacket ("OK"); + } + else + putPacket ("E03"); + } + else + putPacket ("E02"); + } + else if (kind == 'm') + { + /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */ + /* TRY TO READ %x,%x. IF SUCCEED, SET PTR = 0 */ + if (hexToInt(&ptr,&addr) + && *(ptr++) == ',' + && hexToInt (&ptr,&length)) + { + if (valid_addr_range (addr, length)) + putHex (0, addr, length); + else + putPacket ("E03"); + } + else + putPacket ("E02"); + } + else if (kind == 'R') + { + if (hexToInt (&ptr, &addr)) + registers.pc = addr; + putPacket ("OK"); + } + else if (kind == '!') + putPacket ("OK"); + else if (kind == '?') + putHex ('S', (unsigned long)(unsigned int)&sigval, 1); + else if (kind == 'g') + putHex (0, (unsigned long)(unsigned int)®isters, NUMREGBYTES); + else if (kind == 'P') + { + /* set the value of a single CPU register - return OK */ + unsigned long regno; + + if (hexToInt (&ptr, ®no) + && *ptr++ == '=' + && regno < NUMREGS) + { + hex2mem (ptr, (unsigned long)(unsigned int)(registers.r + regno), + regno == PC ? 4 : 2); + putPacket ("OK"); + } + else + putPacket ("E01"); + } + else if (kind == 'G') + { + /* set the value of the CPU registers - return OK */ + hex2mem(ptr, (unsigned long)(unsigned int)®isters, NUMREGBYTES); + putPacket ("OK"); + } + else if (kind == 's' || kind == 'c') + { + /* sAA..AA Step one instruction from AA..AA(optional) */ + /* cAA..AA Continue from address AA..AA(optional) */ + /* try to read optional parameter, pc unchanged if no parm */ + + is_running = 1; + + if (hexToInt(&ptr,&addr)) + registers.pc = addr; + + if (kind == 's') /* single-stepping */ + prepare_to_step(); + return; + } + else if (kind == 'k') + { + /* kill the program */ + assign_regs (®isters, &orig_registers); + is_running = 0; + putPacket (""); + } + else + /* Unknown code. Return an empty reply message. */ + putPacket (""); + } +} + +static int +hex (int ch) +{ + if ((ch >= '0') && (ch <= '9')) return (ch-'0'); + if ((ch >= 'a') && (ch <= 'f')) return (ch-'a'+10); + if ((ch >= 'A') && (ch <= 'F')) return (ch-'A'+10); + return (-1); +} + +/* scan for the sequence $<data>#<checksum> */ + +static unsigned char * +getpacket (void) +{ + unsigned char *buffer = &remcomBuffer[0]; + unsigned checksum; + int count; + char ch; + + while (1) + { + /* wait around for the start character, ignore all other characters */ + while (getDebugChar () != '$') + ; + + checksum = 0; + count = 0; + while ((ch = getDebugChar ()) == '$') + ; + + /* now, read until a # or end of buffer is found */ + while (ch != '#' && count < BUFMAX - 1) + { + checksum = checksum + ch; + buffer[count] = ch; + count = count + 1; + ch = getDebugChar (); + } + buffer[count] = 0; + + if (ch == '#') + { + unsigned xmitcsum; + ch = getDebugChar (); + xmitcsum = hex (ch) << 4; + ch = getDebugChar (); + xmitcsum += hex (ch); + + /* If one of the above 'hex' calls returns -1, xmitcsum will + have high bits set, and so the test below will fail. */ + + if ((checksum & 0xFF) != xmitcsum) + putDebugChar ('-'); /* failed checksum */ + else + { + putDebugChar ('+'); /* successful transfer */ + return &buffer[0]; + } + } + } +} + +/* send the packet in buffer. */ + +static void +putPacket (unsigned char *buffer_p) +{ + /* $<packet info>#<checksum>. */ + do { + unsigned checksum; + unsigned char *buffer = buffer_p; + + putDebugChar('$'); + checksum = 0; + + while (*buffer) { + putDebugChar(*buffer); + checksum += *buffer; + buffer++; + } + putDebugChar('#'); + putDebugChar(hexchars[(checksum >> 4) % 16]); + putDebugChar(hexchars[checksum % 16]); + } while (getDebugChar() != '+'); +} + +/* Convert the memory pointed to by mem into hex, and return it as a packet. */ + +static void +putHex (char c, unsigned long mem_arg, int count) +{ + do { + unsigned long mem = mem_arg; + int i; + unsigned checksum; + + putDebugChar('$'); + checksum = 0; + + if (c) + { + checksum = c; + putDebugChar(c); + } + + for (i = 0; i < count; i++) + { + unsigned char c = get_char (mem); + char ch = hexchars[c >> 4]; + putDebugChar(ch); + checksum += ch; + ch = hexchars[c % 16]; + putDebugChar(ch); + checksum += ch; + mem++; + } + putDebugChar('#'); + putDebugChar(hexchars[(checksum >> 4) % 16]); + putDebugChar(hexchars[checksum % 16]); + } while (getDebugChar() != '+'); +} + +/* Function: gdb_write(char *, int) + Make gdb write n bytes to stdout (not assumed to be null-terminated). */ + +void +gdb_write (char *data, int len) +{ + ERR_DETECT_REG &= ~SER0_IRQ_ENA; + putHex ('O', (unsigned long)(unsigned int)data, len); + ERR_DETECT_REG |= SER0_IRQ_ENA; +} + +int +gdb_read (char *buf, int nbytes) +{ + int i = 0; + + ERR_DETECT_REG &= ~SER0_IRQ_ENA; + for (i = 0; i < nbytes; i++) + { + *(buf + i) = getDebugChar(); + if ((*(buf + i) == '\n') || (*(buf + i) == '\r')) + { + (*(buf + i + 1)) = 0; + break; + } + } + ERR_DETECT_REG |= SER0_IRQ_ENA; + return (i); +} + +static int +valid_addr_range (unsigned long mem, int count) +{ + unsigned long last = mem + count - 1; + + if (last < 0x800L) + return 1; + + if (mem < 0x7f00L) + return 0; + + if (last > 0x7ffffL) + return 0; + + return 1; +} + +/* Convert the hex array pointed to by buf into binary to be placed in mem. + Return a pointer to the character AFTER the last byte written. */ + +static void +hex2mem (unsigned char *buf, unsigned long mem, int count) +{ + int i; + unsigned char ch; + + for (i=0;i<count;i++) + { + ch = hex(*buf++) << 4; + ch = ch + hex(*buf++); + set_char (mem++, ch); + } +} + +/**********************************************/ +/* WHILE WE FIND NICE HEX CHARS, BUILD AN INT */ +/* RETURN NUMBER OF CHARS PROCESSED */ +/**********************************************/ +static int +hexToInt (unsigned char **ptr, long *intValue) +{ + int numChars = 0; + int hexValue; + + *intValue = 0; + while (**ptr) + { + hexValue = hex(**ptr); + if (hexValue >=0) + { + *intValue = (*intValue <<4) | (unsigned) hexValue; + numChars ++; + } + else + break; + (*ptr)++; + } + return (numChars); +} + + +/* Function: opcode_size + Determine number of bytes in full opcode by examining first word. +*/ +static int +opcode_size(unsigned int opcode) +{ + if ((opcode & 0xff00) == 0) + return 2; + + if ((opcode & 0xf800) == 0) + return 4; + + if ((opcode & 0xf800) == 0x7800) + return 4; + + if ((opcode & 0xf000) == 0xc000) + return 4; + + if ((opcode & 0xf100) == 0x2000) + return 4; + + if ((opcode & 0xfff0) == 0x30e0) + return 4; + + if ((opcode & 0xf008) == 0x6008) + return 4; + + if ((opcode & 0xf808) == 0x7008) + return 4; + + opcode >>= 8; + if (opcode == 0x0c || opcode == 0x0d || opcode == 0x31) + return 4; + + return 2; +} + +static struct { + unsigned long addr; + unsigned long addr2; + unsigned int opcode; + unsigned int opcode2; +} stepinfo; + +/* Function: prepare_to_step + Called from handle_exception to prepare the user program to single-step. + Places a trap instruction after the target instruction, with special + extra handling for branch instructions. +*/ + +static void +prepare_to_step(void) +{ + unsigned long pc = registers.pc; + unsigned long next_pc, next_pc2; + unsigned int op, op2, sp; + unsigned char op_msb, op_lsb; + int r12; + char r8; + + op = get_word(pc); + op_msb = (op >> 8) & 0xff; + op_lsb = op & 0xff; + op2 = get_word(pc + 2); + next_pc = pc + opcode_size(op); + next_pc2 = 0; + + if (op_msb == 0) + { + if (op_lsb == 2) + { + /* IRET */ + sp = registers.r[SP]; + next_pc = *(unsigned *)(sp - 4); + next_pc = (next_pc << 16) | *(unsigned *)(sp - 6); + } + else if (op_lsb == 3) + { + /* RET */ + sp = registers.r[SP]; + next_pc = *(unsigned *)(sp - 2); + next_pc = (next_pc << 16) | *(unsigned *)(sp - 4); + } + else + { + op2 = op_lsb & 0xf0; + if (op2 && op2 < 0x40) + { + /* {CALLR,BR,ICALLR} Rs */ + next_pc = (pc + 2) + (int)registers.r[op_lsb & 0xf]; + } + else if (op2 < 0x80 || op2 == 0xa0 || op2 == 0xb0) + { + /* {JMP,ICALL,CALL} Rb,Rs */ + next_pc = registers.r[(op_lsb & 0x10) ? 9 : 8]; + next_pc = (next_pc << 16) | (unsigned int)registers.r[op_lsb & 0xf]; + } + } + } + else if (op_msb < 4) + { + /* {CALLF,JMPF,ICALLF} a24 */ + next_pc = ((unsigned long)op2) << 8; + next_pc |= op_lsb; + } + else if (op_msb < 8) + { + if ((op2 & 0xf000) == 0) + { + /* Bx Rd,#imm4,r12 */ + /* Bx Rd,Rs,r12 */ + r12 = op2 << 4; + r12 >>= 4; + next_pc2 = (pc + 4) + r12; + } + } + else if (op_msb == 0x0c || op_msb == 0x0d || (op_msb & 0xf1) == 0x20 || + ((op_msb >= 0x7c && op_msb <= 0x7f) && (op2 & 0x8000) == 0)) + { + /* Bxx Rd,Rs,r12 */ + /* Bxx Rd,#imm8,r12 */ + /* Bx m8,#imm3,r12 */ + /* Bx s8,#imm3,r12 */ + r12 = op2 << 4; + r12 >>= 4; + next_pc2 = (pc + 4) + r12; + } + else if ((op_msb & 0xf0) == 0x10) + { + /* {BR,CALLR} r12 */ + r12 = (op & 0xffe) << 4; + r12 >>= 4; + next_pc = (pc + 2) + r12; + } + else if ((op_msb & 0xe0) == 0xc0) + { + /* Bxx Rx,#imm16,r8 */ + /* TBxx r8 */ + r8 = op_lsb; + next_pc2 = next_pc + r8; + } + + stepinfo.addr = next_pc; + stepinfo.opcode = get_word(next_pc); + set_word(next_pc, BREAKPOINT_OPCODE); + + if (next_pc2) + { + stepinfo.addr2 = next_pc2; + stepinfo.opcode2 = get_word(next_pc2); + set_word(next_pc2, BREAKPOINT_OPCODE); + } +} + +/* Function: finish_from_step + Called from handle_exception to finish up when the user program + returns from a single-step. Replaces the instructions that had + been overwritten by breakpoint. */ + +static void +finish_from_step (void) +{ + if (stepinfo.addr) /* anything to do? */ + { + set_word(stepinfo.addr, stepinfo.opcode); + stepinfo.addr = 0; + if (stepinfo.addr2) + { + set_word(stepinfo.addr2, stepinfo.opcode2); + stepinfo.addr2 = 0; + } + } +} + + +/* + * UART support + */ +#define UART0_BASE 0x7f38 +#define UART1_BASE 0x7f48 + +#define UART_CR(base) (*(volatile unsigned char *)(base)) +#define UART_RXD(base) (*(volatile unsigned int *)((base) + 2)) +#define UART_TXD(base) (*(volatile unsigned int *)((base) + 4)) + +#define UART_CR_RUN 0x80 +#define UART_CR_ERR 0x40 +#define UART_CR_BAUD_115k 0x20 +#define UART_CR_PARITY 0x10 +#define UART_CR_TXEMPTY 0x08 +#define UART_CR_TXIEN 0x04 +#define UART_CR_RXRDY 0x02 +#define UART_CR_RXIEN 0x01 + +#define DBG_UART UART0_BASE + +static void +putDebugChar(unsigned ch) +{ + while ((UART_CR(DBG_UART) & UART_CR_TXEMPTY) == 0) ; + + UART_TXD(DBG_UART) = ch; +} + +static unsigned char +getDebugChar(void) +{ + while ((UART_CR(DBG_UART) & UART_CR_RXRDY) == 0) ; + + return UART_RXD(DBG_UART); +} + +void +uart_init(void) +{ + UART_CR(DBG_UART) |= (UART_CR_RUN | UART_CR_RXIEN); +} + |