20000317 sourceware import

This commit is contained in:
Ranjith Kumaran
2000-03-17 22:48:54 +00:00
parent fae4c299f1
commit 03261851a1
420 changed files with 66815 additions and 0 deletions

142
libgloss/i960/Makefile.in Normal file
View File

@ -0,0 +1,142 @@
#
#
VPATH = @srcdir@ @srcdir@/..
srcdir = @srcdir@
objdir = .
srcroot = $(srcdir)/../..
objroot = $(objdir)/../..
prefix = @prefix@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
target_alias = @target_alias@
bindir = @bindir@
libdir = @libdir@
tooldir = $(exec_prefix)/$(target_alias)
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
# Multilib support variables.
# TOP is used instead of MULTI{BUILD,SRC}TOP.
MULTIDIRS =
MULTISUBDIR =
SHELL = /bin/sh
CC = @CC@
AS = @AS@
AR = @AR@
LD = @LD@
RANLIB = @RANLIB@
OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \
then echo ${objroot}/../binutils/objdump ; \
else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi`
OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \
then echo ${objroot}/../binutils/objcopy ; \
else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi`
OBJS = putnum.o unlink.o
CFLAGS = -g
SCRIPTS =
# Here is all of the simulator stuff
SIM_SCRIPTS =
SIM_LDFLAGS =
SIM_BSP = libsim.a
SIM_CRT0 = sim-crt0.o
SIM_OBJS = sim-print.o sim-inbyte.o sim-sbrk.o sim-abort.o sim-errno.o simulator.o
SIM_TEST = sim-test
SIM_INSTALL = install-sim
# Here is all of the mon960 stuff
MON_LDFLAGS =
MON_BSP = libmon960.a
MON_CRT0 = crt0.o
MON_OBJS = mon-read.o mon-write.o mon-syscalls.o mon960.o
MON_SCRIPTS = mon960.ld
MON_TEST =
MON_INSTALL = install-mon
# 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: ${MON_CRT0} ${MON_BSP}
#
# here's where we build the board support packages for each target
#
${SIM_BSP}: ${OBJS} ${SIM_OBJS}
${AR} ${ARFLAGS} ${SIM_BSP} ${SIM_OBJS} ${OBJS}
${RANLIB} ${SIM_BSP}
${MON_BSP}: ${OBJS} ${MON_OBJS}
${AR} ${ARFLAGS} ${MON_BSP} ${MON_OBJS} ${OBJS}
${RANLIB} ${MON_BSP}
#
# here's where we build the test programs for each target
#
.PHONY: test
test: ${SIM_TEST} ${MVME_TEST} ${EVM_TEST}
sim-test: sim-test.x sim-test.dis
sim-test.x: test.o ${SIM_CRT0} ${SIM_BSP}
${CC} ${LDFLAGS_FOR_TARGET} -L${objdir} \
${SIM_CRT0} test.o \
-o sim-test.x ${LIBS_FOR_TARGET} -lc ${SIM_BSP}
sim-test.dis: sim-test.x
${OBJDUMP} -d sim-test.x > sim-test.dis
#
#
#
.c.S:
${CC} ${CFLAGS_FOR_TARGET} -c $<
simulator.o: simulator.S
sim-crt0.o: sim-crt0.S
mvme-crt0.o: mvme-crt0.S
mvme-exit.o: mvme-exit.S
mvme-inbyte.o: mvme-inbyte.S
mvme-outbyte.o: mvme-outbyte.S
clean mostlyclean:
rm -f a.out core *.i *.o *-test *.srec *.dis *.x
distclean maintainer-clean realclean: clean
rm -f Makefile config.status *~
.PHONY: install info install-info clean-info
install: ${MON_INSTALL}
install-mon:
set -e; for x in ${MON_CRT0} ${MON_BSP}; do ${INSTALL_DATA} $$x ${tooldir}/lib${MULTISUBDIR}/$$x; done
set -e; for x in ${MON_SCRIPTS}; do ${INSTALL_DATA} ${srcdir}/$$x ${tooldir}/lib${MULTISUBDIR}/$$x; done
install-sim:
set -e; for x in ${SIM_CRT0} ${SIM_BSP} ${SIM_SCRIPTS}; do ${INSTALL_DATA} $$x ${tooldir}/lib/$$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

17
libgloss/i960/asm.h Normal file
View File

@ -0,0 +1,17 @@
#ifndef ASM_H
#define ASM_H
#ifdef __STDC__
# define _C_LABEL(x) _ ## x
#else
# define _C_LABEL(x) _/**/x
#endif
#define _ASM_LABEL(x) x
#define _ENTRY(name) \
.text; .align 4; .globl name; name:
#define ENTRY(name) \
_ENTRY(_C_LABEL(name))
#endif

1219
libgloss/i960/configure vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,75 @@
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.5)dnl
AC_INIT(crt0.c)
AC_CANONICAL_SYSTEM
AC_ARG_PROGRAM
if test "$srcdir" = "." ; then
mdir=`echo "${with_multisubdir}/" \
| sed -e 's,\([[^/]][[^/]]*\),..,g' -e 's,^/$,,'`
AC_CONFIG_AUX_DIR(${mdir}../../..)
else
AC_CONFIG_AUX_DIR(${srcdir}/../..)
fi
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)

66
libgloss/i960/crt0.c Normal file
View File

@ -0,0 +1,66 @@
extern int main(int argc, char **argv, char **envp);
extern int brk (void *value);
extern char bss_start;
extern char end;
char *__env[1] = {0};
char **environ = __env;
#define ENABLE_TRACE_MASK 1
__inline static void
enable_tracing (void)
{
register int mask = ENABLE_TRACE_MASK;
__asm__ volatile ("modpc %0,%0,%0"
:
: "d" (mask));
}
#define STACK_ALIGN 64
__inline static void
set_stack (void* ptr)
{
ptr = (void *)(((int)ptr + STACK_ALIGN - 1) & ~(STACK_ALIGN - 1));
/* SP must be 64 bytes larger than FP at start. */
__asm__ volatile ("mov %0,sp"
:
: "d" (ptr+STACK_ALIGN));
__asm__ volatile ("mov %0,fp"
:
: "d" (ptr));
}
__inline static void
init_Cregs (void)
{
/* set register values gcc like */
register unsigned int mask0=0x3b001000;
register unsigned int mask1=0x00009107;
__asm__ volatile ("mov %0,g14"
: /* no output */
: "I" (0)); /* gnu structure pointer */
__asm__ volatile ("modac %1,%0,%0"
: /* no output */
: "d" (mask0),
"d" (mask1)); /* fpu control kb */
}
void
_start(void)
{
char *p;
enable_tracing ();
set_stack (&end);
init_Cregs ();
/* The stack grows upwards, so this makes the heap start after a 256K
stack area. PlumHall known to fail with less than 73K of stack. */
brk (&end+0x40000);
/* clear bss */
memset (&bss_start, 0, &end - &bss_start);
main(0, 0, 0);
exit(0);
}

18
libgloss/i960/mon-read.c Normal file
View File

@ -0,0 +1,18 @@
#include <errno.h>
read (fd, buf, sz)
int fd;
char *buf;
int sz;
{
int nread;
int r;
r = _sys_read (fd, buf, sz, &nread);
if (r != 0)
{
errno = r;
return -1;
}
return nread;
}

View File

@ -0,0 +1,30 @@
#include "asm.h"
ENTRY(_exit)
lda 257,g13
calls g13
ENTRY(_sys_open)
lda 230,g13
calls g13
ret
ENTRY(_sys_read)
lda 231,g13
calls g13
ret
ENTRY(_sys_write)
lda 232,g13
calls g13
ret
ENTRY(_sys_lseek)
lda 233,g13
calls g13
ret
ENTRY(_sys_close)
lda 234,g13
calls g13
ret

14
libgloss/i960/mon-write.c Normal file
View File

@ -0,0 +1,14 @@
#include <errno.h>
int
write (int fd, const char *buf, int sz)
{
int nwritten;
int r = _sys_write (fd, buf, sz, &nwritten);
if (r != 0)
{
errno = r;
return -1;
}
return nwritten;
}

83
libgloss/i960/mon960.c Normal file
View File

@ -0,0 +1,83 @@
#include <sys/types.h>
#include <sys/stat.h>
static char *heap_end = 0;
int
brk (void *ptr)
{
heap_end = ptr;
return 0;
}
caddr_t
sbrk (int amt)
{
extern char end;
char *prev_heap_end;
if (heap_end == 0)
heap_end = &end;
prev_heap_end = heap_end;
heap_end += amt;
return ((caddr_t) prev_heap_end);
}
int
isatty (int file)
{
return file<3;
}
int
fstat (int file, struct stat *st)
{
st->st_mode = S_IFCHR;
return 0;
}
int
stat (const char *filename, struct stat *st)
{
st->st_mode = S_IFCHR;
return 0;
}
int
lseek (int fd, off_t offset, int type)
{
return _sys_lseek (fd, offset, type);
}
int
open (char *file, int mode, int perms)
{
return _sys_open (file, mode, perms);
}
int
close (int fd)
{
return _sys_close (fd);
}
int
getpid ()
{
return -1;
}
int
kill (int pid, int signal)
{
exit (signal);
}
#if 0
/* This conflicts with the abort defined in newlib. */
void
abort ()
{
exit (6);
}
#endif

36
libgloss/i960/mon960.ld Normal file
View File

@ -0,0 +1,36 @@
GROUP(-lc -lgcc -lmon960)
SECTIONS
{
. = 0xa0008000;
.text :
{
CREATE_OBJECT_SYMBOLS
*(.text)
_etext = .;
___CTOR_LIST__ = .;
LONG((___CTOR_END__ - ___CTOR_LIST__) / 4 - 2)
*(.ctors)
LONG(0)
___CTOR_END__ = .;
___DTOR_LIST__ = .;
LONG((___DTOR_END__ - ___DTOR_LIST__) / 4 - 2)
*(.dtors)
LONG(0)
___DTOR_END__ = .;
}
.data SIZEOF(.text) + ADDR(.text):
{
*(.data)
CONSTRUCTORS
_edata = .;
}
.bss SIZEOF(.data) + ADDR(.data):
{
_bss_start = .;
*(.bss)
*(COMMON)
_end = .;
}
}

51
libgloss/i960/syscall.h Normal file
View File

@ -0,0 +1,51 @@
/* mon960 syscall.h file. This is used only by the simulator. This matches
the syscall numbers used by mon-syscalls.S, but is otherwise a copy of
the libgloss/syscall.h file. */
/* ??? This file should be used by mon-syscalls.S to avoid maintenance
problems. */
#ifndef LIBGLOSS_SYSCALL_H
#define LIBGLOSS_SYSCALL_H
/* Note: This file may be included by assembler source. */
/* These should be as small as possible to allow a port to use a trap type
instruction, which the system call # as the trap (the d10v for instance
supports traps 0..31). An alternative would be to define one trap for doing
system calls, and put the system call number in a register that is not used
for the normal calling sequence (so that you don't have to shift down the
arguments to add the system call number). Obviously, if these system call
numbers are ever changed, all of the simulators and potentially user code
will need to be updated. */
/* There is no current need for the following: SYS_execv, SYS_creat, SYS_wait,
etc. etc. Don't add them. */
/* These are required by the ANSI C part of newlib (excluding system() of
course). */
#define SYS_exit 257
#define SYS_open 230
#define SYS_close 234
#define SYS_read 231
#define SYS_write 232
#define SYS_lseek 233
/* ??? The following system calls apparently aren't support by mon960. */
#define SYS_unlink 7
#define SYS_getpid 8
#define SYS_kill 9
#define SYS_fstat 10
/*#define SYS_sbrk 11 - not currently a system call, but reserved. */
/* ARGV support. */
#define SYS_argvlen 12
#define SYS_argv 13
/* These are extras added for one reason or another. */
#define SYS_chdir 14
#define SYS_stat 15
#define SYS_chmod 16
#define SYS_utime 17
#define SYS_time 18
#endif