2012-09-26 Ian Bolton <ian.bolton@arm.com>
Jim MacArthur <jim.macarthur@arm.com> Marcus Shawcroft <marcus.shawcroft@arm.com> Nigel Stephens <nigel.stephens@arm.com> Ramana Radhakrishnan <ramana.radhakrishnan@arm.com> Richard Earnshaw <rearnsha@arm.com> Sofiane Naci <sofiane.naci@arm.com> Tejas Belagod <tejas.belagod@arm.com> Yufeng Zhang <yufeng.zhang@arm.com> * aarch64/Makefile.in: New file. * aarch64/_exit.c: New file. * aarch64/_kill.c: New file. * aarch64/aclocal.m4: Generated. * aarch64/configure: Generated. * aarch64/configure.in: New file. * aarch64/cpu-init/Makefile.in: New file. * aarch64/cpu-init/rdimon-aem-el3.S: New file. * aarch64/crt0.S: New file. * aarch64/elf-rdimon.specs: New file. * aarch64/libcfunc.c: New file. * aarch64/svc.h: New file. * aarch64/syscalls.c: New file. * configure.in: Add AArch64. * configure: Re-generated.
This commit is contained in:
parent
c3fe5bf771
commit
cdf81c0c4c
|
@ -1,3 +1,29 @@
|
|||
2012-09-26 Ian Bolton <ian.bolton@arm.com>
|
||||
Jim MacArthur <jim.macarthur@arm.com>
|
||||
Marcus Shawcroft <marcus.shawcroft@arm.com>
|
||||
Nigel Stephens <nigel.stephens@arm.com>
|
||||
Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
|
||||
Richard Earnshaw <rearnsha@arm.com>
|
||||
Sofiane Naci <sofiane.naci@arm.com>
|
||||
Tejas Belagod <tejas.belagod@arm.com>
|
||||
Yufeng Zhang <yufeng.zhang@arm.com>
|
||||
|
||||
* aarch64/Makefile.in: New file.
|
||||
* aarch64/_exit.c: New file.
|
||||
* aarch64/_kill.c: New file.
|
||||
* aarch64/aclocal.m4: Generated.
|
||||
* aarch64/configure: Generated.
|
||||
* aarch64/configure.in: New file.
|
||||
* aarch64/cpu-init/Makefile.in: New file.
|
||||
* aarch64/cpu-init/rdimon-aem-el3.S: New file.
|
||||
* aarch64/crt0.S: New file.
|
||||
* aarch64/elf-rdimon.specs: New file.
|
||||
* aarch64/libcfunc.c: New file.
|
||||
* aarch64/svc.h: New file.
|
||||
* aarch64/syscalls.c: New file.
|
||||
* configure.in: Add AArch64.
|
||||
* configure: Re-generated.
|
||||
|
||||
2012-09-13 Anthony Green <green@moxielogic.com>
|
||||
|
||||
* moxie/moxie-elf-common.ld: Add bi-endian support.
|
||||
|
|
|
@ -0,0 +1,181 @@
|
|||
# Copyright (c) 2012 ARM Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. 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.
|
||||
# 3. The name of the company may not be used to endorse or promote
|
||||
# products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY ARM LTD ``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 ARM LTD 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.
|
||||
|
||||
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)
|
||||
|
||||
objtype = @objtype@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
# Multilib support variables.
|
||||
# TOP is used instead of MULTI{BUILD,SRC}TOP.
|
||||
MULTISRCTOP =
|
||||
MULTIBUILDTOP =
|
||||
MULTIDIRS =
|
||||
MULTISUBDIR =
|
||||
MULTIDO = true
|
||||
MULTICLEAN = true
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
CC = @CC@
|
||||
|
||||
AS = @AS@
|
||||
AR = @AR@
|
||||
LD = @LD@
|
||||
RANLIB = @RANLIB@
|
||||
|
||||
SUBDIRS = @subdirs@
|
||||
|
||||
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`
|
||||
|
||||
OBJS = syscalls.o libcfunc.o _exit.o _kill.o
|
||||
CRT0 = crt0.o
|
||||
CRT0_INSTALL = install-crt0
|
||||
|
||||
CRT0_INSTALL = install-crt0
|
||||
RDIMON_CRT0 = rdimon-crt0.o
|
||||
RDIMON_BSP = librdimon.a
|
||||
RDIMON_OBJS = $(patsubst %,rdimon-%,$(OBJS))
|
||||
RDIMON_SCRIPTS = rdimon.specs
|
||||
RDIMON_INSTALL = install-rdimon
|
||||
|
||||
CFLAGS = -g
|
||||
|
||||
# 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: ${CRT0} ${RDIMON_CRT0} ${RDIMON_BSP}
|
||||
@rootpre=`pwd`/; export rootpre; \
|
||||
srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \
|
||||
for dir in .. ${SUBDIRS}; do \
|
||||
if [ x$$dir != x.. ]; then \
|
||||
if [ -d $$dir ]; then \
|
||||
(cd $$dir; $(MAKE) $(FLAGS_TO_PASS)); \
|
||||
else true; fi; \
|
||||
else true; fi; \
|
||||
done
|
||||
|
||||
#
|
||||
# here's where we build the test programs for each target
|
||||
#
|
||||
.PHONY: test
|
||||
test:
|
||||
|
||||
#
|
||||
crt0.o: crt0.S
|
||||
rdimon-crt0.o: crt0.S
|
||||
$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $<
|
||||
|
||||
#rdimon-trap.o: trap.S
|
||||
# $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $<
|
||||
|
||||
rdimon-_exit.o: _exit.c
|
||||
$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $<
|
||||
|
||||
rdimon-_kill.o: _kill.c
|
||||
$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $<
|
||||
|
||||
rdimon-syscalls.o: syscalls.c
|
||||
$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $<
|
||||
|
||||
rdimon-libcfunc.o: libcfunc.c
|
||||
$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $<
|
||||
|
||||
$(RDIMON_BSP): $(RDIMON_OBJS)
|
||||
${AR} ${ARFLAGS} $@ $^
|
||||
${RANLIB} $@
|
||||
|
||||
clean mostlyclean:
|
||||
rm -f a.out core *.i *.o *-test *.srec *.dis *.x $(SIM_BSP)
|
||||
@rootpre=`pwd`/; export rootpre; \
|
||||
srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \
|
||||
for dir in .. ${SUBDIRS}; do \
|
||||
if [ x$$dir != x.. ]; then \
|
||||
if [ -d $$dir ]; then \
|
||||
(cd $$dir; $(MAKE) $(FLAGS_TO_PASS) clean); \
|
||||
else true; fi; \
|
||||
else true; fi; \
|
||||
done
|
||||
|
||||
distclean maintainer-clean realclean: clean
|
||||
rm -f Makefile config.status *~
|
||||
|
||||
.PHONY: install info install-info clean-info
|
||||
install: ${CRT0_INSTALL} ${RDIMON_INSTALL}
|
||||
@rootpre=`pwd`/; export rootpre; \
|
||||
srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \
|
||||
for dir in .. ${SUBDIRS}; do \
|
||||
if [ x$$dir != x.. ]; then \
|
||||
if [ -d $$dir ]; then \
|
||||
(cd $$dir; $(MAKE) $(FLAGS_TO_PASS) install); \
|
||||
else true; fi; \
|
||||
else true; fi; \
|
||||
done
|
||||
|
||||
install-crt0:
|
||||
${INSTALL_DATA} ${CRT0} $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x
|
||||
|
||||
install-rdimon:
|
||||
set -e; for x in ${RDIMON_CRT0} ${RDIMON_BSP}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
|
||||
set -e; for x in ${RDIMON_SCRIPTS}; do ${INSTALL_DATA} ${srcdir}/${objtype}$$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
|
|
@ -0,0 +1,41 @@
|
|||
/* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. 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.
|
||||
3. The name of the company may not be used to endorse or promote
|
||||
products derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY ARM LTD ``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 ARM LTD 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 <_ansi.h>
|
||||
#include "svc.h"
|
||||
|
||||
void _exit _PARAMS ((int));
|
||||
|
||||
__attribute__ ((noreturn)) void
|
||||
_exit (int status)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
param_block_t block[2];
|
||||
block[0] = ADP_Stopped_ApplicationExit;
|
||||
block[1] = status;
|
||||
do_AngelSVC (AngelSVC_Reason_ReportException, block);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
/* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. 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.
|
||||
3. The name of the company may not be used to endorse or promote
|
||||
products derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY ARM LTD ``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 ARM LTD 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 <_ansi.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include "svc.h"
|
||||
|
||||
int _kill _PARAMS ((int, int));
|
||||
|
||||
int
|
||||
_kill (int pid, int sig)
|
||||
{
|
||||
param_block_t block[2];
|
||||
|
||||
if (pid == 0)
|
||||
return 0;
|
||||
if (pid != 1 && pid != -1)
|
||||
{
|
||||
errno = ESRCH;
|
||||
return -1;
|
||||
}
|
||||
|
||||
block[0] = ADP_Stopped_RunTimeError;
|
||||
block[1] = sig;
|
||||
return do_AngelSVC (AngelSVC_Reason_ReportException, block);
|
||||
}
|
|
@ -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])
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,73 @@
|
|||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_PREREQ(2.59)
|
||||
AC_INIT(crt0.S)
|
||||
|
||||
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
|
||||
|
||||
case "${target}" in
|
||||
*-*-elf)
|
||||
objtype=elf-
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_SUBST(objtype)
|
||||
|
||||
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)
|
||||
|
||||
# Configure cpu init plug-ins
|
||||
if test -d "${srcdir}/cpu-init"; then
|
||||
subdirs="${subdirs} cpu-init"
|
||||
AC_CONFIG_FILES(cpu-init/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_SUBST(subdirs)
|
||||
fi
|
||||
|
||||
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
|
|
@ -0,0 +1,110 @@
|
|||
# Copyright (c) 2012 ARM Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. 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.
|
||||
# 3. The name of the company may not be used to endorse or promote
|
||||
# products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY ARM LTD ``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 ARM LTD 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.
|
||||
|
||||
DESTDIR =
|
||||
VPATH = @srcdir@ @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)
|
||||
|
||||
objtype = @objtype@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
# Multilib support variables.
|
||||
# TOP is used instead of MULTI{BUILD,SRC}TOP.
|
||||
MULTISRCTOP =
|
||||
MULTIBUILDTOP =
|
||||
MULTIDIRS =
|
||||
MULTISUBDIR =
|
||||
MULTIDO = true
|
||||
MULTICLEAN = true
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
CC = @CC@
|
||||
|
||||
AS = @AS@
|
||||
AR = @AR@
|
||||
LD = @LD@
|
||||
RANLIB = @RANLIB@
|
||||
|
||||
CPU_INIT_OBJS = rdimon-aem-el3.o
|
||||
CPU_INIT_INSTALL = install-cpu-init
|
||||
|
||||
CFLAGS = -g
|
||||
|
||||
# Host specific makefile fragment comes in here.
|
||||
@host_makefile_frag@
|
||||
|
||||
.PHONY: all
|
||||
all: ${CPU_INIT_OBJS}
|
||||
|
||||
#
|
||||
# here's where we build the test programs for each target
|
||||
#
|
||||
.PHONY: test
|
||||
test:
|
||||
|
||||
# Static pattern rule for assembling cpu init files to object files.
|
||||
${CPU_INIT_OBJS}: %.o: %.S
|
||||
$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $<
|
||||
|
||||
clean mostlyclean:
|
||||
rm -f a.out core *.i *.o *-test *.srec *.dis *.x
|
||||
|
||||
distclean maintainer-clean realclean: clean
|
||||
rm -f Makefile *~
|
||||
|
||||
.PHONY: install info install-info clean-info
|
||||
install: ${CPU_INIT_INSTALL}
|
||||
|
||||
install-cpu-init:
|
||||
test -d $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/cpu-init || mkdir $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/cpu-init
|
||||
set -e; for x in ${CPU_INIT_OBJS}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/cpu-init/$$x; done
|
||||
|
||||
doc:
|
||||
info:
|
||||
install-info:
|
||||
clean-info:
|
||||
|
||||
Makefile: Makefile.in ../config.status @host_makefile_frag_path@
|
||||
$(SHELL) ../config.status --file cpu-init/Makefile
|
||||
|
||||
../config.status: ../configure
|
||||
$(SHELL) ../config.status --recheck
|
|
@ -0,0 +1,167 @@
|
|||
/* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. 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.
|
||||
3. The name of the company may not be used to endorse or promote
|
||||
products derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY ARM LTD ``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 ARM LTD 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 "newlib.h"
|
||||
#include "svc.h"
|
||||
|
||||
/* ANSI concatenation macros. */
|
||||
#define CONCAT(a, b) CONCAT2(a, b)
|
||||
#define CONCAT2(a, b) a ## b
|
||||
|
||||
#ifdef __USER_LABEL_PREFIX__
|
||||
#define FUNCTION( name ) CONCAT (__USER_LABEL_PREFIX__, name)
|
||||
#else
|
||||
#error __USER_LABEL_PREFIX is not defined
|
||||
#endif
|
||||
|
||||
|
||||
.text
|
||||
.align 2
|
||||
_init_vectors:
|
||||
/* Installs a table of exception vectors to catch and handle all
|
||||
exceptions by terminating the process with a diagnostic. */
|
||||
adr x0, vectors
|
||||
msr vbar_el3, x0
|
||||
msr vbar_el2, x0
|
||||
msr vbar_el1, x0
|
||||
ret
|
||||
|
||||
curr_sp0_sync:
|
||||
curr_sp0_irq:
|
||||
curr_sp0_fiq:
|
||||
curr_sp0_serror:
|
||||
curr_spx_sync:
|
||||
curr_spx_irq:
|
||||
curr_spx_fiq:
|
||||
curr_spx_serror:
|
||||
lower_a64_sync:
|
||||
lower_a64_irq:
|
||||
lower_a64_fiq:
|
||||
lower_a64_serror:
|
||||
lower_a32_sync:
|
||||
lower_a32_irq:
|
||||
lower_a32_fiq:
|
||||
lower_a32_serror:
|
||||
mov x0, 2
|
||||
adr x1, .LC3
|
||||
mov x2, 26
|
||||
bl FUNCTION (write)
|
||||
mov x0, 126
|
||||
b FUNCTION (exit) /* Cannot return. */
|
||||
.LC3:
|
||||
.string "Terminated by exception.\n"
|
||||
|
||||
.macro ventry label
|
||||
.align 7
|
||||
b \label
|
||||
.endm
|
||||
|
||||
.align 7
|
||||
|
||||
/* AArch64 Exception Model -- 3.5.5 Exception Vectors. */
|
||||
|
||||
vectors:
|
||||
/* Current EL with SP0. */
|
||||
ventry curr_sp0_sync /* Synchronous */
|
||||
ventry curr_sp0_irq /* Irq/vIRQ */
|
||||
ventry curr_sp0_fiq /* Fiq/vFIQ */
|
||||
ventry curr_sp0_serror /* SError/VSError */
|
||||
|
||||
/* Current EL with SPx. */
|
||||
ventry curr_spx_sync /* Synchronous */
|
||||
ventry curr_spx_irq /* IRQ/vIRQ */
|
||||
ventry curr_spx_fiq /* FIQ/vFIQ */
|
||||
ventry curr_spx_serror /* SError/VSError */
|
||||
|
||||
/* Lower EL using AArch64. */
|
||||
ventry lower_a64_sync /* Synchronous */
|
||||
ventry lower_a64_irq /* IRQ/vIRQ */
|
||||
ventry lower_a64_fiq /* FIQ/vFIQ */
|
||||
ventry lower_a64_serror /* SError/VSError */
|
||||
|
||||
/* Lower EL using AArch32. */
|
||||
ventry lower_a32_sync /* Synchronous */
|
||||
ventry lower_a32_irq /* IRQ/vIRQ */
|
||||
ventry lower_a32_fiq /* FIQ/vFIQ */
|
||||
ventry lower_a32_serror /* SError/VSError */
|
||||
|
||||
|
||||
.text
|
||||
.align 2
|
||||
_flat_map:
|
||||
/* Page table setup (identity mapping). */
|
||||
adrp x0, ttb
|
||||
add x0, x0, :lo12:ttb
|
||||
msr ttbr0_el3, x0
|
||||
adr x1, . /* phys address */
|
||||
bic x1, x1, #(1 << 30) - 1 /* 1GB block alignment */
|
||||
add x2, x0, x1, lsr #(30 - 3) /* offset in level 1 page
|
||||
table */
|
||||
mov x3, #0x401 /* page table attributes
|
||||
(AF, block) */
|
||||
orr x1, x1, x3
|
||||
mov x3, #(1 << 30) /* 1GB block */
|
||||
str x1, [x2], #8 /* 1st GB */
|
||||
add x1, x1, x3
|
||||
str x1, [x2] /* 2nd GB */
|
||||
|
||||
/* Setup/enable the MMU. */
|
||||
|
||||
/* RES1, RES1, 40-bit PA, 39-bit VA, inner/outer cacheable WB */
|
||||
ldr x0, =(1 << 31) | (1 << 23) | (2 << 16) | 25 | (3 << 10) | (3 << 8)
|
||||
msr tcr_el3, x0
|
||||
|
||||
mov x0, #0xee /* Inner/outer cacheable WB */
|
||||
msr mair_el3, x0
|
||||
isb
|
||||
|
||||
mrs x0, sctlr_el3
|
||||
ldr x1, =0x100d /* bits I(12) SA(3) C(2) M(0) */
|
||||
bic x0, x0, #2 /* clear bit A(1) */
|
||||
orr x0, x0, x1 /* set bits */
|
||||
|
||||
msr sctlr_el3, x0
|
||||
isb
|
||||
ret
|
||||
|
||||
.data
|
||||
.align 12
|
||||
ttb:
|
||||
.space 4096, 0
|
||||
|
||||
|
||||
.text
|
||||
.align 2
|
||||
.global FUNCTION (_cpu_init_hook)
|
||||
.type FUNCTION (_cpu_init_hook), %function
|
||||
FUNCTION (_cpu_init_hook):
|
||||
sub sp, sp, #16
|
||||
str x30, [sp, xzr]
|
||||
bl _init_vectors
|
||||
bl _flat_map
|
||||
ldr x30, [sp, xzr]
|
||||
add sp, sp, #16
|
||||
ret
|
||||
.size FUNCTION (_cpu_init_hook), .-FUNCTION (_cpu_init_hook)
|
|
@ -0,0 +1,203 @@
|
|||
/* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. 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.
|
||||
3. The name of the company may not be used to endorse or promote
|
||||
products derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY ARM LTD ``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 ARM LTD 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 "newlib.h"
|
||||
#include "svc.h"
|
||||
|
||||
/* ANSI concatenation macros. */
|
||||
#define CONCAT(a, b) CONCAT2(a, b)
|
||||
#define CONCAT2(a, b) a ## b
|
||||
|
||||
#ifdef __USER_LABEL_PREFIX__
|
||||
#define FUNCTION( name ) CONCAT (__USER_LABEL_PREFIX__, name)
|
||||
#else
|
||||
#error __USER_LABEL_PREFIX is not defined
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_INITFINI_ARRAY
|
||||
#define _init __libc_init_array
|
||||
#define _fini __libc_fini_array
|
||||
#endif
|
||||
|
||||
.text
|
||||
.macro FUNC_START name
|
||||
.global \name
|
||||
\name:
|
||||
.endm
|
||||
|
||||
.align 2
|
||||
|
||||
FUNC_START _mainCRTStartup
|
||||
FUNC_START _start
|
||||
FUNC_START start
|
||||
|
||||
/* Start by setting up a stack */
|
||||
|
||||
/* Issue Angel SVC to read memory info.
|
||||
|
||||
ptr to ptr to 4 words to receive data. */
|
||||
adr x1, .LC0
|
||||
mov w0, #AngelSVC_Reason_HeapInfo
|
||||
AngelSVCAsm AngelSVC
|
||||
|
||||
/* Initialise the stack pointer */
|
||||
|
||||
/* We currently choose to use the heap_limit field rather than
|
||||
stack_base because the AEM validation model
|
||||
returns sane values in the heap fields, but 0 in the stack
|
||||
fields. Note on the VE AEM model it is necessary to pass
|
||||
command line options to the AEM in order to define the values
|
||||
exposed here in the HeapInfo Angel call. */
|
||||
ldr x0, .LC0 /* point at returned values */
|
||||
ldr x0, [x0, #8] /* get heap_limit */
|
||||
|
||||
/* Ensure quad-word stack alignment. */
|
||||
and x0, x0, #~15
|
||||
mov sp, x0
|
||||
|
||||
/* Setup an initial dummy frame with saved fp=0 and saved lr=0 */
|
||||
mov x29, 0
|
||||
stp x29, x29, [sp, #-16]!
|
||||
mov x29, sp
|
||||
|
||||
/* Initialize exception vector table, flatmap, etc. */
|
||||
bl FUNCTION (_cpu_init_hook)
|
||||
|
||||
/* Zero the memory in the .bss section. */
|
||||
ldr x0, .LC1 /* First arg: start of memory block */
|
||||
mov w1, #0 /* Second arg: fill value */
|
||||
ldr x2, .LC2
|
||||
sub x2, x2, x0 /* Third arg: length of block */
|
||||
bl FUNCTION (memset)
|
||||
|
||||
/* Need to set up standard file handles */
|
||||
bl FUNCTION (initialise_monitor_handles)
|
||||
|
||||
/* .init and .fini sections are used to create constructors
|
||||
and destructors. Here we call the _init function and arrange
|
||||
for _fini to be called at program exit. */
|
||||
ldr x0, .Lfini
|
||||
bl FUNCTION (atexit)
|
||||
|
||||
bl FUNCTION (_init)
|
||||
|
||||
/* Fetch and parse the command line. */
|
||||
adr x1, .Lcmdline /* Command line descriptor. */
|
||||
mov w0, #AngelSVC_Reason_GetCmdLine
|
||||
AngelSVCAsm AngelSVC
|
||||
ldr x8, .Lcmdline
|
||||
|
||||
mov x0, #0 /* argc */
|
||||
mov x1, sp /* argv */
|
||||
ldr x2, .Lenvp /* envp */
|
||||
|
||||
/* Put NULL at end of argv array. */
|
||||
str x0, [x1, #-8]!
|
||||
|
||||
/* Skip leading blanks. */
|
||||
.Lnext: ldrb w3, [x8], #1
|
||||
cbz w3, .Lendstr
|
||||
cmp w3, #' '
|
||||
b.eq .Lnext
|
||||
|
||||
mov w4, #' ' /* Terminator is space. */
|
||||
|
||||
/* See whether we are scanning a quoted string by checking for
|
||||
opening quote (" or '). */
|
||||
subs w9, w3, #'\"'
|
||||
sub x8, x8, #1 /* Backup if no match. */
|
||||
ccmp w9, #('\'' - '\"'), 0x4 /* FLG_Z */, ne
|
||||
csel w4, w3, w4, eq /* Terminator = quote if match. */
|
||||
cinc x8, x8, eq
|
||||
|
||||
/* Push arg pointer to argv, and bump argc. */
|
||||
str x8, [x1, #-8]!
|
||||
add x0, x0, #1
|
||||
|
||||
/* Find end of arg string. */
|
||||
1: ldrb w3, [x8], #1
|
||||
cbz w3, .Lendstr
|
||||
cmp w4, w3 /* Reached terminator? */
|
||||
b.ne 1b
|
||||
|
||||
/* Terminate the arg string with NUL char. */
|
||||
mov w4, #0
|
||||
strb w4, [x8, #-1]
|
||||
b .Lnext
|
||||
|
||||
/* Reverse argv array. */
|
||||
.Lendstr:
|
||||
add x3, x1, #0 /* sp = &argv[0] */
|
||||
add x4, x1, w0, uxtw #3 /* ep = &argv[argc] */
|
||||
cmp x4, x3
|
||||
b.lo 2f
|
||||
1: ldr x5, [x4, #-8] /* x5 = ep[-1] */
|
||||
ldr x6, [x3] /* x6 = *sp */
|
||||
str x6, [x4, #-8]! /* *--ep = x6 */
|
||||
str x5, [x3], #8 /* *sp++ = x5 */
|
||||
cmp x4, x3
|
||||
b.hi 1b
|
||||
2:
|
||||
/* Move sp to the 16B boundary below argv. */
|
||||
and x4, x1, ~15
|
||||
mov sp, x4
|
||||
|
||||
bl FUNCTION (main)
|
||||
|
||||
b FUNCTION (exit) /* Cannot return. */
|
||||
|
||||
/* Function initializing exception vector table, flatmap, etc.
|
||||
Declared as weak symbol so that user can override this definition
|
||||
by linking in their own version of the function. */
|
||||
.weak FUNCTION (_cpu_init_hook)
|
||||
FUNCTION (_cpu_init_hook):
|
||||
ret
|
||||
|
||||
.align 3
|
||||
.LC0:
|
||||
.dword HeapBase
|
||||
.LC1:
|
||||
.dword __bss_start__
|
||||
.LC2:
|
||||
.dword __bss_end__
|
||||
.Lfini:
|
||||
.dword FUNCTION(_fini)
|
||||
.Lenvp:
|
||||
.dword env
|
||||
.Lcmdline:
|
||||
.dword CommandLine
|
||||
.dword 255
|
||||
|
||||
/* Workspace for Angel calls. */
|
||||
.data
|
||||
.align 3
|
||||
/* Data returned by monitor SVC. */
|
||||
.global __stack_base__
|
||||
HeapBase: .dword 0
|
||||
HeapLimit: .dword 0
|
||||
__stack_base__: .dword 0
|
||||
StackLimit: .dword 0
|
||||
env: .dword 0 /* Dummy environment array */
|
||||
CommandLine: .space 256,0 /* Maximum length of 255 chars handled. */
|
|
@ -0,0 +1,7 @@
|
|||
%rename lib libc
|
||||
|
||||
*libgloss:
|
||||
-lrdimon
|
||||
|
||||
*lib:
|
||||
--start-group %(libc) %(libgloss) --end-group
|
|
@ -0,0 +1,91 @@
|
|||
/* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. 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.
|
||||
3. The name of the company may not be used to endorse or promote
|
||||
products derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY ARM LTD ``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 ARM LTD 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. */
|
||||
|
||||
/* Support files for GNU libc. Files in the C namespace go here.
|
||||
Files in the system namespace (ie those that start with an underscore)
|
||||
go in syscalls.c.
|
||||
|
||||
Note: These functions are in a seperate file so that OS providers can
|
||||
overrride the system call stubs (defined in syscalls.c) without having
|
||||
to provide libc funcitons as well. */
|
||||
|
||||
#include "svc.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
extern clock_t _clock (void);
|
||||
extern int _isatty (int);
|
||||
|
||||
unsigned __attribute__((weak))
|
||||
alarm (unsigned seconds)
|
||||
{
|
||||
(void) seconds;
|
||||
return 0;
|
||||
}
|
||||
|
||||
clock_t __attribute__((weak))
|
||||
clock (void)
|
||||
{
|
||||
return _clock ();
|
||||
}
|
||||
|
||||
int __attribute__((weak))
|
||||
isatty (int fildes)
|
||||
{
|
||||
return _isatty (fildes);
|
||||
}
|
||||
|
||||
int __attribute__((weak))
|
||||
pause (void)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
unsigned __attribute__((weak))
|
||||
sleep (unsigned seconds)
|
||||
{
|
||||
clock_t t0 = _clock ();
|
||||
clock_t dt = seconds * CLOCKS_PER_SEC;
|
||||
|
||||
while (_clock () - t0 < dt)
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __attribute__((weak))
|
||||
usleep (useconds_t useconds)
|
||||
{
|
||||
clock_t t0 = _clock ();
|
||||
clock_t dt = useconds / (1000000 / CLOCKS_PER_SEC);
|
||||
|
||||
while (_clock () - t0 < dt)
|
||||
;
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
/* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. 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.
|
||||
3. The name of the company may not be used to endorse or promote
|
||||
products derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY ARM LTD ``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 ARM LTD 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. */
|
||||
|
||||
/* Now the SWI numbers and reason codes for RDI (Angel) monitors. */
|
||||
#define AngelSVC 0xF000
|
||||
#define AngelSVCInsn "hlt"
|
||||
#define AngelSVCAsm hlt
|
||||
|
||||
/* The reason codes: */
|
||||
#define AngelSVC_Reason_Open 0x01
|
||||
#define AngelSVC_Reason_Close 0x02
|
||||
#define AngelSVC_Reason_WriteC 0x03
|
||||
#define AngelSVC_Reason_Write0 0x04
|
||||
#define AngelSVC_Reason_Write 0x05
|
||||
#define AngelSVC_Reason_Read 0x06
|
||||
#define AngelSVC_Reason_ReadC 0x07
|
||||
#define AngelSVC_Reason_IsTTY 0x09
|
||||
#define AngelSVC_Reason_Seek 0x0A
|
||||
#define AngelSVC_Reason_FLen 0x0C
|
||||
#define AngelSVC_Reason_TmpNam 0x0D
|
||||
#define AngelSVC_Reason_Remove 0x0E
|
||||
#define AngelSVC_Reason_Rename 0x0F
|
||||
#define AngelSVC_Reason_Clock 0x10
|
||||
#define AngelSVC_Reason_Time 0x11
|
||||
#define AngelSVC_Reason_System 0x12
|
||||
#define AngelSVC_Reason_Errno 0x13
|
||||
#define AngelSVC_Reason_GetCmdLine 0x15
|
||||
#define AngelSVC_Reason_HeapInfo 0x16
|
||||
#define AngelSVC_Reason_EnterSVC 0x17
|
||||
#define AngelSVC_Reason_ReportException 0x18
|
||||
#define AngelSVC_Reason_SyncCacheRange 0x19
|
||||
#define AngelSVC_Reason_Elapsed 0x30
|
||||
#define ADP_Stopped_ApplicationExit ((2 << 16) + 38)
|
||||
#define ADP_Stopped_RunTimeError ((2 << 16) + 35)
|
||||
|
||||
#if defined(ARM_RDI_MONITOR) && !defined(__ASSEMBLER__)
|
||||
|
||||
/* Type of each entry in a parameter block. */
|
||||
typedef long long param_block_t;
|
||||
|
||||
static inline long long
|
||||
do_AngelSVC (int reason, param_block_t * arg)
|
||||
{
|
||||
long long value;
|
||||
asm volatile ("mov w0, %w1; mov x1, %2; " AngelSVCInsn " %3; mov %0, x0"
|
||||
: "=r" (value) /* Outputs */
|
||||
: "r" (reason), "r" (arg), "n" (AngelSVC) /* Inputs */
|
||||
: "x0", "x1", "x2", "x3", "x17", "x30", "memory", "cc"
|
||||
/* Clobbers x0 and x1, and lr if in supervisor mode */);
|
||||
return value;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,751 @@
|
|||
/* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. 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.
|
||||
3. The name of the company may not be used to endorse or promote
|
||||
products derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY ARM LTD ``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 ARM LTD 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. */
|
||||
|
||||
/* Support files for GNU libc. Files in the system namespace go here.
|
||||
Files in the C namespace (ie those that do not start with an
|
||||
underscore) go in .c. */
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/times.h>
|
||||
#include <errno.h>
|
||||
#include <reent.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/wait.h>
|
||||
#include "svc.h"
|
||||
|
||||
/* Forward prototypes. */
|
||||
int _system _PARAMS ((const char *));
|
||||
int _rename _PARAMS ((const char *, const char *));
|
||||
int _isatty _PARAMS ((int));
|
||||
clock_t _times _PARAMS ((struct tms *));
|
||||
int _gettimeofday _PARAMS ((struct timeval *, void *));
|
||||
int _unlink _PARAMS ((const char *));
|
||||
int _link _PARAMS ((void));
|
||||
int _stat _PARAMS ((const char *, struct stat *));
|
||||
int _fstat _PARAMS ((int, struct stat *));
|
||||
int _swistat _PARAMS ((int fd, struct stat * st));
|
||||
caddr_t _sbrk _PARAMS ((int));
|
||||
int _getpid _PARAMS ((int));
|
||||
int _close _PARAMS ((int));
|
||||
clock_t _clock _PARAMS ((void));
|
||||
int _swiclose _PARAMS ((int));
|
||||
int _open _PARAMS ((const char *, int, ...));
|
||||
int _swiopen _PARAMS ((const char *, int));
|
||||
int _write _PARAMS ((int, char *, int));
|
||||
int _swiwrite _PARAMS ((int, char *, int));
|
||||
int _lseek _PARAMS ((int, int, int));
|
||||
int _swilseek _PARAMS ((int, int, int));
|
||||
int _read _PARAMS ((int, char *, int));
|
||||
int _swiread _PARAMS ((int, char *, int));
|
||||
void initialise_monitor_handles _PARAMS ((void));
|
||||
|
||||
static int checkerror _PARAMS ((int));
|
||||
static int error _PARAMS ((int));
|
||||
static int get_errno _PARAMS ((void));
|
||||
|
||||
/* Struct used to keep track of the file position, just so we
|
||||
can implement fseek(fh,x,SEEK_CUR). */
|
||||
struct fdent
|
||||
{
|
||||
int handle;
|
||||
int flags;
|
||||
ino_t ino;
|
||||
int pos;
|
||||
};
|
||||
|
||||
#define MAX_OPEN_FILES 20
|
||||
|
||||
/* User file descriptors (fd) are integer indexes into
|
||||
the openfiles[] array. Error checking is done by using
|
||||
findslot().
|
||||
|
||||
This openfiles array is manipulated directly by only
|
||||
these 5 functions:
|
||||
|
||||
findslot() - Translate entry.
|
||||
newslot() - Find empty entry.
|
||||
initilise_monitor_handles() - Initialize entries.
|
||||
_swiopen() - Initialize entry.
|
||||
_close() - Handle stdout == stderr case.
|
||||
|
||||
Every other function must use findslot(). */
|
||||
|
||||
static struct fdent openfiles[MAX_OPEN_FILES];
|
||||
|
||||
static struct fdent *findslot _PARAMS ((int));
|
||||
static int newslot _PARAMS ((void));
|
||||
|
||||
/* Register name faking - works in collusion with the linker. */
|
||||
register char * stack_ptr asm ("sp");
|
||||
|
||||
|
||||
/* following is copied from libc/stdio/local.h to check std streams */
|
||||
extern void _EXFUN (__sinit, (struct _reent *));
|
||||
#define CHECK_INIT(ptr) \
|
||||
do \
|
||||
{ \
|
||||
if ((ptr) && !(ptr)->__sdidinit) \
|
||||
__sinit (ptr); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
static int monitor_stdin;
|
||||
static int monitor_stdout;
|
||||
static int monitor_stderr;
|
||||
|
||||
/* Return a pointer to the structure associated with
|
||||
the user file descriptor fd. */
|
||||
static struct fdent *
|
||||
findslot (int fd)
|
||||
{
|
||||
CHECK_INIT (_REENT);
|
||||
|
||||
/* User file descriptor is out of range. */
|
||||
if ((unsigned int) fd >= MAX_OPEN_FILES)
|
||||
return NULL;
|
||||
|
||||
/* User file descriptor is open? */
|
||||
if (openfiles[fd].handle == -1)
|
||||
return NULL;
|
||||
|
||||
/* Valid. */
|
||||
return &openfiles[fd];
|
||||
}
|
||||
|
||||
/* Return the next lowest numbered free file
|
||||
structure, or -1 if we can't find one. */
|
||||
static int
|
||||
newslot (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_OPEN_FILES; i++)
|
||||
if (openfiles[i].handle == -1)
|
||||
break;
|
||||
|
||||
if (i == MAX_OPEN_FILES)
|
||||
return -1;
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
void
|
||||
initialise_monitor_handles (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Open the standard file descriptors by opening the special
|
||||
* teletype device, ":tt", read-only to obtain a descritpor for
|
||||
* standard input and write-only to obtain a descriptor for standard
|
||||
* output. Finally, open ":tt" in append mode to obtain a descriptor
|
||||
* for standard error. Since this is a write mode, most kernels will
|
||||
* probably return the same value as for standard output, but the
|
||||
* kernel can differentiate the two using the mode flag and return a
|
||||
* different descriptor for standard error.
|
||||
*/
|
||||
|
||||
param_block_t block[3];
|
||||
|
||||
block[0] = (param_block_t) ":tt";
|
||||
block[2] = 3; /* length of filename */
|
||||
block[1] = 0; /* mode "r" */
|
||||
monitor_stdin = do_AngelSVC (AngelSVC_Reason_Open, block);
|
||||
|
||||
block[0] = (param_block_t) ":tt";
|
||||
block[2] = 3; /* length of filename */
|
||||
block[1] = 4; /* mode "w" */
|
||||
monitor_stdout = do_AngelSVC (AngelSVC_Reason_Open, block);
|
||||
|
||||
block[0] = (param_block_t) ":tt";
|
||||
block[2] = 3; /* length of filename */
|
||||
block[1] = 8; /* mode "a" */
|
||||
monitor_stderr = do_AngelSVC (AngelSVC_Reason_Open, block);
|
||||
|
||||
/* If we failed to open stderr, redirect to stdout. */
|
||||
if (monitor_stderr == -1)
|
||||
monitor_stderr = monitor_stdout;
|
||||
|
||||
for (i = 0; i < MAX_OPEN_FILES; i++)
|
||||
openfiles[i].handle = -1;
|
||||
|
||||
openfiles[0].handle = monitor_stdin;
|
||||
openfiles[0].flags = _FREAD;
|
||||
openfiles[0].pos = 0;
|
||||
openfiles[1].handle = monitor_stdout;
|
||||
openfiles[0].flags = _FWRITE;
|
||||
openfiles[1].pos = 0;
|
||||
openfiles[2].handle = monitor_stderr;
|
||||
openfiles[0].flags = _FWRITE;
|
||||
openfiles[2].pos = 0;
|
||||
}
|
||||
|
||||
static int
|
||||
get_errno (void)
|
||||
{
|
||||
return do_AngelSVC (AngelSVC_Reason_Errno, NULL);
|
||||
}
|
||||
|
||||
/* Set errno and return result. */
|
||||
static int
|
||||
error (int result)
|
||||
{
|
||||
errno = get_errno ();
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Check the return and set errno appropriately. */
|
||||
static int
|
||||
checkerror (int result)
|
||||
{
|
||||
if (result == -1)
|
||||
return error (-1);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* fh, is a valid internal file handle.
|
||||
ptr, is a null terminated string.
|
||||
len, is the length in bytes to read.
|
||||
Returns the number of bytes *not* written. */
|
||||
int
|
||||
_swiread (int fh, char *ptr, int len)
|
||||
{
|
||||
param_block_t block[3];
|
||||
|
||||
block[0] = fh;
|
||||
block[1] = (param_block_t) ptr;
|
||||
block[2] = len;
|
||||
|
||||
return checkerror (do_AngelSVC (AngelSVC_Reason_Read, block));
|
||||
}
|
||||
|
||||
/* fd, is a valid user file handle.
|
||||
Translates the return of _swiread into
|
||||
bytes read. */
|
||||
int
|
||||
_read (int fd, char *ptr, int len)
|
||||
{
|
||||
int res;
|
||||
struct fdent *pfd;
|
||||
|
||||
pfd = findslot (fd);
|
||||
if (pfd == NULL)
|
||||
{
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
||||
res = _swiread (pfd->handle, ptr, len);
|
||||
|
||||
if (res == -1)
|
||||
return res;
|
||||
|
||||
pfd->pos += len - res;
|
||||
|
||||
/* res == len is not an error,
|
||||
at least if we want feof() to work. */
|
||||
return len - res;
|
||||
}
|
||||
|
||||
/* fd, is a user file descriptor. */
|
||||
int
|
||||
_swilseek (int fd, int ptr, int dir)
|
||||
{
|
||||
int res;
|
||||
struct fdent *pfd;
|
||||
|
||||
/* Valid file descriptor? */
|
||||
pfd = findslot (fd);
|
||||
if (pfd == NULL)
|
||||
{
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Valid whence? */
|
||||
if ((dir != SEEK_CUR) && (dir != SEEK_SET) && (dir != SEEK_END))
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Convert SEEK_CUR to SEEK_SET */
|
||||
if (dir == SEEK_CUR)
|
||||
{
|
||||
ptr = pfd->pos + ptr;
|
||||
/* The resulting file offset would be negative. */
|
||||
if (ptr < 0)
|
||||
{
|
||||
errno = EINVAL;
|
||||
if ((pfd->pos > 0) && (ptr > 0))
|
||||
errno = EOVERFLOW;
|
||||
return -1;
|
||||
}
|
||||
dir = SEEK_SET;
|
||||
}
|
||||
|
||||
param_block_t block[2];
|
||||
if (dir == SEEK_END)
|
||||
{
|
||||
block[0] = pfd->handle;
|
||||
res = checkerror (do_AngelSVC (AngelSVC_Reason_FLen, block));
|
||||
if (res == -1)
|
||||
return -1;
|
||||
ptr += res;
|
||||
}
|
||||
|
||||
/* This code only does absolute seeks. */
|
||||
block[0] = pfd->handle;
|
||||
block[1] = ptr;
|
||||
res = checkerror (do_AngelSVC (AngelSVC_Reason_Seek, block));
|
||||
/* At this point ptr is the current file position. */
|
||||
if (res >= 0)
|
||||
{
|
||||
pfd->pos = ptr;
|
||||
return ptr;
|
||||
}
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
_lseek (int fd, int ptr, int dir)
|
||||
{
|
||||
return _swilseek (fd, ptr, dir);
|
||||
}
|
||||
|
||||
/* fh, is a valid internal file handle.
|
||||
Returns the number of bytes *not* written. */
|
||||
int
|
||||
_swiwrite (int fh, char *ptr, int len)
|
||||
{
|
||||
param_block_t block[3];
|
||||
|
||||
block[0] = fh;
|
||||
block[1] = (param_block_t) ptr;
|
||||
block[2] = len;
|
||||
|
||||
return checkerror (do_AngelSVC (AngelSVC_Reason_Write, block));
|
||||
}
|
||||
|
||||
/* fd, is a user file descriptor. */
|
||||
int
|
||||
_write (int fd, char *ptr, int len)
|
||||
{
|
||||
int res;
|
||||
struct fdent *pfd;
|
||||
|
||||
pfd = findslot (fd);
|
||||
if (pfd == NULL)
|
||||
{
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
||||
res = _swiwrite (pfd->handle, ptr, len);
|
||||
|
||||
/* Clearly an error. */
|
||||
if (res < 0)
|
||||
return -1;
|
||||
|
||||
pfd->pos += len - res;
|
||||
|
||||
/* We wrote 0 bytes?
|
||||
Retrieve errno just in case. */
|
||||
if ((len - res) == 0)
|
||||
return error (0);
|
||||
|
||||
return (len - res);
|
||||
}
|
||||
|
||||
int
|
||||
_swiopen (const char *path, int flags)
|
||||
{
|
||||
int aflags = 0, fh;
|
||||
param_block_t block[3];
|
||||
static ino_t ino = 1;
|
||||
int fd;
|
||||
|
||||
if (path == NULL)
|
||||
{
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
fd = newslot ();
|
||||
|
||||
if (fd == -1)
|
||||
{
|
||||
errno = EMFILE;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* It is an error to open a file that already exists. */
|
||||
if ((flags & O_CREAT) && (flags & O_EXCL))
|
||||
{
|
||||
struct stat st;
|
||||
int res;
|
||||
res = _stat (path, &st);
|
||||
if (res != -1)
|
||||
{
|
||||
errno = EEXIST;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* The flags are Unix-style, so we need to convert them. */
|
||||
#ifdef O_BINARY
|
||||
if (flags & O_BINARY)
|
||||
aflags |= 1;
|
||||
#endif
|
||||
|
||||
/* In O_RDONLY we expect aflags == 0. */
|
||||
|
||||
if (flags & O_RDWR)
|
||||
aflags |= 2;
|
||||
|
||||
if ((flags & O_CREAT) || (flags & O_TRUNC) || (flags & O_WRONLY))
|
||||
aflags |= 4;
|
||||
|
||||
if (flags & O_APPEND)
|
||||
{
|
||||
/* Can't ask for w AND a; means just 'a'. */
|
||||
aflags &= ~4;
|
||||
aflags |= 8;
|
||||
}
|
||||
|
||||
block[0] = (param_block_t) path;
|
||||
block[2] = strlen (path);
|
||||
block[1] = aflags;
|
||||
|
||||
fh = do_AngelSVC (AngelSVC_Reason_Open, block);
|
||||
|
||||
/* Return a user file descriptor or an error. */
|
||||
if (fh >= 0)
|
||||
{
|
||||
openfiles[fd].handle = fh;
|
||||
openfiles[fd].flags = flags + 1;
|
||||
openfiles[fd].ino = ino++;
|
||||
openfiles[fd].pos = 0;
|
||||
return fd;
|
||||
}
|
||||
else
|
||||
return error (fh);
|
||||
}
|
||||
|
||||
int
|
||||
_open (const char *path, int flags, ...)
|
||||
{
|
||||
return _swiopen (path, flags);
|
||||
}
|
||||
|
||||
/* fh, is a valid internal file handle. */
|
||||
int
|
||||
_swiclose (int fh)
|
||||
{
|
||||
param_block_t param[1];
|
||||
param[0] = fh;
|
||||
return checkerror (do_AngelSVC (AngelSVC_Reason_Close, param));
|
||||
}
|
||||
|
||||
/* fd, is a user file descriptor. */
|
||||
int
|
||||
_close (int fd)
|
||||
{
|
||||
int res;
|
||||
struct fdent *pfd;
|
||||
|
||||
pfd = findslot (fd);
|
||||
if (pfd == NULL)
|
||||
{
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Handle stderr == stdout. */
|
||||
if ((fd == 1 || fd == 2) && (openfiles[1].handle == openfiles[2].handle))
|
||||
{
|
||||
pfd->handle = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Attempt to close the handle. */
|
||||
res = _swiclose (pfd->handle);
|
||||
|
||||
/* Reclaim handle? */
|
||||
if (res == 0)
|
||||
pfd->handle = -1;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
int __attribute__((weak))
|
||||
_getpid (int n __attribute__ ((unused)))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
caddr_t
|
||||
_sbrk (int incr)
|
||||
{
|
||||
extern char end asm ("end"); /* Defined by the linker. */
|
||||
static char *heap_end;
|
||||
char *prev_heap_end;
|
||||
|
||||
if (heap_end == NULL)
|
||||
heap_end = &end;
|
||||
|
||||
prev_heap_end = heap_end;
|
||||
|
||||
if (heap_end + incr > stack_ptr)
|
||||
{
|
||||
/* Some of the libstdc++-v3 tests rely upon detecting
|
||||
out of memory errors, so do not abort here. */
|
||||
errno = ENOMEM;
|
||||
return (caddr_t) - 1;
|
||||
}
|
||||
|
||||
heap_end += incr;
|
||||
|
||||
return (caddr_t) prev_heap_end;
|
||||
}
|
||||
|
||||
int
|
||||
_swistat (int fd, struct stat *st)
|
||||
{
|
||||
struct fdent *pfd;
|
||||
param_block_t param[1];
|
||||
int res;
|
||||
|
||||
pfd = findslot (fd);
|
||||
if (pfd == NULL)
|
||||
{
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
||||
param[0] = pfd->handle;
|
||||
res = do_AngelSVC (AngelSVC_Reason_IsTTY, param);
|
||||
if (res != 0 && res != 1)
|
||||
return error (-1);
|
||||
|
||||
memset (st, 0, sizeof (*st));
|
||||
|
||||
if (res)
|
||||
{
|
||||
/* This is a tty. */
|
||||
st->st_mode |= S_IFCHR;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* This is a file, return the file length. */
|
||||
st->st_mode |= S_IFREG;
|
||||
res = checkerror (do_AngelSVC (AngelSVC_Reason_FLen, param));
|
||||
if (res == -1)
|
||||
return -1;
|
||||
st->st_size = res;
|
||||
st->st_blksize = 1024;
|
||||
st->st_blocks = (res + 1023) / 1024;
|
||||
}
|
||||
|
||||
/* Deduce permissions based on mode in which file opened. */
|
||||
st->st_mode |= S_IRUSR | S_IRGRP | S_IROTH;
|
||||
if (pfd->flags & _FWRITE)
|
||||
st->st_mode |= S_IWUSR | S_IWGRP | S_IWOTH;
|
||||
|
||||
st->st_ino = pfd->ino;
|
||||
st->st_nlink = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __attribute__((weak))
|
||||
_fstat (int fd, struct stat * st)
|
||||
{
|
||||
return _swistat (fd, st);
|
||||
}
|
||||
|
||||
int __attribute__((weak))
|
||||
_stat (const char *fname, struct stat *st)
|
||||
{
|
||||
int fd, res;
|
||||
/* The best we can do is try to open the file readonly.
|
||||
If it exists, then we can guess a few things about it. */
|
||||
if ((fd = _open (fname, O_RDONLY)) == -1)
|
||||
return -1;
|
||||
res = _swistat (fd, st);
|
||||
/* Not interested in the error. */
|
||||
_close (fd);
|
||||
return res;
|
||||
}
|
||||
|
||||
int __attribute__((weak))
|
||||
_link (void)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
_unlink (const char *path)
|
||||
{
|
||||
int res;
|
||||
param_block_t block[2];
|
||||
block[0] = (param_block_t) path;
|
||||
block[1] = strlen (path);
|
||||
res = do_AngelSVC (AngelSVC_Reason_Remove, block);
|
||||
if (res == -1)
|
||||
return error (res);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
_gettimeofday (struct timeval *tp, void *tzvp)
|
||||
{
|
||||
struct timezone *tzp = tzvp;
|
||||
if (tp)
|
||||
{
|
||||
/* Ask the host for the seconds since the Unix epoch. */
|
||||
tp->tv_sec = do_AngelSVC (AngelSVC_Reason_Time, NULL);
|
||||
tp->tv_usec = 0;
|
||||
}
|
||||
|
||||
/* Return fixed data for the timezone. */
|
||||
if (tzp)
|
||||
{
|
||||
tzp->tz_minuteswest = 0;
|
||||
tzp->tz_dsttime = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Return a clock that ticks at 100Hz. */
|
||||
clock_t
|
||||
_clock (void)
|
||||
{
|
||||
clock_t timeval;
|
||||
|
||||
timeval = do_AngelSVC (AngelSVC_Reason_Clock, NULL);
|
||||
return timeval;
|
||||
}
|
||||
|
||||
/* Return a clock that ticks at 100Hz. */
|
||||
clock_t
|
||||
_times (struct tms * tp)
|
||||
{
|
||||
clock_t timeval = _clock ();
|
||||
|
||||
if (tp)
|
||||
{
|
||||
tp->tms_utime = timeval; /* user time */
|
||||
tp->tms_stime = 0; /* system time */
|
||||
tp->tms_cutime = 0; /* user time, children */
|
||||
tp->tms_cstime = 0; /* system time, children */
|
||||
}
|
||||
|
||||
return timeval;
|
||||
};
|
||||
|
||||
|
||||
int
|
||||
_isatty (int fd)
|
||||
{
|
||||
struct fdent *pfd;
|
||||
param_block_t param[1];
|
||||
int res;
|
||||
|
||||
/* Return 1 if fd is an open file descriptor referring to a terminal;
|
||||
otherwise 0 is returned, and errno is set to indicate the error. */
|
||||
|
||||
pfd = findslot (fd);
|
||||
if (pfd == NULL)
|
||||
{
|
||||
errno = EBADF;
|
||||
return 0;
|
||||
}
|
||||
|
||||
param[0] = pfd->handle;
|
||||
res = do_AngelSVC (AngelSVC_Reason_IsTTY, param);
|
||||
|
||||
if (res != 1)
|
||||
return error (0);
|
||||
return res;
|
||||
}
|
||||
|
||||
int
|
||||
_system (const char *s)
|
||||
{
|
||||
param_block_t block[2];
|
||||
int e;
|
||||
|
||||
/* Hmmm. The ARM debug interface specification doesn't say whether
|
||||
SYS_SYSTEM does the right thing with a null argument, or assign any
|
||||
meaning to its return value. Try to do something reasonable.... */
|
||||
if (!s)
|
||||
return 1; /* maybe there is a shell available? we can hope. :-P */
|
||||
block[0] = (param_block_t) s;
|
||||
block[1] = strlen (s);
|
||||
e = checkerror (do_AngelSVC (AngelSVC_Reason_System, block));
|
||||
if ((e >= 0) && (e < 256))
|
||||
{
|
||||
/* We have to convert e, an exit status to the encoded status of
|
||||
the command. To avoid hard coding the exit status, we simply
|
||||
loop until we find the right position. */
|
||||
int exit_code;
|
||||
|
||||
for (exit_code = e; e && WEXITSTATUS (e) != exit_code; e <<= 1)
|
||||
continue;
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
int
|
||||
_rename (const char *oldpath, const char *newpath)
|
||||
{
|
||||
param_block_t block[4];
|
||||
block[0] = (param_block_t) oldpath;
|
||||
block[1] = strlen (oldpath);
|
||||
block[2] = (param_block_t) newpath;
|
||||
block[3] = strlen (newpath);
|
||||
return checkerror (do_AngelSVC (AngelSVC_Reason_Rename, block)) ? -1 : 0;
|
||||
}
|
||||
|
||||
/* Returns the number of elapsed target ticks since the support code
|
||||
started execution. Returns -1 and sets errno on error. */
|
||||
long
|
||||
__aarch64_angel_elapsed (void)
|
||||
{
|
||||
int result;
|
||||
param_block_t block[2];
|
||||
result = checkerror (do_AngelSVC (AngelSVC_Reason_Elapsed, block));
|
||||
if (result == -1)
|
||||
return result;
|
||||
return block[0];
|
||||
}
|
|
@ -665,6 +665,7 @@ target_alias
|
|||
CCAS
|
||||
CCASFLAGS'
|
||||
ac_subdirs_all='doc
|
||||
aarch64
|
||||
epiphany
|
||||
i386
|
||||
m32r
|
||||
|
@ -2391,6 +2392,11 @@ config_testsuite=true
|
|||
config_libnosys=true
|
||||
|
||||
case "${target}" in
|
||||
aarch64*-*-*)
|
||||
subdirs="$subdirs aarch64"
|
||||
|
||||
config_testsuite=true
|
||||
;;
|
||||
epiphany-*-*)
|
||||
subdirs="$subdirs epiphany"
|
||||
|
||||
|
|
|
@ -34,6 +34,10 @@ dnl indicates whether to run configure within the libnosys subdirectory
|
|||
config_libnosys=true
|
||||
|
||||
case "${target}" in
|
||||
aarch64*-*-*)
|
||||
AC_CONFIG_SUBDIRS(aarch64)
|
||||
config_testsuite=true
|
||||
;;
|
||||
epiphany-*-*)
|
||||
AC_CONFIG_SUBDIRS(epiphany)
|
||||
config_testsuite=true
|
||||
|
|
Loading…
Reference in New Issue