iq2000 port.
This commit is contained in:
parent
75d7d17700
commit
045e4d2e08
@ -1,3 +1,20 @@
|
|||||||
|
2003-06-06 Stan Cox <scox@redhat.com>
|
||||||
|
Jeff Johnston <jjohnstn@redhat.com>
|
||||||
|
Anthony Green <green@redhat.com>
|
||||||
|
|
||||||
|
* configure.in: Add iq2000 support.
|
||||||
|
* configure: Rebuilt.
|
||||||
|
* iq2000/Makefile.in, iq2000/access.c, iq2000/_exit.c,
|
||||||
|
iq2000/configure, iq2000/chmod.c, iq2000/chown.c, iq2000/close.c,
|
||||||
|
iq2000/configure.in, iq2000/creat.c, iq2000/crt0.S, iq2000/crt1.c,
|
||||||
|
iq2000/execv.c, iq2000/execve.c, iq2000/fork.c, iq2000/fstat.c,
|
||||||
|
iq2000/getpid.c, iq2000/gettime.c, iq2000/isatty.c, iq2000/kill.c,
|
||||||
|
iq2000/lseek.c, iq2000/open.c, iq2000/pipe.c, iq2000/read.c,
|
||||||
|
iq2000/sbrk.c, iq2000/sim.ld, iq2000/stat.c, iq2000/test.c,
|
||||||
|
iq2000/time.c, iq2000/times.c, iq2000/trap.c, iq2000/trap.h,
|
||||||
|
iq2000/unlink.c, iq2000/utime.c, iq2000/wait.c, iq2000/write.c:
|
||||||
|
New files.
|
||||||
|
|
||||||
2003-05-27 Jeff Johnston <jjohnstn@redhat.com>
|
2003-05-27 Jeff Johnston <jjohnstn@redhat.com>
|
||||||
|
|
||||||
* libnosys/Makefile.in: Add errno.o.
|
* libnosys/Makefile.in: Add errno.o.
|
||||||
|
148
libgloss/iq2000/Makefile.in
Normal file
148
libgloss/iq2000/Makefile.in
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
# Copyright (c) 2000, Cygnus Solutions, A Red Hat Company
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
VPATH = @srcdir@
|
||||||
|
srcdir = @srcdir@
|
||||||
|
objdir = .
|
||||||
|
srcroot = $(srcdir)/../..
|
||||||
|
objroot = $(objdir)/../..
|
||||||
|
|
||||||
|
prefix = @prefix@
|
||||||
|
exec_prefix = @exec_prefix@
|
||||||
|
|
||||||
|
host_alias = @host_alias@
|
||||||
|
target_alias = @target_alias@
|
||||||
|
program_transform_name = @program_transform_name@
|
||||||
|
|
||||||
|
bindir = @bindir@
|
||||||
|
libdir = @libdir@
|
||||||
|
tooldir = $(exec_prefix)/$(target_alias)
|
||||||
|
|
||||||
|
# Multilib support variables.
|
||||||
|
# TOP is used instead of MULTI{BUILD,SRC}TOP.
|
||||||
|
MULTIDIRS =
|
||||||
|
MULTISUBDIR =
|
||||||
|
MULTIDO = true
|
||||||
|
MULTICLEAN = true
|
||||||
|
|
||||||
|
INSTALL = @INSTALL@
|
||||||
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||||
|
INSTALL_DATA = @INSTALL_DATA@
|
||||||
|
|
||||||
|
SHELL = /bin/sh
|
||||||
|
|
||||||
|
CC = @CC@
|
||||||
|
|
||||||
|
#AS = @AS@
|
||||||
|
AS = `if [ -f ${objroot}/../gas/as.new ] ; \
|
||||||
|
then echo ${objroot}/../gas/as.new ; \
|
||||||
|
else echo as ; fi`
|
||||||
|
|
||||||
|
AR = @AR@
|
||||||
|
|
||||||
|
#LD = @LD@
|
||||||
|
LD = `if [ -f ${objroot}/../ld/ld.new ] ; \
|
||||||
|
then echo ${objroot}/../ld/ld.new ; \
|
||||||
|
else echo ld ; fi`
|
||||||
|
|
||||||
|
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`
|
||||||
|
|
||||||
|
CRT0 = crt0.o
|
||||||
|
|
||||||
|
# Generic object files common to all targets.
|
||||||
|
GENOBJS = _exit.o access.o chmod.o close.o crt1.o \
|
||||||
|
fstat.o getpid.o gettime.o isatty.o \
|
||||||
|
kill.o lseek.o open.o read.o \
|
||||||
|
sbrk.o stat.o time.o trap.o unlink.o utime.o write.o
|
||||||
|
|
||||||
|
# Object files specific to particular targets.
|
||||||
|
EVALOBJS = ${GENOBJS}
|
||||||
|
|
||||||
|
CFLAGS = -g
|
||||||
|
|
||||||
|
GCC_LDFLAGS = `if [ -d ${objroot}/../gcc ] ; \
|
||||||
|
then echo -L${objroot}/../gcc ; fi`
|
||||||
|
|
||||||
|
SCRIPTS = sim
|
||||||
|
BSP = libeval.a
|
||||||
|
|
||||||
|
# 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} test.o ${BSP}
|
||||||
|
|
||||||
|
#
|
||||||
|
# here's where we build the board support packages for each target
|
||||||
|
#
|
||||||
|
|
||||||
|
libeval.a: $(EVALOBJS)
|
||||||
|
${AR} ${ARFLAGS} $@ $(EVALOBJS)
|
||||||
|
${RANLIB} $@
|
||||||
|
|
||||||
|
|
||||||
|
# compile a fully linked binary. The -Wl,-T*.ld is for the linker
|
||||||
|
# script. By using -Wl, the linker script is put on the proper place
|
||||||
|
# in the comand line for ld, and all the symbols will get fully
|
||||||
|
# resolved.
|
||||||
|
|
||||||
|
test: $(CRT0) test.o
|
||||||
|
${CC} $(CFLAGS_FOR_TARGET) -L${srcdir} -L${objdir} \
|
||||||
|
test.o -o $@ $(NEWLIB_LDFLAGS)
|
||||||
|
@echo Done...
|
||||||
|
|
||||||
|
doc:
|
||||||
|
|
||||||
|
clean mostlyclean:
|
||||||
|
rm -f a.out core *.i *~ *.o *-test *.srec *.dis *.map *.x
|
||||||
|
|
||||||
|
distclean maintainer-clean realclean: clean
|
||||||
|
rm -f Makefile config.status a.out
|
||||||
|
|
||||||
|
.PHONY: install info install-info clean-info
|
||||||
|
install:
|
||||||
|
$(INSTALL_PROGRAM) $(CRT0) $(tooldir)/lib${MULTISUBDIR}/$(CRT0)
|
||||||
|
@for bsp in ${BSP}; do\
|
||||||
|
$(INSTALL_PROGRAM) $${bsp} $(tooldir)/lib${MULTISUBDIR}; \
|
||||||
|
done
|
||||||
|
@for script in ${SCRIPTS}; do\
|
||||||
|
$(INSTALL_DATA) $(srcdir)/$${script}.ld $(tooldir)/lib${MULTISUBDIR}/$${script}.ld; \
|
||||||
|
done
|
||||||
|
|
||||||
|
info:
|
||||||
|
install-info:
|
||||||
|
clean-info:
|
||||||
|
|
||||||
|
test.o: ${srcdir}/test.c
|
||||||
|
|
||||||
|
# these are for the BSPs
|
||||||
|
${CRT0}: ${srcdir}/crt0.S
|
||||||
|
|
||||||
|
# target specific makefile fragment comes in here.
|
||||||
|
@target_makefile_frag@
|
||||||
|
|
||||||
|
Makefile: Makefile.in config.status @host_makefile_frag_path@ @target_makefile_frag_path@
|
||||||
|
$(SHELL) config.status
|
||||||
|
|
||||||
|
config.status: configure
|
||||||
|
$(SHELL) config.status --recheck
|
35
libgloss/iq2000/_exit.c
Normal file
35
libgloss/iq2000/_exit.c
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#include <_ansi.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include "trap.h"
|
||||||
|
|
||||||
|
|
||||||
|
static void _do_dtors()
|
||||||
|
{
|
||||||
|
/* The loop variable is static so that if a destructor calls exit,
|
||||||
|
and we return here, we simply continue with the next destructor. */
|
||||||
|
typedef void (*pfunc) ();
|
||||||
|
extern pfunc __dtors[];
|
||||||
|
extern pfunc __dtors_end[];
|
||||||
|
static pfunc *p = __dtors;
|
||||||
|
|
||||||
|
while (p < __dtors_end)
|
||||||
|
(*p++) ();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void _exit (n)
|
||||||
|
{
|
||||||
|
extern unsigned char __eh_frame_begin[];
|
||||||
|
extern void __deregister_frame_info (void *);
|
||||||
|
|
||||||
|
/* Destructors should be done earlier because they need to be done before the
|
||||||
|
files are closed, but here is better than nowhere (and this balances the
|
||||||
|
constructors done in crt1.c. */
|
||||||
|
_do_dtors();
|
||||||
|
|
||||||
|
/* Deregister any eh frames. */
|
||||||
|
__deregister_frame_info (__eh_frame_begin);
|
||||||
|
|
||||||
|
TRAP0 (SYS_exit, n, 0, 0);
|
||||||
|
}
|
33
libgloss/iq2000/access.c
Normal file
33
libgloss/iq2000/access.c
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/* This is file ACCESS.C */
|
||||||
|
/*
|
||||||
|
* Copyright (C) 1993 DJ Delorie
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms is permitted
|
||||||
|
* provided that the above copyright notice and following paragraph are
|
||||||
|
* duplicated in all such forms.
|
||||||
|
*
|
||||||
|
* This file is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||||
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int access(const char *fn, int flags)
|
||||||
|
{
|
||||||
|
struct stat s;
|
||||||
|
if (stat(fn, &s))
|
||||||
|
return -1;
|
||||||
|
if (s.st_mode & S_IFDIR)
|
||||||
|
return 0;
|
||||||
|
if (flags & W_OK)
|
||||||
|
{
|
||||||
|
if (s.st_mode & S_IWRITE)
|
||||||
|
return 0;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
11
libgloss/iq2000/chmod.c
Normal file
11
libgloss/iq2000/chmod.c
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#include <_ansi.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include "trap.h"
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
chmod (const char *path, mode_t mode)
|
||||||
|
{
|
||||||
|
return TRAP0 (SYS_chmod, path, mode, 0);
|
||||||
|
}
|
12
libgloss/iq2000/chown.c
Normal file
12
libgloss/iq2000/chown.c
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#include <_ansi.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include "trap.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
chown (const char *path, short owner, short group)
|
||||||
|
{
|
||||||
|
return TRAP0 (SYS_chown, path, owner, group);
|
||||||
|
}
|
11
libgloss/iq2000/close.c
Normal file
11
libgloss/iq2000/close.c
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#include <_ansi.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include "trap.h"
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
_close (int file)
|
||||||
|
{
|
||||||
|
return TRAP0 (SYS_close, file, 0, 0);
|
||||||
|
}
|
1232
libgloss/iq2000/configure
vendored
Executable file
1232
libgloss/iq2000/configure
vendored
Executable file
File diff suppressed because it is too large
Load Diff
115
libgloss/iq2000/configure.in
Normal file
115
libgloss/iq2000/configure.in
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
# Copyright (c) 2000, Cygnus Solutions, A Red Hat Company
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
# 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 building a library that must be included in all links, so we
|
||||||
|
# can't link an executable until this lib is built.
|
||||||
|
# autoconf should provide a way to do this.
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
if test "${with_multisubdir}" = "m32"; then
|
||||||
|
LD_TYPE="m32"
|
||||||
|
else
|
||||||
|
LD_TYPE="m16"
|
||||||
|
fi
|
||||||
|
AC_SUBST(LD_TYPE)
|
||||||
|
|
||||||
|
dnl We have to assign the same value to other variables because autoconf
|
||||||
|
dnl doesn't provide a mechanism to substitute a replacement keyword with
|
||||||
|
dnl arbitrary data or pathnames.
|
||||||
|
dnl
|
||||||
|
host_makefile_frag_path=$host_makefile_frag
|
||||||
|
AC_SUBST(host_makefile_frag_path)
|
||||||
|
AC_SUBST_FILE(host_makefile_frag)
|
||||||
|
target_makefile_frag_path=$target_makefile_frag
|
||||||
|
AC_SUBST(target_makefile_frag_path)
|
||||||
|
AC_SUBST_FILE(target_makefile_frag)
|
||||||
|
AC_SUBST(part_specific_obj)
|
||||||
|
|
||||||
|
AC_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}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
12
libgloss/iq2000/creat.c
Normal file
12
libgloss/iq2000/creat.c
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#include <_ansi.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include "trap.h"
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
creat (const char *path,
|
||||||
|
int mode)
|
||||||
|
{
|
||||||
|
return TRAP0 (SYS_creat, path, mode, 0);
|
||||||
|
}
|
56
libgloss/iq2000/crt0.S
Normal file
56
libgloss/iq2000/crt0.S
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
##==============================================================================
|
||||||
|
##
|
||||||
|
## crt0.S
|
||||||
|
##
|
||||||
|
## IQ2000 startup code
|
||||||
|
##
|
||||||
|
##==============================================================================
|
||||||
|
##
|
||||||
|
## Copyright (c) 2000, Cygnus Solutions, A Red Hat Company
|
||||||
|
##
|
||||||
|
## 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"
|
||||||
|
|
||||||
|
##------------------------------------------------------------------------------
|
||||||
|
## Startup code
|
||||||
|
.section .text
|
||||||
|
.global _start
|
||||||
|
_start:
|
||||||
|
lui %29,%hi(__stack)
|
||||||
|
ori %29,%29,%lo(__stack)
|
||||||
|
|
||||||
|
lui %24,%hi(_edata) # get start of bss
|
||||||
|
ori %24,%24,%lo(_edata)
|
||||||
|
|
||||||
|
lui %25,%hi(_end) # get end of bss
|
||||||
|
ori %25,%25,%lo(_end)
|
||||||
|
|
||||||
|
beq %24,%25,.L0 # check if end and start are the same
|
||||||
|
# do nothing if no bss
|
||||||
|
|
||||||
|
.L1:
|
||||||
|
sb %0,0(%24) # clear a byte and bump pointer
|
||||||
|
addi %24,%24,1
|
||||||
|
bne %24,%25,.L1
|
||||||
|
nop
|
||||||
|
|
||||||
|
.L0:
|
||||||
|
jal _main # call _main to run ctors/dtors
|
||||||
|
nop
|
||||||
|
xor %4,%4,%4
|
||||||
|
jal main # call main program
|
||||||
|
xor %5,%5,%5
|
||||||
|
jal exit # all done, no need to return or
|
||||||
|
or %4,%0,%2 # exit with main's return value
|
31
libgloss/iq2000/crt1.c
Normal file
31
libgloss/iq2000/crt1.c
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
|
||||||
|
/* This object reserves enough space for an EH frame initialization
|
||||||
|
object. */
|
||||||
|
|
||||||
|
struct object {
|
||||||
|
void *reserve[7];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void _main ()
|
||||||
|
{
|
||||||
|
static int initialized;
|
||||||
|
static struct object object;
|
||||||
|
if (! initialized)
|
||||||
|
{
|
||||||
|
typedef void (*pfunc) ();
|
||||||
|
extern pfunc __ctors[];
|
||||||
|
extern pfunc __ctors_end[];
|
||||||
|
extern unsigned char __eh_frame_begin[];
|
||||||
|
extern void __register_frame_info (void *, struct object *);
|
||||||
|
|
||||||
|
pfunc *p;
|
||||||
|
|
||||||
|
initialized = 1;
|
||||||
|
for (p = __ctors_end; p > __ctors; )
|
||||||
|
(*--p) ();
|
||||||
|
|
||||||
|
__register_frame_info (__eh_frame_begin, &object);
|
||||||
|
}
|
||||||
|
}
|
11
libgloss/iq2000/execv.c
Normal file
11
libgloss/iq2000/execv.c
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#include <_ansi.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include "trap.h"
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
execv (const char *path, char *const argv[])
|
||||||
|
{
|
||||||
|
return TRAP0 (SYS_execv, path, argv, 0);
|
||||||
|
}
|
11
libgloss/iq2000/execve.c
Normal file
11
libgloss/iq2000/execve.c
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#include <_ansi.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include "trap.h"
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
_execve (const char *path, char *const argv[], char *const envp[])
|
||||||
|
{
|
||||||
|
return TRAP0 (SYS_execve, path, argv, envp);
|
||||||
|
}
|
11
libgloss/iq2000/fork.c
Normal file
11
libgloss/iq2000/fork.c
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#include <_ansi.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include "trap.h"
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
_fork ()
|
||||||
|
{
|
||||||
|
return TRAP0 (SYS_fork, 0, 0, 0);
|
||||||
|
}
|
14
libgloss/iq2000/fstat.c
Normal file
14
libgloss/iq2000/fstat.c
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#include <_ansi.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include "trap.h"
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
_fstat (int file,
|
||||||
|
struct stat *st)
|
||||||
|
{
|
||||||
|
st->st_mode = S_IFCHR;
|
||||||
|
st->st_blksize = 4096;
|
||||||
|
return 0;
|
||||||
|
}
|
10
libgloss/iq2000/getpid.c
Normal file
10
libgloss/iq2000/getpid.c
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#include <_ansi.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include "trap.h"
|
||||||
|
|
||||||
|
|
||||||
|
_getpid (n)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
12
libgloss/iq2000/gettime.c
Normal file
12
libgloss/iq2000/gettime.c
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#include <_ansi.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include "trap.h"
|
||||||
|
#include "sys/time.h"
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
_gettimeofday (struct timeval *tp, void *tzp)
|
||||||
|
{
|
||||||
|
return TRAP0 (SYS_gettimeofday, tp, tzp, 0);
|
||||||
|
}
|
11
libgloss/iq2000/isatty.c
Normal file
11
libgloss/iq2000/isatty.c
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#include <_ansi.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include "trap.h"
|
||||||
|
|
||||||
|
|
||||||
|
isatty (fd)
|
||||||
|
int fd;
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
11
libgloss/iq2000/kill.c
Normal file
11
libgloss/iq2000/kill.c
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#include <_ansi.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include "trap.h"
|
||||||
|
|
||||||
|
|
||||||
|
_kill (n, m)
|
||||||
|
{
|
||||||
|
return TRAP0 (SYS_exit, 0xdead, 0, 0);
|
||||||
|
}
|
||||||
|
|
14
libgloss/iq2000/lseek.c
Normal file
14
libgloss/iq2000/lseek.c
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#include <_ansi.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/unistd.h>
|
||||||
|
#include "trap.h"
|
||||||
|
|
||||||
|
|
||||||
|
off_t
|
||||||
|
_lseek (int file,
|
||||||
|
off_t ptr,
|
||||||
|
int dir)
|
||||||
|
{
|
||||||
|
return TRAP0 (SYS_lseek, file, ptr, dir);
|
||||||
|
}
|
12
libgloss/iq2000/open.c
Normal file
12
libgloss/iq2000/open.c
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#include <_ansi.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include "trap.h"
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
_open (const char *path,
|
||||||
|
int flags)
|
||||||
|
{
|
||||||
|
return TRAP0 (SYS_open, path, flags, 0);
|
||||||
|
}
|
11
libgloss/iq2000/pipe.c
Normal file
11
libgloss/iq2000/pipe.c
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#include <_ansi.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include "trap.h"
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
pipe (int fd)
|
||||||
|
{
|
||||||
|
return TRAP0 (SYS_pipe, fd, 0, 0);
|
||||||
|
}
|
12
libgloss/iq2000/read.c
Normal file
12
libgloss/iq2000/read.c
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#include <_ansi.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include "trap.h"
|
||||||
|
|
||||||
|
|
||||||
|
_read (int file,
|
||||||
|
char *ptr,
|
||||||
|
size_t len)
|
||||||
|
{
|
||||||
|
return TRAP0 (SYS_read, file, ptr, len);
|
||||||
|
}
|
30
libgloss/iq2000/sbrk.c
Normal file
30
libgloss/iq2000/sbrk.c
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#include <_ansi.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include "trap.h"
|
||||||
|
|
||||||
|
|
||||||
|
caddr_t
|
||||||
|
_sbrk (size_t incr)
|
||||||
|
{
|
||||||
|
extern char __stack; /* Defined by the linker */
|
||||||
|
extern char _end; /* Defined by the linker */
|
||||||
|
static char *heap_end;
|
||||||
|
char *prev_heap_end;
|
||||||
|
char *sp = (char *)&sp;
|
||||||
|
|
||||||
|
if (heap_end == 0)
|
||||||
|
{
|
||||||
|
heap_end = &_end;
|
||||||
|
}
|
||||||
|
prev_heap_end = heap_end;
|
||||||
|
heap_end += incr;
|
||||||
|
if (heap_end > sp)
|
||||||
|
{
|
||||||
|
_write (1, "Heap and stack collision\n", 25);
|
||||||
|
errno = ENOMEM;
|
||||||
|
return (caddr_t)-1;
|
||||||
|
}
|
||||||
|
return (caddr_t) prev_heap_end;
|
||||||
|
}
|
278
libgloss/iq2000/sim.ld
Normal file
278
libgloss/iq2000/sim.ld
Normal file
@ -0,0 +1,278 @@
|
|||||||
|
/* Special linker script for running C executables on simulator */
|
||||||
|
OUTPUT_FORMAT("elf32-iq2000", "elf32-iq2000",
|
||||||
|
"elf32-iq2000")
|
||||||
|
OUTPUT_ARCH(iq2000)
|
||||||
|
ENTRY(_start)
|
||||||
|
/* Do we need any of these for elf?
|
||||||
|
__DYNAMIC = 0; */
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
. = 0x80000000;
|
||||||
|
.interp : { *(.interp) }
|
||||||
|
.rel.init : { *(.rel.init) }
|
||||||
|
.rela.init : { *(.rela.init) }
|
||||||
|
.rel.text :
|
||||||
|
{
|
||||||
|
*(.rel.text)
|
||||||
|
*(.rel.text.*)
|
||||||
|
*(.rel.gnu.linkonce.t.*)
|
||||||
|
}
|
||||||
|
.rela.text :
|
||||||
|
{
|
||||||
|
*(.rela.text)
|
||||||
|
*(.rela.text.*)
|
||||||
|
*(.rela.gnu.linkonce.t.*)
|
||||||
|
}
|
||||||
|
.rel.fini : { *(.rel.fini) }
|
||||||
|
.rela.fini : { *(.rela.fini) }
|
||||||
|
.rel.rodata :
|
||||||
|
{
|
||||||
|
*(.rel.rodata)
|
||||||
|
*(.rel.rodata.*)
|
||||||
|
*(.rel.gnu.linkonce.r.*)
|
||||||
|
}
|
||||||
|
.rela.rodata :
|
||||||
|
{
|
||||||
|
*(.rela.rodata)
|
||||||
|
*(.rela.rodata.*)
|
||||||
|
*(.rela.gnu.linkonce.r.*)
|
||||||
|
}
|
||||||
|
.rel.data :
|
||||||
|
{
|
||||||
|
*(.rel.data)
|
||||||
|
*(.rel.data.*)
|
||||||
|
*(.rel.gnu.linkonce.d.*)
|
||||||
|
}
|
||||||
|
.rela.data :
|
||||||
|
{
|
||||||
|
*(.rela.data)
|
||||||
|
*(.rela.data.*)
|
||||||
|
*(.rela.gnu.linkonce.d.*)
|
||||||
|
}
|
||||||
|
.rel.ctors : { *(.rel.ctors) }
|
||||||
|
.rela.ctors : { *(.rela.ctors) }
|
||||||
|
.rel.dtors : { *(.rel.dtors) }
|
||||||
|
.rela.dtors : { *(.rela.dtors) }
|
||||||
|
.rel.got : { *(.rel.got) }
|
||||||
|
.rela.got : { *(.rela.got) }
|
||||||
|
.rel.sdata :
|
||||||
|
{
|
||||||
|
*(.rel.sdata)
|
||||||
|
*(.rel.sdata.*)
|
||||||
|
*(.rel.gnu.linkonce.s.*)
|
||||||
|
}
|
||||||
|
.rela.sdata :
|
||||||
|
{
|
||||||
|
*(.rela.sdata)
|
||||||
|
*(.rela.sdata.*)
|
||||||
|
*(.rela.gnu.linkonce.s.*)
|
||||||
|
}
|
||||||
|
.rel.sbss :
|
||||||
|
{
|
||||||
|
*(.rel.sbss)
|
||||||
|
*(.rel.sbss.*)
|
||||||
|
*(.rel.gnu.linkonce.sb.*)
|
||||||
|
}
|
||||||
|
.rela.sbss :
|
||||||
|
{
|
||||||
|
*(.rela.sbss)
|
||||||
|
*(.rela.sbss.*)
|
||||||
|
*(.rela.gnu.linkonce.sb.*)
|
||||||
|
}
|
||||||
|
.rel.sdata2 :
|
||||||
|
{
|
||||||
|
*(.rel.sdata2)
|
||||||
|
*(.rel.sdata2.*)
|
||||||
|
*(.rel.gnu.linkonce.s2.*)
|
||||||
|
}
|
||||||
|
.rela.sdata2 :
|
||||||
|
{
|
||||||
|
*(.rela.sdata2)
|
||||||
|
*(.rela.sdata2.*)
|
||||||
|
*(.rela.gnu.linkonce.s2.*)
|
||||||
|
}
|
||||||
|
.rel.sbss2 :
|
||||||
|
{
|
||||||
|
*(.rel.sbss2)
|
||||||
|
*(.rel.sbss2.*)
|
||||||
|
*(.rel.gnu.linkonce.sb2.*)
|
||||||
|
}
|
||||||
|
.rela.sbss2 :
|
||||||
|
{
|
||||||
|
*(.rela.sbss2)
|
||||||
|
*(.rela.sbss2.*)
|
||||||
|
*(.rela.gnu.linkonce.sb2.*)
|
||||||
|
}
|
||||||
|
.rel.bss :
|
||||||
|
{
|
||||||
|
*(.rel.bss)
|
||||||
|
*(.rel.bss.*)
|
||||||
|
*(.rel.gnu.linkonce.b.*)
|
||||||
|
}
|
||||||
|
.rela.bss :
|
||||||
|
{
|
||||||
|
*(.rela.bss)
|
||||||
|
*(.rela.bss.*)
|
||||||
|
*(.rela.gnu.linkonce.b.*)
|
||||||
|
}
|
||||||
|
.rel.plt : { *(.rel.plt) }
|
||||||
|
.rela.plt : { *(.rela.plt) }
|
||||||
|
.init :
|
||||||
|
{
|
||||||
|
KEEP (*(.init))
|
||||||
|
} =0
|
||||||
|
.plt : { *(.plt) }
|
||||||
|
.text :
|
||||||
|
{
|
||||||
|
*(.text)
|
||||||
|
*(.text.*)
|
||||||
|
*(.stub)
|
||||||
|
/* .gnu.warning sections are handled specially by elf32.em. */
|
||||||
|
*(.gnu.warning)
|
||||||
|
*(.gnu.linkonce.t.*)
|
||||||
|
} =0
|
||||||
|
.fini :
|
||||||
|
{
|
||||||
|
KEEP (*(.fini))
|
||||||
|
} =0
|
||||||
|
PROVIDE (__etext = .);
|
||||||
|
PROVIDE (_etext = .);
|
||||||
|
PROVIDE (etext = .);
|
||||||
|
/* Adjust the address for the data segment. We want to adjust up to
|
||||||
|
the same address within the page on the next page up. */
|
||||||
|
. = 0x1000;
|
||||||
|
.data :
|
||||||
|
{
|
||||||
|
*(.data)
|
||||||
|
*(.data.*)
|
||||||
|
*(.gnu.linkonce.d.*)
|
||||||
|
SORT(CONSTRUCTORS)
|
||||||
|
}
|
||||||
|
.data1 : { *(.data1) }
|
||||||
|
.eh_frame :
|
||||||
|
{
|
||||||
|
PROVIDE (__eh_frame_begin = .);
|
||||||
|
*(.eh_frame)
|
||||||
|
LONG (0);
|
||||||
|
PROVIDE (__eh_frame_end = .);
|
||||||
|
}
|
||||||
|
.gcc_except_table : { *(.gcc_except_table) }
|
||||||
|
.hash : { *(.hash) }
|
||||||
|
.dynsym : { *(.dynsym) }
|
||||||
|
.dynstr : { *(.dynstr) }
|
||||||
|
.gnu.version : { *(.gnu.version) }
|
||||||
|
.gnu.version_d : { *(.gnu.version_d) }
|
||||||
|
.gnu.version_r : { *(.gnu.version_r) }
|
||||||
|
.rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r.*) }
|
||||||
|
.rodata1 : { *(.rodata1) }
|
||||||
|
.sdata2 : { *(.sdata2) *(.sdata2.*) *(.gnu.linkonce.s2.*) }
|
||||||
|
.sbss2 : { *(.sbss2) *(.sbss2.*) *(.gnu.linkonce.sb2.*) }
|
||||||
|
.dynamic : { *(.dynamic) }
|
||||||
|
.ctors :
|
||||||
|
{
|
||||||
|
__ctors = .;
|
||||||
|
/* gcc uses crtbegin.o to find the start of
|
||||||
|
the constructors, so we make sure it is
|
||||||
|
first. Because this is a wildcard, it
|
||||||
|
doesn't matter if the user does not
|
||||||
|
actually link against crtbegin.o; the
|
||||||
|
linker won't look for a file to match a
|
||||||
|
wildcard. The wildcard also means that it
|
||||||
|
doesn't matter which directory crtbegin.o
|
||||||
|
is in. */
|
||||||
|
KEEP (*crtbegin.o(.ctors))
|
||||||
|
/* We don't want to include the .ctor section from
|
||||||
|
from the crtend.o file until after the sorted ctors.
|
||||||
|
The .ctor section from the crtend file contains the
|
||||||
|
end of ctors marker and it must be last */
|
||||||
|
KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
|
||||||
|
KEEP (*(SORT(.ctors.*)))
|
||||||
|
KEEP (*(.ctors))
|
||||||
|
__ctors_end = .;
|
||||||
|
}
|
||||||
|
.dtors :
|
||||||
|
{
|
||||||
|
__dtors = .;
|
||||||
|
KEEP (*crtbegin.o(.dtors))
|
||||||
|
KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
|
||||||
|
KEEP (*(SORT(.dtors.*)))
|
||||||
|
KEEP (*(.dtors))
|
||||||
|
__dtors_end = .;
|
||||||
|
}
|
||||||
|
.jcr : { KEEP (*(.jcr)) }
|
||||||
|
.got : { *(.got.plt) *(.got) }
|
||||||
|
/* We want the small data sections together, so single-instruction offsets
|
||||||
|
can access them all, and initialized data all before uninitialized, so
|
||||||
|
we can shorten the on-disk segment size. */
|
||||||
|
.sdata :
|
||||||
|
{
|
||||||
|
*(.sdata)
|
||||||
|
*(.sdata.*)
|
||||||
|
*(.gnu.linkonce.s.*)
|
||||||
|
}
|
||||||
|
_edata = .;
|
||||||
|
PROVIDE (edata = .);
|
||||||
|
__bss_start = .;
|
||||||
|
.sbss :
|
||||||
|
{
|
||||||
|
PROVIDE (__sbss_start = .);
|
||||||
|
PROVIDE (___sbss_start = .);
|
||||||
|
*(.dynsbss)
|
||||||
|
*(.sbss)
|
||||||
|
*(.sbss.*)
|
||||||
|
*(.gnu.linkonce.sb.*)
|
||||||
|
*(.scommon)
|
||||||
|
PROVIDE (__sbss_end = .);
|
||||||
|
PROVIDE (___sbss_end = .);
|
||||||
|
}
|
||||||
|
.bss :
|
||||||
|
{
|
||||||
|
*(.dynbss)
|
||||||
|
*(.bss)
|
||||||
|
*(.bss.*)
|
||||||
|
*(.gnu.linkonce.b.*)
|
||||||
|
*(COMMON)
|
||||||
|
/* Align here to ensure that the .bss section occupies space up to
|
||||||
|
_end. Align after .bss to ensure correct alignment even if the
|
||||||
|
.bss section disappears because there are no input sections. */
|
||||||
|
. = ALIGN(32 / 8);
|
||||||
|
}
|
||||||
|
. = ALIGN(32 / 8);
|
||||||
|
_end = .;
|
||||||
|
PROVIDE (end = .);
|
||||||
|
/* Stabs debugging sections. */
|
||||||
|
.stab 0 : { *(.stab) }
|
||||||
|
.stabstr 0 : { *(.stabstr) }
|
||||||
|
.stab.excl 0 : { *(.stab.excl) }
|
||||||
|
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||||
|
.stab.index 0 : { *(.stab.index) }
|
||||||
|
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||||
|
.comment 0 : { *(.comment) }
|
||||||
|
/* DWARF debug sections.
|
||||||
|
Symbols in the DWARF debugging sections are relative to the beginning
|
||||||
|
of the section so we begin them at 0. */
|
||||||
|
/* DWARF 1 */
|
||||||
|
.debug 0 : { *(.debug) }
|
||||||
|
.line 0 : { *(.line) }
|
||||||
|
/* GNU DWARF 1 extensions */
|
||||||
|
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||||
|
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||||
|
/* DWARF 1.1 and DWARF 2 */
|
||||||
|
.debug_aranges 0 : { *(.debug_aranges) }
|
||||||
|
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||||
|
/* DWARF 2 */
|
||||||
|
.debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
|
||||||
|
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||||
|
.debug_line 0 : { *(.debug_line) }
|
||||||
|
.debug_frame 0 : { *(.debug_frame) }
|
||||||
|
.debug_str 0 : { *(.debug_str) }
|
||||||
|
.debug_loc 0 : { *(.debug_loc) }
|
||||||
|
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||||
|
/* SGI/MIPS DWARF 2 extensions */
|
||||||
|
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||||
|
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||||
|
.debug_typenames 0 : { *(.debug_typenames) }
|
||||||
|
.debug_varnames 0 : { *(.debug_varnames) }
|
||||||
|
PROVIDE (__stack = 0x80000);
|
||||||
|
/* These must appear regardless of . */
|
||||||
|
}
|
12
libgloss/iq2000/stat.c
Normal file
12
libgloss/iq2000/stat.c
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#include <_ansi.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include "trap.h"
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
_stat (const char *path, struct stat *st)
|
||||||
|
|
||||||
|
{
|
||||||
|
return TRAP0 (SYS_stat, path, st, 0);
|
||||||
|
}
|
39
libgloss/iq2000/test.c
Normal file
39
libgloss/iq2000/test.c
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
static void
|
||||||
|
send_msg1 (void)
|
||||||
|
{
|
||||||
|
static char msg[] = "Hello World\r\n";
|
||||||
|
write(1, msg, strlen (msg));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
send_msg2 (void)
|
||||||
|
{
|
||||||
|
static char msg[] = "Goodnight Irene\r\n";
|
||||||
|
write(1, msg, strlen (msg));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
delay (void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < 1000000; i++)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
int i, j;
|
||||||
|
for (i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
send_msg1 ();
|
||||||
|
delay ();
|
||||||
|
send_msg2 ();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
11
libgloss/iq2000/time.c
Normal file
11
libgloss/iq2000/time.c
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#include <_ansi.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include "trap.h"
|
||||||
|
|
||||||
|
|
||||||
|
time_t
|
||||||
|
time (time_t *tloc)
|
||||||
|
{
|
||||||
|
return TRAP0 (SYS_time, tloc, 0, 0);
|
||||||
|
}
|
12
libgloss/iq2000/times.c
Normal file
12
libgloss/iq2000/times.c
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#include <_ansi.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include "trap.h"
|
||||||
|
#include "sys/times.h"
|
||||||
|
|
||||||
|
|
||||||
|
clock_t
|
||||||
|
times (struct tms *buffer)
|
||||||
|
{
|
||||||
|
return TRAP0 (SYS_times, buffer, 0, 0);
|
||||||
|
}
|
13
libgloss/iq2000/trap.c
Normal file
13
libgloss/iq2000/trap.c
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// Perform a system call.
|
||||||
|
// Unused parameters should be set to 0.
|
||||||
|
int __trap0(unsigned long func, unsigned long p1, unsigned long p2, unsigned long p3)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
asm volatile ("nop\n\tor %%4,%%0,%0" : : "r"(func));
|
||||||
|
asm volatile ("nop\n\tor %%5,%%0,%0" : : "r"(p1));
|
||||||
|
asm volatile ("nop\n\tor %%6,%%0,%0" : : "r"(p2));
|
||||||
|
asm volatile ("nop\n\tor %%7,%%0,%0" : : "r"(p3));
|
||||||
|
asm volatile ("nop\n\tor %%11,%%0,%0" : : "r"(func));
|
||||||
|
asm volatile ("syscall\n\tnop\n\tor %0,%%0,%%2" : "=r"(ret));
|
||||||
|
return ret;
|
||||||
|
}
|
5
libgloss/iq2000/trap.h
Normal file
5
libgloss/iq2000/trap.h
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#include "syscall.h"
|
||||||
|
|
||||||
|
int __trap0 ();
|
||||||
|
|
||||||
|
#define TRAP0(f, p1, p2, p3) __trap0(f, (p1), (p2), (p3))
|
11
libgloss/iq2000/unlink.c
Normal file
11
libgloss/iq2000/unlink.c
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#include <_ansi.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include "trap.h"
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
_unlink ()
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
13
libgloss/iq2000/utime.c
Normal file
13
libgloss/iq2000/utime.c
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#include <_ansi.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include "trap.h"
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
utime (path, times)
|
||||||
|
const char *path;
|
||||||
|
char *times;
|
||||||
|
{
|
||||||
|
return TRAP0 (SYS_utime, path, times, 0);
|
||||||
|
}
|
12
libgloss/iq2000/wait.c
Normal file
12
libgloss/iq2000/wait.c
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#include <_ansi.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include "trap.h"
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
_wait (statusp)
|
||||||
|
int *statusp;
|
||||||
|
{
|
||||||
|
return TRAP0 (SYS_wait, 0, 0, 0);
|
||||||
|
}
|
13
libgloss/iq2000/write.c
Normal file
13
libgloss/iq2000/write.c
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#include <_ansi.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include "trap.h"
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
_write ( int file,
|
||||||
|
char *ptr,
|
||||||
|
size_t len)
|
||||||
|
{
|
||||||
|
return TRAP0 (SYS_write, file, ptr, len);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user