20000317 sourceware import
This commit is contained in:
142
libgloss/mcore/Makefile.in
Normal file
142
libgloss/mcore/Makefile.in
Normal file
@ -0,0 +1,142 @@
|
||||
#
|
||||
#
|
||||
|
||||
VPATH = @srcdir@ @srcdir@/..
|
||||
srcdir = @srcdir@
|
||||
objdir = .
|
||||
srcroot = $(srcdir)/../..
|
||||
objroot = $(objdir)/../..
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
host_alias = @host_alias@
|
||||
target_alias = @target_alias@
|
||||
|
||||
bindir = @bindir@
|
||||
libdir = @libdir@
|
||||
tooldir = $(exec_prefix)/$(target_alias)
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
# Multilib support variables.
|
||||
# TOP is used instead of MULTI{BUILD,SRC}TOP.
|
||||
MULTIDIRS =
|
||||
MULTISUBDIR =
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
CC = @CC@
|
||||
|
||||
AS = @AS@
|
||||
AR = @AR@
|
||||
LD = @LD@
|
||||
RANLIB = @RANLIB@
|
||||
|
||||
OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \
|
||||
then echo ${objroot}/../binutils/objdump ; \
|
||||
else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi`
|
||||
OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \
|
||||
then echo ${objroot}/../binutils/objcopy ; \
|
||||
else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi`
|
||||
|
||||
OBJS = fstat.o getpid.o isatty.o kill.o raise.o putnum.o stat.o unlink.o
|
||||
CFLAGS = -g
|
||||
SCRIPTS =
|
||||
|
||||
# Here is all of the simulator stuff
|
||||
SIM_SCRIPTS =
|
||||
SIM_LDFLAGS =
|
||||
SIM_BSP = libsim.a
|
||||
SIM_CRT0 = crt0.o
|
||||
SIM_OBJS = syscalls.o
|
||||
SIM_TEST = sim-test
|
||||
SIM_INSTALL = install-sim
|
||||
|
||||
# Here is all of the picobug on cmb stuff
|
||||
MON_PREFIX = @bsp_prefix@
|
||||
MON_LDFLAGS =
|
||||
MON_BSP = libcmb.a
|
||||
MON_CRT0 = crt0.o
|
||||
MON_OBJS = open.o close.o lseek.o sbrk.o read.o write.o print.o cmb-exit.o cmb-inbyte.o cmb-outbyte.o
|
||||
MON_SCRIPTS = cmb.ld cmb.specs
|
||||
MON_TEST =
|
||||
MON_INSTALL = install-mon
|
||||
|
||||
# Host specific makefile fragment comes in here.
|
||||
@host_makefile_frag@
|
||||
|
||||
#
|
||||
# build a test program for each target board. Just trying to get
|
||||
# it to link is a good test, so we ignore all the errors for now.
|
||||
#
|
||||
all: ${SIM_CRT0} ${SIM_BSP} ${MON_BSP}
|
||||
|
||||
#
|
||||
# here's where we build the board support packages for each target
|
||||
#
|
||||
${SIM_BSP}: ${OBJS} ${SIM_OBJS}
|
||||
${AR} ${ARFLAGS} ${SIM_BSP} ${SIM_OBJS} ${OBJS}
|
||||
${RANLIB} ${SIM_BSP}
|
||||
|
||||
${MON_BSP}: ${OBJS} ${MON_OBJS}
|
||||
${AR} ${ARFLAGS} ${MON_BSP} ${MON_OBJS} ${OBJS}
|
||||
${RANLIB} ${MON_BSP}
|
||||
|
||||
#
|
||||
# here's where we build the test programs for each target
|
||||
#
|
||||
.PHONY: test
|
||||
test: ${SIM_TEST} ${MON_TEST}
|
||||
|
||||
sim-test: sim-test.x sim-test.dis
|
||||
|
||||
sim-test.x: test.o ${SIM_CRT0} ${SIM_BSP}
|
||||
${CC} ${LDFLAGS_FOR_TARGET} -L${objdir} \
|
||||
${SIM_CRT0} test.o \
|
||||
-o sim-test.x ${LIBS_FOR_TARGET} -lc ${SIM_BSP}
|
||||
|
||||
sim-test.dis: sim-test.x
|
||||
${OBJDUMP} -d sim-test.x > sim-test.dis
|
||||
|
||||
|
||||
#
|
||||
#
|
||||
#
|
||||
.c.S:
|
||||
${CC} ${CFLAGS_FOR_TARGET} $(INCLUDES) $(CFLAGS) -c $<
|
||||
|
||||
simulator.o: simulator.S
|
||||
sim-crt0.o: sim-crt0.S
|
||||
cmb-exit.o: cmb-exit.c
|
||||
cmb-inbyte.o: cmb-inbyte.c
|
||||
cmb-outbyte.o: cmb-outbyte.c
|
||||
|
||||
clean mostlyclean:
|
||||
rm -f a.out core *.i *.o *-test *.srec *.dis *.x $(SIM_BSP) $(MON_BSP)
|
||||
|
||||
distclean maintainer-clean realclean: clean
|
||||
rm -f Makefile config.status *~
|
||||
|
||||
.PHONY: install info install-info clean-info
|
||||
install: ${SIM_INSTALL} ${MON_INSTALL}
|
||||
|
||||
install-mon:
|
||||
set -e; for x in ${MON_CRT0} ${MON_BSP}; do ${INSTALL_DATA} $$x ${tooldir}/lib${MULTISUBDIR}/$$x; done
|
||||
set -e; for x in ${MON_SCRIPTS}; do ${INSTALL_DATA} ${srcdir}/${MON_PREFIX}$$x ${tooldir}/lib${MULTISUBDIR}/$$x; done
|
||||
|
||||
install-sim:
|
||||
set -e; for x in ${SIM_CRT0} ${SIM_BSP} ${SIM_SCRIPTS}; do ${INSTALL_DATA} $$x ${tooldir}/lib${MULTISUBDIR}/$$x; done
|
||||
|
||||
doc:
|
||||
info:
|
||||
install-info:
|
||||
clean-info:
|
||||
|
||||
Makefile: Makefile.in config.status @host_makefile_frag_path@
|
||||
$(SHELL) config.status
|
||||
|
||||
config.status: configure
|
||||
$(SHELL) config.status --recheck
|
25
libgloss/mcore/close.c
Normal file
25
libgloss/mcore/close.c
Normal file
@ -0,0 +1,25 @@
|
||||
/* close.c -- close a file descriptor.
|
||||
*
|
||||
* Copyright (c) 1995, 1999 Cygnus Support
|
||||
*
|
||||
* The authors hereby grant permission to use, copy, modify, distribute,
|
||||
* and license this software and its documentation for any purpose, provided
|
||||
* that existing copyright notices are retained in all copies and that this
|
||||
* notice is included verbatim in any distributions. No written agreement,
|
||||
* license, or royalty fee is required for any of the authorized uses.
|
||||
* Modifications to this software may be copyrighted by their authors
|
||||
* and need not follow the licensing terms described here, provided that
|
||||
* the new terms are clearly indicated on the first page of each file where
|
||||
* they apply.
|
||||
*/
|
||||
#include "glue.h"
|
||||
|
||||
/*
|
||||
* close -- We don't need to do anything, but pretend we did.
|
||||
*/
|
||||
int
|
||||
_DEFUN (_close ,(fd),
|
||||
int fd)
|
||||
{
|
||||
return (0);
|
||||
}
|
27
libgloss/mcore/cmb-exit.c
Normal file
27
libgloss/mcore/cmb-exit.c
Normal file
@ -0,0 +1,27 @@
|
||||
/* cmb-exit.c -- exit trap binding.
|
||||
*
|
||||
* Copyright (c) 1999 Cygnus Support
|
||||
*
|
||||
* The authors hereby grant permission to use, copy, modify, distribute,
|
||||
* and license this software and its documentation for any purpose, provided
|
||||
* that existing copyright notices are retained in all copies and that this
|
||||
* notice is included verbatim in any distributions. No written agreement,
|
||||
* license, or royalty fee is required for any of the authorized uses.
|
||||
* Modifications to this software may be copyrighted by their authors
|
||||
* and need not follow the licensing terms described here, provided that
|
||||
* the new terms are clearly indicated on the first page of each file where
|
||||
* they apply.
|
||||
*/
|
||||
#include <_ansi.h>
|
||||
|
||||
/*
|
||||
* _exit -- Just cause a breakpoint so user can see why we exited.
|
||||
*/
|
||||
void
|
||||
_DEFUN (_exit, (val),
|
||||
int val)
|
||||
{
|
||||
while (1) {
|
||||
asm("bkpt");
|
||||
}
|
||||
}
|
24
libgloss/mcore/cmb-inbyte.c
Normal file
24
libgloss/mcore/cmb-inbyte.c
Normal file
@ -0,0 +1,24 @@
|
||||
/* cmb-inbyte.c -- inbyte function for CMB1200 eval board.
|
||||
*
|
||||
* Copyright (c) 1999 Cygnus Support
|
||||
*
|
||||
* The authors hereby grant permission to use, copy, modify, distribute,
|
||||
* and license this software and its documentation for any purpose, provided
|
||||
* that existing copyright notices are retained in all copies and that this
|
||||
* notice is included verbatim in any distributions. No written agreement,
|
||||
* license, or royalty fee is required for any of the authorized uses.
|
||||
* Modifications to this software may be copyrighted by their authors
|
||||
* and need not follow the licensing terms described here, provided that
|
||||
* the new terms are clearly indicated on the first page of each file where
|
||||
* they apply.
|
||||
*/
|
||||
#include <_ansi.h>
|
||||
|
||||
int
|
||||
_DEFUN (inbyte, (),
|
||||
_NOARGS)
|
||||
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
46
libgloss/mcore/cmb-outbyte.c
Normal file
46
libgloss/mcore/cmb-outbyte.c
Normal file
@ -0,0 +1,46 @@
|
||||
/* cmb-outbyte.c -- outbyte function for CMB1200 eval board.
|
||||
*
|
||||
* Copyright (c) 1999 Cygnus Support
|
||||
*
|
||||
* The authors hereby grant permission to use, copy, modify, distribute,
|
||||
* and license this software and its documentation for any purpose, provided
|
||||
* that existing copyright notices are retained in all copies and that this
|
||||
* notice is included verbatim in any distributions. No written agreement,
|
||||
* license, or royalty fee is required for any of the authorized uses.
|
||||
* Modifications to this software may be copyrighted by their authors
|
||||
* and need not follow the licensing terms described here, provided that
|
||||
* the new terms are clearly indicated on the first page of each file where
|
||||
* they apply.
|
||||
*/
|
||||
#include <_ansi.h>
|
||||
|
||||
#define _TX 0x40
|
||||
#define _SR 0x86
|
||||
|
||||
#define UART0_BASE 0x10009000
|
||||
#define UART1_BASE 0x1000a000
|
||||
|
||||
#define UART_BASE UART0_BASE
|
||||
|
||||
#define TXREG ((volatile unsigned short *)(UART_BASE + _TX))
|
||||
#define SRREG ((volatile unsigned short *)(UART_BASE + _SR))
|
||||
|
||||
#define TRDY 0x2000
|
||||
|
||||
#define GDB_QUOTE_CHAR 15 /* ^O */
|
||||
|
||||
/*
|
||||
* outbyte -- send a byte to the UART.
|
||||
*/
|
||||
void
|
||||
_DEFUN (outbyte, (ch),
|
||||
char ch)
|
||||
{
|
||||
while (!(*SRREG & TRDY))
|
||||
;
|
||||
*TXREG = GDB_QUOTE_CHAR;
|
||||
|
||||
while (!(*SRREG & TRDY))
|
||||
;
|
||||
*TXREG = (unsigned short)ch;
|
||||
}
|
1206
libgloss/mcore/configure
vendored
Executable file
1206
libgloss/mcore/configure
vendored
Executable file
File diff suppressed because it is too large
Load Diff
100
libgloss/mcore/configure.in
Normal file
100
libgloss/mcore/configure.in
Normal file
@ -0,0 +1,100 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_PREREQ(2.5)dnl
|
||||
AC_INIT(crt0.S)
|
||||
|
||||
if test "${enable_shared}" = "yes" ; then
|
||||
echo "Shared libraries not supported for cross compiling, ignored"
|
||||
fi
|
||||
|
||||
if test "$srcdir" = "." ; then
|
||||
if test "${with_target_subdir}" != "." ; then
|
||||
libgloss_topdir="${srcdir}/${with_multisrctop}../../.."
|
||||
else
|
||||
libgloss_topdir="${srcdir}/${with_multisrctop}../.."
|
||||
fi
|
||||
else
|
||||
libgloss_topdir="${srcdir}/../.."
|
||||
fi
|
||||
AC_CONFIG_AUX_DIR($libgloss_topdir)
|
||||
|
||||
AC_CANONICAL_SYSTEM
|
||||
AC_ARG_PROGRAM
|
||||
|
||||
AC_PROG_INSTALL
|
||||
|
||||
# FIXME: We temporarily define our own version of AC_PROG_CC. This is
|
||||
# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
|
||||
# are probably using a cross compiler, which will not be able to fully
|
||||
# link an executable. This should really be fixed in autoconf
|
||||
# itself.
|
||||
|
||||
AC_DEFUN(LIB_AC_PROG_CC,
|
||||
[AC_BEFORE([$0], [AC_PROG_CPP])dnl
|
||||
AC_CHECK_PROG(CC, gcc, gcc)
|
||||
if test -z "$CC"; then
|
||||
AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
|
||||
test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
|
||||
fi
|
||||
|
||||
AC_PROG_CC_GNU
|
||||
|
||||
if test $ac_cv_prog_gcc = yes; then
|
||||
GCC=yes
|
||||
dnl Check whether -g works, even if CFLAGS is set, in case the package
|
||||
dnl plays around with CFLAGS (such as to build both debugging and
|
||||
dnl normal versions of a library), tasteless as that idea is.
|
||||
ac_test_CFLAGS="${CFLAGS+set}"
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
CFLAGS=
|
||||
AC_PROG_CC_G
|
||||
if test "$ac_test_CFLAGS" = set; then
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
elif test $ac_cv_prog_cc_g = yes; then
|
||||
CFLAGS="-g -O2"
|
||||
else
|
||||
CFLAGS="-O2"
|
||||
fi
|
||||
else
|
||||
GCC=
|
||||
test "${CFLAGS+set}" = set || CFLAGS="-g"
|
||||
fi
|
||||
])
|
||||
|
||||
LIB_AC_PROG_CC
|
||||
AS=${AS-as}
|
||||
AC_SUBST(AS)
|
||||
AR=${AR-ar}
|
||||
AC_SUBST(AR)
|
||||
LD=${LD-ld}
|
||||
AC_SUBST(LD)
|
||||
AC_PROG_RANLIB
|
||||
|
||||
case "${target}" in
|
||||
mcore-*-elf)
|
||||
bsp_prefix=elf-
|
||||
;;
|
||||
mcore-*-pe)
|
||||
bsp_prefix=pe-
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_SUBST(bsp_prefix)
|
||||
|
||||
host_makefile_frag=${srcdir}/../config/default.mh
|
||||
|
||||
dnl We have to assign the same value to other variables because autoconf
|
||||
dnl doesn't provide a mechanism to substitute a replacement keyword with
|
||||
dnl arbitrary data or pathnames.
|
||||
dnl
|
||||
host_makefile_frag_path=$host_makefile_frag
|
||||
AC_SUBST(host_makefile_frag_path)
|
||||
AC_SUBST_FILE(host_makefile_frag)
|
||||
|
||||
AC_OUTPUT(Makefile,
|
||||
. ${libgloss_topdir}/config-ml.in,
|
||||
srcdir=${srcdir}
|
||||
target=${target}
|
||||
ac_configure_args="${ac_configure_args} --enable-multilib"
|
||||
CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
|
||||
libgloss_topdir=${libgloss_topdir}
|
||||
)
|
49
libgloss/mcore/crt0.S
Normal file
49
libgloss/mcore/crt0.S
Normal file
@ -0,0 +1,49 @@
|
||||
// MCore StartUp Code.
|
||||
|
||||
.import main
|
||||
.import exit
|
||||
|
||||
.text
|
||||
.export _start
|
||||
_start:
|
||||
.export _mainCRTStartup
|
||||
_mainCRTStartup:
|
||||
// Initialise the stack pointer
|
||||
lrw r1, _stack
|
||||
mov r0, r1
|
||||
|
||||
// Zero the .bss data space
|
||||
lrw r1, __bss_start__
|
||||
lrw r2, __bss_end__
|
||||
movi r3, 0
|
||||
.L0:
|
||||
st r3, (r1, 0)
|
||||
addi r1, 4
|
||||
cmphs r1, r2
|
||||
bf .L0
|
||||
#ifdef __ELF__
|
||||
// Call the global/static constructors
|
||||
jbsr _init
|
||||
|
||||
// Setup destructors to be called from exit,
|
||||
// just in case main never returns...
|
||||
lrw r2, _fini
|
||||
jbsr atexit
|
||||
#endif
|
||||
|
||||
// Initialise the parameters to main()
|
||||
movi r2, 0 // argc
|
||||
movi r3, 0 // argv
|
||||
movi r4, 0 // envp
|
||||
|
||||
// Call main
|
||||
jbsr main
|
||||
|
||||
// Call exit
|
||||
movi r2, 0
|
||||
jbsr exit
|
||||
|
||||
// We should never reach here.
|
||||
bkpt
|
||||
|
||||
|
190
libgloss/mcore/elf-cmb.ld
Normal file
190
libgloss/mcore/elf-cmb.ld
Normal file
@ -0,0 +1,190 @@
|
||||
OUTPUT_FORMAT("elf32-mcore-big", "elf32-mcore-big",
|
||||
"elf32-mcore-little")
|
||||
OUTPUT_ARCH(mcore)
|
||||
GROUP(-lc -lcmb -lgcc)
|
||||
ENTRY(_start)
|
||||
/* Do we need any of these for elf?
|
||||
__DYNAMIC = 0; */
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
. = 0x2f000000;
|
||||
.interp : { *(.interp) }
|
||||
.hash : { *(.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.gnu.version : { *(.gnu.version) }
|
||||
.gnu.version_d : { *(.gnu.version_d) }
|
||||
.gnu.version_r : { *(.gnu.version_r) }
|
||||
.rel.text :
|
||||
{
|
||||
*(.rel.text)
|
||||
*(.rel.text.*)
|
||||
*(.rel.gnu.linkonce.t*)
|
||||
}
|
||||
.rela.text :
|
||||
{
|
||||
*(.rela.text)
|
||||
*(.rela.text.*)
|
||||
*(.rela.gnu.linkonce.t*)
|
||||
}
|
||||
.rel.data :
|
||||
{
|
||||
*(.rel.data)
|
||||
*(.rel.data.*)
|
||||
*(.rel.gnu.linkonce.d*)
|
||||
}
|
||||
.rela.data :
|
||||
{
|
||||
*(.rela.data)
|
||||
*(.rela.data.*)
|
||||
*(.rela.gnu.linkonce.d*)
|
||||
}
|
||||
.rel.rodata :
|
||||
{
|
||||
*(.rel.rodata)
|
||||
*(.rel.rodata.*)
|
||||
*(.rel.gnu.linkonce.r*)
|
||||
}
|
||||
.rela.rodata :
|
||||
{
|
||||
*(.rela.rodata)
|
||||
*(.rela.rodata.*)
|
||||
*(.rela.gnu.linkonce.r*)
|
||||
}
|
||||
.rel.got : { *(.rel.got) }
|
||||
.rela.got : { *(.rela.got) }
|
||||
.rel.ctors : { *(.rel.ctors) }
|
||||
.rela.ctors : { *(.rela.ctors) }
|
||||
.rel.dtors : { *(.rel.dtors) }
|
||||
.rela.dtors : { *(.rela.dtors) }
|
||||
.rel.init : { *(.rel.init) }
|
||||
.rela.init : { *(.rela.init) }
|
||||
.rel.fini : { *(.rel.fini) }
|
||||
.rela.fini : { *(.rela.fini) }
|
||||
.rel.bss : { *(.rel.bss) }
|
||||
.rela.bss : { *(.rela.bss) }
|
||||
.rel.plt : { *(.rel.plt) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
.init : { KEEP (*(.init)) } =0x0e0e
|
||||
.plt : { *(.plt) }
|
||||
.text :
|
||||
{
|
||||
*(.text)
|
||||
*(.text.*)
|
||||
*(.stub)
|
||||
/* .gnu.warning sections are handled specially by elf32.em. */
|
||||
*(.gnu.warning)
|
||||
*(.gnu.linkonce.t*)
|
||||
} =0x0e0e
|
||||
_etext = .;
|
||||
PROVIDE (etext = .);
|
||||
.fini : { KEEP (*(.fini)) } =0x0e0e
|
||||
.rodata :
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata.*)
|
||||
*(.gnu.linkonce.r*)
|
||||
}
|
||||
.rodata1 : { *(.rodata1) }
|
||||
/* Adjust the address for the data segment. We want to adjust up to
|
||||
the same address within the page on the next page up. */
|
||||
. = ALIGN(0x1000) + (. & (0x1000 - 1));
|
||||
.data :
|
||||
{
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.gnu.linkonce.d*)
|
||||
SORT(CONSTRUCTORS)
|
||||
}
|
||||
.data1 : { *(.data1) }
|
||||
.eh_frame : { *(.eh_frame) }
|
||||
.gcc_except_table : { *(.gcc_except_table) }
|
||||
.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))
|
||||
}
|
||||
.dtors :
|
||||
{
|
||||
KEEP (*crtbegin.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*(.dtors))
|
||||
}
|
||||
.got : { *(.got.plt) *(.got) }
|
||||
.dynamic : { *(.dynamic) }
|
||||
/* 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.*) }
|
||||
_edata = .;
|
||||
PROVIDE (edata = .);
|
||||
__bss_start = .;
|
||||
__bss_start__ = . ;
|
||||
.sbss : { *(.sbss) *(.scommon) }
|
||||
.bss :
|
||||
{
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(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 = . ;
|
||||
__bss_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) }
|
||||
.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) }
|
||||
.stack 0x2f0ffffc : { _stack = .; *(.stack) }
|
||||
/* These must appear regardless of . */
|
||||
}
|
3
libgloss/mcore/elf-cmb.specs
Normal file
3
libgloss/mcore/elf-cmb.specs
Normal file
@ -0,0 +1,3 @@
|
||||
*endfile:
|
||||
-Tcmb.ld crtend.o%s crtn.o%s
|
||||
|
30
libgloss/mcore/fstat.c
Normal file
30
libgloss/mcore/fstat.c
Normal file
@ -0,0 +1,30 @@
|
||||
/* fstat.c -- get status of a file.
|
||||
*
|
||||
* Copyright (c) 1995, 1999 Cygnus Support
|
||||
*
|
||||
* The authors hereby grant permission to use, copy, modify, distribute,
|
||||
* and license this software and its documentation for any purpose, provided
|
||||
* that existing copyright notices are retained in all copies and that this
|
||||
* notice is included verbatim in any distributions. No written agreement,
|
||||
* license, or royalty fee is required for any of the authorized uses.
|
||||
* Modifications to this software may be copyrighted by their authors
|
||||
* and need not follow the licensing terms described here, provided that
|
||||
* the new terms are clearly indicated on the first page of each file where
|
||||
* they apply.
|
||||
*/
|
||||
#include <sys/stat.h>
|
||||
#include "glue.h"
|
||||
|
||||
/*
|
||||
* fstat -- Since we have no file system, we just return an error.
|
||||
*/
|
||||
int
|
||||
_DEFUN (_fstat, (fd, buf),
|
||||
int fd _AND
|
||||
struct stat *buf)
|
||||
{
|
||||
buf->st_mode = S_IFCHR; /* Always pretend to be a tty */
|
||||
buf->st_blksize = 0;
|
||||
|
||||
return (0);
|
||||
}
|
25
libgloss/mcore/getpid.c
Normal file
25
libgloss/mcore/getpid.c
Normal file
@ -0,0 +1,25 @@
|
||||
/* getpid.c -- get the current process id.
|
||||
*
|
||||
* Copyright (c) 1995, 1999 Cygnus Support
|
||||
*
|
||||
* The authors hereby grant permission to use, copy, modify, distribute,
|
||||
* and license this software and its documentation for any purpose, provided
|
||||
* that existing copyright notices are retained in all copies and that this
|
||||
* notice is included verbatim in any distributions. No written agreement,
|
||||
* license, or royalty fee is required for any of the authorized uses.
|
||||
* Modifications to this software may be copyrighted by their authors
|
||||
* and need not follow the licensing terms described here, provided that
|
||||
* the new terms are clearly indicated on the first page of each file where
|
||||
* they apply.
|
||||
*/
|
||||
#include "glue.h"
|
||||
|
||||
/*
|
||||
* getpid -- only one process, so just return 1.
|
||||
*/
|
||||
int
|
||||
_DEFUN (_getpid, (),
|
||||
)
|
||||
{
|
||||
return __MYPID;
|
||||
}
|
28
libgloss/mcore/kill.c
Normal file
28
libgloss/mcore/kill.c
Normal file
@ -0,0 +1,28 @@
|
||||
/* kill.c -- remove a process.
|
||||
*
|
||||
* Copyright (c) 1995, 1999 Cygnus Support
|
||||
*
|
||||
* The authors hereby grant permission to use, copy, modify, distribute,
|
||||
* and license this software and its documentation for any purpose, provided
|
||||
* that existing copyright notices are retained in all copies and that this
|
||||
* notice is included verbatim in any distributions. No written agreement,
|
||||
* license, or royalty fee is required for any of the authorized uses.
|
||||
* Modifications to this software may be copyrighted by their authors
|
||||
* and need not follow the licensing terms described here, provided that
|
||||
* the new terms are clearly indicated on the first page of each file where
|
||||
* they apply.
|
||||
*/
|
||||
#include "glue.h"
|
||||
|
||||
/*
|
||||
* kill -- go out via exit...
|
||||
*/
|
||||
int
|
||||
_DEFUN (_kill, (pid, sig),
|
||||
int pid _AND
|
||||
int sig)
|
||||
{
|
||||
if(pid == __MYPID)
|
||||
_exit(sig);
|
||||
return 0;
|
||||
}
|
31
libgloss/mcore/lseek.c
Normal file
31
libgloss/mcore/lseek.c
Normal file
@ -0,0 +1,31 @@
|
||||
/* lseek.c -- move read/write pointer.
|
||||
*
|
||||
* Copyright (c) 1995, 1999 Cygnus Support
|
||||
*
|
||||
* The authors hereby grant permission to use, copy, modify, distribute,
|
||||
* and license this software and its documentation for any purpose, provided
|
||||
* that existing copyright notices are retained in all copies and that this
|
||||
* notice is included verbatim in any distributions. No written agreement,
|
||||
* license, or royalty fee is required for any of the authorized uses.
|
||||
* Modifications to this software may be copyrighted by their authors
|
||||
* and need not follow the licensing terms described here, provided that
|
||||
* the new terms are clearly indicated on the first page of each file where
|
||||
* they apply.
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
#include "glue.h"
|
||||
|
||||
/*
|
||||
* lseek -- Since a serial port is non-seekable, we return an error.
|
||||
*/
|
||||
off_t
|
||||
_DEFUN (_lseek, (fd, offset, whence),
|
||||
int fd _AND
|
||||
off_t offset _AND
|
||||
int whence)
|
||||
{
|
||||
errno = ESPIPE;
|
||||
return ((off_t)-1);
|
||||
}
|
||||
|
30
libgloss/mcore/open.c
Normal file
30
libgloss/mcore/open.c
Normal file
@ -0,0 +1,30 @@
|
||||
/* open.c -- open a file.
|
||||
*
|
||||
* Copyright (c) 1995, 1999 Cygnus Support
|
||||
*
|
||||
* The authors hereby grant permission to use, copy, modify, distribute,
|
||||
* and license this software and its documentation for any purpose, provided
|
||||
* that existing copyright notices are retained in all copies and that this
|
||||
* notice is included verbatim in any distributions. No written agreement,
|
||||
* license, or royalty fee is required for any of the authorized uses.
|
||||
* Modifications to this software may be copyrighted by their authors
|
||||
* and need not follow the licensing terms described here, provided that
|
||||
* the new terms are clearly indicated on the first page of each file where
|
||||
* they apply.
|
||||
*/
|
||||
#include <errno.h>
|
||||
#include "glue.h"
|
||||
|
||||
/*
|
||||
* open -- open a file descriptor. We don't have a filesystem, so
|
||||
* we return an error.
|
||||
*/
|
||||
int
|
||||
_DEFUN (_open, (buf, flags, mode),
|
||||
const char *buf _AND
|
||||
int flags _AND
|
||||
int mode)
|
||||
{
|
||||
errno = EIO;
|
||||
return (-1);
|
||||
}
|
108
libgloss/mcore/pe-cmb.ld
Normal file
108
libgloss/mcore/pe-cmb.ld
Normal file
@ -0,0 +1,108 @@
|
||||
OUTPUT_FORMAT("pei-mcore-big", "pei-mcore-big",
|
||||
"pei-mcore-little")
|
||||
GROUP(-lc -lcmb -lgcc)
|
||||
ENTRY(_mainCRTStartup)
|
||||
SECTIONS
|
||||
{
|
||||
.text 0x2f000000 :
|
||||
{
|
||||
*(.init)
|
||||
*(.text)
|
||||
*(SORT(.text$*))
|
||||
*(.glue_7t)
|
||||
*(.glue_7)
|
||||
___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
|
||||
LONG (-1); *(.ctors); *(.ctor); LONG (0);
|
||||
___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
|
||||
LONG (-1); *(.dtors); *(.dtor); LONG (0);
|
||||
*(.fini)
|
||||
/* ??? Why is .gcc_exc here? */
|
||||
*(.gcc_exc)
|
||||
etext = .;
|
||||
*(.gcc_except_table)
|
||||
}
|
||||
/* The Cygwin32 library uses a section to avoid copying certain data
|
||||
on fork. This used to be named ".data". The linker used
|
||||
to include this between __data_start__ and __data_end__, but that
|
||||
breaks building the cygwin32 dll. Instead, we name the section
|
||||
".data_cygwin_nocopy" and explictly include it after __data_end__. */
|
||||
.data BLOCK(__section_alignment__) :
|
||||
{
|
||||
__data_start__ = . ;
|
||||
*(.data)
|
||||
*(.data2)
|
||||
*(SORT(.data$*))
|
||||
__data_end__ = . ;
|
||||
*(.data_cygwin_nocopy)
|
||||
}
|
||||
.bss BLOCK(__section_alignment__) :
|
||||
{
|
||||
__bss_start__ = . ;
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
__bss_end__ = . ;
|
||||
}
|
||||
.rdata BLOCK(__section_alignment__) :
|
||||
{
|
||||
*(.rdata)
|
||||
*(SORT(.rdata$*))
|
||||
*(.eh_frame)
|
||||
}
|
||||
.edata BLOCK(__section_alignment__) :
|
||||
{
|
||||
*(.edata)
|
||||
}
|
||||
/DISCARD/ :
|
||||
{
|
||||
*(.debug$S)
|
||||
*(.debug$T)
|
||||
*(.debug$F)
|
||||
*(.drectve)
|
||||
}
|
||||
.idata BLOCK(__section_alignment__) :
|
||||
{
|
||||
/* This cannot currently be handled with grouped sections.
|
||||
See pe.em:sort_sections. */
|
||||
SORT(*)(.idata$2)
|
||||
SORT(*)(.idata$3)
|
||||
/* These zeroes mark the end of the import list. */
|
||||
LONG (0); LONG (0); LONG (0); LONG (0); LONG (0);
|
||||
SORT(*)(.idata$4)
|
||||
SORT(*)(.idata$5)
|
||||
SORT(*)(.idata$6)
|
||||
SORT(*)(.idata$7)
|
||||
}
|
||||
.CRT BLOCK(__section_alignment__) :
|
||||
{
|
||||
*(SORT(.CRT$*))
|
||||
}
|
||||
.endjunk BLOCK(__section_alignment__) :
|
||||
{
|
||||
/* end is deprecated, don't use it */
|
||||
end = .;
|
||||
_end = .;
|
||||
__end__ = .;
|
||||
}
|
||||
.reloc BLOCK(__section_alignment__) :
|
||||
{
|
||||
*(.reloc)
|
||||
}
|
||||
.rsrc BLOCK(__section_alignment__) :
|
||||
{
|
||||
*(.rsrc)
|
||||
*(SORT(.rsrc$*))
|
||||
}
|
||||
.stab BLOCK(__section_alignment__) (NOLOAD) :
|
||||
{
|
||||
[ .stab ]
|
||||
}
|
||||
.stabstr BLOCK(__section_alignment__) (NOLOAD) :
|
||||
{
|
||||
[ .stabstr ]
|
||||
}
|
||||
.stack 0x2f0ffffc :
|
||||
{
|
||||
_stack = .;
|
||||
*(.stack)
|
||||
}
|
||||
}
|
3
libgloss/mcore/pe-cmb.specs
Normal file
3
libgloss/mcore/pe-cmb.specs
Normal file
@ -0,0 +1,3 @@
|
||||
*endfile:
|
||||
-Tcmb.ld
|
||||
|
27
libgloss/mcore/print.c
Normal file
27
libgloss/mcore/print.c
Normal file
@ -0,0 +1,27 @@
|
||||
/* print.c -- print a string on the output device.
|
||||
*
|
||||
* Copyright (c) 1995, 1999 Cygnus Support
|
||||
*
|
||||
* The authors hereby grant permission to use, copy, modify, distribute,
|
||||
* and license this software and its documentation for any purpose, provided
|
||||
* that existing copyright notices are retained in all copies and that this
|
||||
* notice is included verbatim in any distributions. No written agreement,
|
||||
* license, or royalty fee is required for any of the authorized uses.
|
||||
* Modifications to this software may be copyrighted by their authors
|
||||
* and need not follow the licensing terms described here, provided that
|
||||
* the new terms are clearly indicated on the first page of each file where
|
||||
* they apply.
|
||||
*/
|
||||
#include "glue.h"
|
||||
|
||||
/*
|
||||
* print -- do a raw print of a string
|
||||
*/
|
||||
void
|
||||
_DEFUN (_print, (ptr),
|
||||
char *ptr)
|
||||
{
|
||||
while (*ptr) {
|
||||
outbyte (*ptr++);
|
||||
}
|
||||
}
|
41
libgloss/mcore/putnum.c
Normal file
41
libgloss/mcore/putnum.c
Normal file
@ -0,0 +1,41 @@
|
||||
/* putnum.c -- put a hex number on the output device.
|
||||
*
|
||||
* Copyright (c) 1995, 1999 Cygnus Support
|
||||
*
|
||||
* The authors hereby grant permission to use, copy, modify, distribute,
|
||||
* and license this software and its documentation for any purpose, provided
|
||||
* that existing copyright notices are retained in all copies and that this
|
||||
* notice is included verbatim in any distributions. No written agreement,
|
||||
* license, or royalty fee is required for any of the authorized uses.
|
||||
* Modifications to this software may be copyrighted by their authors
|
||||
* and need not follow the licensing terms described here, provided that
|
||||
* the new terms are clearly indicated on the first page of each file where
|
||||
* they apply.
|
||||
*/
|
||||
#include "glue.h"
|
||||
|
||||
/*
|
||||
* putnum -- print a 32 bit number in hex
|
||||
*/
|
||||
void
|
||||
_DEFUN (_putnum, (num),
|
||||
unsigned int num)
|
||||
{
|
||||
char buf[9];
|
||||
int cnt;
|
||||
char *ptr;
|
||||
int digit;
|
||||
|
||||
ptr = buf;
|
||||
for (cnt = 7 ; cnt >= 0 ; cnt--) {
|
||||
digit = (num >> (cnt * 4)) & 0xf;
|
||||
|
||||
if (digit <= 9)
|
||||
*ptr++ = (char) ('0' + digit);
|
||||
else
|
||||
*ptr++ = (char) ('a' - 10 + digit);
|
||||
}
|
||||
|
||||
*ptr = (char) 0;
|
||||
print (buf);
|
||||
}
|
22
libgloss/mcore/raise.c
Normal file
22
libgloss/mcore/raise.c
Normal file
@ -0,0 +1,22 @@
|
||||
/* raise.c -- raise a signal for current process.
|
||||
*
|
||||
* Copyright (c) 1999 Cygnus Support
|
||||
*
|
||||
* The authors hereby grant permission to use, copy, modify, distribute,
|
||||
* and license this software and its documentation for any purpose, provided
|
||||
* that existing copyright notices are retained in all copies and that this
|
||||
* notice is included verbatim in any distributions. No written agreement,
|
||||
* license, or royalty fee is required for any of the authorized uses.
|
||||
* Modifications to this software may be copyrighted by their authors
|
||||
* and need not follow the licensing terms described here, provided that
|
||||
* the new terms are clearly indicated on the first page of each file where
|
||||
* they apply.
|
||||
*/
|
||||
#include "glue.h"
|
||||
|
||||
int
|
||||
_DEFUN (_raise, (sig),
|
||||
int sig)
|
||||
{
|
||||
return _kill (_getpid (), sig);
|
||||
}
|
39
libgloss/mcore/read.c
Normal file
39
libgloss/mcore/read.c
Normal file
@ -0,0 +1,39 @@
|
||||
/* read.c -- read bytes from a input device.
|
||||
*
|
||||
* Copyright (c) 1995, 1999 Cygnus Support
|
||||
*
|
||||
* The authors hereby grant permission to use, copy, modify, distribute,
|
||||
* and license this software and its documentation for any purpose, provided
|
||||
* that existing copyright notices are retained in all copies and that this
|
||||
* notice is included verbatim in any distributions. No written agreement,
|
||||
* license, or royalty fee is required for any of the authorized uses.
|
||||
* Modifications to this software may be copyrighted by their authors
|
||||
* and need not follow the licensing terms described here, provided that
|
||||
* the new terms are clearly indicated on the first page of each file where
|
||||
* they apply.
|
||||
*/
|
||||
#include "glue.h"
|
||||
|
||||
extern char _DEFUN_VOID (inbyte);
|
||||
|
||||
/*
|
||||
* read -- read bytes from the serial port. Ignore fd, since
|
||||
* we only have stdin.
|
||||
*/
|
||||
int
|
||||
_DEFUN (_read, (fd, buf, nbytes),
|
||||
int fd _AND
|
||||
char *buf _AND
|
||||
int nbytes)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
for (i = 0; i < nbytes; i++) {
|
||||
*(buf + i) = inbyte();
|
||||
if ((*(buf + i) == '\n') || (*(buf + i) == '\r')) {
|
||||
(*(buf + i + 1)) = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return (i);
|
||||
}
|
42
libgloss/mcore/sbrk.c
Normal file
42
libgloss/mcore/sbrk.c
Normal file
@ -0,0 +1,42 @@
|
||||
/* sbrk.c -- allocate memory dynamically.
|
||||
*
|
||||
* Copyright (c) 1995,1996,1999 Cygnus Support
|
||||
*
|
||||
* The authors hereby grant permission to use, copy, modify, distribute,
|
||||
* and license this software and its documentation for any purpose, provided
|
||||
* that existing copyright notices are retained in all copies and that this
|
||||
* notice is included verbatim in any distributions. No written agreement,
|
||||
* license, or royalty fee is required for any of the authorized uses.
|
||||
* Modifications to this software may be copyrighted by their authors
|
||||
* and need not follow the licensing terms described here, provided that
|
||||
* the new terms are clearly indicated on the first page of each file where
|
||||
* they apply.
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "glue.h"
|
||||
|
||||
caddr_t
|
||||
_sbrk (size_t incr)
|
||||
{
|
||||
static char *heap_end;
|
||||
char *prev_heap_end;
|
||||
char *sp = (char *)&sp;
|
||||
|
||||
if (heap_end == 0)
|
||||
{
|
||||
heap_end = _end;
|
||||
}
|
||||
prev_heap_end = heap_end;
|
||||
if (heap_end > sp)
|
||||
{
|
||||
_write (1, "Heap and stack collision\n", 25);
|
||||
#if 0 /* Calling abort brings in the signal handling code. */
|
||||
abort ();
|
||||
#else
|
||||
exit (1);
|
||||
#endif
|
||||
}
|
||||
heap_end += incr;
|
||||
return (caddr_t) prev_heap_end;
|
||||
}
|
30
libgloss/mcore/stat.c
Normal file
30
libgloss/mcore/stat.c
Normal file
@ -0,0 +1,30 @@
|
||||
/* stat.c -- Get the status of a file.
|
||||
*
|
||||
* Copyright (c) 1995, 1999 Cygnus Support
|
||||
*
|
||||
* The authors hereby grant permission to use, copy, modify, distribute,
|
||||
* and license this software and its documentation for any purpose, provided
|
||||
* that existing copyright notices are retained in all copies and that this
|
||||
* notice is included verbatim in any distributions. No written agreement,
|
||||
* license, or royalty fee is required for any of the authorized uses.
|
||||
* Modifications to this software may be copyrighted by their authors
|
||||
* and need not follow the licensing terms described here, provided that
|
||||
* the new terms are clearly indicated on the first page of each file where
|
||||
* they apply.
|
||||
*/
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#include "glue.h"
|
||||
|
||||
/*
|
||||
* stat -- Since we have no file system, we just return an error.
|
||||
*/
|
||||
int
|
||||
_DEFUN (_stat, (path, buf),
|
||||
const char *path _AND
|
||||
struct stat *buf)
|
||||
{
|
||||
errno = EIO;
|
||||
return (-1);
|
||||
}
|
||||
|
64
libgloss/mcore/syscalls.S
Normal file
64
libgloss/mcore/syscalls.S
Normal file
@ -0,0 +1,64 @@
|
||||
.macro FUNC_START name
|
||||
.text
|
||||
.globl \name
|
||||
.globl _\name
|
||||
\name:
|
||||
_\name:
|
||||
.endm
|
||||
|
||||
FUNC_START _sbrk
|
||||
mov r4, r2 // save increment
|
||||
lrw r3, brkval
|
||||
ldw r2, (r3) // get next spot
|
||||
|
||||
movi r5, 7
|
||||
addi r2, 7 // round up to 8 bytes
|
||||
andn r2, r5
|
||||
|
||||
addu r4, r2 // save updated pointer
|
||||
stw r4, (r3)
|
||||
jmp r15
|
||||
|
||||
// brk() could go in here too...
|
||||
|
||||
.data
|
||||
.import _end
|
||||
brkval: .long _end
|
||||
|
||||
|
||||
FUNC_START _exit
|
||||
mov r1, r1 // accomodate simulator glitch...
|
||||
.short 0x5000
|
||||
br _exit // hard loop here
|
||||
|
||||
// 0x5001 - printf
|
||||
// 0x5002 - scanf
|
||||
|
||||
FUNC_START utime
|
||||
.short 0x5003
|
||||
jmp r15
|
||||
|
||||
|
||||
.macro stub name value
|
||||
FUNC_START \name
|
||||
movi r1, \value
|
||||
.short 0x50FF
|
||||
jmp r15
|
||||
.endm
|
||||
|
||||
stub _close 6
|
||||
stub _lseek 19
|
||||
stub _open 5
|
||||
stub _read 3
|
||||
stub _times 43
|
||||
stub _unlink 10
|
||||
stub _write 4
|
||||
|
||||
//stub access 33
|
||||
//stub creat 8
|
||||
//stub link 9
|
||||
//stub time 13
|
||||
|
||||
//stub profil 98 // movi r6, 2
|
||||
//stub lprofil 98 // movi r6, 4
|
||||
|
28
libgloss/mcore/unlink.c
Normal file
28
libgloss/mcore/unlink.c
Normal file
@ -0,0 +1,28 @@
|
||||
/* unlink.c -- remove a file.
|
||||
*
|
||||
* Copyright (c) 1995, 1999 Cygnus Support
|
||||
*
|
||||
* The authors hereby grant permission to use, copy, modify, distribute,
|
||||
* and license this software and its documentation for any purpose, provided
|
||||
* that existing copyright notices are retained in all copies and that this
|
||||
* notice is included verbatim in any distributions. No written agreement,
|
||||
* license, or royalty fee is required for any of the authorized uses.
|
||||
* Modifications to this software may be copyrighted by their authors
|
||||
* and need not follow the licensing terms described here, provided that
|
||||
* the new terms are clearly indicated on the first page of each file where
|
||||
* they apply.
|
||||
*/
|
||||
#include <errno.h>
|
||||
#include "glue.h"
|
||||
|
||||
/*
|
||||
* unlink -- since we have no file system,
|
||||
* we just return an error.
|
||||
*/
|
||||
int
|
||||
_DEFUN (_unlink, (path),
|
||||
char * path)
|
||||
{
|
||||
errno = EIO;
|
||||
return (-1);
|
||||
}
|
39
libgloss/mcore/write.c
Normal file
39
libgloss/mcore/write.c
Normal file
@ -0,0 +1,39 @@
|
||||
/* write.c -- write bytes to an output device.
|
||||
*
|
||||
* Copyright (c) 1995, 1999 Cygnus Support
|
||||
*
|
||||
* The authors hereby grant permission to use, copy, modify, distribute,
|
||||
* and license this software and its documentation for any purpose, provided
|
||||
* that existing copyright notices are retained in all copies and that this
|
||||
* notice is included verbatim in any distributions. No written agreement,
|
||||
* license, or royalty fee is required for any of the authorized uses.
|
||||
* Modifications to this software may be copyrighted by their authors
|
||||
* and need not follow the licensing terms described here, provided that
|
||||
* the new terms are clearly indicated on the first page of each file where
|
||||
* they apply.
|
||||
*/
|
||||
#include "glue.h"
|
||||
|
||||
extern int _EXFUN (outbyte, (char x));
|
||||
|
||||
/*
|
||||
* write -- write bytes to the serial port. Ignore fd, since
|
||||
* stdout and stderr are the same. Since we have no filesystem,
|
||||
* open will only return an error.
|
||||
*/
|
||||
int
|
||||
_DEFUN (_write, (fd, buf, nbytes),
|
||||
int fd _AND
|
||||
char *buf _AND
|
||||
int nbytes)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nbytes; i++) {
|
||||
if (*(buf + i) == '\n') {
|
||||
outbyte ('\r');
|
||||
}
|
||||
outbyte (*(buf + i));
|
||||
}
|
||||
return (nbytes);
|
||||
}
|
Reference in New Issue
Block a user