mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-31 11:30:56 +08:00
2010-10-08 Bernd Schmidt <bernds@codesourcery.com>
Joseph Myers <joseph@codesourcery.com> * configure.in: Handle tic6x targets. * configure: Regenerate. * tic6x/Makefile.in, tic6x/configure.in, tic6x/crt0.S, tic6x/getpid.c, tic6x/kill.c, tic6x/sbrk.c, tic6x/syscalls.c: New. * tic6x/configure: New (generated).
This commit is contained in:
parent
cab874029f
commit
4606798ea0
@ -1,3 +1,12 @@
|
||||
2010-10-08 Bernd Schmidt <bernds@codesourcery.com>
|
||||
Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
* configure.in: Handle tic6x targets.
|
||||
* configure: Regenerate.
|
||||
* tic6x/Makefile.in, tic6x/configure.in, tic6x/crt0.S,
|
||||
tic6x/getpid.c, tic6x/kill.c, tic6x/sbrk.c, tic6x/syscalls.c: New.
|
||||
* tic6x/configure: New (generated).
|
||||
|
||||
2010-10-02 Anthony Green <green@moxielogic.com>
|
||||
|
||||
* moxie/Makefile.in (QEMU_OBJS): Add missing object files to the
|
||||
|
6
libgloss/configure
vendored
6
libgloss/configure
vendored
@ -732,6 +732,7 @@ m32c
|
||||
rx
|
||||
arm
|
||||
spu
|
||||
tic6x
|
||||
iq2000
|
||||
libnosys'
|
||||
|
||||
@ -2561,6 +2562,11 @@ case "${target}" in
|
||||
config_testsuite=false
|
||||
config_libnosys=false
|
||||
;;
|
||||
tic6x-*-*)
|
||||
subdirs="$subdirs tic6x"
|
||||
|
||||
config_testsuite=false
|
||||
;;
|
||||
iq2000-*-*)
|
||||
subdirs="$subdirs iq2000"
|
||||
|
||||
|
@ -129,6 +129,10 @@ case "${target}" in
|
||||
config_testsuite=false
|
||||
config_libnosys=false
|
||||
;;
|
||||
tic6x-*-*)
|
||||
AC_CONFIG_SUBDIRS(tic6x)
|
||||
config_testsuite=false
|
||||
;;
|
||||
iq2000-*-*)
|
||||
AC_CONFIG_SUBDIRS([iq2000])
|
||||
;;
|
||||
|
126
libgloss/tic6x/Makefile.in
Normal file
126
libgloss/tic6x/Makefile.in
Normal file
@ -0,0 +1,126 @@
|
||||
#
|
||||
#
|
||||
|
||||
DESTDIR =
|
||||
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@
|
||||
|
||||
OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \
|
||||
then echo ${objroot}/../binutils/objdump ; \
|
||||
else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi`
|
||||
OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \
|
||||
then echo ${objroot}/../binutils/objcopy ; \
|
||||
else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi`
|
||||
|
||||
CFLAGS = -g
|
||||
SCRIPTS =
|
||||
|
||||
# Here is all of the simulator stuff
|
||||
SIM_SCRIPTS =
|
||||
SIM_LDFLAGS =
|
||||
SIM_BSP = libsim.a
|
||||
SIM_CRT0 = crt0.o
|
||||
SIM_OBJS = sbrk.o putnum.o getpid.o kill.o syscalls.o
|
||||
SIM_TEST = sim-test
|
||||
SIM_INSTALL = install-sim
|
||||
|
||||
# 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: ${SIM_CRT0} ${SIM_BSP}
|
||||
|
||||
#
|
||||
# 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}
|
||||
|
||||
|
||||
#
|
||||
# here's where we build the test programs for each target
|
||||
#
|
||||
.PHONY: test
|
||||
test: ${SIM_TEST}
|
||||
|
||||
sim-test: sim-test.x sim-test.dis
|
||||
|
||||
sim-test.x: test.o ${SIM_CRT0} ${SIM_BSP}
|
||||
${CC} ${LDFLAGS_FOR_TARGET} -L${objdir} \
|
||||
${SIM_CRT0} test.o \
|
||||
-o sim-test.x ${LIBS_FOR_TARGET} -lc ${SIM_BSP}
|
||||
|
||||
sim-test.dis: sim-test.x
|
||||
${OBJDUMP} -d sim-test.x > sim-test.dis
|
||||
|
||||
|
||||
#
|
||||
#
|
||||
#
|
||||
.c.S:
|
||||
${CC} ${CFLAGS_FOR_TARGET} -c $<
|
||||
|
||||
clean mostlyclean:
|
||||
rm -f a.out core *.i *.o *-test *.srec *.dis *.x $(SIM_BSP)
|
||||
|
||||
distclean maintainer-clean realclean: clean
|
||||
rm -f Makefile config.status *~
|
||||
|
||||
.PHONY: install info install-info clean-info
|
||||
install: ${SIM_INSTALL}
|
||||
|
||||
install-sim:
|
||||
set -e;\
|
||||
for x in ${SIM_CRT0} ${SIM_BSP}; do\
|
||||
${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x;\
|
||||
done
|
||||
for x in ${SIM_SCRIPTS}; do\
|
||||
${INSTALL_DATA} ${srcdir}/$${x} $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; \
|
||||
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
|
404
libgloss/tic6x/aclocal.m4
vendored
Normal file
404
libgloss/tic6x/aclocal.m4
vendored
Normal file
@ -0,0 +1,404 @@
|
||||
# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
# AM_CONDITIONAL -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 9
|
||||
|
||||
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
|
||||
# -------------------------------------
|
||||
# Define a conditional.
|
||||
AC_DEFUN([AM_CONDITIONAL],
|
||||
[AC_PREREQ(2.52)dnl
|
||||
ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
|
||||
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
|
||||
AC_SUBST([$1_TRUE])dnl
|
||||
AC_SUBST([$1_FALSE])dnl
|
||||
_AM_SUBST_NOTMAKE([$1_TRUE])dnl
|
||||
_AM_SUBST_NOTMAKE([$1_FALSE])dnl
|
||||
m4_define([_AM_COND_VALUE_$1], [$2])dnl
|
||||
if $2; then
|
||||
$1_TRUE=
|
||||
$1_FALSE='#'
|
||||
else
|
||||
$1_TRUE='#'
|
||||
$1_FALSE=
|
||||
fi
|
||||
AC_CONFIG_COMMANDS_PRE(
|
||||
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
|
||||
AC_MSG_ERROR([[conditional "$1" was never defined.
|
||||
Usually this means the macro was only invoked conditionally.]])
|
||||
fi])])
|
||||
|
||||
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 10
|
||||
|
||||
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
|
||||
# written in clear, in which case automake, when reading aclocal.m4,
|
||||
# will think it sees a *use*, and therefore will trigger all it's
|
||||
# C support machinery. Also note that it means that autoscan, seeing
|
||||
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
|
||||
|
||||
|
||||
# _AM_DEPENDENCIES(NAME)
|
||||
# ----------------------
|
||||
# See how the compiler implements dependency checking.
|
||||
# NAME is "CC", "CXX", "GCJ", or "OBJC".
|
||||
# We try a few techniques and use that to set a single cache variable.
|
||||
#
|
||||
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
|
||||
# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
|
||||
# dependency, and given that the user is not expected to run this macro,
|
||||
# just rely on AC_PROG_CC.
|
||||
AC_DEFUN([_AM_DEPENDENCIES],
|
||||
[AC_REQUIRE([AM_SET_DEPDIR])dnl
|
||||
AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
|
||||
AC_REQUIRE([AM_MAKE_INCLUDE])dnl
|
||||
AC_REQUIRE([AM_DEP_TRACK])dnl
|
||||
|
||||
ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
|
||||
[$1], CXX, [depcc="$CXX" am_compiler_list=],
|
||||
[$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
|
||||
[$1], UPC, [depcc="$UPC" am_compiler_list=],
|
||||
[$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
|
||||
[depcc="$$1" am_compiler_list=])
|
||||
|
||||
AC_CACHE_CHECK([dependency style of $depcc],
|
||||
[am_cv_$1_dependencies_compiler_type],
|
||||
[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
|
||||
# We make a subdir and do the tests there. Otherwise we can end up
|
||||
# making bogus files that we don't know about and never remove. For
|
||||
# instance it was reported that on HP-UX the gcc test will end up
|
||||
# making a dummy file named `D' -- because `-MD' means `put the output
|
||||
# in D'.
|
||||
mkdir conftest.dir
|
||||
# Copy depcomp to subdir because otherwise we won't find it if we're
|
||||
# using a relative directory.
|
||||
cp "$am_depcomp" conftest.dir
|
||||
cd conftest.dir
|
||||
# We will build objects and dependencies in a subdirectory because
|
||||
# it helps to detect inapplicable dependency modes. For instance
|
||||
# both Tru64's cc and ICC support -MD to output dependencies as a
|
||||
# side effect of compilation, but ICC will put the dependencies in
|
||||
# the current directory while Tru64 will put them in the object
|
||||
# directory.
|
||||
mkdir sub
|
||||
|
||||
am_cv_$1_dependencies_compiler_type=none
|
||||
if test "$am_compiler_list" = ""; then
|
||||
am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
|
||||
fi
|
||||
am__universal=false
|
||||
m4_case([$1], [CC],
|
||||
[case " $depcc " in #(
|
||||
*\ -arch\ *\ -arch\ *) am__universal=true ;;
|
||||
esac],
|
||||
[CXX],
|
||||
[case " $depcc " in #(
|
||||
*\ -arch\ *\ -arch\ *) am__universal=true ;;
|
||||
esac])
|
||||
|
||||
for depmode in $am_compiler_list; do
|
||||
# Setup a source with many dependencies, because some compilers
|
||||
# like to wrap large dependency lists on column 80 (with \), and
|
||||
# we should not choose a depcomp mode which is confused by this.
|
||||
#
|
||||
# We need to recreate these files for each test, as the compiler may
|
||||
# overwrite some of them when testing with obscure command lines.
|
||||
# This happens at least with the AIX C compiler.
|
||||
: > sub/conftest.c
|
||||
for i in 1 2 3 4 5 6; do
|
||||
echo '#include "conftst'$i'.h"' >> sub/conftest.c
|
||||
# Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
|
||||
# Solaris 8's {/usr,}/bin/sh.
|
||||
touch sub/conftst$i.h
|
||||
done
|
||||
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
|
||||
|
||||
# We check with `-c' and `-o' for the sake of the "dashmstdout"
|
||||
# mode. It turns out that the SunPro C++ compiler does not properly
|
||||
# handle `-M -o', and we need to detect this. Also, some Intel
|
||||
# versions had trouble with output in subdirs
|
||||
am__obj=sub/conftest.${OBJEXT-o}
|
||||
am__minus_obj="-o $am__obj"
|
||||
case $depmode in
|
||||
gcc)
|
||||
# This depmode causes a compiler race in universal mode.
|
||||
test "$am__universal" = false || continue
|
||||
;;
|
||||
nosideeffect)
|
||||
# after this tag, mechanisms are not by side-effect, so they'll
|
||||
# only be used when explicitly requested
|
||||
if test "x$enable_dependency_tracking" = xyes; then
|
||||
continue
|
||||
else
|
||||
break
|
||||
fi
|
||||
;;
|
||||
msvisualcpp | msvcmsys)
|
||||
# This compiler won't grok `-c -o', but also, the minuso test has
|
||||
# not run yet. These depmodes are late enough in the game, and
|
||||
# so weak that their functioning should not be impacted.
|
||||
am__obj=conftest.${OBJEXT-o}
|
||||
am__minus_obj=
|
||||
;;
|
||||
none) break ;;
|
||||
esac
|
||||
if depmode=$depmode \
|
||||
source=sub/conftest.c object=$am__obj \
|
||||
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
|
||||
$SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
|
||||
>/dev/null 2>conftest.err &&
|
||||
grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
|
||||
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
|
||||
grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
|
||||
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
|
||||
# icc doesn't choke on unknown options, it will just issue warnings
|
||||
# or remarks (even with -Werror). So we grep stderr for any message
|
||||
# that says an option was ignored or not supported.
|
||||
# When given -MP, icc 7.0 and 7.1 complain thusly:
|
||||
# icc: Command line warning: ignoring option '-M'; no argument required
|
||||
# The diagnosis changed in icc 8.0:
|
||||
# icc: Command line remark: option '-MP' not supported
|
||||
if (grep 'ignoring option' conftest.err ||
|
||||
grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
|
||||
am_cv_$1_dependencies_compiler_type=$depmode
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
cd ..
|
||||
rm -rf conftest.dir
|
||||
else
|
||||
am_cv_$1_dependencies_compiler_type=none
|
||||
fi
|
||||
])
|
||||
AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
|
||||
AM_CONDITIONAL([am__fastdep$1], [
|
||||
test "x$enable_dependency_tracking" != xno \
|
||||
&& test "$am_cv_$1_dependencies_compiler_type" = gcc3])
|
||||
])
|
||||
|
||||
|
||||
# AM_SET_DEPDIR
|
||||
# -------------
|
||||
# Choose a directory name for dependency files.
|
||||
# This macro is AC_REQUIREd in _AM_DEPENDENCIES
|
||||
AC_DEFUN([AM_SET_DEPDIR],
|
||||
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
|
||||
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
|
||||
])
|
||||
|
||||
|
||||
# AM_DEP_TRACK
|
||||
# ------------
|
||||
AC_DEFUN([AM_DEP_TRACK],
|
||||
[AC_ARG_ENABLE(dependency-tracking,
|
||||
[ --disable-dependency-tracking speeds up one-time build
|
||||
--enable-dependency-tracking do not reject slow dependency extractors])
|
||||
if test "x$enable_dependency_tracking" != xno; then
|
||||
am_depcomp="$ac_aux_dir/depcomp"
|
||||
AMDEPBACKSLASH='\'
|
||||
fi
|
||||
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
|
||||
AC_SUBST([AMDEPBACKSLASH])dnl
|
||||
_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
|
||||
])
|
||||
|
||||
# Generate code to set up dependency tracking. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
#serial 5
|
||||
|
||||
# _AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||
# ------------------------------
|
||||
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[{
|
||||
# Autoconf 2.62 quotes --file arguments for eval, but not when files
|
||||
# are listed without --file. Let's play safe and only enable the eval
|
||||
# if we detect the quoting.
|
||||
case $CONFIG_FILES in
|
||||
*\'*) eval set x "$CONFIG_FILES" ;;
|
||||
*) set x $CONFIG_FILES ;;
|
||||
esac
|
||||
shift
|
||||
for mf
|
||||
do
|
||||
# Strip MF so we end up with the name of the file.
|
||||
mf=`echo "$mf" | sed -e 's/:.*$//'`
|
||||
# Check whether this is an Automake generated Makefile or not.
|
||||
# We used to match only the files named `Makefile.in', but
|
||||
# some people rename them; so instead we look at the file content.
|
||||
# Grep'ing the first line is not enough: some people post-process
|
||||
# each Makefile.in and add a new line on top of each file to say so.
|
||||
# Grep'ing the whole file is not good either: AIX grep has a line
|
||||
# limit of 2048, but all sed's we know have understand at least 4000.
|
||||
if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
|
||||
dirpart=`AS_DIRNAME("$mf")`
|
||||
else
|
||||
continue
|
||||
fi
|
||||
# Extract the definition of DEPDIR, am__include, and am__quote
|
||||
# from the Makefile without running `make'.
|
||||
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
|
||||
test -z "$DEPDIR" && continue
|
||||
am__include=`sed -n 's/^am__include = //p' < "$mf"`
|
||||
test -z "am__include" && continue
|
||||
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
|
||||
# When using ansi2knr, U may be empty or an underscore; expand it
|
||||
U=`sed -n 's/^U = //p' < "$mf"`
|
||||
# Find all dependency output files, they are included files with
|
||||
# $(DEPDIR) in their names. We invoke sed twice because it is the
|
||||
# simplest approach to changing $(DEPDIR) to its actual value in the
|
||||
# expansion.
|
||||
for file in `sed -n "
|
||||
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
|
||||
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
|
||||
# Make sure the directory exists.
|
||||
test -f "$dirpart/$file" && continue
|
||||
fdir=`AS_DIRNAME(["$file"])`
|
||||
AS_MKDIR_P([$dirpart/$fdir])
|
||||
# echo "creating $dirpart/$file"
|
||||
echo '# dummy' > "$dirpart/$file"
|
||||
done
|
||||
done
|
||||
}
|
||||
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||
|
||||
|
||||
# AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||
# -----------------------------
|
||||
# This macro should only be invoked once -- use via AC_REQUIRE.
|
||||
#
|
||||
# This code is only required when automatic dependency tracking
|
||||
# is enabled. FIXME. This creates each `.P' file that we will
|
||||
# need in order to bootstrap the dependency handling code.
|
||||
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[AC_CONFIG_COMMANDS([depfiles],
|
||||
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
|
||||
])
|
||||
|
||||
# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 2
|
||||
|
||||
# Check whether the underlying file-system supports filenames
|
||||
# with a leading dot. For instance MS-DOS doesn't.
|
||||
AC_DEFUN([AM_SET_LEADING_DOT],
|
||||
[rm -rf .tst 2>/dev/null
|
||||
mkdir .tst 2>/dev/null
|
||||
if test -d .tst; then
|
||||
am__leading_dot=.
|
||||
else
|
||||
am__leading_dot=_
|
||||
fi
|
||||
rmdir .tst 2>/dev/null
|
||||
AC_SUBST([am__leading_dot])])
|
||||
|
||||
# Check to see how 'make' treats includes. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 4
|
||||
|
||||
# AM_MAKE_INCLUDE()
|
||||
# -----------------
|
||||
# Check to see how make treats includes.
|
||||
AC_DEFUN([AM_MAKE_INCLUDE],
|
||||
[am_make=${MAKE-make}
|
||||
cat > confinc << 'END'
|
||||
am__doit:
|
||||
@echo this is the am__doit target
|
||||
.PHONY: am__doit
|
||||
END
|
||||
# If we don't find an include directive, just comment out the code.
|
||||
AC_MSG_CHECKING([for style of include used by $am_make])
|
||||
am__include="#"
|
||||
am__quote=
|
||||
_am_result=none
|
||||
# First try GNU make style include.
|
||||
echo "include confinc" > confmf
|
||||
# Ignore all kinds of additional output from `make'.
|
||||
case `$am_make -s -f confmf 2> /dev/null` in #(
|
||||
*the\ am__doit\ target*)
|
||||
am__include=include
|
||||
am__quote=
|
||||
_am_result=GNU
|
||||
;;
|
||||
esac
|
||||
# Now try BSD make style include.
|
||||
if test "$am__include" = "#"; then
|
||||
echo '.include "confinc"' > confmf
|
||||
case `$am_make -s -f confmf 2> /dev/null` in #(
|
||||
*the\ am__doit\ target*)
|
||||
am__include=.include
|
||||
am__quote="\""
|
||||
_am_result=BSD
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
AC_SUBST([am__include])
|
||||
AC_SUBST([am__quote])
|
||||
AC_MSG_RESULT([$_am_result])
|
||||
rm -f confinc confmf
|
||||
])
|
||||
|
||||
# Copyright (C) 2006, 2008 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 2
|
||||
|
||||
# _AM_SUBST_NOTMAKE(VARIABLE)
|
||||
# ---------------------------
|
||||
# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
|
||||
# This macro is traced by Automake.
|
||||
AC_DEFUN([_AM_SUBST_NOTMAKE])
|
||||
|
||||
# AM_SUBST_NOTMAKE(VARIABLE)
|
||||
# ---------------------------
|
||||
# Public sister of _AM_SUBST_NOTMAKE.
|
||||
AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
|
||||
|
||||
m4_include([../acinclude.m4])
|
3974
libgloss/tic6x/configure
vendored
Executable file
3974
libgloss/tic6x/configure
vendored
Executable file
File diff suppressed because it is too large
Load Diff
54
libgloss/tic6x/configure.in
Normal file
54
libgloss/tic6x/configure.in
Normal file
@ -0,0 +1,54 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_PREREQ(2.59)
|
||||
AC_INIT(crt0.S)
|
||||
|
||||
if test "${enable_shared}" = "yes" ; then
|
||||
echo "Shared libraries not supported for cross compiling, ignored"
|
||||
fi
|
||||
|
||||
if test "$srcdir" = "." ; then
|
||||
if test "${with_target_subdir}" != "." ; then
|
||||
libgloss_topdir="${srcdir}/${with_multisrctop}../../.."
|
||||
else
|
||||
libgloss_topdir="${srcdir}/${with_multisrctop}../.."
|
||||
fi
|
||||
else
|
||||
libgloss_topdir="${srcdir}/../.."
|
||||
fi
|
||||
AC_CONFIG_AUX_DIR($libgloss_topdir)
|
||||
|
||||
AC_CANONICAL_SYSTEM
|
||||
AC_ARG_PROGRAM
|
||||
|
||||
AC_PROG_INSTALL
|
||||
|
||||
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
|
||||
LIB_AM_PROG_AS
|
||||
|
||||
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_CONFIG_FILES(Makefile,
|
||||
. ${libgloss_topdir}/config-ml.in,
|
||||
srcdir=${srcdir}
|
||||
target=${target}
|
||||
with_multisubdir=${with_multisubdir}
|
||||
ac_configure_args="${ac_configure_args} --enable-multilib"
|
||||
CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
|
||||
libgloss_topdir=${libgloss_topdir}
|
||||
)
|
||||
AC_OUTPUT
|
63
libgloss/tic6x/crt0.S
Normal file
63
libgloss/tic6x/crt0.S
Normal file
@ -0,0 +1,63 @@
|
||||
/* crt0.S for the TI C6X series of processors
|
||||
|
||||
Copyright (c) 2010 CodeSourcery, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of CodeSourcery nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY CODESOURCERY, INC. ``AS IS'' AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CODESOURCERY BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGE. */
|
||||
|
||||
.text
|
||||
.align 2
|
||||
|
||||
.global _start
|
||||
_start:
|
||||
/* Start by setting up a stack */
|
||||
mvkl .s2 _STACK_START - 4, B15
|
||||
mvkh .s2 _STACK_START - 4, B15
|
||||
and .s2 -8, B15, B15
|
||||
|
||||
mvkl .s2 __c6xabi_DSBT_BASE, B14
|
||||
mvkh .s2 __c6xabi_DSBT_BASE, B14
|
||||
|
||||
#ifdef __DSBT__
|
||||
stw .d2t2 B14, *B14
|
||||
#endif
|
||||
/* Zero the memory in the .bss section. */
|
||||
|
||||
/* Set up GOT pointer. */
|
||||
|
||||
mvkl .s2 1f, B3
|
||||
mvkh .s2 1f, B3
|
||||
call .s2 _init
|
||||
nop 5
|
||||
1:
|
||||
|
||||
mvkl .s2 1f, B3
|
||||
mvkh .s2 1f, B3
|
||||
call .s2 main
|
||||
nop 5
|
||||
1:
|
||||
|
||||
b .s2 exit
|
||||
nop 5
|
26
libgloss/tic6x/getpid.c
Normal file
26
libgloss/tic6x/getpid.c
Normal file
@ -0,0 +1,26 @@
|
||||
/* 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 <_ansi.h>
|
||||
#define __MYPID 1
|
||||
|
||||
/*
|
||||
* getpid -- only one process, so just return 1.
|
||||
*/
|
||||
int
|
||||
_DEFUN (getpid, (),
|
||||
)
|
||||
{
|
||||
return __MYPID;
|
||||
}
|
29
libgloss/tic6x/kill.c
Normal file
29
libgloss/tic6x/kill.c
Normal file
@ -0,0 +1,29 @@
|
||||
/* 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 <_ansi.h>
|
||||
#define __MYPID 1
|
||||
|
||||
/*
|
||||
* kill -- go out via exit...
|
||||
*/
|
||||
int
|
||||
_DEFUN (kill, (pid, sig),
|
||||
int pid _AND
|
||||
int sig)
|
||||
{
|
||||
if(pid == __MYPID)
|
||||
_exit(sig);
|
||||
return 0;
|
||||
}
|
59
libgloss/tic6x/sbrk.c
Normal file
59
libgloss/tic6x/sbrk.c
Normal file
@ -0,0 +1,59 @@
|
||||
/* sbrk.c -- Implementation of the low-level sbrk() routine
|
||||
*
|
||||
* Copyright (c) 2004 National Semiconductor Corporation
|
||||
*
|
||||
* 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 <stddef.h> /* where ptrdiff_t is defined */
|
||||
#include <stdlib.h>
|
||||
|
||||
/* Start of the heap. */
|
||||
extern const char _HEAP_START __attribute__((section(".heap")));
|
||||
/* End of the heap (maximum value of heap_ptr). */
|
||||
extern const char _HEAP_MAX __attribute__((section(".heap")));
|
||||
|
||||
/* Extend heap space by size bytes.
|
||||
Return start of new space allocated, or -1 for errors
|
||||
Error cases:
|
||||
1. Allocation is not within heap range */
|
||||
|
||||
void * sbrk (ptrdiff_t size)
|
||||
{
|
||||
/*
|
||||
* The following two memory locations should be defined in the linker script file
|
||||
*/
|
||||
|
||||
static const char * heap_ptr; /* pointer to head of heap */
|
||||
const char * old_heap_ptr;
|
||||
static unsigned char init_sbrk = 0;
|
||||
|
||||
/* heap_ptr is initialized to HEAP_START */
|
||||
if (init_sbrk == 0)
|
||||
{
|
||||
heap_ptr = &_HEAP_START;
|
||||
init_sbrk = 1;
|
||||
}
|
||||
|
||||
old_heap_ptr = heap_ptr;
|
||||
|
||||
if ((heap_ptr + size) > &_HEAP_MAX)
|
||||
{
|
||||
/* top of heap is bigger than _HEAP_MAX */
|
||||
errno = ENOMEM;
|
||||
return (void *) -1;
|
||||
}
|
||||
|
||||
/* success: update heap_ptr and return previous value */
|
||||
heap_ptr += size;
|
||||
return (void *)old_heap_ptr;
|
||||
}
|
361
libgloss/tic6x/syscalls.c
Normal file
361
libgloss/tic6x/syscalls.c
Normal file
@ -0,0 +1,361 @@
|
||||
/* Copyright (c) 2010 CodeSourcery, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of CodeSourcery nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY CODESOURCERY, INC. ``AS IS'' AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CODESOURCERY BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGE. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
|
||||
#define _DTOPEN 0xf0
|
||||
#define _DTCLOSE 0xf1
|
||||
#define _DTREAD 0xf2
|
||||
#define _DTWRITE 0xf3
|
||||
#define _DTLSEEK 0xf4
|
||||
#define _DTUNLINK 0xf5
|
||||
#define _DTGETENV 0xf6
|
||||
#define _DTRENAME 0xf7
|
||||
#define _DTGETTIME 0xf8
|
||||
#define _DTGETCLK 0xf9
|
||||
#define _DTSYNC 0xff
|
||||
|
||||
#define CIOBUFSIZ (BUFSIZ + 32)
|
||||
|
||||
struct __attribute__((packed)) cio_open_to_host
|
||||
{
|
||||
/* Suggested file descriptor (little endian). */
|
||||
short fd;
|
||||
/* Flags (little endian). */
|
||||
short flags;
|
||||
};
|
||||
|
||||
struct __attribute__((packed)) cio_open_from_host
|
||||
{
|
||||
/* File descriptor (little endian). */
|
||||
short fd;
|
||||
};
|
||||
|
||||
struct __attribute__((packed)) cio_close_to_host
|
||||
{
|
||||
/* File descriptor (little endian). */
|
||||
short fd;
|
||||
};
|
||||
|
||||
struct __attribute__((packed)) cio_close_from_host
|
||||
{
|
||||
/* Result (little endian). */
|
||||
short result;
|
||||
};
|
||||
|
||||
struct __attribute__((packed)) cio_read_to_host
|
||||
{
|
||||
/* File descriptor (little endian). */
|
||||
short fd;
|
||||
/* Length (little endian). */
|
||||
short length;
|
||||
};
|
||||
|
||||
struct __attribute__((packed)) cio_read_from_host
|
||||
{
|
||||
/* Result (little endian). */
|
||||
short result;
|
||||
};
|
||||
|
||||
struct __attribute__((packed)) cio_write_to_host
|
||||
{
|
||||
/* File descriptor (little endian). */
|
||||
short fd;
|
||||
/* Length (little endian). */
|
||||
short length;
|
||||
};
|
||||
|
||||
struct __attribute__((packed)) cio_write_from_host
|
||||
{
|
||||
/* Result (little endian). */
|
||||
short result;
|
||||
};
|
||||
|
||||
struct __attribute__((packed)) cio_lseek_to_host
|
||||
{
|
||||
/* File descriptor (little endian). */
|
||||
short fd;
|
||||
/* Offset (little endian). */
|
||||
int offset;
|
||||
/* Whence (little endian). */
|
||||
short whence;
|
||||
};
|
||||
|
||||
struct __attribute__((packed)) cio_lseek_from_host
|
||||
{
|
||||
/* Result (little endian). */
|
||||
int result;
|
||||
};
|
||||
|
||||
struct __attribute__((packed)) cio_unlink_to_host
|
||||
{
|
||||
/* Empty. */
|
||||
};
|
||||
|
||||
struct __attribute__((packed)) cio_unlink_from_host
|
||||
{
|
||||
/* Result (little endian). */
|
||||
short result;
|
||||
};
|
||||
|
||||
struct __attribute__((packed)) cio_rename_to_host
|
||||
{
|
||||
/* Empty. */
|
||||
};
|
||||
|
||||
struct __attribute__((packed)) cio_rename_from_host
|
||||
{
|
||||
/* Result (little endian). */
|
||||
short result;
|
||||
};
|
||||
|
||||
struct __attribute__((packed)) cio_gettime_to_host
|
||||
{
|
||||
/* Empty. */
|
||||
};
|
||||
|
||||
struct __attribute__((packed)) cio_gettime_from_host
|
||||
{
|
||||
/* Time (little endian). */
|
||||
int time;
|
||||
};
|
||||
|
||||
struct __attribute__((packed)) cio_to_host
|
||||
{
|
||||
/* Data length (target endian). */
|
||||
unsigned int length;
|
||||
/* Command. */
|
||||
unsigned char command;
|
||||
/* Parameters. */
|
||||
union
|
||||
{
|
||||
unsigned char buf[8];
|
||||
struct cio_open_to_host open;
|
||||
struct cio_close_to_host close;
|
||||
struct cio_read_to_host read;
|
||||
struct cio_write_to_host write;
|
||||
struct cio_lseek_to_host lseek;
|
||||
struct cio_unlink_to_host unlink;
|
||||
struct cio_rename_to_host rename;
|
||||
struct cio_gettime_to_host gettime;
|
||||
} parms;
|
||||
/* Variable-length data. */
|
||||
unsigned char data[];
|
||||
};
|
||||
|
||||
struct __attribute__((packed)) cio_from_host
|
||||
{
|
||||
/* Length (target endian). */
|
||||
unsigned int length;
|
||||
/* Parameters. */
|
||||
union
|
||||
{
|
||||
unsigned char buf[8];
|
||||
struct cio_open_from_host open;
|
||||
struct cio_close_from_host close;
|
||||
struct cio_read_from_host read;
|
||||
struct cio_write_from_host write;
|
||||
struct cio_lseek_from_host lseek;
|
||||
struct cio_unlink_from_host unlink;
|
||||
struct cio_rename_from_host rename;
|
||||
struct cio_gettime_from_host gettime;
|
||||
} parms;
|
||||
/* Data. */
|
||||
unsigned char data[];
|
||||
};
|
||||
|
||||
union
|
||||
{
|
||||
unsigned char buf[CIOBUFSIZ];
|
||||
int align;
|
||||
union
|
||||
{
|
||||
struct cio_to_host to_host;
|
||||
struct cio_from_host from_host;
|
||||
} u;
|
||||
} _CIOBUF_ __attribute__((section(".cio")));
|
||||
|
||||
#ifdef _BIG_ENDIAN
|
||||
#define SWAPSHORT(s) ((short)((((s) & 0xff) << 8) | (((s) & 0xff00) >> 8)))
|
||||
#define SWAPINT(i) (__builtin_bswap32 (i))
|
||||
#else
|
||||
#define SWAPSHORT(s) (s)
|
||||
#define SWAPINT(i) (i)
|
||||
#endif
|
||||
|
||||
static void __attribute__((noinline))
|
||||
do_semi_call (void)
|
||||
{
|
||||
asm volatile (".globl C$$IO$$\nnop\nC$$IO$$:nop" : "+m" (_CIOBUF_));
|
||||
}
|
||||
|
||||
static inline void
|
||||
semi_call_wrapper (unsigned char command, const char *data,
|
||||
unsigned int length)
|
||||
{
|
||||
_CIOBUF_.u.to_host.length = length;
|
||||
_CIOBUF_.u.to_host.command = command;
|
||||
if (data != NULL)
|
||||
memcpy (_CIOBUF_.u.to_host.data, data, length);
|
||||
do_semi_call ();
|
||||
}
|
||||
|
||||
static inline void
|
||||
semi_call_wrapper2 (unsigned char command, const char *data1,
|
||||
unsigned int length1, const char *data2,
|
||||
unsigned int length2)
|
||||
{
|
||||
_CIOBUF_.u.to_host.length = length1 + length2;
|
||||
_CIOBUF_.u.to_host.command = command;
|
||||
if (data1 != NULL)
|
||||
memcpy (_CIOBUF_.u.to_host.data, data1, length1);
|
||||
if (data2 != NULL)
|
||||
memcpy (_CIOBUF_.u.to_host.data + length1, data2, length2);
|
||||
do_semi_call ();
|
||||
}
|
||||
|
||||
void
|
||||
_exit (int status)
|
||||
{
|
||||
/* The semihosting interface appears to provide no way to return an
|
||||
exit status. */
|
||||
asm volatile (".globl C$$EXIT\nnop\nC$$EXIT:nop");
|
||||
}
|
||||
|
||||
int
|
||||
open (const char *path, int flags, ...)
|
||||
{
|
||||
/* ??? It's not clear what the suggested fd is for. */
|
||||
static short suggest_fd = 3;
|
||||
short ret_fd;
|
||||
++suggest_fd;
|
||||
_CIOBUF_.u.to_host.parms.open.fd = SWAPSHORT (suggest_fd);
|
||||
_CIOBUF_.u.to_host.parms.open.flags = SWAPSHORT (flags);
|
||||
semi_call_wrapper (_DTOPEN, path, strlen (path) + 1);
|
||||
ret_fd = SWAPSHORT (_CIOBUF_.u.from_host.parms.open.fd);
|
||||
if (ret_fd == -1)
|
||||
return -1;
|
||||
return suggest_fd;
|
||||
}
|
||||
|
||||
int
|
||||
close (int fd)
|
||||
{
|
||||
_CIOBUF_.u.to_host.parms.close.fd = SWAPSHORT (fd);
|
||||
semi_call_wrapper (_DTCLOSE, NULL, 0);
|
||||
return SWAPSHORT (_CIOBUF_.u.from_host.parms.close.result);
|
||||
}
|
||||
|
||||
int
|
||||
read (int fd, char *ptr, int len)
|
||||
{
|
||||
if (len > BUFSIZ)
|
||||
len = BUFSIZ;
|
||||
_CIOBUF_.u.to_host.parms.read.fd = SWAPSHORT (fd);
|
||||
_CIOBUF_.u.to_host.parms.read.length = SWAPSHORT (len);
|
||||
semi_call_wrapper (_DTREAD, NULL, 0);
|
||||
memcpy (ptr, _CIOBUF_.u.from_host.data, _CIOBUF_.u.from_host.length);
|
||||
return SWAPSHORT (_CIOBUF_.u.from_host.parms.read.result);
|
||||
}
|
||||
|
||||
int
|
||||
write (int fd, char *ptr, int len)
|
||||
{
|
||||
if (len > BUFSIZ)
|
||||
len = BUFSIZ;
|
||||
_CIOBUF_.u.to_host.parms.write.fd = SWAPSHORT (fd);
|
||||
_CIOBUF_.u.to_host.parms.write.length = SWAPSHORT (len);
|
||||
semi_call_wrapper (_DTWRITE, ptr, len);
|
||||
return SWAPSHORT (_CIOBUF_.u.from_host.parms.write.result);
|
||||
}
|
||||
|
||||
int
|
||||
lseek (int fd, int offset, int whence)
|
||||
{
|
||||
_CIOBUF_.u.to_host.parms.lseek.fd = SWAPSHORT (fd);
|
||||
_CIOBUF_.u.to_host.parms.lseek.offset = SWAPINT (offset);
|
||||
_CIOBUF_.u.to_host.parms.lseek.whence = SWAPSHORT (whence);
|
||||
semi_call_wrapper (_DTLSEEK, NULL, 0);
|
||||
return SWAPINT (_CIOBUF_.u.from_host.parms.lseek.result);
|
||||
}
|
||||
|
||||
int
|
||||
unlink (const char *path)
|
||||
{
|
||||
semi_call_wrapper (_DTUNLINK, path, strlen (path) + 1);
|
||||
return SWAPSHORT (_CIOBUF_.u.from_host.parms.unlink.result);
|
||||
}
|
||||
|
||||
int
|
||||
rename (const char *oldpath, const char *newpath)
|
||||
{
|
||||
semi_call_wrapper2 (_DTRENAME, oldpath, strlen (oldpath) + 1,
|
||||
newpath, strlen (newpath) + 1);
|
||||
return SWAPSHORT (_CIOBUF_.u.from_host.parms.rename.result);
|
||||
}
|
||||
|
||||
int
|
||||
gettimeofday (struct timeval *tp, void *tzvp)
|
||||
{
|
||||
struct timezone *tzp = tzvp;
|
||||
|
||||
if (tp)
|
||||
{
|
||||
semi_call_wrapper (_DTGETTIME, NULL, 0);
|
||||
tp->tv_sec = SWAPINT (_CIOBUF_.u.from_host.parms.gettime.time);
|
||||
tp->tv_usec = 0;
|
||||
}
|
||||
|
||||
if (tzp)
|
||||
{
|
||||
tzp->tz_minuteswest = 0;
|
||||
tzp->tz_dsttime = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
isatty (int file __attribute__((unused)))
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
fstat (int fd, struct stat *buf)
|
||||
{
|
||||
buf->st_mode = S_IFCHR; /* Always pretend to be a tty */
|
||||
buf->st_blksize = 0;
|
||||
|
||||
return (0);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user