2002-06-18 Dave Brolley <brolley@redhat.com>
From Catherine Moore, Michael Meissner, Richard Sandiford: * configure.in: Support frv*-*-*. * frv/Makefile.in: New file. * frv/configure: New file. * frv/configure.in: New file. * frv/crt0.S: New file. * frv/fstat.c: New file. * frv/getpid.c: New file. * frv/isatty.c: New file. * frv/kill.c: New file. * frv/print.c: New file. * frv/putnum.c: New file. * frv/sbrk.c: New file. * frv/sim-close.S: New file. * frv/sim-exit.S: New file. * frv/sim-inbyte.c: New file. * frv/sim-lseek.S: New file. * frv/sim-open.S: New file. * frv/sim-read.S: New file. * frv/sim-time.c: New file. * frv/sim-unlink.S: New file. * frv/sim-write.S: New file. * frv/stat.c: New file.
This commit is contained in:
		@@ -1,3 +1,29 @@
 | 
			
		||||
2002-06-18  Dave Brolley  <brolley@redhat.com>
 | 
			
		||||
 | 
			
		||||
	From Catherine Moore, Michael Meissner, Richard Sandiford:
 | 
			
		||||
	* configure.in: Support frv*-*-*.
 | 
			
		||||
	* frv/Makefile.in: New file.
 | 
			
		||||
	* frv/configure: New file.
 | 
			
		||||
	* frv/configure.in: New file.
 | 
			
		||||
	* frv/crt0.S: New file.
 | 
			
		||||
	* frv/fstat.c: New file.
 | 
			
		||||
	* frv/getpid.c: New file.
 | 
			
		||||
	* frv/isatty.c: New file.
 | 
			
		||||
	* frv/kill.c: New file.
 | 
			
		||||
	* frv/print.c: New file.
 | 
			
		||||
	* frv/putnum.c: New file.
 | 
			
		||||
	* frv/sbrk.c: New file.
 | 
			
		||||
	* frv/sim-close.S: New file.
 | 
			
		||||
	* frv/sim-exit.S: New file.
 | 
			
		||||
	* frv/sim-inbyte.c: New file.
 | 
			
		||||
	* frv/sim-lseek.S: New file.
 | 
			
		||||
	* frv/sim-open.S: New file.
 | 
			
		||||
	* frv/sim-read.S: New file.
 | 
			
		||||
	* frv/sim-time.c: New file.
 | 
			
		||||
	* frv/sim-unlink.S: New file.
 | 
			
		||||
	* frv/sim-write.S: New file.
 | 
			
		||||
	* frv/stat.c: New file.
 | 
			
		||||
 | 
			
		||||
2002-05-11  Thomas Fitzsimmons  <fitzsim@redhat.com>
 | 
			
		||||
 | 
			
		||||
	* libnosys/acconfig.h (HAVE_SECTION_ATTRIBUTES): New macro.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								libgloss/configure
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								libgloss/configure
									
									
									
									
										vendored
									
									
								
							@@ -774,6 +774,8 @@ case "${target}" in
 | 
			
		||||
  fr30-*-*)
 | 
			
		||||
	configdirs="${configdirs} fr30 testsuite"
 | 
			
		||||
	;;
 | 
			
		||||
  frv*-*-*)
 | 
			
		||||
	configdirs="${configdirs} frv testsuite";;
 | 
			
		||||
  mcore-*-*)
 | 
			
		||||
	configdirs="${configdirs} mcore testsuite"
 | 
			
		||||
	;;
 | 
			
		||||
 
 | 
			
		||||
@@ -85,6 +85,8 @@ case "${target}" in
 | 
			
		||||
  fr30-*-*)
 | 
			
		||||
	configdirs="${configdirs} fr30 testsuite"
 | 
			
		||||
	;;
 | 
			
		||||
  frv*-*-*)
 | 
			
		||||
	configdirs="${configdirs} frv testsuite";;
 | 
			
		||||
  mcore-*-*)
 | 
			
		||||
	configdirs="${configdirs} mcore testsuite"
 | 
			
		||||
	;;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										124
									
								
								libgloss/frv/Makefile.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										124
									
								
								libgloss/frv/Makefile.in
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,124 @@
 | 
			
		||||
# Copyright (c) 2002 Red Hat, Inc
 | 
			
		||||
#
 | 
			
		||||
# The authors hereby grant permission to use, copy, modify, distribute,
 | 
			
		||||
# and license this software and its documentation for any purpose, provided
 | 
			
		||||
# that existing copyright notices are retained in all copies and that this
 | 
			
		||||
# notice is included verbatim in any distributions. No written agreement,
 | 
			
		||||
# license, or royalty fee is required for any of the authorized uses.
 | 
			
		||||
# Modifications to this software may be copyrighted by their authors
 | 
			
		||||
# and need not follow the licensing terms described here, provided that
 | 
			
		||||
# the new terms are clearly indicated on the first page of each file where
 | 
			
		||||
# they apply.
 | 
			
		||||
 | 
			
		||||
# Makefile for libgloss/frv. This is the board support
 | 
			
		||||
# code for the various frv targets.
 | 
			
		||||
 | 
			
		||||
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)
 | 
			
		||||
 | 
			
		||||
# 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@
 | 
			
		||||
AR_FLAGS = rc
 | 
			
		||||
 | 
			
		||||
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`
 | 
			
		||||
 | 
			
		||||
CRT0 = crt0.o
 | 
			
		||||
SIM_BSP = libsim.a
 | 
			
		||||
SIM_OBJS = fstat.o \
 | 
			
		||||
	   getpid.o \
 | 
			
		||||
	   isatty.o \
 | 
			
		||||
	   kill.o \
 | 
			
		||||
	   putnum.o \
 | 
			
		||||
	   sbrk.o \
 | 
			
		||||
	   sim-close.o \
 | 
			
		||||
	   sim-exit.o \
 | 
			
		||||
	   sim-inbyte.o \
 | 
			
		||||
	   sim-lseek.o \
 | 
			
		||||
	   sim-open.o \
 | 
			
		||||
	   sim-read.o \
 | 
			
		||||
	   sim-time.o \
 | 
			
		||||
	   sim-unlink.o \
 | 
			
		||||
	   sim-write.o \
 | 
			
		||||
	   stat.o
 | 
			
		||||
 | 
			
		||||
#### Host specific Makefile fragment comes in here.
 | 
			
		||||
@host_makefile_frag@
 | 
			
		||||
 | 
			
		||||
all: $(CRT0) $(SIM_BSP)
 | 
			
		||||
 | 
			
		||||
$(SIM_BSP): $(SIM_OBJS)
 | 
			
		||||
	$(AR) $(ARFLAGS) $@ $?
 | 
			
		||||
	$(RANLIB) $@
 | 
			
		||||
 | 
			
		||||
fstat.o: $(srcdir)/fstat.c
 | 
			
		||||
getpid.o: $(srcdir)/getpid.c
 | 
			
		||||
isatty.o: $(srcdir)/isatty.c
 | 
			
		||||
kill.o: $(srcdir)/kill.c
 | 
			
		||||
putnum.o: $(srcdir)/putnum.c
 | 
			
		||||
sbrk.o: $(srcdir)/sbrk.c
 | 
			
		||||
sim-close.o: $(srcdir)/sim-close.S
 | 
			
		||||
sim-exit.o: $(srcdir)/sim-exit.S
 | 
			
		||||
sim-inbyte.o: $(srcdir)/sim-inbyte.c
 | 
			
		||||
sim-lseek.o: $(srcdir)/sim-lseek.S
 | 
			
		||||
sim-open.o: $(srcdir)/sim-open.S
 | 
			
		||||
sim-read.o: $(srcdir)/sim-read.S
 | 
			
		||||
sim-time.o: $(srcdir)/sim-time.c
 | 
			
		||||
sim-unlink.o: $(srcdir)/sim-unlink.S
 | 
			
		||||
sim-write.o: $(srcdir)/sim-write.S
 | 
			
		||||
stat.o: $(srcdir)/stat.c
 | 
			
		||||
 | 
			
		||||
install: $($(CPU)_INSTALL)
 | 
			
		||||
	$(INSTALL_DATA) $(CRT0) $(tooldir)/lib${MULTISUBDIR}/$(CRT0)
 | 
			
		||||
	$(INSTALL_DATA) $(SIM_BSP) $(tooldir)/lib${MULTISUBDIR}/$(SIM_BSP)
 | 
			
		||||
 | 
			
		||||
clean mostlyclean:
 | 
			
		||||
	rm -f *.o *.a
 | 
			
		||||
 | 
			
		||||
distclean maintainer-clean realclean: clean
 | 
			
		||||
	rm -f Makefile config.cache config.log config.status
 | 
			
		||||
 | 
			
		||||
.PHONY: info dvi doc install-info clean-info
 | 
			
		||||
info doc dvi:
 | 
			
		||||
install-info:
 | 
			
		||||
clean-info:
 | 
			
		||||
 | 
			
		||||
Makefile: Makefile.in config.status @host_makefile_frag_path@
 | 
			
		||||
	$(SHELL) config.status
 | 
			
		||||
 | 
			
		||||
config.status: configure
 | 
			
		||||
	$(SHELL) config.status --recheck
 | 
			
		||||
							
								
								
									
										1204
									
								
								libgloss/frv/configure
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
							
						
						
									
										1204
									
								
								libgloss/frv/configure
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										90
									
								
								libgloss/frv/configure.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										90
									
								
								libgloss/frv/configure.in
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,90 @@
 | 
			
		||||
dnl Process this file with autoconf to produce a configure script.
 | 
			
		||||
AC_PREREQ(2.5)dnl
 | 
			
		||||
AC_INIT(crt0.S)
 | 
			
		||||
 | 
			
		||||
if test "${enable_shared}" = "yes" ; then
 | 
			
		||||
    echo "Shared libraries not supported for cross compiling, ignored"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if test "$srcdir" = "." ; then
 | 
			
		||||
  if test "${with_target_subdir}" != "." ; then
 | 
			
		||||
    libgloss_topdir="${srcdir}/${with_multisrctop}../../.."
 | 
			
		||||
  else
 | 
			
		||||
    libgloss_topdir="${srcdir}/${with_multisrctop}../.."
 | 
			
		||||
  fi
 | 
			
		||||
else
 | 
			
		||||
  libgloss_topdir="${srcdir}/../.."
 | 
			
		||||
fi
 | 
			
		||||
AC_CONFIG_AUX_DIR($libgloss_topdir)
 | 
			
		||||
 | 
			
		||||
AC_CANONICAL_SYSTEM
 | 
			
		||||
AC_ARG_PROGRAM
 | 
			
		||||
 | 
			
		||||
AC_PROG_INSTALL
 | 
			
		||||
 | 
			
		||||
# FIXME: We temporarily define our own version of AC_PROG_CC.  This is
 | 
			
		||||
# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS.  We
 | 
			
		||||
# are probably using a cross compiler, which will not be able to fully
 | 
			
		||||
# link an executable.  This should really be fixed in autoconf
 | 
			
		||||
# itself.
 | 
			
		||||
 | 
			
		||||
AC_DEFUN(LIB_AC_PROG_CC,
 | 
			
		||||
[AC_BEFORE([$0], [AC_PROG_CPP])dnl
 | 
			
		||||
AC_CHECK_PROG(CC, gcc, gcc)
 | 
			
		||||
if test -z "$CC"; then
 | 
			
		||||
  AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
 | 
			
		||||
  test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
AC_PROG_CC_GNU
 | 
			
		||||
 | 
			
		||||
if test $ac_cv_prog_gcc = yes; then
 | 
			
		||||
  GCC=yes
 | 
			
		||||
dnl Check whether -g works, even if CFLAGS is set, in case the package
 | 
			
		||||
dnl plays around with CFLAGS (such as to build both debugging and
 | 
			
		||||
dnl normal versions of a library), tasteless as that idea is.
 | 
			
		||||
  ac_test_CFLAGS="${CFLAGS+set}"
 | 
			
		||||
  ac_save_CFLAGS="$CFLAGS"
 | 
			
		||||
  CFLAGS=
 | 
			
		||||
  AC_PROG_CC_G
 | 
			
		||||
  if test "$ac_test_CFLAGS" = set; then
 | 
			
		||||
    CFLAGS="$ac_save_CFLAGS"
 | 
			
		||||
  elif test $ac_cv_prog_cc_g = yes; then
 | 
			
		||||
    CFLAGS="-g -O2"
 | 
			
		||||
  else
 | 
			
		||||
    CFLAGS="-O2"
 | 
			
		||||
  fi
 | 
			
		||||
else
 | 
			
		||||
  GCC=
 | 
			
		||||
  test "${CFLAGS+set}" = set || CFLAGS="-g"
 | 
			
		||||
fi
 | 
			
		||||
])
 | 
			
		||||
 | 
			
		||||
LIB_AC_PROG_CC
 | 
			
		||||
 | 
			
		||||
AS=${AS-as}
 | 
			
		||||
AC_SUBST(AS)
 | 
			
		||||
AR=${AR-ar}
 | 
			
		||||
AC_SUBST(AR)
 | 
			
		||||
LD=${LD-ld}
 | 
			
		||||
AC_SUBST(LD)
 | 
			
		||||
AC_PROG_RANLIB
 | 
			
		||||
 | 
			
		||||
host_makefile_frag=${srcdir}/../config/default.mh
 | 
			
		||||
 | 
			
		||||
dnl We have to assign the same value to other variables because autoconf
 | 
			
		||||
dnl doesn't provide a mechanism to substitute a replacement keyword with
 | 
			
		||||
dnl arbitrary data or pathnames.
 | 
			
		||||
dnl
 | 
			
		||||
host_makefile_frag_path=$host_makefile_frag
 | 
			
		||||
AC_SUBST(host_makefile_frag_path)
 | 
			
		||||
AC_SUBST_FILE(host_makefile_frag)
 | 
			
		||||
 | 
			
		||||
AC_OUTPUT(Makefile,
 | 
			
		||||
. ${libgloss_topdir}/config-ml.in,
 | 
			
		||||
srcdir=${srcdir}
 | 
			
		||||
target=${target}
 | 
			
		||||
ac_configure_args="${ac_configure_args} --enable-multilib"
 | 
			
		||||
CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
 | 
			
		||||
libgloss_topdir=${libgloss_topdir}
 | 
			
		||||
)
 | 
			
		||||
							
								
								
									
										231
									
								
								libgloss/frv/crt0.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										231
									
								
								libgloss/frv/crt0.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,231 @@
 | 
			
		||||
/* crt0.S -- startup file for frv.
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) 2002 Red Hat, Inc
 | 
			
		||||
 *
 | 
			
		||||
 * The authors hereby grant permission to use, copy, modify, distribute,
 | 
			
		||||
 * and license this software and its documentation for any purpose, provided
 | 
			
		||||
 * that existing copyright notices are retained in all copies and that this
 | 
			
		||||
 * notice is included verbatim in any distributions. No written agreement,
 | 
			
		||||
 * license, or royalty fee is required for any of the authorized uses.
 | 
			
		||||
 * Modifications to this software may be copyrighted by their authors
 | 
			
		||||
 * and need not follow the licensing terms described here, provided that
 | 
			
		||||
 * the new terms are clearly indicated on the first page of each file where
 | 
			
		||||
 * they apply.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <frv-asm.h>
 | 
			
		||||
 | 
			
		||||
	/* statically store .Lcall's address so we can see if we are running
 | 
			
		||||
	   at the location we were linked for or a different location.  */
 | 
			
		||||
	.data
 | 
			
		||||
	.type	EXT(__start_cmp),@object
 | 
			
		||||
	.size	EXT(__start_cmp),4
 | 
			
		||||
	.p2align 2
 | 
			
		||||
EXT(__start_cmp):
 | 
			
		||||
	.picptr	 .Lcall
 | 
			
		||||
	
 | 
			
		||||
	.globl	__start
 | 
			
		||||
	.weak	_start
 | 
			
		||||
	.text
 | 
			
		||||
	.type	__start,@function
 | 
			
		||||
__start:
 | 
			
		||||
_start:
 | 
			
		||||
	call	.Lcall				/* set up _gp in a pic-friendly manor */
 | 
			
		||||
.Lcall:	movsg	lr, gr4
 | 
			
		||||
	P(sethi) #gprelhi(.Lcall), gr5
 | 
			
		||||
	setlo	 #gprello(.Lcall), gr5
 | 
			
		||||
	P(sub)	 gr4, gr5, gr16
 | 
			
		||||
 | 
			
		||||
	sethi	 #gprelhi(EXT(_stack)), sp	/* load up stack pointer */
 | 
			
		||||
	P(setlo) #gprello(EXT(_stack)), sp
 | 
			
		||||
	setlos   #0, fp				/* zero fp to allow unwinders to stop */
 | 
			
		||||
	P(add)	 sp, gr16, sp
 | 
			
		||||
 | 
			
		||||
	sethi	 #gprelhi(EXT(__start_cmp)), gr5
 | 
			
		||||
	setlo    #gprello(EXT(__start_cmp)), gr5
 | 
			
		||||
	ld	 @(gr5,gr16), gr6
 | 
			
		||||
	subcc	gr4, gr6, gr8, icc0
 | 
			
		||||
	beq	icc0, 0, .Lfixed
 | 
			
		||||
 | 
			
		||||
	P(st)	gr4, @(gr5, gr16)	/* update so if we restart no need to fixup */
 | 
			
		||||
 | 
			
		||||
					/* fixup the .ctors list */
 | 
			
		||||
	sethi	 #gprelhi(EXT(__CTOR_LIST__)), gr9
 | 
			
		||||
	P(sethi) #gprelhi(EXT(__CTOR_END__)), gr10
 | 
			
		||||
	setlo	 #gprello(EXT(__CTOR_LIST__)), gr9
 | 
			
		||||
	P(setlo) #gprello(EXT(__CTOR_END__)), gr10
 | 
			
		||||
	add	 gr9, gr16, gr9
 | 
			
		||||
	P(add)	 gr10, gr16, gr10
 | 
			
		||||
	addi	 gr9, 4, gr9
 | 
			
		||||
	P(subi)	 gr10, 4, gr10
 | 
			
		||||
	setlos	 4, gr11
 | 
			
		||||
	call	 EXT(__frv_fixptrs)
 | 
			
		||||
 | 
			
		||||
					/* fixup the .dtors list */
 | 
			
		||||
	P(sethi) #gprelhi(EXT(__DTOR_LIST__)), gr9
 | 
			
		||||
	sethi	 #gprelhi(EXT(__DTOR_END__)), gr10
 | 
			
		||||
	P(setlo) #gprello(EXT(__DTOR_LIST__)), gr9
 | 
			
		||||
	setlo	 #gprello(EXT(__DTOR_END__)), gr10
 | 
			
		||||
	P(add)	 gr9, gr16, gr9
 | 
			
		||||
	add	 gr10, gr16, gr10
 | 
			
		||||
	P(addi)	 gr9, 4, gr9
 | 
			
		||||
	subi	 gr10, 4, gr10
 | 
			
		||||
	call	 EXT(__frv_fixptrs)
 | 
			
		||||
 | 
			
		||||
					/* fixup the .dtors list */
 | 
			
		||||
	P(sethi) #gprelhi(EXT(__ROFIXUP_LIST__)), gr9
 | 
			
		||||
	sethi	 #gprelhi(EXT(__ROFIXUP_END__)), gr10
 | 
			
		||||
	P(setlo) #gprello(EXT(__ROFIXUP_LIST__)), gr9
 | 
			
		||||
	setlo	 #gprello(EXT(__ROFIXUP_END__)), gr10
 | 
			
		||||
	P(add)	 gr9, gr16, gr9
 | 
			
		||||
	add	 gr10, gr16, gr10
 | 
			
		||||
	call	 EXT(__frv_fix_usrptrs)
 | 
			
		||||
 | 
			
		||||
.Lfixed:
 | 
			
		||||
 | 
			
		||||
/* HSR flags */
 | 
			
		||||
#define HSR_ICE  0x80000000		/* Instruction cache enable */
 | 
			
		||||
#define HSR_DCE  0x40000000		/* Data cache enable */
 | 
			
		||||
#define HSR_CBM  0x08000000		/* Cache copy back mode */
 | 
			
		||||
#define HSR_EIMM 0x04000000		/* Enable Instruction MMU */
 | 
			
		||||
#define HSR_EDMM 0x02000000		/* Enable Data MMU */
 | 
			
		||||
#define HSR_EMEM 0x00800000		/* Enable MMU miss exception mask */
 | 
			
		||||
#define HSR_RME  0x00400000		/* Ram mode enable */
 | 
			
		||||
#define HSR_SA   0x00001000		/* Start address */
 | 
			
		||||
#define HSR_FRN  0x00000800		/* Number of FPRs */
 | 
			
		||||
#define HSR_GRN  0x00000400		/* Number of GPRs */
 | 
			
		||||
#define HSR_FRHE 0x00000200		/* FR Higher Enable */
 | 
			
		||||
#define HSR_FRLE 0x00000100		/* FR Lower Enable */
 | 
			
		||||
#define HSR_GRHE 0x00000080		/* GR Higher Enable */
 | 
			
		||||
#define HSR_GRLE 0x00000040		/* GR Lower Enable */
 | 
			
		||||
 | 
			
		||||
#ifndef HSR_CLEAR
 | 
			
		||||
#define HSR_CLEAR 0
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef HSR_SET
 | 
			
		||||
#ifndef FRV_NO_CACHE
 | 
			
		||||
#define HSR_SET (HSR_ICE|HSR_DCE|HSR_FRHE|HSR_FRLE|HSR_GRHE|HSR_GRLE)
 | 
			
		||||
#else
 | 
			
		||||
#define HSR_SET (HSR_FRHE|HSR_FRLE|HSR_GRHE|HSR_GRLE)
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* PSR flags */
 | 
			
		||||
#define PSR_ICE  0x00010000		/* In circuit emulation mode */
 | 
			
		||||
#define PSR_NEM  0x00004000		/* Non-exception mode */
 | 
			
		||||
#define PSR_CM   0x00002000		/* Conditional mode */
 | 
			
		||||
#define PSR_BE   0x00001000		/* Big endian mode */
 | 
			
		||||
#define PSR_EF   0x00000100		/* Enable floating point */
 | 
			
		||||
#define PSR_EM   0x00000080		/* Enable media instructions */
 | 
			
		||||
#define PSR_S    0x00000004		/* Enable supervisor mode */
 | 
			
		||||
#define PSR_PS   0x00000002		/* Previous supervisor mode */
 | 
			
		||||
#define PSR_ET   0x00000001		/* Enable interrupts */
 | 
			
		||||
 | 
			
		||||
#ifndef PSR_CLEAR
 | 
			
		||||
#if __FRV_FPR__
 | 
			
		||||
#define PSR_CLEAR 0
 | 
			
		||||
#else
 | 
			
		||||
#define PSR_CLEAR (PSR_EF|PSR_EM)
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef PSR_SET
 | 
			
		||||
#if __FRV_FPR__
 | 
			
		||||
#define PSR_SET (PSR_NEM|PSR_CM|PSR_EF|PSR_EM)
 | 
			
		||||
#else
 | 
			
		||||
#define PSR_SET (PSR_NEM|PSR_CM)
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	/* Enable floating point */
 | 
			
		||||
	movsg	  hsr0, gr4
 | 
			
		||||
	P(sethi)  #hi(HSR_SET), gr5
 | 
			
		||||
	setlo	  #lo(HSR_SET), gr5
 | 
			
		||||
	P(sethi)  #hi(~HSR_CLEAR), gr6
 | 
			
		||||
	setlo     #lo(~HSR_CLEAR), gr6
 | 
			
		||||
	or	  gr4, gr5, gr4
 | 
			
		||||
	and	  gr4, gr6, gr4
 | 
			
		||||
	movgs	  gr4, hsr0
 | 
			
		||||
 | 
			
		||||
	movsg	  psr, gr4
 | 
			
		||||
	P(sethi)  #hi(PSR_SET), gr5
 | 
			
		||||
	setlo	  #lo(PSR_SET), gr5
 | 
			
		||||
	P(sethi)  #hi(~PSR_CLEAR), gr6
 | 
			
		||||
	setlo     #lo(~PSR_CLEAR), gr6
 | 
			
		||||
	or	  gr4, gr5, gr4
 | 
			
		||||
	and	  gr4, gr6, gr4
 | 
			
		||||
	movgs	  gr4, psr
 | 
			
		||||
 | 
			
		||||
	/* zero the bss area */
 | 
			
		||||
	P(sethi)  #gprelhi(__bss_start), gr8
 | 
			
		||||
	sethi	  #gprelhi(__end), gr4
 | 
			
		||||
	P(setlo)  #gprello(__bss_start), gr8
 | 
			
		||||
	setlo	  #gprello(__end), gr4
 | 
			
		||||
	P(add)	  gr8, gr16, gr8
 | 
			
		||||
	add	  gr4, gr16, gr4
 | 
			
		||||
	P(setlos) #0, gr9
 | 
			
		||||
	sub	  gr4, gr8, gr10
 | 
			
		||||
	call	  EXT(memset)
 | 
			
		||||
 | 
			
		||||
	P(setlos) #0, gr8		/* zero argc, argv, envp */
 | 
			
		||||
	setlos	  #0, gr9
 | 
			
		||||
	P(setlos) #0, gr10
 | 
			
		||||
 | 
			
		||||
	call	  EXT(main)
 | 
			
		||||
	call	  EXT(exit)
 | 
			
		||||
.Lend:
 | 
			
		||||
	.size	__start,(.Lend-__start)
 | 
			
		||||
 | 
			
		||||
	/* Routine to adjust pointers
 | 
			
		||||
	   gr8  = difference to adjust by
 | 
			
		||||
	   gr9  = starting address
 | 
			
		||||
	   gr10 = ending address + 4
 | 
			
		||||
	   gr11 = amount to add to the pointer each iteration.  */
 | 
			
		||||
	.globl	EXT(__frv_fixptrs)
 | 
			
		||||
	.type	EXT(__frv_fixptrs),@function
 | 
			
		||||
EXT(__frv_fixptrs):
 | 
			
		||||
	P(sub)	gr9, gr11, gr9
 | 
			
		||||
	sub	gr10, gr11, gr10
 | 
			
		||||
.Lloop2:
 | 
			
		||||
	cmp	gr10, gr9, icc0
 | 
			
		||||
	bls	icc0, 0, .Lret2
 | 
			
		||||
 | 
			
		||||
	ldu	@(gr9,gr11), gr5
 | 
			
		||||
	add	gr8, gr5, gr5
 | 
			
		||||
	P(st)	gr5, @(gr9,gr0)
 | 
			
		||||
	bra	.Lloop2
 | 
			
		||||
 | 
			
		||||
.Lret2:	ret
 | 
			
		||||
.Lend2:
 | 
			
		||||
	.size	EXT(__frv_fixptrs),.Lend2-EXT(__frv_fixptrs)
 | 
			
		||||
 | 
			
		||||
	/* Routine to adjust statically initialized pointers
 | 
			
		||||
	   Note since these are pointers to pointers, they
 | 
			
		||||
	   need to be adjusted themsevles.
 | 
			
		||||
 | 
			
		||||
	   gr8  = difference to adjust by
 | 
			
		||||
	   gr9  = starting address
 | 
			
		||||
	   gr10 = ending address + 4
 | 
			
		||||
	   gr11 = amount to add to the pointer each iteration.  */
 | 
			
		||||
	.globl	EXT(__frv_fix_usrptrs)
 | 
			
		||||
	.type	EXT(__frv_fix_usrptrs),@function
 | 
			
		||||
EXT(__frv_fix_usrptrs):
 | 
			
		||||
	P(sub)	gr9, gr11, gr9
 | 
			
		||||
	sub	gr10, gr11, gr10
 | 
			
		||||
.Lloop3:
 | 
			
		||||
	cmp	gr10, gr9, icc0
 | 
			
		||||
	bls	icc0, 0, .Lret3
 | 
			
		||||
 | 
			
		||||
	ldu	@(gr9,gr11), gr5
 | 
			
		||||
	ld	@(gr5, gr8), gr6
 | 
			
		||||
	cmp	gr6, gr0, icc0		/* skip pointers initialized to 0 */
 | 
			
		||||
	beq	icc0, 0, .Lloop3
 | 
			
		||||
 | 
			
		||||
	add	gr8, gr6, gr6
 | 
			
		||||
	P(st)	gr6, @(gr5,gr8)
 | 
			
		||||
	bra	.Lloop3
 | 
			
		||||
 | 
			
		||||
.Lret3:	ret
 | 
			
		||||
.Lend3:
 | 
			
		||||
	.size	EXT(__frv_fix_usrptrs),.Lend2-EXT(__frv_fix_usrptrs)
 | 
			
		||||
							
								
								
									
										30
									
								
								libgloss/frv/fstat.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								libgloss/frv/fstat.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
			
		||||
/* fstat.c -- get status of a file.
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (c) 2002 Red Hat, Inc
 | 
			
		||||
 *
 | 
			
		||||
 * The authors hereby grant permission to use, copy, modify, distribute,
 | 
			
		||||
 * and license this software and its documentation for any purpose, provided
 | 
			
		||||
 * that existing copyright notices are retained in all copies and that this
 | 
			
		||||
 * notice is included verbatim in any distributions. No written agreement,
 | 
			
		||||
 * license, or royalty fee is required for any of the authorized uses.
 | 
			
		||||
 * Modifications to this software may be copyrighted by their authors
 | 
			
		||||
 * and need not follow the licensing terms described here, provided that
 | 
			
		||||
 * the new terms are clearly indicated on the first page of each file where
 | 
			
		||||
 * they apply.
 | 
			
		||||
 */
 | 
			
		||||
#include <sys/stat.h>
 | 
			
		||||
#include "glue.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * fstat -- Since we have no file system, we just return an error.
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
_DEFUN (_fstat, (fd, buf),
 | 
			
		||||
       int fd _AND
 | 
			
		||||
       struct stat *buf)
 | 
			
		||||
{
 | 
			
		||||
  buf->st_mode = S_IFCHR;	/* Always pretend to be a tty */
 | 
			
		||||
  buf->st_blksize = 0;
 | 
			
		||||
 | 
			
		||||
  return (0);
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										25
									
								
								libgloss/frv/getpid.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								libgloss/frv/getpid.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
/* getpid.c -- get the current process id.
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (c) 2002 Red Hat, Inc
 | 
			
		||||
 *
 | 
			
		||||
 * The authors hereby grant permission to use, copy, modify, distribute,
 | 
			
		||||
 * and license this software and its documentation for any purpose, provided
 | 
			
		||||
 * that existing copyright notices are retained in all copies and that this
 | 
			
		||||
 * notice is included verbatim in any distributions. No written agreement,
 | 
			
		||||
 * license, or royalty fee is required for any of the authorized uses.
 | 
			
		||||
 * Modifications to this software may be copyrighted by their authors
 | 
			
		||||
 * and need not follow the licensing terms described here, provided that
 | 
			
		||||
 * the new terms are clearly indicated on the first page of each file where
 | 
			
		||||
 * they apply.
 | 
			
		||||
 */
 | 
			
		||||
#include "glue.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * getpid -- only one process, so just return 1.
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
_DEFUN (_getpid, (),
 | 
			
		||||
        )
 | 
			
		||||
{
 | 
			
		||||
  return __MYPID;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										27
									
								
								libgloss/frv/isatty.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								libgloss/frv/isatty.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,27 @@
 | 
			
		||||
/* isatty.c -- chek the terminal device.
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) 2002 Red Hat, Inc
 | 
			
		||||
 *
 | 
			
		||||
 * The authors hereby grant permission to use, copy, modify, distribute,
 | 
			
		||||
 * and license this software and its documentation for any purpose, provided
 | 
			
		||||
 * that existing copyright notices are retained in all copies and that this
 | 
			
		||||
 * notice is included verbatim in any distributions. No written agreement,
 | 
			
		||||
 * license, or royalty fee is required for any of the authorized uses.
 | 
			
		||||
 * Modifications to this software may be copyrighted by their authors
 | 
			
		||||
 * and need not follow the licensing terms described here, provided that
 | 
			
		||||
 * the new terms are clearly indicated on the first page of each file where
 | 
			
		||||
 * they apply.
 | 
			
		||||
 */
 | 
			
		||||
#include "glue.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * isatty -- returns 1 if connected to a terminal device,
 | 
			
		||||
 *           returns 0 if not. Since we're hooked up to a
 | 
			
		||||
 *           serial port, we'll say yes _AND return a 1.
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
_DEFUN (isatty, (fd),
 | 
			
		||||
       int fd)
 | 
			
		||||
{
 | 
			
		||||
  return (1);
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										30
									
								
								libgloss/frv/kill.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								libgloss/frv/kill.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
			
		||||
/* kill.c -- remove a process.
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (c) 2002 Red Hat, Inc
 | 
			
		||||
 *
 | 
			
		||||
 * The authors hereby grant permission to use, copy, modify, distribute,
 | 
			
		||||
 * and license this software and its documentation for any purpose, provided
 | 
			
		||||
 * that existing copyright notices are retained in all copies and that this
 | 
			
		||||
 * notice is included verbatim in any distributions. No written agreement,
 | 
			
		||||
 * license, or royalty fee is required for any of the authorized uses.
 | 
			
		||||
 * Modifications to this software may be copyrighted by their authors
 | 
			
		||||
 * and need not follow the licensing terms described here, provided that
 | 
			
		||||
 * the new terms are clearly indicated on the first page of each file where
 | 
			
		||||
 * they apply.
 | 
			
		||||
 */
 | 
			
		||||
#include "glue.h"
 | 
			
		||||
 | 
			
		||||
extern void _exit (int) __attribute__((__noreturn__));
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * kill -- go out via exit...
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
_DEFUN (_kill, (pid, sig),
 | 
			
		||||
        int pid _AND 
 | 
			
		||||
        int sig)
 | 
			
		||||
{
 | 
			
		||||
  if(pid == __MYPID)
 | 
			
		||||
    _exit(sig);
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										27
									
								
								libgloss/frv/print.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								libgloss/frv/print.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,27 @@
 | 
			
		||||
/* print.c -- print a string on the output device.
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (c) 2002 Red Hat, Inc
 | 
			
		||||
 *
 | 
			
		||||
 * The authors hereby grant permission to use, copy, modify, distribute,
 | 
			
		||||
 * and license this software and its documentation for any purpose, provided
 | 
			
		||||
 * that existing copyright notices are retained in all copies and that this
 | 
			
		||||
 * notice is included verbatim in any distributions. No written agreement,
 | 
			
		||||
 * license, or royalty fee is required for any of the authorized uses.
 | 
			
		||||
 * Modifications to this software may be copyrighted by their authors
 | 
			
		||||
 * and need not follow the licensing terms described here, provided that
 | 
			
		||||
 * the new terms are clearly indicated on the first page of each file where
 | 
			
		||||
 * they apply.
 | 
			
		||||
 */
 | 
			
		||||
#include "glue.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * print -- do a raw print of a string
 | 
			
		||||
 */ 
 | 
			
		||||
void
 | 
			
		||||
_DEFUN (_print, (ptr),
 | 
			
		||||
char *ptr)
 | 
			
		||||
{
 | 
			
		||||
  while (*ptr) {
 | 
			
		||||
    outbyte (*ptr++);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										41
									
								
								libgloss/frv/putnum.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								libgloss/frv/putnum.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,41 @@
 | 
			
		||||
/* putnum.c -- put a hex number on the output device.
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) 2002 Red Hat, Inc
 | 
			
		||||
 *
 | 
			
		||||
 * The authors hereby grant permission to use, copy, modify, distribute,
 | 
			
		||||
 * and license this software and its documentation for any purpose, provided
 | 
			
		||||
 * that existing copyright notices are retained in all copies and that this
 | 
			
		||||
 * notice is included verbatim in any distributions. No written agreement,
 | 
			
		||||
 * license, or royalty fee is required for any of the authorized uses.
 | 
			
		||||
 * Modifications to this software may be copyrighted by their authors
 | 
			
		||||
 * and need not follow the licensing terms described here, provided that
 | 
			
		||||
 * the new terms are clearly indicated on the first page of each file where
 | 
			
		||||
 * they apply.
 | 
			
		||||
 */
 | 
			
		||||
#include "glue.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * putnum -- print a 32 bit number in hex
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
_DEFUN (_putnum, (num),
 | 
			
		||||
	unsigned int num)
 | 
			
		||||
{
 | 
			
		||||
  char  buf[9];
 | 
			
		||||
  int   cnt;
 | 
			
		||||
  char  *ptr;
 | 
			
		||||
  int   digit;
 | 
			
		||||
  
 | 
			
		||||
  ptr = buf;
 | 
			
		||||
  for (cnt = 7 ; cnt >= 0 ; cnt--) {
 | 
			
		||||
    digit = (num >> (cnt * 4)) & 0xf;
 | 
			
		||||
    
 | 
			
		||||
    if (digit <= 9)
 | 
			
		||||
      *ptr++ = (char) ('0' + digit);
 | 
			
		||||
    else
 | 
			
		||||
      *ptr++ = (char) ('a' - 10 + digit);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  *ptr = (char) 0;
 | 
			
		||||
  print (buf);
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										54
									
								
								libgloss/frv/sbrk.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								libgloss/frv/sbrk.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,54 @@
 | 
			
		||||
/* sbrk.c -- allocate memory dynamically.
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) 2002 Red Hat, Inc
 | 
			
		||||
 *
 | 
			
		||||
 * The authors hereby grant permission to use, copy, modify, distribute,
 | 
			
		||||
 * and license this software and its documentation for any purpose, provided
 | 
			
		||||
 * that existing copyright notices are retained in all copies and that this
 | 
			
		||||
 * notice is included verbatim in any distributions. No written agreement,
 | 
			
		||||
 * license, or royalty fee is required for any of the authorized uses.
 | 
			
		||||
 * Modifications to this software may be copyrighted by their authors
 | 
			
		||||
 * and need not follow the licensing terms described here, provided that
 | 
			
		||||
 * the new terms are clearly indicated on the first page of each file where
 | 
			
		||||
 * they apply.
 | 
			
		||||
 */
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include "glue.h"
 | 
			
		||||
 | 
			
		||||
/* just in case, most boards have at least some memory */
 | 
			
		||||
#ifndef RAMSIZE
 | 
			
		||||
#  define RAMSIZE             (caddr_t)0x100000
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
char *__heap_ptr = (char *)&_end;
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * sbrk -- changes heap size size. Get nbytes more
 | 
			
		||||
 *         RAM. We just increment a pointer in what's
 | 
			
		||||
 *         left of memory on the board.
 | 
			
		||||
 */
 | 
			
		||||
char *
 | 
			
		||||
_sbrk (nbytes)
 | 
			
		||||
     int nbytes;
 | 
			
		||||
{
 | 
			
		||||
  char *base;
 | 
			
		||||
  char *sp;
 | 
			
		||||
 | 
			
		||||
  base = __heap_ptr;
 | 
			
		||||
  __heap_ptr += nbytes;
 | 
			
		||||
 | 
			
		||||
  return base;
 | 
			
		||||
/* FIXME: We really want to make sure we don't run out of RAM, but this
 | 
			
		||||
 *       isn't very portable.
 | 
			
		||||
 */
 | 
			
		||||
#if 0
 | 
			
		||||
  if ((RAMSIZE - heap_ptr - nbytes) >= 0) {
 | 
			
		||||
    base = heap_ptr;
 | 
			
		||||
    heap_ptr += nbytes;
 | 
			
		||||
    return (base);
 | 
			
		||||
  } else {
 | 
			
		||||
    errno = ENOMEM;
 | 
			
		||||
    return ((char *)-1);
 | 
			
		||||
  }
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										40
									
								
								libgloss/frv/sim-close.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								libgloss/frv/sim-close.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,40 @@
 | 
			
		||||
/*
 | 
			
		||||
 * sim-close.S -- close interface for frv simulator
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) 2002 Red Hat, Inc
 | 
			
		||||
 *
 | 
			
		||||
 * The authors hereby grant permission to use, copy, modify, distribute,
 | 
			
		||||
 * and license this software and its documentation for any purpose, provided
 | 
			
		||||
 * that existing copyright notices are retained in all copies and that this
 | 
			
		||||
 * notice is included verbatim in any distributions. No written agreement,
 | 
			
		||||
 * license, or royalty fee is required for any of the authorized uses.
 | 
			
		||||
 * Modifications to this software may be copyrighted by their authors
 | 
			
		||||
 * and need not follow the licensing terms described here, provided that
 | 
			
		||||
 * the new terms are clearly indicated on the first page of each file where
 | 
			
		||||
 * they apply.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <frv-asm.h>
 | 
			
		||||
 | 
			
		||||
#include "syscall.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Input:
 | 
			
		||||
 * gr8	  -- File descriptor to close.
 | 
			
		||||
 *
 | 
			
		||||
 * Output:
 | 
			
		||||
 * gr8	  -- 0 or -1.
 | 
			
		||||
 * errno  -- Set if an error
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
	.globl	EXT(_close)
 | 
			
		||||
	.type	EXT(_close),@function
 | 
			
		||||
	.weak	EXT(close)
 | 
			
		||||
	.text
 | 
			
		||||
EXT(_close):
 | 
			
		||||
EXT(close):
 | 
			
		||||
	setlos	#SYS_close,gr7
 | 
			
		||||
	tira	gr0,#0
 | 
			
		||||
	ret
 | 
			
		||||
.Lend:
 | 
			
		||||
	.size	EXT(_close),.Lend-EXT(_close)
 | 
			
		||||
							
								
								
									
										36
									
								
								libgloss/frv/sim-exit.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								libgloss/frv/sim-exit.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,36 @@
 | 
			
		||||
/*
 | 
			
		||||
 * sim-exit.S -- _exit interface for frv simulator
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) 2002 Red Hat, Inc
 | 
			
		||||
 *
 | 
			
		||||
 * The authors hereby grant permission to use, copy, modify, distribute,
 | 
			
		||||
 * and license this software and its documentation for any purpose, provided
 | 
			
		||||
 * that existing copyright notices are retained in all copies and that this
 | 
			
		||||
 * notice is included verbatim in any distributions. No written agreement,
 | 
			
		||||
 * license, or royalty fee is required for any of the authorized uses.
 | 
			
		||||
 * Modifications to this software may be copyrighted by their authors
 | 
			
		||||
 * and need not follow the licensing terms described here, provided that
 | 
			
		||||
 * the new terms are clearly indicated on the first page of each file where
 | 
			
		||||
 * they apply.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <frv-asm.h>
 | 
			
		||||
 | 
			
		||||
#include "syscall.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Input:
 | 
			
		||||
 * gr8	-- exit value
 | 
			
		||||
 *
 | 
			
		||||
 * Output:
 | 
			
		||||
 * none
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
	.globl	EXT(_exit)
 | 
			
		||||
	.type	EXT(_exit),@function
 | 
			
		||||
	.text
 | 
			
		||||
EXT(_exit):
 | 
			
		||||
	setlos	#SYS_exit,gr7
 | 
			
		||||
	tira	gr0,#0
 | 
			
		||||
.Lend:
 | 
			
		||||
	.size	EXT(_exit),.Lend-EXT(_exit)
 | 
			
		||||
							
								
								
									
										26
									
								
								libgloss/frv/sim-inbyte.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								libgloss/frv/sim-inbyte.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,26 @@
 | 
			
		||||
/*
 | 
			
		||||
 * sim-inbyte.c -- read a character from standard input.
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (c) 2002 Red Hat, Inc
 | 
			
		||||
 *
 | 
			
		||||
 * The authors hereby grant permission to use, copy, modify, distribute,
 | 
			
		||||
 * and license this software and its documentation for any purpose, provided
 | 
			
		||||
 * that existing copyright notices are retained in all copies and that this
 | 
			
		||||
 * notice is included verbatim in any distributions. No written agreement,
 | 
			
		||||
 * license, or royalty fee is required for any of the authorized uses.
 | 
			
		||||
 * Modifications to this software may be copyrighted by their authors
 | 
			
		||||
 * and need not follow the licensing terms described here, provided that
 | 
			
		||||
 * the new terms are clearly indicated on the first page of each file where
 | 
			
		||||
 * they apply.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
inbyte ()
 | 
			
		||||
{
 | 
			
		||||
  char c;
 | 
			
		||||
 | 
			
		||||
  if (read (0, &c, 1) <= 0)
 | 
			
		||||
    return -1;
 | 
			
		||||
 | 
			
		||||
  return c;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										42
									
								
								libgloss/frv/sim-lseek.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								libgloss/frv/sim-lseek.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,42 @@
 | 
			
		||||
/*
 | 
			
		||||
 * sim-lseek.S -- write interface for frv simulator
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) 2002 Red Hat, Inc
 | 
			
		||||
 *
 | 
			
		||||
 * The authors hereby grant permission to use, copy, modify, distribute,
 | 
			
		||||
 * and license this software and its documentation for any purpose, provided
 | 
			
		||||
 * that existing copyright notices are retained in all copies and that this
 | 
			
		||||
 * notice is included verbatim in any distributions. No written agreement,
 | 
			
		||||
 * license, or royalty fee is required for any of the authorized uses.
 | 
			
		||||
 * Modifications to this software may be copyrighted by their authors
 | 
			
		||||
 * and need not follow the licensing terms described here, provided that
 | 
			
		||||
 * the new terms are clearly indicated on the first page of each file where
 | 
			
		||||
 * they apply.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <frv-asm.h>
 | 
			
		||||
 | 
			
		||||
#include "syscall.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Input:
 | 
			
		||||
 * gr8	  -- File descriptor
 | 
			
		||||
 * gr9	  -- Offset
 | 
			
		||||
 * gr10   -- Base from which offset should be taken
 | 
			
		||||
 *
 | 
			
		||||
 * Output:
 | 
			
		||||
 * gr8	  -- Zero on success, -1 on failure.
 | 
			
		||||
 * errno  -- Set if an error
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
	.globl	EXT(_lseek)
 | 
			
		||||
	.type	EXT(_lseek),@function
 | 
			
		||||
	.weak	EXT(lseek)
 | 
			
		||||
	.text
 | 
			
		||||
EXT(_lseek):
 | 
			
		||||
EXT(lseek):
 | 
			
		||||
	setlos	#SYS_lseek,gr7
 | 
			
		||||
	tira	gr0,#0
 | 
			
		||||
	ret
 | 
			
		||||
.Lend:
 | 
			
		||||
	.size	EXT(_lseek),.Lend-EXT(_lseek)
 | 
			
		||||
							
								
								
									
										42
									
								
								libgloss/frv/sim-open.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								libgloss/frv/sim-open.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,42 @@
 | 
			
		||||
/*
 | 
			
		||||
 * sim-open.S -- open interface for frv simulator
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) 2002 Red Hat, Inc
 | 
			
		||||
 *
 | 
			
		||||
 * The authors hereby grant permission to use, copy, modify, distribute,
 | 
			
		||||
 * and license this software and its documentation for any purpose, provided
 | 
			
		||||
 * that existing copyright notices are retained in all copies and that this
 | 
			
		||||
 * notice is included verbatim in any distributions. No written agreement,
 | 
			
		||||
 * license, or royalty fee is required for any of the authorized uses.
 | 
			
		||||
 * Modifications to this software may be copyrighted by their authors
 | 
			
		||||
 * and need not follow the licensing terms described here, provided that
 | 
			
		||||
 * the new terms are clearly indicated on the first page of each file where
 | 
			
		||||
 * they apply.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <frv-asm.h>
 | 
			
		||||
 | 
			
		||||
#include "syscall.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Input:
 | 
			
		||||
 * gr8	  -- File name to open.
 | 
			
		||||
 * gr9	  -- open mode.
 | 
			
		||||
 * gr10	  -- optionally, the permission bits to set the file to.
 | 
			
		||||
 *
 | 
			
		||||
 * Output:
 | 
			
		||||
 * gr8	  -- file descriptor or -1.
 | 
			
		||||
 * errno  -- Set if an error
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
	.globl	EXT(_open)
 | 
			
		||||
	.type	EXT(_open),@function
 | 
			
		||||
	.weak	EXT(open)
 | 
			
		||||
	.text
 | 
			
		||||
EXT(_open):
 | 
			
		||||
EXT(open):
 | 
			
		||||
	setlos	#SYS_open,gr7
 | 
			
		||||
	tira	gr0,#0
 | 
			
		||||
	ret
 | 
			
		||||
.Lend:
 | 
			
		||||
	.size	EXT(_open),.Lend-EXT(_open)
 | 
			
		||||
							
								
								
									
										42
									
								
								libgloss/frv/sim-read.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								libgloss/frv/sim-read.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,42 @@
 | 
			
		||||
/*
 | 
			
		||||
 * sim-read.S -- read interface for frv simulator
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) 2002 Red Hat, Inc
 | 
			
		||||
 *
 | 
			
		||||
 * The authors hereby grant permission to use, copy, modify, distribute,
 | 
			
		||||
 * and license this software and its documentation for any purpose, provided
 | 
			
		||||
 * that existing copyright notices are retained in all copies and that this
 | 
			
		||||
 * notice is included verbatim in any distributions. No written agreement,
 | 
			
		||||
 * license, or royalty fee is required for any of the authorized uses.
 | 
			
		||||
 * Modifications to this software may be copyrighted by their authors
 | 
			
		||||
 * and need not follow the licensing terms described here, provided that
 | 
			
		||||
 * the new terms are clearly indicated on the first page of each file where
 | 
			
		||||
 * they apply.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <frv-asm.h>
 | 
			
		||||
 | 
			
		||||
#include "syscall.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Input:
 | 
			
		||||
 * gr8	  -- File descriptor.
 | 
			
		||||
 * gr9	  -- Buffer to be read into.
 | 
			
		||||
 * gr10	  -- Length of the buffer.
 | 
			
		||||
 *
 | 
			
		||||
 * Output:
 | 
			
		||||
 * gr8	  -- Length read or -1.
 | 
			
		||||
 * errno  -- Set if an error
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
	.globl	EXT(_read)
 | 
			
		||||
	.type	EXT(_read),@function
 | 
			
		||||
	.weak	EXT(read)
 | 
			
		||||
	.text
 | 
			
		||||
EXT(_read):
 | 
			
		||||
EXT(read):
 | 
			
		||||
	setlos	#SYS_read,gr7
 | 
			
		||||
	tira	gr0,#0
 | 
			
		||||
	ret
 | 
			
		||||
.Lend:
 | 
			
		||||
	.size	EXT(_read),.Lend-EXT(_read)
 | 
			
		||||
							
								
								
									
										78
									
								
								libgloss/frv/sim-time.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										78
									
								
								libgloss/frv/sim-time.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,78 @@
 | 
			
		||||
/* sim-time.c -- stubs so clock can be linked in.
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (c) 2002 Red Hat, Inc
 | 
			
		||||
 *
 | 
			
		||||
 * The authors hereby grant permission to use, copy, modify, distribute,
 | 
			
		||||
 * and license this software and its documentation for any purpose, provided
 | 
			
		||||
 * that existing copyright notices are retained in all copies and that this
 | 
			
		||||
 * notice is included verbatim in any distributions. No written agreement,
 | 
			
		||||
 * license, or royalty fee is required for any of the authorized uses.
 | 
			
		||||
 * Modifications to this software may be copyrighted by their authors
 | 
			
		||||
 * and need not follow the licensing terms described here, provided that
 | 
			
		||||
 * the new terms are clearly indicated on the first page of each file where
 | 
			
		||||
 * they apply.
 | 
			
		||||
 */
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include <sys/time.h>
 | 
			
		||||
#include <sys/times.h>
 | 
			
		||||
#include "glue.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * time -- simulator interface to return current time in seconds.
 | 
			
		||||
 */
 | 
			
		||||
__asm__ ("\
 | 
			
		||||
	.text\n\
 | 
			
		||||
	.globl	_sim_time\n\
 | 
			
		||||
	.type	_sim_time,@function\n\
 | 
			
		||||
_sim_time:\n\
 | 
			
		||||
	setlos	#18, gr7\n\
 | 
			
		||||
	tira	gr0, #0\n\
 | 
			
		||||
	ret\n\
 | 
			
		||||
.Lsim:\n\
 | 
			
		||||
	.size	_sim_time,.Lsim-_sim_time");
 | 
			
		||||
 | 
			
		||||
extern time_t _sim_time (void) __asm__("_sim_time");
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * time -- return current time in seconds.
 | 
			
		||||
 */
 | 
			
		||||
time_t
 | 
			
		||||
_DEFUN (time, time (t),
 | 
			
		||||
	time_t *t)
 | 
			
		||||
{
 | 
			
		||||
  time_t ret = _sim_time ();
 | 
			
		||||
 | 
			
		||||
  if (t)
 | 
			
		||||
    *t = ret;
 | 
			
		||||
 | 
			
		||||
  return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * _times -- no clock, so return an error.
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
_DEFUN (_times, _times (buf),
 | 
			
		||||
	struct tms *buf)
 | 
			
		||||
{
 | 
			
		||||
  errno = EINVAL;
 | 
			
		||||
  return (-1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * _gettimeofday -- implement in terms of time, which means we can't return the
 | 
			
		||||
 * microseconds.
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
_DEFUN (_gettimeofday, _gettimeofday (tv, tz),
 | 
			
		||||
	struct timeval *tv _AND
 | 
			
		||||
	struct timezone *tz)
 | 
			
		||||
{
 | 
			
		||||
  if (tz)
 | 
			
		||||
    tz->tz_minuteswest = tz->tz_dsttime = 0;
 | 
			
		||||
 | 
			
		||||
  tv->tv_usec = 0;
 | 
			
		||||
  tv->tv_sec = _sim_time ();
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										40
									
								
								libgloss/frv/sim-unlink.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								libgloss/frv/sim-unlink.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,40 @@
 | 
			
		||||
/*
 | 
			
		||||
 * sim-unlink.S -- write interface for frv simulator
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) 2002 Red Hat, Inc
 | 
			
		||||
 *
 | 
			
		||||
 * The authors hereby grant permission to use, copy, modify, distribute,
 | 
			
		||||
 * and license this software and its documentation for any purpose, provided
 | 
			
		||||
 * that existing copyright notices are retained in all copies and that this
 | 
			
		||||
 * notice is included verbatim in any distributions. No written agreement,
 | 
			
		||||
 * license, or royalty fee is required for any of the authorized uses.
 | 
			
		||||
 * Modifications to this software may be copyrighted by their authors
 | 
			
		||||
 * and need not follow the licensing terms described here, provided that
 | 
			
		||||
 * the new terms are clearly indicated on the first page of each file where
 | 
			
		||||
 * they apply.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <frv-asm.h>
 | 
			
		||||
 | 
			
		||||
#include "syscall.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Input:
 | 
			
		||||
 * gr8	  -- Filename
 | 
			
		||||
 *
 | 
			
		||||
 * Output:
 | 
			
		||||
 * gr8	  -- Zero on success, -1 on failure.
 | 
			
		||||
 * errno  -- Set if an error
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
	.globl	EXT(_unlink)
 | 
			
		||||
	.type	EXT(_unlink),@function
 | 
			
		||||
	.weak	EXT(unlink)
 | 
			
		||||
	.text
 | 
			
		||||
EXT(_unlink):
 | 
			
		||||
EXT(unlink):
 | 
			
		||||
	setlos	#SYS_unlink,gr7
 | 
			
		||||
	tira	gr0,#0
 | 
			
		||||
	ret
 | 
			
		||||
.Lend:
 | 
			
		||||
	.size	EXT(_unlink),.Lend-EXT(_unlink)
 | 
			
		||||
							
								
								
									
										42
									
								
								libgloss/frv/sim-write.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								libgloss/frv/sim-write.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,42 @@
 | 
			
		||||
/*
 | 
			
		||||
 * sim-write.S -- write interface for frv simulator
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) 2002 Red Hat, Inc
 | 
			
		||||
 *
 | 
			
		||||
 * The authors hereby grant permission to use, copy, modify, distribute,
 | 
			
		||||
 * and license this software and its documentation for any purpose, provided
 | 
			
		||||
 * that existing copyright notices are retained in all copies and that this
 | 
			
		||||
 * notice is included verbatim in any distributions. No written agreement,
 | 
			
		||||
 * license, or royalty fee is required for any of the authorized uses.
 | 
			
		||||
 * Modifications to this software may be copyrighted by their authors
 | 
			
		||||
 * and need not follow the licensing terms described here, provided that
 | 
			
		||||
 * the new terms are clearly indicated on the first page of each file where
 | 
			
		||||
 * they apply.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <frv-asm.h>
 | 
			
		||||
 | 
			
		||||
#include "syscall.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Input:
 | 
			
		||||
 * gr8	  -- File descriptor.
 | 
			
		||||
 * gr9	  -- String to be printed.
 | 
			
		||||
 * gr10	  -- Length of the string.
 | 
			
		||||
 *
 | 
			
		||||
 * Output:
 | 
			
		||||
 * gr8	  -- Length written or -1.
 | 
			
		||||
 * errno  -- Set if an error
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
	.globl	EXT(_write)
 | 
			
		||||
	.type	EXT(_write),@function
 | 
			
		||||
	.weak	EXT(write)
 | 
			
		||||
	.text
 | 
			
		||||
EXT(_write):
 | 
			
		||||
EXT(write):
 | 
			
		||||
	setlos	#SYS_write,gr7
 | 
			
		||||
	tira	gr0,#0
 | 
			
		||||
	ret
 | 
			
		||||
.Lend:
 | 
			
		||||
	.size	EXT(_write),.Lend-EXT(_write)
 | 
			
		||||
							
								
								
									
										30
									
								
								libgloss/frv/stat.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								libgloss/frv/stat.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
			
		||||
/* stat.c -- Get the status of a file.
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (c) 2002 Red Hat, Inc
 | 
			
		||||
 *
 | 
			
		||||
 * The authors hereby grant permission to use, copy, modify, distribute,
 | 
			
		||||
 * and license this software and its documentation for any purpose, provided
 | 
			
		||||
 * that existing copyright notices are retained in all copies and that this
 | 
			
		||||
 * notice is included verbatim in any distributions. No written agreement,
 | 
			
		||||
 * license, or royalty fee is required for any of the authorized uses.
 | 
			
		||||
 * Modifications to this software may be copyrighted by their authors
 | 
			
		||||
 * and need not follow the licensing terms described here, provided that
 | 
			
		||||
 * the new terms are clearly indicated on the first page of each file where
 | 
			
		||||
 * they apply.
 | 
			
		||||
 */
 | 
			
		||||
#include <sys/stat.h>
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include "glue.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * stat -- Since we have no file system, we just return an error.
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
_DEFUN (_stat, (path, buf),
 | 
			
		||||
       const char *path _AND
 | 
			
		||||
       struct stat *buf)
 | 
			
		||||
{
 | 
			
		||||
  errno = EIO;
 | 
			
		||||
  return (-1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user