20000317 sourceware import
This commit is contained in:
128
libgloss/d30v/Makefile.in
Normal file
128
libgloss/d30v/Makefile.in
Normal file
@ -0,0 +1,128 @@
|
||||
# Copyright (c) 1997 Cygnus Support
|
||||
#
|
||||
# The authors hereby grant permission to use, copy, modify, distribute,
|
||||
# and license this software and its documentation for any purpose, provided
|
||||
# that existing copyright notices are retained in all copies and that this
|
||||
# notice is included verbatim in any distributions. No written agreement,
|
||||
# license, or royalty fee is required for any of the authorized uses.
|
||||
# Modifications to this software may be copyrighted by their authors
|
||||
# and need not follow the licensing terms described here, provided that
|
||||
# the new terms are clearly indicated on the first page of each file where
|
||||
# they apply.
|
||||
#
|
||||
|
||||
#
|
||||
# This currently works with the D30V simulator.
|
||||
#
|
||||
|
||||
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@
|
||||
|
||||
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 = isatty.o print.o putnum.o sbrk.o
|
||||
CFLAGS = -g
|
||||
SCRIPTS = ${SIM_SCRIPTS}
|
||||
|
||||
# Here is all of the simulator stuff
|
||||
SIM_SCRIPTS =
|
||||
SIM_LDFLAGS =
|
||||
SIM_BSP = libsim.a
|
||||
SIM_CRT0 = crt0.o
|
||||
SIM_OBJS = syscalls.o outbyte.o inbyte.o
|
||||
SIM_TEST =
|
||||
SIM_INSTALL = install-sim
|
||||
|
||||
# Host specific makefile fragment comes in here.
|
||||
@host_makefile_frag@
|
||||
|
||||
#
|
||||
# build a test program for each target board. Just trying to get
|
||||
# it to link is a good test, so we ignore all the errors for now.
|
||||
#
|
||||
all: ${SIM_CRT0} ${SIM_BSP}
|
||||
|
||||
#
|
||||
# here's where we build the board support packages for each target
|
||||
#
|
||||
|
||||
${SIM_BSP}: ${OBJS} ${SIM_OBJS}
|
||||
${AR} ${ARFLAGS} $@ ${SIM_OBJS} ${OBJS}
|
||||
${RANLIB} $@
|
||||
|
||||
#
|
||||
# here's where we build the test programs for each target
|
||||
#
|
||||
.PHONY: test
|
||||
test: ${SIM_TEST}
|
||||
|
||||
crt0.o: crt0.S
|
||||
syscalls.o: syscalls.c $(srcdir)/../syscall.h
|
||||
outbyte.o: outbyte.c
|
||||
inbyte.o: inbyte.c
|
||||
|
||||
isatty.o: $(srcdir)/../isatty.c
|
||||
print.o: $(srcdir)/../print.c
|
||||
putnum.o: $(srcdir)/../putnum.c
|
||||
sbrk.o: $(srcdir)/../sbrk.c
|
||||
|
||||
clean mostlyclean:
|
||||
rm -f a.out core *.[oais] *-test *.srec *.dis *.x syscall.h
|
||||
|
||||
distclean maintainer-clean realclean: clean
|
||||
rm -f Makefile config.status *~
|
||||
|
||||
.PHONY: install info install-info clean-info
|
||||
install: ${SIM_INSTALL}
|
||||
|
||||
install-sim:
|
||||
set -e; for x in ${SIM_CRT0} ${SIM_BSP} ${SIM_SCRIPTS}; do ${INSTALL_DATA} $$x ${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
|
1191
libgloss/d30v/configure
vendored
Executable file
1191
libgloss/d30v/configure
vendored
Executable file
File diff suppressed because it is too large
Load Diff
90
libgloss/d30v/configure.in
Normal file
90
libgloss/d30v/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}
|
||||
)
|
56
libgloss/d30v/crt0.S
Normal file
56
libgloss/d30v/crt0.S
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* crt0.S -- startup file for D30V systems.
|
||||
*
|
||||
* Copyright (c) 1997 Cygnus Support
|
||||
*
|
||||
* The authors hereby grant permission to use, copy, modify, distribute,
|
||||
* and license this software and its documentation for any purpose, provided
|
||||
* that existing copyright notices are retained in all copies and that this
|
||||
* notice is included verbatim in any distributions. No written agreement,
|
||||
* license, or royalty fee is required for any of the authorized uses.
|
||||
* Modifications to this software may be copyrighted by their authors
|
||||
* and need not follow the licensing terms described here, provided that
|
||||
* the new terms are clearly indicated on the first page of each file where
|
||||
* they apply.
|
||||
*/
|
||||
|
||||
.file "crt0.S"
|
||||
.text
|
||||
.globl _start
|
||||
.extern main
|
||||
.extern exit
|
||||
.extern __stack
|
||||
.extern __sbss_start
|
||||
.extern __sbss_end
|
||||
.extern __ebss_start
|
||||
.extern __ebss_end
|
||||
.extern __bss_start
|
||||
.extern __bss_end
|
||||
.extern memset
|
||||
.type _start,@function
|
||||
|
||||
_start: or.l sp,r0,__stack
|
||||
|
||||
/* Zero the .sbss area */
|
||||
or.l r2,r0,__sbss_start
|
||||
or.l r4,r0,__sbss_end
|
||||
sub r4,r4,r2 || or.s r3,r0,0
|
||||
bsrtnz.l r4,(memset)
|
||||
|
||||
/* Zero the .ebss area */
|
||||
or.l r2,r0,__ebss_start
|
||||
or.l r4,r0,__ebss_end
|
||||
sub r4,r4,r2 || or.s r3,r0,0
|
||||
bsrtnz.l r4,(memset)
|
||||
|
||||
/* Zero the .bss area */
|
||||
or.l r2,r0,__bss_start
|
||||
or.l r4,r0,__bss_end
|
||||
sub r4,r4,r2 || or.s r3,r0,0
|
||||
bsrtnz.l r4,(memset)
|
||||
|
||||
or.s r2,r0,0 || or.s r3,r0,0
|
||||
or r4,r0,0 || nop
|
||||
jsr.l (main)
|
||||
jsr.l (exit)
|
||||
.size _start,.-_start
|
24
libgloss/d30v/inbyte.c
Normal file
24
libgloss/d30v/inbyte.c
Normal file
@ -0,0 +1,24 @@
|
||||
/* inbyte -- read a single byte.
|
||||
*
|
||||
* Copyright (c) 1997 Cygnus Support
|
||||
*
|
||||
* The authors hereby grant permission to use, copy, modify, distribute,
|
||||
* and license this software and its documentation for any purpose, provided
|
||||
* that existing copyright notices are retained in all copies and that this
|
||||
* notice is included verbatim in any distributions. No written agreement,
|
||||
* license, or royalty fee is required for any of the authorized uses.
|
||||
* Modifications to this software may be copyrighted by their authors
|
||||
* and need not follow the licensing terms described here, provided that
|
||||
* the new terms are clearly indicated on the first page of each file where
|
||||
* they apply.
|
||||
*/
|
||||
|
||||
int
|
||||
inbyte (void)
|
||||
{
|
||||
char ch;
|
||||
if (read (0, &ch, 1) == 1)
|
||||
return ch;
|
||||
|
||||
return -1;
|
||||
}
|
21
libgloss/d30v/outbyte.c
Normal file
21
libgloss/d30v/outbyte.c
Normal file
@ -0,0 +1,21 @@
|
||||
/* outbyte -- write a single byte.
|
||||
*
|
||||
* Copyright (c) 1997 Cygnus Support
|
||||
*
|
||||
* The authors hereby grant permission to use, copy, modify, distribute,
|
||||
* and license this software and its documentation for any purpose, provided
|
||||
* that existing copyright notices are retained in all copies and that this
|
||||
* notice is included verbatim in any distributions. No written agreement,
|
||||
* license, or royalty fee is required for any of the authorized uses.
|
||||
* Modifications to this software may be copyrighted by their authors
|
||||
* and need not follow the licensing terms described here, provided that
|
||||
* the new terms are clearly indicated on the first page of each file where
|
||||
* they apply.
|
||||
*/
|
||||
|
||||
void
|
||||
outbyte (int byte)
|
||||
{
|
||||
char ch = byte;
|
||||
write (1, &ch, 1);
|
||||
}
|
146
libgloss/d30v/syscalls.c
Normal file
146
libgloss/d30v/syscalls.c
Normal file
@ -0,0 +1,146 @@
|
||||
/*
|
||||
* syscalls.c -- provide system call support via trap 31
|
||||
*
|
||||
* Copyright (c) 1997 Cygnus Support
|
||||
*
|
||||
* The authors hereby grant permission to use, copy, modify, distribute,
|
||||
* and license this software and its documentation for any purpose, provided
|
||||
* that existing copyright notices are retained in all copies and that this
|
||||
* notice is included verbatim in any distributions. No written agreement,
|
||||
* license, or royalty fee is required for any of the authorized uses.
|
||||
* Modifications to this software may be copyrighted by their authors
|
||||
* and need not follow the licensing terms described here, provided that
|
||||
* the new terms are clearly indicated on the first page of each file where
|
||||
* they apply.
|
||||
*
|
||||
* Read bytes, using simulator trap 31.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "syscall.h"
|
||||
|
||||
extern int *__errno(), errno;
|
||||
|
||||
__asm__ (
|
||||
" .globl __syscall
|
||||
.type __syscall,@function
|
||||
__syscall:
|
||||
trap 31 || nop
|
||||
cmpge f0,r2,0 -> jmp/tx link
|
||||
bra __set_errno
|
||||
.size __syscall,.-__syscall
|
||||
");
|
||||
|
||||
int
|
||||
__set_errno (int new_errno)
|
||||
{
|
||||
errno = new_errno;
|
||||
*(__errno)() = errno;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void
|
||||
_exit (int status)
|
||||
{
|
||||
__syscall (status, 0, 0, 0, SYS_exit);
|
||||
}
|
||||
|
||||
int
|
||||
open (const char *filename, int flags, int mode)
|
||||
{
|
||||
return __syscall (filename, flags, mode, 0, SYS_open);
|
||||
}
|
||||
|
||||
int
|
||||
close (int filedes)
|
||||
{
|
||||
return __syscall (filedes, 0, 0, 0, SYS_close);
|
||||
}
|
||||
|
||||
int
|
||||
read (int filedes, void *buffer, size_t length)
|
||||
{
|
||||
return __syscall (filedes, buffer, length, 0, SYS_read);
|
||||
}
|
||||
|
||||
int
|
||||
write (int filedes, void *buffer, size_t length)
|
||||
{
|
||||
return __syscall (filedes, buffer, length, 0, SYS_write);
|
||||
}
|
||||
|
||||
long
|
||||
lseek (int filedes, long offset, int whence)
|
||||
{
|
||||
return __syscall (filedes, offset, whence, 0, SYS_lseek);
|
||||
}
|
||||
|
||||
int
|
||||
unlink (const char *filename)
|
||||
{
|
||||
return __syscall (filename, 0, 0, 0, SYS_unlink);
|
||||
}
|
||||
|
||||
int
|
||||
getpid (void)
|
||||
{
|
||||
return __syscall (0, 0, 0, 0, SYS_getpid);
|
||||
}
|
||||
|
||||
int
|
||||
kill (int signal, int pid)
|
||||
{
|
||||
return __syscall (signal, pid, 0, 0, SYS_kill);
|
||||
}
|
||||
|
||||
int
|
||||
fstat (int filedes, void *info)
|
||||
{
|
||||
return __syscall (filedes, info, 0, 0, SYS_fstat);
|
||||
}
|
||||
|
||||
int
|
||||
__argvlen (void)
|
||||
{
|
||||
return __syscall (0, 0, 0, 0, SYS_argvlen);
|
||||
}
|
||||
|
||||
int
|
||||
__argv (void)
|
||||
{
|
||||
return __syscall (0, 0, 0, 0, SYS_argv);
|
||||
}
|
||||
|
||||
int
|
||||
chdir (char *dir)
|
||||
{
|
||||
return __syscall (dir, 0, 0, 0, SYS_chdir);
|
||||
}
|
||||
|
||||
int
|
||||
stat (const char *filename, void *info)
|
||||
{
|
||||
return __syscall (filename, info, 0, 0, SYS_stat);
|
||||
}
|
||||
|
||||
int
|
||||
chmod (const char *filename, int mode)
|
||||
{
|
||||
return __syscall (filename, mode, 0, 0, SYS_chmod);
|
||||
}
|
||||
|
||||
int
|
||||
utime (const char *filename, void *packet)
|
||||
{
|
||||
return __syscall (filename, packet, 0, 0, SYS_utime);
|
||||
}
|
||||
|
||||
time_t
|
||||
time (time_t *time_ptr)
|
||||
{
|
||||
time_t result;
|
||||
result = (time_t) __syscall (time_ptr, 0, 0, 0, SYS_time);
|
||||
if (time_ptr != NULL)
|
||||
*time_ptr = result;
|
||||
return result;
|
||||
}
|
Reference in New Issue
Block a user