20000317 sourceware import
This commit is contained in:
parent
fae4c299f1
commit
03261851a1
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,185 @@
|
|||
# Top level makefile for libgloss
|
||||
#
|
||||
# Copyright (c) 1995, 1996 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.
|
||||
#
|
||||
|
||||
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)
|
||||
|
||||
TOP = .
|
||||
SRCTOP = .
|
||||
|
||||
# Multilib support variables.
|
||||
# TOP is used instead of MULTI{BUILD,SRC}TOP.
|
||||
MULTISRCTOP =
|
||||
MULTIBUILDTOP =
|
||||
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 = qv
|
||||
BISON = bison
|
||||
MAKEINFO = makeinfo
|
||||
|
||||
SUBDIRS = @subdirs@
|
||||
|
||||
.NOEXPORT:
|
||||
MAKEOVERRIDES=
|
||||
|
||||
# Host specific makefile fragment comes in here.
|
||||
@host_makefile_frag@
|
||||
|
||||
# These are roughly topologically sorted in order to make porting more
|
||||
# streamlined.
|
||||
FLAGS_TO_PASS = \
|
||||
"CC=$(CC)" \
|
||||
"CFLAGS=$(CFLAGS)" \
|
||||
"AR=$(AR)" \
|
||||
"RANLIB=$(RANLIB)" \
|
||||
"AR_FLAGS=$(AR_FLAGS)" \
|
||||
"MAKEINFO=$(MAKEINFO)" \
|
||||
"AS=$(AS)" \
|
||||
"LD=$(LD)" \
|
||||
"CROSS_CFLAGS=$(CROSS_CFLAGS)" \
|
||||
"TARGET_CFLAGS=$(TARGET_CFLAGS)" \
|
||||
"exec_prefix=$(exec_prefix)" \
|
||||
"prefix=$(prefix)" \
|
||||
"tooldir=$(tooldir)" \
|
||||
"INSTALL=$(INSTALL)" \
|
||||
"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
|
||||
"INSTALL_DATA=$(INSTALL_DATA)"
|
||||
|
||||
all: stmp-bsp force
|
||||
@rootpre=`pwd`/; export rootpre; \
|
||||
srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \
|
||||
$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all
|
||||
|
||||
stmp-bsp: force
|
||||
@rootpre=`pwd`/; export rootpre; \
|
||||
srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \
|
||||
for dir in .. ${SUBDIRS}; do \
|
||||
if [ x$$dir != x.. ]; then \
|
||||
if [ -d $$dir ]; then \
|
||||
(cd $$dir; $(MAKE) $(FLAGS_TO_PASS)); \
|
||||
else true; fi; \
|
||||
else true; fi; \
|
||||
done
|
||||
|
||||
install: force
|
||||
@rootpre=`pwd`/; export rootpre; \
|
||||
srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \
|
||||
for dir in .. ${SUBDIRS}; do \
|
||||
if [ x$$dir != x.. ]; then \
|
||||
if [ -d $$dir ]; then \
|
||||
(cd $$dir; $(MAKE) $(FLAGS_TO_PASS) install); \
|
||||
else true; fi; \
|
||||
else true; fi; \
|
||||
done
|
||||
@rootpre=`pwd`/; export rootpre; \
|
||||
srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \
|
||||
$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
|
||||
|
||||
test: force
|
||||
@rootpre=`pwd`/; export rootpre; \
|
||||
srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \
|
||||
for dir in .. ${SUBDIRS}; do \
|
||||
if [ x$$dir != x.. ]; then \
|
||||
if [ -d $$dir ]; then \
|
||||
(cd $$dir; $(MAKE) $(FLAGS_TO_PASS) test); \
|
||||
else true; fi; \
|
||||
else true; fi; \
|
||||
done
|
||||
@rootpre=`pwd`/; export rootpre; \
|
||||
srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \
|
||||
$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=test
|
||||
|
||||
clean-here:
|
||||
-rm -f *~ core *.o a.out xgdb *.x
|
||||
|
||||
clean mostlyclean: clean-here
|
||||
rootpre=`pwd`/; export rootpre; \
|
||||
srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \
|
||||
$(MAKE) DO=$@ DODIRS="$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do; \
|
||||
$(MULTICLEAN) multi-clean DO=$@
|
||||
|
||||
distclean maintainer-clean realclean: clean-here
|
||||
-rm -f Makefile config.cache config.log config.status
|
||||
-rm -f *-init.exp site.*
|
||||
-rm -fr *.log summary detail *.sum
|
||||
rootpre=`pwd`/; export rootpre; \
|
||||
srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \
|
||||
$(MAKE) DO=$@ DODIRS="$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do; \
|
||||
$(MULTICLEAN) multi-clean DO=$@
|
||||
|
||||
.PHONY: info install-info clean-info
|
||||
subdir_do:
|
||||
@rootpre=`pwd`/; export rootpre; \
|
||||
srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \
|
||||
for i in .. $(DODIRS); do \
|
||||
if [ x$$i != x.. ]; then \
|
||||
if [ -f ./$$i/Makefile ]; then \
|
||||
if (cd ./$$i; $(MAKE) $(FLAGS_TO_PASS) $(DO)); then \
|
||||
true; \
|
||||
else \
|
||||
exit 1; \
|
||||
fi; \
|
||||
else true; fi; \
|
||||
else true; fi; \
|
||||
done
|
||||
|
||||
info dvi docs:
|
||||
rootpre=`pwd`/; export rootpre; \
|
||||
srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \
|
||||
$(MAKE) DO=$@ DODIRS=doc $(FLAGS_TO_PASS) subdir_do
|
||||
|
||||
install-info:
|
||||
rootpre=`pwd`/; export rootpre; \
|
||||
srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \
|
||||
$(MAKE) DO=$@ DODIRS=doc $(FLAGS_TO_PASS) subdir_do
|
||||
|
||||
clean-info:
|
||||
|
||||
force:
|
||||
|
||||
Makefile: Makefile.in config.status @host_makefile_frag_path@
|
||||
$(SHELL) config.status
|
||||
|
||||
config.status: configure
|
||||
$(SHELL) config.status --recheck
|
|
@ -0,0 +1,5 @@
|
|||
sparc - Fujitsu Sparclite board. Works on the ex930, ex931, ex933
|
||||
hp74x - Hewlett Packard HP742 board. Also some support for the hp743.
|
||||
m68k - Motorola MVME135 and IDP board. For CPU32 systems.
|
||||
pa - WinBond and Oki boards with a PA.
|
||||
mips - R3000 support. Array Tech LSI33k based RAID disk controller.
|
|
@ -0,0 +1,25 @@
|
|||
/* close.c -- close a file descriptor.
|
||||
*
|
||||
* Copyright (c) 1995 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);
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
NEWLIB_CFLAGS = `if [ -d ${objroot}/newlib ]; then echo -I${objroot}/newlib/targ-include -I${srcroot}/newlib/libc/include; fi`
|
||||
NEWLIB_LDFLAGS = `if [ -d ${objroot}/newlib ]; then echo -B${objroot}/newlib/ -L${objroot}/newlib/; fi`
|
||||
|
||||
INCLUDES = -I. -I$(srcdir)/..
|
||||
# Note that when building the library, ${MULTILIB} is not the way multilib
|
||||
# options are passed; they're passed in $(CFLAGS).
|
||||
CFLAGS_FOR_TARGET = -O2 -g ${MULTILIB} ${INCLUDES} ${NEWLIB_CFLAGS}
|
||||
LDFLAGS_FOR_TARGET = ${MULTILIB} ${NEWLIB_LDFLAGS}
|
||||
AR_FLAGS = qc
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $<
|
||||
|
||||
.C.o:
|
||||
$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $<
|
||||
.s.o:
|
||||
$(AS) $(ASFLAGS_FOR_TARGET) $(INCLUDES) $(ASFLAGS) -o $*.o $<
|
||||
|
||||
#
|
||||
# GCC knows to run the preprocessor on .S files before it assembles them.
|
||||
#
|
||||
.S.o:
|
||||
$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) $(CFLAGS) -c $<
|
||||
|
||||
#
|
||||
# this is a bogus target that'll produce an assembler from the
|
||||
# C source with the right compiler options. this is so we can
|
||||
# track down code generation or debug symbol bugs.
|
||||
#
|
||||
.c.s:
|
||||
$(CC) $(CFLAGS_FOR_TARGET) -S $(INCLUDES) $(CFLAGS) $<
|
|
@ -0,0 +1,33 @@
|
|||
#
|
||||
# these are the minimum required stubs to support newlib
|
||||
#
|
||||
close.o: ${srcdir}/../close.c
|
||||
$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $?
|
||||
fstat.o: ${srcdir}/../fstat.c
|
||||
$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $?
|
||||
getpid.o: ${srcdir}/../getpid.c
|
||||
$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $?
|
||||
isatty.o: ${srcdir}/../isatty.c
|
||||
$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $?
|
||||
kill.o: ${srcdir}/../kill.c
|
||||
$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $?
|
||||
lseek.o: ${srcdir}/../lseek.c
|
||||
$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $?
|
||||
open.o: ${srcdir}/../open.c
|
||||
$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $?
|
||||
print.o: ${srcdir}/../print.c
|
||||
$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $?
|
||||
putnum.o: ${srcdir}/../putnum.c
|
||||
$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $?
|
||||
read.o: ${srcdir}/../read.c
|
||||
$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $?
|
||||
sbrk.o: ${srcdir}/../sbrk.c
|
||||
$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $?
|
||||
stat.o: ${srcdir}/../stat.c
|
||||
$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $?
|
||||
unlink.o: ${srcdir}/../unlink.c
|
||||
$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $?
|
||||
write.o: ${srcdir}/../write.c
|
||||
$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $?
|
||||
debug.o: ${srcdir}/../debug.c ${srcdir}/../debug.h
|
||||
$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) ${srcdir}/../debug.c
|
|
@ -0,0 +1,57 @@
|
|||
NEWLIB_CFLAGS = `if [ -d ${objroot}/newlib ]; then echo -I${objroot}/newlib/targ-include -I${srcroot}/newlib/libc/include; fi`
|
||||
NEWLIB_LDFLAGS = `if [ -d ${objroot}/newlib ]; then echo -B${objroot}/newlib/; fi`
|
||||
|
||||
INCLUDES = -I.
|
||||
# Note that when building the library, ${MULTILIB} is not the way multilib
|
||||
# options are passed; they're passed in $(CFLAGS).
|
||||
CFLAGS_FOR_TARGET = -O2 -g ${MULTILIB} ${INCLUDES} ${NEWLIB_CFLAGS}
|
||||
LDFLAGS_FOR_TARGET = ${MULTILIB} ${NEWLIB_LDFLAGS}
|
||||
ARFLAGS_FOR_TARGET = qc
|
||||
|
||||
# find the tools used to build libgloss. As this is a DOS build in a
|
||||
# 3way cross, we have to specify the name as it lives prebuilt in Unix
|
||||
# land. The freshly built tools are for the wrong architecture.
|
||||
CC_FOR_TARGET = `t='$(program_transform_name)'; echo gcc | sed -e $$t`
|
||||
|
||||
AS_FOR_TARGET = `t='$(program_transform_name)'; echo as | sed -e $$t`
|
||||
|
||||
AR_FOR_TARGET = `t='$(program_transform_name)'; echo ar | sed -e $$t`
|
||||
|
||||
LD_FOR_TARGET = `t='$(program_transform_name)'; echo ld | sed -e $$t`
|
||||
|
||||
RANLIB_FOR_TARGET = `t='$(program_transform_name)'; echo ranlib | sed -e $$t`
|
||||
|
||||
OBJDUMP_FOR_TARGET = `t='$(program_transform_name)'; echo objdump | sed -e $$t`
|
||||
|
||||
OBJCOPY_FOR_TARGET = `t='$(program_transform_name)'; echo objcopy | sed -e $$t`
|
||||
|
||||
|
||||
# Using CFLAGS here may be confusing if the user has given a special
|
||||
# CFLAGS intended for use on the host, since we are passing it to the
|
||||
# cross-compiler; I'm not sure what to do about this. INCLUDES is
|
||||
# from the top level Makefile.
|
||||
# FIXME: But isn't CFLAGS what is used to pass multilib options when
|
||||
# building the library?
|
||||
|
||||
.c.o:
|
||||
rootme=`pwd` ; \
|
||||
echo CC_FOR_TARGET is ${CC_FOR_TARGET} ; \
|
||||
$(CC_FOR_TARGET) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $<
|
||||
|
||||
.c.s:
|
||||
rootme=`pwd` ; \
|
||||
echo CC_FOR_TARGET is ${CC_FOR_TARGET} ; \
|
||||
$(CC_FOR_TARGET) $(CFLAGS_FOR_TARGET) -S $(INCLUDES) $<
|
||||
|
||||
.S.o:
|
||||
rootme=`pwd` ; \
|
||||
echo CC_FOR_TARGET is ${CC_FOR_TARGET} ; \
|
||||
$(CC_FOR_TARGET) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $<
|
||||
|
||||
.s.o:
|
||||
rootme=`pwd` ; \
|
||||
echo AS_FOR_TARGET is ${AS_FOR_TARGET} ; \
|
||||
$(AS_FOR_TARGET) $(ASFLAGS_FOR_TARGET) $(INCLUDES) -o $*.o $<
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
#
|
||||
# These are the minimum required stubs to support newlib
|
||||
# for embedded MIPS targets. Note that although read.o and write.o
|
||||
# are mentioned here, they are not used for all targets.
|
||||
#
|
||||
close.o: ${srcdir}/../close.c
|
||||
$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $?
|
||||
fstat.o: ${srcdir}/../fstat.c
|
||||
$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $?
|
||||
getpid.o: ${srcdir}/../getpid.c
|
||||
$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $?
|
||||
isatty.o: ${srcdir}/../isatty.c
|
||||
$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $?
|
||||
kill.o: ${srcdir}/../kill.c
|
||||
$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $?
|
||||
lseek.o: ${srcdir}/../lseek.c
|
||||
$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $?
|
||||
open.o: ${srcdir}/../open.c
|
||||
$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $?
|
||||
print.o: ${srcdir}/../print.c
|
||||
$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $?
|
||||
putnum.o: ${srcdir}/../putnum.c
|
||||
$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $?
|
||||
read.o: ${srcdir}/../read.c
|
||||
$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $?
|
||||
stat.o: ${srcdir}/../stat.c
|
||||
$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $?
|
||||
unlink.o: ${srcdir}/../unlink.c
|
||||
$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $?
|
||||
write.o: ${srcdir}/../write.c
|
||||
$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $?
|
|
@ -0,0 +1,3 @@
|
|||
# Dummy target-specific Makefile fragment for MN10200. We can't
|
||||
# use default.mt because it refers to generic source files whose
|
||||
# names conflict with the MN10200-specific sources.
|
|
@ -0,0 +1,3 @@
|
|||
# Dummy target-specific Makefile fragment for MN10300. We can't
|
||||
# use default.mt because it refers to generic source files whose
|
||||
# names conflict with the MN10300-specific sources.
|
|
@ -0,0 +1,35 @@
|
|||
NEWLIB_CFLAGS = `if [ -d ${objroot}/newlib ]; then echo -I${objroot}/newlib/targ-include -I${srcroot}/newlib/libc/include; fi`
|
||||
NEWLIB_LDFLAGS = `if [ -d ${objroot}/newlib ]; then echo -B${objroot}/newlib/ -L${objroot}/newlib/; fi`
|
||||
|
||||
# For the PowerPC, always add -mrelocatable-lib -mno-eabi. These are set for the
|
||||
# multilibs, but are ignored when building the toplevel directory.
|
||||
CFLAGS_MRELOCATABLE = -mrelocatable-lib -mno-eabi
|
||||
|
||||
INCLUDES = -I. -I$(srcdir)/..
|
||||
# Note that when building the library, ${MULTILIB} is not the way multilib
|
||||
# options are passed; they're passed in $(CFLAGS).
|
||||
CFLAGS_FOR_TARGET = -O2 -g ${MULTILIB} ${INCLUDES} ${NEWLIB_CFLAGS}
|
||||
LDFLAGS_FOR_TARGET = ${MULTILIB} ${NEWLIB_LDFLAGS}
|
||||
AR_FLAGS = qc
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS_MRELOCATABLE) -O2 $(INCLUDES) -c $(CFLAGS) $<
|
||||
|
||||
.C.o:
|
||||
$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS_MRELOCATABLE) -O2 $(INCLUDES) -c $(CFLAGS) $<
|
||||
.s.o:
|
||||
$(AS) $(ASFLAGS_FOR_TARGET) $(INCLUDES) $(ASFLAGS) -o $*.o $<
|
||||
|
||||
#
|
||||
# GCC knows to run the preprocessor on .S files before it assembles them.
|
||||
#
|
||||
.S.o:
|
||||
$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS_MRELOCATABLE) $(INCLUDES) $(CFLAGS) -c $<
|
||||
|
||||
#
|
||||
# this is a bogus target that'll produce an assembler from the
|
||||
# C source with the right compiler options. this is so we can
|
||||
# track down code generation or debug symbol bugs.
|
||||
#
|
||||
.c.s:
|
||||
$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS_MRELOCATABLE) -S $(INCLUDES) $(CFLAGS) $<
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,168 @@
|
|||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_PREREQ(2.7)dnl
|
||||
AC_INIT(README)
|
||||
|
||||
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_PROG_INSTALL
|
||||
|
||||
AC_CANONICAL_SYSTEM
|
||||
|
||||
if test -z "${with_multisubdir}" ; then
|
||||
configdirs="doc libnosys"
|
||||
else
|
||||
configdirs="libnosys"
|
||||
fi
|
||||
|
||||
case "${target}" in
|
||||
i386-*-elf*)
|
||||
configdirs="${configdirs} i386 testsuite";
|
||||
;;
|
||||
m32r-*-*)
|
||||
configdirs="${configdirs} m32r testsuite"
|
||||
;;
|
||||
m68*-*-*)
|
||||
configdirs="${configdirs} m68k testsuite"
|
||||
;;
|
||||
hppa*-*-pro*)
|
||||
configdirs="${configdirs} pa testsuite"
|
||||
;;
|
||||
i960-*-coff)
|
||||
configdirs="${configdirs} i960 testsuite"
|
||||
;;
|
||||
sparc-*-elf*)
|
||||
configdirs="${configdirs} sparc testsuite"
|
||||
;;
|
||||
sparc64-*-elf*)
|
||||
configdirs="${configdirs} sparc testsuite"
|
||||
;;
|
||||
sparc86x-*-*)
|
||||
configdirs="${configdirs} sparc testsuite"
|
||||
;;
|
||||
sparclite-*-*)
|
||||
configdirs="${configdirs} sparc testsuite"
|
||||
;;
|
||||
sparclet-*-aout*)
|
||||
configdirs="${configdirs} sparc sparc/libsys testsuite"
|
||||
;;
|
||||
*arm-wince-pe)
|
||||
configdirs="wince"
|
||||
;;
|
||||
sh*-*-pe)
|
||||
configdirs="wince"
|
||||
;;
|
||||
mips*-*-pe)
|
||||
configdirs="wince"
|
||||
;;
|
||||
mips*-*-*)
|
||||
configdirs="${configdirs} mips testsuite"
|
||||
;;
|
||||
powerpc-*-*|powerpcle-*-*)
|
||||
configdirs="${configdirs} rs6000 testsuite"
|
||||
;;
|
||||
mn10200-*-*)
|
||||
configdirs="${configdirs} mn10200 testsuite"
|
||||
;;
|
||||
mn10300-*-*)
|
||||
configdirs="${configdirs} mn10300 testsuite"
|
||||
;;
|
||||
d30v-*-*)
|
||||
configdirs="${configdirs} d30v testsuite"
|
||||
;;
|
||||
fr30-*-*)
|
||||
configdirs="${configdirs} fr30 testsuite"
|
||||
;;
|
||||
mcore-*-*)
|
||||
configdirs="${configdirs} mcore testsuite"
|
||||
;;
|
||||
esac
|
||||
|
||||
# temporarily strip out testsuite
|
||||
configdirs=`echo $configdirs | sed 's/testsuite//'`
|
||||
|
||||
AC_CONFIG_SUBDIRS($configdirs)
|
||||
|
||||
# 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)
|
||||
AC_CHECK_PROG(AR, ar, ar, :)
|
||||
AR=${AR-ar}
|
||||
AC_SUBST(AR)
|
||||
LD=${LD-ld}
|
||||
AC_SUBST(LD)
|
||||
AC_PROG_RANLIB
|
||||
|
||||
host_makefile_frag=${srcdir}/config/default.mh
|
||||
|
||||
dnl We have to assign the same value to other variables because autoconf
|
||||
dnl doesn't provide a mechanism to substitute a replacement keyword with
|
||||
dnl arbitrary data or pathnames.
|
||||
dnl
|
||||
host_makefile_frag_path=$host_makefile_frag
|
||||
AC_SUBST(host_makefile_frag_path)
|
||||
AC_SUBST_FILE(host_makefile_frag)
|
||||
|
||||
# for now, only add multilibs for specific targets
|
||||
AC_OUTPUT(Makefile,
|
||||
. ${libgloss_topdir}/config-ml.in,
|
||||
srcdir=${srcdir}
|
||||
target=${target}
|
||||
with_multisubdir=${with_multisubdir}
|
||||
ac_configure_args="--enable-multilib ${ac_configure_args}"
|
||||
CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
|
||||
libgloss_topdir=${libgloss_topdir}
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,128 @@
|
|||
# Copyright (c) 1997 Cygnus Support
|
||||
#
|
||||
# The authors hereby grant permission to use, copy, modify, distribute,
|
||||
# and license this software and its documentation for any purpose, provided
|
||||
# that existing copyright notices are retained in all copies and that this
|
||||
# notice is included verbatim in any distributions. No written agreement,
|
||||
# license, or royalty fee is required for any of the authorized uses.
|
||||
# Modifications to this software may be copyrighted by their authors
|
||||
# and need not follow the licensing terms described here, provided that
|
||||
# the new terms are clearly indicated on the first page of each file where
|
||||
# they apply.
|
||||
#
|
||||
|
||||
#
|
||||
# This currently works with the D30V simulator.
|
||||
#
|
||||
|
||||
VPATH = @srcdir@ @srcdir@/..
|
||||
srcdir = @srcdir@
|
||||
objdir = .
|
||||
srcroot = $(srcdir)/../..
|
||||
objroot = $(objdir)/../..
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
host_alias = @host_alias@
|
||||
target_alias = @target_alias@
|
||||
|
||||
bindir = @bindir@
|
||||
libdir = @libdir@
|
||||
tooldir = $(exec_prefix)/$(target_alias)
|
||||
|
||||
# Multilib support variables.
|
||||
# TOP is used instead of MULTI{BUILD,SRC}TOP.
|
||||
MULTIDIRS =
|
||||
MULTISUBDIR =
|
||||
MULTIDO = true
|
||||
MULTICLEAN = true
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
CC = @CC@
|
||||
|
||||
AS = @AS@
|
||||
AR = @AR@
|
||||
LD = @LD@
|
||||
RANLIB = @RANLIB@
|
||||
|
||||
OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \
|
||||
then echo ${objroot}/../binutils/objdump ; \
|
||||
else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi`
|
||||
OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \
|
||||
then echo ${objroot}/../binutils/objcopy ; \
|
||||
else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi`
|
||||
|
||||
OBJS = isatty.o print.o putnum.o sbrk.o
|
||||
CFLAGS = -g
|
||||
SCRIPTS = ${SIM_SCRIPTS}
|
||||
|
||||
# Here is all of the simulator stuff
|
||||
SIM_SCRIPTS =
|
||||
SIM_LDFLAGS =
|
||||
SIM_BSP = libsim.a
|
||||
SIM_CRT0 = crt0.o
|
||||
SIM_OBJS = syscalls.o outbyte.o inbyte.o
|
||||
SIM_TEST =
|
||||
SIM_INSTALL = install-sim
|
||||
|
||||
# Host specific makefile fragment comes in here.
|
||||
@host_makefile_frag@
|
||||
|
||||
#
|
||||
# build a test program for each target board. Just trying to get
|
||||
# it to link is a good test, so we ignore all the errors for now.
|
||||
#
|
||||
all: ${SIM_CRT0} ${SIM_BSP}
|
||||
|
||||
#
|
||||
# here's where we build the board support packages for each target
|
||||
#
|
||||
|
||||
${SIM_BSP}: ${OBJS} ${SIM_OBJS}
|
||||
${AR} ${ARFLAGS} $@ ${SIM_OBJS} ${OBJS}
|
||||
${RANLIB} $@
|
||||
|
||||
#
|
||||
# here's where we build the test programs for each target
|
||||
#
|
||||
.PHONY: test
|
||||
test: ${SIM_TEST}
|
||||
|
||||
crt0.o: crt0.S
|
||||
syscalls.o: syscalls.c $(srcdir)/../syscall.h
|
||||
outbyte.o: outbyte.c
|
||||
inbyte.o: inbyte.c
|
||||
|
||||
isatty.o: $(srcdir)/../isatty.c
|
||||
print.o: $(srcdir)/../print.c
|
||||
putnum.o: $(srcdir)/../putnum.c
|
||||
sbrk.o: $(srcdir)/../sbrk.c
|
||||
|
||||
clean mostlyclean:
|
||||
rm -f a.out core *.[oais] *-test *.srec *.dis *.x syscall.h
|
||||
|
||||
distclean maintainer-clean realclean: clean
|
||||
rm -f Makefile config.status *~
|
||||
|
||||
.PHONY: install info install-info clean-info
|
||||
install: ${SIM_INSTALL}
|
||||
|
||||
install-sim:
|
||||
set -e; for x in ${SIM_CRT0} ${SIM_BSP} ${SIM_SCRIPTS}; do ${INSTALL_DATA} $$x ${tooldir}/lib${MULTISUBDIR}/$$x; done
|
||||
|
||||
doc:
|
||||
info:
|
||||
install-info:
|
||||
clean-info:
|
||||
|
||||
Makefile: Makefile.in config.status @host_makefile_frag_path@
|
||||
$(SHELL) config.status
|
||||
|
||||
config.status: configure
|
||||
$(SHELL) config.status --recheck
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,90 @@
|
|||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_PREREQ(2.5)dnl
|
||||
AC_INIT(crt0.S)
|
||||
|
||||
if test "${enable_shared}" = "yes" ; then
|
||||
echo "Shared libraries not supported for cross compiling, ignored"
|
||||
fi
|
||||
|
||||
if test "$srcdir" = "." ; then
|
||||
if test "${with_target_subdir}" != "." ; then
|
||||
libgloss_topdir="${srcdir}/${with_multisrctop}../../.."
|
||||
else
|
||||
libgloss_topdir="${srcdir}/${with_multisrctop}../.."
|
||||
fi
|
||||
else
|
||||
libgloss_topdir="${srcdir}/../.."
|
||||
fi
|
||||
AC_CONFIG_AUX_DIR($libgloss_topdir)
|
||||
|
||||
AC_CANONICAL_SYSTEM
|
||||
AC_ARG_PROGRAM
|
||||
|
||||
AC_PROG_INSTALL
|
||||
|
||||
# FIXME: We temporarily define our own version of AC_PROG_CC. This is
|
||||
# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
|
||||
# are probably using a cross compiler, which will not be able to fully
|
||||
# link an executable. This should really be fixed in autoconf
|
||||
# itself.
|
||||
|
||||
AC_DEFUN(LIB_AC_PROG_CC,
|
||||
[AC_BEFORE([$0], [AC_PROG_CPP])dnl
|
||||
AC_CHECK_PROG(CC, gcc, gcc)
|
||||
if test -z "$CC"; then
|
||||
AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
|
||||
test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
|
||||
fi
|
||||
|
||||
AC_PROG_CC_GNU
|
||||
|
||||
if test $ac_cv_prog_gcc = yes; then
|
||||
GCC=yes
|
||||
dnl Check whether -g works, even if CFLAGS is set, in case the package
|
||||
dnl plays around with CFLAGS (such as to build both debugging and
|
||||
dnl normal versions of a library), tasteless as that idea is.
|
||||
ac_test_CFLAGS="${CFLAGS+set}"
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
CFLAGS=
|
||||
AC_PROG_CC_G
|
||||
if test "$ac_test_CFLAGS" = set; then
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
elif test $ac_cv_prog_cc_g = yes; then
|
||||
CFLAGS="-g -O2"
|
||||
else
|
||||
CFLAGS="-O2"
|
||||
fi
|
||||
else
|
||||
GCC=
|
||||
test "${CFLAGS+set}" = set || CFLAGS="-g"
|
||||
fi
|
||||
])
|
||||
|
||||
LIB_AC_PROG_CC
|
||||
|
||||
AS=${AS-as}
|
||||
AC_SUBST(AS)
|
||||
AR=${AR-ar}
|
||||
AC_SUBST(AR)
|
||||
LD=${LD-ld}
|
||||
AC_SUBST(LD)
|
||||
AC_PROG_RANLIB
|
||||
|
||||
host_makefile_frag=${srcdir}/../config/default.mh
|
||||
|
||||
dnl We have to assign the same value to other variables because autoconf
|
||||
dnl doesn't provide a mechanism to substitute a replacement keyword with
|
||||
dnl arbitrary data or pathnames.
|
||||
dnl
|
||||
host_makefile_frag_path=$host_makefile_frag
|
||||
AC_SUBST(host_makefile_frag_path)
|
||||
AC_SUBST_FILE(host_makefile_frag)
|
||||
|
||||
AC_OUTPUT(Makefile,
|
||||
. ${libgloss_topdir}/config-ml.in,
|
||||
srcdir=${srcdir}
|
||||
target=${target}
|
||||
ac_configure_args="${ac_configure_args} --enable-multilib"
|
||||
CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
|
||||
libgloss_topdir=${libgloss_topdir}
|
||||
)
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* crt0.S -- startup file for D30V systems.
|
||||
*
|
||||
* Copyright (c) 1997 Cygnus Support
|
||||
*
|
||||
* The authors hereby grant permission to use, copy, modify, distribute,
|
||||
* and license this software and its documentation for any purpose, provided
|
||||
* that existing copyright notices are retained in all copies and that this
|
||||
* notice is included verbatim in any distributions. No written agreement,
|
||||
* license, or royalty fee is required for any of the authorized uses.
|
||||
* Modifications to this software may be copyrighted by their authors
|
||||
* and need not follow the licensing terms described here, provided that
|
||||
* the new terms are clearly indicated on the first page of each file where
|
||||
* they apply.
|
||||
*/
|
||||
|
||||
.file "crt0.S"
|
||||
.text
|
||||
.globl _start
|
||||
.extern main
|
||||
.extern exit
|
||||
.extern __stack
|
||||
.extern __sbss_start
|
||||
.extern __sbss_end
|
||||
.extern __ebss_start
|
||||
.extern __ebss_end
|
||||
.extern __bss_start
|
||||
.extern __bss_end
|
||||
.extern memset
|
||||
.type _start,@function
|
||||
|
||||
_start: or.l sp,r0,__stack
|
||||
|
||||
/* Zero the .sbss area */
|
||||
or.l r2,r0,__sbss_start
|
||||
or.l r4,r0,__sbss_end
|
||||
sub r4,r4,r2 || or.s r3,r0,0
|
||||
bsrtnz.l r4,(memset)
|
||||
|
||||
/* Zero the .ebss area */
|
||||
or.l r2,r0,__ebss_start
|
||||
or.l r4,r0,__ebss_end
|
||||
sub r4,r4,r2 || or.s r3,r0,0
|
||||
bsrtnz.l r4,(memset)
|
||||
|
||||
/* Zero the .bss area */
|
||||
or.l r2,r0,__bss_start
|
||||
or.l r4,r0,__bss_end
|
||||
sub r4,r4,r2 || or.s r3,r0,0
|
||||
bsrtnz.l r4,(memset)
|
||||
|
||||
or.s r2,r0,0 || or.s r3,r0,0
|
||||
or r4,r0,0 || nop
|
||||
jsr.l (main)
|
||||
jsr.l (exit)
|
||||
.size _start,.-_start
|
|
@ -0,0 +1,24 @@
|
|||
/* inbyte -- read a single byte.
|
||||
*
|
||||
* Copyright (c) 1997 Cygnus Support
|
||||
*
|
||||
* The authors hereby grant permission to use, copy, modify, distribute,
|
||||
* and license this software and its documentation for any purpose, provided
|
||||
* that existing copyright notices are retained in all copies and that this
|
||||
* notice is included verbatim in any distributions. No written agreement,
|
||||
* license, or royalty fee is required for any of the authorized uses.
|
||||
* Modifications to this software may be copyrighted by their authors
|
||||
* and need not follow the licensing terms described here, provided that
|
||||
* the new terms are clearly indicated on the first page of each file where
|
||||
* they apply.
|
||||
*/
|
||||
|
||||
int
|
||||
inbyte (void)
|
||||
{
|
||||
char ch;
|
||||
if (read (0, &ch, 1) == 1)
|
||||
return ch;
|
||||
|
||||
return -1;
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
/* outbyte -- write a single byte.
|
||||
*
|
||||
* Copyright (c) 1997 Cygnus Support
|
||||
*
|
||||
* The authors hereby grant permission to use, copy, modify, distribute,
|
||||
* and license this software and its documentation for any purpose, provided
|
||||
* that existing copyright notices are retained in all copies and that this
|
||||
* notice is included verbatim in any distributions. No written agreement,
|
||||
* license, or royalty fee is required for any of the authorized uses.
|
||||
* Modifications to this software may be copyrighted by their authors
|
||||
* and need not follow the licensing terms described here, provided that
|
||||
* the new terms are clearly indicated on the first page of each file where
|
||||
* they apply.
|
||||
*/
|
||||
|
||||
void
|
||||
outbyte (int byte)
|
||||
{
|
||||
char ch = byte;
|
||||
write (1, &ch, 1);
|
||||
}
|
|
@ -0,0 +1,146 @@
|
|||
/*
|
||||
* syscalls.c -- provide system call support via trap 31
|
||||
*
|
||||
* Copyright (c) 1997 Cygnus Support
|
||||
*
|
||||
* The authors hereby grant permission to use, copy, modify, distribute,
|
||||
* and license this software and its documentation for any purpose, provided
|
||||
* that existing copyright notices are retained in all copies and that this
|
||||
* notice is included verbatim in any distributions. No written agreement,
|
||||
* license, or royalty fee is required for any of the authorized uses.
|
||||
* Modifications to this software may be copyrighted by their authors
|
||||
* and need not follow the licensing terms described here, provided that
|
||||
* the new terms are clearly indicated on the first page of each file where
|
||||
* they apply.
|
||||
*
|
||||
* Read bytes, using simulator trap 31.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "syscall.h"
|
||||
|
||||
extern int *__errno(), errno;
|
||||
|
||||
__asm__ (
|
||||
" .globl __syscall
|
||||
.type __syscall,@function
|
||||
__syscall:
|
||||
trap 31 || nop
|
||||
cmpge f0,r2,0 -> jmp/tx link
|
||||
bra __set_errno
|
||||
.size __syscall,.-__syscall
|
||||
");
|
||||
|
||||
int
|
||||
__set_errno (int new_errno)
|
||||
{
|
||||
errno = new_errno;
|
||||
*(__errno)() = errno;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void
|
||||
_exit (int status)
|
||||
{
|
||||
__syscall (status, 0, 0, 0, SYS_exit);
|
||||
}
|
||||
|
||||
int
|
||||
open (const char *filename, int flags, int mode)
|
||||
{
|
||||
return __syscall (filename, flags, mode, 0, SYS_open);
|
||||
}
|
||||
|
||||
int
|
||||
close (int filedes)
|
||||
{
|
||||
return __syscall (filedes, 0, 0, 0, SYS_close);
|
||||
}
|
||||
|
||||
int
|
||||
read (int filedes, void *buffer, size_t length)
|
||||
{
|
||||
return __syscall (filedes, buffer, length, 0, SYS_read);
|
||||
}
|
||||
|
||||
int
|
||||
write (int filedes, void *buffer, size_t length)
|
||||
{
|
||||
return __syscall (filedes, buffer, length, 0, SYS_write);
|
||||
}
|
||||
|
||||
long
|
||||
lseek (int filedes, long offset, int whence)
|
||||
{
|
||||
return __syscall (filedes, offset, whence, 0, SYS_lseek);
|
||||
}
|
||||
|
||||
int
|
||||
unlink (const char *filename)
|
||||
{
|
||||
return __syscall (filename, 0, 0, 0, SYS_unlink);
|
||||
}
|
||||
|
||||
int
|
||||
getpid (void)
|
||||
{
|
||||
return __syscall (0, 0, 0, 0, SYS_getpid);
|
||||
}
|
||||
|
||||
int
|
||||
kill (int signal, int pid)
|
||||
{
|
||||
return __syscall (signal, pid, 0, 0, SYS_kill);
|
||||
}
|
||||
|
||||
int
|
||||
fstat (int filedes, void *info)
|
||||
{
|
||||
return __syscall (filedes, info, 0, 0, SYS_fstat);
|
||||
}
|
||||
|
||||
int
|
||||
__argvlen (void)
|
||||
{
|
||||
return __syscall (0, 0, 0, 0, SYS_argvlen);
|
||||
}
|
||||
|
||||
int
|
||||
__argv (void)
|
||||
{
|
||||
return __syscall (0, 0, 0, 0, SYS_argv);
|
||||
}
|
||||
|
||||
int
|
||||
chdir (char *dir)
|
||||
{
|
||||
return __syscall (dir, 0, 0, 0, SYS_chdir);
|
||||
}
|
||||
|
||||
int
|
||||
stat (const char *filename, void *info)
|
||||
{
|
||||
return __syscall (filename, info, 0, 0, SYS_stat);
|
||||
}
|
||||
|
||||
int
|
||||
chmod (const char *filename, int mode)
|
||||
{
|
||||
return __syscall (filename, mode, 0, 0, SYS_chmod);
|
||||
}
|
||||
|
||||
int
|
||||
utime (const char *filename, void *packet)
|
||||
{
|
||||
return __syscall (filename, packet, 0, 0, SYS_utime);
|
||||
}
|
||||
|
||||
time_t
|
||||
time (time_t *time_ptr)
|
||||
{
|
||||
time_t result;
|
||||
result = (time_t) __syscall (time_ptr, 0, 0, 0, SYS_time);
|
||||
if (time_ptr != NULL)
|
||||
*time_ptr = result;
|
||||
return result;
|
||||
}
|
|
@ -0,0 +1,848 @@
|
|||
/*
|
||||
* Copyright (c) 1995, 1996 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* A debug packet whose contents are <data> looks like:
|
||||
*
|
||||
* $ <data> # CSUM1 CSUM2
|
||||
*
|
||||
* <data> must be ASCII alphanumeric and cannot include characters
|
||||
* '$' or '#'. If <data> starts with two characters followed by
|
||||
* ':', then the existing stubs interpret this as a sequence number.
|
||||
*
|
||||
* CSUM1 and CSUM2 are ascii hex representation of an 8-bit
|
||||
* checksum of <data>, the most significant nibble is sent first.
|
||||
* the hex digits 0-9,a-f are used.
|
||||
*
|
||||
* We respond with:
|
||||
*
|
||||
* + - if CSUM is correct and ready for next packet
|
||||
* - - if CSUM is incorrect
|
||||
*
|
||||
* <data> is as follows:
|
||||
* Most values are encoded in ascii hex digits.
|
||||
*/
|
||||
|
||||
#include "debug.h"
|
||||
#include <signal.h>
|
||||
|
||||
/*
|
||||
* buffers that hold the packets while they're being constructed.
|
||||
*/
|
||||
char packet_in_buf[BUFMAX];
|
||||
char packet_out_buf[BUFMAX];
|
||||
int packet_index;
|
||||
|
||||
/*
|
||||
* indicate to caller of mem2hex or hex2mem that there has been an error.
|
||||
* 0 means ok, 1 means error
|
||||
*/
|
||||
volatile int mem_err = 0;
|
||||
|
||||
/*
|
||||
* 1 means print debugging messages from the target, 0 means be quiet. This is
|
||||
* changed by gdb_debug().
|
||||
*/
|
||||
int remote_debug = 0;
|
||||
|
||||
/*
|
||||
* indicate whether the debug vectors ahave been initialized
|
||||
* 0 means not yet, 1 means yep, it's ready.
|
||||
*/
|
||||
int initialized = 0;
|
||||
|
||||
/*
|
||||
* These variables are instantialted in the GDB stub code.
|
||||
*/
|
||||
|
||||
/* this is a list of signal to exception mappings. */
|
||||
extern struct trap_info hard_trap_info[];
|
||||
|
||||
/* this is a memory fault exception handler, used by mem2hex & hex2mem */
|
||||
extern void set_mem_fault_trap();
|
||||
|
||||
/*
|
||||
* print debugging messages. This uses print, rather than one of the
|
||||
* stdio routines, cause if there are stack or memory problems, the
|
||||
* stdio routines don't work.
|
||||
* params are the debug level, and the string to print
|
||||
* it doesn't return anything.
|
||||
*/
|
||||
void
|
||||
debuglog(int level, char *msg)
|
||||
{
|
||||
char *p;
|
||||
unsigned char buf[BUFMAX];
|
||||
char newmsg[BUFMAX];
|
||||
int i;
|
||||
|
||||
if (level > remote_debug)
|
||||
return;
|
||||
|
||||
if ((level <0) || (level > 100)) {
|
||||
print ("ERROR: debug print level out of range");
|
||||
return;
|
||||
}
|
||||
|
||||
/* convert some characters so it'll look right in the log */
|
||||
p = newmsg;
|
||||
for (i = 0 ; msg[i] != '\0'; i++) {
|
||||
if (i > BUFMAX)
|
||||
print ("\r\nERROR: Debug message too long\r\n");
|
||||
switch (msg[i]) {
|
||||
case '\n': /* newlines */
|
||||
*p++ = '\\';
|
||||
*p++ = 'n';
|
||||
continue;
|
||||
case '\r': /* carriage returns */
|
||||
*p++ = '\\';
|
||||
*p++ = 'r';
|
||||
continue;
|
||||
case '\033': /* escape */
|
||||
*p++ = '\\';
|
||||
*p++ = 'e';
|
||||
continue;
|
||||
case '\t': /* tab */
|
||||
*p++ = '\\';
|
||||
*p++ = 't';
|
||||
continue;
|
||||
case '\b': /* backspace */
|
||||
*p++ = '\\';
|
||||
*p++ = 'b';
|
||||
continue;
|
||||
default: /* no change */
|
||||
*p++ = msg[i];
|
||||
}
|
||||
|
||||
if (msg[i] < 26) { /* modify control characters */
|
||||
*p++ = '^';
|
||||
*p++ = msg[i] + 'A';
|
||||
continue;
|
||||
}
|
||||
if (msg[i] >= 127) { /* modify control characters */
|
||||
*p++ = '!';
|
||||
*p++ = msg[i] + 'A';
|
||||
continue;
|
||||
}
|
||||
}
|
||||
*p = '\0'; /* terminate the string */
|
||||
print (newmsg);
|
||||
print ("\r\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* convert an ascii hex digit to a number.
|
||||
* param is hex digit.
|
||||
* returns a decimal digit.
|
||||
*/
|
||||
int
|
||||
hex2digit (int digit)
|
||||
{
|
||||
if (digit == 0)
|
||||
return 0;
|
||||
|
||||
if (digit >= '0' && digit <= '9')
|
||||
return digit - '0';
|
||||
if (digit >= 'a' && digit <= 'f')
|
||||
return digit - 'a' + 10;
|
||||
if (digit >= 'A' && digit <= 'F')
|
||||
return digit - 'A' + 10;
|
||||
|
||||
/* shouldn't ever get this far */
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
* convert number NIB to a hex digit.
|
||||
* param is a decimal digit.
|
||||
* returns a hex digit.
|
||||
*/
|
||||
char
|
||||
digit2hex(int digit)
|
||||
{
|
||||
if (digit < 10)
|
||||
return '0' + digit;
|
||||
else
|
||||
return 'a' + digit - 10;
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert the memory pointed to by mem into hex, placing result in buf.
|
||||
* Return a pointer to the last char put in buf (null), in case of mem fault,
|
||||
* return 0.
|
||||
* If MAY_FAULT is non-zero, then we will handle memory faults by returning
|
||||
* a 0, else treat a fault like any other fault in the stub.
|
||||
*/
|
||||
unsigned char *
|
||||
mem2hex(unsigned char *mem, unsigned char *buf, int count, int may_fault)
|
||||
{
|
||||
unsigned char ch;
|
||||
|
||||
DEBUG (1, "In mem2hex");
|
||||
|
||||
set_mem_fault_trap(MAY_FAULT);
|
||||
|
||||
while (count-- > 0) {
|
||||
ch = *mem++;
|
||||
if (mem_err) {
|
||||
DEBUG (1, "memory fault in mem2hex");
|
||||
return 0;
|
||||
}
|
||||
*buf++ = digit2hex(ch >> 4);
|
||||
*buf++ = digit2hex(ch & 0xf);
|
||||
}
|
||||
|
||||
*buf = 0;
|
||||
|
||||
set_mem_fault_trap(OK);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert the hex array pointed to by buf into binary to be placed in mem
|
||||
* return a pointer to the character AFTER the last byte written
|
||||
*/
|
||||
unsigned char *
|
||||
hex2mem(unsigned char *buf, unsigned char *mem, int count, int may_fault)
|
||||
{
|
||||
int i;
|
||||
unsigned char ch;
|
||||
|
||||
DEBUG (1, "In hex2mem");
|
||||
|
||||
set_mem_fault_trap(may_fault);
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
ch = hex2digit(*buf++) << 4;
|
||||
ch |= hex2digit(*buf++);
|
||||
*mem++ = ch;
|
||||
if (mem_err)
|
||||
return 0;
|
||||
}
|
||||
|
||||
set_mem_fault_trap(0);
|
||||
|
||||
return mem;
|
||||
}
|
||||
|
||||
/*
|
||||
* while we find nice hex chars, build an int.
|
||||
* param is a pointer to the string.
|
||||
* returns the int in the param field, and the number of chars processed.
|
||||
*/
|
||||
int
|
||||
hex2int (char **ptr, int *intValue)
|
||||
{
|
||||
int numChars = 0;
|
||||
int hexValue;
|
||||
|
||||
*intValue = 0;
|
||||
|
||||
while (**ptr)
|
||||
{
|
||||
hexValue = hex2digit(**ptr);
|
||||
if (hexValue < 0)
|
||||
break;
|
||||
|
||||
*intValue = (*intValue << 4) | hexValue;
|
||||
numChars ++;
|
||||
(*ptr)++;
|
||||
}
|
||||
return (numChars);
|
||||
}
|
||||
|
||||
/*
|
||||
* Scan for the sequence $<data>#<checksum>
|
||||
*/
|
||||
void
|
||||
getpacket(unsigned char *buffer)
|
||||
{
|
||||
unsigned char checksum;
|
||||
unsigned char xmitcsum;
|
||||
int i;
|
||||
int count;
|
||||
unsigned char ch;
|
||||
|
||||
do {
|
||||
/* wait around for the start character, ignore all other characters */
|
||||
while ((ch = (inbyte() & 0x7f)) != '$') ;
|
||||
|
||||
checksum = 0;
|
||||
xmitcsum = -1;
|
||||
|
||||
count = 0;
|
||||
|
||||
/* now, read until a # or end of buffer is found */
|
||||
while (count < BUFMAX) {
|
||||
ch = inbyte() & 0x7f;
|
||||
if (ch == '#')
|
||||
break;
|
||||
checksum = checksum + ch;
|
||||
buffer[count] = ch;
|
||||
count = count + 1;
|
||||
}
|
||||
|
||||
if (count >= BUFMAX)
|
||||
continue;
|
||||
|
||||
buffer[count] = 0;
|
||||
|
||||
if (ch == '#') {
|
||||
xmitcsum = hex2digit(inbyte() & 0x7f) << 4;
|
||||
xmitcsum |= hex2digit(inbyte() & 0x7f);
|
||||
#if 1
|
||||
/* Humans shouldn't have to figure out checksums to type to it. */
|
||||
outbyte ('+');
|
||||
return;
|
||||
#endif
|
||||
if (checksum != xmitcsum)
|
||||
outbyte('-'); /* failed checksum */
|
||||
else {
|
||||
outbyte('+'); /* successful transfer */
|
||||
/* if a sequence char is present, reply the sequence ID */
|
||||
if (buffer[2] == ':') {
|
||||
outbyte(buffer[0]);
|
||||
outbyte(buffer[1]);
|
||||
/* remove sequence chars from buffer */
|
||||
count = strlen(buffer);
|
||||
for (i=3; i <= count; i++)
|
||||
buffer[i-3] = buffer[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while (checksum != xmitcsum);
|
||||
}
|
||||
|
||||
/*
|
||||
* Send the packet in buffer.
|
||||
*/
|
||||
void
|
||||
putpacket(unsigned char *buffer)
|
||||
{
|
||||
unsigned char checksum;
|
||||
int count;
|
||||
unsigned char ch;
|
||||
|
||||
/* $<packet info>#<checksum>. */
|
||||
do {
|
||||
outbyte('$');
|
||||
checksum = 0;
|
||||
count = 0;
|
||||
|
||||
while (ch = buffer[count]) {
|
||||
if (! outbyte(ch))
|
||||
return;
|
||||
checksum += ch;
|
||||
count += 1;
|
||||
}
|
||||
|
||||
outbyte('#');
|
||||
outbyte(digit2hex(checksum >> 4));
|
||||
outbyte(digit2hex(checksum & 0xf));
|
||||
|
||||
}
|
||||
while ((inbyte() & 0x7f) != '+');
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void
|
||||
gdb_event_loop(int sigval, unsigned long *registers)
|
||||
{
|
||||
int addr;
|
||||
int length;
|
||||
unsigned char *ptr;
|
||||
ptr = packet_out_buf;
|
||||
|
||||
DEBUG (1, "In gdb_event_loop");
|
||||
|
||||
while (1) {
|
||||
packet_out_buf[0] = 0;
|
||||
|
||||
getpacket(packet_in_buf);
|
||||
ptr = &packet_in_buf[1];
|
||||
|
||||
switch (packet_in_buf[0]) {
|
||||
case '?': /* get the last known signal */
|
||||
gdb_last_signal(sigval);
|
||||
break;
|
||||
|
||||
case 'd': /* toggle debug messages from the stub */
|
||||
gdb_toggle();
|
||||
break;
|
||||
|
||||
case 'g': /* return the value of the CPU registers */
|
||||
target_read_registers(registers);
|
||||
break;
|
||||
|
||||
case 'G': /* set the value of the CPU registers - return OK */
|
||||
target_write_registers(registers);
|
||||
break;
|
||||
|
||||
case 'm': /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */
|
||||
/* Try to read %x,%x. */
|
||||
if (hex2int((char **)&ptr, &addr)
|
||||
&& *ptr++ == ','
|
||||
&& hex2int((char **)&ptr, &length)) {
|
||||
gdb_read_memory(addr, length);
|
||||
} else {
|
||||
make_return_packet(1);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'M': /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */
|
||||
/* Try to read '%x,%x:'. */
|
||||
if (hex2int((char **)&ptr, &addr)
|
||||
&& *ptr++ == ','
|
||||
&& hex2int((char **)&ptr, &length)
|
||||
&& *ptr++ == ':') {
|
||||
gdb_write_memory (addr, length, ptr);
|
||||
} else {
|
||||
make_return_packet(2);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'c': /* cAA..AA Continue at address AA..AA(optional) */
|
||||
/* try to read optional parameter, pc unchanged if no parm */
|
||||
if (hex2int((char **)&ptr, &addr)) {
|
||||
write_pc(registers, addr);
|
||||
}
|
||||
|
||||
/*
|
||||
* we need to flush the instruction cache here, as we may have
|
||||
* deposited a breakpoint, and the icache probably has no way of
|
||||
* knowing that a data ref to some location may have changed
|
||||
* something that is in the instruction cache.
|
||||
*/
|
||||
|
||||
flush_i_cache();
|
||||
/* by returning, we pick up execution where we left off */
|
||||
return;
|
||||
|
||||
/* kill the program */
|
||||
case 'k' :
|
||||
gdb_kill();
|
||||
break;
|
||||
case 'r': /* Reset */
|
||||
target_reset();
|
||||
break;
|
||||
} /* switch */
|
||||
|
||||
/* reply to the request */
|
||||
putpacket(packet_out_buf);
|
||||
}
|
||||
DEBUG (1, "Leaving handle_exception()");
|
||||
}
|
||||
|
||||
/* Convert the hardware trap type code to a unix signal number. */
|
||||
|
||||
int
|
||||
computeSignal(int tt)
|
||||
{
|
||||
struct trap_info *ht;
|
||||
|
||||
for (ht = hard_trap_info; ht->tt && ht->signo; ht++)
|
||||
if (ht->tt == tt)
|
||||
return ht->signo;
|
||||
|
||||
return SIGHUP; /* default for things we don't know about */
|
||||
}
|
||||
|
||||
/*
|
||||
* Set up exception handlers for tracing and breakpoints
|
||||
*/
|
||||
void
|
||||
set_debug_traps()
|
||||
{
|
||||
struct trap_info *ht;
|
||||
|
||||
DEBUG (1, "Entering set_debug_traps()");
|
||||
|
||||
if (hard_trap_info->tt == 0) {
|
||||
print ("ERROR: ARG#$@%^&*!! no hard trap info!!\r\n");
|
||||
}
|
||||
|
||||
for (ht = hard_trap_info; ht->tt && ht->signo; ht++) {
|
||||
exception_handler(ht->tt, (unsigned long)default_trap_hook);
|
||||
}
|
||||
|
||||
/* In case GDB is started before us, ack any packets (presumably
|
||||
"$?#xx") sitting there. */
|
||||
|
||||
outbyte ('+');
|
||||
initialized = 1;
|
||||
|
||||
DEBUG (1, "Leaving set_debug_traps()");
|
||||
}
|
||||
|
||||
/*
|
||||
* make a return packet.
|
||||
* param is the value to return.
|
||||
* 0 = OK, any other value is converted to a two digit hex number.
|
||||
* returns a string or "OK" or "ENN", where NN is the error number. Each N
|
||||
* is an ASCII encoded hex digit.
|
||||
*/
|
||||
char *
|
||||
make_return_packet(int val)
|
||||
{
|
||||
if (val == 0) {
|
||||
packet_out_buf[0] = 'O';
|
||||
packet_out_buf[1] = 'K';
|
||||
packet_out_buf[2] = 0;
|
||||
} else {
|
||||
packet_out_buf[0] = 'E';
|
||||
packet_out_buf[1] = digit2hex((val >> 4) & 0xf);
|
||||
packet_out_buf[2] = digit2hex(val & 0xf);
|
||||
packet_out_buf[3] = 0;
|
||||
}
|
||||
return(packet_out_buf);
|
||||
}
|
||||
|
||||
/*
|
||||
* g - read registers.
|
||||
* no params.
|
||||
* returns a vector of words, size is NUM_REGS.
|
||||
*/
|
||||
char *
|
||||
gdb_read_registers()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* G - write registers.
|
||||
* param is a vector of words, size is NUM_REGS.
|
||||
* returns an OK or an error number.
|
||||
*/
|
||||
char *
|
||||
gdb_write_registers(char *regs)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* m - read memory.
|
||||
* params are the address to start the read at and the number of
|
||||
* bytes to read.
|
||||
* returns a vector of nbytes or an error number.
|
||||
* Can be fewer bytes than requested if able to read only part of the
|
||||
* data.
|
||||
*/
|
||||
char *
|
||||
gdb_read_memory(long addr, int nbytes)
|
||||
{
|
||||
if (mem2hex((char *)addr, packet_out_buf, nbytes, MAY_FAULT))
|
||||
return(packet_out_buf);
|
||||
else {
|
||||
return(make_return_packet(3));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* M write memory
|
||||
* params are the address to start writing to, the number of
|
||||
* bytes to write, and the new values of the bytes.
|
||||
* returns an OK or an error number.
|
||||
*/
|
||||
char *
|
||||
gdb_write_memory(long addr, int nbytes, char *mem)
|
||||
{
|
||||
if (hex2mem(mem, (char *)addr, nbytes, MAY_FAULT))
|
||||
return(make_return_packet(OK));
|
||||
else {
|
||||
return(make_return_packet(3));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* c - continue at address.
|
||||
* param is the address to start at, and an optional signal. If
|
||||
* sig is zero, then ignore it.
|
||||
* returns an OK or an error number.
|
||||
*/
|
||||
char *
|
||||
gdb_continue(int sig, long addr)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* s - step instruction(s)
|
||||
* param is the address to start at, and an optional signal. If
|
||||
* sig is zero, then ignore it.
|
||||
* returns an OK or an error number.
|
||||
*/
|
||||
char *
|
||||
gdb_step(int sig, long addr)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* k - kill program.
|
||||
* no params.
|
||||
* returns an OK or an error number.
|
||||
*/
|
||||
char *
|
||||
gdb_kill()
|
||||
{
|
||||
/* generically, we can't do anything for this command */
|
||||
return(make_return_packet(OK));
|
||||
}
|
||||
|
||||
/*
|
||||
* ? - last signal.
|
||||
* no params.
|
||||
* returns the last signal number.
|
||||
*/
|
||||
char *
|
||||
gdb_last_signal(int val)
|
||||
{
|
||||
DEBUG (1, "Entering gdb_last_signal()");
|
||||
|
||||
packet_out_buf[0] = 'S';
|
||||
packet_out_buf[1] = digit2hex(val >> 4);
|
||||
packet_out_buf[2] = digit2hex(val & 0xf);
|
||||
packet_out_buf[3] = 0;
|
||||
|
||||
DEBUG (1, "Leaving gdb_last_signal()");
|
||||
return (packet_out_buf);
|
||||
}
|
||||
|
||||
/*
|
||||
* b - change baud rate.
|
||||
* param is the new baudrate
|
||||
* returns the baud rate.
|
||||
*/
|
||||
char *
|
||||
gdb_baudrate(int baud)
|
||||
{
|
||||
/* generically, we can't do anything for this command */
|
||||
return(make_return_packet(OK));
|
||||
}
|
||||
|
||||
/*
|
||||
* T - dump state.
|
||||
* no params.
|
||||
* returns the signal number, the registers, the thread ID, and
|
||||
* possible extensions in a vector that looks like:
|
||||
* TAAn...:r...;n...:r...;n...:r...; where:
|
||||
* AA = signal number
|
||||
* n... = register number (hex)
|
||||
* r... = register contents
|
||||
* n... = `thread'
|
||||
* r... = thread process ID. This is a hex integer.
|
||||
* n... = other string not starting with valid hex digit.
|
||||
* gdb should ignore this n,r pair and go on to
|
||||
* the next. This way we can extend the protocol.
|
||||
*/
|
||||
char *
|
||||
gdb_dump_state()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* D - host requests a detach
|
||||
* no params.
|
||||
* returns either a S, T, W, or X command.
|
||||
* returns an OK or an error number.
|
||||
*/
|
||||
char *
|
||||
gdb_detach()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* H - set thread.
|
||||
* params are the command to execute and the thread ID.
|
||||
* cmd = 'c' for thread used in step and continue;
|
||||
* cmd = 'g' for thread used in other operations.
|
||||
* tid = -1 for all threads.
|
||||
* tid = zero, pick a thread,any thread.
|
||||
* returns an OK or an error number.
|
||||
*/
|
||||
char *
|
||||
gdb_set_thread(int cmd, int tid)
|
||||
{
|
||||
/* generically, we can't do anything for this command */
|
||||
return(make_return_packet(OK));
|
||||
}
|
||||
|
||||
/*
|
||||
* p - read one register.
|
||||
* param is the register number.
|
||||
* returns the register value or ENN.
|
||||
*/
|
||||
char *
|
||||
gdb_read_reg(int reg)
|
||||
{
|
||||
/* generically, we can't do anything for this command */
|
||||
return(make_return_packet(OK));
|
||||
}
|
||||
|
||||
/*
|
||||
* P - write one register.
|
||||
* params are the register number, and it's new value.
|
||||
* returns the register value or ENN.
|
||||
*/
|
||||
char *
|
||||
gdb_write_reg(int reg, long val)
|
||||
{
|
||||
/* generically, we can't do anything for this command */
|
||||
|
||||
return(make_return_packet(OK));
|
||||
}
|
||||
|
||||
/*
|
||||
* W - process exited.
|
||||
* no params.
|
||||
* returns the exit status.
|
||||
*/
|
||||
char *
|
||||
gdb_exited()
|
||||
{
|
||||
/* generically, we can't do anything for this command */
|
||||
return(make_return_packet(OK));
|
||||
}
|
||||
|
||||
/*
|
||||
* X - process terminated.
|
||||
* no params.
|
||||
* returns the last signal.
|
||||
*/
|
||||
char *
|
||||
gdb_terminated()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* O - hex encoding.
|
||||
* params are a vector of bytes, and the number of bytes to encode.
|
||||
* returns a vector of ASCII encoded hex numbers.
|
||||
*/
|
||||
char *
|
||||
gdb_hex(char *str, int nbytes)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* A - tread alive request.
|
||||
* param is the thread ID.
|
||||
* returns an OK or an error number.
|
||||
*/
|
||||
char *
|
||||
gdb_thread_alive(int tid)
|
||||
{
|
||||
/* generically, we can't do anything for this command */
|
||||
return(make_return_packet(OK));
|
||||
}
|
||||
|
||||
/*
|
||||
* ! - extended protocol.
|
||||
* no params.
|
||||
* returns an OK or an error number.
|
||||
*/
|
||||
char *
|
||||
gdb_extended()
|
||||
{
|
||||
/* generically, we can't do anything for this command */
|
||||
return(make_return_packet(OK));
|
||||
}
|
||||
|
||||
/*
|
||||
* d - toggle gdb stub diagnostics.
|
||||
* no params.
|
||||
* returns an OK or an error number.
|
||||
*/
|
||||
char *
|
||||
gdb_debug()
|
||||
{
|
||||
if (remote_debug > 0)
|
||||
remote_debug = 0;
|
||||
else
|
||||
remote_debug = 1;
|
||||
|
||||
return(make_return_packet(OK));
|
||||
}
|
||||
|
||||
/*
|
||||
* d - toggle gdb stub.
|
||||
* no params.
|
||||
* returns an OK or an error number.
|
||||
*/
|
||||
char *
|
||||
gdb_toggle()
|
||||
{
|
||||
static int level = 0;
|
||||
|
||||
if (remote_debug) {
|
||||
level = remote_debug;
|
||||
remote_debug = 0;
|
||||
} else {
|
||||
remote_debug = level;
|
||||
}
|
||||
|
||||
return(make_return_packet(OK));
|
||||
}
|
||||
|
||||
/*
|
||||
* r - reset target
|
||||
* no params.
|
||||
* returns an OK or an error number.
|
||||
*/
|
||||
char *
|
||||
gdb_reset()
|
||||
{
|
||||
/* generically, we can't do anything for this command */
|
||||
return(make_return_packet(OK));
|
||||
}
|
||||
|
||||
/*
|
||||
* t - search backwards.
|
||||
* params are the address to start searching from, a pattern to match, and
|
||||
* the mask to use.
|
||||
* FIXME: not entirely sure what this is supposed to return.
|
||||
*/
|
||||
char *
|
||||
gdb_search(long addr, long pat, long mask)
|
||||
{
|
||||
/* generically, we can't do anything for this command */
|
||||
return(make_return_packet(OK));
|
||||
}
|
||||
|
||||
/*
|
||||
* q - general get query.
|
||||
* param is a string, that's the query to be executed.
|
||||
* FIXME: not entirely sure what this is supposed to return.
|
||||
*/
|
||||
char *
|
||||
gdb_get_query(char *query)
|
||||
{
|
||||
/* generically, we can't do anything for this command */
|
||||
return(make_return_packet(OK));
|
||||
}
|
||||
|
||||
/*
|
||||
* Q - general set query
|
||||
* param is a string, that's the query to be executed.
|
||||
* FIXME: not entirely sure what this means.
|
||||
* returns an OK or an error number.
|
||||
*/
|
||||
char *
|
||||
gdb_set(char *query)
|
||||
{
|
||||
/* generically, we can't do anything for this command */
|
||||
return(make_return_packet(OK));
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,150 @@
|
|||
/*
|
||||
* Copyright (c) 1995, 1996 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.
|
||||
*/
|
||||
|
||||
static const char hexchars[]="0123456789abcdef";
|
||||
|
||||
typedef void (*exception_t)(int); /* pointer to function with int parm */
|
||||
|
||||
/*
|
||||
* This is the default function handler to be called with all exceptions.
|
||||
*/
|
||||
extern exception_t default_trap_hook;
|
||||
|
||||
/* this is used to make Unix style signale nukbers to an exception */
|
||||
struct trap_info
|
||||
{
|
||||
unsigned char tt; /* exception number */
|
||||
unsigned char signo; /* corresponding signal number */
|
||||
};
|
||||
|
||||
/*
|
||||
* prototypes for the functions in debug.c. As these'll only be used with GCC,
|
||||
* we don't worry about no stinkin K&R comilers.
|
||||
*/
|
||||
extern void exception_handler (int, unsigned long);
|
||||
extern unsigned char *mem2hex(unsigned char *, unsigned char *, int, int);
|
||||
extern unsigned char *hex2mem(unsigned char *, unsigned char *, int, int);
|
||||
extern void getpacket(unsigned char *);
|
||||
extern void putpacket(unsigned char *);
|
||||
extern char *make_return_packet(int);
|
||||
extern void set_debug_traps();
|
||||
extern int computeSignal(int);
|
||||
extern char digit2hex(int);
|
||||
extern int hex2digit(int);
|
||||
extern void debuglogs(int level, char *msg);
|
||||
extern int hex2int();
|
||||
extern char *int2hex(int);
|
||||
extern void gdb_event_loop(int, unsigned long *);
|
||||
|
||||
extern char *gdb_read_registers(); /* g - read registers */
|
||||
extern char *gdb_write_registers(char *); /* G - write registers */
|
||||
extern char *gdb_read_memory(long, int); /* m - read memory */
|
||||
extern char *gdb_write_memory(long, int, char *);/* M write memory */
|
||||
extern char *gdb_continue(int, long ); /* c - continue */
|
||||
extern char *gdb_step(int, long); /* s - step instruction(s) */
|
||||
extern char *gdb_kill(); /* k - kill program */
|
||||
extern char *gdb_last_signal(); /* ? - last signal */
|
||||
extern char *gdb_baudrate(int); /* b - change baud rate */
|
||||
extern char *gdb_dump_state(); /* T - dump state */
|
||||
extern char *gdb_set_thread(int, int); /* H - set thread */
|
||||
extern char *gdb_detach(); /* D - detach */
|
||||
extern char *gdb_read_reg(int); /* p - read one register */
|
||||
extern char *gdb_write_reg(int, long); /* P - write one register */
|
||||
extern char *gdb_exited(); /* W - process exited */
|
||||
extern char *gdb_terminated(); /* X - process terminated */
|
||||
extern char *gdb_hex(); /* O - hex encoding */
|
||||
extern char *gdb_thread_alive(int); /* A - tread alive request */
|
||||
extern char *gdb_extended(); /* ! - extended protocol */
|
||||
extern char *gdb_debug(); /* d - toggle stub diagnostics */
|
||||
extern char *gdb_toggle(); /* unsupported, toggle stub on/off */
|
||||
extern char *gdb_reset(); /* r - reset target */
|
||||
extern char *gdb_search(long, long, long); /* t - search backwards */
|
||||
extern char *gdb_query(char *); /* q - general query */
|
||||
extern char *gdb_set(char *); /* Q - set value */
|
||||
|
||||
/*
|
||||
* indicate to caller of mem2hex or hex2mem that there has been an error.
|
||||
* 0 means ok, 1 means error
|
||||
*/
|
||||
extern int mem_err;
|
||||
|
||||
/*
|
||||
* indicate whether the debug vectors have been initialized
|
||||
* 0 means not yet, 1 means yep, it's ready.
|
||||
*/
|
||||
extern int initialized;
|
||||
|
||||
/*
|
||||
* 1 means print debugging messages from the target, 0 means be quiet.
|
||||
*/
|
||||
extern int remote_debug;
|
||||
|
||||
/*
|
||||
* Set up the command processing required for GDB
|
||||
*/
|
||||
|
||||
struct gdb_ops {
|
||||
/*
|
||||
* these functions are the most minimal working subset top get full
|
||||
* functionality for remote debugging
|
||||
*/
|
||||
char *(*gdb_read_registers); /* g - read registers */
|
||||
char *(*gdb_write_registers)(char *); /* G - write registers */
|
||||
char *(*gdb_read_memory)(long, int); /* m - read memory */
|
||||
char *(*gdb_write_memory)(long, int, char *);/* M write memory */
|
||||
char *(*gdb_continue)(int, long ); /* c - continue */
|
||||
char *(*gdb_step)(int, long); /* s - step instruction(s) */
|
||||
char *(*gdb_kill); /* k - kill program */
|
||||
char *(*gdb_last_signal); /* ? - last signal */
|
||||
char *(*gdb_baudrate)(int); /* b - change baud rate */
|
||||
char *(*gdb_dump_state); /* T - dump state */
|
||||
/*
|
||||
* these functions are for a more sophisticated target, typically
|
||||
* running a simple RTOS.
|
||||
*/
|
||||
char *(*gdb_set_thread)(int, int); /* H - set thread */
|
||||
char *(*gdb_detach); /* D - detach */
|
||||
char *(*gdb_read_reg)(int); /* p - read one register */
|
||||
char *(*gdb_write_reg)(int, long); /* P - write one register */
|
||||
char *(*gdb_exited); /* W - process exited */
|
||||
char *(*gdb_terminated); /* X - process terminated */
|
||||
char *(*gdb_hex); /* O - hex encoding */
|
||||
char *(*gdb_thread_alive)(int); /* A - tread alive request */
|
||||
/* FIXME: not standard yet */
|
||||
char *(*gdb_extended); /* ! - extended protocol */
|
||||
char *(*gdb_debug); /* d - toggle stub diagnostics */
|
||||
char *(*gdb_toggle); /* unsupported, toggle stub on/off */
|
||||
char *(*gdb_reset); /* r - reset target */
|
||||
char *(*gdb_search)(long, long, long); /* t - search backwards */
|
||||
char *(*gdb_query)(char *); /* q - general query */
|
||||
char *(*gdb_set)(long); /* Q - set value */
|
||||
};
|
||||
|
||||
/*
|
||||
* BUFMAX defines the maximum number of characters in inbound/outbound buffers
|
||||
* at least NUMREGBYTES*2 are needed for register packets
|
||||
*/
|
||||
#define BUFMAX 2048
|
||||
extern char packet_in_buf[BUFMAX];
|
||||
extern char packet_out_buf[BUFMAX];
|
||||
extern int packet_index;
|
||||
|
||||
#define DEBUG(x, y) debuglog(x, y);
|
||||
#define set_debug_level(x) remote_debug = x;
|
||||
#define OK 0
|
||||
#define ERROR -1
|
||||
#define ENN(x) "x"
|
||||
|
||||
#define MAY_FAULT 1
|
||||
#define NO_FAULT 0
|
|
@ -0,0 +1,147 @@
|
|||
# Copyright (c) 1995, 1996 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.
|
||||
#
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
mandir = @mandir@
|
||||
man1dir = $(mandir)/man1
|
||||
infodir = @infodir@
|
||||
|
||||
MAKEINFO = makeinfo
|
||||
TEXI2DVI = TEXINPUTS=$(TEXIDIR):$(srcdir):$$TEXINPUTS texi2dvi
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
# Where to find texinfo.tex to format docn with TeX
|
||||
TEXIDIR = $(srcdir)/../../texinfo
|
||||
|
||||
MANPAGES =
|
||||
|
||||
all:
|
||||
|
||||
info: porting.info
|
||||
|
||||
dvi: porting.dvi
|
||||
|
||||
ps: porting.ps
|
||||
|
||||
doc: info dvi
|
||||
|
||||
porting: porting.dvi porting.info
|
||||
|
||||
######################################################################
|
||||
# DOCUMENTATION TARGETS
|
||||
# TeX output
|
||||
porting.dvi: $(srcdir)/porting.texi $(srcdir)/porting.texi
|
||||
$(TEXI2DVI) $(srcdir)/porting.texi
|
||||
|
||||
# info file for online browsing
|
||||
porting.info: $(srcdir)/porting.texi $(srcdir)/porting.texi
|
||||
$(MAKEINFO) -I $(srcdir) -o porting.info $(srcdir)/porting.texi
|
||||
|
||||
porting.ps: porting.dvi
|
||||
dvips -f porting.dvi > porting.ps
|
||||
|
||||
# different targets for -ms, -mm, -me
|
||||
# Try to use a recent texi2roff. v2 was put on prep in jan91.
|
||||
# If you want an index, see texi2roff doc for postprocessing
|
||||
# and add -i to texi2roff invocations below.
|
||||
# Workarounds for texi2roff-2 (probably fixed in later texi2roff's, delete
|
||||
# correspondint -e lines when later texi2roff's are current)
|
||||
# + @ifinfo's deleted explicitly due to texi2roff-2 bug w nested constructs.
|
||||
# + @c's deleted explicitly because texi2roff sees texinfo commands in them
|
||||
# + @ (that's at-BLANK) not recognized by texi2roff, turned into blank
|
||||
# + @alphaenumerate is ridiculously new, turned into @enumerate
|
||||
|
||||
# roff output (-ms)
|
||||
porting.ms: $(srcdir)/porting.texi
|
||||
sed -e '/\\input texinfo/d' \
|
||||
-e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
|
||||
-e '/^@ifinfo/,/^@end ifinfo/d' \
|
||||
-e '/^@c/d' \
|
||||
-e 's/{.*,,/{/' \
|
||||
-e 's/@ / /g' \
|
||||
-e 's/^@alphaenumerate/@enumerate/g' \
|
||||
-e 's/^@end alphaenumerate/@end enumerate/g' \
|
||||
$(srcdir)/porting.texi | \
|
||||
$(TEXI2ROFF) -ms | \
|
||||
sed -e 's/---/\\(em/g' \
|
||||
>porting.ms
|
||||
|
||||
# roff output (-mm)
|
||||
# '@noindent's removed due to texi2roff-2 mm bug; if yours is newer,
|
||||
# try leaving them in
|
||||
porting.mm: $(srcdir)/porting.texi
|
||||
sed -e '/\\input texinfo/d' \
|
||||
-e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
|
||||
-e '/^@ifinfo/,/^@end ifinfo/d' \
|
||||
-e '/^@c/d' \
|
||||
-e 's/{.*,,/{/' \
|
||||
-e '/@noindent/d' \
|
||||
-e 's/@ / /g' \
|
||||
-e 's/^@alphaenumerate/@enumerate/g' \
|
||||
-e 's/^@end alphaenumerate/@end enumerate/g' \
|
||||
$(srcdir)/porting.texi | \
|
||||
$(TEXI2ROFF) -mm | \
|
||||
sed -e 's/---/\\(em/g' \
|
||||
>porting.mm
|
||||
|
||||
# roff output (-me)
|
||||
porting.me: $(srcdir)/porting.texi
|
||||
sed -e '/\\input texinfo/d' \
|
||||
-e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
|
||||
-e '/^@ifinfo/,/^@end ifinfo/d' \
|
||||
-e '/^@c/d' \
|
||||
-e 's/{.*,,/{/' \
|
||||
-e 's/@ / /g' \
|
||||
-e 's/^@alphaenumerate/@enumerate/g' \
|
||||
-e 's/^@end alphaenumerate/@end enumerate/g' \
|
||||
$(srcdir)/porting.texi | \
|
||||
$(TEXI2ROFF) -me | \
|
||||
sed -e 's/---/\\(em/g' \
|
||||
>porting.me
|
||||
|
||||
|
||||
######################################################################
|
||||
|
||||
clean mostlyclean:
|
||||
-rm -f *.o *~ \#* core *.aux *.cp *.dvi *.fn *.ky *.log *.pg *.toc \
|
||||
*.tp *.vr *.cps *.fns *.kys *.pgs *.tps *.vrs *.info* *.1 *.ps
|
||||
|
||||
maintainer-clean realclean: clean
|
||||
-rm -f
|
||||
|
||||
install:
|
||||
|
||||
install-info: info
|
||||
for i in *.info* ; do \
|
||||
$(INSTALL_DATA) $$i $(infodir)/$$i ; \
|
||||
done
|
||||
|
||||
clean-info:
|
||||
-rm -rf *.info*
|
||||
|
||||
distclean: clean
|
||||
-rm -f Makefile config.cache config.log config.status
|
||||
|
||||
Makefile: Makefile.in config.status
|
||||
$(SHELL) config.status
|
||||
|
||||
config.status: configure
|
||||
$(SHELL) config.status --recheck
|
|
@ -0,0 +1,887 @@
|
|||
#! /bin/sh
|
||||
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated automatically using autoconf version 2.12.1
|
||||
# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
|
||||
#
|
||||
# This configure script is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy, distribute and modify it.
|
||||
|
||||
# Defaults:
|
||||
ac_help=
|
||||
ac_default_prefix=/usr/local
|
||||
# Any additions from configure.in:
|
||||
|
||||
# Initialize some variables set by options.
|
||||
# The variables have the same names as the options, with
|
||||
# dashes changed to underlines.
|
||||
build=NONE
|
||||
cache_file=./config.cache
|
||||
exec_prefix=NONE
|
||||
host=NONE
|
||||
no_create=
|
||||
nonopt=NONE
|
||||
no_recursion=
|
||||
prefix=NONE
|
||||
program_prefix=NONE
|
||||
program_suffix=NONE
|
||||
program_transform_name=s,x,x,
|
||||
silent=
|
||||
site=
|
||||
srcdir=
|
||||
target=NONE
|
||||
verbose=
|
||||
x_includes=NONE
|
||||
x_libraries=NONE
|
||||
bindir='${exec_prefix}/bin'
|
||||
sbindir='${exec_prefix}/sbin'
|
||||
libexecdir='${exec_prefix}/libexec'
|
||||
datadir='${prefix}/share'
|
||||
sysconfdir='${prefix}/etc'
|
||||
sharedstatedir='${prefix}/com'
|
||||
localstatedir='${prefix}/var'
|
||||
libdir='${exec_prefix}/lib'
|
||||
includedir='${prefix}/include'
|
||||
oldincludedir='/usr/include'
|
||||
infodir='${prefix}/info'
|
||||
mandir='${prefix}/man'
|
||||
|
||||
# Initialize some other variables.
|
||||
subdirs=
|
||||
MFLAGS= MAKEFLAGS=
|
||||
SHELL=${CONFIG_SHELL-/bin/sh}
|
||||
# Maximum number of lines to put in a shell here document.
|
||||
ac_max_here_lines=12
|
||||
|
||||
ac_prev=
|
||||
for ac_option
|
||||
do
|
||||
|
||||
# If the previous option needs an argument, assign it.
|
||||
if test -n "$ac_prev"; then
|
||||
eval "$ac_prev=\$ac_option"
|
||||
ac_prev=
|
||||
continue
|
||||
fi
|
||||
|
||||
case "$ac_option" in
|
||||
-*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
|
||||
*) ac_optarg= ;;
|
||||
esac
|
||||
|
||||
# Accept the important Cygnus configure options, so we can diagnose typos.
|
||||
|
||||
case "$ac_option" in
|
||||
|
||||
-bindir | --bindir | --bindi | --bind | --bin | --bi)
|
||||
ac_prev=bindir ;;
|
||||
-bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
|
||||
bindir="$ac_optarg" ;;
|
||||
|
||||
-build | --build | --buil | --bui | --bu)
|
||||
ac_prev=build ;;
|
||||
-build=* | --build=* | --buil=* | --bui=* | --bu=*)
|
||||
build="$ac_optarg" ;;
|
||||
|
||||
-cache-file | --cache-file | --cache-fil | --cache-fi \
|
||||
| --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
|
||||
ac_prev=cache_file ;;
|
||||
-cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
|
||||
| --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
|
||||
cache_file="$ac_optarg" ;;
|
||||
|
||||
-datadir | --datadir | --datadi | --datad | --data | --dat | --da)
|
||||
ac_prev=datadir ;;
|
||||
-datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
|
||||
| --da=*)
|
||||
datadir="$ac_optarg" ;;
|
||||
|
||||
-disable-* | --disable-*)
|
||||
ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
|
||||
# Reject names that are not valid shell variable names.
|
||||
if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
|
||||
{ echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
|
||||
fi
|
||||
ac_feature=`echo $ac_feature| sed 's/-/_/g'`
|
||||
eval "enable_${ac_feature}=no" ;;
|
||||
|
||||
-enable-* | --enable-*)
|
||||
ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
|
||||
# Reject names that are not valid shell variable names.
|
||||
if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
|
||||
{ echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
|
||||
fi
|
||||
ac_feature=`echo $ac_feature| sed 's/-/_/g'`
|
||||
case "$ac_option" in
|
||||
*=*) ;;
|
||||
*) ac_optarg=yes ;;
|
||||
esac
|
||||
eval "enable_${ac_feature}='$ac_optarg'" ;;
|
||||
|
||||
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
|
||||
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
|
||||
| --exec | --exe | --ex)
|
||||
ac_prev=exec_prefix ;;
|
||||
-exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
|
||||
| --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
|
||||
| --exec=* | --exe=* | --ex=*)
|
||||
exec_prefix="$ac_optarg" ;;
|
||||
|
||||
-gas | --gas | --ga | --g)
|
||||
# Obsolete; use --with-gas.
|
||||
with_gas=yes ;;
|
||||
|
||||
-help | --help | --hel | --he)
|
||||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat << EOF
|
||||
Usage: configure [options] [host]
|
||||
Options: [defaults in brackets after descriptions]
|
||||
Configuration:
|
||||
--cache-file=FILE cache test results in FILE
|
||||
--help print this message
|
||||
--no-create do not create output files
|
||||
--quiet, --silent do not print \`checking...' messages
|
||||
--version print the version of autoconf that created configure
|
||||
Directory and file names:
|
||||
--prefix=PREFIX install architecture-independent files in PREFIX
|
||||
[$ac_default_prefix]
|
||||
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
|
||||
[same as prefix]
|
||||
--bindir=DIR user executables in DIR [EPREFIX/bin]
|
||||
--sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
|
||||
--libexecdir=DIR program executables in DIR [EPREFIX/libexec]
|
||||
--datadir=DIR read-only architecture-independent data in DIR
|
||||
[PREFIX/share]
|
||||
--sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
|
||||
--sharedstatedir=DIR modifiable architecture-independent data in DIR
|
||||
[PREFIX/com]
|
||||
--localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
|
||||
--libdir=DIR object code libraries in DIR [EPREFIX/lib]
|
||||
--includedir=DIR C header files in DIR [PREFIX/include]
|
||||
--oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
|
||||
--infodir=DIR info documentation in DIR [PREFIX/info]
|
||||
--mandir=DIR man documentation in DIR [PREFIX/man]
|
||||
--srcdir=DIR find the sources in DIR [configure dir or ..]
|
||||
--program-prefix=PREFIX prepend PREFIX to installed program names
|
||||
--program-suffix=SUFFIX append SUFFIX to installed program names
|
||||
--program-transform-name=PROGRAM
|
||||
run sed PROGRAM on installed program names
|
||||
EOF
|
||||
cat << EOF
|
||||
Host type:
|
||||
--build=BUILD configure for building on BUILD [BUILD=HOST]
|
||||
--host=HOST configure for HOST [guessed]
|
||||
--target=TARGET configure for TARGET [TARGET=HOST]
|
||||
Features and packages:
|
||||
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
|
||||
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
|
||||
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
|
||||
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
|
||||
--x-includes=DIR X include files are in DIR
|
||||
--x-libraries=DIR X library files are in DIR
|
||||
EOF
|
||||
if test -n "$ac_help"; then
|
||||
echo "--enable and --with options recognized:$ac_help"
|
||||
fi
|
||||
exit 0 ;;
|
||||
|
||||
-host | --host | --hos | --ho)
|
||||
ac_prev=host ;;
|
||||
-host=* | --host=* | --hos=* | --ho=*)
|
||||
host="$ac_optarg" ;;
|
||||
|
||||
-includedir | --includedir | --includedi | --included | --include \
|
||||
| --includ | --inclu | --incl | --inc)
|
||||
ac_prev=includedir ;;
|
||||
-includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
|
||||
| --includ=* | --inclu=* | --incl=* | --inc=*)
|
||||
includedir="$ac_optarg" ;;
|
||||
|
||||
-infodir | --infodir | --infodi | --infod | --info | --inf)
|
||||
ac_prev=infodir ;;
|
||||
-infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
|
||||
infodir="$ac_optarg" ;;
|
||||
|
||||
-libdir | --libdir | --libdi | --libd)
|
||||
ac_prev=libdir ;;
|
||||
-libdir=* | --libdir=* | --libdi=* | --libd=*)
|
||||
libdir="$ac_optarg" ;;
|
||||
|
||||
-libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
|
||||
| --libexe | --libex | --libe)
|
||||
ac_prev=libexecdir ;;
|
||||
-libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
|
||||
| --libexe=* | --libex=* | --libe=*)
|
||||
libexecdir="$ac_optarg" ;;
|
||||
|
||||
-localstatedir | --localstatedir | --localstatedi | --localstated \
|
||||
| --localstate | --localstat | --localsta | --localst \
|
||||
| --locals | --local | --loca | --loc | --lo)
|
||||
ac_prev=localstatedir ;;
|
||||
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
|
||||
| --localstate=* | --localstat=* | --localsta=* | --localst=* \
|
||||
| --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
|
||||
localstatedir="$ac_optarg" ;;
|
||||
|
||||
-mandir | --mandir | --mandi | --mand | --man | --ma | --m)
|
||||
ac_prev=mandir ;;
|
||||
-mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
|
||||
mandir="$ac_optarg" ;;
|
||||
|
||||
-nfp | --nfp | --nf)
|
||||
# Obsolete; use --without-fp.
|
||||
with_fp=no ;;
|
||||
|
||||
-no-create | --no-create | --no-creat | --no-crea | --no-cre \
|
||||
| --no-cr | --no-c)
|
||||
no_create=yes ;;
|
||||
|
||||
-no-recursion | --no-recursion | --no-recursio | --no-recursi \
|
||||
| --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
|
||||
no_recursion=yes ;;
|
||||
|
||||
-oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
|
||||
| --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
|
||||
| --oldin | --oldi | --old | --ol | --o)
|
||||
ac_prev=oldincludedir ;;
|
||||
-oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
|
||||
| --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
|
||||
| --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
|
||||
oldincludedir="$ac_optarg" ;;
|
||||
|
||||
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
|
||||
ac_prev=prefix ;;
|
||||
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
|
||||
prefix="$ac_optarg" ;;
|
||||
|
||||
-program-prefix | --program-prefix | --program-prefi | --program-pref \
|
||||
| --program-pre | --program-pr | --program-p)
|
||||
ac_prev=program_prefix ;;
|
||||
-program-prefix=* | --program-prefix=* | --program-prefi=* \
|
||||
| --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
|
||||
program_prefix="$ac_optarg" ;;
|
||||
|
||||
-program-suffix | --program-suffix | --program-suffi | --program-suff \
|
||||
| --program-suf | --program-su | --program-s)
|
||||
ac_prev=program_suffix ;;
|
||||
-program-suffix=* | --program-suffix=* | --program-suffi=* \
|
||||
| --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
|
||||
program_suffix="$ac_optarg" ;;
|
||||
|
||||
-program-transform-name | --program-transform-name \
|
||||
| --program-transform-nam | --program-transform-na \
|
||||
| --program-transform-n | --program-transform- \
|
||||
| --program-transform | --program-transfor \
|
||||
| --program-transfo | --program-transf \
|
||||
| --program-trans | --program-tran \
|
||||
| --progr-tra | --program-tr | --program-t)
|
||||
ac_prev=program_transform_name ;;
|
||||
-program-transform-name=* | --program-transform-name=* \
|
||||
| --program-transform-nam=* | --program-transform-na=* \
|
||||
| --program-transform-n=* | --program-transform-=* \
|
||||
| --program-transform=* | --program-transfor=* \
|
||||
| --program-transfo=* | --program-transf=* \
|
||||
| --program-trans=* | --program-tran=* \
|
||||
| --progr-tra=* | --program-tr=* | --program-t=*)
|
||||
program_transform_name="$ac_optarg" ;;
|
||||
|
||||
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
|
||||
| -silent | --silent | --silen | --sile | --sil)
|
||||
silent=yes ;;
|
||||
|
||||
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
|
||||
ac_prev=sbindir ;;
|
||||
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
|
||||
| --sbi=* | --sb=*)
|
||||
sbindir="$ac_optarg" ;;
|
||||
|
||||
-sharedstatedir | --sharedstatedir | --sharedstatedi \
|
||||
| --sharedstated | --sharedstate | --sharedstat | --sharedsta \
|
||||
| --sharedst | --shareds | --shared | --share | --shar \
|
||||
| --sha | --sh)
|
||||
ac_prev=sharedstatedir ;;
|
||||
-sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
|
||||
| --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
|
||||
| --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
|
||||
| --sha=* | --sh=*)
|
||||
sharedstatedir="$ac_optarg" ;;
|
||||
|
||||
-site | --site | --sit)
|
||||
ac_prev=site ;;
|
||||
-site=* | --site=* | --sit=*)
|
||||
site="$ac_optarg" ;;
|
||||
|
||||
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
|
||||
ac_prev=srcdir ;;
|
||||
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
|
||||
srcdir="$ac_optarg" ;;
|
||||
|
||||
-sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
|
||||
| --syscon | --sysco | --sysc | --sys | --sy)
|
||||
ac_prev=sysconfdir ;;
|
||||
-sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
|
||||
| --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
|
||||
sysconfdir="$ac_optarg" ;;
|
||||
|
||||
-target | --target | --targe | --targ | --tar | --ta | --t)
|
||||
ac_prev=target ;;
|
||||
-target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
|
||||
target="$ac_optarg" ;;
|
||||
|
||||
-v | -verbose | --verbose | --verbos | --verbo | --verb)
|
||||
verbose=yes ;;
|
||||
|
||||
-version | --version | --versio | --versi | --vers)
|
||||
echo "configure generated by autoconf version 2.12.1"
|
||||
exit 0 ;;
|
||||
|
||||
-with-* | --with-*)
|
||||
ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
|
||||
# Reject names that are not valid shell variable names.
|
||||
if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
|
||||
{ echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
|
||||
fi
|
||||
ac_package=`echo $ac_package| sed 's/-/_/g'`
|
||||
case "$ac_option" in
|
||||
*=*) ;;
|
||||
*) ac_optarg=yes ;;
|
||||
esac
|
||||
eval "with_${ac_package}='$ac_optarg'" ;;
|
||||
|
||||
-without-* | --without-*)
|
||||
ac_package=`echo $ac_option|sed -e 's/-*without-//'`
|
||||
# Reject names that are not valid shell variable names.
|
||||
if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
|
||||
{ echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
|
||||
fi
|
||||
ac_package=`echo $ac_package| sed 's/-/_/g'`
|
||||
eval "with_${ac_package}=no" ;;
|
||||
|
||||
--x)
|
||||
# Obsolete; use --with-x.
|
||||
with_x=yes ;;
|
||||
|
||||
-x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
|
||||
| --x-incl | --x-inc | --x-in | --x-i)
|
||||
ac_prev=x_includes ;;
|
||||
-x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
|
||||
| --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
|
||||
x_includes="$ac_optarg" ;;
|
||||
|
||||
-x-libraries | --x-libraries | --x-librarie | --x-librari \
|
||||
| --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
|
||||
ac_prev=x_libraries ;;
|
||||
-x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
|
||||
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
|
||||
x_libraries="$ac_optarg" ;;
|
||||
|
||||
-*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
|
||||
;;
|
||||
|
||||
*)
|
||||
if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
|
||||
echo "configure: warning: $ac_option: invalid host type" 1>&2
|
||||
fi
|
||||
if test "x$nonopt" != xNONE; then
|
||||
{ echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
|
||||
fi
|
||||
nonopt="$ac_option"
|
||||
;;
|
||||
|
||||
esac
|
||||
done
|
||||
|
||||
if test -n "$ac_prev"; then
|
||||
{ echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
|
||||
fi
|
||||
|
||||
trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
|
||||
|
||||
# File descriptor usage:
|
||||
# 0 standard input
|
||||
# 1 file creation
|
||||
# 2 errors and warnings
|
||||
# 3 some systems may open it to /dev/tty
|
||||
# 4 used on the Kubota Titan
|
||||
# 6 checking for... messages and results
|
||||
# 5 compiler messages saved in config.log
|
||||
if test "$silent" = yes; then
|
||||
exec 6>/dev/null
|
||||
else
|
||||
exec 6>&1
|
||||
fi
|
||||
exec 5>./config.log
|
||||
|
||||
echo "\
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
" 1>&5
|
||||
|
||||
# Strip out --no-create and --no-recursion so they do not pile up.
|
||||
# Also quote any args containing shell metacharacters.
|
||||
ac_configure_args=
|
||||
for ac_arg
|
||||
do
|
||||
case "$ac_arg" in
|
||||
-no-create | --no-create | --no-creat | --no-crea | --no-cre \
|
||||
| --no-cr | --no-c) ;;
|
||||
-no-recursion | --no-recursion | --no-recursio | --no-recursi \
|
||||
| --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
|
||||
*" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
|
||||
ac_configure_args="$ac_configure_args '$ac_arg'" ;;
|
||||
*) ac_configure_args="$ac_configure_args $ac_arg" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# NLS nuisances.
|
||||
# Only set these to C if already set. These must not be set unconditionally
|
||||
# because not all systems understand e.g. LANG=C (notably SCO).
|
||||
# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
|
||||
# Non-C LC_CTYPE values break the ctype check.
|
||||
if test "${LANG+set}" = set; then LANG=C; export LANG; fi
|
||||
if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
|
||||
if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
|
||||
if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
|
||||
|
||||
# confdefs.h avoids OS command line length limits that DEFS can exceed.
|
||||
rm -rf conftest* confdefs.h
|
||||
# AIX cpp loses on an empty file, so make sure it contains at least a newline.
|
||||
echo > confdefs.h
|
||||
|
||||
# A filename unique to this package, relative to the directory that
|
||||
# configure is in, which we can look for to find out if srcdir is correct.
|
||||
ac_unique_file=porting.texi
|
||||
|
||||
# Find the source files, if location was not specified.
|
||||
if test -z "$srcdir"; then
|
||||
ac_srcdir_defaulted=yes
|
||||
# Try the directory containing this script, then its parent.
|
||||
ac_prog=$0
|
||||
ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
|
||||
test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
|
||||
srcdir=$ac_confdir
|
||||
if test ! -r $srcdir/$ac_unique_file; then
|
||||
srcdir=..
|
||||
fi
|
||||
else
|
||||
ac_srcdir_defaulted=no
|
||||
fi
|
||||
if test ! -r $srcdir/$ac_unique_file; then
|
||||
if test "$ac_srcdir_defaulted" = yes; then
|
||||
{ echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
|
||||
else
|
||||
{ echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
|
||||
fi
|
||||
fi
|
||||
srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
|
||||
|
||||
# Prefer explicitly selected file to automatically selected ones.
|
||||
if test -z "$CONFIG_SITE"; then
|
||||
if test "x$prefix" != xNONE; then
|
||||
CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
|
||||
else
|
||||
CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
|
||||
fi
|
||||
fi
|
||||
for ac_site_file in $CONFIG_SITE; do
|
||||
if test -r "$ac_site_file"; then
|
||||
echo "loading site script $ac_site_file"
|
||||
. "$ac_site_file"
|
||||
fi
|
||||
done
|
||||
|
||||
if test -r "$cache_file"; then
|
||||
echo "loading cache $cache_file"
|
||||
. $cache_file
|
||||
else
|
||||
echo "creating cache $cache_file"
|
||||
> $cache_file
|
||||
fi
|
||||
|
||||
ac_ext=c
|
||||
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
|
||||
ac_cpp='$CPP $CPPFLAGS'
|
||||
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
|
||||
ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
|
||||
cross_compiling=$ac_cv_prog_cc_cross
|
||||
|
||||
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
|
||||
# Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
|
||||
if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
|
||||
ac_n= ac_c='
|
||||
' ac_t=' '
|
||||
else
|
||||
ac_n=-n ac_c= ac_t=
|
||||
fi
|
||||
else
|
||||
ac_n= ac_c='\c' ac_t=
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if test "$srcdir" = "." ; then
|
||||
mdir=`echo "${with_multisubdir}/" \
|
||||
| sed -e 's,\([^/][^/]*\),..,g' -e 's,^/$,,'`
|
||||
ac_aux_dir=
|
||||
for ac_dir in ${mdir}../../.. $srcdir/${mdir}../../..; do
|
||||
if test -f $ac_dir/install-sh; then
|
||||
ac_aux_dir=$ac_dir
|
||||
ac_install_sh="$ac_aux_dir/install-sh -c"
|
||||
break
|
||||
elif test -f $ac_dir/install.sh; then
|
||||
ac_aux_dir=$ac_dir
|
||||
ac_install_sh="$ac_aux_dir/install.sh -c"
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -z "$ac_aux_dir"; then
|
||||
{ echo "configure: error: can not find install-sh or install.sh in ${mdir}../../.. $srcdir/${mdir}../../.." 1>&2; exit 1; }
|
||||
fi
|
||||
ac_config_guess=$ac_aux_dir/config.guess
|
||||
ac_config_sub=$ac_aux_dir/config.sub
|
||||
ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
|
||||
|
||||
else
|
||||
ac_aux_dir=
|
||||
for ac_dir in ${srcdir}/../.. $srcdir/${srcdir}/../..; do
|
||||
if test -f $ac_dir/install-sh; then
|
||||
ac_aux_dir=$ac_dir
|
||||
ac_install_sh="$ac_aux_dir/install-sh -c"
|
||||
break
|
||||
elif test -f $ac_dir/install.sh; then
|
||||
ac_aux_dir=$ac_dir
|
||||
ac_install_sh="$ac_aux_dir/install.sh -c"
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -z "$ac_aux_dir"; then
|
||||
{ echo "configure: error: can not find install-sh or install.sh in ${srcdir}/../.. $srcdir/${srcdir}/../.." 1>&2; exit 1; }
|
||||
fi
|
||||
ac_config_guess=$ac_aux_dir/config.guess
|
||||
ac_config_sub=$ac_aux_dir/config.sub
|
||||
ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
|
||||
|
||||
fi
|
||||
|
||||
# Find a good install program. We prefer a C program (faster),
|
||||
# so one script is as good as another. But avoid the broken or
|
||||
# incompatible versions:
|
||||
# SysV /etc/install, /usr/sbin/install
|
||||
# SunOS /usr/etc/install
|
||||
# IRIX /sbin/install
|
||||
# AIX /bin/install
|
||||
# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
|
||||
# AFS /usr/afsws/bin/install, which mishandles nonexistent args
|
||||
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
|
||||
# ./install, which can be erroneously created by make from ./install.sh.
|
||||
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
|
||||
echo "configure:580: checking for a BSD compatible install" >&5
|
||||
if test -z "$INSTALL"; then
|
||||
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
|
||||
for ac_dir in $PATH; do
|
||||
# Account for people who put trailing slashes in PATH elements.
|
||||
case "$ac_dir/" in
|
||||
/|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
|
||||
*)
|
||||
# OSF1 and SCO ODT 3.0 have their own names for install.
|
||||
# Don't use installbsd from OSF since it installs stuff as root
|
||||
# by default.
|
||||
for ac_prog in ginstall scoinst install; do
|
||||
if test -f $ac_dir/$ac_prog; then
|
||||
if test $ac_prog = install &&
|
||||
grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
|
||||
# AIX install. It has an incompatible calling convention.
|
||||
:
|
||||
else
|
||||
ac_cv_path_install="$ac_dir/$ac_prog -c"
|
||||
break 2
|
||||
fi
|
||||
fi
|
||||
done
|
||||
;;
|
||||
esac
|
||||
done
|
||||
IFS="$ac_save_IFS"
|
||||
|
||||
fi
|
||||
if test "${ac_cv_path_install+set}" = set; then
|
||||
INSTALL="$ac_cv_path_install"
|
||||
else
|
||||
# As a last resort, use the slow shell script. We don't cache a
|
||||
# path for INSTALL within a source directory, because that will
|
||||
# break other packages using the cache if that directory is
|
||||
# removed, or if the path is relative.
|
||||
INSTALL="$ac_install_sh"
|
||||
fi
|
||||
fi
|
||||
echo "$ac_t""$INSTALL" 1>&6
|
||||
|
||||
# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
|
||||
# It thinks the first close brace ends the variable substitution.
|
||||
test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
|
||||
|
||||
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
|
||||
|
||||
|
||||
trap '' 1 2 15
|
||||
cat > confcache <<\EOF
|
||||
# This file is a shell script that caches the results of configure
|
||||
# tests run on this system so they can be shared between configure
|
||||
# scripts and configure runs. It is not useful on other systems.
|
||||
# If it contains results you don't want to keep, you may remove or edit it.
|
||||
#
|
||||
# By default, configure uses ./config.cache as the cache file,
|
||||
# creating it if it does not exist already. You can give configure
|
||||
# the --cache-file=FILE option to use a different cache file; that is
|
||||
# what configure does when it calls configure scripts in
|
||||
# subdirectories, so they share the cache.
|
||||
# Giving --cache-file=/dev/null disables caching, for debugging configure.
|
||||
# config.status only pays attention to the cache file if you give it the
|
||||
# --recheck option to rerun configure.
|
||||
#
|
||||
EOF
|
||||
# The following way of writing the cache mishandles newlines in values,
|
||||
# but we know of no workaround that is simple, portable, and efficient.
|
||||
# So, don't put newlines in cache variables' values.
|
||||
# Ultrix sh set writes to stderr and can't be redirected directly,
|
||||
# and sets the high bit in the cache file unless we assign to the vars.
|
||||
(set) 2>&1 |
|
||||
case `(ac_space=' '; set) 2>&1 | grep ac_space` in
|
||||
*ac_space=\ *)
|
||||
# `set' does not quote correctly, so add quotes (double-quote substitution
|
||||
# turns \\\\ into \\, and sed turns \\ into \).
|
||||
sed -n \
|
||||
-e "s/'/'\\\\''/g" \
|
||||
-e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
|
||||
;;
|
||||
*)
|
||||
# `set' quotes correctly as required by POSIX, so do not add quotes.
|
||||
sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
|
||||
;;
|
||||
esac >> confcache
|
||||
if cmp -s $cache_file confcache; then
|
||||
:
|
||||
else
|
||||
if test -w $cache_file; then
|
||||
echo "updating cache $cache_file"
|
||||
cat confcache > $cache_file
|
||||
else
|
||||
echo "not updating unwritable cache $cache_file"
|
||||
fi
|
||||
fi
|
||||
rm -f confcache
|
||||
|
||||
trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
|
||||
|
||||
test "x$prefix" = xNONE && prefix=$ac_default_prefix
|
||||
# Let make expand exec_prefix.
|
||||
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
|
||||
|
||||
# Any assignment to VPATH causes Sun make to only execute
|
||||
# the first set of double-colon rules, so remove it if not needed.
|
||||
# If there is a colon in the path, we need to keep it.
|
||||
if test "x$srcdir" = x.; then
|
||||
ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
|
||||
fi
|
||||
|
||||
trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
|
||||
|
||||
# Transform confdefs.h into DEFS.
|
||||
# Protect against shell expansion while executing Makefile rules.
|
||||
# Protect against Makefile macro expansion.
|
||||
cat > conftest.defs <<\EOF
|
||||
s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
|
||||
s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g
|
||||
s%\[%\\&%g
|
||||
s%\]%\\&%g
|
||||
s%\$%$$%g
|
||||
EOF
|
||||
DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
|
||||
rm -f conftest.defs
|
||||
|
||||
|
||||
# Without the "./", some shells look in PATH for config.status.
|
||||
: ${CONFIG_STATUS=./config.status}
|
||||
|
||||
echo creating $CONFIG_STATUS
|
||||
rm -f $CONFIG_STATUS
|
||||
cat > $CONFIG_STATUS <<EOF
|
||||
#! /bin/sh
|
||||
# Generated automatically by configure.
|
||||
# Run this file to recreate the current configuration.
|
||||
# This directory was configured as follows,
|
||||
# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
|
||||
#
|
||||
# $0 $ac_configure_args
|
||||
#
|
||||
# Compiler output produced by configure, useful for debugging
|
||||
# configure, is in ./config.log if it exists.
|
||||
|
||||
ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
|
||||
for ac_option
|
||||
do
|
||||
case "\$ac_option" in
|
||||
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
|
||||
echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
|
||||
exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
|
||||
-version | --version | --versio | --versi | --vers | --ver | --ve | --v)
|
||||
echo "$CONFIG_STATUS generated by autoconf version 2.12.1"
|
||||
exit 0 ;;
|
||||
-help | --help | --hel | --he | --h)
|
||||
echo "\$ac_cs_usage"; exit 0 ;;
|
||||
*) echo "\$ac_cs_usage"; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
ac_given_srcdir=$srcdir
|
||||
ac_given_INSTALL="$INSTALL"
|
||||
|
||||
trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
|
||||
EOF
|
||||
cat >> $CONFIG_STATUS <<EOF
|
||||
|
||||
# Protect against being on the right side of a sed subst in config.status.
|
||||
sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
|
||||
s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
|
||||
$ac_vpsub
|
||||
$extrasub
|
||||
s%@SHELL@%$SHELL%g
|
||||
s%@CFLAGS@%$CFLAGS%g
|
||||
s%@CPPFLAGS@%$CPPFLAGS%g
|
||||
s%@CXXFLAGS@%$CXXFLAGS%g
|
||||
s%@DEFS@%$DEFS%g
|
||||
s%@LDFLAGS@%$LDFLAGS%g
|
||||
s%@LIBS@%$LIBS%g
|
||||
s%@exec_prefix@%$exec_prefix%g
|
||||
s%@prefix@%$prefix%g
|
||||
s%@program_transform_name@%$program_transform_name%g
|
||||
s%@bindir@%$bindir%g
|
||||
s%@sbindir@%$sbindir%g
|
||||
s%@libexecdir@%$libexecdir%g
|
||||
s%@datadir@%$datadir%g
|
||||
s%@sysconfdir@%$sysconfdir%g
|
||||
s%@sharedstatedir@%$sharedstatedir%g
|
||||
s%@localstatedir@%$localstatedir%g
|
||||
s%@libdir@%$libdir%g
|
||||
s%@includedir@%$includedir%g
|
||||
s%@oldincludedir@%$oldincludedir%g
|
||||
s%@infodir@%$infodir%g
|
||||
s%@mandir@%$mandir%g
|
||||
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
|
||||
s%@INSTALL_DATA@%$INSTALL_DATA%g
|
||||
|
||||
CEOF
|
||||
EOF
|
||||
|
||||
cat >> $CONFIG_STATUS <<\EOF
|
||||
|
||||
# Split the substitutions into bite-sized pieces for seds with
|
||||
# small command number limits, like on Digital OSF/1 and HP-UX.
|
||||
ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
|
||||
ac_file=1 # Number of current file.
|
||||
ac_beg=1 # First line for current file.
|
||||
ac_end=$ac_max_sed_cmds # Line after last line for current file.
|
||||
ac_more_lines=:
|
||||
ac_sed_cmds=""
|
||||
while $ac_more_lines; do
|
||||
if test $ac_beg -gt 1; then
|
||||
sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
|
||||
else
|
||||
sed "${ac_end}q" conftest.subs > conftest.s$ac_file
|
||||
fi
|
||||
if test ! -s conftest.s$ac_file; then
|
||||
ac_more_lines=false
|
||||
rm -f conftest.s$ac_file
|
||||
else
|
||||
if test -z "$ac_sed_cmds"; then
|
||||
ac_sed_cmds="sed -f conftest.s$ac_file"
|
||||
else
|
||||
ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
|
||||
fi
|
||||
ac_file=`expr $ac_file + 1`
|
||||
ac_beg=$ac_end
|
||||
ac_end=`expr $ac_end + $ac_max_sed_cmds`
|
||||
fi
|
||||
done
|
||||
if test -z "$ac_sed_cmds"; then
|
||||
ac_sed_cmds=cat
|
||||
fi
|
||||
EOF
|
||||
|
||||
cat >> $CONFIG_STATUS <<EOF
|
||||
|
||||
CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
|
||||
EOF
|
||||
cat >> $CONFIG_STATUS <<\EOF
|
||||
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
|
||||
# Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
|
||||
case "$ac_file" in
|
||||
*:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
|
||||
ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
|
||||
*) ac_file_in="${ac_file}.in" ;;
|
||||
esac
|
||||
|
||||
# Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
|
||||
|
||||
# Remove last slash and all that follows it. Not all systems have dirname.
|
||||
ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
|
||||
if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
|
||||
# The file is in a subdirectory.
|
||||
test ! -d "$ac_dir" && mkdir "$ac_dir"
|
||||
ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
|
||||
# A "../" for each directory in $ac_dir_suffix.
|
||||
ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
|
||||
else
|
||||
ac_dir_suffix= ac_dots=
|
||||
fi
|
||||
|
||||
case "$ac_given_srcdir" in
|
||||
.) srcdir=.
|
||||
if test -z "$ac_dots"; then top_srcdir=.
|
||||
else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
|
||||
/*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
|
||||
*) # Relative path.
|
||||
srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
|
||||
top_srcdir="$ac_dots$ac_given_srcdir" ;;
|
||||
esac
|
||||
|
||||
case "$ac_given_INSTALL" in
|
||||
[/$]*) INSTALL="$ac_given_INSTALL" ;;
|
||||
*) INSTALL="$ac_dots$ac_given_INSTALL" ;;
|
||||
esac
|
||||
|
||||
echo creating "$ac_file"
|
||||
rm -f "$ac_file"
|
||||
configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
|
||||
case "$ac_file" in
|
||||
*Makefile*) ac_comsub="1i\\
|
||||
# $configure_input" ;;
|
||||
*) ac_comsub= ;;
|
||||
esac
|
||||
|
||||
ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
|
||||
sed -e "$ac_comsub
|
||||
s%@configure_input@%$configure_input%g
|
||||
s%@srcdir@%$srcdir%g
|
||||
s%@top_srcdir@%$top_srcdir%g
|
||||
s%@INSTALL@%$INSTALL%g
|
||||
" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
|
||||
fi; done
|
||||
rm -f conftest.s*
|
||||
|
||||
EOF
|
||||
cat >> $CONFIG_STATUS <<EOF
|
||||
|
||||
EOF
|
||||
cat >> $CONFIG_STATUS <<\EOF
|
||||
|
||||
exit 0
|
||||
EOF
|
||||
chmod +x $CONFIG_STATUS
|
||||
rm -fr confdefs* $ac_clean_files
|
||||
test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_PREREQ(2.5)dnl
|
||||
AC_INIT(porting.texi)
|
||||
|
||||
if test "$srcdir" = "." ; then
|
||||
mdir=`echo "${with_multisubdir}/" \
|
||||
| sed -e 's,\([[^/]][[^/]]*\),..,g' -e 's,^/$,,'`
|
||||
AC_CONFIG_AUX_DIR(${mdir}../../..)
|
||||
else
|
||||
AC_CONFIG_AUX_DIR(${srcdir}/../..)
|
||||
fi
|
||||
|
||||
AC_PROG_INSTALL
|
||||
|
||||
AC_OUTPUT(Makefile)
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,143 @@
|
|||
#
|
||||
#
|
||||
|
||||
VPATH = @srcdir@ @srcdir@/..
|
||||
srcdir = @srcdir@
|
||||
objdir = .
|
||||
srcroot = $(srcdir)/../..
|
||||
objroot = $(objdir)/../..
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
host_alias = @host_alias@
|
||||
target_alias = @target_alias@
|
||||
|
||||
bindir = @bindir@
|
||||
libdir = @libdir@
|
||||
tooldir = $(exec_prefix)/$(target_alias)
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
# Multilib support variables.
|
||||
# TOP is used instead of MULTI{BUILD,SRC}TOP.
|
||||
MULTIDIRS =
|
||||
MULTISUBDIR =
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
CC = @CC@
|
||||
|
||||
AS = @AS@
|
||||
AR = @AR@
|
||||
LD = @LD@
|
||||
RANLIB = @RANLIB@
|
||||
|
||||
OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \
|
||||
then echo ${objroot}/../binutils/objdump ; \
|
||||
else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi`
|
||||
OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \
|
||||
then echo ${objroot}/../binutils/objcopy ; \
|
||||
else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi`
|
||||
|
||||
OBJS = putnum.o unlink.o
|
||||
CFLAGS = -g
|
||||
SCRIPTS =
|
||||
|
||||
# Here is all of the simulator stuff
|
||||
SIM_SCRIPTS =
|
||||
SIM_LDFLAGS =
|
||||
SIM_BSP = libsim.a
|
||||
SIM_CRT0 = crt0.o
|
||||
SIM_OBJS = syscalls.o
|
||||
SIM_TEST = sim-test
|
||||
SIM_INSTALL = install-sim
|
||||
|
||||
# Here is all of the mon960 stuff
|
||||
MON_LDFLAGS =
|
||||
MON_BSP = libmon960.a
|
||||
MON_CRT0 = crt0.o
|
||||
MON_OBJS =
|
||||
MON_SCRIPTS = mon960.ld
|
||||
MON_TEST =
|
||||
MON_INSTALL = install-mon
|
||||
|
||||
# Host specific makefile fragment comes in here.
|
||||
@host_makefile_frag@
|
||||
|
||||
#
|
||||
# build a test program for each target board. Just trying to get
|
||||
# it to link is a good test, so we ignore all the errors for now.
|
||||
#
|
||||
# all: ${MON_CRT0} ${MON_BSP}
|
||||
all: ${SIM_CRT0} ${SIM_BSP}
|
||||
|
||||
#
|
||||
# here's where we build the board support packages for each target
|
||||
#
|
||||
${SIM_BSP}: ${OBJS} ${SIM_OBJS}
|
||||
${AR} ${ARFLAGS} ${SIM_BSP} ${SIM_OBJS} ${OBJS}
|
||||
${RANLIB} ${SIM_BSP}
|
||||
|
||||
${MON_BSP}: ${OBJS} ${MON_OBJS}
|
||||
${AR} ${ARFLAGS} ${MON_BSP} ${MON_OBJS} ${OBJS}
|
||||
${RANLIB} ${MON_BSP}
|
||||
|
||||
#
|
||||
# here's where we build the test programs for each target
|
||||
#
|
||||
.PHONY: test
|
||||
test: ${SIM_TEST} ${MVME_TEST} ${EVM_TEST}
|
||||
|
||||
sim-test: sim-test.x sim-test.dis
|
||||
|
||||
sim-test.x: test.o ${SIM_CRT0} ${SIM_BSP}
|
||||
${CC} ${LDFLAGS_FOR_TARGET} -L${objdir} \
|
||||
${SIM_CRT0} test.o \
|
||||
-o sim-test.x ${LIBS_FOR_TARGET} -lc ${SIM_BSP}
|
||||
|
||||
sim-test.dis: sim-test.x
|
||||
${OBJDUMP} -d sim-test.x > sim-test.dis
|
||||
|
||||
|
||||
#
|
||||
#
|
||||
#
|
||||
.c.S:
|
||||
${CC} ${CFLAGS_FOR_TARGET} -c $<
|
||||
|
||||
simulator.o: simulator.S
|
||||
sim-crt0.o: sim-crt0.S
|
||||
mvme-crt0.o: mvme-crt0.S
|
||||
mvme-exit.o: mvme-exit.S
|
||||
mvme-inbyte.o: mvme-inbyte.S
|
||||
mvme-outbyte.o: mvme-outbyte.S
|
||||
|
||||
clean mostlyclean:
|
||||
rm -f a.out core *.i *.o *-test *.srec *.dis *.x $(SIM_BSP) $(MON_BSP)
|
||||
|
||||
distclean maintainer-clean realclean: clean
|
||||
rm -f Makefile config.status *~
|
||||
|
||||
.PHONY: install info install-info clean-info
|
||||
install: ${SIM_INSTALL}
|
||||
|
||||
install-mon:
|
||||
set -e; for x in ${MON_CRT0} ${MON_BSP}; do ${INSTALL_DATA} $$x ${tooldir}/lib${MULTISUBDIR}/$$x; done
|
||||
set -e; for x in ${MON_SCRIPTS}; do ${INSTALL_DATA} ${srcdir}/$$x ${tooldir}/lib${MULTISUBDIR}/$$x; done
|
||||
|
||||
install-sim:
|
||||
set -e; for x in ${SIM_CRT0} ${SIM_BSP} ${SIM_SCRIPTS}; do ${INSTALL_DATA} $$x ${tooldir}/lib/$$x; done
|
||||
|
||||
doc:
|
||||
info:
|
||||
install-info:
|
||||
clean-info:
|
||||
|
||||
Makefile: Makefile.in config.status @host_makefile_frag_path@
|
||||
$(SHELL) config.status
|
||||
|
||||
config.status: configure
|
||||
$(SHELL) config.status --recheck
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,75 @@
|
|||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_PREREQ(2.5)dnl
|
||||
AC_INIT(crt0.s)
|
||||
|
||||
AC_CANONICAL_SYSTEM
|
||||
AC_ARG_PROGRAM
|
||||
|
||||
if test "$srcdir" = "." ; then
|
||||
mdir=`echo "${with_multisubdir}/" \
|
||||
| sed -e 's,\([[^/]][[^/]]*\),..,g' -e 's,^/$,,'`
|
||||
AC_CONFIG_AUX_DIR(${mdir}../../..)
|
||||
else
|
||||
AC_CONFIG_AUX_DIR(${srcdir}/../..)
|
||||
fi
|
||||
|
||||
AC_PROG_INSTALL
|
||||
|
||||
# FIXME: We temporarily define our own version of AC_PROG_CC. This is
|
||||
# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
|
||||
# are probably using a cross compiler, which will not be able to fully
|
||||
# link an executable. This should really be fixed in autoconf
|
||||
# itself.
|
||||
|
||||
AC_DEFUN(LIB_AC_PROG_CC,
|
||||
[AC_BEFORE([$0], [AC_PROG_CPP])dnl
|
||||
AC_CHECK_PROG(CC, gcc, gcc)
|
||||
if test -z "$CC"; then
|
||||
AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
|
||||
test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
|
||||
fi
|
||||
|
||||
AC_PROG_CC_GNU
|
||||
|
||||
if test $ac_cv_prog_gcc = yes; then
|
||||
GCC=yes
|
||||
dnl Check whether -g works, even if CFLAGS is set, in case the package
|
||||
dnl plays around with CFLAGS (such as to build both debugging and
|
||||
dnl normal versions of a library), tasteless as that idea is.
|
||||
ac_test_CFLAGS="${CFLAGS+set}"
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
CFLAGS=
|
||||
AC_PROG_CC_G
|
||||
if test "$ac_test_CFLAGS" = set; then
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
elif test $ac_cv_prog_cc_g = yes; then
|
||||
CFLAGS="-g -O2"
|
||||
else
|
||||
CFLAGS="-O2"
|
||||
fi
|
||||
else
|
||||
GCC=
|
||||
test "${CFLAGS+set}" = set || CFLAGS="-g"
|
||||
fi
|
||||
])
|
||||
|
||||
LIB_AC_PROG_CC
|
||||
AS=${AS-as}
|
||||
AC_SUBST(AS)
|
||||
AR=${AR-ar}
|
||||
AC_SUBST(AR)
|
||||
LD=${LD-ld}
|
||||
AC_SUBST(LD)
|
||||
AC_PROG_RANLIB
|
||||
|
||||
host_makefile_frag=${srcdir}/../config/default.mh
|
||||
|
||||
dnl We have to assign the same value to other variables because autoconf
|
||||
dnl doesn't provide a mechanism to substitute a replacement keyword with
|
||||
dnl arbitrary data or pathnames.
|
||||
dnl
|
||||
host_makefile_frag_path=$host_makefile_frag
|
||||
AC_SUBST(host_makefile_frag_path)
|
||||
AC_SUBST_FILE(host_makefile_frag)
|
||||
|
||||
AC_OUTPUT(Makefile)
|
|
@ -0,0 +1,46 @@
|
|||
# FR30 startup code
|
||||
|
||||
.section .text
|
||||
.global _start
|
||||
_start:
|
||||
|
||||
;; Initialise the stack pointer
|
||||
ldi:32 __stack, r0
|
||||
mov r0, sp
|
||||
mov r0, fp
|
||||
|
||||
;; Zero the data space
|
||||
ldi:32 #_edata, r0
|
||||
ldi:32 #_end, r1
|
||||
ldi:8 #0, r2
|
||||
.L0:
|
||||
st r2, @r0
|
||||
add #4, r0
|
||||
cmp r1, r0
|
||||
blt .L0
|
||||
|
||||
;; Call global and static constructors
|
||||
ldi:32 _init, r0
|
||||
call @r0
|
||||
|
||||
;; Setup destrcutors to be called from exit.
|
||||
;; (Just in case main never returns....)
|
||||
ldi:32 atexit, r0
|
||||
ldi:32 _fini, r4
|
||||
call @r0
|
||||
|
||||
;; Initialise argc, argv and envp to empty
|
||||
ldi:8 #0, r4
|
||||
ldi:8 #0, r5
|
||||
ldi:8 #0, r6
|
||||
|
||||
;; Call main
|
||||
ldi:32 main, r0
|
||||
call @r0
|
||||
|
||||
;; Jump to exit
|
||||
ldi:32 exit, r0
|
||||
call @r0
|
||||
|
||||
;; Should never reach here
|
||||
int #9
|
|
@ -0,0 +1,162 @@
|
|||
/* FR30 system call emulation code
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
Contributed by Cygnus Solutions.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU CC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include "../syscall.h"
|
||||
|
||||
int
|
||||
_read (file, ptr, len)
|
||||
int file;
|
||||
char * ptr;
|
||||
int len;
|
||||
{
|
||||
asm ("ldi:8 %0, r0" :: "i" (SYS_read) : "r0");
|
||||
asm ("int #10");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
_lseek (file, ptr, dir)
|
||||
int file;
|
||||
int ptr;
|
||||
int dir;
|
||||
{
|
||||
asm ("ldi:8 %0, r0" :: "i" (SYS_lseek) : "r0");
|
||||
asm ("int #10");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
_write (file, ptr, len)
|
||||
int file;
|
||||
char * ptr;
|
||||
int len;
|
||||
{
|
||||
asm ("ldi:8 %0, r0" :: "i" (SYS_write) : "r0");
|
||||
asm ("int #10");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
_open (path, flags)
|
||||
const char * path;
|
||||
int flags;
|
||||
{
|
||||
asm ("ldi:8 %0, r0" :: "i" (SYS_open) : "r0");
|
||||
asm ("int #10");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
_close (file)
|
||||
int file;
|
||||
{
|
||||
asm ("ldi:8 %0, r0" :: "i" (SYS_close) : "r0");
|
||||
asm ("int #10");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
_exit (n)
|
||||
int n;
|
||||
{
|
||||
asm ("ldi:8 %0, r0" :: "i" (SYS_exit) : "r0");
|
||||
asm ("int #10");
|
||||
}
|
||||
|
||||
|
||||
caddr_t
|
||||
_sbrk (incr)
|
||||
int incr;
|
||||
{
|
||||
extern char end asm ("_end"); /* Defined by the linker */
|
||||
extern int __stack; /* Defined by linker script. */
|
||||
static char * heap_end;
|
||||
char * prev_heap_end;
|
||||
|
||||
if (heap_end == NULL)
|
||||
heap_end = & end;
|
||||
|
||||
prev_heap_end = heap_end;
|
||||
#if 0
|
||||
if (heap_end + incr > __stack)
|
||||
{
|
||||
_write ( 1, "_sbrk: Heap and stack collision\n", 32);
|
||||
abort ();
|
||||
}
|
||||
#endif
|
||||
heap_end += incr;
|
||||
|
||||
return (caddr_t) prev_heap_end;
|
||||
}
|
||||
|
||||
int
|
||||
_fstat (file, st)
|
||||
int file;
|
||||
struct stat * st;
|
||||
{
|
||||
st->st_mode = S_IFCHR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
_unlink ()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
isatty (fd)
|
||||
int fd;
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
_raise ()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
_times ()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
_kill (pid, sig)
|
||||
int pid;
|
||||
int sig;
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
_getpid (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
/* fstat.c -- get status of a file.
|
||||
*
|
||||
* Copyright (c) 1995 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);
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
/* getpid.c -- get the current process id.
|
||||
*
|
||||
* Copyright (c) 1995 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;
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/* glue.h -- common definitions for "glue" fucntions.
|
||||
*
|
||||
* Copyright (c) 1995 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>
|
||||
|
||||
#ifndef NULL
|
||||
# define NULL 0
|
||||
#endif
|
||||
|
||||
#ifdef __NO_UNDERSCORE__
|
||||
# define _end end
|
||||
# define _exit exit
|
||||
#endif
|
||||
|
||||
extern char _end[]; /* _end is set in the linker command file */
|
||||
|
||||
/* only one prcess support, as this is OS dependant */
|
||||
#define __MYPID 1
|
||||
|
||||
|
|
@ -0,0 +1,215 @@
|
|||
#
|
||||
# Makefile
|
||||
# Copyright (C) 1990, 1991, 1992, 1993 ,1994 Free Software Foundation
|
||||
#
|
||||
# This file is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
#
|
||||
|
||||
#
|
||||
# Makefile for newlib/libc/stub/hppa. This is the board support code
|
||||
# for the HP-PRO hppa embedded boards. <rob@cygnus.com>
|
||||
#
|
||||
|
||||
VPATH = @srcdir@
|
||||
srcdir = @srcdir@
|
||||
objdir = .
|
||||
srcroot = $(srcdir)/../..
|
||||
objroot = $(objdir)/../..
|
||||
|
||||
prefix = @prefix
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
libdir = @libdir@
|
||||
tooldir = $(exec_prefix)/$(target_alias)
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
CC = @CC@
|
||||
|
||||
AS = @AS@
|
||||
AR = @AR@
|
||||
LD = @LD@
|
||||
RANLIB = @RANLIB@
|
||||
|
||||
#
|
||||
# As the boot process only deals with LIF volumes, here's the src
|
||||
# where we borrow existing code modules and where we put our
|
||||
# boot image if we can bvuild one.
|
||||
#
|
||||
LIF_SRC = /usr/tftpdir/srcboot.lif
|
||||
LIF_DEST = /usr/tftpdir/romboot.lif
|
||||
|
||||
HPDEFS = -D_INCLUDE_POSIX_SOURCE -D_INCLUDE_XOPEN_SOURCE \
|
||||
-D_INCLUDE_HPUX_SOURCE -DPCXT
|
||||
|
||||
LIBS_FOR_TARGET = -lc
|
||||
|
||||
#
|
||||
# The original flags used by HP for the boot ROMS were
|
||||
# CFLAGS_FOR_TARGET = -c -Aa +O3 +OS -Wc,-DA1.0 -Wc,-DS1.0 +ESfic +ESsfc ${HPDEFS}
|
||||
CFLAGS_FOR_TARGET = -c -Wd,-a -g
|
||||
# the original value for -R was 0
|
||||
LDFLAGS_FOR_TARGET = -v -t -N -R 10000 -a archive
|
||||
INCLUDES = -I${srcdir}
|
||||
|
||||
BSP_OBJS= pa_stub.o debugger.o iva_table.o io.o
|
||||
STUBCRT0=crt0.o
|
||||
STUBLIB=hppa.o
|
||||
LDSCRIPT=hppa.ld
|
||||
SHARED_DIR=
|
||||
SHARED_OBJS=
|
||||
# SHARED_OBJS=$(SHARED_DIR)
|
||||
|
||||
# Host specific makefile fragment comes in here.
|
||||
@host_makefile_frag@
|
||||
|
||||
all: boot
|
||||
|
||||
# this target is only for testing
|
||||
test: ${STUBCRT0} $(STUBLIB) test.o $(BSP_OBJS)
|
||||
# ${LD} $(LDFLAGS_FOR_TARGET) ${STUBCRT0} test.o $(BSP_OBJS) -o test $(LIBS_FOR_TARGET)
|
||||
rootme=`pwd` ; \
|
||||
${LD} $(LDFLAGS_FOR_TARGET) ${STUBCRT0} test.o pa_stub.o debugger.o iva_table.o io.o -o test $(LIBS_FOR_TARGET)
|
||||
|
||||
$(STUBLIB): $(BSP_OBJS)
|
||||
${LD} -r $(BSP_OBJS) $(SHARED_OBJS) -o $(STUBLIB)
|
||||
|
||||
checksum: $(srcdir)/checksum.c
|
||||
$(CC) -g $(srcdir)/checksum.c -o checksum
|
||||
|
||||
# this is the target from HP's Makefile, it may be bogus
|
||||
hpstub: $(OBJS)
|
||||
$(LD) $(LDFLAGS_FOR_TARGET) -e main -o $@ $(LIBRARY)/crt1.o \
|
||||
$(OBJS) -lc -m >stub.map
|
||||
|
||||
install:
|
||||
$(INSTALL_PROGRAM) $(STUBLIB) $(tooldir)/lib/$(MULTISUBDIR)$(STUBLIB)
|
||||
$(INSTALL_PROGRAM) $(SHARED_DIR)/$(STUBCRT0) $(tooldir)/lib/$(MULTISUBDIR)$(STUBCRT0)
|
||||
$(INSTALL_PROGRAM) $(srcdir)/$(LDSCRIPT) $(tooldir)/lib/$(LDSCRIPT)
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $<
|
||||
|
||||
.c.s:
|
||||
$(CC) $(CFLAGS_FOR_TARGET) -S $(INCLUDES) $<
|
||||
# $(CC) $(CFLAGS_FOR_TARGET) $(NEWLIB_CFLAGS) $(INCLUDES) -c $<
|
||||
|
||||
.s.o:
|
||||
$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $<
|
||||
# $(AS) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $<
|
||||
|
||||
.SUFFIXES: .S .c .o .s .lif
|
||||
#
|
||||
# lifinit --
|
||||
# -vnnn Sets volume size to nnn bytes.
|
||||
# nnn must be a multiple of 256.
|
||||
# -d Sets directory size to nnn file entries.
|
||||
# nnn must be a multiple of 8.
|
||||
# -nsss Sets the volume name to be sss.
|
||||
# -Knnn Forces the directory start location to be the
|
||||
# nearest multiple of nnn x 1024 bytes.
|
||||
# -snnn set the initial system load (ISL) start address to
|
||||
# nnn in the volume label
|
||||
# -lnnn Specifies the length in bytes of the ISL code.
|
||||
# -ennn Set the ISL entry point to nnn bytes from the
|
||||
# beginning of the ISL
|
||||
#
|
||||
# lifcp --
|
||||
# -r Forces RAW mode copying.
|
||||
# -T Sets the file type of the directory entry.
|
||||
# ASCII is 1
|
||||
# BIN is -23951
|
||||
# BINARY is -2
|
||||
# -Knnn forces each file copied in to begin on a nnn x
|
||||
# 1024-byte boundary from the beginning of the volume
|
||||
# Note: the word echoed below MUST be 10 characters exactly.
|
||||
#
|
||||
# somxtract infile outfile --
|
||||
# converts a series 800 file *only* into a raw image
|
||||
#
|
||||
LIF_VOL = this_lif
|
||||
# 65532
|
||||
boot: test checksum
|
||||
# FIXME: This fills up the hard disk unless "-R" is used
|
||||
@rm -f ${LIF_VOL} ${LIF_DEST}
|
||||
@ipl_entry=`nm -t d $< | grep "T .START." | sed -e 's/T .START.//' -e 's/^0*//'` ; \
|
||||
echo "Entry point is at $${ipl_entry}" ; \
|
||||
if test x"$${ipl_entry}" != x ; then \
|
||||
ipl_entry=`expr $${ipl_entry} - 65536` ; \
|
||||
echo "Entry point offset is $${ipl_entry}" ; \
|
||||
cp $< $<.raw ; \
|
||||
rm -f $<.dis ; \
|
||||
objdump -d $< > $<.dis ; \
|
||||
somxtract $< $<.raw ; \
|
||||
ipl_size=`checksum -s $<.raw $<.image | sed -e 's/ is the.*//'` ; \
|
||||
echo "IPL_SIZE is $${ipl_size}" ; \
|
||||
lifinit -v64000000 -d64 -n"CYGNUS " -K2 -s4096 -l$${ipl_size} -e$${ipl_entry} ${LIF_DEST} ;\
|
||||
else \
|
||||
echo "ERROR: \$$START\$$ symbol not found" ; \
|
||||
fi
|
||||
@chmod a+rw $<.image
|
||||
@lifcp -r -K2 $<.image ${LIF_DEST}:TEST
|
||||
@rm -f $<.image $<.dis
|
||||
@lifls -l ${LIF_DEST}
|
||||
@objdump -d $< > $<.dis
|
||||
|
||||
.S.o:
|
||||
rm -f $*.s
|
||||
${CPP} $< > $*.s
|
||||
$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $*.s
|
||||
# $(CC) $(CFLAGS_FOR_TARGET) $(NEWLIB_CFLAGS) $(INCLUDES) -c $<
|
||||
|
||||
.c.list:
|
||||
$(CC) $(CFLAGS) $*.c -S
|
||||
$(AS) $(AFLAGS) $*.s -Wa,-l > $*.list
|
||||
rm $*.s
|
||||
|
||||
.s.list:
|
||||
$(AS) $(AFLAGS) $*.s -Wa,-l > $*.list
|
||||
|
||||
doc:
|
||||
|
||||
clean mostlyclean:
|
||||
rm -f *~ *.map *.list stub romboot.lif a.out *.raw *.image
|
||||
rm -f *.o $(STUBLIB) $(STUBCRT0) checksum *.dis test
|
||||
|
||||
distclean maintainer-clean realclean: clean
|
||||
rm -f Makefile config.cache config.log config.status
|
||||
|
||||
pa_stub.o: $(srcdir)/pa_stub.c
|
||||
debugger.o: $(srcdir)/debugger.s
|
||||
iva_table.o: $(srcdir)/iva_table.s
|
||||
io.o: $(srcdir)/io.c
|
||||
crt0.o: $(srcdir)/crt0.s
|
||||
test.o: $(srcdir)/test.c
|
||||
term_in.o: $(srcdir)/term_in.s
|
||||
term_out.o: $(srcdir)/term_out.s
|
||||
term_init.o: $(srcdir)/term_init.s
|
||||
|
||||
.PHONY: info install-info clean-info
|
||||
info:
|
||||
install-info:
|
||||
clean-info:
|
||||
|
||||
Makefile: Makefile.in config.status @host_makefile_frag_path@
|
||||
$(SHELL) config.status
|
||||
|
||||
config.status: configure
|
||||
$(SHELL) config.status --recheck
|
|
@ -0,0 +1,156 @@
|
|||
*** Registers
|
||||
GR0 *always zero
|
||||
GR1 scratch
|
||||
GR2 normal return register
|
||||
GR27 Global Data Pointer (Must be set in crt0)
|
||||
GR30 SP stack pointer
|
||||
GR31 milicode return pointer
|
||||
|
||||
SR* Space registers
|
||||
|
||||
CR24-31 Temporary Control Registers
|
||||
CR14 Vector Table Register (like VBR on an m68020)
|
||||
CR0 Put in a count, causes exception when decremented to 0.
|
||||
|
||||
FORTH's magic number is 031240
|
||||
|
||||
***
|
||||
Series 700/800
|
||||
The following options are also supported:
|
||||
|
||||
-snnn set the initial system load (ISL) start address to
|
||||
nnn in the volume label. This is useful when
|
||||
building boot media for Series 700/800 systems.
|
||||
|
||||
-lnnn specifies the length in bytes of the ISL code in
|
||||
the LIF volume.
|
||||
|
||||
-ennn set the ISL entry point to nnn bytes from the
|
||||
beginning of the ISL. For example, specifying -
|
||||
e3272 means that the ISL entry point is 3272
|
||||
(decimal) bytes from the beginning of the ISL
|
||||
object module.
|
||||
|
||||
-Knnn forces the directory start location to be the
|
||||
nearest multiple of nnn x 1024 bytes from the
|
||||
beginning of the volume. This is necessary for
|
||||
booting Series 700/800 systems from LIF media.
|
||||
|
||||
-n xxx Sets the volume name to be xxx.
|
||||
lifinit -v64000000 -d64 -nISL10 -K2 -s4096 -l61440 -e5336 this_lif
|
||||
|
||||
# lifcp --
|
||||
# -r Forces RAW mode copying. (file type BIN (-23951))
|
||||
# -T Sets the file type of the directory entry.
|
||||
# -Knnn forces each file copied in to begin on a nnn x
|
||||
# 1024-byte boundary from the beginning of the volume
|
||||
# Note: the word echoed below MUST be 10 characters exactly.
|
||||
#
|
||||
(echo "FORTH ") | lifcp -r -T-030001 -K2 - this_lif:AUTO
|
||||
|
||||
|
||||
#
|
||||
# somxtract infile outfile --
|
||||
# converts a series 800 file *only* into a raw image
|
||||
|
||||
It turns out the native cc and our current gcc produce series 700
|
||||
output, so in this case it runs till if fills up the hard disk.
|
||||
|
||||
*** rombootlf5 is a FORTH interpreter in a "boot" image. (it won't run on
|
||||
the HP742 board)
|
||||
|
||||
lifls -l rombootlf5
|
||||
volume ISL10 data size 249984 directory size 8 94/04/20 10:26:36
|
||||
filename type start size implement created
|
||||
===============================================================
|
||||
ISL -12800 16 240 0 94/04/20 10:26:36
|
||||
HPUX -12928 256 496 0 94/04/20 10:26:37
|
||||
IOMAP -12960 752 1504 0 94/04/20 10:26:37
|
||||
AUTO -12289 2256 1 0 94/04/20 10:26:38
|
||||
FORTH -12960 2264 208 0 94/04/20 10:26:38
|
||||
HPFORTH ASCII 2472 420 0 94/04/20 10:26:38
|
||||
BOOTROM ASCII 2896 3849 0 94/04/20 10:26:40
|
||||
PAD1 -12290 6752 1172 0 94/04/20 10:26:40
|
||||
|
||||
*** The ISL is only needed when booting the raw hardware. As we're runing
|
||||
on a monitor (barely) all we need is a crt0 that initiallizes the GR27
|
||||
Global Data Pointer and zero's bss.
|
||||
|
||||
*** Initial Program Load
|
||||
--------------------
|
||||
From page 11-56, architecture book.
|
||||
0x00000000 +------------------------------------+ 0
|
||||
| LIF_MAGIC | |
|
||||
0x00000004 +------------------------------------+ 4
|
||||
| |
|
||||
0x000000F0 +------------------------------------+ 240
|
||||
| IPL_ADDR |
|
||||
0x000000F4 +------------------------------------+ 244
|
||||
| IPL_SIZE |
|
||||
0x000000F8 +------------------------------------+ 248
|
||||
| IPL_ENTRY |
|
||||
0x000000FC +------------------------------------+ 252
|
||||
| |
|
||||
IPL_ADDR +------------------------------------+ IPL_ADDR
|
||||
| Position Independant |
|
||||
| IPL Code |
|
||||
| (including IPL_CHECKSUM) |
|
||||
+------------------------------------+ IPL_ADDR + IPL_SIZE
|
||||
| |
|
||||
+------------------------------------+
|
||||
|
||||
IPL_ADDR 2 Kbyte aligned, nonzero
|
||||
IPL_SIZE Multiple of 2Kbytes, <= 256 Kbytes
|
||||
IPL_ENTRY Word aligned, less than IPL_SIZE
|
||||
|
||||
Loads at IPL_START
|
||||
|
||||
This is based on Cobra/Coral hardware:
|
||||
LED register at 0xf080024
|
||||
I/O status register at 0xf0800000
|
||||
EEPROM at 0xf0810000 (LAN ID begins at byte 0)
|
||||
|
||||
Here's a dump of the LIF volume header using "xd" (od with hex output)
|
||||
|
||||
*
|
||||
00000f0 0000 1000 0000 9800 0000 0000 0000 0000
|
||||
^^^^
|
||||
This is the size
|
||||
*
|
||||
0000800 5445 5354 2020 2020 2020 a271 0000 0010
|
||||
^^^^ ^^^^ ^^^^ ^^^^ ^^^^ ^^^^<-- this is the ipl offset
|
||||
this is the vol name ^^^^<- this is the type
|
||||
|
||||
0000810 0000 0098 9407 1919 1426 8001 0000 0000
|
||||
^^^^
|
||||
This is the ipl size
|
||||
|
||||
Interupts
|
||||
---------
|
||||
The vector table is access by %iva (%cr14). The address here must be a
|
||||
multiple of 2048. The indexes are:
|
||||
1 high-priority
|
||||
2 power failure
|
||||
3 recovery counter
|
||||
4 external interrupt
|
||||
5 low-priority machine check
|
||||
6 instruction TLB miss/instruction page fault
|
||||
7 instruction memory protection
|
||||
8 illegal instruction
|
||||
9 break instruction
|
||||
10 priviledged operation
|
||||
11 priviledged register
|
||||
12 overflow
|
||||
13 conditional
|
||||
14 assist exception
|
||||
15 data TLB miss fault/data page fault
|
||||
16 non access instruction TLB miss fault
|
||||
17 non access page TLB miss fault/non access data page fault
|
||||
18 data memory protection/unaligned data reference
|
||||
19 data memory break
|
||||
20 TLB dirty bit
|
||||
21 page reference
|
||||
22 assist emulation
|
||||
23 higher-priority transfer
|
||||
24 lower-priority transfe
|
||||
25 taken branch
|
|
@ -0,0 +1,150 @@
|
|||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#define USAGE "USAGE: checkum -[vhcs] infile outfile\n\t-v\tverbose\n\
|
||||
\t-h\thelp\n\t-c\tcheck checksum\n\t-s\tprint the ipl size"
|
||||
static int verbose = 0;
|
||||
static int verify = 0;
|
||||
static int size = 0;
|
||||
|
||||
typedef int word_t;
|
||||
#define WORDSIZE (sizeof(word_t))
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
char *infile;
|
||||
char *outfile;
|
||||
int infd;
|
||||
int outfd;
|
||||
word_t checksum = 0;
|
||||
int nbytes;
|
||||
word_t buf;
|
||||
int i = 1;
|
||||
int filesize = 0;
|
||||
|
||||
while (*argv[i] == '-') {
|
||||
switch (*(argv[i]+1)) {
|
||||
case 'v':
|
||||
verbose++;
|
||||
break;
|
||||
case 'c':
|
||||
verify++;
|
||||
puts ("Sorry, unimplemented for now");
|
||||
exit(1);
|
||||
break;
|
||||
case 's':
|
||||
size++;
|
||||
break;
|
||||
case 'h':
|
||||
puts (USAGE);
|
||||
exit(0);
|
||||
default:
|
||||
printf ("\"%s\", Illegal option\n", argv[i]);
|
||||
puts (USAGE);
|
||||
exit(1);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
infile = *(argv + i);
|
||||
outfile = *(argv + i+1);
|
||||
|
||||
/* see it there were file names on the command line */
|
||||
if (infile == 0x0) {
|
||||
puts("Didn't specify an input file name");
|
||||
exit(1);
|
||||
}
|
||||
if (outfile == 0x0) {
|
||||
puts("Didn't specify an output file name");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* try to open the files */
|
||||
infd = open(infile, O_RDONLY);
|
||||
if (infd == -1) {
|
||||
printf("Couldn't open %s\n", infile);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
outfd = open(outfile, O_WRONLY|O_CREAT|O_TRUNC);
|
||||
if (outfd == -1) {
|
||||
printf("Couldn't open %s\n", outfile);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (verbose > 2)
|
||||
putchar('\n');
|
||||
|
||||
/* calculate the checksum */
|
||||
while ((nbytes = read(infd, &buf, WORDSIZE)) == WORDSIZE) {
|
||||
if (verbose > 2)
|
||||
putchar('.');
|
||||
checksum+= buf;
|
||||
filesize+= WORDSIZE;
|
||||
if (write(outfd, &buf, WORDSIZE) != WORDSIZE) {
|
||||
puts("Couldn't write");
|
||||
}
|
||||
if (verbose > 3)
|
||||
putchar('+');
|
||||
}
|
||||
if (verbose > 2)
|
||||
putchar('\n');
|
||||
|
||||
/* write the last byte read */
|
||||
if (nbytes > 0) {
|
||||
write(outfd, &buf, nbytes);
|
||||
checksum+= buf; /* calculate the last word */
|
||||
filesize+= nbytes;
|
||||
}
|
||||
/* write the checksum */
|
||||
buf = -checksum;
|
||||
write(outfd, &buf, WORDSIZE);
|
||||
filesize+= WORDSIZE; /* checksum increase the size */
|
||||
|
||||
if (verbose > 0)
|
||||
printf("The calculated checksum is:\n\t0x%x,\n\t%u\n", -checksum, -checksum);
|
||||
|
||||
/* calculate the extra 2K here */
|
||||
buf = 0;
|
||||
while ((filesize % 2048) !=0) {
|
||||
filesize+=WORDSIZE;
|
||||
write(outfd, &buf, WORDSIZE);
|
||||
}
|
||||
if (size > 0) {
|
||||
printf ("%u is the new file size\n", filesize);
|
||||
}
|
||||
close(outfd);
|
||||
close(infd);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* Calculate a simple checksum and concatenate it to the end of BUF. */
|
||||
void
|
||||
compute_and_concatenate_checksum (word *buf, size_t bufsize_in_words)
|
||||
{
|
||||
size_t i;
|
||||
word sum;
|
||||
sum = buf[0]
|
||||
for (i = 1; i < bufsize_in_words; i++)
|
||||
sum += buf[i];
|
||||
buf[bufsize_in_words] = -sum;
|
||||
}
|
||||
|
||||
/* Calculate a simple checksum and verify it. NOTE: bufsize_in_words should
|
||||
include the checksum, i.e., it should be one larger than when the
|
||||
checksum was calculated using compute_and_concatenate_checksum! */
|
||||
int
|
||||
compute_and_and_verify_checksum (word *buf, size_t bufsize_in_words)
|
||||
{
|
||||
size_t i;
|
||||
word sum;
|
||||
sum = buf[0];
|
||||
for (i = 1; i < bufsize_in_words; i++)
|
||||
sum += buf[i];
|
||||
if (sum != 0)
|
||||
return ERROR;
|
||||
return SUCCESS;
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,991 @@
|
|||
#! /bin/sh
|
||||
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated automatically using autoconf version 2.10
|
||||
# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
|
||||
#
|
||||
# This configure script is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy, distribute and modify it.
|
||||
|
||||
# Defaults:
|
||||
ac_help=
|
||||
ac_default_prefix=/usr/local
|
||||
# Any additions from configure.in:
|
||||
|
||||
# Initialize some variables set by options.
|
||||
# The variables have the same names as the options, with
|
||||
# dashes changed to underlines.
|
||||
build=NONE
|
||||
cache_file=./config.cache
|
||||
exec_prefix=NONE
|
||||
host=NONE
|
||||
no_create=
|
||||
nonopt=NONE
|
||||
no_recursion=
|
||||
prefix=NONE
|
||||
program_prefix=NONE
|
||||
program_suffix=NONE
|
||||
program_transform_name=s,x,x,
|
||||
silent=
|
||||
site=
|
||||
srcdir=
|
||||
target=NONE
|
||||
verbose=
|
||||
x_includes=NONE
|
||||
x_libraries=NONE
|
||||
bindir='${exec_prefix}/bin'
|
||||
sbindir='${exec_prefix}/sbin'
|
||||
libexecdir='${exec_prefix}/libexec'
|
||||
datadir='${prefix}/share'
|
||||
sysconfdir='${prefix}/etc'
|
||||
sharedstatedir='${prefix}/com'
|
||||
localstatedir='${prefix}/var'
|
||||
libdir='${exec_prefix}/lib'
|
||||
includedir='${prefix}/include'
|
||||
oldincludedir='/usr/include'
|
||||
infodir='${prefix}/info'
|
||||
mandir='${prefix}/man'
|
||||
|
||||
# Initialize some other variables.
|
||||
subdirs=
|
||||
MFLAGS= MAKEFLAGS=
|
||||
|
||||
ac_prev=
|
||||
for ac_option
|
||||
do
|
||||
|
||||
# If the previous option needs an argument, assign it.
|
||||
if test -n "$ac_prev"; then
|
||||
eval "$ac_prev=\$ac_option"
|
||||
ac_prev=
|
||||
continue
|
||||
fi
|
||||
|
||||
case "$ac_option" in
|
||||
-*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
|
||||
*) ac_optarg= ;;
|
||||
esac
|
||||
|
||||
# Accept the important Cygnus configure options, so we can diagnose typos.
|
||||
|
||||
case "$ac_option" in
|
||||
|
||||
-bindir | --bindir | --bindi | --bind | --bin | --bi)
|
||||
ac_prev=bindir ;;
|
||||
-bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
|
||||
bindir="$ac_optarg" ;;
|
||||
|
||||
-build | --build | --buil | --bui | --bu)
|
||||
ac_prev=build ;;
|
||||
-build=* | --build=* | --buil=* | --bui=* | --bu=*)
|
||||
build="$ac_optarg" ;;
|
||||
|
||||
-cache-file | --cache-file | --cache-fil | --cache-fi \
|
||||
| --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
|
||||
ac_prev=cache_file ;;
|
||||
-cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
|
||||
| --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
|
||||
cache_file="$ac_optarg" ;;
|
||||
|
||||
-datadir | --datadir | --datadi | --datad | --data | --dat | --da)
|
||||
ac_prev=datadir ;;
|
||||
-datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
|
||||
| --da=*)
|
||||
datadir="$ac_optarg" ;;
|
||||
|
||||
-disable-* | --disable-*)
|
||||
ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
|
||||
# Reject names that are not valid shell variable names.
|
||||
if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
|
||||
{ echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
|
||||
fi
|
||||
ac_feature=`echo $ac_feature| sed 's/-/_/g'`
|
||||
eval "enable_${ac_feature}=no" ;;
|
||||
|
||||
-enable-* | --enable-*)
|
||||
ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
|
||||
# Reject names that are not valid shell variable names.
|
||||
if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
|
||||
{ echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
|
||||
fi
|
||||
ac_feature=`echo $ac_feature| sed 's/-/_/g'`
|
||||
case "$ac_option" in
|
||||
*=*) ;;
|
||||
*) ac_optarg=yes ;;
|
||||
esac
|
||||
eval "enable_${ac_feature}='$ac_optarg'" ;;
|
||||
|
||||
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
|
||||
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
|
||||
| --exec | --exe | --ex)
|
||||
ac_prev=exec_prefix ;;
|
||||
-exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
|
||||
| --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
|
||||
| --exec=* | --exe=* | --ex=*)
|
||||
exec_prefix="$ac_optarg" ;;
|
||||
|
||||
-gas | --gas | --ga | --g)
|
||||
# Obsolete; use --with-gas.
|
||||
with_gas=yes ;;
|
||||
|
||||
-help | --help | --hel | --he)
|
||||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat << EOF
|
||||
Usage: configure [options] [host]
|
||||
Options: [defaults in brackets after descriptions]
|
||||
Configuration:
|
||||
--cache-file=FILE cache test results in FILE
|
||||
--help print this message
|
||||
--no-create do not create output files
|
||||
--quiet, --silent do not print \`checking...' messages
|
||||
--version print the version of autoconf that created configure
|
||||
Directory and file names:
|
||||
--prefix=PREFIX install architecture-independent files in PREFIX
|
||||
[$ac_default_prefix]
|
||||
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
|
||||
[same as prefix]
|
||||
--bindir=DIR user executables in DIR [EPREFIX/bin]
|
||||
--sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
|
||||
--libexecdir=DIR program executables in DIR [EPREFIX/libexec]
|
||||
--datadir=DIR read-only architecture-independent data in DIR
|
||||
[PREFIX/share]
|
||||
--sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
|
||||
--sharedstatedir=DIR modifiable architecture-independent data in DIR
|
||||
[PREFIX/com]
|
||||
--localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
|
||||
--libdir=DIR object code libraries in DIR [EPREFIX/lib]
|
||||
--includedir=DIR C header files in DIR [PREFIX/include]
|
||||
--oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
|
||||
--infodir=DIR info documentation in DIR [PREFIX/info]
|
||||
--mandir=DIR man documentation in DIR [PREFIX/man]
|
||||
--srcdir=DIR find the sources in DIR [configure dir or ..]
|
||||
--program-prefix=PREFIX prepend PREFIX to installed program names
|
||||
--program-suffix=SUFFIX append SUFFIX to installed program names
|
||||
--program-transform-name=PROGRAM
|
||||
run sed PROGRAM on installed program names
|
||||
EOF
|
||||
cat << EOF
|
||||
Host type:
|
||||
--build=BUILD configure for building on BUILD [BUILD=HOST]
|
||||
--host=HOST configure for HOST [guessed]
|
||||
--target=TARGET configure for TARGET [TARGET=HOST]
|
||||
Features and packages:
|
||||
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
|
||||
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
|
||||
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
|
||||
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
|
||||
--x-includes=DIR X include files are in DIR
|
||||
--x-libraries=DIR X library files are in DIR
|
||||
EOF
|
||||
if test -n "$ac_help"; then
|
||||
echo "--enable and --with options recognized:$ac_help"
|
||||
fi
|
||||
exit 0 ;;
|
||||
|
||||
-host | --host | --hos | --ho)
|
||||
ac_prev=host ;;
|
||||
-host=* | --host=* | --hos=* | --ho=*)
|
||||
host="$ac_optarg" ;;
|
||||
|
||||
-includedir | --includedir | --includedi | --included | --include \
|
||||
| --includ | --inclu | --incl | --inc)
|
||||
ac_prev=includedir ;;
|
||||
-includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
|
||||
| --includ=* | --inclu=* | --incl=* | --inc=*)
|
||||
includedir="$ac_optarg" ;;
|
||||
|
||||
-infodir | --infodir | --infodi | --infod | --info | --inf)
|
||||
ac_prev=infodir ;;
|
||||
-infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
|
||||
infodir="$ac_optarg" ;;
|
||||
|
||||
-libdir | --libdir | --libdi | --libd)
|
||||
ac_prev=libdir ;;
|
||||
-libdir=* | --libdir=* | --libdi=* | --libd=*)
|
||||
libdir="$ac_optarg" ;;
|
||||
|
||||
-libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
|
||||
| --libexe | --libex | --libe)
|
||||
ac_prev=libexecdir ;;
|
||||
-libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
|
||||
| --libexe=* | --libex=* | --libe=*)
|
||||
libexecdir="$ac_optarg" ;;
|
||||
|
||||
-localstatedir | --localstatedir | --localstatedi | --localstated \
|
||||
| --localstate | --localstat | --localsta | --localst \
|
||||
| --locals | --local | --loca | --loc | --lo)
|
||||
ac_prev=localstatedir ;;
|
||||
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
|
||||
| --localstate=* | --localstat=* | --localsta=* | --localst=* \
|
||||
| --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
|
||||
localstatedir="$ac_optarg" ;;
|
||||
|
||||
-mandir | --mandir | --mandi | --mand | --man | --ma | --m)
|
||||
ac_prev=mandir ;;
|
||||
-mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
|
||||
mandir="$ac_optarg" ;;
|
||||
|
||||
-nfp | --nfp | --nf)
|
||||
# Obsolete; use --without-fp.
|
||||
with_fp=no ;;
|
||||
|
||||
-no-create | --no-create | --no-creat | --no-crea | --no-cre \
|
||||
| --no-cr | --no-c)
|
||||
no_create=yes ;;
|
||||
|
||||
-no-recursion | --no-recursion | --no-recursio | --no-recursi \
|
||||
| --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
|
||||
no_recursion=yes ;;
|
||||
|
||||
-oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
|
||||
| --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
|
||||
| --oldin | --oldi | --old | --ol | --o)
|
||||
ac_prev=oldincludedir ;;
|
||||
-oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
|
||||
| --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
|
||||
| --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
|
||||
oldincludedir="$ac_optarg" ;;
|
||||
|
||||
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
|
||||
ac_prev=prefix ;;
|
||||
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
|
||||
prefix="$ac_optarg" ;;
|
||||
|
||||
-program-prefix | --program-prefix | --program-prefi | --program-pref \
|
||||
| --program-pre | --program-pr | --program-p)
|
||||
ac_prev=program_prefix ;;
|
||||
-program-prefix=* | --program-prefix=* | --program-prefi=* \
|
||||
| --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
|
||||
program_prefix="$ac_optarg" ;;
|
||||
|
||||
-program-suffix | --program-suffix | --program-suffi | --program-suff \
|
||||
| --program-suf | --program-su | --program-s)
|
||||
ac_prev=program_suffix ;;
|
||||
-program-suffix=* | --program-suffix=* | --program-suffi=* \
|
||||
| --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
|
||||
program_suffix="$ac_optarg" ;;
|
||||
|
||||
-program-transform-name | --program-transform-name \
|
||||
| --program-transform-nam | --program-transform-na \
|
||||
| --program-transform-n | --program-transform- \
|
||||
| --program-transform | --program-transfor \
|
||||
| --program-transfo | --program-transf \
|
||||
| --program-trans | --program-tran \
|
||||
| --progr-tra | --program-tr | --program-t)
|
||||
ac_prev=program_transform_name ;;
|
||||
-program-transform-name=* | --program-transform-name=* \
|
||||
| --program-transform-nam=* | --program-transform-na=* \
|
||||
| --program-transform-n=* | --program-transform-=* \
|
||||
| --program-transform=* | --program-transfor=* \
|
||||
| --program-transfo=* | --program-transf=* \
|
||||
| --program-trans=* | --program-tran=* \
|
||||
| --progr-tra=* | --program-tr=* | --program-t=*)
|
||||
program_transform_name="$ac_optarg" ;;
|
||||
|
||||
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
|
||||
| -silent | --silent | --silen | --sile | --sil)
|
||||
silent=yes ;;
|
||||
|
||||
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
|
||||
ac_prev=sbindir ;;
|
||||
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
|
||||
| --sbi=* | --sb=*)
|
||||
sbindir="$ac_optarg" ;;
|
||||
|
||||
-sharedstatedir | --sharedstatedir | --sharedstatedi \
|
||||
| --sharedstated | --sharedstate | --sharedstat | --sharedsta \
|
||||
| --sharedst | --shareds | --shared | --share | --shar \
|
||||
| --sha | --sh)
|
||||
ac_prev=sharedstatedir ;;
|
||||
-sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
|
||||
| --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
|
||||
| --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
|
||||
| --sha=* | --sh=*)
|
||||
sharedstatedir="$ac_optarg" ;;
|
||||
|
||||
-site | --site | --sit)
|
||||
ac_prev=site ;;
|
||||
-site=* | --site=* | --sit=*)
|
||||
site="$ac_optarg" ;;
|
||||
|
||||
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
|
||||
ac_prev=srcdir ;;
|
||||
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
|
||||
srcdir="$ac_optarg" ;;
|
||||
|
||||
-sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
|
||||
| --syscon | --sysco | --sysc | --sys | --sy)
|
||||
ac_prev=sysconfdir ;;
|
||||
-sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
|
||||
| --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
|
||||
sysconfdir="$ac_optarg" ;;
|
||||
|
||||
-target | --target | --targe | --targ | --tar | --ta | --t)
|
||||
ac_prev=target ;;
|
||||
-target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
|
||||
target="$ac_optarg" ;;
|
||||
|
||||
-v | -verbose | --verbose | --verbos | --verbo | --verb)
|
||||
verbose=yes ;;
|
||||
|
||||
-version | --version | --versio | --versi | --vers)
|
||||
echo "configure generated by autoconf version 2.10"
|
||||
exit 0 ;;
|
||||
|
||||
-with-* | --with-*)
|
||||
ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
|
||||
# Reject names that are not valid shell variable names.
|
||||
if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
|
||||
{ echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
|
||||
fi
|
||||
ac_package=`echo $ac_package| sed 's/-/_/g'`
|
||||
case "$ac_option" in
|
||||
*=*) ;;
|
||||
*) ac_optarg=yes ;;
|
||||
esac
|
||||
eval "with_${ac_package}='$ac_optarg'" ;;
|
||||
|
||||
-without-* | --without-*)
|
||||
ac_package=`echo $ac_option|sed -e 's/-*without-//'`
|
||||
# Reject names that are not valid shell variable names.
|
||||
if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
|
||||
{ echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
|
||||
fi
|
||||
ac_package=`echo $ac_package| sed 's/-/_/g'`
|
||||
eval "with_${ac_package}=no" ;;
|
||||
|
||||
--x)
|
||||
# Obsolete; use --with-x.
|
||||
with_x=yes ;;
|
||||
|
||||
-x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
|
||||
| --x-incl | --x-inc | --x-in | --x-i)
|
||||
ac_prev=x_includes ;;
|
||||
-x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
|
||||
| --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
|
||||
x_includes="$ac_optarg" ;;
|
||||
|
||||
-x-libraries | --x-libraries | --x-librarie | --x-librari \
|
||||
| --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
|
||||
ac_prev=x_libraries ;;
|
||||
-x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
|
||||
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
|
||||
x_libraries="$ac_optarg" ;;
|
||||
|
||||
-*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
|
||||
;;
|
||||
|
||||
*)
|
||||
if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
|
||||
echo "configure: warning: $ac_option: invalid host type" 1>&2
|
||||
fi
|
||||
if test "x$nonopt" != xNONE; then
|
||||
{ echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
|
||||
fi
|
||||
nonopt="$ac_option"
|
||||
;;
|
||||
|
||||
esac
|
||||
done
|
||||
|
||||
if test -n "$ac_prev"; then
|
||||
{ echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
|
||||
fi
|
||||
|
||||
trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
|
||||
|
||||
# File descriptor usage:
|
||||
# 0 standard input
|
||||
# 1 file creation
|
||||
# 2 errors and warnings
|
||||
# 3 some systems may open it to /dev/tty
|
||||
# 4 used on the Kubota Titan
|
||||
# 6 checking for... messages and results
|
||||
# 5 compiler messages saved in config.log
|
||||
if test "$silent" = yes; then
|
||||
exec 6>/dev/null
|
||||
else
|
||||
exec 6>&1
|
||||
fi
|
||||
exec 5>./config.log
|
||||
|
||||
echo "\
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
" 1>&5
|
||||
|
||||
# Strip out --no-create and --no-recursion so they do not pile up.
|
||||
# Also quote any args containing shell metacharacters.
|
||||
ac_configure_args=
|
||||
for ac_arg
|
||||
do
|
||||
case "$ac_arg" in
|
||||
-no-create | --no-create | --no-creat | --no-crea | --no-cre \
|
||||
| --no-cr | --no-c) ;;
|
||||
-no-recursion | --no-recursion | --no-recursio | --no-recursi \
|
||||
| --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
|
||||
*" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
|
||||
ac_configure_args="$ac_configure_args '$ac_arg'" ;;
|
||||
*) ac_configure_args="$ac_configure_args $ac_arg" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# NLS nuisances.
|
||||
# Only set LANG and LC_ALL to C if already set.
|
||||
# These must not be set unconditionally because not all systems understand
|
||||
# e.g. LANG=C (notably SCO).
|
||||
if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
|
||||
if test "${LANG+set}" = set; then LANG=C; export LANG; fi
|
||||
|
||||
# confdefs.h avoids OS command line length limits that DEFS can exceed.
|
||||
rm -rf conftest* confdefs.h
|
||||
# AIX cpp loses on an empty file, so make sure it contains at least a newline.
|
||||
echo > confdefs.h
|
||||
|
||||
# A filename unique to this package, relative to the directory that
|
||||
# configure is in, which we can look for to find out if srcdir is correct.
|
||||
ac_unique_file=crt0.s
|
||||
|
||||
# Find the source files, if location was not specified.
|
||||
if test -z "$srcdir"; then
|
||||
ac_srcdir_defaulted=yes
|
||||
# Try the directory containing this script, then its parent.
|
||||
ac_prog=$0
|
||||
ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
|
||||
test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
|
||||
srcdir=$ac_confdir
|
||||
if test ! -r $srcdir/$ac_unique_file; then
|
||||
srcdir=..
|
||||
fi
|
||||
else
|
||||
ac_srcdir_defaulted=no
|
||||
fi
|
||||
if test ! -r $srcdir/$ac_unique_file; then
|
||||
if test "$ac_srcdir_defaulted" = yes; then
|
||||
{ echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
|
||||
else
|
||||
{ echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
|
||||
fi
|
||||
fi
|
||||
srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
|
||||
|
||||
# Prefer explicitly selected file to automatically selected ones.
|
||||
if test -z "$CONFIG_SITE"; then
|
||||
if test "x$prefix" != xNONE; then
|
||||
CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
|
||||
else
|
||||
CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
|
||||
fi
|
||||
fi
|
||||
for ac_site_file in $CONFIG_SITE; do
|
||||
if test -r "$ac_site_file"; then
|
||||
echo "loading site script $ac_site_file"
|
||||
. "$ac_site_file"
|
||||
fi
|
||||
done
|
||||
|
||||
if test -r "$cache_file"; then
|
||||
echo "loading cache $cache_file"
|
||||
. $cache_file
|
||||
else
|
||||
echo "creating cache $cache_file"
|
||||
> $cache_file
|
||||
fi
|
||||
|
||||
ac_ext=c
|
||||
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
|
||||
ac_cpp='$CPP $CPPFLAGS'
|
||||
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
|
||||
ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
|
||||
|
||||
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
|
||||
# Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
|
||||
if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
|
||||
ac_n= ac_c='
|
||||
' ac_t=' '
|
||||
else
|
||||
ac_n=-n ac_c= ac_t=
|
||||
fi
|
||||
else
|
||||
ac_n= ac_c='\c' ac_t=
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if test "$srcdir" = "." ; then
|
||||
mdir=`echo "${with_multisubdir}/" \
|
||||
| sed -e 's,\([^/][^/]*\),..,g' -e 's,^/$,,'`
|
||||
ac_aux_dir=
|
||||
for ac_dir in ${mdir}../../.. $srcdir/${mdir}../../..; do
|
||||
if test -f $ac_dir/install-sh; then
|
||||
ac_aux_dir=$ac_dir
|
||||
ac_install_sh="$ac_aux_dir/install-sh -c"
|
||||
break
|
||||
elif test -f $ac_dir/install.sh; then
|
||||
ac_aux_dir=$ac_dir
|
||||
ac_install_sh="$ac_aux_dir/install.sh -c"
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -z "$ac_aux_dir"; then
|
||||
{ echo "configure: error: can not find install-sh or install.sh in ${mdir}../../.. $srcdir/${mdir}../../.." 1>&2; exit 1; }
|
||||
fi
|
||||
ac_config_guess=$ac_aux_dir/config.guess
|
||||
ac_config_sub=$ac_aux_dir/config.sub
|
||||
ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
|
||||
|
||||
else
|
||||
ac_aux_dir=
|
||||
for ac_dir in ${srcdir}/../.. $srcdir/${srcdir}/../..; do
|
||||
if test -f $ac_dir/install-sh; then
|
||||
ac_aux_dir=$ac_dir
|
||||
ac_install_sh="$ac_aux_dir/install-sh -c"
|
||||
break
|
||||
elif test -f $ac_dir/install.sh; then
|
||||
ac_aux_dir=$ac_dir
|
||||
ac_install_sh="$ac_aux_dir/install.sh -c"
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -z "$ac_aux_dir"; then
|
||||
{ echo "configure: error: can not find install-sh or install.sh in ${srcdir}/../.. $srcdir/${srcdir}/../.." 1>&2; exit 1; }
|
||||
fi
|
||||
ac_config_guess=$ac_aux_dir/config.guess
|
||||
ac_config_sub=$ac_aux_dir/config.sub
|
||||
ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
|
||||
|
||||
fi
|
||||
|
||||
# Find a good install program. We prefer a C program (faster),
|
||||
# so one script is as good as another. But avoid the broken or
|
||||
# incompatible versions:
|
||||
# SysV /etc/install, /usr/sbin/install
|
||||
# SunOS /usr/etc/install
|
||||
# IRIX /sbin/install
|
||||
# AIX /bin/install
|
||||
# AFS /usr/afsws/bin/install, which mishandles nonexistent args
|
||||
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
|
||||
# ./install, which can be erroneously created by make from ./install.sh.
|
||||
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
|
||||
if test -z "$INSTALL"; then
|
||||
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||
for ac_dir in $PATH; do
|
||||
# Account for people who put trailing slashes in PATH elements.
|
||||
case "$ac_dir/" in
|
||||
/|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
|
||||
*)
|
||||
# OSF1 and SCO ODT 3.0 have their own names for install.
|
||||
for ac_prog in ginstall installbsd scoinst install; do
|
||||
if test -f $ac_dir/$ac_prog; then
|
||||
if test $ac_prog = install &&
|
||||
grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
|
||||
# AIX install. It has an incompatible calling convention.
|
||||
# OSF/1 installbsd also uses dspmsg, but is usable.
|
||||
:
|
||||
else
|
||||
ac_cv_path_install="$ac_dir/$ac_prog -c"
|
||||
break 2
|
||||
fi
|
||||
fi
|
||||
done
|
||||
;;
|
||||
esac
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
|
||||
fi
|
||||
if test "${ac_cv_path_install+set}" = set; then
|
||||
INSTALL="$ac_cv_path_install"
|
||||
else
|
||||
# As a last resort, use the slow shell script. We don't cache a
|
||||
# path for INSTALL within a source directory, because that will
|
||||
# break other packages using the cache if that directory is
|
||||
# removed, or if the path is relative.
|
||||
INSTALL="$ac_install_sh"
|
||||
fi
|
||||
fi
|
||||
echo "$ac_t""$INSTALL" 1>&6
|
||||
|
||||
# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
|
||||
# It thinks the first close brace ends the variable substitution.
|
||||
test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
|
||||
|
||||
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
|
||||
|
||||
|
||||
# Extract the first word of "gcc", so it can be a program name with args.
|
||||
set dummy gcc; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
if test -n "$CC"; then
|
||||
ac_cv_prog_CC="$CC" # Let the user override the test.
|
||||
else
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||
for ac_dir in $PATH; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f $ac_dir/$ac_word; then
|
||||
ac_cv_prog_CC="gcc"
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
fi
|
||||
fi
|
||||
CC="$ac_cv_prog_CC"
|
||||
if test -n "$CC"; then
|
||||
echo "$ac_t""$CC" 1>&6
|
||||
else
|
||||
echo "$ac_t""no" 1>&6
|
||||
fi
|
||||
|
||||
if test -z "$CC"; then
|
||||
# Extract the first word of "cc", so it can be a program name with args.
|
||||
set dummy cc; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
if test -n "$CC"; then
|
||||
ac_cv_prog_CC="$CC" # Let the user override the test.
|
||||
else
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||
ac_prog_rejected=no
|
||||
for ac_dir in $PATH; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f $ac_dir/$ac_word; then
|
||||
if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
|
||||
ac_prog_rejected=yes
|
||||
continue
|
||||
fi
|
||||
ac_cv_prog_CC="cc"
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
if test $ac_prog_rejected = yes; then
|
||||
# We found a bogon in the path, so make sure we never use it.
|
||||
set dummy $ac_cv_prog_CC
|
||||
shift
|
||||
if test $# -gt 0; then
|
||||
# We chose a different compiler from the bogus one.
|
||||
# However, it has the same basename, so the bogon will be chosen
|
||||
# first if we set CC to just the basename; use the full file name.
|
||||
shift
|
||||
set dummy "$ac_dir/$ac_word" "$@"
|
||||
shift
|
||||
ac_cv_prog_CC="$@"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
CC="$ac_cv_prog_CC"
|
||||
if test -n "$CC"; then
|
||||
echo "$ac_t""$CC" 1>&6
|
||||
else
|
||||
echo "$ac_t""no" 1>&6
|
||||
fi
|
||||
|
||||
test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
|
||||
fi
|
||||
|
||||
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.c <<EOF
|
||||
#ifdef __GNUC__
|
||||
yes;
|
||||
#endif
|
||||
EOF
|
||||
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:707: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
|
||||
ac_cv_prog_gcc=yes
|
||||
else
|
||||
ac_cv_prog_gcc=no
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$ac_t""$ac_cv_prog_gcc" 1>&6
|
||||
if test $ac_cv_prog_gcc = yes; then
|
||||
GCC=yes
|
||||
if test "${CFLAGS+set}" != set; then
|
||||
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_gcc_g'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
echo 'void f(){}' > conftest.c
|
||||
if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
|
||||
ac_cv_prog_gcc_g=yes
|
||||
else
|
||||
ac_cv_prog_gcc_g=no
|
||||
fi
|
||||
rm -f conftest*
|
||||
|
||||
fi
|
||||
|
||||
echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6
|
||||
if test $ac_cv_prog_gcc_g = yes; then
|
||||
CFLAGS="-g -O"
|
||||
else
|
||||
CFLAGS="-O"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
GCC=
|
||||
test "${CFLAGS+set}" = set || CFLAGS="-g"
|
||||
fi
|
||||
|
||||
AS=${AS-as}
|
||||
|
||||
AR=${AR-ar}
|
||||
|
||||
LD=${LD-ld}
|
||||
|
||||
# Extract the first word of "ranlib", so it can be a program name with args.
|
||||
set dummy ranlib; ac_word=$2
|
||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
if test -n "$RANLIB"; then
|
||||
ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
|
||||
else
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||
for ac_dir in $PATH; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f $ac_dir/$ac_word; then
|
||||
ac_cv_prog_RANLIB="ranlib"
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
|
||||
fi
|
||||
fi
|
||||
RANLIB="$ac_cv_prog_RANLIB"
|
||||
if test -n "$RANLIB"; then
|
||||
echo "$ac_t""$RANLIB" 1>&6
|
||||
else
|
||||
echo "$ac_t""no" 1>&6
|
||||
fi
|
||||
|
||||
|
||||
host_makefile_frag=${srcdir}/../config/default.mh
|
||||
|
||||
host_makefile_frag_path=$host_makefile_frag
|
||||
|
||||
|
||||
|
||||
trap '' 1 2 15
|
||||
cat > confcache <<\EOF
|
||||
# This file is a shell script that caches the results of configure
|
||||
# tests run on this system so they can be shared between configure
|
||||
# scripts and configure runs. It is not useful on other systems.
|
||||
# If it contains results you don't want to keep, you may remove or edit it.
|
||||
#
|
||||
# By default, configure uses ./config.cache as the cache file,
|
||||
# creating it if it does not exist already. You can give configure
|
||||
# the --cache-file=FILE option to use a different cache file; that is
|
||||
# what configure does when it calls configure scripts in
|
||||
# subdirectories, so they share the cache.
|
||||
# Giving --cache-file=/dev/null disables caching, for debugging configure.
|
||||
# config.status only pays attention to the cache file if you give it the
|
||||
# --recheck option to rerun configure.
|
||||
#
|
||||
EOF
|
||||
# Ultrix sh set writes to stderr and can't be redirected directly,
|
||||
# and sets the high bit in the cache file unless we assign to the vars.
|
||||
(set) 2>&1 |
|
||||
sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" \
|
||||
>> confcache
|
||||
if cmp -s $cache_file confcache; then
|
||||
:
|
||||
else
|
||||
if test -w $cache_file; then
|
||||
echo "updating cache $cache_file"
|
||||
cat confcache > $cache_file
|
||||
else
|
||||
echo "not updating unwritable cache $cache_file"
|
||||
fi
|
||||
fi
|
||||
rm -f confcache
|
||||
|
||||
trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
|
||||
|
||||
test "x$prefix" = xNONE && prefix=$ac_default_prefix
|
||||
# Let make expand exec_prefix.
|
||||
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
|
||||
|
||||
# Any assignment to VPATH causes Sun make to only execute
|
||||
# the first set of double-colon rules, so remove it if not needed.
|
||||
# If there is a colon in the path, we need to keep it.
|
||||
if test "x$srcdir" = x.; then
|
||||
ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
|
||||
fi
|
||||
|
||||
trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
|
||||
|
||||
# Transform confdefs.h into DEFS.
|
||||
# Protect against shell expansion while executing Makefile rules.
|
||||
# Protect against Makefile macro expansion.
|
||||
cat > conftest.defs <<\EOF
|
||||
s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
|
||||
s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g
|
||||
s%\[%\\&%g
|
||||
s%\]%\\&%g
|
||||
s%\$%$$%g
|
||||
EOF
|
||||
DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
|
||||
rm -f conftest.defs
|
||||
|
||||
|
||||
# Without the "./", some shells look in PATH for config.status.
|
||||
: ${CONFIG_STATUS=./config.status}
|
||||
|
||||
echo creating $CONFIG_STATUS
|
||||
rm -f $CONFIG_STATUS
|
||||
cat > $CONFIG_STATUS <<EOF
|
||||
#! /bin/sh
|
||||
# Generated automatically by configure.
|
||||
# Run this file to recreate the current configuration.
|
||||
# This directory was configured as follows,
|
||||
# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
|
||||
#
|
||||
# $0 $ac_configure_args
|
||||
#
|
||||
# Compiler output produced by configure, useful for debugging
|
||||
# configure, is in ./config.log if it exists.
|
||||
|
||||
ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
|
||||
for ac_option
|
||||
do
|
||||
case "\$ac_option" in
|
||||
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
|
||||
echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
|
||||
exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
|
||||
-version | --version | --versio | --versi | --vers | --ver | --ve | --v)
|
||||
echo "$CONFIG_STATUS generated by autoconf version 2.10"
|
||||
exit 0 ;;
|
||||
-help | --help | --hel | --he | --h)
|
||||
echo "\$ac_cs_usage"; exit 0 ;;
|
||||
*) echo "\$ac_cs_usage"; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
ac_given_srcdir=$srcdir
|
||||
ac_given_INSTALL="$INSTALL"
|
||||
|
||||
trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
|
||||
EOF
|
||||
cat >> $CONFIG_STATUS <<EOF
|
||||
|
||||
# Protect against being on the right side of a sed subst in config.status.
|
||||
sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
|
||||
s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
|
||||
$ac_vpsub
|
||||
$extrasub
|
||||
s%@CFLAGS@%$CFLAGS%g
|
||||
s%@CPPFLAGS@%$CPPFLAGS%g
|
||||
s%@CXXFLAGS@%$CXXFLAGS%g
|
||||
s%@DEFS@%$DEFS%g
|
||||
s%@LDFLAGS@%$LDFLAGS%g
|
||||
s%@LIBS@%$LIBS%g
|
||||
s%@exec_prefix@%$exec_prefix%g
|
||||
s%@prefix@%$prefix%g
|
||||
s%@program_transform_name@%$program_transform_name%g
|
||||
s%@bindir@%$bindir%g
|
||||
s%@sbindir@%$sbindir%g
|
||||
s%@libexecdir@%$libexecdir%g
|
||||
s%@datadir@%$datadir%g
|
||||
s%@sysconfdir@%$sysconfdir%g
|
||||
s%@sharedstatedir@%$sharedstatedir%g
|
||||
s%@localstatedir@%$localstatedir%g
|
||||
s%@libdir@%$libdir%g
|
||||
s%@includedir@%$includedir%g
|
||||
s%@oldincludedir@%$oldincludedir%g
|
||||
s%@infodir@%$infodir%g
|
||||
s%@mandir@%$mandir%g
|
||||
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
|
||||
s%@INSTALL_DATA@%$INSTALL_DATA%g
|
||||
s%@CC@%$CC%g
|
||||
s%@AS@%$AS%g
|
||||
s%@AR@%$AR%g
|
||||
s%@LD@%$LD%g
|
||||
s%@RANLIB@%$RANLIB%g
|
||||
s%@host_makefile_frag_path@%$host_makefile_frag_path%g
|
||||
/@host_makefile_frag@/r $host_makefile_frag
|
||||
s%@host_makefile_frag@%%g
|
||||
|
||||
CEOF
|
||||
EOF
|
||||
cat >> $CONFIG_STATUS <<EOF
|
||||
|
||||
CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
|
||||
EOF
|
||||
cat >> $CONFIG_STATUS <<\EOF
|
||||
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
|
||||
# Support "outfile[:infile]", defaulting infile="outfile.in".
|
||||
case "$ac_file" in
|
||||
*:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'`
|
||||
ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
|
||||
*) ac_file_in="${ac_file}.in" ;;
|
||||
esac
|
||||
|
||||
# Adjust relative srcdir, etc. for subdirectories.
|
||||
|
||||
# Remove last slash and all that follows it. Not all systems have dirname.
|
||||
ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
|
||||
if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
|
||||
# The file is in a subdirectory.
|
||||
test ! -d "$ac_dir" && mkdir "$ac_dir"
|
||||
ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
|
||||
# A "../" for each directory in $ac_dir_suffix.
|
||||
ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
|
||||
else
|
||||
ac_dir_suffix= ac_dots=
|
||||
fi
|
||||
|
||||
case "$ac_given_srcdir" in
|
||||
.) srcdir=.
|
||||
if test -z "$ac_dots"; then top_srcdir=.
|
||||
else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
|
||||
/*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
|
||||
*) # Relative path.
|
||||
srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
|
||||
top_srcdir="$ac_dots$ac_given_srcdir" ;;
|
||||
esac
|
||||
|
||||
case "$ac_given_INSTALL" in
|
||||
[/$]*) INSTALL="$ac_given_INSTALL" ;;
|
||||
*) INSTALL="$ac_dots$ac_given_INSTALL" ;;
|
||||
esac
|
||||
echo creating "$ac_file"
|
||||
rm -f "$ac_file"
|
||||
configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
|
||||
case "$ac_file" in
|
||||
*Makefile*) ac_comsub="1i\\
|
||||
# $configure_input" ;;
|
||||
*) ac_comsub= ;;
|
||||
esac
|
||||
sed -e "$ac_comsub
|
||||
s%@configure_input@%$configure_input%g
|
||||
s%@srcdir@%$srcdir%g
|
||||
s%@top_srcdir@%$top_srcdir%g
|
||||
s%@INSTALL@%$INSTALL%g
|
||||
" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file
|
||||
fi; done
|
||||
rm -f conftest.subs
|
||||
|
||||
|
||||
|
||||
exit 0
|
||||
EOF
|
||||
chmod +x $CONFIG_STATUS
|
||||
rm -fr confdefs* $ac_clean_files
|
||||
test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_PREREQ(2.5)dnl
|
||||
AC_INIT(crt0.s)
|
||||
|
||||
if test "$srcdir" = "." ; then
|
||||
mdir=`echo "${with_multisubdir}/" \
|
||||
| sed -e 's,\([[^/]][[^/]]*\),..,g' -e 's,^/$,,'`
|
||||
AC_CONFIG_AUX_DIR(${mdir}../../..)
|
||||
else
|
||||
AC_CONFIG_AUX_DIR(${srcdir}/../..)
|
||||
fi
|
||||
|
||||
AC_PROG_INSTALL
|
||||
|
||||
AC_PROG_CC
|
||||
AS=${AS-as}
|
||||
AC_SUBST(AS)
|
||||
AR=${AR-ar}
|
||||
AC_SUBST(AR)
|
||||
LD=${LD-ld}
|
||||
AC_SUBST(LD)
|
||||
AC_PROG_RANLIB
|
||||
|
||||
host_makefile_frag=${srcdir}/../config/default.mh
|
||||
|
||||
dnl We have to assign the same value to other variables because autoconf
|
||||
dnl doesn't provide a mechanism to substitute a replacement keyword with
|
||||
dnl arbitrary data or pathnames.
|
||||
dnl
|
||||
host_makefile_frag_path=$host_makefile_frag
|
||||
AC_SUBST(host_makefile_frag_path)
|
||||
AC_SUBST_FILE(host_makefile_frag)
|
||||
|
||||
AC_OUTPUT(Makefile)
|
|
@ -0,0 +1,177 @@
|
|||
/*
|
||||
* crt0.S -- startup file for hppa.
|
||||
* rob@cygnus.com (Rob Savoye)
|
||||
*/
|
||||
.VERSION "0.2"
|
||||
.COPYRIGHT "crt0.S for hppa"
|
||||
|
||||
;sp .equ %r30 ; stack pointer
|
||||
;dp .equ %r27 ; global data pointer
|
||||
;arg0 .equ %r26 ; argument
|
||||
;arg1 .equ %r25 ; argument or high part of double argument
|
||||
;arg2 .equ %r24 ; argument
|
||||
;arg3 .equ %r23 ; argument or high part of double argument
|
||||
|
||||
#define IMM(a,b) ldil L%a,b ! ldo R%a(b),b
|
||||
#define imm(i,t) ldil LS%i,t ! addi RS%i,t,t
|
||||
|
||||
.DATA
|
||||
|
||||
/****
|
||||
* FIXME: these are just a gross hack so this will assemble
|
||||
****/
|
||||
_bss_start .WORD
|
||||
_bss_end .WORD
|
||||
_foobar
|
||||
.STRINGZ "Foo Bar...\r\n"
|
||||
|
||||
;;_SYSTEM_ID .WORD
|
||||
;; .EXPORT _SYSTEM_ID ; FIXME this is only so it'll
|
||||
; link
|
||||
|
||||
/*
|
||||
* Set up the standard spaces (sections) These definitions come
|
||||
* from /lib/pcc_prefix.s.
|
||||
*/
|
||||
.space $TEXT$,0
|
||||
|
||||
.SUBSPA $BOOT$,QUAD=0,ALIGN=8,ACCESS=0x2c,SORT=4
|
||||
.IMPORT _start
|
||||
|
||||
/*
|
||||
* stuff we need that's defined elsewhere.
|
||||
*/
|
||||
.IMPORT main, CODE
|
||||
.IMPORT _bss_start, DATA
|
||||
.IMPORT _bss_end, DATA
|
||||
.IMPORT environ, DATA
|
||||
|
||||
/*
|
||||
* start -- set things up so the application will run.
|
||||
*
|
||||
*/
|
||||
.PROC
|
||||
.CALLINFO SAVE_SP, FRAME=48
|
||||
.EXPORT $START$,ENTRY
|
||||
$START$
|
||||
|
||||
/* FIXME: this writes to page zero */
|
||||
;; setup the %30 (stack pointer) with some memory
|
||||
ldil L%_stack+48,%r30
|
||||
ldo R%_stack+48(%r30),%r30 ; should be %r30 (sp) but then
|
||||
; we'd kill our test program :-)
|
||||
;; we need to set %r27 (global data pointer) here too
|
||||
ldil L%$global$,%r27
|
||||
ldo R%$global$(%r27),%r27 ; same problem as above
|
||||
|
||||
/*
|
||||
* zerobss -- zero out the bss section
|
||||
*/
|
||||
; load the start of bss
|
||||
ldil L%_bss_start,%r4
|
||||
ldo R%_bss_start(%r4),%r4
|
||||
|
||||
; load the end of bss
|
||||
ldil L%_bss_end,%r5
|
||||
ldo R%_bss_end(%r5),%r5
|
||||
|
||||
|
||||
bssloop
|
||||
addi -1,%r5,%r5 ; decrement _bss_end
|
||||
stb %r0,0(0,%r5) ; we do this by bytes for now even
|
||||
; though it's slower, it's safer
|
||||
combf,= %r4,%r5, bssloop
|
||||
nop
|
||||
|
||||
ldi 1,%ret0
|
||||
|
||||
/*
|
||||
* Call the main routine from the application to get it going.
|
||||
* main (argc, argv, environ)
|
||||
* We pass argv as a pointer to NULL.
|
||||
*/
|
||||
|
||||
bl main,%r2
|
||||
nop
|
||||
|
||||
.PROCEND
|
||||
/*
|
||||
* _exit -- Exit from the application. Normally we cause a user trap
|
||||
* to return to the ROM monitor for another run, but with
|
||||
* this monitor we can't. Still, "C" wants this symbol, it
|
||||
* should be here. Jumping to 0xF0000004 jumps back into the
|
||||
* firmware, while writing a 5 to 0xFFFE0030 causes a reset.
|
||||
*/
|
||||
.EXPORT _exit, ENTRY
|
||||
_exit
|
||||
.PROC
|
||||
.CALLINFO
|
||||
.ENTRY
|
||||
;; ldil L%0xf0000004,%r1
|
||||
;; bl %r1, %r2
|
||||
|
||||
ldil L'4026531844,%r19
|
||||
ldo R'4026531844(%r19),%r19
|
||||
blr %r19, %r2
|
||||
nop
|
||||
|
||||
;; This just causes a breakpoint exception
|
||||
;; break 0x0e,0xa5a
|
||||
;; bv,n (%rp)
|
||||
nop
|
||||
.EXIT
|
||||
.PROCEND
|
||||
|
||||
.subspa $UNWIND_START$,QUAD=0,ALIGN=8,ACCESS=0x2c,SORT=56
|
||||
.export $UNWIND_START
|
||||
$UNWIND_START
|
||||
.subspa $UNWIND$,QUAD=0,ALIGN=8,ACCESS=0x2c,SORT=64
|
||||
.subspa $UNWIND_END$,QUAD=0,ALIGN=8,ACCESS=0x2c,SORT=72
|
||||
.export $UNWIND_END
|
||||
$UNWIND_END
|
||||
.subspa $RECOVER_START$,QUAD=0,ALIGN=4,ACCESS=0x2c,SORT=73
|
||||
.export $RECOVER_START
|
||||
$RECOVER_START
|
||||
.subspa $RECOVER$,QUAD=0,ALIGN=4,ACCESS=0x2c,SORT=80
|
||||
.subspa $RECOVER_END$,QUAD=0,ALIGN=4,ACCESS=0x2c,SORT=88
|
||||
.export $RECOVER_END
|
||||
$RECOVER_END
|
||||
|
||||
; The following declarations are, by default in the data space ($PRIVATE$)
|
||||
|
||||
;; .space $PRIVATE$,1
|
||||
|
||||
/*
|
||||
* Here we set up the standard date sub spaces.
|
||||
* _dp is for the WinBond board.
|
||||
*
|
||||
* Set up some room for a stack. We just grab a chunk of memory.
|
||||
* We also setup some space for the global variable space, which
|
||||
* must be done using the reserved name "$global$" so "C" code
|
||||
* can find it. The stack grows towards the higher addresses.
|
||||
*/
|
||||
|
||||
.subspa $DATA$,QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=16
|
||||
.subspa $SHORTDATA$,QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=24
|
||||
.subspa $GLOBAL$,QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=40
|
||||
.export $global$
|
||||
.export _dp
|
||||
$global$
|
||||
_dp
|
||||
.subspa $SHORTBSS$,QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=80,ZERO
|
||||
.subspa $BSS$,QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=82,ZERO
|
||||
|
||||
.subspa $STACK$,QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=88,ZERO
|
||||
.export _stack
|
||||
_stack
|
||||
.BLOCK 0x2000
|
||||
|
||||
/*
|
||||
* The heap follows the stack. To use dynamic memory routines in an
|
||||
* application, some space MUST be assigned to the stack.
|
||||
*/
|
||||
|
||||
.subspa $HEAP$,QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=96,ZERO
|
||||
.export _heap
|
||||
_heap
|
||||
.end
|
|
@ -0,0 +1,127 @@
|
|||
/****************************************************************************
|
||||
|
||||
THIS SOFTWARE IS NOT COPYRIGHTED
|
||||
|
||||
HP offers the following for use in the public domain. HP makes no
|
||||
warranty with regard to the software or it's performance and the
|
||||
user accepts the software "AS IS" with all faults.
|
||||
|
||||
HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD
|
||||
TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
/* Debugger register array offets */
|
||||
|
||||
#define R_gr0 0
|
||||
#define R_gr1 4
|
||||
#define R_gr2 8
|
||||
#define R_gr3 12
|
||||
#define R_gr4 16
|
||||
#define R_gr5 20
|
||||
#define R_gr6 24
|
||||
#define R_gr7 28
|
||||
#define R_gr8 32
|
||||
#define R_gr9 36
|
||||
#define R_gr10 40
|
||||
#define R_gr11 44
|
||||
#define R_gr12 48
|
||||
#define R_gr13 52
|
||||
#define R_gr14 56
|
||||
#define R_gr15 60
|
||||
#define R_gr16 64
|
||||
#define R_gr17 68
|
||||
#define R_gr18 72
|
||||
#define R_gr19 76
|
||||
#define R_gr20 80
|
||||
#define R_gr21 84
|
||||
#define R_gr22 88
|
||||
#define R_gr23 92
|
||||
#define R_gr24 96
|
||||
#define R_gr25 100
|
||||
#define R_gr26 104
|
||||
#define R_gr27 108
|
||||
#define R_gr28 112
|
||||
#define R_gr29 116
|
||||
#define R_gr30 120
|
||||
#define R_gr31 124
|
||||
|
||||
#define R_sr0 128
|
||||
#define R_sr1 132
|
||||
#define R_sr2 136
|
||||
#define R_sr3 140
|
||||
#define R_sr4 144
|
||||
#define R_sr5 148
|
||||
#define R_sr6 152
|
||||
#define R_sr7 156
|
||||
|
||||
#define R_cr0 160
|
||||
#define R_cr1 164
|
||||
#define R_cr2 168
|
||||
#define R_cr3 172
|
||||
#define R_cr4 176
|
||||
#define R_cr5 180
|
||||
#define R_cr6 184
|
||||
#define R_cr7 188
|
||||
#define R_cr8 192
|
||||
#define R_cr9 196
|
||||
#define R_cr10 200
|
||||
#define R_cr11 204
|
||||
#define R_cr12 208
|
||||
#define R_cr13 212
|
||||
#define R_cr14 216
|
||||
#define R_cr15 220
|
||||
#define R_cr16 224
|
||||
#define R_cr17H 228
|
||||
#define R_cr18H 232
|
||||
#define R_cr19 236
|
||||
#define R_cr20 240
|
||||
#define R_cr21 244
|
||||
#define R_cr22 248
|
||||
#define R_cr23 252
|
||||
#define R_cr24 256
|
||||
#define R_cr25 260
|
||||
#define R_cr26 264
|
||||
#define R_cr27 268
|
||||
#define R_cr28 272
|
||||
#define R_cr29 276
|
||||
#define R_cr30 280
|
||||
#define R_cr31 284
|
||||
|
||||
#define R_cr17T 288
|
||||
#define R_cr18T 292
|
||||
|
||||
#define R_cpu0 296
|
||||
|
||||
#define R_SIZE 300
|
||||
|
||||
#define min_stack 64
|
||||
|
||||
; -----------------------------------------------------------
|
||||
; ------ ASCII control codes
|
||||
; -----------------------------------------------------------
|
||||
|
||||
#define NULL 0x00 /* <break> soft-reset (input only) */
|
||||
#define DELP 0x03 /* <ctrl>C del-collapse (input only, non-std) */
|
||||
#define DELE 0x04 /* <ctrl>D del-to_eol (input only, non-std) */
|
||||
#define BELL 0x07 /* <ctrl>G bell - audio */
|
||||
#define BS 0x08 /* <ctrl>H back space (left arrow) */
|
||||
#define HT 0x09 /* <ctrl>I horizontal tab */
|
||||
#define LF 0x0a /* <ctrl>J line feed (down arrow) */
|
||||
#define VT 0x0b /* <ctrl>K vertical tab (up arrow) */
|
||||
#define FF 0x0c /* <ctrl>L form feed (right arrow) */
|
||||
#define RTN 0x0d /* <ctrl>M carrage return */
|
||||
#define CR 0x0d /* <ctrl>M carrage return */
|
||||
#define INSC 0x0e /* <ctrl>N insert char (input only, non-std) */
|
||||
#define XON 0x11 /* <ctrl>Q DC1 - continue */
|
||||
#define BT 0x12 /* <ctrl>R reverse tab (input only, non-std) */
|
||||
#define XOFF 0x13 /* <ctrl>S DC3 - wait */
|
||||
#define INSE 0x16 /* <ctrl>V insert-expand (input only, non-std) */
|
||||
#define DELC 0x18 /* <ctrl>X delete char (input only, non-std) */
|
||||
#define CLRH 0x1a /* <ctrl>Z clear/home (input only) */
|
||||
#define ESC 0x1b /* <ctrl>[ escape (must call key again) */
|
||||
#define ENDL 0x1c /* <ctrl>\ cursor-to-eol (input only, non-std) */
|
||||
#define HOME 0x1e /* <ctrl>^ cursor home (input only) */
|
||||
#define DEL 0x7f /* <shift>BS destructive backspace */
|
||||
|
|
@ -0,0 +1,585 @@
|
|||
/****************************************************************************
|
||||
|
||||
THIS SOFTWARE IS NOT COPYRIGHTED
|
||||
|
||||
HP offers the following for use in the public domain. HP makes no
|
||||
warranty with regard to the software or it's performance and the
|
||||
user accepts the software "AS IS" with all faults.
|
||||
|
||||
HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD
|
||||
TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
****************************************************************************/
|
||||
.space $TEXT$
|
||||
.subspa $CODE$,access=0x2c
|
||||
|
||||
#if 1
|
||||
#include "diagnose.h"
|
||||
#endif
|
||||
|
||||
i13BREAK .equ 0xa5a ; im13 field for specified functions
|
||||
i5REG .equ 0x06 ; Init registers
|
||||
i5BP .equ 0x09 ; GDB breakpoin
|
||||
i5PSW .equ 0x0b ; Get PSW
|
||||
i5INLINE .equ 0x0e ; Get INLINE
|
||||
R_gr0 .equ 0
|
||||
R_gr1 .equ 4
|
||||
R_gr2 .equ 8
|
||||
R_gr3 .equ 12
|
||||
R_gr4 .equ 16
|
||||
R_gr5 .equ 20
|
||||
R_gr6 .equ 24
|
||||
R_gr7 .equ 28
|
||||
R_gr8 .equ 32
|
||||
R_gr9 .equ 36
|
||||
R_gr10 .equ 40
|
||||
R_gr11 .equ 44
|
||||
R_gr12 .equ 48
|
||||
R_gr13 .equ 52
|
||||
R_gr14 .equ 56
|
||||
R_gr15 .equ 60
|
||||
R_gr16 .equ 64
|
||||
R_gr17 .equ 68
|
||||
R_gr18 .equ 72
|
||||
R_gr19 .equ 76
|
||||
R_gr20 .equ 80
|
||||
R_gr21 .equ 84
|
||||
R_gr22 .equ 88
|
||||
R_gr23 .equ 92
|
||||
R_gr24 .equ 96
|
||||
R_gr25 .equ 100
|
||||
R_gr26 .equ 104
|
||||
R_gr27 .equ 108
|
||||
R_gr28 .equ 112
|
||||
R_gr29 .equ 116
|
||||
R_gr30 .equ 120
|
||||
R_gr31 .equ 124
|
||||
|
||||
R_sr0 .equ 128
|
||||
R_sr1 .equ 132
|
||||
R_sr2 .equ 136
|
||||
R_sr3 .equ 140
|
||||
R_sr4 .equ 144
|
||||
R_sr5 .equ 148
|
||||
R_sr6 .equ 152
|
||||
R_sr7 .equ 156
|
||||
|
||||
R_cr0 .equ 160
|
||||
R_cr1 .equ 164
|
||||
R_cr2 .equ 168
|
||||
R_cr3 .equ 172
|
||||
R_cr4 .equ 176
|
||||
R_cr5 .equ 180
|
||||
R_cr6 .equ 184
|
||||
R_cr7 .equ 188
|
||||
R_cr8 .equ 192
|
||||
R_cr9 .equ 196
|
||||
R_cr10 .equ 200
|
||||
R_cr11 .equ 204
|
||||
R_cr12 .equ 208
|
||||
R_cr13 .equ 212
|
||||
R_cr14 .equ 216
|
||||
R_cr15 .equ 220
|
||||
R_cr16 .equ 224
|
||||
R_cr17H .equ 228
|
||||
R_cr18H .equ 232
|
||||
R_cr19 .equ 236
|
||||
R_cr20 .equ 240
|
||||
R_cr21 .equ 244
|
||||
R_cr22 .equ 248
|
||||
R_cr23 .equ 252
|
||||
R_cr24 .equ 256
|
||||
R_cr25 .equ 260
|
||||
R_cr26 .equ 264
|
||||
R_cr27 .equ 268
|
||||
R_cr28 .equ 272
|
||||
R_cr29 .equ 276
|
||||
R_cr30 .equ 280
|
||||
R_cr31 .equ 284
|
||||
|
||||
R_cr17T .equ 288
|
||||
R_cr18T .equ 292
|
||||
|
||||
R_cpu0 .equ 296
|
||||
|
||||
R_SIZE .equ 300
|
||||
|
||||
min_stack .equ 64
|
||||
|
||||
.import handle_exception
|
||||
.import $global$, data
|
||||
.IMPORT putnum, code
|
||||
.IMPORT led_putnum, code
|
||||
.IMPORT delay, code
|
||||
|
||||
.export FICE
|
||||
.export DEBUG_GO
|
||||
.export DEBUG_SS
|
||||
.export STUB_RESTORE
|
||||
|
||||
.export save_regs
|
||||
.export RegBlk
|
||||
.export Exception_index
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
.EXPORT breakpoint,ENTRY,ARGW0=GR,RTNVAL=GR
|
||||
breakpoint
|
||||
.PROC
|
||||
.CALLINFO CALLER,FRAME=128,SAVE_RP
|
||||
.ENTRY
|
||||
|
||||
stw %r2,-20(0,%r30) ; stash the return pointer
|
||||
ldo 128(%r30),%r30 ; push up the stack pointer
|
||||
|
||||
;;; debug
|
||||
ldi 6, %r26
|
||||
bl,n led_putnum,%r2
|
||||
nop
|
||||
ldil L'900000,%r26
|
||||
ldo R'900000(%r26),%r26
|
||||
bl,n delay,%r2
|
||||
nop
|
||||
;;;
|
||||
break i5INLINE,i13BREAK
|
||||
;;; more debug
|
||||
ldi 7, %r26
|
||||
bl,n led_putnum,%r2
|
||||
nop
|
||||
ldil L'900000,%r26
|
||||
ldo R'900000(%r26),%r26
|
||||
bl,n delay,%r2
|
||||
nop
|
||||
;;;
|
||||
|
||||
FICE fice 0(0,%r26) ; Flush the i cache entry
|
||||
sync
|
||||
|
||||
ldw -148(0,%r30),%r2 ; retrieve the return pointer
|
||||
ldo -128(%r30),%r30 ; reset the stack pointer
|
||||
bv,n 0(%r2) ; return to caller
|
||||
nop
|
||||
|
||||
.EXIT
|
||||
.PROCEND
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
DEBUG_GO
|
||||
or,tr %r0,%r0,%r10 ; if go, do not set R-bit to 1
|
||||
|
||||
DEBUG_SS
|
||||
ldi 1,%r10 ; else set R-bit to 1
|
||||
|
||||
DEBUG_EXEC
|
||||
|
||||
bl DGO_0,%r8 ; r8 points to register block
|
||||
addil L%RegBlk-DGO_0,%r8
|
||||
DGO_0
|
||||
ldo R%RegBlk-DGO_0(%r1),%r8
|
||||
|
||||
; load space registers
|
||||
|
||||
ldw R_sr0(%r8),%r1
|
||||
mtsp %r1,%sr0
|
||||
ldw R_sr1(%r8),%r1
|
||||
mtsp %r1,%sr1
|
||||
ldw R_sr2(%r8),%r1
|
||||
mtsp %r1,%sr2
|
||||
ldw R_sr3(%r8),%r1
|
||||
mtsp %r1,%sr3
|
||||
ldw R_sr4(%r8),%r1
|
||||
mtsp %r1,%sr4
|
||||
ldw R_sr5(%r8),%r1
|
||||
mtsp %r1,%sr5
|
||||
ldw R_sr6(%r8),%r1
|
||||
mtsp %r1,%sr6
|
||||
ldw R_sr7(%r8),%r1
|
||||
mtsp %r1,%sr7
|
||||
|
||||
; clear Q-bit for rfi
|
||||
|
||||
rsm 0x08,%r0
|
||||
|
||||
; load control registers
|
||||
|
||||
ldw R_cr0(%r8),%r1
|
||||
or,= %r10,%r0,%r0 ; if single step
|
||||
copy %r0,%r1 ; set %cr0 to 0
|
||||
mtctl %r1,%cr0
|
||||
ldw R_cr8(%r8),%r1
|
||||
mtctl %r1,%cr8
|
||||
ldw R_cr9(%r8),%r1
|
||||
mtctl %r1,%cr9
|
||||
ldw R_cr10(%r8),%r1
|
||||
mtctl %r1,%cr10
|
||||
ldw R_cr11(%r8),%r1
|
||||
mtctl %r1,%cr11
|
||||
ldw R_cr12(%r8),%r1
|
||||
mtctl %r1,%cr12
|
||||
ldw R_cr13(%r8),%r1
|
||||
mtctl %r1,%cr13
|
||||
ldw R_cr14(%r8),%r1
|
||||
mtctl %r1,%cr14
|
||||
ldw R_cr15(%r8),%r1
|
||||
mtctl %r1,%cr15
|
||||
ldw R_cr16(%r8),%r1
|
||||
mtctl %r1,%cr16
|
||||
ldw R_cr17H(%r8),%r1 ; load iiasq.head
|
||||
mtctl %r1,%cr17
|
||||
ldw R_cr18H(%r8),%r1 ; load iiaoq.head
|
||||
mtctl %r1,%cr18
|
||||
ldw R_cr17T(%r8),%r1 ; load iiasq.tail
|
||||
mtctl %r1,%cr17
|
||||
ldw R_cr18T(%r8),%r1 ; load iiaoq.tail
|
||||
mtctl %r1,%cr18
|
||||
ldw R_cr19(%r8),%r1
|
||||
mtctl %r1,%cr19
|
||||
ldw R_cr20(%r8),%r1
|
||||
mtctl %r1,%cr20
|
||||
ldw R_cr21(%r8),%r1
|
||||
mtctl %r1,%cr21
|
||||
ldw R_cr22(%r8),%r1
|
||||
dep %r10,27,1,%r1 ; set R-bit if applicable
|
||||
mtctl %r1,%cr22
|
||||
ldw R_cr23(%r8),%r1
|
||||
mtctl %r1,%cr23
|
||||
ldw R_cr24(%r8),%r1
|
||||
mtctl %r1,%cr24
|
||||
ldw R_cr25(%r8),%r1
|
||||
mtctl %r1,%cr25
|
||||
ldw R_cr26(%r8),%r1
|
||||
mtctl %r1,%cr26
|
||||
ldw R_cr27(%r8),%r1
|
||||
mtctl %r1,%cr27
|
||||
ldw R_cr28(%r8),%r1
|
||||
mtctl %r1,%cr28
|
||||
ldw R_cr29(%r8),%r1
|
||||
mtctl %r1,%cr29
|
||||
ldw R_cr30(%r8),%r1
|
||||
mtctl %r1,%cr30
|
||||
ldw R_cr31(%r8),%r1
|
||||
mtctl %r1,%cr31
|
||||
|
||||
; load diagnose registers
|
||||
|
||||
ldw R_cpu0(%r8),%r1
|
||||
ldil L%CPU0_MASK,%r2
|
||||
ldo R%CPU0_MASK(%r2),%r2
|
||||
xor %r1,%r2,%r1 ; xor the read/clear bits
|
||||
nop
|
||||
mtcpu %r1,0
|
||||
mtcpu %r1,0
|
||||
|
||||
; load general registers
|
||||
|
||||
ldw R_gr1(%r8),%r1
|
||||
ldw R_gr2(%r8),%r2
|
||||
ldw R_gr3(%r8),%r3
|
||||
ldw R_gr4(%r8),%r4
|
||||
ldw R_gr5(%r8),%r5
|
||||
ldw R_gr6(%r8),%r6
|
||||
ldw R_gr7(%r8),%r7
|
||||
ldw R_gr9(%r8),%r9
|
||||
ldw R_gr10(%r8),%r10
|
||||
ldw R_gr11(%r8),%r11
|
||||
ldw R_gr12(%r8),%r12
|
||||
ldw R_gr13(%r8),%r13
|
||||
ldw R_gr14(%r8),%r14
|
||||
ldw R_gr15(%r8),%r15
|
||||
ldw R_gr16(%r8),%r16
|
||||
ldw R_gr17(%r8),%r17
|
||||
ldw R_gr18(%r8),%r18
|
||||
ldw R_gr19(%r8),%r19
|
||||
ldw R_gr20(%r8),%r20
|
||||
ldw R_gr21(%r8),%r21
|
||||
ldw R_gr22(%r8),%r22
|
||||
ldw R_gr23(%r8),%r23
|
||||
ldw R_gr24(%r8),%r24
|
||||
ldw R_gr25(%r8),%r25
|
||||
ldw R_gr26(%r8),%r26
|
||||
ldw R_gr27(%r8),%r27
|
||||
ldw R_gr28(%r8),%r28
|
||||
ldw R_gr29(%r8),%r29
|
||||
ldw R_gr30(%r8),%r30
|
||||
ldw R_gr31(%r8),%r31
|
||||
ldw R_gr8(%r8),%r8
|
||||
|
||||
; execute user program
|
||||
|
||||
nop
|
||||
rfi ; switch to user code
|
||||
nop
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
|
||||
STUB_RESTORE
|
||||
copy %r1,%r9 ; save exception index
|
||||
bl SR_00,%r8
|
||||
addil L%Exception_index-SR_00,%r8
|
||||
SR_00
|
||||
ldo R%Exception_index-SR_00(%r1),%r8
|
||||
stw %r9,(%r8)
|
||||
|
||||
bl save_regs,%r25
|
||||
nop
|
||||
|
||||
#ifdef DEBUG_DEBUGGER1
|
||||
stwm %r1,8(%sp)
|
||||
bl putc,%rp
|
||||
ldi CR,%arg0
|
||||
bl putc,%rp
|
||||
ldi LF,%arg0
|
||||
bl printit,%mrp
|
||||
mfctl %pcoq,%arg0
|
||||
|
||||
mfctl %pcoq,%r1
|
||||
mtctl %r1,%pcoq
|
||||
mfctl %pcoq,%arg0
|
||||
bl printit,%mrp
|
||||
mtctl %arg0,%pcoq
|
||||
|
||||
bl printit,%mrp
|
||||
ldw -8(%sp),%arg0
|
||||
|
||||
ldwm -8(%sp),%r1
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_DEBUGGER2
|
||||
stwm %r1,8(%sp)
|
||||
bl putc,%rp
|
||||
ldi LF,%arg0
|
||||
ldwm -8(%sp),%r1
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_DEBUGGER3
|
||||
bl printit,%mrp
|
||||
copy iptr,%arg0
|
||||
bl printit,%mrp
|
||||
copy rstack,%arg0
|
||||
bl printit,%mrp
|
||||
copy gspace,%arg0
|
||||
bl printit,%mrp
|
||||
copy dstack,%arg0
|
||||
bl printit,%mrp
|
||||
copy nextptr,%arg0
|
||||
bl printit,%mrp
|
||||
copy %dp,%arg0
|
||||
bl printit,%mrp
|
||||
copy %sp,%arg0
|
||||
bl printit,%mrp
|
||||
mfctl %rctr,%arg0
|
||||
bl printit,%mrp
|
||||
mfctl %iva,%arg0
|
||||
bl printit,%mrp
|
||||
mfctl %eiem,%arg0
|
||||
bl printit,%mrp
|
||||
mfctl %ipsw,%arg0
|
||||
bl printit,%mrp
|
||||
copy %r0,%arg0
|
||||
#endif
|
||||
bl SR_1,%sp
|
||||
addil L%Stub_stack-SR_1,%sp
|
||||
SR_1
|
||||
ldo R%Stub_stack-SR_1(%r1),%sp ; set the stack pointer
|
||||
|
||||
bl SR_2,%arg0
|
||||
addil L%RegBlk-SR_2,%arg0
|
||||
SR_2
|
||||
ldo R%RegBlk-SR_2(%r1),%arg0 ; set arg0 (save register area)
|
||||
|
||||
bl SR_3,%arg1
|
||||
addil L%Exception_index-SR_3,%arg1 ; set arg1 address
|
||||
SR_3
|
||||
ldo R%Exception_index-SR_3(%r1),%arg1 ; set arg1 address
|
||||
|
||||
addi min_stack,%sp,%sp ; allocate min stack frame
|
||||
|
||||
bl handle_exception,%r2
|
||||
ldw 0(%arg1),%arg1 ; load arg1
|
||||
addi -min_stack,%sp,%sp ; de allocate min stack frame
|
||||
|
||||
b DEBUG_EXEC ;
|
||||
copy %r28,%r10
|
||||
;-------------------------------------------------------------------------------
|
||||
|
||||
save_regs ; return address is in %r25
|
||||
|
||||
bl SR_0,%r1 ; r1 points to Register block
|
||||
addil L%RegBlk-SR_0,%r1
|
||||
SR_0
|
||||
ldo R%RegBlk-SR_0(%r1),%r1
|
||||
|
||||
; save general registers
|
||||
|
||||
stw %r0,R_gr0(%r1)
|
||||
; don't store %r1 yet
|
||||
stw %r2,R_gr2(%r1)
|
||||
stw %r3,R_gr3(%r1)
|
||||
stw %r4,R_gr4(%r1)
|
||||
stw %r5,R_gr5(%r1)
|
||||
stw %r6,R_gr6(%r1)
|
||||
stw %r7,R_gr7(%r1)
|
||||
; don't store %r8 yet
|
||||
; don't store %r9 yet
|
||||
stw %r10,R_gr10(%r1)
|
||||
stw %r11,R_gr11(%r1)
|
||||
stw %r12,R_gr12(%r1)
|
||||
stw %r13,R_gr13(%r1)
|
||||
stw %r14,R_gr14(%r1)
|
||||
stw %r15,R_gr15(%r1)
|
||||
; don't store %r16 yet
|
||||
; don't store %r17 yet
|
||||
stw %r18,R_gr18(%r1)
|
||||
stw %r19,R_gr19(%r1)
|
||||
stw %r20,R_gr20(%r1)
|
||||
stw %r21,R_gr21(%r1)
|
||||
stw %r22,R_gr22(%r1)
|
||||
stw %r23,R_gr23(%r1)
|
||||
; don't store %r24 yet
|
||||
; don't store %r25 yet
|
||||
stw %r26,R_gr26(%r1)
|
||||
stw %r27,R_gr27(%r1)
|
||||
stw %r28,R_gr28(%r1)
|
||||
stw %r29,R_gr29(%r1)
|
||||
stw %r30,R_gr30(%r1)
|
||||
stw %r31,R_gr31(%r1)
|
||||
|
||||
; restore general registers from shadow registers and save them
|
||||
|
||||
copy %r1,%r10 ; hold Register block pointer
|
||||
copy %r25,%rp ; hold return pointer
|
||||
shdw_gr
|
||||
shdw_gr
|
||||
stw %r1,R_gr1(%r10)
|
||||
stw %r8,R_gr8(%r10)
|
||||
stw %r9,R_gr9(%r10)
|
||||
stw %r16,R_gr16(%r10)
|
||||
stw %r17,R_gr17(%r10)
|
||||
stw %r24,R_gr24(%r10)
|
||||
stw %r25,R_gr25(%r10)
|
||||
|
||||
; save control registers
|
||||
|
||||
mfctl %cr0,%r1
|
||||
stw %r1,R_cr0(%r10)
|
||||
stw %r0,R_cr1(%r10)
|
||||
stw %r0,R_cr2(%r10)
|
||||
stw %r0,R_cr3(%r10)
|
||||
stw %r0,R_cr4(%r10)
|
||||
stw %r0,R_cr5(%r10)
|
||||
stw %r0,R_cr6(%r10)
|
||||
stw %r0,R_cr7(%r10)
|
||||
mfctl %cr8,%r1
|
||||
stw %r1,R_cr8(%r10)
|
||||
mfctl %cr9,%r1
|
||||
stw %r1,R_cr9(%r10)
|
||||
mfctl %cr10,%r1
|
||||
stw %r1,R_cr10(%r10)
|
||||
mfctl %cr11,%r1
|
||||
stw %r1,R_cr11(%r10)
|
||||
mfctl %cr12,%r1
|
||||
stw %r1,R_cr12(%r10)
|
||||
mfctl %cr13,%r1
|
||||
stw %r1,R_cr13(%r10)
|
||||
mfctl %cr14,%r1
|
||||
stw %r1,R_cr14(%r10)
|
||||
mfctl %cr15,%r1
|
||||
stw %r1,R_cr15(%r10)
|
||||
mfctl %cr16,%r1
|
||||
stw %r1,R_cr16(%r10)
|
||||
mfctl %cr17,%r1
|
||||
stw %r1,R_cr17H(%r10)
|
||||
mtctl %r1,%cr17
|
||||
mfctl %cr17,%r1
|
||||
stw %r1,R_cr17T(%r10)
|
||||
mtctl %r1,%cr17
|
||||
mfctl %cr18,%r1
|
||||
stw %r1,R_cr18H(%r10)
|
||||
mtctl %r1,%cr18
|
||||
mfctl %cr18,%r1
|
||||
stw %r1,R_cr18T(%r10)
|
||||
mtctl %r1,%cr18
|
||||
mfctl %cr19,%r1
|
||||
stw %r1,R_cr19(%r10)
|
||||
mfctl %cr20,%r1
|
||||
stw %r1,R_cr20(%r10)
|
||||
mfctl %cr21,%r1
|
||||
stw %r1,R_cr21(%r10)
|
||||
mfctl %cr22,%r1
|
||||
stw %r1,R_cr22(%r10)
|
||||
mfctl %cr23,%r1
|
||||
stw %r1,R_cr23(%r10)
|
||||
mfctl %cr24,%r1
|
||||
stw %r1,R_cr24(%r10)
|
||||
mfctl %cr25,%r1
|
||||
stw %r1,R_cr25(%r10)
|
||||
mfctl %cr26,%r1
|
||||
stw %r1,R_cr26(%r10)
|
||||
mfctl %cr27,%r1
|
||||
stw %r1,R_cr27(%r10)
|
||||
mfctl %cr28,%r1
|
||||
stw %r1,R_cr28(%r10)
|
||||
mfctl %cr29,%r1
|
||||
stw %r1,R_cr29(%r10)
|
||||
mfctl %cr30,%r1
|
||||
stw %r1,R_cr30(%r10)
|
||||
mfctl %cr31,%r1
|
||||
stw %r1,R_cr31(%r10)
|
||||
|
||||
; save diagnose registers
|
||||
|
||||
mfcpu_c 0,%r1
|
||||
mfcpu_c 0,%r1
|
||||
stw %r1,R_cpu0(%r10)
|
||||
|
||||
; save space registers
|
||||
|
||||
mfsp %sr0,%r1
|
||||
stw %r1,R_sr0(%r10)
|
||||
mfsp %sr1,%r1
|
||||
stw %r1,R_sr1(%r10)
|
||||
mfsp %sr2,%r1
|
||||
stw %r1,R_sr2(%r10)
|
||||
mfsp %sr3,%r1
|
||||
stw %r1,R_sr3(%r10)
|
||||
mfsp %sr4,%r1
|
||||
stw %r1,R_sr4(%r10)
|
||||
mfsp %sr5,%r1
|
||||
stw %r1,R_sr5(%r10)
|
||||
mfsp %sr6,%r1
|
||||
stw %r1,R_sr6(%r10)
|
||||
mfsp %sr7,%r1
|
||||
bv (%rp)
|
||||
stw %r1,R_sr7(%r10)
|
||||
|
||||
#ifdef DEBUG_DEBUGGER
|
||||
;-------------------------------------------------------------------------------
|
||||
printit
|
||||
mtctl %rp,%tr0
|
||||
mtctl %r1,%tr1
|
||||
bl putnum,%rp
|
||||
copy %rp,%arg0
|
||||
|
||||
mtctl %mrp,%tr2
|
||||
bl putc,%rp
|
||||
ldi CR,%arg0
|
||||
bl putc,%rp
|
||||
ldi LF,%arg0
|
||||
mfctl %tr2,%mrp
|
||||
mfctl %tr1,%r1
|
||||
bv (%mrp)
|
||||
mfctl %tr0,%rp
|
||||
#endif
|
||||
.space $PRIVATE$
|
||||
.subspa $DATA$,align=4,access=0x1f
|
||||
|
||||
Exception_index
|
||||
.word 0
|
||||
|
||||
RegBlk
|
||||
.block R_SIZE ; register block
|
||||
|
||||
Stub_stack
|
||||
.block 1024
|
||||
|
||||
.end
|
|
@ -0,0 +1,168 @@
|
|||
/****************************************************************************
|
||||
|
||||
THIS SOFTWARE IS NOT COPYRIGHTED
|
||||
|
||||
HP offers the following for use in the public domain. HP makes no
|
||||
warranty with regard to the software or it's performance and the
|
||||
user accepts the software "AS IS" with all faults.
|
||||
|
||||
HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD
|
||||
TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
/* Diagnose register definitions */
|
||||
|
||||
|
||||
#ifdef PCXL
|
||||
|
||||
#define CPU_DIAG_0_L2IHPMC_BIT 6 /* Level 2 I-cache error flag */
|
||||
#define CPU_DIAG_0_L2DHPMC_BIT 8 /* Level 2 D-cache error flag */
|
||||
#define CPU_DIAG_0_L1IHPMC_BIT 10 /* Level 1 I-cache error flag */
|
||||
#define CPU_DIAG_0_L2PARERR_BIT 15 /* rightmost bit */
|
||||
#define CPU_DIAG_0_PREV_HPMC_PREP_BIT 16 /* Previous HPMC finished */
|
||||
#define CPU_DIAG_0_PWR_FAIL_BIT 17
|
||||
#define CPU_DIAG_0_EXPECT_HPMC_BIT 18 /* Expecting HPMC */
|
||||
|
||||
/* Mask for Read/clear bits in CPU diagnose register 0 */
|
||||
#define CPU0_MASK 0x02AF0000
|
||||
|
||||
#else /* PCXT */
|
||||
|
||||
#define CPU_DIAG_0_PREV_HPMC_PREP_BIT 3 /* Previous HPMC finished */
|
||||
#define CPU_DIAG_0_BOOTING_BIT 4
|
||||
#define CPU_DIAG_0_EXPECT_HPMC_BIT 5 /* Expecting HPMC */
|
||||
|
||||
#define CPU_DIAG_0_DHPMC_BIT 10
|
||||
#define CPU_DIAG_0_ILPMC_BIT 14
|
||||
#define CPU_DIAG_0_HTOC_BIT 23
|
||||
|
||||
/* Mask for Read/clear bits in CPU diagnose register 0 */
|
||||
#define CPU0_MASK 0x00220100
|
||||
|
||||
#endif
|
||||
|
||||
/* Diagnose instruction macros */
|
||||
|
||||
#ifdef PCXL
|
||||
|
||||
/*** Different PCXL diagnose commands ***/
|
||||
|
||||
/* Original mfcpu replaced with the two commands mfcpu_t & mfcpu_c */
|
||||
mfcpu_t .macro diag_reg,gen_reg
|
||||
{ 0 .. 5} = 0x5 {26 .. 31}
|
||||
{ 6 .. 10} = diag_reg {27 .. 31}
|
||||
{11 .. 15} = 0x0 {27 .. 31}
|
||||
{16 .. 18} = 0x0 {29 .. 31}
|
||||
{19 .. 26} = 0xa0 {24 .. 31}
|
||||
{27 .. 31} = gen_reg {27 .. 31}
|
||||
.endm
|
||||
|
||||
mfcpu_c .macro diag_reg,gen_reg
|
||||
{ 0 .. 5} = 0x5 {26 .. 31}
|
||||
{ 6 .. 10} = diag_reg {27 .. 31}
|
||||
{11 .. 15} = gen_reg {27 .. 31}
|
||||
{16 .. 18} = 0x0 {29 .. 31}
|
||||
{19 .. 26} = 0x30 {24 .. 31}
|
||||
{27 .. 31} = 0x0 {27 .. 31}
|
||||
.endm
|
||||
|
||||
mtcpu .macro gen_reg,diag_reg
|
||||
{ 0 .. 5} = 0x5 {26 .. 31}
|
||||
{ 6 .. 10} = diag_reg {27 .. 31}
|
||||
{11 .. 15} = gen_reg {27 .. 31}
|
||||
{16 .. 18} = 0x0 {29 .. 31}
|
||||
{19 .. 26} = 0x12 {24 .. 31}
|
||||
{27 .. 31} = 0x0 {27 .. 31}
|
||||
.endm
|
||||
|
||||
shdw_gr .macro
|
||||
{ 0 .. 5} = 0x5 {26 .. 31}
|
||||
{ 6 .. 10} = 0x0 {27 .. 31}
|
||||
{11 .. 15} = 0x0 {27 .. 31}
|
||||
{16 .. 18} = 0x0 {29 .. 31}
|
||||
{19 .. 26} = 0xd0 {24 .. 31}
|
||||
{27 .. 31} = 0x0 {27 .. 31}
|
||||
.endm
|
||||
|
||||
gr_shdw .macro
|
||||
{ 0 .. 5} = 0x5 {26 .. 31}
|
||||
{ 6 .. 10} = 0x0 {27 .. 31}
|
||||
{11 .. 15} = 0x0 {27 .. 31}
|
||||
{16 .. 18} = 0x0 {29 .. 31}
|
||||
{19 .. 26} = 0xd2 {24 .. 31}
|
||||
{27 .. 31} = 0x0 {27 .. 31}
|
||||
.endm
|
||||
|
||||
#else
|
||||
|
||||
/*** original PCXT version ***/
|
||||
|
||||
/* Originally was mfcpu without the _c */
|
||||
mfcpu_c .macro diag_reg,gen_reg
|
||||
{ 0 .. 5} = 0x5 {26 .. 31}
|
||||
{ 6 .. 10} = diag_reg {27 .. 31}
|
||||
{11 .. 15} = gen_reg {27 .. 31}
|
||||
{16 .. 18} = 0x0 {29 .. 31}
|
||||
{19 .. 26} = 0xd0 {24 .. 31}
|
||||
{27 .. 31} = 0x0 {27 .. 31}
|
||||
.endm
|
||||
|
||||
mtcpu .macro gen_reg,diag_reg
|
||||
{ 0 .. 5} = 0x5 {26 .. 31}
|
||||
{ 6 .. 10} = diag_reg {27 .. 31}
|
||||
{11 .. 15} = gen_reg {27 .. 31}
|
||||
{16 .. 18} = 0x0 {29 .. 31}
|
||||
{19 .. 26} = 0xb0 {24 .. 31}
|
||||
{27 .. 31} = 0x0 {27 .. 31}
|
||||
.endm
|
||||
|
||||
shdw_gr .macro
|
||||
{ 0 .. 5} = 0x5 {26 .. 31}
|
||||
{ 6 .. 10} = 0x2 {27 .. 31}
|
||||
{11 .. 15} = 0x0 {27 .. 31}
|
||||
{16 .. 18} = 0x1 {29 .. 31}
|
||||
{19 .. 26} = 0x30 {24 .. 31}
|
||||
{27 .. 31} = 0x0 {27 .. 31}
|
||||
.endm
|
||||
|
||||
gr_shdw .macro
|
||||
{ 0 .. 5} = 0x5 {26 .. 31}
|
||||
{ 6 .. 10} = 0x2 {27 .. 31}
|
||||
{11 .. 15} = 0x0 {27 .. 31}
|
||||
{16 .. 18} = 0x0 {29 .. 31}
|
||||
{19 .. 26} = 0x31 {24 .. 31}
|
||||
{27 .. 31} = 0x0 {27 .. 31}
|
||||
.endm
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* Actual commands used doubled instructions for cpu timing */
|
||||
|
||||
|
||||
#define SHDW_GR shdw_gr ! \
|
||||
shdw_gr
|
||||
|
||||
|
||||
/* Break instruction definitions */
|
||||
|
||||
#define i13BREAK 0xa5a /* im13 field for specified functions */
|
||||
#define i5REG 0x06 /* Init registers */
|
||||
#define i5BP 0x09 /* GDB breakpoint */
|
||||
#define i5PSW 0x0b /* Get PSW */
|
||||
#define i5INLINE 0x0e /* Get INLINE */
|
||||
|
||||
BR_INIT_REGS .macro
|
||||
break i5REG,i13BREAK
|
||||
.endm
|
||||
|
||||
BR_GET_PSW .macro
|
||||
break i5PSW,i13BREAK
|
||||
.endm
|
||||
|
||||
BR_INLINE .macro
|
||||
break i5INLINE,i13BREAK
|
||||
.endm
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
/*
|
||||
* PDC support
|
||||
*/
|
||||
#define OPT_PDC_CACHE 5
|
||||
#define OPT_PDC_ADD_VALID 12
|
||||
#define OPT_PDC_CHASSIS 2 /* LED's */
|
||||
#define OPT_PDC_IODC 8 /* console I/O */
|
||||
#define IODC_CONSOLE_OUT 3 /* bytes out serial port */
|
||||
#define IODC_CONSOLE_IN 2 /* bytes in serial port */
|
||||
|
||||
#define PGZ_MEM_PDC 0x0388 /* location of PDC_ENTRY in memory */
|
||||
#define PGZ_CONSOLE_STRUCT 0x3A0 /* console config info */
|
||||
#define CALL_PDC (*(int (*)())((int *)(*((int *)PGZ_MEM_PDC))))
|
||||
|
||||
#define putDebugChar outbyte
|
||||
#define getDebugChar inbyte
|
||||
|
||||
/*
|
||||
* IODC support
|
||||
*/
|
||||
#define MAX_BUS_CONVERTERS 6
|
||||
#define MAX_LAYERS 6
|
||||
#define IO_CONSOLE_INPUT 2
|
||||
#define IO_CONSOLE_OUTPUT 3
|
||||
|
||||
struct _dev {
|
||||
unsigned char flags; /* auto-search and auto-boot */
|
||||
unsigned char bus_convert[MAX_BUS_CONVERTERS];
|
||||
unsigned char pm; /* fixed field of HPA */
|
||||
unsigned int layer[MAX_LAYERS]; /* device dependent layers */
|
||||
unsigned int hpa; /* device HPA */
|
||||
unsigned int spa; /* device SPA */
|
||||
unsigned int *iodc_io; /* address of ENTRY_IO in mem */
|
||||
unsigned int class; /* device class */
|
||||
};
|
||||
|
||||
/*
|
||||
* Register defintions
|
||||
*/
|
||||
#define gr0 %r0 /* always ZERO */
|
||||
#define gr1 %r1 /* ADDIL results only */
|
||||
#define gr2 %r2 /* return address */
|
||||
#define gr3 %r3 /* scratch registers */
|
||||
#define gr4 %r4
|
||||
#define gr5 %r5
|
||||
#define gr6 %r6
|
||||
#define gr7 %r7
|
||||
#define gr8 %r8
|
||||
#define gr9 %r9
|
||||
#define gr10 %r10
|
||||
#define gr11 %r11
|
||||
#define gr12 %r12
|
||||
#define gr13 %r13
|
||||
#define gr14 %r14
|
||||
#define gr15 %r15
|
||||
#define gr16 %r16
|
||||
#define gr17 %r17
|
||||
#define gr18 %r18
|
||||
#define gr19 %r19 /* 4th temp register */
|
||||
#define gr20 %r20 /* 3rd temp register */
|
||||
#define gr21 %r21 /* 2rd temp register */
|
||||
#define gr22 %r22 /* 1rd temp register */
|
||||
#define gr23 %r23 /* argument 3 */
|
||||
#define gr24 %r24 /* argument 2 */
|
||||
#define gr25 %r25 /* argument 1 */
|
||||
#define gr26 %r26 /* argument 0 */
|
||||
#define gr27 %r27 /* global data pointer */
|
||||
#define gr28 %r28 /* return value */
|
||||
#define gr29 %r29 /* return value, static link */
|
||||
#define gr30 %r30 /* stack pointer */
|
||||
#define gr31 %r31 /* millicode return pointer */
|
||||
|
||||
/*
|
||||
* extra definitions, calling conventions
|
||||
*/
|
||||
#define rp gr2 /* return address */
|
||||
#define sp gr30 /* stack pointer */
|
||||
#define dp gr27 /* global data area pointer */
|
||||
|
||||
/*
|
||||
* extra definitions, argument passing
|
||||
*/
|
||||
#define Arg0 gr26 /* pdc function to perform */
|
||||
#define Arg1 gr25 /* args to the pdc function */
|
||||
#define Arg2 gr24
|
||||
#define Arg3 gr23
|
||||
|
||||
/*
|
||||
* Special Processor Registers
|
||||
*/
|
||||
#define SAR %cr11 /* shift amount register */
|
||||
#define IVA %cr14 /* Interruption Vector Address */
|
||||
#define EIEM %cr15 /* EIEM reg */
|
||||
#define EIR %cr23 /* EIR reg */
|
||||
#define TIMER %cr16 /* interval timer */
|
||||
#define CCR %cr10 /* coprocessor control reg. */
|
||||
|
||||
/*
|
||||
* ASCII escape code
|
||||
*/
|
||||
#define NULL 0x00 /* <break> soft-reset (input only) */
|
||||
#define DELP 0x03 /* <ctrl>C del-collapse (input only, non-std) */
|
||||
#define DELE 0x04 /* <ctrl>D del-to_eol (input only, non-std) */
|
||||
#define BELL 0x07 /* <ctrl>G bell - audio */
|
||||
#define BS 0x08 /* <ctrl>H back space (left arrow) */
|
||||
#define HT 0x09 /* <ctrl>I horizontal tab */
|
||||
#define LF 0x0a /* <ctrl>J line feed (down arrow) */
|
||||
#define VT 0x0b /* <ctrl>K vertical tab (up arrow) */
|
||||
#define FF 0x0c /* <ctrl>L form feed (right arrow) */
|
||||
#define RTN 0x0d /* <ctrl>M carrage return */
|
||||
#define CR 0x0d /* <ctrl>M carrage return */
|
||||
|
||||
#define INSC 0x0e /* <ctrl>N insert char (input only, non-std) */
|
||||
#define XON 0x11 /* <ctrl>Q DC1 - continue */
|
||||
#define BT 0x12 /* <ctrl>R reverse tab (input only, non-std) */
|
||||
#define XOFF 0x13 /* <ctrl>S DC3 - wait */
|
||||
#define INSE 0x16 /* <ctrl>V insert-expand (input only, non-std) */
|
||||
#define DELC 0x18 /* <ctrl>X delete char (input only, non-std) */
|
||||
#define CLRH 0x1a /* <ctrl>Z clear/home (input only) */
|
||||
#define ESC 0x1b /* <ctrl>[ escape (must call key again) */
|
||||
#define ENDL 0x1c /* <ctrl>\ cursor-to-eol (input only, non-std) */
|
||||
#define HOME 0x1e /* <ctrl>^ cursor home (input only) */
|
||||
#define DEL 0x7f /* <shift>BS destructive backspace */
|
|
@ -0,0 +1,64 @@
|
|||
STARTUP(crt0-hppa.o)
|
||||
OUTPUT_ARCH(hppa)
|
||||
/*** INPUT(hppa.o) ***/
|
||||
SEARCH_DIR(.)
|
||||
__DYNAMIC = 0;
|
||||
|
||||
/*
|
||||
* Setup the memory map of the MC68ec0x0 Board (IDP)
|
||||
* stack grows up towards high memory. This works for
|
||||
* both the rom68k and the mon68k monitors.
|
||||
*/
|
||||
MEMORY
|
||||
{
|
||||
ram (rwx) : ORIGIN = 0x10000, LENGTH = 32M
|
||||
}
|
||||
|
||||
/*
|
||||
* stick everything in ram (of course)
|
||||
*/
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
CREATE_OBJECT_SYMBOLS
|
||||
*(.text)
|
||||
etext = .;
|
||||
__CTOR_LIST__ = .;
|
||||
LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
|
||||
*(.ctors)
|
||||
LONG(0)
|
||||
__CTOR_END__ = .;
|
||||
__DTOR_LIST__ = .;
|
||||
LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)
|
||||
*(.dtors)
|
||||
LONG(0)
|
||||
__DTOR_END__ = .;
|
||||
*(.lit)
|
||||
*(.shdata)
|
||||
} > ram
|
||||
.shbss SIZEOF(.text) + ADDR(.text) : {
|
||||
*(.shbss)
|
||||
}
|
||||
.data : {
|
||||
*(.data)
|
||||
CONSTRUCTORS
|
||||
_edata = .;
|
||||
} > ram
|
||||
|
||||
.bss SIZEOF(.data) + ADDR(.data) :
|
||||
{
|
||||
_bss_start = ALIGN(0x8);
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
_bss_end = ALIGN(0x8);
|
||||
}
|
||||
.stab 0 (NOLOAD) :
|
||||
{
|
||||
[ .stab ]
|
||||
}
|
||||
.stabstr 0 (NOLOAD) :
|
||||
{
|
||||
[ .stabstr ]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,338 @@
|
|||
/*
|
||||
* io.c -- all the code to make GCC and the libraries run on
|
||||
* a bare target board.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "hppa-defs.h"
|
||||
|
||||
extern char *_end; /* _end is set in the linker command file */
|
||||
|
||||
/* just in case, most boards have at least some memory */
|
||||
#ifndef RAMSIZE
|
||||
# define RAMSIZE (char *)0x100000
|
||||
#endif
|
||||
|
||||
int
|
||||
print(ptr)
|
||||
char *ptr;
|
||||
{
|
||||
while (*ptr)
|
||||
outbyte (*ptr++);
|
||||
}
|
||||
|
||||
int
|
||||
putnum (Num)
|
||||
unsigned int Num;
|
||||
{
|
||||
char Buffer[9];
|
||||
int Count;
|
||||
char *BufPtr = Buffer;
|
||||
int Digit;
|
||||
|
||||
for (Count = 7 ; Count >= 0 ; Count--) {
|
||||
Digit = (Num >> (Count * 4)) & 0xf;
|
||||
|
||||
if (Digit <= 9)
|
||||
*BufPtr++ = (char) ('0' + Digit);
|
||||
else
|
||||
*BufPtr++ = (char) ('a' - 10 + Digit);
|
||||
}
|
||||
|
||||
*BufPtr = (char) 0;
|
||||
print (Buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
delay (x)
|
||||
int x;
|
||||
{
|
||||
int y = 17;
|
||||
while (x-- !=0)
|
||||
y = y^2;
|
||||
}
|
||||
|
||||
/*
|
||||
* strobe -- do a zylons thing, toggling each led in sequence forever...
|
||||
*/
|
||||
int
|
||||
zylons()
|
||||
{
|
||||
while (1) {
|
||||
strobe();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* strobe -- toggle each led in sequence up and back once.
|
||||
*/
|
||||
int
|
||||
strobe()
|
||||
{
|
||||
static unsigned char curled = 1;
|
||||
static unsigned char dir = 0;
|
||||
|
||||
curled = 1;
|
||||
dir = 0;
|
||||
while (curled != 0) {
|
||||
led_putnum (curled);
|
||||
delay (70000);
|
||||
if (dir)
|
||||
curled >>= 1;
|
||||
else
|
||||
curled <<= 1;
|
||||
|
||||
if (curled == 128) {
|
||||
dir = ~dir;
|
||||
}
|
||||
}
|
||||
curled = 1;
|
||||
dir = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* iodc_io_call -- this makes a call into the IODC routine
|
||||
*/
|
||||
int
|
||||
iodc_io_call(ep_address,arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11)
|
||||
int ep_address, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11;
|
||||
{
|
||||
int (*iodc_entry_point)();
|
||||
|
||||
iodc_entry_point = (int (*)())ep_address;
|
||||
|
||||
return ((*iodc_entry_point)(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11));
|
||||
}
|
||||
|
||||
/*
|
||||
* pdc_call -- this makes a call into the PDC routine
|
||||
*/
|
||||
int
|
||||
pdc_call(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11)
|
||||
int arg0, arg1, arg2, arg3, arg4, arg5;
|
||||
int arg6, arg7, arg9, arg10, arg11;
|
||||
{
|
||||
return ( CALL_PDC(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11));
|
||||
}
|
||||
|
||||
/*
|
||||
* put_led -- put a bit pattern on the LED's.
|
||||
*/
|
||||
int
|
||||
led_putnum (byte)
|
||||
unsigned short byte;
|
||||
{
|
||||
return (pdc_call(OPT_PDC_CHASSIS,0,byte));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* outbyte -- shove a byte out the serial port
|
||||
*/
|
||||
int
|
||||
outbyte(byte)
|
||||
unsigned char byte;
|
||||
{
|
||||
int status;
|
||||
int R_addr[32];
|
||||
struct _dev *console = (struct _dev *)PGZ_CONSOLE_STRUCT;
|
||||
|
||||
status = iodc_io_call(console->iodc_io, console->hpa, IO_CONSOLE_OUTPUT, console->spa,
|
||||
console->layer[0], R_addr, 0, &byte, 1, 0);
|
||||
|
||||
switch(status)
|
||||
{
|
||||
case 0: return(1);
|
||||
default: return (-1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* inbyte -- get a byte from the serial port
|
||||
*/
|
||||
unsigned char
|
||||
inbyte()
|
||||
{
|
||||
int status;
|
||||
int R_addr[32];
|
||||
char inbuf;
|
||||
struct _dev *console = (struct _dev *)PGZ_CONSOLE_STRUCT;
|
||||
|
||||
while (status == 0) {
|
||||
status = iodc_io_call(console->iodc_io, console->hpa, IO_CONSOLE_INPUT, console->spa,
|
||||
console->layer[0], R_addr, 0, &inbuf, 1, 0);
|
||||
|
||||
switch (status) {
|
||||
case 0:
|
||||
case 2: /* recoverable error */
|
||||
if (R_addr[0] != 0) { /* found a character */
|
||||
return(inbuf);
|
||||
}
|
||||
else
|
||||
break; /* error, no character */
|
||||
default: /* error, no character */
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* read -- read bytes from the serial port. Ignore fd, since
|
||||
* we only have stdin.
|
||||
*/
|
||||
int
|
||||
read(fd, buf, nbytes)
|
||||
int fd;
|
||||
char *buf;
|
||||
int nbytes;
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
for (i = 0; i < nbytes; i++) {
|
||||
*(buf + i) = inbyte();
|
||||
if ((*(buf + i) == '\n') || (*(buf + i) == '\r')) {
|
||||
(*(buf + i)) = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return (i);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
write(fd, buf, nbytes)
|
||||
int fd;
|
||||
char *buf;
|
||||
int nbytes;
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nbytes; i++) {
|
||||
if (*(buf + i) == '\n') {
|
||||
outbyte ('\r');
|
||||
}
|
||||
outbyte (*(buf + i));
|
||||
}
|
||||
return (nbytes);
|
||||
}
|
||||
|
||||
/*
|
||||
* open -- open a file descriptor. We don't have a filesystem, so
|
||||
* we return an error.
|
||||
*/
|
||||
int
|
||||
open(buf, flags, mode)
|
||||
char *buf;
|
||||
int flags;
|
||||
int mode;
|
||||
{
|
||||
errno = EIO;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/*
|
||||
* close -- close a file descriptor. We don't need
|
||||
* to do anything, but pretend we did.
|
||||
*/
|
||||
int
|
||||
close(fd)
|
||||
int fd;
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* sbrk -- changes heap size size. Get nbytes more
|
||||
* RAM. We just increment a pointer in what's
|
||||
* left of memory on the board.
|
||||
*/
|
||||
char *
|
||||
sbrk(nbytes)
|
||||
int nbytes;
|
||||
{
|
||||
static char * heap_ptr = NULL;
|
||||
char * base;
|
||||
|
||||
if (heap_ptr == NULL) {
|
||||
heap_ptr = (char *)&_end;
|
||||
}
|
||||
|
||||
if ((RAMSIZE - heap_ptr) >= 0) {
|
||||
base = heap_ptr;
|
||||
heap_ptr += nbytes;
|
||||
return (heap_ptr);
|
||||
} else {
|
||||
errno = ENOMEM;
|
||||
return ((char *)-1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* isatty -- returns 1 if connected to a terminal device,
|
||||
* returns 0 if not. Since we're hooked up to a
|
||||
* serial port, we'll say yes return a 1.
|
||||
*/
|
||||
int
|
||||
isatty(fd)
|
||||
int fd;
|
||||
{
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* lseek -- move read/write pointer. Since a serial port
|
||||
* is non-seekable, we return an error.
|
||||
*/
|
||||
off_t
|
||||
lseek(fd, offset, whence)
|
||||
int fd;
|
||||
off_t offset;
|
||||
int whence;
|
||||
{
|
||||
errno = ESPIPE;
|
||||
return ((off_t)-1);
|
||||
}
|
||||
|
||||
/*
|
||||
* fstat -- get status of a file. Since we have no file
|
||||
* system, we just return an error.
|
||||
*/
|
||||
int
|
||||
fstat(fd, buf)
|
||||
int fd;
|
||||
struct stat *buf;
|
||||
{
|
||||
errno = EIO;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/*
|
||||
* getpid -- only one process, so just return 1.
|
||||
*/
|
||||
#define __MYPID 1
|
||||
int
|
||||
getpid()
|
||||
{
|
||||
return __MYPID;
|
||||
}
|
||||
|
||||
/*
|
||||
* kill -- assume mvme.S, and go out via exit...
|
||||
*/
|
||||
int
|
||||
kill(pid, sig)
|
||||
int pid;
|
||||
int sig;
|
||||
{
|
||||
if(pid == __MYPID)
|
||||
_exit(sig);
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,164 @@
|
|||
/****************************************************************************
|
||||
|
||||
THIS SOFTWARE IS NOT COPYRIGHTED
|
||||
|
||||
HP offers the following for use in the public domain. HP makes no
|
||||
warranty with regard to the software or it's performance and the
|
||||
user accepts the software "AS IS" with all faults.
|
||||
|
||||
HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD
|
||||
TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
/* Interrupt Vector Table entry macros */
|
||||
|
||||
#define cstring(Len,String) .byte Len !\
|
||||
.string String
|
||||
|
||||
#define cstringz(Len,String) .byte Len !\
|
||||
.stringz String
|
||||
|
||||
AdvancePCOQ .macro
|
||||
mtctl %r0,%pcoq ; throw away iiaoq head pointer, tail->head
|
||||
mfctl %pcoq,%r1 ; get tail pointer
|
||||
mtctl %r1,%pcoq ; insert tail pointer
|
||||
ldo 4(%r1),%r1 ; advance tail pointer
|
||||
mtctl %r1,%pcoq ; insert new tail pointer, former tail->head
|
||||
.endm
|
||||
|
||||
#ifdef PRINTSTRING_LED
|
||||
PrintString .macro NString,Num
|
||||
bl put_led,%mrp
|
||||
ldi Num+0xa0,%arg2
|
||||
addil L%NString-$global$,%dp
|
||||
bl puts,%rp
|
||||
ldo R%NString-$global$(%r1),%arg0
|
||||
b,n .
|
||||
nop
|
||||
.endm
|
||||
#endif
|
||||
|
||||
#ifdef HALT
|
||||
|
||||
PrintString .macro NString,Num
|
||||
bl,n save_state,%r25
|
||||
nop
|
||||
bl print_intr,%rp
|
||||
ldi NString-Str01,%arg0
|
||||
bl print_state,%rp
|
||||
nop
|
||||
b,n halt
|
||||
nop
|
||||
.endm
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef RECOVER
|
||||
|
||||
PrintString .macro NString,Num
|
||||
bl,n save_state,%r25
|
||||
nop
|
||||
bl print_intr,%rp
|
||||
ldi NString-Str01,%arg0
|
||||
bl print_state,%rp
|
||||
nop
|
||||
b,n recover
|
||||
nop
|
||||
.endm
|
||||
|
||||
#endif
|
||||
|
||||
PrintString .macro NString,Num
|
||||
bl,n save_state,%r25
|
||||
nop
|
||||
bl print_intr,%rp
|
||||
ldi NString-Str01,%arg0
|
||||
#ifdef FULL_REPORT
|
||||
bl print_state,%rp
|
||||
#else
|
||||
nop
|
||||
#endif
|
||||
nop
|
||||
b restore_to_STUB
|
||||
ldi Num,%r1
|
||||
.endm
|
||||
|
||||
|
||||
/* IVA register array offets */
|
||||
|
||||
#define R_sr0 0
|
||||
#define R_sr1 4
|
||||
#define R_sr2 8
|
||||
#define R_sr3 12
|
||||
#define R_sr4 16
|
||||
#define R_sr5 20
|
||||
#define R_sr6 24
|
||||
#define R_sr7 28
|
||||
|
||||
#define R_gr0 32
|
||||
#define R_gr1 36
|
||||
#define R_gr2 40
|
||||
#define R_gr3 44
|
||||
#define R_gr4 48
|
||||
#define R_gr5 52
|
||||
#define R_gr6 56
|
||||
#define R_gr7 60
|
||||
#define R_gr8 64
|
||||
#define R_gr9 68
|
||||
#define R_gr10 72
|
||||
#define R_gr11 76
|
||||
#define R_gr12 80
|
||||
#define R_gr13 84
|
||||
#define R_gr14 88
|
||||
#define R_gr15 92
|
||||
#define R_gr16 96
|
||||
#define R_gr17 100
|
||||
#define R_gr18 104
|
||||
#define R_gr19 108
|
||||
#define R_gr20 112
|
||||
#define R_gr21 116
|
||||
#define R_gr22 120
|
||||
#define R_gr23 124
|
||||
#define R_gr24 128
|
||||
#define R_gr25 132
|
||||
#define R_gr26 136
|
||||
#define R_gr27 140
|
||||
#define R_gr28 144
|
||||
#define R_gr29 148
|
||||
#define R_gr30 152
|
||||
#define R_gr31 156
|
||||
|
||||
#define R_rctr 160
|
||||
#define R_cpu0 164
|
||||
#define R_pidr1 168
|
||||
#define R_pidr2 172
|
||||
#define R_ccr 176
|
||||
#define R_sar 180
|
||||
#define R_pidr3 184
|
||||
#define R_pidr4 188
|
||||
#define R_iva 192
|
||||
#define R_eiem 196
|
||||
|
||||
#define R_itmr 200
|
||||
#define R_pcsqH 204
|
||||
#define R_pcoqH 208
|
||||
#define R_iir 212
|
||||
#define R_pcsqT 216
|
||||
#define R_pcoqT 220
|
||||
#define R_isr 224
|
||||
#define R_ior 228
|
||||
#define R_ipsw 232
|
||||
#define R_eirr 236
|
||||
|
||||
#define R_tr0 240
|
||||
#define R_tr1 244
|
||||
#define R_tr2 248
|
||||
#define R_tr3 252
|
||||
#define R_tr4 256
|
||||
#define R_tr5 260
|
||||
#define R_tr6 264
|
||||
#define R_tr7 268
|
||||
|
||||
#define R_SIZE 272
|
|
@ -0,0 +1,996 @@
|
|||
/****************************************************************************
|
||||
|
||||
THIS SOFTWARE IS NOT COPYRIGHTED
|
||||
|
||||
HP offers the following for use in the public domain. HP makes no
|
||||
warranty with regard to the software or it's performance and the
|
||||
user accepts the software "AS IS" with all faults.
|
||||
|
||||
HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD
|
||||
TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
.space $TEXT$
|
||||
.subspa $CODE$,access=0x2c
|
||||
|
||||
#include "diagnose.h"
|
||||
#if 0
|
||||
#include "iva_table.h"
|
||||
#endif
|
||||
|
||||
R_gr0 .equ 0
|
||||
R_gr1 .equ 4
|
||||
R_gr2 .equ 8
|
||||
R_gr3 .equ 12
|
||||
R_gr4 .equ 16
|
||||
R_gr5 .equ 20
|
||||
R_gr6 .equ 24
|
||||
R_gr7 .equ 28
|
||||
R_gr8 .equ 32
|
||||
R_gr9 .equ 36
|
||||
R_gr10 .equ 40
|
||||
R_gr11 .equ 44
|
||||
R_gr12 .equ 48
|
||||
R_gr13 .equ 52
|
||||
R_gr14 .equ 56
|
||||
R_gr15 .equ 60
|
||||
R_gr16 .equ 64
|
||||
R_gr17 .equ 68
|
||||
R_gr18 .equ 72
|
||||
R_gr19 .equ 76
|
||||
R_gr20 .equ 80
|
||||
R_gr21 .equ 84
|
||||
R_gr22 .equ 88
|
||||
R_gr23 .equ 92
|
||||
R_gr24 .equ 96
|
||||
R_gr25 .equ 100
|
||||
R_gr26 .equ 104
|
||||
R_gr27 .equ 108
|
||||
R_gr28 .equ 112
|
||||
R_gr29 .equ 116
|
||||
R_gr30 .equ 120
|
||||
R_gr31 .equ 124
|
||||
R_rctr .equ 160
|
||||
R_cpu0 .equ 164
|
||||
R_pidr1 .equ 168
|
||||
R_pidr2 .equ 172
|
||||
R_ccr .equ 176
|
||||
R_sar .equ 180
|
||||
R_pidr3 .equ 184
|
||||
R_pidr4 .equ 188
|
||||
R_iva .equ 192
|
||||
R_eiem .equ 196
|
||||
|
||||
R_itmr .equ 200
|
||||
R_pcsqH .equ 204
|
||||
R_pcoqH .equ 208
|
||||
R_iir .equ 212
|
||||
R_pcsqT .equ 216
|
||||
R_pcoqT .equ 220
|
||||
R_isr .equ 224
|
||||
R_ior .equ 228
|
||||
R_ipsw .equ 232
|
||||
R_eirr .equ 236
|
||||
R_tr0 .equ 240
|
||||
R_tr1 .equ 244
|
||||
R_tr2 .equ 248
|
||||
R_tr3 .equ 252
|
||||
R_tr4 .equ 256
|
||||
R_tr5 .equ 260
|
||||
R_tr6 .equ 264
|
||||
R_tr7 .equ 268
|
||||
|
||||
R_SIZE .equ 300
|
||||
|
||||
.import putc,code
|
||||
.import puts,code
|
||||
.import putnum,code
|
||||
.import put_led,code
|
||||
.import save_regs,code
|
||||
.import STUB_RESTORE,code
|
||||
.import RegBlk,data
|
||||
.export iva_table,data
|
||||
.IMPORT led_putnum,code
|
||||
.IMPORT delay,code
|
||||
.IMPORT putnum,code
|
||||
.IMPORT outbyte,code
|
||||
.IMPORT print,code
|
||||
|
||||
.align 2048
|
||||
iva_table
|
||||
.blockz 32 ; entry 0 is reserved
|
||||
|
||||
.align 32
|
||||
hpmc
|
||||
nop
|
||||
b,n hpmc_handler
|
||||
nop
|
||||
.word 0
|
||||
.word 0
|
||||
.word 0
|
||||
.word hpmc_handler
|
||||
.word 0
|
||||
|
||||
.align 32
|
||||
power_fail
|
||||
; PrintString Str02,0x2
|
||||
ldi 1,%r26
|
||||
bl,n putnum,%r2
|
||||
nop
|
||||
|
||||
.align 32
|
||||
recovery
|
||||
;; PrintString Str03,0x3
|
||||
ldi 2,%r26
|
||||
bl,n putnum,%r2
|
||||
nop
|
||||
ldi 3,%r1
|
||||
b,n handle_rcc
|
||||
nop
|
||||
|
||||
.align 32
|
||||
external
|
||||
; PrintString Str04,0x4
|
||||
ldi 3,%r26
|
||||
bl,n putnum,%r2
|
||||
nop
|
||||
|
||||
.align 32
|
||||
lpmc
|
||||
; PrintString Str05,0x5
|
||||
ldi 4,%r26
|
||||
bl,n putnum,%r2
|
||||
nop
|
||||
|
||||
.align 32
|
||||
itlb_miss
|
||||
; PrintString Str06,0x6
|
||||
ldi 5,%r26
|
||||
bl,n putnum,%r2
|
||||
nop
|
||||
|
||||
.align 32
|
||||
imem_protection
|
||||
; PrintString Str07,0x7
|
||||
ldi 6,%r26
|
||||
bl,n putnum,%r2
|
||||
nop
|
||||
|
||||
.align 32
|
||||
illegal_inst
|
||||
; PrintString Str08,0x8
|
||||
ldi 7,%r26
|
||||
bl,n putnum,%r2
|
||||
nop
|
||||
|
||||
.align 32
|
||||
break
|
||||
b,n break_handler
|
||||
nop
|
||||
|
||||
.align 32
|
||||
privileged_op
|
||||
; PrintString Str0a,0xa
|
||||
ldi 8,%r26
|
||||
bl,n putnum,%r2
|
||||
nop
|
||||
|
||||
.align 32
|
||||
privileged_reg
|
||||
; PrintString Str0b,0xb
|
||||
ldi 9,%r26
|
||||
bl,n putnum,%r2
|
||||
nop
|
||||
|
||||
.align 32
|
||||
overflow
|
||||
; PrintString Str0c,0xc
|
||||
ldi 32,%r26
|
||||
bl,n putnum,%r2
|
||||
nop
|
||||
|
||||
.align 32
|
||||
conditional
|
||||
; PrintString Str0d,0xd
|
||||
ldi 32,%r26
|
||||
bl,n putnum,%r2
|
||||
nop
|
||||
|
||||
.align 32
|
||||
assist_excep
|
||||
; PrintString Str0e,0xe
|
||||
ldi 32,%r26
|
||||
bl,n putnum,%r2
|
||||
nop
|
||||
|
||||
.align 32
|
||||
dtlb_miss
|
||||
; PrintString Str0f,0xf
|
||||
ldi 32,%r26
|
||||
bl,n putnum,%r2
|
||||
nop
|
||||
|
||||
.align 32
|
||||
na_itlb
|
||||
; PrintString Str10,0x10
|
||||
ldi 32,%r26
|
||||
bl,n putnum,%r2
|
||||
nop
|
||||
|
||||
.align 32
|
||||
na_dtlb
|
||||
; PrintString Str11,0x11
|
||||
ldi 32,%r26
|
||||
bl,n putnum,%r2
|
||||
nop
|
||||
|
||||
.align 32
|
||||
dmem_protection
|
||||
; PrintString Str12,0x12
|
||||
ldi 32,%r26
|
||||
bl,n putnum,%r2
|
||||
nop
|
||||
|
||||
.align 32
|
||||
dmem_break
|
||||
; PrintString Str13,0x13
|
||||
ldi 32,%r26
|
||||
bl,n putnum,%r2
|
||||
nop
|
||||
|
||||
.align 32
|
||||
tlb_dirty
|
||||
; PrintString Str14,0x14
|
||||
ldi 32,%r26
|
||||
bl,n putnum,%r2
|
||||
nop
|
||||
|
||||
.align 32
|
||||
page_ref
|
||||
; PrintString Str15,0x15
|
||||
ldi 32,%r26
|
||||
bl,n putnum,%r2
|
||||
nop
|
||||
|
||||
.align 32
|
||||
assist_emul
|
||||
; PrintString Str16,0x16
|
||||
ldi 32,%r26
|
||||
bl,n putnum,%r2
|
||||
nop
|
||||
|
||||
.align 32
|
||||
high_priv
|
||||
; PrintString Str17,0x17
|
||||
ldi 32,%r26
|
||||
bl,n putnum,%r2
|
||||
nop
|
||||
|
||||
.align 32
|
||||
low_priv
|
||||
; PrintString Str18,0x18
|
||||
ldi 32,%r26
|
||||
bl,n putnum,%r2
|
||||
nop
|
||||
|
||||
.align 32
|
||||
branch_taken
|
||||
; PrintString Str19,0x19
|
||||
ldi 32,%r26
|
||||
bl,n putnum,%r2
|
||||
nop
|
||||
|
||||
/*
|
||||
* foobar -- debug procedure calling between C and assembler
|
||||
*/
|
||||
.EXPORT foobar,ENTRY,ARGW0=GR,RTNVAL=GR
|
||||
foobar
|
||||
.PROC
|
||||
.CALLINFO CALLER,FRAME=128,SAVE_RP
|
||||
.ENTRY
|
||||
|
||||
stw %r2,-20(0,%r30) ; stash the return pointer
|
||||
ldo 128(%r30),%r30 ; push up the stack pointer
|
||||
|
||||
ldi 8, %r26
|
||||
bl,n led_putnum,%r2
|
||||
nop
|
||||
ldil L'900000,%r26
|
||||
ldo R'900000(%r26),%r26
|
||||
bl,n delay,%r2
|
||||
nop
|
||||
ldi 8, %r26
|
||||
bl,n led_putnum,%r2
|
||||
nop
|
||||
ldil L'900000,%r26
|
||||
ldo R'900000(%r26),%r26
|
||||
bl,n delay,%r2
|
||||
nop
|
||||
;; copy %r26,%r26
|
||||
;; bl,n putnum,%r2
|
||||
nop
|
||||
|
||||
ldw -148(0,%r30),%r2 ; retrieve the return pointer
|
||||
ldo -128(%r30),%r30 ; reset the stack pointer
|
||||
bv,n 0(%r2)
|
||||
nop
|
||||
|
||||
.EXIT
|
||||
.PROCEND
|
||||
|
||||
/*
|
||||
* setup_vectors -- add vectors for GDB to the vector table.
|
||||
* %r3 - current vector table
|
||||
* %r4 - new vector table
|
||||
*/
|
||||
.EXPORT setup_vectors,ENTRY,ARGW0=GR,RTNVAL=GR
|
||||
setup_vectors
|
||||
.PROC
|
||||
.CALLINFO CALLER,FRAME=128,SAVE_RP
|
||||
.ENTRY
|
||||
stw %r2,-20(0,%r30) ; stash the return pointer
|
||||
ldo 128(%r30),%r30 ; push up the stack pointer
|
||||
|
||||
mfctl %iva,%r3
|
||||
|
||||
ldil L%iva_table,%r4 ; Get the new vector table
|
||||
ldo R%iva_table(%r4),%r4 ; address
|
||||
|
||||
ldil L%break_handler,%r5 ; Get the breakpoint
|
||||
ldo R%break_handler(%r5),%r5 ; handler vector
|
||||
|
||||
ldil L%break_default,%r6 ; Get the default handler
|
||||
ldo R%break_default(%r6),%r6 ; vector
|
||||
|
||||
stw %r6,4(%r4) ; ad the default vector
|
||||
stw %r5,36(%r4) ; add the break vector
|
||||
|
||||
mtctl %r4,%iva
|
||||
|
||||
ldw -148(0,%r30),%r2 ; retrieve the return pointer
|
||||
ldo -128(%r30),%r30 ; reset the stack pointer
|
||||
bv,n 0(%r2)
|
||||
nop
|
||||
|
||||
.EXIT
|
||||
.PROCEND
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
hpmc_handler
|
||||
bl,n save_state,%r25
|
||||
nop
|
||||
bl print_intr,%rp
|
||||
ldi Str01-Str01,%arg0
|
||||
bl print_state,%rp
|
||||
nop
|
||||
ldil L%0xf0000000,%r1
|
||||
ldw (%r1),%r1 ; read from ROM to reset HPMC
|
||||
|
||||
mfcpu_c 0,%r1
|
||||
mfcpu_c 0,%r1
|
||||
depi 0,CPU_DIAG_0_PREV_HPMC_PREP_BIT,1,%r1 ; clear Prev HPMC bit
|
||||
|
||||
#ifdef PCXL
|
||||
depi 0,CPU_DIAG_0_L2DHPMC_BIT,1,%r1
|
||||
depi 0,CPU_DIAG_0_L2IHPMC_BIT,1,%r1
|
||||
depi 0,CPU_DIAG_0_L1IHPMC_BIT,1,%r1
|
||||
depi 0,CPU_DIAG_0_L2PARERR_BIT,4,%r1
|
||||
#else /* PCXT */
|
||||
depi 0,CPU_DIAG_0_DHPMC_BIT,1,%r1 ; don't clear DHPMC
|
||||
depi 0,CPU_DIAG_0_ILPMC_BIT,1,%r1 ; don't clear ILPMC
|
||||
depi 0,CPU_DIAG_0_HTOC_BIT,1,%r1 ; don't clear HTOC
|
||||
#endif
|
||||
|
||||
mtcpu %r1,0
|
||||
mtcpu %r1,0
|
||||
|
||||
b,n restore_to_STUB
|
||||
ldi 0x1,%r1
|
||||
|
||||
/*
|
||||
* break_handler -- this is the main entry point for an exception
|
||||
*/
|
||||
.ALIGN 2048
|
||||
break_handler
|
||||
|
||||
mfctl %iir,%r1 ; r1 = break instruction
|
||||
extru %r1,18,13,%r8
|
||||
ldo -i13BREAK(%r8),%r8 ; if im13 field doesn't match
|
||||
comb,<>,n %r8,%r0,break_default ; go to default operation
|
||||
extru %r1,31,5,%r8
|
||||
ldi 0x9,%r1 ; set exception index
|
||||
comib,=,n i5BP,%r8,break_breakpoint
|
||||
comib,=,n i5PSW,%r8,break_psw
|
||||
comib,=,n i5REG,%r8,break_reg_init
|
||||
comib,=,n i5INLINE,%r8,break_breakpoint
|
||||
; fall through to break_default
|
||||
|
||||
break_default
|
||||
; PrintString Str09,0x9
|
||||
ldi 32,%r26
|
||||
bl,n putnum,%r2
|
||||
nop
|
||||
|
||||
break_reg_init
|
||||
bl setup_vectors,%r25
|
||||
nop
|
||||
bl save_regs,%r25
|
||||
nop
|
||||
; fall through to advance past break instruction
|
||||
|
||||
break_psw
|
||||
b,n recover
|
||||
|
||||
break_breakpoint
|
||||
b,n STUB_RESTORE
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
|
||||
handle_rcc
|
||||
mfctl %ipsw,%r1
|
||||
bb,>=,n %r1,10,do_restore ; check nullify bit
|
||||
dep %r0,10,1,%r1
|
||||
mtctl %r1,%ipsw ; clear nullify bit
|
||||
|
||||
;; was the AdvancePCOQ .macro
|
||||
mtctl %r0,%pcoq ; throw away iiaoq head pointer, tail->head
|
||||
mfctl %pcoq,%r1 ; get tail pointer
|
||||
mtctl %r1,%pcoq ; insert tail pointer
|
||||
ldo 4(%r1),%r1 ; advance tail pointer
|
||||
mtctl %r1,%pcoq ; insert new tail pointer, former tail->head
|
||||
|
||||
do_restore
|
||||
b,n STUB_RESTORE
|
||||
nop
|
||||
;-------------------------------------------------------------------------------
|
||||
|
||||
print_intr
|
||||
; %dp may be messed up, so do self-relocating to reach Save_area
|
||||
blr %r0,%r1
|
||||
addil L%Str01-pr_intr_0,%r1
|
||||
|
||||
pr_intr_0
|
||||
ldo R%Str01-pr_intr_0(%r1),%r1 ; r1 points to Save_area
|
||||
b puts ; print string--return through rp
|
||||
add %r1,%arg0,%arg0
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
|
||||
halt
|
||||
; %dp may be messed up, so do self-relocating to reach Save_area
|
||||
blr %r0,%r1
|
||||
addil L%HaltStr-halt_0,%r1
|
||||
|
||||
halt_0
|
||||
bl puts,%rp ; print halt message
|
||||
ldo R%HaltStr-halt_0(%r1),%arg0
|
||||
|
||||
nop
|
||||
b,n . ; loop forever
|
||||
nop
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
|
||||
recover
|
||||
;; was the AdvancePCOQ .macro
|
||||
mtctl %r0,%pcoq ; throw away iiaoq head pointer, tail->head
|
||||
mfctl %pcoq,%r1 ; get tail pointer
|
||||
mtctl %r1,%pcoq ; insert tail pointer
|
||||
ldo 4(%r1),%r1 ; advance tail pointer
|
||||
mtctl %r1,%pcoq ; insert new tail pointer, former tail->head
|
||||
|
||||
rfir
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
|
||||
save_state ; %r25 is return pointer
|
||||
; %dp may be messed up, so do self-relocating to reach Save_area
|
||||
blr %r0,%r1
|
||||
addil L%Save_area-sa_st_0,%r1
|
||||
|
||||
sa_st_0
|
||||
ldo R%Save_area-sa_st_0(%r1),%r1 ; r1 points to Save_area
|
||||
|
||||
; save general registers
|
||||
stw %r0,R_gr0(%r1)
|
||||
; don't save %r1 until restored
|
||||
stw %r2,R_gr2(%r1)
|
||||
stw %r3,R_gr3(%r1)
|
||||
stw %r4,R_gr4(%r1)
|
||||
stw %r5,R_gr5(%r1)
|
||||
stw %r6,R_gr6(%r1)
|
||||
stw %r7,R_gr7(%r1)
|
||||
; don't save %r8, %r9 until restored
|
||||
stw %r10,R_gr10(%r1)
|
||||
stw %r11,R_gr11(%r1)
|
||||
stw %r12,R_gr12(%r1)
|
||||
stw %r13,R_gr13(%r1)
|
||||
stw %r14,R_gr14(%r1)
|
||||
stw %r15,R_gr15(%r1)
|
||||
; don't save %r16, %r17 until restored
|
||||
stw %r18,R_gr18(%r1)
|
||||
stw %r19,R_gr19(%r1)
|
||||
stw %r20,R_gr20(%r1)
|
||||
stw %r21,R_gr21(%r1)
|
||||
stw %r22,R_gr22(%r1)
|
||||
stw %r23,R_gr23(%r1)
|
||||
; don't save %r24, %r25 until restored
|
||||
stw %r26,R_gr26(%r1)
|
||||
stw %r27,R_gr27(%r1)
|
||||
stw %r28,R_gr28(%r1)
|
||||
stw %r29,R_gr29(%r1)
|
||||
copy %r25,%rp ; copy return pointer to %rp
|
||||
stw %r30,R_gr30(%r1)
|
||||
copy %r1,%r19 ; save Save_area pointer in %r19
|
||||
stw %r31,R_gr31(%r1)
|
||||
shdw_gr ; restore %r1 and %r25 (et al.) from shadow regs
|
||||
shdw_gr
|
||||
stw %r1,R_gr1(%r19) ; save %r1
|
||||
stw %r8,R_gr8(%r19)
|
||||
stw %r9,R_gr9(%r19)
|
||||
stw %r16,R_gr16(%r19)
|
||||
stw %r17,R_gr17(%r19)
|
||||
stw %r24,R_gr24(%r19)
|
||||
|
||||
; save control registers
|
||||
mfctl %rctr,%r1
|
||||
stw %r1,R_rctr(%r19)
|
||||
mfctl %pidr1,%r1
|
||||
stw %r1,R_pidr1(%r19)
|
||||
mfctl %pidr2,%r1
|
||||
stw %r1,R_pidr2(%r19)
|
||||
mfctl %ccr,%r1
|
||||
stw %r1,R_ccr(%r19)
|
||||
mfctl %sar,%r1
|
||||
stw %r1,R_sar(%r19)
|
||||
mfctl %pidr3,%r1
|
||||
stw %r1,R_pidr3(%r19)
|
||||
mfctl %pidr4,%r1
|
||||
stw %r1,R_pidr4(%r19)
|
||||
mfctl %iva,%r1
|
||||
stw %r1,R_iva(%r19)
|
||||
mfctl %eiem,%r1
|
||||
stw %r1,R_eiem(%r19)
|
||||
mfctl %itmr,%r1
|
||||
stw %r1,R_itmr(%r19)
|
||||
mfctl %pcsq,%r1
|
||||
mtctl %r1,%pcsq
|
||||
stw %r1,R_pcsqH(%r19)
|
||||
mfctl %pcsq,%r1
|
||||
mtctl %r1,%pcsq
|
||||
stw %r1,R_pcsqT(%r19)
|
||||
mfctl %pcoq,%r1
|
||||
mtctl %r1,%pcoq
|
||||
stw %r1,R_pcoqH(%r19)
|
||||
mfctl %pcoq,%r1
|
||||
mtctl %r1,%pcoq
|
||||
stw %r1,R_pcoqT(%r19)
|
||||
mfctl %iir,%r1
|
||||
stw %r1,R_iir(%r19)
|
||||
mfctl %isr,%r1
|
||||
stw %r1,R_isr(%r19)
|
||||
mfctl %ior,%r1
|
||||
stw %r1,R_ior(%r19)
|
||||
mfctl %ipsw,%r1
|
||||
stw %r1,R_ipsw(%r19)
|
||||
mfctl %eirr,%r1
|
||||
stw %r1,R_eirr(%r19)
|
||||
mfctl %tr0,%r1
|
||||
stw %r1,R_tr0(%r19)
|
||||
mfctl %tr1,%r1
|
||||
stw %r1,R_tr1(%r19)
|
||||
mfctl %tr2,%r1
|
||||
stw %r1,R_tr2(%r19)
|
||||
mfctl %tr3,%r1
|
||||
stw %r1,R_tr3(%r19)
|
||||
mfctl %tr4,%r1
|
||||
stw %r1,R_tr4(%r19)
|
||||
mfctl %tr5,%r1
|
||||
stw %r1,R_tr5(%r19)
|
||||
mfctl %tr6,%r1
|
||||
stw %r1,R_tr6(%r19)
|
||||
mfctl %tr7,%r1
|
||||
stw %r1,R_tr7(%r19)
|
||||
|
||||
; save diagnose registers
|
||||
mfcpu_c 0,%r1
|
||||
mfcpu_c 0,%r1
|
||||
stw %r1,R_cpu0(%r19)
|
||||
|
||||
#ifdef PRINT_SPACE
|
||||
stw %r25,R_gr25(%r19)
|
||||
|
||||
; save space registers
|
||||
mfsp %sr0,%r1
|
||||
stw %r1,R_sr0(%r19)
|
||||
mfsp %sr1,%r1
|
||||
stw %r1,R_sr1(%r19)
|
||||
mfsp %sr2,%r1
|
||||
stw %r1,R_sr2(%r19)
|
||||
mfsp %sr3,%r1
|
||||
stw %r1,R_sr3(%r19)
|
||||
mfsp %sr4,%r1
|
||||
stw %r1,R_sr4(%r19)
|
||||
mfsp %sr5,%r1
|
||||
stw %r1,R_sr5(%r19)
|
||||
mfsp %sr6,%r1
|
||||
stw %r1,R_sr6(%r19)
|
||||
mfsp %sr7,%r1
|
||||
bv (%rp)
|
||||
stw %r1,R_sr7(%r19)
|
||||
#else
|
||||
bv (%rp)
|
||||
stw %r25,R_gr25(%r19)
|
||||
#endif
|
||||
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
|
||||
restore_to_STUB ; doesn't return--goes to STUB_RESTORE
|
||||
; Note--STUB_RESTORE executes rfir,
|
||||
; so we don't need to
|
||||
copy %r1,%r8 ; save exception index
|
||||
; %dp may be messed up, so do self-relocating to reach Save_area
|
||||
bl re_st_0,%r1
|
||||
addil L%Save_area-re_st_0,%r1
|
||||
|
||||
re_st_0
|
||||
ldo R%Save_area-re_st_0(%r1),%r1 ; r1 points to Save_area
|
||||
|
||||
; restore general registers
|
||||
ldw R_gr2(%r1),%r2
|
||||
ldw R_gr3(%r1),%r3
|
||||
ldw R_gr4(%r1),%r4
|
||||
ldw R_gr5(%r1),%r5
|
||||
ldw R_gr6(%r1),%r6
|
||||
ldw R_gr7(%r1),%r7
|
||||
; ldw R_gr8(%r1),%r8 don't smash the exception index
|
||||
ldw R_gr9(%r1),%r9
|
||||
ldw R_gr10(%r1),%r10
|
||||
ldw R_gr11(%r1),%r11
|
||||
ldw R_gr12(%r1),%r12
|
||||
ldw R_gr13(%r1),%r13
|
||||
ldw R_gr14(%r1),%r14
|
||||
ldw R_gr15(%r1),%r15
|
||||
ldw R_gr16(%r1),%r16
|
||||
ldw R_gr17(%r1),%r17
|
||||
ldw R_gr18(%r1),%r18
|
||||
ldw R_gr19(%r1),%r19
|
||||
ldw R_gr20(%r1),%r20
|
||||
ldw R_gr21(%r1),%r21
|
||||
ldw R_gr22(%r1),%r22
|
||||
ldw R_gr23(%r1),%r23
|
||||
ldw R_gr24(%r1),%r24
|
||||
ldw R_gr25(%r1),%r25
|
||||
ldw R_gr26(%r1),%r26
|
||||
ldw R_gr27(%r1),%r27
|
||||
ldw R_gr28(%r1),%r28
|
||||
ldw R_gr29(%r1),%r29
|
||||
ldw R_gr30(%r1),%r30
|
||||
ldw R_gr31(%r1),%r31
|
||||
ldw R_gr1(%r1),%r1
|
||||
b STUB_RESTORE
|
||||
copy %r8,%r1 ; restore the exception index
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
|
||||
#define HoldPtr %r10
|
||||
#define SavePtr %r11
|
||||
#define StrPtr %r12
|
||||
#define Count %r13
|
||||
|
||||
#define Hold_Hold 0*4 /* First word of hold area */
|
||||
#define Hold_Save 1*4 /* Second word of hold area */
|
||||
#define Hold_Str 2*4 /* Third word of hold area */
|
||||
#define Hold_Count 3*4 /* Fourth word of hold area */
|
||||
#define Hold_rp 4*4 /* Fifth word of hold area */
|
||||
|
||||
print_state
|
||||
; %dp may be messed up, so do self-relocating to reach Save_area
|
||||
blr %r0,%mrp
|
||||
addil L%Hold_area-pr_st_0,%mrp
|
||||
|
||||
pr_st_0
|
||||
ldo R%Hold_area-pr_st_0(%r1),%r1 ; r1 points to Hold_area
|
||||
|
||||
; save working registers
|
||||
|
||||
stw HoldPtr,Hold_Hold(%r1)
|
||||
copy %r1,HoldPtr ; HoldPtr = &Hold_area
|
||||
stw SavePtr,Hold_Save(HoldPtr)
|
||||
ldo Save_area-Hold_area(HoldPtr),SavePtr ; SavePtr = &Save_area
|
||||
stw StrPtr,Hold_Str(HoldPtr)
|
||||
addil L%PrintLabels-pr_st_0,%mrp
|
||||
stw Count,Hold_Count(HoldPtr)
|
||||
ldo R%PrintLabels-pr_st_0(%r1),StrPtr
|
||||
stw %rp,Hold_rp(HoldPtr)
|
||||
|
||||
|
||||
#ifdef PRINT_SPACE
|
||||
ldi 68,Count
|
||||
#else
|
||||
ldo R_gr0(SavePtr),SavePtr
|
||||
ldi 60,Count
|
||||
#endif
|
||||
|
||||
; print register values
|
||||
|
||||
print_loop
|
||||
bl puts,%rp ; print label
|
||||
ldo 1(StrPtr),%arg0 ; advance past length byte
|
||||
bl putnum,%rp ; print register value
|
||||
ldwm 4(SavePtr),%arg0
|
||||
ldbs,ma 1(StrPtr),%r1
|
||||
addib,> -1,Count,print_loop
|
||||
add %r1,StrPtr,StrPtr
|
||||
|
||||
; skip to next line
|
||||
bl puts,%rp ; print label
|
||||
ldo 1(StrPtr),%arg0 ; advance past length byte
|
||||
|
||||
; restore working registers
|
||||
|
||||
ldw Hold_rp(HoldPtr),%rp
|
||||
ldw Hold_Count(HoldPtr),Count
|
||||
ldw Hold_Str(HoldPtr),StrPtr
|
||||
ldw Hold_Save(HoldPtr),SavePtr
|
||||
bv (%rp)
|
||||
ldw Hold_Hold(HoldPtr),HoldPtr
|
||||
|
||||
#undef SavePtr
|
||||
#undef HoldPtr
|
||||
#undef StrPtr
|
||||
#undef Count
|
||||
|
||||
#undef Hold_Save
|
||||
#undef Hold_Scr
|
||||
#undef Hold_Str
|
||||
#undef Hold_Count
|
||||
#undef Hold_rp
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
|
||||
.space $PRIVATE$
|
||||
.subspa $DATA$,align=4,access=0x1f
|
||||
|
||||
/* Used to save machine registers before printing */
|
||||
Save_area
|
||||
.block R_SIZE ; Used to store registers
|
||||
|
||||
/* Used to hold callee-save registers */
|
||||
Hold_area
|
||||
.block 8*4 ; 8 words to store temp. registers
|
||||
|
||||
HaltStr
|
||||
.stringz "\r\nHalted\r\n"
|
||||
|
||||
RebootStr
|
||||
.stringz "\r\nRebooting . . .\r\n"
|
||||
|
||||
Str01
|
||||
.stringz "\r\nHPMC\r\n"
|
||||
|
||||
Str02
|
||||
.stringz "\r\nPower Fail\r\n"
|
||||
|
||||
Str03
|
||||
.stringz "\r\nRecovery Counter Trap\r\n"
|
||||
|
||||
Str04
|
||||
.stringz "\r\nExternal Interrupt\r\n"
|
||||
|
||||
Str05
|
||||
.stringz "\r\nLPMC\r\n"
|
||||
|
||||
Str06
|
||||
.stringz "\r\nITLB Miss\r\n"
|
||||
|
||||
Str07
|
||||
.stringz "\r\nInstruction Memory Protection Trap\r\n"
|
||||
|
||||
Str08
|
||||
.stringz "\r\nIllegal Instruction\r\n"
|
||||
|
||||
Str09
|
||||
.stringz "\r\nBreak Trap\r\n"
|
||||
|
||||
Str0a
|
||||
.stringz "\r\nPrivileged Operation\r\n"
|
||||
|
||||
Str0b
|
||||
.stringz "\r\nPrivileged Register\r\n"
|
||||
|
||||
Str0c
|
||||
.stringz "\r\nOverflow Trap\r\n"
|
||||
|
||||
Str0d
|
||||
.stringz "\r\nConditional Trap\r\n"
|
||||
|
||||
Str0e
|
||||
.stringz "\r\nAssist Exception\r\n"
|
||||
|
||||
Str0f
|
||||
.stringz "\r\nData TLB Miss\r\n"
|
||||
|
||||
Str10
|
||||
.stringz "\r\nNon-access ITLB Miss\r\n"
|
||||
|
||||
Str11
|
||||
.stringz "\r\nNon-access DTLB Miss\r\n"
|
||||
|
||||
Str12
|
||||
.stringz "\r\nData Memory Protection Trap\r\n"
|
||||
|
||||
Str13
|
||||
.stringz "\r\nData Memory Break\r\n"
|
||||
|
||||
Str14
|
||||
.stringz "\r\nTLB Dirty Bit Trap\r\n"
|
||||
|
||||
Str15
|
||||
.stringz "\r\nPage Reference Trap\r\n"
|
||||
|
||||
Str16
|
||||
.stringz "\r\nAssist Emulation Trap\r\n"
|
||||
|
||||
Str17
|
||||
.stringz "\r\nHigher-privilege Trap\r\n"
|
||||
|
||||
Str18
|
||||
.stringz "\r\nLower-privilege Trap\r\n"
|
||||
|
||||
Str19
|
||||
.stringz "\r\nTaken Branch Trap\r\n"
|
||||
|
||||
Str20
|
||||
.stringz "\r\nHere I am!\r\n"
|
||||
|
||||
PrintLabels
|
||||
#ifdef PRINT_SPACE
|
||||
.byte 10
|
||||
.stringz "sr 0 = 0x"
|
||||
.byte 13
|
||||
.stringz "sr 1 = 0x"
|
||||
.byte 13
|
||||
.stringz "sr 2 = 0x"
|
||||
.byte 13
|
||||
.stringz " sr 3 = 0x"
|
||||
.byte 12
|
||||
.stringz "\r\nsr 4 = 0x"
|
||||
.byte 13
|
||||
.stringz " sr 5 = 0x"
|
||||
.byte 13
|
||||
.stringz " sr 6 = 0x"
|
||||
.byte 13
|
||||
.stringz " sr 7 = 0x"
|
||||
.byte 13
|
||||
.stringz "\r\n\ngr 0 = 0x"
|
||||
#else
|
||||
.byte 10
|
||||
.stringz "gr 0 = 0x"
|
||||
#endif
|
||||
|
||||
.byte 13
|
||||
.stringz " gr 1 = 0x"
|
||||
.byte 13
|
||||
.stringz " gr 2 = 0x"
|
||||
.byte 13
|
||||
.stringz " gr 3 = 0x"
|
||||
.byte 12
|
||||
.stringz "\r\ngr 4 = 0x"
|
||||
.byte 13
|
||||
.stringz " gr 5 = 0x"
|
||||
.byte 13
|
||||
.stringz " gr 6 = 0x"
|
||||
.byte 13
|
||||
.stringz " gr 7 = 0x"
|
||||
.byte 12
|
||||
.stringz "\r\ngr 8 = 0x"
|
||||
.byte 13
|
||||
.stringz " gr 9 = 0x"
|
||||
.byte 13
|
||||
.stringz " gr10 = 0x"
|
||||
.byte 13
|
||||
.stringz " gr11 = 0x"
|
||||
.byte 12
|
||||
.stringz "\r\ngr12 = 0x"
|
||||
.byte 13
|
||||
.stringz " gr13 = 0x"
|
||||
.byte 13
|
||||
.stringz " gr14 = 0x"
|
||||
.byte 13
|
||||
.stringz " gr15 = 0x"
|
||||
.byte 12
|
||||
.stringz "\r\ngr16 = 0x"
|
||||
.byte 13
|
||||
.stringz " gr17 = 0x"
|
||||
.byte 13
|
||||
.stringz " gr18 = 0x"
|
||||
.byte 13
|
||||
.stringz " gr19 = 0x"
|
||||
.byte 12
|
||||
.stringz "\r\ngr20 = 0x"
|
||||
.byte 13
|
||||
.stringz " gr21 = 0x"
|
||||
.byte 13
|
||||
.stringz " gr22 = 0x"
|
||||
.byte 13
|
||||
.stringz " gr23 = 0x"
|
||||
.byte 12
|
||||
.stringz "\r\ngr24 = 0x"
|
||||
.byte 13
|
||||
.stringz " gr25 = 0x"
|
||||
.byte 13
|
||||
.stringz " gr26 = 0x"
|
||||
.byte 13
|
||||
.stringz " gr27 = 0x"
|
||||
.byte 12
|
||||
.stringz "\r\ngr28 = 0x"
|
||||
.byte 13
|
||||
.stringz " gr29 = 0x"
|
||||
.byte 13
|
||||
.stringz " gr30 = 0x"
|
||||
.byte 13
|
||||
.stringz " gr31 = 0x"
|
||||
.byte 13
|
||||
.stringz "\r\n\nrctr = 0x"
|
||||
.byte 53
|
||||
.stringz " cpu0 = 0x"
|
||||
.byte 12
|
||||
.stringz "\r\npid1 = 0x"
|
||||
.byte 13
|
||||
.stringz " pid2 = 0x"
|
||||
.byte 13
|
||||
.stringz " ccr = 0x"
|
||||
.byte 13
|
||||
.stringz " sar = 0x"
|
||||
.byte 12
|
||||
.stringz "\r\npid3 = 0x"
|
||||
.byte 13
|
||||
.stringz " pid4 = 0x"
|
||||
.byte 13
|
||||
.stringz " iva = 0x"
|
||||
.byte 13
|
||||
.stringz " eiem = 0x"
|
||||
.byte 12
|
||||
.stringz "\r\nitmr = 0x"
|
||||
.byte 13
|
||||
.stringz " iasq = 0x"
|
||||
.byte 13
|
||||
.stringz " iaoq = 0x"
|
||||
.byte 13
|
||||
.stringz " iir = 0x"
|
||||
.byte 32
|
||||
.stringz "\r\n iasq = 0x"
|
||||
.byte 13
|
||||
.stringz " iaoq = 0x"
|
||||
.byte 12
|
||||
.stringz "\r\n isr = 0x"
|
||||
.byte 13
|
||||
.stringz " ior = 0x"
|
||||
.byte 13
|
||||
.stringz " ipsw = 0x"
|
||||
.byte 13
|
||||
.stringz " eirr = 0x"
|
||||
.byte 12
|
||||
.stringz "\r\ncr24 = 0x"
|
||||
.byte 13
|
||||
.stringz " cr25 = 0x"
|
||||
.byte 13
|
||||
.stringz " cr26 = 0x"
|
||||
.byte 13
|
||||
.stringz " cr27 = 0x"
|
||||
.byte 12
|
||||
.stringz "\r\ncr28 = 0x"
|
||||
.byte 13
|
||||
.stringz " cr29 = 0x"
|
||||
.byte 13
|
||||
.stringz " cr30 = 0x"
|
||||
.byte 13
|
||||
.stringz " cr31 = 0x"
|
||||
.byte 4
|
||||
.stringz "\r\n\n"
|
||||
|
||||
.end
|
|
@ -0,0 +1,698 @@
|
|||
/* -*-C-*-
|
||||
*******************************************************************************
|
||||
*
|
||||
* File: pa_stub.c
|
||||
* RCS: $Header$
|
||||
* Description: main routines for PA RISC monitor stub
|
||||
* Author: Robert Quist
|
||||
* Created: Mon Nov 1 10:00:36 1993
|
||||
* Modified: Fri Nov 12 15:14:23 1993 (Robert Quist) quist@hpfcrdq
|
||||
* Language: C
|
||||
* Package: N/A
|
||||
* Status: Experimental (Do Not Distribute)
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
THIS SOFTWARE IS NOT COPYRIGHTED
|
||||
|
||||
HP offers the following for use in the public domain. HP makes no
|
||||
warranty with regard to the software or it's performance and the
|
||||
user accepts the software "AS IS" with all faults.
|
||||
|
||||
HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD
|
||||
TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* Description: low level support for gdb debugger. $
|
||||
*
|
||||
* Considerations: only works on target hardware $
|
||||
*
|
||||
* NOTES: See Below $
|
||||
*
|
||||
* To enable debugger support, two things need to happen.
|
||||
*
|
||||
* One, a call to set_debug_traps() is necessary in order to allow
|
||||
* any breakpoints or error conditions to be properly intercepted and
|
||||
* reported to gdb.
|
||||
*
|
||||
* Two, a breakpoint needs to be generated to begin communication.
|
||||
* This is most easily accomplished by a call to breakpoint().
|
||||
* breakpoint() simulates a breakpoint
|
||||
|
||||
|
||||
*************
|
||||
*
|
||||
* The following gdb commands are supported:
|
||||
*
|
||||
* command function Return value
|
||||
*
|
||||
* g return the value of the CPU registers hex data or ENN
|
||||
* G set the value of the CPU registers OK or ENN
|
||||
*
|
||||
* mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN
|
||||
* MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN
|
||||
*
|
||||
* c Resume at current address SNN ( signal NN)
|
||||
* cAA..AA Continue at address AA..AA SNN
|
||||
*
|
||||
* s Step one instruction SNN
|
||||
* sAA..AA Step one instruction from AA..AA SNN
|
||||
*
|
||||
* k kill
|
||||
*
|
||||
* ? What was the last sigval ? SNN (signal NN)
|
||||
*
|
||||
* bBB..BB Set baud rate to BB..BB OK or BNN, then sets
|
||||
* baud rate
|
||||
*
|
||||
|
||||
************
|
||||
* All commands and responses are sent with a packet which includes a
|
||||
* checksum. A packet consists of :
|
||||
*
|
||||
* $<packet info>#<checksum>.
|
||||
*
|
||||
* where
|
||||
* <packet info> :: <characters representing the command or response>
|
||||
* <checksum> :: < two hex digits computed as modulo 256 sum of <packetinfo>>
|
||||
*
|
||||
* When a packet is received, it is first acknowledged with either '+' or '-'.
|
||||
* '+' indicates a successful transfer. '-' indicates a failed transfer.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* Host: Reply:
|
||||
* $m0,10#2a +$00010203040506070809101112131415#42
|
||||
*
|
||||
****************************************************************************/
|
||||
#include <signal.h>
|
||||
#include "hppa-defs.h"
|
||||
|
||||
/************************************************************************
|
||||
*
|
||||
* external low-level support
|
||||
*/
|
||||
#define OPT_PDC_CACHE 5
|
||||
#define OPT_PDC_ADD_VALID 12
|
||||
#define PGZ_MEM_PDC 0x0388 /* location of PDC_ENTRY in memory */
|
||||
#define CALL_PDC (*(int (*)())((int *)(*((int *)PGZ_MEM_PDC))))
|
||||
|
||||
extern putDebugChar(); /* write a single character */
|
||||
extern getDebugChar(); /* read and return a single char */
|
||||
extern FICE(); /* flush i cache entry */
|
||||
extern INLINE_BREAK(); /* break for user call */
|
||||
|
||||
#define RADDR_ALIGN(s,r) (s = ((unsigned int *) ((((int) r ) + 7 ) & 0xFFFFFFF8)))
|
||||
|
||||
/************************************************************************/
|
||||
/* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/
|
||||
/* at least NUMREGBYTES*2 are needed for register packets */
|
||||
|
||||
#define BUFMAX 2048
|
||||
|
||||
#define NUMGPRS 32
|
||||
#define NUMSRS 8
|
||||
#define NUMCRS 32
|
||||
#define NUMSPCLS 3
|
||||
#define NUMFPRS 32
|
||||
|
||||
#define NUMGPRBYTES 4
|
||||
#define NUMSRBYTES 4
|
||||
#define NUMCRBYTES 4
|
||||
#define NUMSPCLBYTES 4
|
||||
#define NUMFPRBYTES 8
|
||||
|
||||
/* Number of bytes of registers. */
|
||||
#define NUMREGBYTES \
|
||||
( (NUMGPRS * NUMGPRBYTES) \
|
||||
+ (NUMSRS * NUMSRBYTES) \
|
||||
+ (NUMCRS * NUMCRBYTES) \
|
||||
+ (NUMSPCLS * NUMSPCLBYTES) \
|
||||
+ (NUMFPRS * NUMFPRBYTES) \
|
||||
)
|
||||
|
||||
|
||||
enum regnames {GR0, GR1, GR2, GR3, GR4, GR5, GR6, GR7,
|
||||
GR8, GR9, GR10, GR11, GR12, GR13, GR14, GR15,
|
||||
GR16, GR17, GR18, GR19, GR20, GR21, GR22, GR23,
|
||||
GR24, GR25, GR26, GR27, GR28, GR29, GR30, GR31,
|
||||
|
||||
SR0, SR1, SR2, SR3, SR4, SR5, SR6, SR7,
|
||||
|
||||
CR0, CR1, CR2, CR3, CR4, CR5, CR6, CR7,
|
||||
CR8, CR9, CR10, CR11, CR12, CR13, CR14, CR15,
|
||||
CR16, CR17H,CR18H,CR19, CR20, CR21, CR22, CR23,
|
||||
CR24, CR25, CR26, CR27, CR28, CR29, CR30, CR31,
|
||||
|
||||
CR17T,CR18T,CPUD0 };
|
||||
|
||||
enum fregnames {FPR0, FPR1, FPR2, FPR3, FPR4, FPR5, FPR6, FPR7,
|
||||
FPR8, FPR9, FPR10, FPR11, FPR12, FPR13, FPR14, FPR15,
|
||||
FPR16, FPR17, FPR18, FPR19, FPR20, FPR21, FPR22, FPR23,
|
||||
FPR24, FPR25, FPR26, FPR27, FPR28, FPR29, FPR30, FPR31 };
|
||||
|
||||
#define PC CR18H
|
||||
#define NPC CR18T
|
||||
#define SP GR30
|
||||
|
||||
struct registers {
|
||||
int intregs[NUMGPRS + NUMSRS + NUMCRS + NUMSPCLS];
|
||||
int fpregs [NUMFPRS * 2];
|
||||
};
|
||||
/* Global Variables */
|
||||
|
||||
static int initialized = 0; /* !0 means we've been initialized */
|
||||
static unsigned char hexchars[]="0123456789abcdef";
|
||||
static unsigned char remcomInBuffer[BUFMAX];
|
||||
static unsigned char remcomOutBuffer[BUFMAX];
|
||||
static unsigned int i_cache_params[6];
|
||||
|
||||
/* This table contains the mapping between PA hardware exception
|
||||
types, and signals, which are primarily what GDB understands. It also
|
||||
indicates which hardware traps we need to commandeer when initializing
|
||||
the stub.
|
||||
|
||||
The only two currently used are Recovery counter (single stepping)
|
||||
and Break trap ( break points ).
|
||||
*/
|
||||
|
||||
static struct hard_trap_info
|
||||
{
|
||||
unsigned char tt; /* Trap number for PA-RISC */
|
||||
unsigned char signo; /* Signal that we map this trap into */
|
||||
} hard_trap_info[] = {
|
||||
/* 1 High priority machine check */
|
||||
/* 2 Power failure interrupt*/
|
||||
/* 3 Recovery counter -- init */
|
||||
/* 4 External interrupt */
|
||||
/* 5 Low priority machine check */
|
||||
{6, SIGSEGV}, /* Instruction TLB miss/page fault */
|
||||
{7, SIGSEGV}, /* Memory protection */
|
||||
{8, SIGILL}, /* Illegal instruction */
|
||||
{9, SIGTRAP}, /* Break instruction -- init */
|
||||
{10,SIGILL}, /* Privileged instruction */
|
||||
{11,SIGILL}, /* Privileged register */
|
||||
{12,SIGUSR1}, /* Overflow */
|
||||
{13,SIGUSR2}, /* Conditional */
|
||||
{14,SIGEMT}, /* Assist Exception */
|
||||
{15,SIGSEGV}, /* Data TLB miss/page fault */
|
||||
{16,SIGSEGV}, /* Non-access Instruction TLB miss */
|
||||
{17,SIGSEGV}, /* Non-access Data TLB miss/page fault */
|
||||
{18,SIGSEGV}, /* Data memory protection/ unaligned data reference */
|
||||
{19,SIGTRAP}, /* Data memory break */
|
||||
{20,SIGSEGV}, /* TLB dirty bit */
|
||||
{21,SIGSEGV}, /* Page reference */
|
||||
{22,SIGEMT}, /* Assist emulation */
|
||||
{23,SIGILL}, /* Higher-privilege */
|
||||
{24,SIGILL}, /* Lower-privilege */
|
||||
{25,SIGTRAP}, /* Taken branch */
|
||||
{0, 0} /* Must be last */
|
||||
};
|
||||
|
||||
/* Functions */
|
||||
/*========================================================================== */
|
||||
|
||||
/* Convert ch from a hex digit to an int */
|
||||
|
||||
static int
|
||||
hex(ch)
|
||||
unsigned char ch;
|
||||
{
|
||||
if (ch >= 'a' && ch <= 'f')
|
||||
return ch-'a'+10;
|
||||
if (ch >= '0' && ch <= '9')
|
||||
return ch-'0';
|
||||
if (ch >= 'A' && ch <= 'F')
|
||||
return ch-'A'+10;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* scan for the sequence $<data>#<checksum> */
|
||||
|
||||
static void
|
||||
getpacket(buffer)
|
||||
char *buffer;
|
||||
{
|
||||
unsigned char checksum;
|
||||
unsigned char xmitcsum;
|
||||
int i;
|
||||
int count;
|
||||
unsigned char ch;
|
||||
|
||||
do
|
||||
{
|
||||
/* wait around for the start character, ignore all other characters */
|
||||
strobe();
|
||||
while ((ch = getDebugChar()) != '$') ;
|
||||
|
||||
checksum = 0;
|
||||
xmitcsum = -1;
|
||||
|
||||
count = 0;
|
||||
|
||||
/* now, read until a # or end of buffer is found */
|
||||
while (count < BUFMAX)
|
||||
{
|
||||
ch = getDebugChar();
|
||||
if (ch == '#')
|
||||
break;
|
||||
checksum = checksum + ch;
|
||||
buffer[count] = ch;
|
||||
count = count + 1;
|
||||
}
|
||||
|
||||
if (count >= BUFMAX)
|
||||
continue;
|
||||
|
||||
buffer[count] = 0;
|
||||
|
||||
if (ch == '#')
|
||||
{
|
||||
xmitcsum = hex(getDebugChar()) << 4;
|
||||
xmitcsum |= hex(getDebugChar());
|
||||
|
||||
#if TESTING
|
||||
/* Humans shouldn't have to figure out checksums to type to it. */
|
||||
putDebugChar ('+');
|
||||
return;
|
||||
#endif
|
||||
if (checksum != xmitcsum)
|
||||
putDebugChar('-'); /* failed checksum */
|
||||
else
|
||||
{
|
||||
putDebugChar('+'); /* successful transfer */
|
||||
/* if a sequence char is present, reply the sequence ID */
|
||||
if (buffer[2] == ':')
|
||||
{
|
||||
putDebugChar(buffer[0]);
|
||||
putDebugChar(buffer[1]);
|
||||
/* remove sequence chars from buffer */
|
||||
count = strlen(buffer);
|
||||
for (i=3; i <= count; i++)
|
||||
buffer[i-3] = buffer[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while (checksum != xmitcsum);
|
||||
}
|
||||
|
||||
/* send the packet in buffer. */
|
||||
|
||||
static void
|
||||
putpacket(buffer)
|
||||
unsigned char *buffer;
|
||||
{
|
||||
unsigned char checksum;
|
||||
int count;
|
||||
unsigned char ch;
|
||||
|
||||
/* $<packet info>#<checksum>. */
|
||||
|
||||
do
|
||||
{
|
||||
putDebugChar('$');
|
||||
checksum = 0;
|
||||
count = 0;
|
||||
|
||||
while (ch = buffer[count])
|
||||
{
|
||||
if (! putDebugChar(ch))
|
||||
return;
|
||||
checksum += ch;
|
||||
count += 1;
|
||||
}
|
||||
|
||||
putDebugChar('#');
|
||||
putDebugChar(hexchars[checksum >> 4]);
|
||||
putDebugChar(hexchars[checksum & 0xf]);
|
||||
} while (getDebugChar() != '+');
|
||||
}
|
||||
|
||||
/* Convert the memory pointed to by mem into hex, placing result in buf.
|
||||
* Return a pointer to the last char put in buf (null), in case of mem fault,
|
||||
* return 0.
|
||||
* If MAY_FAULT is non-zero, then we will handle memory faults by returning
|
||||
* a 0, else treat a fault like any other fault in the stub.
|
||||
*/
|
||||
|
||||
static unsigned char *
|
||||
mem2hex(mem, buf, count, may_fault)
|
||||
unsigned char *mem;
|
||||
unsigned char *buf;
|
||||
int count;
|
||||
int may_fault;
|
||||
{
|
||||
unsigned char ch;
|
||||
int check_addr,
|
||||
new_addr;
|
||||
|
||||
check_addr = 0;
|
||||
|
||||
while (count-- > 0)
|
||||
{
|
||||
if (may_fault)
|
||||
{ new_addr = ((int) (mem+3)) & 0xFFFFFFF8;
|
||||
if (new_addr != check_addr)
|
||||
{ check_addr = new_addr;
|
||||
if (pdc_call(OPT_PDC_ADD_VALID,0,check_addr)) return 0;
|
||||
}
|
||||
}
|
||||
ch = *mem++;
|
||||
*buf++ = hexchars[ch >> 4];
|
||||
*buf++ = hexchars[ch & 0xf];
|
||||
}
|
||||
|
||||
*buf = 0;
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
/* convert the hex array pointed to by buf into binary to be placed in mem
|
||||
* return a pointer to the character AFTER the last byte written */
|
||||
|
||||
static unsigned char *
|
||||
hex2mem(buf, mem, count, may_fault)
|
||||
unsigned char *buf;
|
||||
unsigned char *mem;
|
||||
int count;
|
||||
int may_fault;
|
||||
{
|
||||
int i;
|
||||
unsigned int ch;
|
||||
int check_addr,
|
||||
new_addr;
|
||||
|
||||
check_addr = 0;
|
||||
|
||||
for (i=0; i<count; i++)
|
||||
{
|
||||
ch = hex(*buf++) << 4;
|
||||
ch |= hex(*buf++);
|
||||
if (may_fault)
|
||||
{ new_addr = ((int)(mem+3)) & 0xFFFFFFF8;
|
||||
if (new_addr != check_addr)
|
||||
{ check_addr = new_addr;
|
||||
if (pdc_call(OPT_PDC_ADD_VALID,0,check_addr)) return 0;
|
||||
}
|
||||
}
|
||||
*mem++ = ch;
|
||||
}
|
||||
|
||||
return mem;
|
||||
}
|
||||
|
||||
/* Set up exception handlers for traceing and breakpoints */
|
||||
|
||||
void
|
||||
set_debug_traps()
|
||||
{
|
||||
unsigned int R_addr[33];
|
||||
unsigned int *Raddr_ptr;
|
||||
|
||||
setup_vectors();
|
||||
|
||||
/* get cache params for use by flush_i_cache */
|
||||
RADDR_ALIGN(Raddr_ptr,R_addr);
|
||||
|
||||
if (pdc_call(OPT_PDC_CACHE,0,Raddr_ptr,0))
|
||||
i_cache_params[0] = -1;
|
||||
else
|
||||
i_cache_params[0] = R_addr[0];
|
||||
|
||||
i_cache_params[1] = Raddr_ptr[1];
|
||||
i_cache_params[2] = Raddr_ptr[2];
|
||||
i_cache_params[3] = Raddr_ptr[3];
|
||||
i_cache_params[4] = Raddr_ptr[4];
|
||||
i_cache_params[5] = Raddr_ptr[5];
|
||||
|
||||
/* In case GDB is started before us, ack any packets (presumably
|
||||
"$?#xx") sitting there. */
|
||||
|
||||
putDebugChar ('+');
|
||||
|
||||
initialized = 1;
|
||||
}
|
||||
|
||||
|
||||
/* Convert the PA-RISC hardware trap number to a unix signal number. */
|
||||
|
||||
static int
|
||||
computeSignal(tt)
|
||||
int tt;
|
||||
{
|
||||
struct hard_trap_info *ht;
|
||||
|
||||
for (ht = hard_trap_info; ht->tt && ht->signo; ht++)
|
||||
if (ht->tt == tt)
|
||||
return ht->signo;
|
||||
|
||||
return SIGHUP; /* default for things we don't know about */
|
||||
}
|
||||
|
||||
/*
|
||||
* While we find nice hex chars, build an int.
|
||||
* Return number of chars processed.
|
||||
*/
|
||||
|
||||
static int
|
||||
hexToInt(ptr, intValue)
|
||||
unsigned char **ptr;
|
||||
int *intValue;
|
||||
{
|
||||
int numChars = 0;
|
||||
int hexValue;
|
||||
|
||||
*intValue = 0;
|
||||
|
||||
while (**ptr)
|
||||
{
|
||||
hexValue = hex(**ptr);
|
||||
if (hexValue < 0)
|
||||
break;
|
||||
|
||||
*intValue = (*intValue << 4) | hexValue;
|
||||
numChars ++;
|
||||
|
||||
(*ptr)++;
|
||||
}
|
||||
|
||||
return (numChars);
|
||||
}
|
||||
|
||||
void
|
||||
flush_i_cache()
|
||||
|
||||
{
|
||||
unsigned int addr,count,loop;
|
||||
|
||||
if (i_cache_params[0] <= 0) return;
|
||||
|
||||
addr = i_cache_params[2];
|
||||
for (count = 0; count < i_cache_params[4]; count++)
|
||||
{ for ( loop = 0; loop < i_cache_params[5]; loop++) FICE(addr);
|
||||
addr = addr + i_cache_params[3];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This function does all command procesing for interfacing to gdb.
|
||||
return of 0 will execute DEBUG_GO (continue)
|
||||
return of 1 will execute DEBUG_SS (single step)
|
||||
*/
|
||||
|
||||
int
|
||||
handle_exception (registers,tt)
|
||||
unsigned long *registers;
|
||||
int tt; /* Trap type */
|
||||
{
|
||||
int sigval;
|
||||
int addr;
|
||||
int length;
|
||||
unsigned char *ptr;
|
||||
|
||||
/* reply to host that an exception has occurred */
|
||||
sigval = computeSignal(tt);
|
||||
ptr = remcomOutBuffer;
|
||||
|
||||
*ptr++ = 'T';
|
||||
*ptr++ = hexchars[sigval >> 4];
|
||||
*ptr++ = hexchars[sigval & 0xf];
|
||||
|
||||
/* could be lots of stuff here like PC and SP registers */
|
||||
|
||||
*ptr++ = 0;
|
||||
|
||||
putpacket(remcomOutBuffer);
|
||||
|
||||
while (1)
|
||||
{
|
||||
remcomOutBuffer[0] = 0;
|
||||
|
||||
getpacket(remcomInBuffer);
|
||||
switch (remcomInBuffer[0])
|
||||
{
|
||||
case '?':
|
||||
remcomOutBuffer[0] = 'S';
|
||||
remcomOutBuffer[1] = hexchars[sigval >> 4];
|
||||
remcomOutBuffer[2] = hexchars[sigval & 0xf];
|
||||
remcomOutBuffer[3] = 0;
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
/* toggle debug flag */
|
||||
led_putnum (16);
|
||||
break;
|
||||
|
||||
case 'g': /* return the value of the CPU registers */
|
||||
{
|
||||
ptr = remcomOutBuffer;
|
||||
/* GR0..GR31 SR0..SR7 CR0..CR31 specials */
|
||||
ptr = mem2hex((char *)registers, ptr, NUMREGBYTES, 0);
|
||||
/* need to add floating point registers */
|
||||
}
|
||||
break;
|
||||
|
||||
case 'G': /* set the value of the CPU registers - return OK */
|
||||
{
|
||||
ptr = &remcomInBuffer[1];
|
||||
/* GR0..GR31 SR0..SR7 CR0..CR31 specials */
|
||||
hex2mem(ptr, (char *)registers, NUMREGBYTES, 0);
|
||||
strcpy(remcomOutBuffer,"OK 1");
|
||||
}
|
||||
break;
|
||||
|
||||
case 'm': /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */
|
||||
/* Try to read %x,%x. */
|
||||
|
||||
ptr = &remcomInBuffer[1];
|
||||
|
||||
if (hexToInt(&ptr, &addr)
|
||||
&& *ptr++ == ','
|
||||
&& hexToInt(&ptr, &length))
|
||||
{
|
||||
if (mem2hex((char *)addr, remcomOutBuffer, length, 1))
|
||||
break;
|
||||
|
||||
strcpy (remcomOutBuffer, "E03");
|
||||
}
|
||||
else
|
||||
strcpy(remcomOutBuffer,"E01");
|
||||
break;
|
||||
|
||||
case 'M': /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */
|
||||
/* Try to read '%x,%x:'. */
|
||||
|
||||
ptr = &remcomInBuffer[1];
|
||||
|
||||
if (hexToInt(&ptr, &addr)
|
||||
&& *ptr++ == ','
|
||||
&& hexToInt(&ptr, &length)
|
||||
&& *ptr++ == ':')
|
||||
{
|
||||
if (hex2mem(ptr, (char *)addr, length, 1))
|
||||
strcpy(remcomOutBuffer, "OK");
|
||||
else
|
||||
strcpy(remcomOutBuffer, "E03");
|
||||
}
|
||||
else
|
||||
strcpy(remcomOutBuffer, "E02");
|
||||
break;
|
||||
|
||||
case 'c': /* cAA..AA Continue at address AA..AA(optional) */
|
||||
/* try to read optional parameter, pc unchanged if no parm */
|
||||
|
||||
ptr = &remcomInBuffer[1];
|
||||
if (hexToInt(&ptr, &addr))
|
||||
{
|
||||
registers[PC] = addr;
|
||||
registers[NPC] = addr + 4;
|
||||
}
|
||||
|
||||
/* Need to flush the instruction cache here, as we may have deposited a
|
||||
breakpoint, and the icache probably has no way of knowing that a data ref to
|
||||
some location may have changed something that is in the instruction cache.
|
||||
*/
|
||||
|
||||
flush_i_cache();
|
||||
return 0; /* execute GO */
|
||||
|
||||
/* kill the program */
|
||||
case 'k' : /* do nothing */
|
||||
break;
|
||||
|
||||
case 's' : /* single step */
|
||||
/* try to read optional parameter, pc unchanged if no parm */
|
||||
|
||||
ptr = &remcomInBuffer[1];
|
||||
if (hexToInt(&ptr, &addr))
|
||||
{
|
||||
registers[PC] = addr;
|
||||
registers[NPC] = addr + 4;
|
||||
}
|
||||
/* Need to flush the instruction cache here, as we may have deposited a
|
||||
breakpoint, and the icache probably has no way of knowing that a data ref to
|
||||
some location may have changed something that is in the instruction cache.
|
||||
*/
|
||||
flush_i_cache();
|
||||
return 1; /* execute Single Step */
|
||||
break;
|
||||
|
||||
#if TESTING1
|
||||
case 't': /* Test feature */
|
||||
break;
|
||||
#endif
|
||||
case 'r': /* Reset */
|
||||
break;
|
||||
|
||||
#if TESTING2
|
||||
Disabled until we can unscrew this properly
|
||||
|
||||
case 'b': /* bBB... Set baud rate to BB... */
|
||||
{
|
||||
int baudrate;
|
||||
extern void set_timer_3();
|
||||
|
||||
ptr = &remcomInBuffer[1];
|
||||
if (!hexToInt(&ptr, &baudrate))
|
||||
{
|
||||
strcpy(remcomOutBuffer,"B01");
|
||||
break;
|
||||
}
|
||||
|
||||
/* Convert baud rate to uart clock divider */
|
||||
switch (baudrate)
|
||||
{
|
||||
case 38400:
|
||||
baudrate = 16;
|
||||
break;
|
||||
case 19200:
|
||||
baudrate = 33;
|
||||
break;
|
||||
case 9600:
|
||||
baudrate = 65;
|
||||
break;
|
||||
default:
|
||||
strcpy(remcomOutBuffer,"B02");
|
||||
goto x1;
|
||||
}
|
||||
|
||||
putpacket("OK 2"); /* Ack before changing speed */
|
||||
set_timer_3(baudrate); /* Set it */
|
||||
}
|
||||
x1: break;
|
||||
#endif
|
||||
} /* switch */
|
||||
|
||||
/* reply to the request */
|
||||
putpacket(remcomOutBuffer);
|
||||
}
|
||||
print ("\r\nEscaped handle_exception\r\n");
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
extern int led_putnum();
|
||||
#define DELAY 900000
|
||||
extern char strobe(),putDebugChar(),print(),putnum();
|
||||
extern char foobar();
|
||||
extern char breakpoint();
|
||||
|
||||
#define TESTSTUB 1
|
||||
|
||||
main()
|
||||
{
|
||||
unsigned char x;
|
||||
char buf[20];
|
||||
|
||||
#if TESTIO
|
||||
strobe();
|
||||
outbyte ('\n');
|
||||
outbyte ('$');
|
||||
write (2, "Enter 5 characters... ", 24);
|
||||
read (0, buf, 5);
|
||||
print (buf);
|
||||
print ("\r\n");
|
||||
strobe ();
|
||||
#endif
|
||||
|
||||
#if TESTSTUB
|
||||
print ("\r\nInit vectors...\r\n");
|
||||
/*** set_debug_traps(); ***/
|
||||
print ("\r\nSet a breakpoint...\r\n");
|
||||
handle_exception();
|
||||
/*** breakpoint(); ***/
|
||||
#endif
|
||||
|
||||
print ("\r\nTest foobar\r\n");
|
||||
foobar();
|
||||
/* whew, we made it */
|
||||
print ("\r\nDone...");
|
||||
}
|
||||
|
||||
/*
|
||||
* FIXME: this is only hear so things will link.
|
||||
*/
|
||||
int
|
||||
puts(s)
|
||||
char *s;
|
||||
{
|
||||
s++;
|
||||
}
|
|
@ -0,0 +1,126 @@
|
|||
# Copyright (c) 1997 Cygnus Support
|
||||
#
|
||||
# The authors hereby grant permission to use, copy, modify, distribute,
|
||||
# and license this software and its documentation for any purpose, provided
|
||||
# that existing copyright notices are retained in all copies and that this
|
||||
# notice is included verbatim in any distributions. No written agreement,
|
||||
# license, or royalty fee is required for any of the authorized uses.
|
||||
# Modifications to this software may be copyrighted by their authors
|
||||
# and need not follow the licensing terms described here, provided that
|
||||
# the new terms are clearly indicated on the first page of each file where
|
||||
# they apply.
|
||||
|
||||
VPATH = @srcdir@
|
||||
srcdir = @srcdir@
|
||||
objdir = .
|
||||
srcroot = $(srcdir)/../..
|
||||
objroot = $(objdir)/../..
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
host_alias = @host_alias@
|
||||
target_alias = @target_alias@
|
||||
program_transform_name = @program_transform_name@
|
||||
|
||||
bindir = @bindir@
|
||||
libdir = @libdir@
|
||||
tooldir = $(exec_prefix)/$(target_alias)
|
||||
|
||||
# Multilib support variables.
|
||||
# TOP is used instead of MULTI{BUILD,SRC}TOP.
|
||||
MULTIDIRS =
|
||||
MULTISUBDIR =
|
||||
MULTIDO = true
|
||||
MULTICLEAN = true
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
CC = @CC@
|
||||
|
||||
#AS = @AS@
|
||||
AS = `if [ -f ${objroot}/../gas/as.new ] ; \
|
||||
then echo ${objroot}/../gas/as.new ; \
|
||||
else echo as ; fi`
|
||||
|
||||
AR = @AR@
|
||||
|
||||
#LD = @LD@
|
||||
LD = `if [ -f ${objroot}/../ld/ld.new ] ; \
|
||||
then echo ${objroot}/../ld/ld.new ; \
|
||||
else echo ld ; fi`
|
||||
|
||||
RANLIB = @RANLIB@
|
||||
|
||||
OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \
|
||||
then echo ${objroot}/../binutils/objdump ; \
|
||||
else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi`
|
||||
OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \
|
||||
then echo ${objroot}/../binutils/objcopy ; \
|
||||
else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi`
|
||||
|
||||
CRT0 = cygmon-crt0.o
|
||||
CYGMON_OBJS = cygmon-salib.o cygmon-gmon.o
|
||||
|
||||
CFLAGS = -g
|
||||
|
||||
GCC_LDFLAGS = `if [ -d ${objroot}/../gcc ] ; \
|
||||
then echo -L${objroot}/../gcc ; fi`
|
||||
|
||||
SCRIPTS = cygmon
|
||||
BSP = libcygmon.a
|
||||
|
||||
# Host specific makefile fragment comes in here.
|
||||
@host_makefile_frag@
|
||||
|
||||
all: ${CRT0} ${BSP}
|
||||
|
||||
#
|
||||
# here's where we build the board support packages for each target
|
||||
#
|
||||
libcygmon.a: $(CYGMON_OBJS)
|
||||
${AR} ${ARFLAGS} $@ $(CYGMON_OBJS)
|
||||
${RANLIB} $@
|
||||
|
||||
cygmon-salib.o: ${srcdir}/cygmon-salib.c
|
||||
$(CC) -c $(CFLAGS) @NEED_UNDERSCORE@ @IS_COFF@ $(<) -o $@
|
||||
|
||||
cygmon-crt0.o: ${srcdir}/cygmon-crt0.S
|
||||
$(CC) -c $(CFLAGS) @NEED_UNDERSCORE@ @IS_COFF@ $(<) -o $@
|
||||
|
||||
doc:
|
||||
|
||||
clean mostlyclean:
|
||||
rm -f a.out core *.i *~ *.o *-test *.srec *.dis *.map *.x
|
||||
|
||||
distclean maintainer-clean realclean: clean
|
||||
rm -f Makefile config.status a.out
|
||||
|
||||
.PHONY: install info install-info clean-info
|
||||
install:
|
||||
$(INSTALL_PROGRAM) $(CRT0) $(tooldir)/lib${MULTISUBDIR}/$(CRT0)
|
||||
@for bsp in ${BSP}; do\
|
||||
$(INSTALL_PROGRAM) $${bsp} $(tooldir)/lib${MULTISUBDIR}; \
|
||||
done
|
||||
@for script in ${SCRIPTS}; do\
|
||||
$(INSTALL_DATA) ${srcdir}/$${script}.ld $(tooldir)/lib${MULTISUBDIR}/$${script}.ld; \
|
||||
done
|
||||
|
||||
info:
|
||||
install-info:
|
||||
clean-info:
|
||||
|
||||
test.o: ${srcdir}/test.c
|
||||
|
||||
# these are for the BSPs
|
||||
${CRT0}: cygmon-crt0.S
|
||||
|
||||
Makefile: Makefile.in config.status @host_makefile_frag_path@
|
||||
$(SHELL) config.status
|
||||
|
||||
config.status: configure
|
||||
$(SHELL) config.status --recheck
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,110 @@
|
|||
# Copyright (c) 1995, 1996 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.
|
||||
#
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
#
|
||||
AC_PREREQ(2.5)dnl
|
||||
AC_INIT(cygmon-salib.c)
|
||||
|
||||
if test "${enable_shared}" = "yes" ; then
|
||||
echo "Shared libraries not supported for cross compiling, ignored"
|
||||
fi
|
||||
|
||||
if test "$srcdir" = "." ; then
|
||||
if test "${with_target_subdir}" != "." ; then
|
||||
libgloss_topdir="${srcdir}/${with_multisrctop}../../.."
|
||||
else
|
||||
libgloss_topdir="${srcdir}/${with_multisrctop}../.."
|
||||
fi
|
||||
else
|
||||
libgloss_topdir="${srcdir}/../.."
|
||||
fi
|
||||
AC_CONFIG_AUX_DIR($libgloss_topdir)
|
||||
|
||||
AC_CANONICAL_SYSTEM
|
||||
AC_ARG_PROGRAM
|
||||
|
||||
AC_PROG_INSTALL
|
||||
|
||||
# FIXME: We temporarily define our own version of AC_PROG_CC. This is
|
||||
# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
|
||||
# are building a library that must be included in all links, so we
|
||||
# can't link an executable until this lib is built.
|
||||
# autoconf should provide a way to do this.
|
||||
|
||||
AC_DEFUN(LIB_AC_PROG_CC,
|
||||
[AC_BEFORE([$0], [AC_PROG_CPP])dnl
|
||||
AC_CHECK_PROG(CC, gcc, gcc)
|
||||
if test -z "$CC"; then
|
||||
AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
|
||||
test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
|
||||
fi
|
||||
|
||||
AC_PROG_CC_GNU
|
||||
|
||||
if test $ac_cv_prog_gcc = yes; then
|
||||
GCC=yes
|
||||
dnl Check whether -g works, even if CFLAGS is set, in case the package
|
||||
dnl plays around with CFLAGS (such as to build both debugging and
|
||||
dnl normal versions of a library), tasteless as that idea is.
|
||||
ac_test_CFLAGS="${CFLAGS+set}"
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
CFLAGS=
|
||||
AC_PROG_CC_G
|
||||
if test "$ac_test_CFLAGS" = set; then
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
elif test $ac_cv_prog_cc_g = yes; then
|
||||
CFLAGS="-g -O2"
|
||||
else
|
||||
CFLAGS="-O2"
|
||||
fi
|
||||
else
|
||||
GCC=
|
||||
test "${CFLAGS+set}" = set || CFLAGS="-g"
|
||||
fi
|
||||
])
|
||||
|
||||
case "$target" in
|
||||
*coff)
|
||||
IS_COFF="-DCOFF"
|
||||
;;
|
||||
esac
|
||||
|
||||
LIB_AC_PROG_CC
|
||||
AS=${AS-as}
|
||||
AC_SUBST(AS)
|
||||
AR=${AR-ar}
|
||||
AC_SUBST(AR)
|
||||
LD=${LD-ld}
|
||||
AC_SUBST(LD)
|
||||
AC_SUBST(IS_COFF)
|
||||
AC_SUBST(NEED_UNDERSCORE)
|
||||
AC_PROG_RANLIB
|
||||
|
||||
host_makefile_frag=${srcdir}/../config/default.mh
|
||||
|
||||
dnl We have to assign the same value to other variables because autoconf
|
||||
dnl doesn't provide a mechanism to substitute a replacement keyword with
|
||||
dnl arbitrary data or pathnames.
|
||||
dnl
|
||||
host_makefile_frag_path=$host_makefile_frag
|
||||
AC_SUBST(host_makefile_frag_path)
|
||||
AC_SUBST_FILE(host_makefile_frag)
|
||||
|
||||
AC_OUTPUT(Makefile,
|
||||
. ${libgloss_topdir}/config-ml.in,
|
||||
srcdir=${srcdir}
|
||||
target=${target}
|
||||
ac_configure_args="${ac_configure_args} --enable-multilib"
|
||||
CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
|
||||
libgloss_topdir=${libgloss_topdir}
|
||||
)
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
* crt0 startup code for user programs running under Cygmon
|
||||
*
|
||||
* Copyright (c) 1998 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.
|
||||
*/
|
||||
|
||||
#ifndef NEED_UNDERSCORE
|
||||
#define SYM(X) X
|
||||
#else
|
||||
#define SYM(X) _ ## X
|
||||
#endif
|
||||
|
||||
.data
|
||||
.align 8
|
||||
SYM(environ):
|
||||
.long 0
|
||||
|
||||
SYM(argc):
|
||||
.long 0
|
||||
|
||||
.text
|
||||
.align 4
|
||||
|
||||
.globl SYM(_start)
|
||||
SYM(_start):
|
||||
/* see if the stack is already setup. if not, then default
|
||||
* to using the value of %sp as set by the ROM monitor
|
||||
*/
|
||||
lea __stack,%eax
|
||||
cmpl $0,%eax
|
||||
jz 1f
|
||||
mov %eax, %esp
|
||||
1:
|
||||
mov $0, %ebp
|
||||
|
||||
lea __bss_start, %eax
|
||||
2:
|
||||
movb $0,(%eax)
|
||||
inc %eax
|
||||
cmp $__bss_end,%eax
|
||||
jl 2b
|
||||
|
||||
2:
|
||||
pushl $SYM(__sigtramp)
|
||||
pushl $0
|
||||
call SYM(__install_signal_handler)
|
||||
add $4, %esp
|
||||
|
||||
pushl $SYM(__do_global_dtors)
|
||||
call SYM(atexit)
|
||||
add $4, %esp
|
||||
|
||||
call SYM(__do_global_ctors)
|
||||
|
||||
pushl $SYM(argc)
|
||||
call SYM(__get_program_arguments)
|
||||
add $4, %esp
|
||||
|
||||
pushl %eax
|
||||
lea SYM(argc), %ebx
|
||||
pushl (%ebx)
|
||||
call SYM(main)
|
||||
add $8, %esp
|
||||
|
||||
/* call exit from the C library so atexit gets called, and the
|
||||
* C++ destructors get run. This calls our exit routine below
|
||||
* when it's done.
|
||||
*/
|
||||
pushl %eax
|
||||
call SYM(exit)
|
||||
3:
|
||||
jmp 3b
|
|
@ -0,0 +1,362 @@
|
|||
/*-
|
||||
* Copyright (c) 1991 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 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 is a modified gmon.c by J.W.Hawtin <oolon@ankh.org>,
|
||||
* 14/8/96 based on the original gmon.c in GCC and the hacked version
|
||||
* solaris 2 sparc version (config/sparc/gmon-sol.c) by Mark Eichin. To do
|
||||
* process profiling on solaris 2.X X86
|
||||
*
|
||||
* It must be used in conjunction with sol2-gc1.asm, which is used to start
|
||||
* and stop process monitoring.
|
||||
*
|
||||
* Differences.
|
||||
*
|
||||
* On Solaris 2 _mcount is called by library functions not mcount, so support
|
||||
* has been added for both.
|
||||
*
|
||||
* Also the prototype for profil() is different
|
||||
*
|
||||
* Solaris 2 does not seem to have char *minbrk which allows the setting of
|
||||
* the minimum SBRK region so this code has been removed and lets pray malloc
|
||||
* does not mess it up.
|
||||
*
|
||||
* Notes
|
||||
*
|
||||
* This code could easily be integrated with the original gmon.c and perhaps
|
||||
* should be.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)gmon.c 5.3 (Berkeley) 5/22/91";
|
||||
#endif /* not lint */
|
||||
|
||||
#define DEBUG
|
||||
#ifdef DEBUG
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include "cygmon-gmon.h"
|
||||
|
||||
/*
|
||||
* froms is actually a bunch of unsigned shorts indexing tos
|
||||
*/
|
||||
static int profiling = 3;
|
||||
static unsigned short *froms;
|
||||
static struct tostruct *tos = 0;
|
||||
static long tolimit = 0;
|
||||
static char *s_lowpc = 0;
|
||||
static char *s_highpc = 0;
|
||||
static unsigned long s_textsize = 0;
|
||||
|
||||
static int ssiz;
|
||||
static char *sbuf;
|
||||
static int s_scale;
|
||||
/* see profil(2) where this is describe (incorrectly) */
|
||||
#define SCALE_1_TO_1 0x10000L
|
||||
|
||||
#define MSG "No space for profiling buffer(s)\n"
|
||||
|
||||
extern int errno;
|
||||
|
||||
int
|
||||
monstartup(lowpc, highpc)
|
||||
char *lowpc;
|
||||
char *highpc;
|
||||
{
|
||||
int monsize;
|
||||
char *buffer;
|
||||
register int o;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
lowpc = (char *)
|
||||
ROUNDDOWN((unsigned)lowpc, HISTFRACTION*sizeof(HISTCOUNTER));
|
||||
s_lowpc = lowpc;
|
||||
highpc = (char *)
|
||||
ROUNDUP((unsigned)highpc, HISTFRACTION*sizeof(HISTCOUNTER));
|
||||
s_highpc = highpc;
|
||||
s_textsize = highpc - lowpc;
|
||||
monsize = (s_textsize / HISTFRACTION) + sizeof(struct phdr);
|
||||
buffer = (char *) sbrk (monsize);
|
||||
if (buffer == (char *) -1)
|
||||
{
|
||||
write (2, MSG , sizeof(MSG));
|
||||
return;
|
||||
}
|
||||
bzero (buffer, monsize);
|
||||
froms = (unsigned short *) sbrk (s_textsize / HASHFRACTION);
|
||||
if (froms == (unsigned short *) -1)
|
||||
{
|
||||
write(2, MSG, sizeof(MSG));
|
||||
froms = 0;
|
||||
return;
|
||||
}
|
||||
bzero (froms, s_textsize / HASHFRACTION);
|
||||
tolimit = s_textsize * ARCDENSITY / 100;
|
||||
if (tolimit < MINARCS)
|
||||
{
|
||||
tolimit = MINARCS;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tolimit > 65534)
|
||||
{
|
||||
tolimit = 65534;
|
||||
}
|
||||
}
|
||||
tos = (struct tostruct *) sbrk( tolimit * sizeof( struct tostruct ) );
|
||||
if (tos == (struct tostruct *) -1)
|
||||
{
|
||||
write (2, MSG, sizeof(MSG));
|
||||
froms = 0;
|
||||
tos = 0;
|
||||
return;
|
||||
}
|
||||
bzero (tos, tolimit * sizeof( struct tostruct ) );
|
||||
tos[0].link = 0;
|
||||
sbuf = buffer;
|
||||
ssiz = monsize;
|
||||
( (struct phdr *) buffer ) -> lpc = lowpc;
|
||||
( (struct phdr *) buffer ) -> hpc = highpc;
|
||||
( (struct phdr *) buffer ) -> ncnt = ssiz;
|
||||
monsize -= sizeof(struct phdr);
|
||||
if ( monsize <= 0 )
|
||||
return;
|
||||
o = highpc - lowpc;
|
||||
if (monsize < o)
|
||||
{
|
||||
s_scale = ( (float) monsize / o ) * SCALE_1_TO_1;
|
||||
}
|
||||
else
|
||||
s_scale = SCALE_1_TO_1;
|
||||
moncontrol (1);
|
||||
}
|
||||
|
||||
void
|
||||
_mcleanup()
|
||||
{
|
||||
int fd;
|
||||
int fromindex;
|
||||
int endfrom;
|
||||
char *frompc;
|
||||
int toindex;
|
||||
struct rawarc rawarc;
|
||||
|
||||
moncontrol (0);
|
||||
profil_write (1, sbuf, ssiz);
|
||||
|
||||
endfrom = s_textsize / (HASHFRACTION * sizeof(*froms));
|
||||
for ( fromindex = 0 ; fromindex < endfrom ; fromindex++ )
|
||||
{
|
||||
if ( froms[fromindex] == 0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
frompc = s_lowpc + (fromindex * HASHFRACTION * sizeof(*froms));
|
||||
for (toindex=froms[fromindex]; toindex!=0; toindex=tos[toindex].link)
|
||||
{
|
||||
rawarc.raw_frompc = (unsigned long) frompc;
|
||||
rawarc.raw_selfpc = (unsigned long) tos[toindex].selfpc;
|
||||
rawarc.raw_count = tos[toindex].count;
|
||||
profil_write (2, &rawarc, sizeof (rawarc));
|
||||
}
|
||||
}
|
||||
profil_write (3, 0, 0);
|
||||
}
|
||||
|
||||
static char already_setup = 0;
|
||||
|
||||
_mcount()
|
||||
{
|
||||
register char *selfpc;
|
||||
register unsigned short *frompcindex;
|
||||
register struct tostruct *top;
|
||||
register struct tostruct *prevtop;
|
||||
register long toindex;
|
||||
|
||||
/*
|
||||
* find the return address for mcount,
|
||||
* and the return address for mcount's caller.
|
||||
*/
|
||||
|
||||
/* selfpc = pc pushed by mcount call.
|
||||
This identifies the function that was just entered. */
|
||||
selfpc = (void *) __builtin_return_address (0);
|
||||
/* frompcindex = pc in preceding frame.
|
||||
This identifies the caller of the function just entered. */
|
||||
frompcindex = (void *) __builtin_return_address (1);
|
||||
|
||||
if (! already_setup)
|
||||
{
|
||||
extern etext();
|
||||
extern _ftext();
|
||||
already_setup = 1;
|
||||
monstartup(_ftext, etext);
|
||||
atexit(_mcleanup);
|
||||
}
|
||||
/*
|
||||
* check that we are profiling
|
||||
* and that we aren't recursively invoked.
|
||||
*/
|
||||
if (profiling)
|
||||
{
|
||||
goto out;
|
||||
}
|
||||
profiling++;
|
||||
/*
|
||||
* check that frompcindex is a reasonable pc value.
|
||||
* for example: signal catchers get called from the stack,
|
||||
* not from text space. too bad.
|
||||
*/
|
||||
frompcindex = (unsigned short *)((long)frompcindex - (long)s_lowpc);
|
||||
if ((unsigned long)frompcindex > s_textsize)
|
||||
{
|
||||
goto done;
|
||||
}
|
||||
frompcindex =
|
||||
&froms[((long)frompcindex) / (HASHFRACTION * sizeof(*froms))];
|
||||
toindex = *frompcindex;
|
||||
if (toindex == 0)
|
||||
{
|
||||
/*
|
||||
* first time traversing this arc
|
||||
*/
|
||||
toindex = ++tos[0].link;
|
||||
if (toindex >= tolimit)
|
||||
{
|
||||
goto overflow;
|
||||
}
|
||||
*frompcindex = toindex;
|
||||
top = &tos[toindex];
|
||||
top->selfpc = selfpc;
|
||||
top->count = 1;
|
||||
top->link = 0;
|
||||
goto done;
|
||||
}
|
||||
top = &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 (; /* goto done */; )
|
||||
{
|
||||
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 = ++tos[0].link;
|
||||
if (toindex >= tolimit)
|
||||
{
|
||||
goto overflow;
|
||||
}
|
||||
top = &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 = &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:
|
||||
profiling--;
|
||||
/* and fall through */
|
||||
out:
|
||||
return; /* normal return restores saved registers */
|
||||
|
||||
overflow:
|
||||
profiling++; /* halt further profiling */
|
||||
# define TOLIMIT "mcount: tos overflow\n"
|
||||
write (2, TOLIMIT, sizeof(TOLIMIT));
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* Control profiling
|
||||
* profiling is what mcount checks to see if
|
||||
* all the data structures are ready.
|
||||
*/
|
||||
moncontrol(mode)
|
||||
int mode;
|
||||
{
|
||||
if (mode)
|
||||
{
|
||||
/* start */
|
||||
profil((unsigned short *)(sbuf + sizeof(struct phdr)),
|
||||
ssiz - sizeof(struct phdr),
|
||||
(int)s_lowpc, s_scale);
|
||||
|
||||
profiling = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* stop */
|
||||
profil((unsigned short *)0, 0, 0, 0);
|
||||
profiling = 3;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
#ifndef GMON_CYGMON_H
|
||||
#define GMON_CYGMON_H
|
||||
|
||||
struct phdr
|
||||
{
|
||||
char *lpc;
|
||||
char *hpc;
|
||||
int ncnt;
|
||||
};
|
||||
|
||||
|
||||
#define HISTFRACTION 2
|
||||
#define HISTCOUNTER unsigned short
|
||||
#define HASHFRACTION 1
|
||||
#define ARCDENSITY 2
|
||||
#define MINARCS 50
|
||||
|
||||
struct tostruct
|
||||
{
|
||||
char *selfpc;
|
||||
long count;
|
||||
unsigned short link;
|
||||
};
|
||||
|
||||
struct rawarc
|
||||
{
|
||||
unsigned long raw_frompc;
|
||||
unsigned long raw_selfpc;
|
||||
long raw_count;
|
||||
};
|
||||
|
||||
#define ROUNDDOWN(x,y) (((x)/(y))*(y))
|
||||
#define ROUNDUP(x,y) ((((x)+(y)-1)/(y))*(y))
|
||||
|
||||
#endif
|
|
@ -0,0 +1,165 @@
|
|||
/*
|
||||
* Standard x86 syscalls for user programs running under Cygmon
|
||||
*
|
||||
* Copyright (c) 1998 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 <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include "cygmon-syscall.h"
|
||||
#include <sys/time.h>
|
||||
|
||||
extern int errno;
|
||||
|
||||
_syscall3(int,write,int,i,char *,c,int,len);
|
||||
|
||||
_syscall3(int,read,int,i,char *,c,int,len);
|
||||
|
||||
_syscall2(int,kill,int,pid,int,signal);
|
||||
|
||||
_syscall2(void,__install_signal_handler,int,arg,void *,handler);
|
||||
_syscall1(char **,__get_program_arguments,int *,argc);
|
||||
|
||||
_syscall1(void,__sys_exit,int,exitcode);
|
||||
_syscall1(void,putTtyChar,int,character);
|
||||
_syscall1(time_t,time,time_t *,ptr);
|
||||
_syscall2(int, gettimeofday, struct timeval *,time, struct timezone *,z);
|
||||
_syscall3(int, __open, const char *, filename, int, mode, int, filemode);
|
||||
_syscall4(void, profil, unsigned short *, buff, unsigned int, bufsiz,
|
||||
unsigned int, offset, unsigned int, scale);
|
||||
_syscall1(int, close, int, fd);
|
||||
|
||||
/* Bleah. */
|
||||
int
|
||||
open (const char *filename, int mode, ...)
|
||||
{
|
||||
return __open (filename, mode, 0644);
|
||||
}
|
||||
|
||||
/* Ultra-super cheezy. */
|
||||
int
|
||||
isatty (int i)
|
||||
{
|
||||
return i<3;
|
||||
}
|
||||
|
||||
char *
|
||||
sbrk (int amt)
|
||||
{
|
||||
extern char _end;
|
||||
static char *ptr = 0;
|
||||
char *res;
|
||||
if (ptr == 0)
|
||||
ptr = &_end;
|
||||
if (amt == 0)
|
||||
return (char *)ptr;
|
||||
|
||||
if (((long)ptr) % 8)
|
||||
ptr = ptr + (8 - (((long)(ptr)) % 8));
|
||||
res = ptr;
|
||||
ptr += amt;
|
||||
return (char *)res;
|
||||
}
|
||||
|
||||
void
|
||||
_exit(int i)
|
||||
{
|
||||
while(1) {
|
||||
__sys_exit (i);
|
||||
asm(" int $3");
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
fstat(int des, struct stat *buf)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
lseek(int des,unsigned long offset, int whence)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
getpid ()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Simple replacement for the clock() syscall. */
|
||||
clock_t
|
||||
clock ()
|
||||
{
|
||||
struct timeval t;
|
||||
|
||||
gettimeofday (&t, 0);
|
||||
return t.tv_sec * 1000 + (t.tv_usec / 1000);
|
||||
}
|
||||
|
||||
#ifndef COFF
|
||||
typedef void (*ctp)();
|
||||
void
|
||||
__do_global_ctors ()
|
||||
{
|
||||
extern int __CTOR_LIST__;
|
||||
int *c = &__CTOR_LIST__;
|
||||
c++;
|
||||
while (*c)
|
||||
{
|
||||
ctp d = (ctp)*c;
|
||||
(d)();
|
||||
c++;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
__do_global_dtors ()
|
||||
{
|
||||
extern int __DTOR_LIST__;
|
||||
int *c = &__DTOR_LIST__;
|
||||
int *cp = c;
|
||||
c++;
|
||||
while (*c)
|
||||
{
|
||||
c++;
|
||||
}
|
||||
c--;
|
||||
while (c > cp)
|
||||
{
|
||||
ctp d = (ctp)*c;
|
||||
(*d)();
|
||||
c--;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
profil_write (int type, char *buffer, int len)
|
||||
{
|
||||
static int des = -1;
|
||||
|
||||
if (des < 0)
|
||||
{
|
||||
des = open ("gmon.out", O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||
}
|
||||
if (len == 0)
|
||||
{
|
||||
close (des);
|
||||
}
|
||||
else
|
||||
{
|
||||
write (des, buffer, len);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* Standard x86 syscalls for user programs running under Cygmon
|
||||
*
|
||||
* Copyright (c) 1998 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.
|
||||
*/
|
||||
|
||||
#ifndef CYGMON_SYSCALL_H
|
||||
#define CYGMON_SYSCALL_H
|
||||
|
||||
#define __MAX_ERRNO 4096
|
||||
|
||||
#define _syscall0(type,name) \
|
||||
type name(void) \
|
||||
{ \
|
||||
long __res; \
|
||||
__asm__ __volatile__ ("int $0x80" \
|
||||
: "=a" (__res) \
|
||||
: "0" (SYS_##name)); \
|
||||
return (type) __res; \
|
||||
}
|
||||
|
||||
#define _syscall1(type,name,atype,a) \
|
||||
type name(atype a) \
|
||||
{ \
|
||||
long __res, dummy; \
|
||||
__asm__ __volatile__ ("int $0x80" \
|
||||
: "=a" (__res), "=&b" (dummy) \
|
||||
: "0" (SYS_##name),"1" ((long)(a))); \
|
||||
return (type) __res; \
|
||||
}
|
||||
|
||||
#define _syscall2(type,name,atype,a,btype,b) \
|
||||
type name(atype a,btype b) \
|
||||
{ \
|
||||
long __res, dummy; \
|
||||
__asm__ __volatile__ ("int $0x80" \
|
||||
: "=a" (__res), "=&b" (dummy) \
|
||||
: "0" (SYS_##name),"1" ((long)(a)),"c" ((long)(b))); \
|
||||
return (type) __res; \
|
||||
}
|
||||
|
||||
#define _syscall3(type,name,atype,a,btype,b,ctype,c) \
|
||||
type name(atype a,btype b,ctype c) \
|
||||
{ \
|
||||
long __res, dummy; \
|
||||
__asm__ __volatile__ ("int $0x80" \
|
||||
: "=a" (__res), "=&b" (dummy) \
|
||||
: "0" (SYS_##name),"1" ((long)(a)),"c" ((long)(b)),"d" ((long)(c))); \
|
||||
return (type) __res; \
|
||||
}
|
||||
|
||||
#define _syscall4(type,name,atype,a,btype,b,ctype,c,dtype,d) \
|
||||
type name (atype a, btype b, ctype c, dtype d) \
|
||||
{ \
|
||||
long __res; \
|
||||
__asm__ __volatile__ ("int $0x80" \
|
||||
: "=a" (__res) \
|
||||
: "0" (SYS_##name),"b" ((long)(a)),"c" ((long)(b)), \
|
||||
"d" ((long)(c)),"S" ((long)(d))); \
|
||||
return (type) __res; \
|
||||
}
|
||||
|
||||
#define _syscall5(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e) \
|
||||
type name (atype a,btype b,ctype c,dtype d,etype e) \
|
||||
{ \
|
||||
long __res; \
|
||||
__asm__ __volatile__ ("int $0x80" \
|
||||
: "=a" (__res) \
|
||||
: "0" (SYS_##name),"b" ((long)(a)),"c" ((long)(b)), \
|
||||
"d" ((long)(c)),"S" ((long)(d)),"D" ((long)(e))); \
|
||||
return (type) __res; \
|
||||
}
|
||||
|
||||
#define SYS_putTtyChar 2
|
||||
#define SYS___sys_exit 1
|
||||
#define SYS_read 3
|
||||
#define SYS_write 4
|
||||
#define SYS___open 5
|
||||
#define SYS_close 6
|
||||
#define SYS_kill 37
|
||||
#define SYS_time 13
|
||||
#define SYS_gettimeofday 156
|
||||
#define SYS___install_signal_handler 48
|
||||
#define SYS_profil 98
|
||||
#define SYS___get_program_arguments 184
|
||||
#endif /* SYSCALL_H */
|
|
@ -0,0 +1,88 @@
|
|||
STARTUP(cygmon-crt0.o)
|
||||
ENTRY(_start)
|
||||
GROUP(-lcygmon -lc -lcygmon -lgcc)
|
||||
SEARCH_DIR(.)
|
||||
__DYNAMIC = 0;
|
||||
|
||||
/*
|
||||
* Allocate the stack to be at the top of memory, since the stack
|
||||
* grows down
|
||||
*/
|
||||
PROVIDE (__stack = 0x500000);
|
||||
|
||||
/*
|
||||
* Initalize some symbols to be zero so we can reference them in the
|
||||
* crt0 without core dumping. These functions are all optional, but
|
||||
* we do this so we can have our crt0 always use them if they exist.
|
||||
* This is so BSPs work better when using the crt0 installed with gcc.
|
||||
* We have to initalize them twice, so we multiple object file
|
||||
* formats, as some prepend an underscore.
|
||||
*/
|
||||
PROVIDE (hardware_init_hook = 0);
|
||||
PROVIDE (software_init_hook = 0);
|
||||
PROVIDE (__mem_start = 0x100000);
|
||||
PROVIDE (___mem_start = 0x100000);
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x100000;
|
||||
.text : {
|
||||
_ftext = . ;
|
||||
*(.init)
|
||||
eprol = .;
|
||||
*(.text)
|
||||
PROVIDE (__runtime_reloc_start = .);
|
||||
*(.rel.sdata)
|
||||
PROVIDE (__runtime_reloc_stop = .);
|
||||
*(.fini)
|
||||
__CTOR_LIST__ = .;
|
||||
CONSTRUCTORS
|
||||
LONG(-1)
|
||||
*(.ctors)
|
||||
LONG(0)
|
||||
__CTOR_END__ = .;
|
||||
__DTOR_LIST__ = .;
|
||||
LONG(-1)
|
||||
*(.dtors)
|
||||
LONG(0)
|
||||
__DTOR_END__ = .;
|
||||
etext = .;
|
||||
_etext = .;
|
||||
}
|
||||
. = .;
|
||||
.rdata : {
|
||||
*(.rdata)
|
||||
}
|
||||
_fdata = ALIGN(16);
|
||||
.data : {
|
||||
*(.data)
|
||||
}
|
||||
. = ALIGN(8);
|
||||
_gp = . + 0x8000;
|
||||
__global = . + 0x8000;
|
||||
.lit8 : {
|
||||
*(.lit8)
|
||||
}
|
||||
.lit4 : {
|
||||
*(.lit4)
|
||||
}
|
||||
.sdata : {
|
||||
*(.sdata)
|
||||
}
|
||||
. = ALIGN(4);
|
||||
edata = .;
|
||||
_edata = .;
|
||||
fbss = .;
|
||||
_fbss = .;
|
||||
.sbss : {
|
||||
*(.sbss)
|
||||
*(.scommon)
|
||||
}
|
||||
.bss : {
|
||||
__bss_start = . ;
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
__bss_end = . ;
|
||||
}
|
||||
end = .;
|
||||
_end = .;
|
||||
}
|
|
@ -0,0 +1,142 @@
|
|||
#
|
||||
#
|
||||
|
||||
VPATH = @srcdir@ @srcdir@/..
|
||||
srcdir = @srcdir@
|
||||
objdir = .
|
||||
srcroot = $(srcdir)/../..
|
||||
objroot = $(objdir)/../..
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
host_alias = @host_alias@
|
||||
target_alias = @target_alias@
|
||||
|
||||
bindir = @bindir@
|
||||
libdir = @libdir@
|
||||
tooldir = $(exec_prefix)/$(target_alias)
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
# Multilib support variables.
|
||||
# TOP is used instead of MULTI{BUILD,SRC}TOP.
|
||||
MULTIDIRS =
|
||||
MULTISUBDIR =
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
CC = @CC@
|
||||
|
||||
AS = @AS@
|
||||
AR = @AR@
|
||||
LD = @LD@
|
||||
RANLIB = @RANLIB@
|
||||
|
||||
OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \
|
||||
then echo ${objroot}/../binutils/objdump ; \
|
||||
else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi`
|
||||
OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \
|
||||
then echo ${objroot}/../binutils/objcopy ; \
|
||||
else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi`
|
||||
|
||||
OBJS = putnum.o unlink.o
|
||||
CFLAGS = -g
|
||||
SCRIPTS =
|
||||
|
||||
# Here is all of the simulator stuff
|
||||
SIM_SCRIPTS =
|
||||
SIM_LDFLAGS =
|
||||
SIM_BSP = libsim.a
|
||||
SIM_CRT0 = sim-crt0.o
|
||||
SIM_OBJS = sim-print.o sim-inbyte.o sim-sbrk.o sim-abort.o sim-errno.o simulator.o
|
||||
SIM_TEST = sim-test
|
||||
SIM_INSTALL = install-sim
|
||||
|
||||
# Here is all of the mon960 stuff
|
||||
MON_LDFLAGS =
|
||||
MON_BSP = libmon960.a
|
||||
MON_CRT0 = crt0.o
|
||||
MON_OBJS = mon-read.o mon-write.o mon-syscalls.o mon960.o
|
||||
MON_SCRIPTS = mon960.ld
|
||||
MON_TEST =
|
||||
MON_INSTALL = install-mon
|
||||
|
||||
# Host specific makefile fragment comes in here.
|
||||
@host_makefile_frag@
|
||||
|
||||
#
|
||||
# build a test program for each target board. Just trying to get
|
||||
# it to link is a good test, so we ignore all the errors for now.
|
||||
#
|
||||
all: ${MON_CRT0} ${MON_BSP}
|
||||
|
||||
#
|
||||
# here's where we build the board support packages for each target
|
||||
#
|
||||
${SIM_BSP}: ${OBJS} ${SIM_OBJS}
|
||||
${AR} ${ARFLAGS} ${SIM_BSP} ${SIM_OBJS} ${OBJS}
|
||||
${RANLIB} ${SIM_BSP}
|
||||
|
||||
${MON_BSP}: ${OBJS} ${MON_OBJS}
|
||||
${AR} ${ARFLAGS} ${MON_BSP} ${MON_OBJS} ${OBJS}
|
||||
${RANLIB} ${MON_BSP}
|
||||
|
||||
#
|
||||
# here's where we build the test programs for each target
|
||||
#
|
||||
.PHONY: test
|
||||
test: ${SIM_TEST} ${MVME_TEST} ${EVM_TEST}
|
||||
|
||||
sim-test: sim-test.x sim-test.dis
|
||||
|
||||
sim-test.x: test.o ${SIM_CRT0} ${SIM_BSP}
|
||||
${CC} ${LDFLAGS_FOR_TARGET} -L${objdir} \
|
||||
${SIM_CRT0} test.o \
|
||||
-o sim-test.x ${LIBS_FOR_TARGET} -lc ${SIM_BSP}
|
||||
|
||||
sim-test.dis: sim-test.x
|
||||
${OBJDUMP} -d sim-test.x > sim-test.dis
|
||||
|
||||
|
||||
#
|
||||
#
|
||||
#
|
||||
.c.S:
|
||||
${CC} ${CFLAGS_FOR_TARGET} -c $<
|
||||
|
||||
simulator.o: simulator.S
|
||||
sim-crt0.o: sim-crt0.S
|
||||
mvme-crt0.o: mvme-crt0.S
|
||||
mvme-exit.o: mvme-exit.S
|
||||
mvme-inbyte.o: mvme-inbyte.S
|
||||
mvme-outbyte.o: mvme-outbyte.S
|
||||
|
||||
clean mostlyclean:
|
||||
rm -f a.out core *.i *.o *-test *.srec *.dis *.x
|
||||
|
||||
distclean maintainer-clean realclean: clean
|
||||
rm -f Makefile config.status *~
|
||||
|
||||
.PHONY: install info install-info clean-info
|
||||
install: ${MON_INSTALL}
|
||||
|
||||
install-mon:
|
||||
set -e; for x in ${MON_CRT0} ${MON_BSP}; do ${INSTALL_DATA} $$x ${tooldir}/lib${MULTISUBDIR}/$$x; done
|
||||
set -e; for x in ${MON_SCRIPTS}; do ${INSTALL_DATA} ${srcdir}/$$x ${tooldir}/lib${MULTISUBDIR}/$$x; done
|
||||
|
||||
install-sim:
|
||||
set -e; for x in ${SIM_CRT0} ${SIM_BSP} ${SIM_SCRIPTS}; do ${INSTALL_DATA} $$x ${tooldir}/lib/$$x; done
|
||||
|
||||
doc:
|
||||
info:
|
||||
install-info:
|
||||
clean-info:
|
||||
|
||||
Makefile: Makefile.in config.status @host_makefile_frag_path@
|
||||
$(SHELL) config.status
|
||||
|
||||
config.status: configure
|
||||
$(SHELL) config.status --recheck
|
|
@ -0,0 +1,17 @@
|
|||
#ifndef ASM_H
|
||||
#define ASM_H
|
||||
|
||||
#ifdef __STDC__
|
||||
# define _C_LABEL(x) _ ## x
|
||||
#else
|
||||
# define _C_LABEL(x) _/**/x
|
||||
#endif
|
||||
#define _ASM_LABEL(x) x
|
||||
|
||||
#define _ENTRY(name) \
|
||||
.text; .align 4; .globl name; name:
|
||||
|
||||
#define ENTRY(name) \
|
||||
_ENTRY(_C_LABEL(name))
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,75 @@
|
|||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_PREREQ(2.5)dnl
|
||||
AC_INIT(crt0.c)
|
||||
|
||||
AC_CANONICAL_SYSTEM
|
||||
AC_ARG_PROGRAM
|
||||
|
||||
if test "$srcdir" = "." ; then
|
||||
mdir=`echo "${with_multisubdir}/" \
|
||||
| sed -e 's,\([[^/]][[^/]]*\),..,g' -e 's,^/$,,'`
|
||||
AC_CONFIG_AUX_DIR(${mdir}../../..)
|
||||
else
|
||||
AC_CONFIG_AUX_DIR(${srcdir}/../..)
|
||||
fi
|
||||
|
||||
AC_PROG_INSTALL
|
||||
|
||||
# FIXME: We temporarily define our own version of AC_PROG_CC. This is
|
||||
# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
|
||||
# are probably using a cross compiler, which will not be able to fully
|
||||
# link an executable. This should really be fixed in autoconf
|
||||
# itself.
|
||||
|
||||
AC_DEFUN(LIB_AC_PROG_CC,
|
||||
[AC_BEFORE([$0], [AC_PROG_CPP])dnl
|
||||
AC_CHECK_PROG(CC, gcc, gcc)
|
||||
if test -z "$CC"; then
|
||||
AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
|
||||
test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
|
||||
fi
|
||||
|
||||
AC_PROG_CC_GNU
|
||||
|
||||
if test $ac_cv_prog_gcc = yes; then
|
||||
GCC=yes
|
||||
dnl Check whether -g works, even if CFLAGS is set, in case the package
|
||||
dnl plays around with CFLAGS (such as to build both debugging and
|
||||
dnl normal versions of a library), tasteless as that idea is.
|
||||
ac_test_CFLAGS="${CFLAGS+set}"
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
CFLAGS=
|
||||
AC_PROG_CC_G
|
||||
if test "$ac_test_CFLAGS" = set; then
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
elif test $ac_cv_prog_cc_g = yes; then
|
||||
CFLAGS="-g -O2"
|
||||
else
|
||||
CFLAGS="-O2"
|
||||
fi
|
||||
else
|
||||
GCC=
|
||||
test "${CFLAGS+set}" = set || CFLAGS="-g"
|
||||
fi
|
||||
])
|
||||
|
||||
LIB_AC_PROG_CC
|
||||
AS=${AS-as}
|
||||
AC_SUBST(AS)
|
||||
AR=${AR-ar}
|
||||
AC_SUBST(AR)
|
||||
LD=${LD-ld}
|
||||
AC_SUBST(LD)
|
||||
AC_PROG_RANLIB
|
||||
|
||||
host_makefile_frag=${srcdir}/../config/default.mh
|
||||
|
||||
dnl We have to assign the same value to other variables because autoconf
|
||||
dnl doesn't provide a mechanism to substitute a replacement keyword with
|
||||
dnl arbitrary data or pathnames.
|
||||
dnl
|
||||
host_makefile_frag_path=$host_makefile_frag
|
||||
AC_SUBST(host_makefile_frag_path)
|
||||
AC_SUBST_FILE(host_makefile_frag)
|
||||
|
||||
AC_OUTPUT(Makefile)
|
|
@ -0,0 +1,66 @@
|
|||
extern int main(int argc, char **argv, char **envp);
|
||||
extern int brk (void *value);
|
||||
|
||||
extern char bss_start;
|
||||
extern char end;
|
||||
|
||||
char *__env[1] = {0};
|
||||
char **environ = __env;
|
||||
|
||||
#define ENABLE_TRACE_MASK 1
|
||||
|
||||
__inline static void
|
||||
enable_tracing (void)
|
||||
{
|
||||
register int mask = ENABLE_TRACE_MASK;
|
||||
__asm__ volatile ("modpc %0,%0,%0"
|
||||
:
|
||||
: "d" (mask));
|
||||
}
|
||||
|
||||
#define STACK_ALIGN 64
|
||||
|
||||
__inline static void
|
||||
set_stack (void* ptr)
|
||||
{
|
||||
ptr = (void *)(((int)ptr + STACK_ALIGN - 1) & ~(STACK_ALIGN - 1));
|
||||
/* SP must be 64 bytes larger than FP at start. */
|
||||
__asm__ volatile ("mov %0,sp"
|
||||
:
|
||||
: "d" (ptr+STACK_ALIGN));
|
||||
__asm__ volatile ("mov %0,fp"
|
||||
:
|
||||
: "d" (ptr));
|
||||
}
|
||||
|
||||
__inline static void
|
||||
init_Cregs (void)
|
||||
{
|
||||
/* set register values gcc like */
|
||||
register unsigned int mask0=0x3b001000;
|
||||
register unsigned int mask1=0x00009107;
|
||||
__asm__ volatile ("mov %0,g14"
|
||||
: /* no output */
|
||||
: "I" (0)); /* gnu structure pointer */
|
||||
__asm__ volatile ("modac %1,%0,%0"
|
||||
: /* no output */
|
||||
: "d" (mask0),
|
||||
"d" (mask1)); /* fpu control kb */
|
||||
}
|
||||
|
||||
void
|
||||
_start(void)
|
||||
{
|
||||
char *p;
|
||||
|
||||
enable_tracing ();
|
||||
set_stack (&end);
|
||||
init_Cregs ();
|
||||
/* The stack grows upwards, so this makes the heap start after a 256K
|
||||
stack area. PlumHall known to fail with less than 73K of stack. */
|
||||
brk (&end+0x40000);
|
||||
/* clear bss */
|
||||
memset (&bss_start, 0, &end - &bss_start);
|
||||
main(0, 0, 0);
|
||||
exit(0);
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
#include <errno.h>
|
||||
|
||||
read (fd, buf, sz)
|
||||
int fd;
|
||||
char *buf;
|
||||
int sz;
|
||||
{
|
||||
int nread;
|
||||
int r;
|
||||
|
||||
r = _sys_read (fd, buf, sz, &nread);
|
||||
if (r != 0)
|
||||
{
|
||||
errno = r;
|
||||
return -1;
|
||||
}
|
||||
return nread;
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
#include "asm.h"
|
||||
|
||||
ENTRY(_exit)
|
||||
lda 257,g13
|
||||
calls g13
|
||||
|
||||
ENTRY(_sys_open)
|
||||
lda 230,g13
|
||||
calls g13
|
||||
ret
|
||||
|
||||
ENTRY(_sys_read)
|
||||
lda 231,g13
|
||||
calls g13
|
||||
ret
|
||||
|
||||
ENTRY(_sys_write)
|
||||
lda 232,g13
|
||||
calls g13
|
||||
ret
|
||||
|
||||
ENTRY(_sys_lseek)
|
||||
lda 233,g13
|
||||
calls g13
|
||||
ret
|
||||
|
||||
ENTRY(_sys_close)
|
||||
lda 234,g13
|
||||
calls g13
|
||||
ret
|
|
@ -0,0 +1,14 @@
|
|||
#include <errno.h>
|
||||
|
||||
int
|
||||
write (int fd, const char *buf, int sz)
|
||||
{
|
||||
int nwritten;
|
||||
int r = _sys_write (fd, buf, sz, &nwritten);
|
||||
if (r != 0)
|
||||
{
|
||||
errno = r;
|
||||
return -1;
|
||||
}
|
||||
return nwritten;
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
static char *heap_end = 0;
|
||||
|
||||
int
|
||||
brk (void *ptr)
|
||||
{
|
||||
heap_end = ptr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
caddr_t
|
||||
sbrk (int amt)
|
||||
{
|
||||
extern char end;
|
||||
char *prev_heap_end;
|
||||
|
||||
if (heap_end == 0)
|
||||
heap_end = &end;
|
||||
prev_heap_end = heap_end;
|
||||
heap_end += amt;
|
||||
return ((caddr_t) prev_heap_end);
|
||||
}
|
||||
|
||||
int
|
||||
isatty (int file)
|
||||
{
|
||||
return file<3;
|
||||
}
|
||||
|
||||
int
|
||||
fstat (int file, struct stat *st)
|
||||
{
|
||||
st->st_mode = S_IFCHR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
stat (const char *filename, struct stat *st)
|
||||
{
|
||||
st->st_mode = S_IFCHR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
lseek (int fd, off_t offset, int type)
|
||||
{
|
||||
return _sys_lseek (fd, offset, type);
|
||||
}
|
||||
|
||||
int
|
||||
open (char *file, int mode, int perms)
|
||||
{
|
||||
return _sys_open (file, mode, perms);
|
||||
}
|
||||
|
||||
int
|
||||
close (int fd)
|
||||
{
|
||||
return _sys_close (fd);
|
||||
}
|
||||
|
||||
int
|
||||
getpid ()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
kill (int pid, int signal)
|
||||
{
|
||||
exit (signal);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* This conflicts with the abort defined in newlib. */
|
||||
void
|
||||
abort ()
|
||||
{
|
||||
exit (6);
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,36 @@
|
|||
GROUP(-lc -lgcc -lmon960)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
. = 0xa0008000;
|
||||
.text :
|
||||
{
|
||||
CREATE_OBJECT_SYMBOLS
|
||||
*(.text)
|
||||
_etext = .;
|
||||
|
||||
___CTOR_LIST__ = .;
|
||||
LONG((___CTOR_END__ - ___CTOR_LIST__) / 4 - 2)
|
||||
*(.ctors)
|
||||
LONG(0)
|
||||
___CTOR_END__ = .;
|
||||
___DTOR_LIST__ = .;
|
||||
LONG((___DTOR_END__ - ___DTOR_LIST__) / 4 - 2)
|
||||
*(.dtors)
|
||||
LONG(0)
|
||||
___DTOR_END__ = .;
|
||||
}
|
||||
.data SIZEOF(.text) + ADDR(.text):
|
||||
{
|
||||
*(.data)
|
||||
CONSTRUCTORS
|
||||
_edata = .;
|
||||
}
|
||||
.bss SIZEOF(.data) + ADDR(.data):
|
||||
{
|
||||
_bss_start = .;
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
_end = .;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
/* mon960 syscall.h file. This is used only by the simulator. This matches
|
||||
the syscall numbers used by mon-syscalls.S, but is otherwise a copy of
|
||||
the libgloss/syscall.h file. */
|
||||
/* ??? This file should be used by mon-syscalls.S to avoid maintenance
|
||||
problems. */
|
||||
|
||||
#ifndef LIBGLOSS_SYSCALL_H
|
||||
#define LIBGLOSS_SYSCALL_H
|
||||
|
||||
/* Note: This file may be included by assembler source. */
|
||||
|
||||
/* These should be as small as possible to allow a port to use a trap type
|
||||
instruction, which the system call # as the trap (the d10v for instance
|
||||
supports traps 0..31). An alternative would be to define one trap for doing
|
||||
system calls, and put the system call number in a register that is not used
|
||||
for the normal calling sequence (so that you don't have to shift down the
|
||||
arguments to add the system call number). Obviously, if these system call
|
||||
numbers are ever changed, all of the simulators and potentially user code
|
||||
will need to be updated. */
|
||||
|
||||
/* There is no current need for the following: SYS_execv, SYS_creat, SYS_wait,
|
||||
etc. etc. Don't add them. */
|
||||
|
||||
/* These are required by the ANSI C part of newlib (excluding system() of
|
||||
course). */
|
||||
#define SYS_exit 257
|
||||
#define SYS_open 230
|
||||
#define SYS_close 234
|
||||
#define SYS_read 231
|
||||
#define SYS_write 232
|
||||
#define SYS_lseek 233
|
||||
|
||||
/* ??? The following system calls apparently aren't support by mon960. */
|
||||
#define SYS_unlink 7
|
||||
#define SYS_getpid 8
|
||||
#define SYS_kill 9
|
||||
#define SYS_fstat 10
|
||||
/*#define SYS_sbrk 11 - not currently a system call, but reserved. */
|
||||
|
||||
/* ARGV support. */
|
||||
#define SYS_argvlen 12
|
||||
#define SYS_argv 13
|
||||
|
||||
/* These are extras added for one reason or another. */
|
||||
#define SYS_chdir 14
|
||||
#define SYS_stat 15
|
||||
#define SYS_chmod 16
|
||||
#define SYS_utime 17
|
||||
#define SYS_time 18
|
||||
|
||||
#endif
|
|
@ -0,0 +1,27 @@
|
|||
/* isatty.c -- chek the terminal device.
|
||||
*
|
||||
* Copyright (c) 1995 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"
|
||||
|
||||
/*
|
||||
* isatty -- returns 1 if connected to a terminal device,
|
||||
* returns 0 if not. Since we're hooked up to a
|
||||
* serial port, we'll say yes _AND return a 1.
|
||||
*/
|
||||
int
|
||||
_DEFUN (isatty, (fd),
|
||||
int fd)
|
||||
{
|
||||
return (1);
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
/* kill.c -- remove a process.
|
||||
*
|
||||
* Copyright (c) 1995 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;
|
||||
}
|
|
@ -0,0 +1,144 @@
|
|||
# Copyright (c) 1998 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.
|
||||
|
||||
VPATH = @srcdir@
|
||||
srcdir = @srcdir@
|
||||
objdir = .
|
||||
srcroot = $(srcdir)/../..
|
||||
objroot = $(objdir)/../..
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
host_alias = @host_alias@
|
||||
target_alias = @target_alias@
|
||||
program_transform_name = @program_transform_name@
|
||||
|
||||
bindir = @bindir@
|
||||
libdir = @libdir@
|
||||
tooldir = $(exec_prefix)/$(target_alias)
|
||||
|
||||
# Multilib support variables.
|
||||
# TOP is used instead of MULTI{BUILD,SRC}TOP.
|
||||
MULTIDIRS =
|
||||
MULTISUBDIR =
|
||||
MULTIDO = true
|
||||
MULTICLEAN = true
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
CC = @CC@
|
||||
|
||||
#AS = @AS@
|
||||
AS = `if [ -f ${objroot}/../gas/as.new ] ; \
|
||||
then echo ${objroot}/../gas/as.new ; \
|
||||
else echo as ; fi`
|
||||
|
||||
AR = @AR@
|
||||
|
||||
#LD = @LD@
|
||||
LD = `if [ -f ${objroot}/../ld/ld.new ] ; \
|
||||
then echo ${objroot}/../ld/ld.new ; \
|
||||
else echo ld ; fi`
|
||||
|
||||
RANLIB = @RANLIB@
|
||||
|
||||
OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \
|
||||
then echo ${objroot}/../binutils/objdump ; \
|
||||
else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi`
|
||||
OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \
|
||||
then echo ${objroot}/../binutils/objcopy ; \
|
||||
else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi`
|
||||
|
||||
# object files needed
|
||||
OBJS = close.o environ.o execve.o fork.o fstat.o getpid.o gettod.o isatty.o \
|
||||
kill.o link.o lseek.o open.o read.o sbrk.o stat.o \
|
||||
times.o unlink.o wait.o write.o
|
||||
|
||||
# Object files specific to particular targets.
|
||||
EVALOBJS = ${OBJS}
|
||||
|
||||
GCC_LDFLAGS = `if [ -d ${objroot}/../gcc ] ; \
|
||||
then echo -L${objroot}/../gcc ; fi`
|
||||
|
||||
OUTPUTS = libnosys.a
|
||||
|
||||
NEWLIB_CFLAGS = `if [ -d ${objroot}/newlib ]; then echo -I${objroot}/newlib/targ-include -I${srcroot}/newlib/libc/include; fi`
|
||||
NEWLIB_LDFLAGS = `if [ -d ${objroot}/newlib ]; then echo -B${objroot}/newlib/ -L${objroot}/newlib/; fi`
|
||||
|
||||
INCLUDES = -I. -I$(srcdir)/..
|
||||
# Note that when building the library, ${MULTILIB} is not the way multilib
|
||||
# options are passed; they're passed in $(CFLAGS).
|
||||
CFLAGS_FOR_TARGET = ${MULTILIB} ${INCLUDES} ${NEWLIB_CFLAGS}
|
||||
LDFLAGS_FOR_TARGET = ${MULTILIB} ${NEWLIB_LDFLAGS}
|
||||
AR_FLAGS = qc
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $<
|
||||
|
||||
.C.o:
|
||||
$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $<
|
||||
.s.o:
|
||||
$(AS) $(ASFLAGS_FOR_TARGET) $(INCLUDES) $(ASFLAGS) -o $*.o $<
|
||||
|
||||
#
|
||||
# GCC knows to run the preprocessor on .S files before it assembles them.
|
||||
#
|
||||
.S.o:
|
||||
$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) $(CFLAGS) -c $<
|
||||
|
||||
#
|
||||
# this is a bogus target that'll produce an assembler from the
|
||||
# C source with the right compiler options. this is so we can
|
||||
# track down code generation or debug symbol bugs.
|
||||
#
|
||||
.c.s:
|
||||
$(CC) $(CFLAGS_FOR_TARGET) -S $(INCLUDES) $(CFLAGS) $<
|
||||
|
||||
all: ${OUTPUTS}
|
||||
|
||||
#
|
||||
# here's where we build the library for each target
|
||||
#
|
||||
|
||||
libnosys.a: $(EVALOBJS)
|
||||
${AR} ${ARFLAGS} $@ $(EVALOBJS)
|
||||
${RANLIB} $@
|
||||
|
||||
doc:
|
||||
|
||||
clean mostlyclean:
|
||||
rm -f $(OUTPUTS) *.i *~ *.o *-test *.srec *.dis *.map *.x
|
||||
|
||||
distclean maintainer-clean realclean: clean
|
||||
rm -f Makefile config.status $(OUTPUTS)
|
||||
|
||||
.PHONY: install info install-info clean-info
|
||||
install:
|
||||
@for outputs in ${OUTPUTS}; do\
|
||||
mkdir -p $(tooldir)/lib${MULTISUBDIR}; \
|
||||
$(INSTALL_PROGRAM) $${outputs} $(tooldir)/lib${MULTISUBDIR}; \
|
||||
done
|
||||
|
||||
info:
|
||||
install-info:
|
||||
clean-info:
|
||||
|
||||
Makefile: Makefile.in config.status @host_makefile_frag_path@
|
||||
$(SHELL) config.status
|
||||
|
||||
config.status: configure
|
||||
$(SHELL) config.status --recheck
|
|
@ -0,0 +1,23 @@
|
|||
/* Name of package. */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Version of package. */
|
||||
#undef VERSION
|
||||
|
||||
/* Missing syscall names */
|
||||
#undef MISSING_SYSCALL_NAMES
|
||||
|
||||
/* Using ELF format */
|
||||
#undef HAVE_ELF
|
||||
|
||||
/* Using GNU LD */
|
||||
#undef HAVE_GNU_LD
|
||||
|
||||
/* .previous directive allowed */
|
||||
#undef HAVE_ASM_PREVIOUS_DIRECTIVE
|
||||
|
||||
/* .pushsection/.popsection directives allowed */
|
||||
#undef HAVE_ASM_POPSECTION_DIRECTIVE
|
||||
|
||||
/* symbol prefix */
|
||||
#undef __SYMBOL_PREFIX
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* Stub version of close.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <_ansi.h>
|
||||
#include <_syslist.h>
|
||||
#include <errno.h>
|
||||
#undef errno
|
||||
extern int errno;
|
||||
#include "warning.h"
|
||||
|
||||
int
|
||||
_DEFUN (_close, (fildes),
|
||||
int fildes)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
stub_warning (_close)
|
|
@ -0,0 +1,19 @@
|
|||
/* config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
|
||||
/* Missing syscall names */
|
||||
#undef MISSING_SYSCALL_NAMES
|
||||
|
||||
/* Using ELF format */
|
||||
#undef HAVE_ELF
|
||||
|
||||
/* Using GNU LD */
|
||||
#undef HAVE_GNU_LD
|
||||
|
||||
/* .previous directive allowed */
|
||||
#undef HAVE_ASM_PREVIOUS_DIRECTIVE
|
||||
|
||||
/* .pushsection/.popsection directives allowed */
|
||||
#undef HAVE_ASM_POPSECTION_DIRECTIVE
|
||||
|
||||
/* symbol prefix */
|
||||
#undef __SYMBOL_PREFIX
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,206 @@
|
|||
# Copyright (c) 1995, 1996 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.
|
||||
#
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
#
|
||||
AC_PREREQ(2.5)dnl
|
||||
AC_INIT(close.c)
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
|
||||
if test "${enable_shared}" = "yes" ; then
|
||||
echo "Shared libraries not supported for cross compiling, ignored"
|
||||
fi
|
||||
|
||||
if test "$srcdir" = "." ; then
|
||||
if test "${with_target_subdir}" != "." ; then
|
||||
libgloss_topdir="${srcdir}/${with_multisrctop}../../.."
|
||||
else
|
||||
libgloss_topdir="${srcdir}/${with_multisrctop}../.."
|
||||
fi
|
||||
else
|
||||
libgloss_topdir="${srcdir}/../.."
|
||||
fi
|
||||
AC_CONFIG_AUX_DIR($libgloss_topdir)
|
||||
|
||||
AC_CANONICAL_SYSTEM
|
||||
AC_ARG_PROGRAM
|
||||
|
||||
AC_PROG_INSTALL
|
||||
|
||||
# FIXME: We temporarily define our own version of AC_PROG_CC. This is
|
||||
# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
|
||||
# are building a library that must be included in all links, so we
|
||||
# can't link an executable until this lib is built.
|
||||
# autoconf should provide a way to do this.
|
||||
|
||||
AC_DEFUN(LIB_AC_PROG_CC,
|
||||
[AC_BEFORE([$0], [AC_PROG_CPP])dnl
|
||||
AC_CHECK_PROG(CC, gcc, gcc)
|
||||
if test -z "$CC"; then
|
||||
AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
|
||||
test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
|
||||
fi
|
||||
|
||||
AC_PROG_CC_GNU
|
||||
|
||||
if test $ac_cv_prog_gcc = yes; then
|
||||
GCC=yes
|
||||
dnl Check whether -g works, even if CFLAGS is set, in case the package
|
||||
dnl plays around with CFLAGS (such as to build both debugging and
|
||||
dnl normal versions of a library), tasteless as that idea is.
|
||||
ac_test_CFLAGS="${CFLAGS+set}"
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
CFLAGS=
|
||||
AC_PROG_CC_G
|
||||
if test "$ac_test_CFLAGS" = set; then
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
elif test $ac_cv_prog_cc_g = yes; then
|
||||
CFLAGS="-g -O2"
|
||||
else
|
||||
CFLAGS="-O2"
|
||||
fi
|
||||
else
|
||||
GCC=
|
||||
test "${CFLAGS+set}" = set || CFLAGS="-g"
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFINE(HAVE_GNU_LD)
|
||||
dnl Make sure syscall names match those being used by newlib
|
||||
case "${target}" in
|
||||
*-*-cygwin*)
|
||||
;;
|
||||
a29k-amd-udi)
|
||||
;;
|
||||
arc-*-*)
|
||||
;;
|
||||
arm-*-pe)
|
||||
;;
|
||||
arm-*-*)
|
||||
;;
|
||||
strongarm-*-*)
|
||||
;;
|
||||
d10v*)
|
||||
;;
|
||||
h8300*-*-*)
|
||||
;;
|
||||
h8500-*-*)
|
||||
;;
|
||||
i[3456]86-*-sco*)
|
||||
;;
|
||||
m32r-*-*)
|
||||
;;
|
||||
mn10?00-*-*)
|
||||
;;
|
||||
powerpcle-*-pe)
|
||||
;;
|
||||
sh*-*-*)
|
||||
;;
|
||||
sparc-sun-sunos*)
|
||||
;;
|
||||
sparc64-*-*)
|
||||
;;
|
||||
thumb-*-pe)
|
||||
;;
|
||||
thumb-*-*)
|
||||
;;
|
||||
v850-*-*)
|
||||
;;
|
||||
v850e-*-*)
|
||||
;;
|
||||
v850ea-*-*)
|
||||
;;
|
||||
w65-*-*)
|
||||
;;
|
||||
z8k-*-*)
|
||||
;;
|
||||
*)
|
||||
AC_DEFINE(MISSING_SYSCALL_NAMES)
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl Make sure we know if elf format used
|
||||
case "${target}" in
|
||||
*-*-elf)
|
||||
AC_DEFINE(HAVE_ELF)
|
||||
|
||||
AC_CACHE_CHECK(for .previous assembler directive,
|
||||
libc_cv_asm_previous_directive, [dnl
|
||||
cat > conftest.s <<EOF
|
||||
.section foo_section
|
||||
.previous
|
||||
EOF
|
||||
if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AC_FD_CC); then
|
||||
AC_DEFINE(HAVE_ASM_PREVIOUS_DIRECTIVE)
|
||||
else
|
||||
rm -f conftest*])
|
||||
AC_CACHE_CHECK(for .popsection assembler directive,
|
||||
libc_cv_asm_popsection_directive, [dnl
|
||||
cat > conftest.s <<EOF
|
||||
.pushsection foo_section
|
||||
.popsection
|
||||
EOF
|
||||
if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AC_FD_CC); then
|
||||
AC_DEFINE(HAVE_ASM_POPSECTION_DIRECTIVE)
|
||||
fi
|
||||
fi
|
||||
rm -f conftest*])
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_CACHE_CHECK(for function prefix, libc_dollar_prefix, [dnl
|
||||
cat > conftest.c <<\EOF
|
||||
foo () { }
|
||||
EOF
|
||||
dnl
|
||||
if AC_TRY_COMMAND([${CC-cc} -S conftest.c -o - | fgrep "\$foo" > /dev/null]);
|
||||
then
|
||||
libc_dollar_prefix=yes
|
||||
else
|
||||
libc_dollar_prefix=no
|
||||
fi
|
||||
rm -f conftest* ])
|
||||
if test $libc_dollar_prefix = yes ; then
|
||||
AC_DEFINE(__SYMBOL_PREFIX, "$")
|
||||
else
|
||||
AC_DEFINE(__SYMBOL_PREFIX, "")
|
||||
fi
|
||||
|
||||
LIB_AC_PROG_CC
|
||||
AS=${AS-as}
|
||||
AC_SUBST(AS)
|
||||
AR=${AR-ar}
|
||||
AC_SUBST(AR)
|
||||
LD=${LD-ld}
|
||||
AC_SUBST(LD)
|
||||
AC_PROG_RANLIB
|
||||
|
||||
host_makefile_frag=${srcdir}/../config/default.mh
|
||||
|
||||
dnl We have to assign the same value to other variables because autoconf
|
||||
dnl doesn't provide a mechanism to substitute a replacement keyword with
|
||||
dnl arbitrary data or pathnames.
|
||||
dnl
|
||||
host_makefile_frag_path=$host_makefile_frag
|
||||
AC_SUBST(host_makefile_frag_path)
|
||||
AC_SUBST_FILE(host_makefile_frag)
|
||||
|
||||
AC_OUTPUT(Makefile,
|
||||
ac_file=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}
|
||||
)
|
||||
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
/*
|
||||
* Version of environ for no OS.
|
||||
*/
|
||||
|
||||
char *__env[1] = { 0 };
|
||||
char **environ = __env;
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Stub version of execve.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <_ansi.h>
|
||||
#include <_syslist.h>
|
||||
#include <errno.h>
|
||||
#undef errno
|
||||
extern int errno;
|
||||
#include "warning.h"
|
||||
|
||||
int
|
||||
_DEFUN (_execve, (name, argv, env),
|
||||
char *name _AND
|
||||
char **argv _AND
|
||||
char **env)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
stub_warning(_execve)
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* Stub version of fork.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <_ansi.h>
|
||||
#include <_syslist.h>
|
||||
#include <errno.h>
|
||||
#undef errno
|
||||
extern int errno;
|
||||
#include "warning.h"
|
||||
|
||||
int
|
||||
_DEFUN (_fork, (),
|
||||
_NOARGS)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
stub_warning(_fork)
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Stub version of fstat.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <_ansi.h>
|
||||
#include <_syslist.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#undef errno
|
||||
extern int errno;
|
||||
#include "warning.h"
|
||||
|
||||
int
|
||||
_DEFUN (_fstat, (fildes, st),
|
||||
int fildes _AND
|
||||
struct stat *st)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
stub_warning(_fstat)
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* Stub version of getpid.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <_ansi.h>
|
||||
#include <_syslist.h>
|
||||
#include <errno.h>
|
||||
#undef errno
|
||||
extern int errno;
|
||||
#include "warning.h"
|
||||
|
||||
int
|
||||
_DEFUN (_getpid, (),
|
||||
_NOARGS)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
stub_warning(_getpid)
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Stub version of gettimeofday.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <_ansi.h>
|
||||
#include <_syslist.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/times.h>
|
||||
#include <errno.h>
|
||||
#undef errno
|
||||
extern int errno;
|
||||
#include "warning.h"
|
||||
|
||||
struct timeval;
|
||||
struct timezone;
|
||||
|
||||
int
|
||||
_DEFUN (_gettimeofday, (ptimeval, ptimezone),
|
||||
struct timeval *ptimeval _AND
|
||||
struct timezone *ptimezone)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
stub_warning(_gettimeofday)
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* Stub version of isatty.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <_ansi.h>
|
||||
#include <_syslist.h>
|
||||
#include <errno.h>
|
||||
#undef errno
|
||||
extern int errno;
|
||||
#include "warning.h"
|
||||
|
||||
int
|
||||
_DEFUN (isatty, (file),
|
||||
int file)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return 0;
|
||||
}
|
||||
|
||||
stub_warning(isatty)
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* Stub version of kill.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <_ansi.h>
|
||||
#include <_syslist.h>
|
||||
#include <errno.h>
|
||||
#undef errno
|
||||
extern int errno;
|
||||
#include "warning.h"
|
||||
|
||||
int
|
||||
_DEFUN (_kill, (pid, sig),
|
||||
int pid _AND
|
||||
int sig)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
stub_warning(_kill)
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* Stub version of link.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <_ansi.h>
|
||||
#include <_syslist.h>
|
||||
#include <errno.h>
|
||||
#undef errno
|
||||
extern int errno;
|
||||
#include "warning.h"
|
||||
|
||||
int
|
||||
_DEFUN (_link, (existing, new),
|
||||
char *existing _AND
|
||||
char *new)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
stub_warning(_link)
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Stub version of lseek.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <_ansi.h>
|
||||
#include <_syslist.h>
|
||||
#include <errno.h>
|
||||
#undef errno
|
||||
extern int errno;
|
||||
#include "warning.h"
|
||||
|
||||
int
|
||||
_DEFUN (_lseek, (file, ptr, dir),
|
||||
int file _AND
|
||||
int ptr _AND
|
||||
int dir)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
stub_warning(_lseek)
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Stub version of open.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <_ansi.h>
|
||||
#include <_syslist.h>
|
||||
#include <errno.h>
|
||||
#undef errno
|
||||
extern int errno;
|
||||
#include "warning.h"
|
||||
|
||||
int
|
||||
_DEFUN (_open, (file, flags, mode),
|
||||
char *file _AND
|
||||
int flags _AND
|
||||
int mode)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
stub_warning(_open)
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Stub version of read.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <_ansi.h>
|
||||
#include <_syslist.h>
|
||||
#include <errno.h>
|
||||
#undef errno
|
||||
extern int errno;
|
||||
#include "warning.h"
|
||||
|
||||
int
|
||||
_DEFUN (_read, (file, ptr, len),
|
||||
int file _AND
|
||||
char *ptr _AND
|
||||
int len)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
stub_warning(_read)
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Version of sbrk for no operating system.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <_ansi.h>
|
||||
#include <_syslist.h>
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
#undef errno
|
||||
extern int errno;
|
||||
|
||||
caddr_t
|
||||
_DEFUN (_sbrk, (incr),
|
||||
int incr)
|
||||
{
|
||||
extern char end; /* set by linker */
|
||||
static char *heap_end;
|
||||
char *prev_heap_end;
|
||||
|
||||
if (heap_end == 0) {
|
||||
heap_end = &end;
|
||||
}
|
||||
prev_heap_end = heap_end;
|
||||
heap_end += incr;
|
||||
return (caddr_t) prev_heap_end;
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Stub version of stat.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <_ansi.h>
|
||||
#include <_syslist.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#undef errno
|
||||
extern int errno;
|
||||
#include "warning.h"
|
||||
|
||||
int
|
||||
_DEFUN (_stat, (file, st),
|
||||
const char *file _AND
|
||||
struct stat *st)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
stub_warning(_stat)
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* Stub version of times.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <_ansi.h>
|
||||
#include <_syslist.h>
|
||||
#include <sys/times.h>
|
||||
#include <errno.h>
|
||||
#undef errno
|
||||
extern int errno;
|
||||
#include "warning.h"
|
||||
|
||||
clock_t
|
||||
_DEFUN (_times, (buf),
|
||||
struct tms *buf)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
stub_warning(_times)
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* Stub version of unlink.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <_ansi.h>
|
||||
#include <_syslist.h>
|
||||
#include <errno.h>
|
||||
#undef errno
|
||||
extern int errno;
|
||||
#include "warning.h"
|
||||
|
||||
int
|
||||
_DEFUN (_unlink, (name),
|
||||
char *name)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
stub_warning(_unlink)
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* Stub version of wait.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <_ansi.h>
|
||||
#include <_syslist.h>
|
||||
#include <errno.h>
|
||||
#undef errno
|
||||
extern int errno;
|
||||
#include "warning.h"
|
||||
|
||||
int
|
||||
_DEFUN (_wait, (status),
|
||||
int *status)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
stub_warning(_wait)
|
|
@ -0,0 +1,39 @@
|
|||
#ifndef __WARNING_H__
|
||||
#define __WARNING_H__
|
||||
|
||||
#ifdef HAVE_GNU_LD
|
||||
# ifdef HAVE_ELF
|
||||
|
||||
/* We want the .gnu.warning.SYMBOL section to be unallocated. */
|
||||
# ifdef HAVE_ASM_PREVIOUS_DIRECTIVE
|
||||
# define __make_section_unallocated(section_string) \
|
||||
asm(".section " section_string "; .previous");
|
||||
# elif defined (HAVE_ASM_POPSECTION_DIRECTIVE)
|
||||
# define __make_section_unallocated(section_string) \
|
||||
asm(".pushsection " section_string "; .popsection");
|
||||
# else
|
||||
# define __make_section_unallocated(section_string)
|
||||
# endif
|
||||
|
||||
# define link_warning(symbol, msg) \
|
||||
__make_section_unallocated (".gnu.warning." #symbol) \
|
||||
static const char __evoke_link_warning_##symbol[] \
|
||||
__attribute__ ((section (".gnu.warning." #symbol))) = msg;
|
||||
|
||||
#else /* !ELF */
|
||||
|
||||
# define link_warning(symbol, msg) \
|
||||
asm(".stabs \"" msg "\",30,0,0,0\n" \
|
||||
".stabs \"" __SYMBOL_PREFIX #symbol "\",1,0,0,0\n");
|
||||
# endif
|
||||
#else /* !GNULD */
|
||||
/* We will never be heard; they will all die horribly. */
|
||||
# define link_warning(symbol, msg)
|
||||
#endif
|
||||
|
||||
/* A canned warning for sysdeps/stub functions. */
|
||||
#define stub_warning(name) \
|
||||
link_warning (name, \
|
||||
"warning: " #name " is not implemented and will always fail")
|
||||
|
||||
#endif /* __WARNING_H__ */
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Stub version of write.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <_ansi.h>
|
||||
#include <_syslist.h>
|
||||
#include <errno.h>
|
||||
#undef errno
|
||||
extern int errno;
|
||||
#include "warning.h"
|
||||
|
||||
int
|
||||
_DEFUN (_write, (file, ptr, len),
|
||||
int file _AND
|
||||
char *ptr _AND
|
||||
int len)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
stub_warning(_write)
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
/* lseek.c -- move read/write pointer.
|
||||
*
|
||||
* Copyright (c) 1995 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);
|
||||
}
|
||||
|
|
@ -0,0 +1,144 @@
|
|||
# Makefile for libgloss/m32r
|
||||
# Copyright (c) 1996, 1998 Cygnus Support.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms are permitted
|
||||
# provided that the above copyright notice and this paragraph are
|
||||
# duplicated in all such forms and that any documentation,
|
||||
# advertising materials, and other materials related to such
|
||||
# distribution and use acknowledge that the software was developed
|
||||
# at Cygnus Support, Inc. Cygnus Support, Inc. may not be used to
|
||||
# endorse or promote products derived from this software without
|
||||
# specific prior written permission.
|
||||
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
VPATH = @srcdir@
|
||||
srcdir = @srcdir@
|
||||
objdir = .
|
||||
srcroot = $(srcdir)/../..
|
||||
objroot = $(objdir)/../..
|
||||
|
||||
host_alias = @host_alias@
|
||||
target_alias = @target_alias@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
bindir = @bindir@
|
||||
libdir = @libdir@
|
||||
tooldir = $(exec_prefix)/$(target_alias)
|
||||
|
||||
TOP = ../..
|
||||
SRCTOP = ../..
|
||||
|
||||
# Multilib support variables.
|
||||
# TOP is used instead of MULTI{BUILD,SRC}TOP.
|
||||
MULTISRCTOP =
|
||||
MULTIBUILDTOP =
|
||||
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 = qv
|
||||
BISON = bison
|
||||
MAKEINFO = makeinfo
|
||||
|
||||
.NOEXPORT:
|
||||
MAKEOVERRIDES=
|
||||
|
||||
TARGETDOC = ../../targetdep.tex
|
||||
|
||||
CRT0 = crt0.o
|
||||
GDBLIB = m32r-lib.o
|
||||
GDBSTUB = m32r-stub.o
|
||||
EVASCRIPT = eva.ld
|
||||
STUBSCRIPT = eva-stub.ld
|
||||
|
||||
GENERIC_LIBOBJS = \
|
||||
chmod.o close.o exit.o fstat.o getpid.o isatty.o kill.o lseek.o \
|
||||
open.o raise.o read.o sbrk.o stat.o unlink.o utime.o write.o
|
||||
|
||||
LIBOBJS = trap0.o $(GENERIC_LIBOBJS)
|
||||
LIBGLOSS = libgloss.a
|
||||
|
||||
MONLIBOBJS = trapmon0.o $(GENERIC_LIBOBJS)
|
||||
MONLIBGLOSS = libmon.a
|
||||
MONSPECS = mon.specs
|
||||
|
||||
# Host specific makefile fragment comes in here.
|
||||
@host_makefile_frag@
|
||||
|
||||
all: $(CRT0) $(LIBGLOSS) $(MONLIBGLOSS) $(GDBLIB) $(GDBSTUB)
|
||||
|
||||
m32r-stub.o: $(srcdir)/$(MULTISRCTOP)../../gdb/m32r-stub.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $(srcdir)/$(MULTISRCTOP)../../gdb/m32r-stub.c
|
||||
|
||||
libgloss.a: $(LIBOBJS)
|
||||
$(AR) $(ARFLAGS) $@ $(LIBOBJS)
|
||||
$(RANLIB) $@
|
||||
|
||||
libmon.a: $(MONLIBOBJS)
|
||||
$(AR) $(ARFLAGS) $@ $(MONLIBOBJS)
|
||||
$(RANLIB) $@
|
||||
|
||||
install:
|
||||
$(INSTALL_DATA) $(CRT0) $(tooldir)/lib${MULTISUBDIR}/$(CRT0)
|
||||
$(INSTALL_DATA) $(LIBGLOSS) $(tooldir)/lib${MULTISUBDIR}/$(LIBGLOSS)
|
||||
$(INSTALL_DATA) $(MONLIBGLOSS) $(tooldir)/lib${MULTISUBDIR}/$(MONLIBGLOSS)
|
||||
$(INSTALL_DATA) $(GDBLIB) $(tooldir)/lib${MULTISUBDIR}/$(GDBLIB)
|
||||
$(INSTALL_DATA) $(GDBSTUB) $(tooldir)/lib${MULTISUBDIR}/$(GDBSTUB)
|
||||
$(INSTALL_DATA) $(srcdir)/$(EVASCRIPT) $(tooldir)/lib/$(EVASCRIPT)
|
||||
$(INSTALL_DATA) $(srcdir)/$(STUBSCRIPT) $(tooldir)/lib/$(STUBSCRIPT)
|
||||
$(INSTALL_DATA) $(srcdir)/$(MONSPECS) $(tooldir)/lib/$(MONSPECS)
|
||||
|
||||
clean mostlyclean:
|
||||
rm -f *~ *.[oa]
|
||||
|
||||
distclean maintainer-clean realclean: clean
|
||||
rm -f Makefile config.status
|
||||
|
||||
info doc:
|
||||
install-info:
|
||||
clean-info:
|
||||
|
||||
Makefile: Makefile.in config.status @host_makefile_frag_path@
|
||||
$(SHELL) config.status
|
||||
|
||||
config.status: configure
|
||||
$(SHELL) config.status --recheck
|
||||
|
||||
# to support SunOS VPATH
|
||||
crt0.o: crt0.S
|
||||
m32r-lib.o: m32r-lib.c
|
||||
chmod.o: chmod.c
|
||||
close.o: close.c
|
||||
exit.o: exit.c
|
||||
fstat.o: fstat.c
|
||||
getpid.o: getpid.c
|
||||
isatty.o: isatty.c
|
||||
kill.o: kill.c
|
||||
lseek.o: lseek.c
|
||||
open.o: open.c
|
||||
raise.o: raise.c
|
||||
read.o: read.c
|
||||
sbrk.o: sbrk.c
|
||||
stat.o: stat.c
|
||||
unlink.o: unlink.c
|
||||
utime.o: utime.c
|
||||
write.o: write.c
|
||||
trap0.o: trap0.S
|
||||
trapmon0.o: trapmon0.c
|
|
@ -0,0 +1,10 @@
|
|||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "syscall.h"
|
||||
#include "eit.h"
|
||||
|
||||
int
|
||||
_chmod (const char *path, short mode)
|
||||
{
|
||||
return TRAP0 (SYS_chmod, path, mode, 0);
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue