* COPYING.LIBGLOSS: Add Controls and Data Services copyright.
* COPYING.NEWLIB: Likewise. libgloss/ * configure.in: Add Visium support. * configure: Regenerate. * visium/: New directory. newlib/ * configure.host: Add Visium support. * libc/machine/configure.in: Likewise. * libc/machine/configure: Regenerate. * libc/machine/visium/: New directory. * libc/include/machine/setjmp.h (_JBLEN): Define for Visium. * libc/include/machine/ieeefp.h (__IEEE_BIG_ENDIAN): Likewise. * libc/include/machine/time.h (_CLOCKS_PER_SEC_): Likewise.
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
2015-01-21 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* configure.in: Add Visium support.
|
||||
* configure: Regenerate.
|
||||
* visium/: New directory.
|
||||
|
||||
2015-01-15 DJ Delorie <dj@redhat.com>
|
||||
|
||||
* rl78/crt0.S: Initialize .saddr. Avoid using SEL.
|
||||
|
6
libgloss/configure
vendored
6
libgloss/configure
vendored
@@ -695,6 +695,7 @@ moxie
|
||||
microblaze
|
||||
mt
|
||||
v850
|
||||
visium
|
||||
xc16x
|
||||
xstormy16
|
||||
m32c
|
||||
@@ -2517,6 +2518,11 @@ case "${target}" in
|
||||
subdirs="$subdirs v850"
|
||||
|
||||
;;
|
||||
visium-*-*)
|
||||
subdirs="$subdirs visium"
|
||||
|
||||
config_testsuite=false
|
||||
;;
|
||||
xc16x-*-*)
|
||||
subdirs="$subdirs xc16x"
|
||||
|
||||
|
@@ -126,6 +126,10 @@ case "${target}" in
|
||||
v850*-*-*)
|
||||
AC_CONFIG_SUBDIRS([v850])
|
||||
;;
|
||||
visium-*-*)
|
||||
AC_CONFIG_SUBDIRS([visium])
|
||||
config_testsuite=false
|
||||
;;
|
||||
xc16x-*-*)
|
||||
AC_CONFIG_SUBDIRS([xc16x])
|
||||
;;
|
||||
|
129
libgloss/visium/Makefile.in
Normal file
129
libgloss/visium/Makefile.in
Normal file
@@ -0,0 +1,129 @@
|
||||
# Copyright (c) 1998 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.
|
||||
|
||||
DESTDIR =
|
||||
VPATH = @srcdir@
|
||||
srcdir = @srcdir@
|
||||
objdir = .
|
||||
srcroot = $(srcdir)/../..
|
||||
objroot = $(objdir)/../..
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
host_alias = @host_alias@
|
||||
target_alias = @target_alias@
|
||||
program_transform_name = @program_transform_name@
|
||||
|
||||
bindir = @bindir@
|
||||
libdir = @libdir@
|
||||
tooldir = $(exec_prefix)/$(target_alias)
|
||||
|
||||
# Multilib support variables.
|
||||
# TOP is used instead of MULTI{BUILD,SRC}TOP.
|
||||
MULTIDIRS =
|
||||
MULTISUBDIR =
|
||||
MULTIDO = true
|
||||
MULTICLEAN = true
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
CC = @CC@
|
||||
|
||||
AS = @AS@
|
||||
|
||||
AR = @AR@
|
||||
|
||||
LD = @LD@
|
||||
|
||||
RANLIB = @RANLIB@
|
||||
|
||||
OBJDUMP = `t='$(program_transform_name)'; echo objdump | sed -e $$t`
|
||||
OBJCOPY = `t='$(program_transform_name)'; echo objcopy | sed -e $$t`
|
||||
|
||||
# Generic object files common to some targets.
|
||||
# These are LIBGLOSS stubs and minimal functionality in SBRK, READ and WRITE.
|
||||
OBJS = close.o fstat.o getpid.o isatty.o kill.o lseek.o open.o \
|
||||
print.o putnum.o read.o stat.o unlink.o write.o
|
||||
|
||||
# Object files specific to particular targets.
|
||||
SERIALOBJS = ${OBJS} _exit.o gettod.o sbrk.o serial-inbyte.o serial-outbyte.o
|
||||
|
||||
# These go with the hosted file I/O libraries with a version of syscalls.
|
||||
HOSTEDOBJS = getpid.o kill.o io-gdb.o io-stubs.o sbrk.o
|
||||
|
||||
SCRIPTS =
|
||||
BSP = crt0.o libserial.a libsim.a libdebug.a
|
||||
|
||||
# Host specific makefile fragment comes in here.
|
||||
@host_makefile_frag@
|
||||
|
||||
all: ${BSP}
|
||||
|
||||
#
|
||||
# here's where we build the board support packages for each target
|
||||
#
|
||||
|
||||
libserial.a: $(SERIALOBJS)
|
||||
$(AR) $(ARFLAGS) $@ $^
|
||||
$(RANLIB) $@
|
||||
|
||||
libsim.a: ${HOSTEDOBJS} sim-syscalls.o
|
||||
${AR} ${ARFLAGS} $@ $^
|
||||
${RANLIB} $@
|
||||
|
||||
libdebug.a: ${HOSTEDOBJS} debug-syscalls.o
|
||||
${AR} ${ARFLAGS} $@ $^
|
||||
${RANLIB} $@
|
||||
|
||||
sim-syscalls.o: syscalls.c syscall.h io.h
|
||||
${CC} ${CFLAGS_FOR_TARGET} ${CFLAGS} -DTARGET_SIM -c -o $@ $<
|
||||
|
||||
debug-syscalls.o: syscalls.c syscall.h io.h
|
||||
${CC} ${CFLAGS_FOR_TARGET} ${CFLAGS} -c -o $@ $<
|
||||
|
||||
$(OBJS): %.o: ../%.c
|
||||
${CC} ${CFLAGS_FOR_TARGET} ${CFLAGS} -c -o $@ $<
|
||||
|
||||
doc:
|
||||
|
||||
clean mostlyclean:
|
||||
rm -f a.out core *.i *~ *.o *-test *.srec *.dis *.map *.x
|
||||
|
||||
distclean maintainer-clean realclean: clean
|
||||
rm -f Makefile config.status a.out
|
||||
|
||||
.PHONY: install info install-info clean-info
|
||||
install:
|
||||
@for bsp in ${BSP}; do\
|
||||
$(INSTALL_DATA) $${bsp} $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}; \
|
||||
done
|
||||
@for script in ${SCRIPTS}; do\
|
||||
$(INSTALL_DATA) $(srcdir)/$${script}.ld $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$${script}.ld; \
|
||||
done
|
||||
|
||||
info:
|
||||
install-info:
|
||||
clean-info:
|
||||
|
||||
# target specific makefile fragment comes in here.
|
||||
@target_makefile_frag@
|
||||
|
||||
Makefile: Makefile.in config.status @host_makefile_frag_path@ @target_makefile_frag_path@
|
||||
$(SHELL) config.status
|
||||
|
||||
config.status: configure
|
||||
$(SHELL) config.status --recheck
|
41
libgloss/visium/_exit.c
Normal file
41
libgloss/visium/_exit.c
Normal file
@@ -0,0 +1,41 @@
|
||||
/* _exit.c for the Visium processor.
|
||||
|
||||
Copyright (c) 2015 Rolls-Royce Controls and Data Services Limited.
|
||||
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 Rolls-Royce Controls and Data Services Limited 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. */
|
||||
|
||||
void _exit (int) __attribute__ ((__noreturn__));
|
||||
|
||||
void
|
||||
_exit (int code)
|
||||
{
|
||||
asm volatile ("stop 0,%0" : : "r" (code & 0xff));
|
||||
|
||||
/* Should never reach this point. Since this function is not supposed to
|
||||
return, pretend to get stuck in a loop. */
|
||||
while (1)
|
||||
;
|
||||
}
|
344
libgloss/visium/aclocal.m4
vendored
Normal file
344
libgloss/visium/aclocal.m4
vendored
Normal file
@@ -0,0 +1,344 @@
|
||||
# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
# 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.
|
||||
|
||||
# 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
|
||||
# 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 7
|
||||
|
||||
# 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])
|
||||
AC_SUBST([$1_FALSE])
|
||||
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
|
||||
# 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 8
|
||||
|
||||
# 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], 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
|
||||
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
|
||||
|
||||
case $depmode in
|
||||
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
|
||||
;;
|
||||
none) break ;;
|
||||
esac
|
||||
# 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.
|
||||
if depmode=$depmode \
|
||||
source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
|
||||
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
|
||||
$SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
|
||||
>/dev/null 2>conftest.err &&
|
||||
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
|
||||
grep sub/conftest.${OBJEXT-o} 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])
|
||||
])
|
||||
|
||||
# Generate code to set up dependency tracking. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 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 3
|
||||
|
||||
# _AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||
# ------------------------------
|
||||
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[for mf in $CONFIG_FILES; 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.
|
||||
# So let's grep whole file.
|
||||
if grep '^#.*generated by automake' $mf > /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 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 3
|
||||
|
||||
# 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 done
|
||||
.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
|
||||
# We grep out `Entering directory' and `Leaving directory'
|
||||
# messages which can occur if `w' ends up in MAKEFLAGS.
|
||||
# In particular we don't look at `^make:' because GNU make might
|
||||
# be invoked under some other name (usually "gmake"), in which
|
||||
# case it prints its new name instead of `make'.
|
||||
if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
|
||||
am__include=include
|
||||
am__quote=
|
||||
_am_result=GNU
|
||||
fi
|
||||
# Now try BSD make style include.
|
||||
if test "$am__include" = "#"; then
|
||||
echo '.include "confinc"' > confmf
|
||||
if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
|
||||
am__include=.include
|
||||
am__quote="\""
|
||||
_am_result=BSD
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([am__include])
|
||||
AC_SUBST([am__quote])
|
||||
AC_MSG_RESULT([$_am_result])
|
||||
rm -f confinc confmf
|
||||
])
|
||||
|
||||
m4_include([../acinclude.m4])
|
3145
libgloss/visium/configure
vendored
Executable file
3145
libgloss/visium/configure
vendored
Executable file
File diff suppressed because it is too large
Load Diff
58
libgloss/visium/configure.in
Normal file
58
libgloss/visium/configure.in
Normal file
@@ -0,0 +1,58 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
AC_PREREQ(2.59)
|
||||
AC_INIT(syscalls.c)
|
||||
|
||||
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)
|
||||
target_makefile_frag_path=$target_makefile_frag
|
||||
AC_SUBST(target_makefile_frag_path)
|
||||
AC_SUBST_FILE(target_makefile_frag)
|
||||
AC_SUBST(part_specific_obj)
|
||||
|
||||
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
|
88
libgloss/visium/crt0.S
Normal file
88
libgloss/visium/crt0.S
Normal file
@@ -0,0 +1,88 @@
|
||||
/* crt0.S for the Visium processor.
|
||||
|
||||
Copyright (c) 2015 Rolls-Royce Controls and Data Services Limited.
|
||||
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 Rolls-Royce Controls and Data Services Limited 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. */
|
||||
|
||||
.weak _get_cmdline
|
||||
.text
|
||||
.align 4
|
||||
.global __start
|
||||
__start:
|
||||
/* Initialize the stack pointer. */
|
||||
moviu r1,%u _estack
|
||||
movil r1,%l _estack
|
||||
move.l r23,r1
|
||||
|
||||
/* Terminate the frame chain. */
|
||||
moviq r22,0
|
||||
|
||||
/* Zero the .bss segment. */
|
||||
moviu r1,%u __bss_start
|
||||
movil r1,%l __bss_start
|
||||
moviu r2,%u __bss_end
|
||||
movil r2,%l __bss_end
|
||||
.L0:
|
||||
cmp.l r1,r1
|
||||
brr eq,.L1
|
||||
nop
|
||||
write.b (r1),r0
|
||||
brr tr,.L0
|
||||
addi r1,1
|
||||
.L1:
|
||||
/* Register __fini (destructors) with atexit. */
|
||||
moviu r1,%u __fini
|
||||
moviu r2,%u atexit
|
||||
movil r2,%l atexit
|
||||
bra tr,r2,r21
|
||||
movil r1,%l __fini
|
||||
|
||||
/* Call __init (constructors). */
|
||||
moviu r1,%u __init
|
||||
movil r1,%l __init
|
||||
bra tr,r1,r21
|
||||
nop
|
||||
|
||||
/* Set up argc and argv. */
|
||||
moviu r3,%u _get_cmdline
|
||||
movil r3,%l _get_cmdline
|
||||
cmp.l r3,r0
|
||||
moviq r1,0
|
||||
bra ne,r3,r21
|
||||
moviq r2,0
|
||||
|
||||
/* Call the main program. */
|
||||
moviu r3,%u main
|
||||
movil r3,%l main
|
||||
bra tr,r3,r21
|
||||
nop
|
||||
|
||||
/* Call exit in case the main program didn't. */
|
||||
moviu r2,%u exit
|
||||
movil r2,%l exit
|
||||
bra tr,r2,r21
|
||||
nop
|
||||
.end
|
45
libgloss/visium/gettod.c
Normal file
45
libgloss/visium/gettod.c
Normal file
@@ -0,0 +1,45 @@
|
||||
/* stub functions for the Visium processor.
|
||||
|
||||
Copyright (c) 2015 Rolls-Royce Controls and Data Services Limited.
|
||||
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 Rolls-Royce Controls and Data Services Limited 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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 <sys/time.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
|
||||
int gettimeofday (struct timeval *__p, void *__tz)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
clock_t
|
||||
clock (void)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return (clock_t) -1;
|
||||
}
|
140
libgloss/visium/io-gdb.c
Normal file
140
libgloss/visium/io-gdb.c
Normal file
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* hosted io support for GDB's remote fileio protocol
|
||||
*
|
||||
* Copyright (c) 2006 CodeSourcery 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 "io.h"
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
gdb_mode_t
|
||||
__hosted_to_gdb_mode_t (mode_t m)
|
||||
{
|
||||
gdb_mode_t result = 0;
|
||||
if (m & S_IFREG)
|
||||
result |= GDB_S_IFREG;
|
||||
if (m & S_IFDIR)
|
||||
result |= GDB_S_IFDIR;
|
||||
if (m & S_IRUSR)
|
||||
result |= GDB_S_IRUSR;
|
||||
if (m & S_IWUSR)
|
||||
result |= GDB_S_IWUSR;
|
||||
if (m & S_IXUSR)
|
||||
result |= GDB_S_IXUSR;
|
||||
if (m & S_IRGRP)
|
||||
result |= GDB_S_IRGRP;
|
||||
if (m & S_IWGRP)
|
||||
result |= GDB_S_IWGRP;
|
||||
if (m & S_IXGRP)
|
||||
result |= GDB_S_IXGRP;
|
||||
if (m & S_IROTH)
|
||||
result |= GDB_S_IROTH;
|
||||
if (m & S_IWOTH)
|
||||
result |= GDB_S_IWOTH;
|
||||
if (m & S_IXOTH)
|
||||
result |= GDB_S_IXOTH;
|
||||
return result;
|
||||
}
|
||||
|
||||
int32_t
|
||||
__hosted_to_gdb_open_flags (int f)
|
||||
{
|
||||
int32_t result = 0;
|
||||
if (f & O_RDONLY)
|
||||
result |= GDB_O_RDONLY;
|
||||
if (f & O_WRONLY)
|
||||
result |= GDB_O_WRONLY;
|
||||
if (f & O_RDWR)
|
||||
result |= GDB_O_RDWR;
|
||||
if (f & O_APPEND)
|
||||
result |= GDB_O_APPEND;
|
||||
if (f & O_CREAT)
|
||||
result |= GDB_O_CREAT;
|
||||
if (f & O_TRUNC)
|
||||
result |= GDB_O_TRUNC;
|
||||
if (f & O_EXCL)
|
||||
result |= GDB_O_EXCL;
|
||||
return result;
|
||||
}
|
||||
|
||||
int32_t
|
||||
__hosted_to_gdb_lseek_flags (int f)
|
||||
{
|
||||
if (f == SEEK_CUR)
|
||||
return GDB_SEEK_CUR;
|
||||
else if (f == SEEK_END)
|
||||
return GDB_SEEK_END;
|
||||
else
|
||||
return GDB_SEEK_SET;
|
||||
}
|
||||
|
||||
void
|
||||
__hosted_from_gdb_stat (const struct gdb_stat *gs,
|
||||
struct stat *s)
|
||||
{
|
||||
s->st_dev = gs->st_dev;
|
||||
s->st_ino = gs->st_ino;
|
||||
s->st_mode = gs->st_mode;
|
||||
s->st_nlink = gs->st_nlink;
|
||||
s->st_uid = gs->st_uid;
|
||||
s->st_gid = gs->st_gid;
|
||||
s->st_rdev = gs->st_rdev;
|
||||
s->st_size = gs->st_size;
|
||||
s->st_blksize = gs->st_blksize;
|
||||
s->st_blocks = gs->st_blocks;
|
||||
s->st_atime = gs->st_atime;
|
||||
s->st_mtime = gs->st_mtime;
|
||||
s->st_ctime = gs->st_ctime;
|
||||
}
|
||||
|
||||
void
|
||||
__hosted_from_gdb_timeval (const struct gdb_timeval *gt,
|
||||
struct timeval *t)
|
||||
{
|
||||
t->tv_sec = gt->tv_sec;
|
||||
t->tv_usec = gt->tv_usec;
|
||||
}
|
||||
|
||||
int
|
||||
__hosted_from_gdb_errno (int32_t err)
|
||||
{
|
||||
switch (err)
|
||||
{
|
||||
case 0: return 0;
|
||||
case GDB_EPERM: return EPERM;
|
||||
case GDB_ENOENT: return ENOENT;
|
||||
case GDB_EINTR: return EINTR;
|
||||
case GDB_EBADF: return EBADF;
|
||||
case GDB_EACCES: return EACCES;
|
||||
case GDB_EFAULT: return EFAULT;
|
||||
case GDB_EBUSY: return EBUSY;
|
||||
case GDB_EEXIST: return EEXIST;
|
||||
case GDB_ENODEV: return ENODEV;
|
||||
case GDB_ENOTDIR: return ENOTDIR;
|
||||
case GDB_EISDIR: return EISDIR;
|
||||
case GDB_EINVAL: return EINVAL;
|
||||
case GDB_ENFILE: return ENFILE;
|
||||
case GDB_EMFILE: return EMFILE;
|
||||
case GDB_EFBIG: return EFBIG;
|
||||
case GDB_ENOSPC: return ENOSPC;
|
||||
case GDB_ESPIPE: return ESPIPE;
|
||||
case GDB_EROFS: return EROFS;
|
||||
case GDB_ENAMETOOLONG: return ENAMETOOLONG;
|
||||
case GDB_EUNKNOWN:
|
||||
default:
|
||||
return EIO;
|
||||
}
|
||||
}
|
||||
|
180
libgloss/visium/io-stubs.c
Normal file
180
libgloss/visium/io-stubs.c
Normal file
@@ -0,0 +1,180 @@
|
||||
/* I/O stub functions for the Visium processor.
|
||||
|
||||
Copyright (c) 2015 Rolls-Royce Controls and Data Services Limited.
|
||||
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 Rolls-Royce Controls and Data Services Limited 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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 <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/times.h>
|
||||
#include <fcntl.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <utime.h>
|
||||
#include <errno.h>
|
||||
|
||||
struct DIR;
|
||||
|
||||
int
|
||||
chdir (const char *path)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
chmod (const char *path, mode_t mode)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
closedir (struct DIR *dirp)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
execv (const char *path, char *const argv[])
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
fcntl (int fd, int cmd, ...)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
fork (void)
|
||||
{
|
||||
errno = EAGAIN;
|
||||
return -1;
|
||||
}
|
||||
|
||||
char *
|
||||
getcwd (char *buf, size_t size)
|
||||
{
|
||||
buf[0] = 0;
|
||||
return buf;
|
||||
}
|
||||
|
||||
pid_t
|
||||
getppid (void)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
link (const char *old, const char *new)
|
||||
{
|
||||
errno = EMLINK;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
nanosleep (const struct timespec *requested_time,
|
||||
struct timespec *remaining)
|
||||
{
|
||||
remaining->tv_sec = 0;
|
||||
remaining->tv_nsec = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct DIR *
|
||||
opendir (const char *dirname)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct dirent *
|
||||
readdir (struct DIR *dirp)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ssize_t
|
||||
readlink (const char *__path, char *__buf, size_t __buflen)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
rmdir (const char *path)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
symlink (const char *name1, const char *name2)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
clock_t
|
||||
times (struct tms *buf)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
char *
|
||||
ttyname (int fildes)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
int
|
||||
utime (const char *path, const struct utimbuf *times)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
wait (int *status)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
pid_t
|
||||
waitpid (pid_t pid, int *stat_loc, int options)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
141
libgloss/visium/io.h
Normal file
141
libgloss/visium/io.h
Normal file
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
* hosted io support.
|
||||
*
|
||||
* Copyright (c) 2006 CodeSourcery 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 <stdint.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define HOSTED_EXIT 0
|
||||
#define HOSTED_INIT_SIM 1
|
||||
#define HOSTED_OPEN 2
|
||||
#define HOSTED_CLOSE 3
|
||||
#define HOSTED_READ 4
|
||||
#define HOSTED_WRITE 5
|
||||
#define HOSTED_LSEEK 6
|
||||
#define HOSTED_RENAME 7
|
||||
#define HOSTED_UNLINK 8
|
||||
#define HOSTED_STAT 9
|
||||
#define HOSTED_FSTAT 10
|
||||
#define HOSTED_GETTIMEOFDAY 11
|
||||
#define HOSTED_ISATTY 12
|
||||
#define HOSTED_SYSTEM 13
|
||||
|
||||
/* This function is provided by the board's BSP, because the precise
|
||||
mechanism of informing gdb is board specific. */
|
||||
extern int __io_hosted (int func, void *args);
|
||||
|
||||
/* Protocol specific representation of datatypes, as specified in D.9.11
|
||||
* of the GDB manual.
|
||||
* Note that since the m68k is big-endian, we can use native
|
||||
* representations of integer datatypes in structured datatypes. */
|
||||
|
||||
typedef uint32_t gdb_mode_t;
|
||||
typedef uint32_t gdb_time_t;
|
||||
|
||||
struct gdb_stat {
|
||||
uint32_t st_dev; /* device */
|
||||
uint32_t st_ino; /* inode */
|
||||
gdb_mode_t st_mode; /* protection */
|
||||
uint32_t st_nlink; /* number of hard links */
|
||||
uint32_t st_uid; /* user ID of owner */
|
||||
uint32_t st_gid; /* group ID of owner */
|
||||
uint32_t st_rdev; /* device type (if inode device) */
|
||||
uint64_t st_size; /* total size, in bytes */
|
||||
uint64_t st_blksize; /* blocksize for filesystem I/O */
|
||||
uint64_t st_blocks; /* number of blocks allocated */
|
||||
gdb_time_t st_atime; /* time of last access */
|
||||
gdb_time_t st_mtime; /* time of last modification */
|
||||
gdb_time_t st_ctime; /* time of last change */
|
||||
};
|
||||
|
||||
struct gdb_timeval {
|
||||
gdb_time_t tv_sec; /* second */
|
||||
uint64_t tv_usec; /* microsecond */
|
||||
};
|
||||
|
||||
|
||||
/* Parameters are passed between the library and the debugging stub
|
||||
* in a fixed-size buffer.
|
||||
*/
|
||||
|
||||
typedef uint32_t gdb_parambuf_t[4];
|
||||
|
||||
/* open flags */
|
||||
|
||||
#define GDB_O_RDONLY 0x0
|
||||
#define GDB_O_WRONLY 0x1
|
||||
#define GDB_O_RDWR 0x2
|
||||
#define GDB_O_APPEND 0x8
|
||||
#define GDB_O_CREAT 0x200
|
||||
#define GDB_O_TRUNC 0x400
|
||||
#define GDB_O_EXCL 0x800
|
||||
|
||||
/* mode_t values */
|
||||
|
||||
#define GDB_S_IFREG 0100000
|
||||
#define GDB_S_IFDIR 040000
|
||||
#define GDB_S_IRUSR 0400
|
||||
#define GDB_S_IWUSR 0200
|
||||
#define GDB_S_IXUSR 0100
|
||||
#define GDB_S_IRGRP 040
|
||||
#define GDB_S_IWGRP 020
|
||||
#define GDB_S_IXGRP 010
|
||||
#define GDB_S_IROTH 04
|
||||
#define GDB_S_IWOTH 02
|
||||
#define GDB_S_IXOTH 01
|
||||
|
||||
/* errno values */
|
||||
|
||||
#define GDB_EPERM 1
|
||||
#define GDB_ENOENT 2
|
||||
#define GDB_EINTR 4
|
||||
#define GDB_EBADF 9
|
||||
#define GDB_EACCES 13
|
||||
#define GDB_EFAULT 14
|
||||
#define GDB_EBUSY 16
|
||||
#define GDB_EEXIST 17
|
||||
#define GDB_ENODEV 19
|
||||
#define GDB_ENOTDIR 20
|
||||
#define GDB_EISDIR 21
|
||||
#define GDB_EINVAL 22
|
||||
#define GDB_ENFILE 23
|
||||
#define GDB_EMFILE 24
|
||||
#define GDB_EFBIG 27
|
||||
#define GDB_ENOSPC 28
|
||||
#define GDB_ESPIPE 29
|
||||
#define GDB_EROFS 30
|
||||
#define GDB_ENAMETOOLONG 91
|
||||
#define GDB_EUNKNOWN 9999
|
||||
|
||||
/* lseek flags */
|
||||
|
||||
#define GDB_SEEK_SET 0
|
||||
#define GDB_SEEK_CUR 1
|
||||
#define GDB_SEEK_END 2
|
||||
|
||||
|
||||
/* conversion functions */
|
||||
|
||||
extern gdb_mode_t __hosted_to_gdb_mode_t (mode_t m);
|
||||
extern int32_t __hosted_to_gdb_open_flags (int f);
|
||||
extern int32_t __hosted_to_gdb_lseek_flags (int f);
|
||||
|
||||
extern void __hosted_from_gdb_stat (const struct gdb_stat *gs,
|
||||
struct stat *s);
|
||||
extern void __hosted_from_gdb_timeval (const struct gdb_timeval *gt,
|
||||
struct timeval *t);
|
||||
extern int __hosted_from_gdb_errno (int32_t err);
|
56
libgloss/visium/sbrk.c
Normal file
56
libgloss/visium/sbrk.c
Normal file
@@ -0,0 +1,56 @@
|
||||
/* sbrk.c for the Visium processor.
|
||||
|
||||
Copyright (c) 2015 Rolls-Royce Controls and Data Services Limited.
|
||||
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 Rolls-Royce Controls and Data Services Limited 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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 <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
/* These labels are set in the linker script, to mark the start and end of the
|
||||
memory reserved for the heap. */
|
||||
extern unsigned char _sheap [];
|
||||
extern unsigned char _eheap [];
|
||||
|
||||
void *
|
||||
sbrk (ptrdiff_t nbytes)
|
||||
{
|
||||
static unsigned char *heap_ptr = _sheap;
|
||||
|
||||
if (0 <= nbytes && heap_ptr + nbytes < _eheap)
|
||||
{
|
||||
void *base = (void *)heap_ptr;
|
||||
|
||||
heap_ptr += nbytes;
|
||||
memset (base, 0, nbytes);
|
||||
|
||||
return base;
|
||||
}
|
||||
|
||||
errno = ENOMEM;
|
||||
return (void *)-1;
|
||||
}
|
47
libgloss/visium/serial-inbyte.c
Normal file
47
libgloss/visium/serial-inbyte.c
Normal file
@@ -0,0 +1,47 @@
|
||||
/* Serial Input for the Visium processor.
|
||||
|
||||
Copyright (c) 2015 Rolls-Royce Controls and Data Services Limited.
|
||||
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 Rolls-Royce Controls and Data Services Limited 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. */
|
||||
|
||||
char
|
||||
inbyte (void)
|
||||
{
|
||||
#ifdef __VISIUM_ARCH_MCM__
|
||||
volatile int *const rxdata = (int *) 0x20003920;
|
||||
volatile int *const rxqs = (int *) 0x20003930;
|
||||
#else
|
||||
volatile int *const rxdata = (int *) 0x20001a20;
|
||||
volatile int *const rxqs = (int *) 0x20001a30;
|
||||
#endif
|
||||
int bytes_in_fifo = 0;
|
||||
|
||||
while (!bytes_in_fifo)
|
||||
bytes_in_fifo = *rxqs;
|
||||
|
||||
/* Read one character. */
|
||||
return (*rxdata) & 0xff;
|
||||
}
|
39
libgloss/visium/serial-outbyte.c
Normal file
39
libgloss/visium/serial-outbyte.c
Normal file
@@ -0,0 +1,39 @@
|
||||
/* Serial Output for the Visium processor.
|
||||
|
||||
Copyright (c) 2015 Rolls-Royce Controls and Data Services Limited.
|
||||
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 Rolls-Royce Controls and Data Services Limited 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. */
|
||||
|
||||
void
|
||||
outbyte (char byte)
|
||||
{
|
||||
#ifdef __VISIUM_ARCH_MCM__
|
||||
volatile int *const txadata = (int *) 0x2000391c;
|
||||
#else
|
||||
volatile int *const txadata = (int *) 0x20001a1c;
|
||||
#endif
|
||||
*txadata = byte;
|
||||
}
|
48
libgloss/visium/syscall.h
Normal file
48
libgloss/visium/syscall.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/* syscall.h for the Visium processor.
|
||||
|
||||
Copyright (c) 2015 Rolls-Royce Controls and Data Services Limited.
|
||||
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 Rolls-Royce Controls and Data Services Limited 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. */
|
||||
|
||||
#ifndef LIBGLOSS_SYSCALL_H
|
||||
#define LIBGLOSS_SYSCALL_H
|
||||
|
||||
#define SYS_null 1
|
||||
#define SYS_exit 2
|
||||
#define SYS_open 3
|
||||
#define SYS_close 4
|
||||
#define SYS_read 5
|
||||
#define SYS_write 6
|
||||
#define SYS_lseek 7
|
||||
#define SYS_rename 8
|
||||
#define SYS_unlink 9
|
||||
#define SYS_fstat 10
|
||||
#define SYS_stat 11
|
||||
#define SYS_gettimeofday 12
|
||||
#define SYS_isatty 13
|
||||
#define SYS_system 14
|
||||
|
||||
#endif
|
341
libgloss/visium/syscalls.c
Normal file
341
libgloss/visium/syscalls.c
Normal file
@@ -0,0 +1,341 @@
|
||||
/* system calls for the Visium processor.
|
||||
|
||||
Copyright (c) 2015 Rolls-Royce Controls and Data Services Limited.
|
||||
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 Rolls-Royce Controls and Data Services Limited 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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 <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include "io.h"
|
||||
#include "syscall.h"
|
||||
|
||||
#ifdef TARGET_SIM
|
||||
struct file_register2
|
||||
{
|
||||
unsigned action;
|
||||
unsigned p1, p2, p3, p4;
|
||||
unsigned error;
|
||||
unsigned retval;
|
||||
};
|
||||
|
||||
extern struct file_register2 _sim_fileio_register;
|
||||
|
||||
static volatile struct file_register2 *const fileio = &_sim_fileio_register;
|
||||
|
||||
static int
|
||||
do_syscall (unsigned action, unsigned p1, unsigned p2,
|
||||
unsigned p3, unsigned p4, int *error)
|
||||
{
|
||||
fileio->p1 = p1;
|
||||
fileio->p2 = p2;
|
||||
fileio->p3 = p3;
|
||||
fileio->p4 = p4;
|
||||
fileio->action = action;
|
||||
|
||||
*error = (int) fileio->error;
|
||||
return (int) fileio->retval;
|
||||
}
|
||||
#else
|
||||
static int
|
||||
do_syscall (unsigned action, unsigned p1, unsigned p2,
|
||||
unsigned p3, unsigned p4, int *error)
|
||||
{
|
||||
int ret;
|
||||
int err;
|
||||
|
||||
/* There is a two instruction delay after the software interrupt is
|
||||
initiated, to allow it to take effect. */
|
||||
|
||||
asm volatile ("\n\
|
||||
move.l r1,%3\n\
|
||||
move.l r2,%4\n\
|
||||
move.l r3,%5\n\
|
||||
moviu r5,%%u 0x20002208\n\
|
||||
movil r5,%%l 0x20002208\n\
|
||||
move.l r4,%6\n\
|
||||
write.l (r5),%2\n\
|
||||
nop\n\
|
||||
nop\n\
|
||||
move.l %0,r1\n\
|
||||
move.l %1,r2"
|
||||
: "=r" (ret), "=r" (err)
|
||||
: "r" (action), "r" (p1), "r" (p2), "r" (p3), "r" (p4)
|
||||
: "r1", "r2", "r3", "r4", "r5");
|
||||
|
||||
*error = err;
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
close (int fildes)
|
||||
{
|
||||
int status;
|
||||
int error;
|
||||
|
||||
status = do_syscall (SYS_close, fildes, 0, 0, 0, &error);
|
||||
|
||||
if (status < 0)
|
||||
errno = __hosted_from_gdb_errno (error);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
void _exit (int) __attribute ((__noreturn__));
|
||||
|
||||
void
|
||||
_exit (int code)
|
||||
{
|
||||
#ifdef TARGET_SIM
|
||||
asm volatile ("stop 0,%0" : : "r" (code & 0xff));
|
||||
#else
|
||||
int error;
|
||||
do_syscall (SYS_exit, code, 0, 0, 0, &error);
|
||||
#endif
|
||||
|
||||
/* Should never reach this point. Since this function is not supposed to
|
||||
return, pretend to get stuck in a loop. */
|
||||
while (1)
|
||||
;
|
||||
}
|
||||
|
||||
#ifdef TARGET_SIM
|
||||
extern long long _sim_cmdline_header;
|
||||
|
||||
long long
|
||||
_get_cmdline (void)
|
||||
{
|
||||
return _sim_cmdline_header;
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
fstat (int fildes, struct stat *st)
|
||||
{
|
||||
struct gdb_stat gst;
|
||||
int status;
|
||||
int error;
|
||||
|
||||
status = do_syscall (SYS_fstat, fildes, (unsigned) &gst, 0, 0, &error);
|
||||
|
||||
if (status < 0)
|
||||
errno = __hosted_from_gdb_errno (error);
|
||||
else
|
||||
__hosted_from_gdb_stat (&gst, st);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int
|
||||
gettimeofday (struct timeval *__p, void *__tz)
|
||||
{
|
||||
struct timeval *tv = __p;
|
||||
struct timezone *tz = __tz;
|
||||
struct gdb_timeval gtv;
|
||||
int status;
|
||||
int error;
|
||||
|
||||
status = do_syscall (SYS_gettimeofday, (unsigned) >v, 0, 0, 0, &error);
|
||||
|
||||
/* The timezone argument is not really supported so:
|
||||
Local time is GMT, no daylight saving */
|
||||
if (tz)
|
||||
{
|
||||
tz->tz_minuteswest = 0;
|
||||
tz->tz_dsttime = 0;
|
||||
}
|
||||
|
||||
if (status < 0)
|
||||
errno = __hosted_from_gdb_errno (error);
|
||||
else
|
||||
__hosted_from_gdb_timeval (>v, tv);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int
|
||||
isatty (int fildes)
|
||||
{
|
||||
int status;
|
||||
int error;
|
||||
|
||||
status = do_syscall (SYS_isatty, fildes, 0, 0, 0, &error);
|
||||
|
||||
if (status == 0)
|
||||
errno = __hosted_from_gdb_errno (error);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
off_t
|
||||
lseek (int fildes, off_t offset, int whence)
|
||||
{
|
||||
off_t ret;
|
||||
int error;
|
||||
|
||||
ret = do_syscall (SYS_lseek, fildes, offset,
|
||||
__hosted_to_gdb_lseek_flags (whence), 0, &error);
|
||||
|
||||
if (ret == (off_t)-1)
|
||||
errno = __hosted_from_gdb_errno (error);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
open (const char *path, int oflag, ...)
|
||||
{
|
||||
mode_t mode = 0;
|
||||
int status;
|
||||
int error;
|
||||
int len = strlen (path) + 1;
|
||||
|
||||
if (oflag & O_CREAT)
|
||||
{
|
||||
va_list ap;
|
||||
va_start (ap, oflag);
|
||||
mode = va_arg (ap, mode_t);
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
status = do_syscall (SYS_open, (unsigned) path, len,
|
||||
__hosted_to_gdb_open_flags (oflag),
|
||||
__hosted_to_gdb_mode_t (mode), &error);
|
||||
|
||||
if (status < 0)
|
||||
errno = __hosted_from_gdb_errno (error);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int
|
||||
read (int fildes, void *buf, size_t nbyte)
|
||||
{
|
||||
int status;
|
||||
int error;
|
||||
|
||||
status = do_syscall (SYS_read, fildes, (unsigned) buf, nbyte, 0, &error);
|
||||
|
||||
if (status < 0)
|
||||
errno = __hosted_from_gdb_errno (error);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int
|
||||
rename (const char *old, const char *new)
|
||||
{
|
||||
int status;
|
||||
int error;
|
||||
int oldlen = strlen (old) + 1;
|
||||
int newlen = strlen (new) + 1;
|
||||
|
||||
status = do_syscall (SYS_rename, (unsigned) old, oldlen, (unsigned) new,
|
||||
newlen, &error);
|
||||
|
||||
if (status < 0)
|
||||
errno = __hosted_from_gdb_errno (error);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int
|
||||
stat (const char *path, struct stat *st)
|
||||
{
|
||||
struct gdb_stat gst;
|
||||
int status;
|
||||
int error;
|
||||
int len = strlen (path) + 1;
|
||||
|
||||
status = do_syscall (SYS_stat, (unsigned) path, len, (unsigned) &gst, 0,
|
||||
&error);
|
||||
|
||||
if (status < 0)
|
||||
errno = __hosted_from_gdb_errno (error);
|
||||
else
|
||||
__hosted_from_gdb_stat (&gst, st);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int
|
||||
system (const char *string)
|
||||
{
|
||||
int status;
|
||||
int error;
|
||||
int len = strlen (string) + 1;
|
||||
|
||||
status = do_syscall (SYS_system, (unsigned) string, len, 0, 0, &error);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int
|
||||
unlink (const char *path)
|
||||
{
|
||||
int status;
|
||||
int error;
|
||||
int len = strlen (path) + 1;
|
||||
|
||||
status = do_syscall (SYS_unlink, (unsigned) path, len, 0, 0, &error);
|
||||
|
||||
if (status < 0)
|
||||
errno = __hosted_from_gdb_errno (error);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int
|
||||
write (int fildes, const void *buf, size_t nbyte)
|
||||
{
|
||||
int status;
|
||||
int error;
|
||||
|
||||
status = do_syscall (SYS_write, fildes, (unsigned) buf, nbyte, 0, &error);
|
||||
|
||||
if (status < 0)
|
||||
errno = __hosted_from_gdb_errno (error);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
extern clock_t _sim_clock;
|
||||
|
||||
clock_t
|
||||
clock (void)
|
||||
{
|
||||
#ifdef TARGET_SIM
|
||||
return _sim_clock;
|
||||
#else
|
||||
return (clock_t) -1;
|
||||
#endif
|
||||
}
|
Reference in New Issue
Block a user