Move/rename files.
This commit is contained in:
parent
458c93a430
commit
5115554247
160
Makefile.in
160
Makefile.in
|
@ -1,160 +0,0 @@
|
|||
# Copyright (c) 2008, 2009, 2011 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/rl78.
|
||||
|
||||
VPATH = @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`
|
||||
|
||||
SCRIPTS = $(srcdir)/rl78.ld $(srcdir)/rl78-sim.ld
|
||||
CRT = gcrt0.o crt0.o crtn.o
|
||||
SIM_BSP = libsim.a
|
||||
LIBNOSYS = ../libnosys/libnosys.a
|
||||
SIM_OBJS = \
|
||||
sbrk.o \
|
||||
exit.o \
|
||||
open.o \
|
||||
close.o \
|
||||
read.o \
|
||||
write.o \
|
||||
lseek.o \
|
||||
unlink.o \
|
||||
getpid.o \
|
||||
kill.o \
|
||||
fstat.o \
|
||||
argvlen.o \
|
||||
argv.o \
|
||||
chdir.o \
|
||||
stat.o \
|
||||
chmod.o \
|
||||
utime.o \
|
||||
time.o \
|
||||
gettimeofday.o \
|
||||
times.o \
|
||||
link.o \
|
||||
isatty.o \
|
||||
abort.o \
|
||||
mcount.o
|
||||
|
||||
#### Host specific Makefile fragment comes in here.
|
||||
@host_makefile_frag@
|
||||
|
||||
|
||||
# Override .S.o rule to pass assembler debugging flags
|
||||
.S.o:
|
||||
$(CC) -Wa,-gdwarf2 -Wa,-I$(srcdir) $(CFLAGS_FOR_TARGET) $(INCLUDES) $(CFLAGS) -c $<
|
||||
|
||||
all: $(CRT) $(SIM_BSP) copy_scripts_to_objdir
|
||||
|
||||
$(SIM_BSP): $(SIM_OBJS)
|
||||
$(AR) $(ARFLAGS) $@ $?
|
||||
$(RANLIB) $@
|
||||
|
||||
copy_scripts_to_objdir: $(SCRIPTS)
|
||||
cp $(SCRIPTS) $(objdir)
|
||||
|
||||
# Dependencies
|
||||
|
||||
SDEPS = $(srcdir)/rl78-sys.h $(srcdir)/../syscall.h
|
||||
|
||||
abort.o : $(SDEPS)
|
||||
argv.o : $(SDEPS)
|
||||
argvlen.o : $(SDEPS)
|
||||
chdir.o : $(SDEPS)
|
||||
chmod.o : $(SDEPS)
|
||||
close.o : $(SDEPS)
|
||||
exit.o : $(SDEPS)
|
||||
fstat.o : $(SDEPS)
|
||||
getpid.o : $(SDEPS)
|
||||
gettimeofday.o : $(SDEPS)
|
||||
gcrt0.o: gcrt0.S crt0.S
|
||||
kill.o : $(SDEPS)
|
||||
link.o : $(SDEPS)
|
||||
lseek.o : $(SDEPS)
|
||||
mcount.o : $(SDEPS)
|
||||
open.o : $(SDEPS)
|
||||
read.o : $(SDEPS)
|
||||
sigprocmask.o : $(SDEPS)
|
||||
sleep.o : $(SDEPS)
|
||||
stat.o : $(SDEPS)
|
||||
time.o : $(SDEPS)
|
||||
times.o : $(SDEPS)
|
||||
unlink.o : $(SDEPS)
|
||||
utime.o : $(SDEPS)
|
||||
write.o : $(SDEPS)
|
||||
|
||||
install: $(CRT) $(SIM_BSP) $(SCRIPTS)
|
||||
for c in $(CRT) $(SIM_BSP); do \
|
||||
$(INSTALL_DATA) $$c $(tooldir)/lib${MULTISUBDIR}/$$c ;\
|
||||
done
|
||||
for c in $(SCRIPTS); do \
|
||||
b=`basename $$c`; \
|
||||
$(INSTALL_DATA) $$c $(tooldir)/lib${MULTISUBDIR}/$$b ;\
|
||||
done
|
||||
|
||||
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
|
50
abort.S
50
abort.S
|
@ -1,50 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2011 Red Hat Incorporated.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
The name of Red Hat Incorporated may not be used to endorse
|
||||
or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rl78-sys.h"
|
||||
|
||||
.global _abort
|
||||
.type _abort, @function
|
||||
_abort:
|
||||
/* This is for debuggers. The simulator stops here too. */
|
||||
brk
|
||||
|
||||
movw ax, #42
|
||||
push ax
|
||||
SYSCALL(SYS_kill)
|
||||
pop ax
|
||||
|
||||
/* Else, exit. */
|
||||
call !!__exit
|
||||
|
||||
.size _abort, . - _abort
|
||||
|
35
argv.S
35
argv.S
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2011 Red Hat Incorporated.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
The name of Red Hat Incorporated may not be used to endorse
|
||||
or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rl78-sys.h"
|
||||
|
||||
ERR(argv)
|
35
argvlen.S
35
argvlen.S
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2011 Red Hat Incorporated.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
The name of Red Hat Incorporated may not be used to endorse
|
||||
or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rl78-sys.h"
|
||||
|
||||
ERR(argvlen)
|
35
chdir.S
35
chdir.S
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2011 Red Hat Incorporated.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
The name of Red Hat Incorporated may not be used to endorse
|
||||
or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rl78-sys.h"
|
||||
|
||||
ERR(chdir)
|
35
chmod.S
35
chmod.S
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2011 Red Hat Incorporated.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
The name of Red Hat Incorporated may not be used to endorse
|
||||
or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rl78-sys.h"
|
||||
|
||||
ERR(chmod)
|
35
close.S
35
close.S
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2011 Red Hat Incorporated.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
The name of Red Hat Incorporated may not be used to endorse
|
||||
or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rl78-sys.h"
|
||||
|
||||
OK(close)
|
55
configure.in
55
configure.in
|
@ -1,55 +0,0 @@
|
|||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_PREREQ(2.59)
|
||||
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
|
||||
|
||||
LIB_AC_PROG_CC
|
||||
|
||||
AS=${AS-as}
|
||||
AC_SUBST(AS)
|
||||
AR=${AR-ar}
|
||||
AC_SUBST(AR)
|
||||
LD=${LD-ld}
|
||||
AC_SUBST(LD)
|
||||
AC_PROG_RANLIB
|
||||
LIB_AM_PROG_AS
|
||||
|
||||
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_CONFIG_FILES(Makefile,
|
||||
. ${libgloss_topdir}/config-ml.in,
|
||||
srcdir=${srcdir}
|
||||
target=${target}
|
||||
with_multisubdir=${with_multisubdir}
|
||||
ac_configure_args="${ac_configure_args} --enable-multilib"
|
||||
CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
|
||||
libgloss_topdir=${libgloss_topdir}
|
||||
)
|
||||
AC_OUTPUT
|
47
crtn.S
47
crtn.S
|
@ -1,47 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2005,2011 Red Hat Incorporated.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
The name of Red Hat Incorporated may not be used to endorse
|
||||
or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
.section .init,"ax"
|
||||
call !!_rl78_run_preinit_array
|
||||
call !!_rl78_run_init_array
|
||||
ret
|
||||
.global __rl78_init_end
|
||||
__rl78_init_end:
|
||||
|
||||
.section .fini,"ax"
|
||||
|
||||
ret
|
||||
.global __rl78_fini_end
|
||||
__rl78_fini_end:
|
||||
|
||||
.text
|
||||
|
43
exit.S
43
exit.S
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2011 Red Hat Incorporated.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
The name of Red Hat Incorporated may not be used to endorse
|
||||
or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rl78-sys.h"
|
||||
|
||||
.global __exit
|
||||
.type __exit, @function
|
||||
__exit:
|
||||
call !!__rl78_fini
|
||||
mov a, [sp+4]
|
||||
halt
|
||||
SYSCALL(SYS_exit)
|
||||
.size __exit, . - __exit
|
||||
|
35
fstat.S
35
fstat.S
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2011 Red Hat Incorporated.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
The name of Red Hat Incorporated may not be used to endorse
|
||||
or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rl78-sys.h"
|
||||
|
||||
ERR(fstat)
|
58
gcrt0.S
58
gcrt0.S
|
@ -1,58 +0,0 @@
|
|||
/* Copyright (c) 2011 Red Hat Incorporated.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
The name of Red Hat Incorporated may not be used to endorse
|
||||
or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
This software is provided by the copyright holders and contributors
|
||||
"AS IS" and any express or implied warranties, including, but not
|
||||
limited to, the implied warranties of merchantability and fitness for
|
||||
a particular purpose are disclaimed. In no event shall Red Hat
|
||||
incorporated be liable for any direct, indirect, incidental, special,
|
||||
exemplary, or consequential damages (including, but not limited to,
|
||||
procurement of substitute goods or services; loss of use, data, or
|
||||
profits; or business interruption) however caused and on any theory of
|
||||
liability, whether in contract, strict liability, or tort (including
|
||||
negligence or otherwise) arising in any way out of the use of this
|
||||
software, even if advised of the possibility of such damage. */
|
||||
|
||||
#define PROFILE_SUPPORT 1
|
||||
|
||||
#include "crt0.S"
|
||||
|
||||
.global __mcount
|
||||
.type __mcount, @function
|
||||
__mcount:
|
||||
;; When a function is compiled for profiling, gcc creates code
|
||||
;; like this at the start of each profiled function:
|
||||
;;
|
||||
;; .global <func_name>
|
||||
;; <func_name>:
|
||||
;; bsr __mcount
|
||||
;; <...function's prologue...>
|
||||
;; <...function's body...>
|
||||
;;
|
||||
;; We must save all of the argument registers, extract the
|
||||
;; address of <func_name>, call _mcount_internal to do the
|
||||
;; real work and then restore the argument registers before
|
||||
;; returning.
|
||||
|
||||
movw ax, [sp]
|
||||
push ax
|
||||
call !!__mcount_internal
|
||||
pop ax
|
||||
ret
|
||||
|
||||
.size __mcount, . - __mcount
|
36
getpid.S
36
getpid.S
|
@ -1,36 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2011 Red Hat Incorporated.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
The name of Red Hat Incorporated may not be used to endorse
|
||||
or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rl78-sys.h"
|
||||
|
||||
RET(getpid,42)
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2011 Red Hat Incorporated.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
The name of Red Hat Incorporated may not be used to endorse
|
||||
or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rl78-sys.h"
|
||||
|
||||
ERR(gettimeofday)
|
36
isatty.S
36
isatty.S
|
@ -1,36 +0,0 @@
|
|||
/* Copyright (c) 2011 Red Hat Incorporated.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
The name of Red Hat Incorporated may not be used to endorse
|
||||
or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
|
||||
|
||||
#include "rl78-sys.h"
|
||||
|
||||
.global _isatty
|
||||
.weak _isatty
|
||||
_isatty:
|
||||
|
||||
RET(_isatty,1)
|
||||
|
35
kill.S
35
kill.S
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2011 Red Hat Incorporated.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
The name of Red Hat Incorporated may not be used to endorse
|
||||
or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rl78-sys.h"
|
||||
|
||||
ERR(kill)
|
35
link.S
35
link.S
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2011 Red Hat Incorporated.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
The name of Red Hat Incorporated may not be used to endorse
|
||||
or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rl78-sys.h"
|
||||
|
||||
ERR(link)
|
35
lseek.S
35
lseek.S
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2011 Red Hat Incorporated.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
The name of Red Hat Incorporated may not be used to endorse
|
||||
or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rl78-sys.h"
|
||||
|
||||
ERR(lseek)
|
422
mcount.c
422
mcount.c
|
@ -1,422 +0,0 @@
|
|||
/*-
|
||||
* Copyright (c) 1983, 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* This file implements a subset of the profiling support functions.
|
||||
It has been copied and adapted from mcount.c, gmon.c and gmon.h in
|
||||
the glibc sources.
|
||||
Since we do not have access to a timer interrupt in the simulator
|
||||
the histogram and basic block information is not generated. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
/* Fraction of text space to allocate for histogram counters here, 1/2. */
|
||||
#define HISTFRACTION 2
|
||||
|
||||
/* Fraction of text space to allocate for from hash buckets.
|
||||
The value of HASHFRACTION is based on the minimum number of bytes
|
||||
of separation between two subroutine call points in the object code.
|
||||
Given MIN_SUBR_SEPARATION bytes of separation the value of
|
||||
HASHFRACTION is calculated as:
|
||||
|
||||
HASHFRACTION = MIN_SUBR_SEPARATION / (2 * sizeof (short) - 1);
|
||||
|
||||
For example, on the VAX, the shortest two call sequence is:
|
||||
|
||||
calls $0,(r0)
|
||||
calls $0,(r0)
|
||||
|
||||
which is separated by only three bytes, thus HASHFRACTION is
|
||||
calculated as:
|
||||
|
||||
HASHFRACTION = 3 / (2 * 2 - 1) = 1
|
||||
|
||||
Note that the division above rounds down, thus if MIN_SUBR_FRACTION
|
||||
is less than three, this algorithm will not work!
|
||||
|
||||
In practice, however, call instructions are rarely at a minimal
|
||||
distance. Hence, we will define HASHFRACTION to be 2 across all
|
||||
architectures. This saves a reasonable amount of space for
|
||||
profiling data structures without (in practice) sacrificing
|
||||
any granularity. */
|
||||
#define HASHFRACTION 2
|
||||
|
||||
/* Percent of text space to allocate for tostructs.
|
||||
This is a heuristic; we will fail with a warning when profiling
|
||||
programs with a very large number of very small functions, but
|
||||
that's normally OK.
|
||||
2 is probably still a good value for normal programs.
|
||||
Profiling a test case with 64000 small functions will work if
|
||||
you raise this value to 3 and link statically (which bloats the
|
||||
text size, thus raising the number of arcs expected by the heuristic). */
|
||||
#define ARCDENSITY 3
|
||||
|
||||
/* Always allocate at least this many tostructs. This hides the
|
||||
inadequacy of the ARCDENSITY heuristic, at least for small programs. */
|
||||
#define MINARCS 50
|
||||
|
||||
/* Maximum number of arcs we want to allow.
|
||||
Used to be max representable value of ARCINDEX minus 2, but now
|
||||
that ARCINDEX is a long, that's too large; we don't really want
|
||||
to allow a 48 gigabyte table.
|
||||
The old value of 1<<16 wasn't high enough in practice for large C++
|
||||
programs; will 1<<20 be adequate for long? FIXME */
|
||||
#define MAXARCS (1L << 20)
|
||||
|
||||
#define SCALE_1_TO_1 0x10000L
|
||||
|
||||
#define GMON_MAGIC "gmon" /* Magic cookie. */
|
||||
#define GMON_VERSION 1 /* Version number. */
|
||||
|
||||
|
||||
/* General rounding functions. */
|
||||
#define ROUNDDOWN(x ,y) (((x) / (y)) * (y))
|
||||
#define ROUNDUP(x, y) ((((x) + (y) - 1) / (y)) * (y))
|
||||
|
||||
struct tostruct
|
||||
{
|
||||
unsigned long selfpc;
|
||||
unsigned long count;
|
||||
unsigned long link;
|
||||
};
|
||||
|
||||
/* Possible states of profiling. */
|
||||
enum profiling_state
|
||||
{
|
||||
GMON_PROF_OFF,
|
||||
GMON_PROF_ON,
|
||||
GMON_PROF_BUSY,
|
||||
GMON_PROF_ERROR
|
||||
};
|
||||
|
||||
/* The profiling data structures are housed in this structure. */
|
||||
struct gmonparam
|
||||
{
|
||||
enum profiling_state state;
|
||||
unsigned short * kcount;
|
||||
unsigned long kcountsize;
|
||||
unsigned long * froms;
|
||||
unsigned long fromssize;
|
||||
struct tostruct * tos;
|
||||
unsigned long tossize;
|
||||
long tolimit;
|
||||
unsigned long lowpc;
|
||||
unsigned long highpc;
|
||||
unsigned long textsize;
|
||||
unsigned long hashfraction;
|
||||
long log_hashfraction;
|
||||
};
|
||||
|
||||
/* Raw header as it appears in the gmon.out file (without padding).
|
||||
This header always comes first and is then followed by a series
|
||||
records defined below. */
|
||||
struct gmon_hdr
|
||||
{
|
||||
char cookie[4];
|
||||
char version[4];
|
||||
char spare[3 * 4];
|
||||
};
|
||||
|
||||
/* Types of records in this file. */
|
||||
typedef enum
|
||||
{
|
||||
GMON_TAG_TIME_HIST = 0,
|
||||
GMON_TAG_CG_ARC = 1,
|
||||
} GMON_Record_Tag;
|
||||
|
||||
struct gmon_cg_arc_record
|
||||
{
|
||||
char tag; /* Set to GMON_TAG_CG_ARC. */
|
||||
char from_pc[sizeof (char *)]; /* Address within caller's body. */
|
||||
char self_pc[sizeof (char *)]; /* Address within callee's body. */
|
||||
char count[4]; /* Number of arc traversals. */
|
||||
};
|
||||
|
||||
|
||||
/* Forward declarations. */
|
||||
void _mcount_internal (unsigned long);
|
||||
void _monstartup (unsigned long, unsigned long);
|
||||
void _mcleanup (void);
|
||||
|
||||
static struct gmonparam _gmonparam;
|
||||
|
||||
void
|
||||
_mcount_internal (unsigned long frompc)
|
||||
{
|
||||
unsigned long selfpc = frompc;
|
||||
unsigned long * frompcindex;
|
||||
struct tostruct * top;
|
||||
struct tostruct * prevtop;
|
||||
struct gmonparam * p;
|
||||
unsigned long toindex;
|
||||
int i;
|
||||
|
||||
p = & _gmonparam;
|
||||
|
||||
/* Check that we are profiling and that we aren't recursively invoked.
|
||||
NB/ This version is not thread-safe. */
|
||||
if (p->state != GMON_PROF_ON)
|
||||
return;
|
||||
p->state = GMON_PROF_BUSY;
|
||||
|
||||
/* Check that frompcindex is a reasonable pc value.
|
||||
For example: signal catchers get called from the stack,
|
||||
not from text space. Too bad. */
|
||||
frompc -= p->lowpc;
|
||||
if (frompc > p->textsize)
|
||||
goto done;
|
||||
|
||||
i = frompc >> p->log_hashfraction;
|
||||
|
||||
frompcindex = p->froms + i;
|
||||
toindex = * frompcindex;
|
||||
|
||||
if (toindex == 0)
|
||||
{
|
||||
/* First time traversing this arc. */
|
||||
toindex = ++ p->tos[0].link;
|
||||
if (toindex >= p->tolimit)
|
||||
/* Halt further profiling. */
|
||||
goto overflow;
|
||||
|
||||
* frompcindex = toindex;
|
||||
top = p->tos + toindex;
|
||||
top->selfpc = selfpc;
|
||||
top->count = 1;
|
||||
top->link = 0;
|
||||
goto done;
|
||||
}
|
||||
|
||||
top = p->tos + toindex;
|
||||
|
||||
if (top->selfpc == selfpc)
|
||||
{
|
||||
/* Arc at front of chain: usual case. */
|
||||
top->count ++;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Have to go looking down chain for it.
|
||||
Top points to what we are looking at,
|
||||
prevtop points to previous top.
|
||||
We know it is not at the head of the chain. */
|
||||
for (;;)
|
||||
{
|
||||
if (top->link == 0)
|
||||
{
|
||||
/* Top is end of the chain and none of the chain
|
||||
had top->selfpc == selfpc. So we allocate a
|
||||
new tostruct and link it to the head of the
|
||||
chain. */
|
||||
toindex = ++ p->tos[0].link;
|
||||
if (toindex >= p->tolimit)
|
||||
goto overflow;
|
||||
|
||||
top = p->tos + toindex;
|
||||
top->selfpc = selfpc;
|
||||
top->count = 1;
|
||||
top->link = * frompcindex;
|
||||
* frompcindex = toindex;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Otherwise, check the next arc on the chain. */
|
||||
prevtop = top;
|
||||
top = p->tos + top->link;
|
||||
|
||||
if (top->selfpc == selfpc)
|
||||
{
|
||||
/* There it is. Increment its count
|
||||
move it to the head of the chain. */
|
||||
top->count ++;
|
||||
toindex = prevtop->link;
|
||||
prevtop->link = top->link;
|
||||
top->link = * frompcindex;
|
||||
* frompcindex = toindex;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
p->state = GMON_PROF_ON;
|
||||
return;
|
||||
|
||||
overflow:
|
||||
p->state = GMON_PROF_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
_monstartup (unsigned long lowpc, unsigned long highpc)
|
||||
{
|
||||
char * cp;
|
||||
struct gmonparam * p = & _gmonparam;
|
||||
|
||||
/* If the calloc() function has been instrumented we must make sure
|
||||
that it is not profiled until we are ready. */
|
||||
p->state = GMON_PROF_BUSY;
|
||||
|
||||
/* Round lowpc and highpc to multiples of the density we're using
|
||||
so the rest of the scaling (here and in gprof) stays in ints. */
|
||||
p->lowpc = ROUNDDOWN (lowpc, HISTFRACTION * sizeof (* p->kcount));
|
||||
p->highpc = ROUNDUP (highpc, HISTFRACTION * sizeof (* p->kcount));
|
||||
p->textsize = p->highpc - p->lowpc;
|
||||
p->kcountsize = ROUNDUP (p->textsize / HISTFRACTION, sizeof (*p->froms));
|
||||
p->hashfraction = HASHFRACTION;
|
||||
p->log_hashfraction = -1;
|
||||
p->log_hashfraction = ffs (p->hashfraction * sizeof (*p->froms)) - 1;
|
||||
p->fromssize = p->textsize / HASHFRACTION;
|
||||
p->tolimit = p->textsize * ARCDENSITY / 100;
|
||||
|
||||
if (p->tolimit < MINARCS)
|
||||
p->tolimit = MINARCS;
|
||||
else if (p->tolimit > MAXARCS)
|
||||
p->tolimit = MAXARCS;
|
||||
|
||||
p->tossize = p->tolimit * sizeof (struct tostruct);
|
||||
|
||||
cp = calloc (p->kcountsize + p->fromssize + p->tossize, 1);
|
||||
if (cp == NULL)
|
||||
{
|
||||
write (2, "monstartup: out of memory\n", 26);
|
||||
p->tos = NULL;
|
||||
p->state = GMON_PROF_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
p->tos = (struct tostruct *) cp;
|
||||
cp += p->tossize;
|
||||
p->kcount = (unsigned short *) cp;
|
||||
cp += p->kcountsize;
|
||||
p->froms = (unsigned long *) cp;
|
||||
|
||||
p->tos[0].link = 0;
|
||||
p->state = GMON_PROF_ON;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
write_call_graph (int fd)
|
||||
{
|
||||
#define NARCS_PER_WRITE 32
|
||||
|
||||
struct gmon_cg_arc_record raw_arc[NARCS_PER_WRITE]
|
||||
__attribute__ ((aligned (__alignof__ (char *))));
|
||||
unsigned long from_index;
|
||||
unsigned long to_index;
|
||||
unsigned long from_len;
|
||||
unsigned long frompc;
|
||||
int nfilled;
|
||||
|
||||
for (nfilled = 0; nfilled < NARCS_PER_WRITE; ++ nfilled)
|
||||
raw_arc[nfilled].tag = GMON_TAG_CG_ARC;
|
||||
|
||||
nfilled = 0;
|
||||
from_len = _gmonparam.fromssize / sizeof (*_gmonparam.froms);
|
||||
|
||||
for (from_index = 0; from_index < from_len; ++from_index)
|
||||
{
|
||||
if (_gmonparam.froms[from_index] == 0)
|
||||
continue;
|
||||
|
||||
frompc = _gmonparam.lowpc;
|
||||
frompc += (from_index * _gmonparam.hashfraction
|
||||
* sizeof (*_gmonparam.froms));
|
||||
|
||||
for (to_index = _gmonparam.froms[from_index];
|
||||
to_index != 0;
|
||||
to_index = _gmonparam.tos[to_index].link)
|
||||
{
|
||||
struct gmon_cg_arc_record * arc = raw_arc + nfilled;
|
||||
|
||||
memcpy (arc->from_pc, & frompc, sizeof (arc->from_pc));
|
||||
memcpy (arc->self_pc, & _gmonparam.tos[to_index].selfpc, sizeof (arc->self_pc));
|
||||
memcpy (arc->count, & _gmonparam.tos[to_index].count, sizeof (arc->count));
|
||||
|
||||
if (++ nfilled == NARCS_PER_WRITE)
|
||||
{
|
||||
write (fd, raw_arc, sizeof raw_arc);
|
||||
nfilled = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nfilled > 0)
|
||||
write (fd, raw_arc, nfilled * sizeof (raw_arc[0]));
|
||||
}
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
static void
|
||||
write_gmon (void)
|
||||
{
|
||||
struct gmon_hdr ghdr __attribute__ ((aligned (__alignof__ (int))));
|
||||
int fd;
|
||||
|
||||
fd = open ("gmon.out", O_CREAT|O_TRUNC|O_WRONLY, 0666);
|
||||
if (fd < 0)
|
||||
{
|
||||
write (2, "_mcleanup: could not create gmon.out\n", 37);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Write gmon.out header: */
|
||||
memset (& ghdr, '\0', sizeof (ghdr));
|
||||
memcpy (ghdr.cookie, GMON_MAGIC, sizeof (ghdr.cookie));
|
||||
* (unsigned long *) ghdr.version = GMON_VERSION;
|
||||
write (fd, & ghdr, sizeof (ghdr));
|
||||
|
||||
/* We do not have histogram or basic block information,
|
||||
so we do not generate these parts of the gmon.out file. */
|
||||
|
||||
/* Write call-graph. */
|
||||
write_call_graph (fd);
|
||||
|
||||
close (fd);
|
||||
}
|
||||
|
||||
void
|
||||
_mcleanup (void)
|
||||
{
|
||||
if (_gmonparam.state != GMON_PROF_ERROR)
|
||||
{
|
||||
_gmonparam.state = GMON_PROF_OFF;
|
||||
write_gmon ();
|
||||
}
|
||||
|
||||
/* Free the memory. */
|
||||
if (_gmonparam.tos != NULL)
|
||||
{
|
||||
free (_gmonparam.tos);
|
||||
_gmonparam.tos = NULL;
|
||||
}
|
||||
}
|
35
open.S
35
open.S
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2011 Red Hat Incorporated.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
The name of Red Hat Incorporated may not be used to endorse
|
||||
or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rl78-sys.h"
|
||||
|
||||
ERR(open)
|
35
read.S
35
read.S
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2011 Red Hat Incorporated.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
The name of Red Hat Incorporated may not be used to endorse
|
||||
or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rl78-sys.h"
|
||||
|
||||
ERR(read)
|
224
rl78-sim.ld
224
rl78-sim.ld
|
@ -1,224 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2005,2008,2009,2011 Red Hat Incorporated.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
The name of Red Hat Incorporated may not be used to endorse
|
||||
or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
/* Default linker script, for normal executables */
|
||||
OUTPUT_ARCH(rl78)
|
||||
ENTRY(_start)
|
||||
|
||||
/* Do we need any of these for elf?
|
||||
__DYNAMIC = 0; */
|
||||
|
||||
/* This is for the simulator - 512k flash, 32k ram, no data flash */
|
||||
MEMORY {
|
||||
VEC (r) : ORIGIN = 0x00000, LENGTH = 0x00002
|
||||
IVEC (r) : ORIGIN = 0x00004, LENGTH = 0x0007c
|
||||
OPT (r) : ORIGIN = 0x000c0, LENGTH = 0x00004
|
||||
ROM (r) : ORIGIN = 0x000d8, LENGTH = 0x7ff28
|
||||
RAM (w) : ORIGIN = 0xf8000, LENGTH = 0x07ee0
|
||||
STACK (w) : ORIGIN = 0xffee0, LENGTH = 0x00002
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.vec :
|
||||
{
|
||||
*(.vec)
|
||||
} > VEC
|
||||
.ivec :
|
||||
{
|
||||
*(.ivec)
|
||||
} > IVEC
|
||||
.opt :
|
||||
{
|
||||
*(.opt)
|
||||
} > OPT
|
||||
|
||||
/* CubeSuite always starts at 0xd8. */
|
||||
.csstart : {
|
||||
*(.csstart)
|
||||
} > ROM
|
||||
|
||||
/* For code that must be in the first 64k, or could fill unused
|
||||
space below .rodata. */
|
||||
.lowtext : {
|
||||
*(.plt)
|
||||
*(.lowtext)
|
||||
} > ROM
|
||||
|
||||
.data : {
|
||||
. = ALIGN(2);
|
||||
PROVIDE (__datastart = .);
|
||||
|
||||
KEEP (*(.jcr))
|
||||
*(.data.rel.ro.local) *(.data.rel.ro*)
|
||||
*(.dynamic)
|
||||
|
||||
*(.data D .data.* .gnu.linkonce.d.*)
|
||||
KEEP (*(.gnu.linkonce.d.*personality*))
|
||||
SORT(CONSTRUCTORS)
|
||||
*(.data1)
|
||||
*(.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. */
|
||||
. = ALIGN(2);
|
||||
*(.sdata .sdata.* .gnu.linkonce.s.* D_2 D_1)
|
||||
|
||||
. = ALIGN(2);
|
||||
_edata = .;
|
||||
PROVIDE (edata = .);
|
||||
PROVIDE (__dataend = .);
|
||||
} > RAM AT> ROM
|
||||
|
||||
/* Note that crt0 assumes this is a multiple of two; all the
|
||||
start/stop symbols are also assumed word-aligned. */
|
||||
PROVIDE(__romdatastart = LOADADDR(.data));
|
||||
PROVIDE (__romdatacopysize = SIZEOF(.data));
|
||||
|
||||
.bss : {
|
||||
. = ALIGN(2);
|
||||
PROVIDE (__bssstart = .);
|
||||
*(.dynbss)
|
||||
*(.sbss .sbss.*)
|
||||
*(.bss B B_2 B_1 .bss.* .gnu.linkonce.b.*)
|
||||
. = ALIGN(2);
|
||||
*(COMMON)
|
||||
. = ALIGN(2);
|
||||
PROVIDE (__bssend = .);
|
||||
_end = .;
|
||||
PROVIDE (end = .);
|
||||
} > RAM
|
||||
PROVIDE (__bsssize = SIZEOF(.bss));
|
||||
|
||||
.stack (ORIGIN (STACK)) :
|
||||
{
|
||||
PROVIDE (__stack = .);
|
||||
*(.stack)
|
||||
}
|
||||
|
||||
.rodata (MAX(__romdatastart + __romdatacopysize, 0x1000)) : {
|
||||
. = ALIGN(2);
|
||||
*(.plt)
|
||||
*(.rodata C C_2 C_1 .rodata.* .gnu.linkonce.r.*)
|
||||
*(.rodata1)
|
||||
*(.eh_frame_hdr)
|
||||
KEEP (*(.eh_frame))
|
||||
KEEP (*(.gcc_except_table)) *(.gcc_except_table.*)
|
||||
PROVIDE (__preinit_array_start = .);
|
||||
KEEP (*(.preinit_array))
|
||||
PROVIDE (__preinit_array_end = .);
|
||||
PROVIDE (__init_array_start = .);
|
||||
KEEP (*(SORT(.init_array.*)))
|
||||
KEEP (*(.init_array))
|
||||
PROVIDE (__init_array_end = .);
|
||||
PROVIDE (__fini_array_start = .);
|
||||
KEEP (*(.fini_array))
|
||||
KEEP (*(SORT(.fini_array.*)))
|
||||
PROVIDE (__fini_array_end = .);
|
||||
LONG(0); /* Sentinel. */
|
||||
|
||||
/* 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))
|
||||
|
||||
KEEP (*crtbegin*.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*(.dtors))
|
||||
} > ROM
|
||||
|
||||
.text :
|
||||
{
|
||||
PROVIDE (_start = .);
|
||||
*(.text P .stub .text.* .gnu.linkonce.t.*)
|
||||
KEEP (*(.text.*personality*))
|
||||
/* .gnu.warning sections are handled specially by elf32.em. */
|
||||
*(.gnu.warning)
|
||||
*(.interp .hash .dynsym .dynstr .gnu.version*)
|
||||
PROVIDE (__etext = .);
|
||||
PROVIDE (_etext = .);
|
||||
PROVIDE (etext = .);
|
||||
. = ALIGN(2);
|
||||
KEEP (*(.init))
|
||||
KEEP (*(.fini))
|
||||
} > ROM
|
||||
|
||||
/* The rest are all not normally part of the runtime image. */
|
||||
|
||||
/* 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) }
|
||||
/DISCARD/ : { *(.note.GNU-stack) }
|
||||
}
|
57
sbrk.c
57
sbrk.c
|
@ -1,57 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2005, 2009 Red Hat Incorporated.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
The name of Red Hat Incorporated may not be used to endorse
|
||||
or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
char *
|
||||
_sbrk (int adj)
|
||||
{
|
||||
extern char end;
|
||||
static char * heap = & end;
|
||||
char * rv = heap;
|
||||
char * heaptop = (char *) &adj;
|
||||
|
||||
heap += adj;
|
||||
|
||||
/* The allocated chunk spans our stack? */
|
||||
if (rv < heaptop && heap > heaptop
|
||||
/* The allocated chunk spans our address space? */
|
||||
|| heap < rv)
|
||||
{
|
||||
errno = ENOMEM;
|
||||
return (char *) -1;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
char * sbrk (int) __attribute__((weak, alias ("_sbrk")));
|
35
stat.S
35
stat.S
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2011 Red Hat Incorporated.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
The name of Red Hat Incorporated may not be used to endorse
|
||||
or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rl78-sys.h"
|
||||
|
||||
ERR(stat)
|
35
time.S
35
time.S
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2011 Red Hat Incorporated.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
The name of Red Hat Incorporated may not be used to endorse
|
||||
or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rl78-sys.h"
|
||||
|
||||
ERR(time)
|
35
times.S
35
times.S
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2011 Red Hat Incorporated.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
The name of Red Hat Incorporated may not be used to endorse
|
||||
or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rl78-sys.h"
|
||||
|
||||
ERR(times)
|
35
unlink.S
35
unlink.S
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2011 Red Hat Incorporated.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
The name of Red Hat Incorporated may not be used to endorse
|
||||
or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rl78-sys.h"
|
||||
|
||||
ERR(unlink)
|
35
utime.S
35
utime.S
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2011 Red Hat Incorporated.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
The name of Red Hat Incorporated may not be used to endorse
|
||||
or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rl78-sys.h"
|
||||
|
||||
ERR(utime)
|
107
write.c
107
write.c
|
@ -1,107 +0,0 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2010 Red Hat Incorporated.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
The name of Red Hat Incorporated may not be used to endorse
|
||||
or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
/* These definitions are for the RL78/G13, which the simulator
|
||||
simulates. */
|
||||
|
||||
typedef unsigned char UQI __attribute__((mode(QI)));
|
||||
typedef unsigned int UHI __attribute__((mode(HI)));
|
||||
|
||||
#define s8(x) (*(volatile UQI *)(x))
|
||||
#define s16(x) (*(volatile UHI *)(x))
|
||||
|
||||
#define P(x) s8(0xfff00+(x))
|
||||
#define PM(x) s8(0xfff20+(x))
|
||||
|
||||
#define PER0 s8(0xf00f0)
|
||||
|
||||
#define SSR00 s16(0xf0100)
|
||||
#define SMR00 s16(0xf0110)
|
||||
#define SCR00 s16(0xf0118)
|
||||
#define SS0 s16(0xf0122)
|
||||
#define SPS0 s16(0xf0126)
|
||||
#define SO0 s16(0xf0128)
|
||||
#define SOE0 s16(0xf012a)
|
||||
#define SOL0 s16(0xf0134)
|
||||
|
||||
#define SDR00 s16(0xfff10)
|
||||
|
||||
static int initted = 0;
|
||||
|
||||
static void
|
||||
init_uart0 ()
|
||||
{
|
||||
initted = 1;
|
||||
|
||||
PER0 = 0xff;
|
||||
SPS0 = 0x0011; /* 16 MHz */
|
||||
SMR00 = 0x0022; /* uart mode */
|
||||
SCR00 = 0x8097; /* 8-N-1 */
|
||||
SDR00 = 0x8a00; /* baud in MSB - 115200 */
|
||||
SOL0 = 0x0000; /* not inverted */
|
||||
SO0 = 0x000f; /* initial value */
|
||||
SOE0 = 0x0001; /* enable TxD0 */
|
||||
P(1) |= 0b00000100;
|
||||
PM(1) &= 0b11111011;
|
||||
SS0 = 0x0001;
|
||||
}
|
||||
|
||||
static void
|
||||
tputc (char c)
|
||||
{
|
||||
/* Wait for transmit buffer to be empty. */
|
||||
while (SSR00 & 0x0020)
|
||||
asm("");
|
||||
/* Transmit that byte. */
|
||||
SDR00 = c;
|
||||
}
|
||||
|
||||
int
|
||||
_write(int fd, char *ptr, int len)
|
||||
{
|
||||
int rv = len;
|
||||
|
||||
if (!initted)
|
||||
init_uart0 ();
|
||||
|
||||
while (len != 0)
|
||||
{
|
||||
if (*ptr == '\n')
|
||||
tputc ('\r');
|
||||
tputc (*ptr);
|
||||
ptr ++;
|
||||
len --;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
char * write (int) __attribute__((weak, alias ("_write")));
|
Loading…
Reference in a new issue