summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorcvs2svn <cvs2svn@FreeBSD.org>1999-12-20 00:16:49 +0000
committercvs2svn <cvs2svn@FreeBSD.org>1999-12-20 00:16:49 +0000
commit7a85407ad7dfbbdae7987bcff091bb36a6b83aee (patch)
tree9ccdf2f6c69e071e12b04d872ba911157a73d7a3 /contrib
parent37af766bc526e3dfbf5ab01dc560bd01e1adffe6 (diff)
Diffstat (limited to 'contrib')
-rw-r--r--contrib/amd/ChangeLog1812
-rw-r--r--contrib/amd/amd/amd.82
-rw-r--r--contrib/amd/amd/amd.c2
-rw-r--r--contrib/amd/amd/amq_subr.c2
-rw-r--r--contrib/amd/amd/get_args.c2
-rw-r--r--contrib/amd/amd/srvr_nfs.c2
-rw-r--r--contrib/amd/amq/amq.82
-rw-r--r--contrib/amd/amq/amq.c2
-rw-r--r--contrib/amd/amq/pawd.12
-rw-r--r--contrib/amd/conf/nfs_prot/nfs_prot_freebsd2.h2
-rw-r--r--contrib/amd/conf/nfs_prot/nfs_prot_freebsd3.h2
-rw-r--r--contrib/amd/fixmount/fixmount.82
-rw-r--r--contrib/amd/fixmount/fixmount.c2
-rw-r--r--contrib/amd/fsinfo/fsinfo.82
-rw-r--r--contrib/amd/fsinfo/fsinfo.c2
-rw-r--r--contrib/amd/hlfsd/hlfsd.82
-rw-r--r--contrib/amd/hlfsd/hlfsd.c2
-rw-r--r--contrib/amd/hlfsd/homedir.c2
-rw-r--r--contrib/amd/include/am_defs.h2
-rw-r--r--contrib/amd/libamu/mount_fs.c2
-rw-r--r--contrib/amd/mk-amd-map/mk-amd-map.82
-rw-r--r--contrib/amd/mk-amd-map/mk-amd-map.c2
-rw-r--r--contrib/amd/scripts/amd.conf.52
-rw-r--r--contrib/amd/wire-test/wire-test.82
-rw-r--r--contrib/amd/wire-test/wire-test.c2
-rw-r--r--contrib/awk/FREEBSD-upgrade2
-rw-r--r--contrib/awk/awk.h2
-rw-r--r--contrib/awk/builtin.c2
-rw-r--r--contrib/awk/doc/awk.12
-rw-r--r--contrib/awk/eval.c2
-rw-r--r--contrib/awk/field.c2
-rw-r--r--contrib/awk/io.c2
-rw-r--r--contrib/awk/main.c2
-rw-r--r--contrib/awk/node.c2
-rw-r--r--contrib/bind/bin/named-xfer/named-xfer.c2
-rw-r--r--contrib/bind/bin/named/Makefile2
-rw-r--r--contrib/bind/bin/nslookup/commands.l2
-rw-r--r--contrib/bind/bin/nslookup/debug.c2
-rw-r--r--contrib/bind/bin/nslookup/getinfo.c2
-rw-r--r--contrib/bind/bin/nslookup/main.c2
-rw-r--r--contrib/bind/doc/man/dig.12
-rw-r--r--contrib/bind/port/freebsd/include/port_after.h2
-rw-r--r--contrib/binutils/bfd/VERSION1
-rw-r--r--contrib/binutils/bfd/doc/bfd.texi585
-rw-r--r--contrib/binutils/gas/conf.in127
-rw-r--r--contrib/binutils/gas/config/i386coff.mt1
-rw-r--r--contrib/binutils/gas/config/sco5.mt1
-rwxr-xr-xcontrib/binutils/install.sh247
-rw-r--r--contrib/cvs/FREEBSD-upgrade2
-rw-r--r--contrib/cvs/contrib/log.pl2
-rw-r--r--contrib/cvs/diff/diff3.c2
-rw-r--r--contrib/cvs/lib/md5.h2
-rw-r--r--contrib/cvs/man/cvs.12
-rw-r--r--contrib/cvs/src/commit.c2
-rw-r--r--contrib/cvs/src/cvs.h2
-rw-r--r--contrib/cvs/src/diff.c2
-rw-r--r--contrib/cvs/src/filesubr.c2
-rw-r--r--contrib/cvs/src/import.c2
-rw-r--r--contrib/cvs/src/lock.c2
-rw-r--r--contrib/cvs/src/login.c2
-rw-r--r--contrib/cvs/src/logmsg.c2
-rw-r--r--contrib/cvs/src/main.c2
-rw-r--r--contrib/cvs/src/mkmodules.c2
-rw-r--r--contrib/cvs/src/prepend_args.c2
-rw-r--r--contrib/cvs/src/prepend_args.h2
-rw-r--r--contrib/cvs/src/rcs.c2
-rw-r--r--contrib/cvs/src/rcs.h2
-rw-r--r--contrib/cvs/src/rcscmds.c2
-rw-r--r--contrib/cvs/src/recurse.c2
-rw-r--r--contrib/cvs/src/server.c2
-rw-r--r--contrib/cvs/src/update.c2
-rw-r--r--contrib/diff/diff.c2
-rw-r--r--contrib/diff/prepend_args.c2
-rw-r--r--contrib/diff/prepend_args.h2
-rw-r--r--contrib/gcc/INSTALL1898
-rw-r--r--contrib/gcc/config/alpha/config-nt.sed33
-rw-r--r--contrib/gcc/config/alpha/win-nt.h72
-rw-r--r--contrib/gcc/config/alpha/xm-winnt.h35
-rw-r--r--contrib/gcc/config/i386/freebsd.h2
-rw-r--r--contrib/gcc/config/i386/freebsd.h.fixed570
-rw-r--r--contrib/gcc/config/t-linux10
-rw-r--r--contrib/gcc/config/t-linux-gnulibc113
-rw-r--r--contrib/gdb/gdb/29k-share/README9
-rw-r--r--contrib/gdb/gdb/29k-share/udi_soc9
-rw-r--r--contrib/gdb/gdb/config/mips/tm-tx39.h39
-rw-r--r--contrib/gdb/gdb/config/mips/tm-tx39l.h39
-rw-r--r--contrib/gdb/gdb/config/mips/tm-vr4100.h25
-rw-r--r--contrib/gdb/gdb/config/mips/tm-vr5000.h23
-rw-r--r--contrib/gdb/gdb/config/mips/tm-vr5000el.h23
-rw-r--r--contrib/gdb/gdb/config/mips/tx39.mt5
-rw-r--r--contrib/gdb/gdb/config/mips/tx39l.mt5
-rw-r--r--contrib/gdb/gdb/config/mips/vr4100.mt5
-rw-r--r--contrib/gdb/gdb/config/mips/vr5000.mt7
-rw-r--r--contrib/gdb/gdb/config/mips/vr5000el.mt5
-rw-r--r--contrib/gdb/gdb/d10v-tdep.c1028
-rw-r--r--contrib/gdb/gdb/d30v-tdep.c1396
-rw-r--r--contrib/gdb/gdb/dbug-rom.c164
-rw-r--r--contrib/gdb/gdb/debugify.c109
-rw-r--r--contrib/gdb/gdb/debugify.h83
-rw-r--r--contrib/gdb/gdb/dve3900-rom.c962
-rw-r--r--contrib/gdb/gdb/mn10200-tdep.c919
-rw-r--r--contrib/gdb/gdb/mn10300-tdep.c791
-rw-r--r--contrib/gdb/gdb/ser-ocd.c209
-rw-r--r--contrib/gdb/gdb/sh-stub.c1549
-rw-r--r--contrib/gdb/gdb/sparclet-rom.c296
-rw-r--r--contrib/gdb/gdb/sparclet-stub.c1232
-rw-r--r--contrib/groff/nroff/nroff.man2
-rwxr-xr-xcontrib/groff/nroff/nroff.sh2
-rw-r--r--contrib/isc-dhcp/TODO31
-rwxr-xr-xcontrib/isc-dhcp/client/scripts/freebsd2
-rw-r--r--contrib/isc-dhcp/common/tables.c2
-rw-r--r--contrib/nvi/ex/ex.c2
-rw-r--r--contrib/perl5/ext/POSIX/POSIX.xs2
-rw-r--r--contrib/perl5/pp.c2
-rw-r--r--contrib/tcpdump/ethertype.h2
-rw-r--r--contrib/tcpdump/interface.h2
-rw-r--r--contrib/tcpdump/ppp.h2
-rw-r--r--contrib/tcpdump/print-ether.c2
-rw-r--r--contrib/tcpdump/print-ppp.c2
119 files changed, 12073 insertions, 2455 deletions
diff --git a/contrib/amd/ChangeLog b/contrib/amd/ChangeLog
index ca984a269e69..c8ef4a66c457 100644
--- a/contrib/amd/ChangeLog
+++ b/contrib/amd/ChangeLog
@@ -3716,1810 +3716,6 @@ Sat May 10 13:09:06 1997 Erez Zadok <ezk@lorien.cs.columbia.edu>
Solaris, which include NFS V3 support.
* conf/nfs_prot/nfs_prot_default.h: default NFS protocol headers.
- *** Released am-utils-6.0a15 ***
- * conf/transp/transp_{tli,sockets}.c (get_mount_client): use NFS
- protocol version while getting a mount client.
-
- * amd/ops_nfs.c (mount_nfs_fh): set the mount types, mnttab types,
- file handle size, and proper file handle based on the correct NFS
- version number.
- browsable_dirs=full, which will print *all* entries (other than
- * conf/mount/mount_svr4.c (mount_svr4): support NFS3 mounts under
- Solaris and other SVR4 systems.
-
- * amd/ops_nfs.c: store NFS file handle version and version
- specific handle in struct fh_cache.
- (got_nfs_fh): pick the correct RPC reply based on the NFS version
- of the server.
- (prime_nfs_fhandle_cache): figure out the right NFS file handle
- for a node, but now include NFS protocol version information.
- (call_mountd): set the correct version for the mount protocol,
- based on the NFS protocol version.
- (nfs_init): use the NFS protocol generic structure
- am_nfs_handle_t.
- to 1500.
- * include/am_utils.h: new structure am_nfs_handle_t to contain all
- possible versions of NFS file handles.
- * doc/am-utils.texi: fixed reversed documentation for NFS mount
- * amd/srvr_nfs.c (start_ping): ping program performs NFS version
- specific pings.
- (recompute_portmap): figure out the correct portmap version mount.
- (nfs_keepalive): call start_ping() with the correct NFS version.
- (find_nfs_srvr): if mount option "vers=" is given, use it. Get
- the NFS server version and verify that it is up.
-
- * conf/transp/transp_{tli,sockets}.c (get_nfs_version): a new
- function to find the best NFS version for a particular host.
- installing html files. Another new target "alldocs" is just for
- * libamu/amu.h: determine what is the highest version of NFS we
- should try.
-
- * include/am_utils.h (NFS_VERSION3): added definition for NFS V3
- protocol number.
- Added field fs_version to struct fserver, so we can now store the
- server protocol version.
- facility in the log_file option.
-Fri May 9 01:09:45 1997 Erez Zadok <ezk@lorien.cs.columbia.edu>
- * libamu/xutil.c (get_syslog_facility): allow users to specify the
- * aux/macros/check_field.m4 (AC_MOUNT_HEADERS): map '.' (dot) into
- underscores too, so I can test for sub-fields.
- will use the default LOG_DAEMON facility.
- * libamu/wire.c: use test that checks for sub-fields of struct
- ifreq.
-Thu Jan 8 04:05:10 1998 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-Sat May 6 10:20:17 2000 Erez Zadok <ezk@glory.soscorp.com>
- (intel).
- * port to BSD/OS 3.0 completed! Many xdr_ functions were broken
- into smaller files. M4 macros fixed to test for existence of
- file systems using getvfsbyname().
- before appending to it, on systems with two or more network
- * amd/sched.c (sigchld): signal handler must waitpid() for all
- possible children.
- the mntent for cachefs.
- * hlfsd/homedir.c: signal handler must waitpid() for all possible
- children.
- const for both arguments.
- * aux/macros/check_restartable_signals.m4: new macro to determine
- if need to reinstall signal handlers per OS is better than trying
- to figure these out based on system macros.
-
-Fri May 5 19:23:28 2000 Erez Zadok <ezk@glory.soscorp.com>
- * amq/pawd.c (cluster_server): don't use getccent() if the extern
- * amd/ops_nfs.c (mount_nfs_fh): set nfs_args_t version number.
- <cluster.h> and struct cct_entry do not exist.
- * amd/ops_afs.c (mount_toplvl): set nfs_args_t version number.
- hpux systems don't have it (hpux 10.20).
- * amd/ops_nfs.c (mount_nfs_fh): process nfs mount option resvport
- (must be supplied for bsdi 3.0)
-
- * libamu/wire.c: use HAVE_FIELD_STRUCT_IFREQ_IFR_ADDR (and
- associated new macro) for determining the right way to compute the
- size of the interface structure.
- for new amq options -T/-U.
-Fri Apr 11 15:56:13 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * aux/configure.in: need to include libc before libnsl if
- get_myaddress() is available because on irix libnsl has a buggy
- get_myaddress().
-
- * include/am_defs.h: make sure REINSTATE_SIGNAL_HANDLER is defined
- on Irix 6 (an SVR4 variant)
- * amq/pawd.c: a new program, Print Automounter Working Directory,
-Thu Mar 27 02:28:40 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
- * aux/macros/localconfig.m4: trivial support for am-utils
- *******************************************************************
- *** Released am-utils-6.0a4 ***
- *******************************************************************
- wish in a file called localconfig.h, located in the top build
-Wed Mar 26 21:15:36 1997 Erez "HWank1" Zadok <ezk@lorien.cs.columbia.edu>
- * doc/am-utils.texi (Caching Filesystem): updated documents for
- * amd/amq_subr.c (ok_security): turned off insecure code unless
- user explicitly runs configure --enable-amq-mount.
- * amd/ops_cachefs.c: initial cachefs support, for solaris.
- * hlfsd/hlfsd.c (main): use new protoypes dor create_nfs_service().
-
- * amd/nfs_start.c (mount_automounter): use code that separately
- creates the NFS and the amq service. Register tcp and udp
- services for amd.
- cachefs file systems.
- * conf/transp/transp_*.c (create_amq_service): new function to
- separately create the amq service for amd. Simplified prototypes
- for create_nfs_service().
- mnttab type is.
-Wed Mar 19 20:40:56 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-Mon Jan 5 23:22:49 1998 Erez Zadok <ezk@lorien.cs.columbia.edu>
- *******************************************************************
- *** Released am-utils-6.0a3 ***
- *******************************************************************
-
-Wed Mar 19 17:49:18 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
- * amd/ops_nfsl.c (nfsl_ffserver, nfsl_match): also check if the
- * new port: rs6000-ibm-aix3.2.5 and rs6000-ibm-aix4.1.5.0. Lots
- of small changes to support these two.
- type:=nfs.
-Wed Mar 19 14:33:30 1997 Erez Zadok <ezk@grande.cs.columbia.edu>
- * updated all source files to add 1998 as a copyright year.
- * conf/umount/umount_default.c (umount_fs): bug: unlock_mntlist()
- should run if MOUNT_TABLE_ON_FILE, not otherwise.
- like type:=linkx if the pathname denoted by $fs exists, and like
-Mon Mar 17 22:02:43 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * hlfsd/hlfsd.c (main): fill in fhsize field if exists
- (freebsd-2.2).
-
- * amd/ops_{nfs,afs}.c (mount_toplvl): fill in fhsize field if
- exists (freebsd-2.2).
-
-Sat Mar 15 19:37:48 1997 Erez "HWank1" Zadok <ezk@shekel.mcl.cs.columbia.edu>
- * hlfsd/homedir.c (plt_init): make function exported, to save on
- * new port: i386-unknown-freebsd2.2. FreeBSD 2.2 and higher
- changed the filehandle type in struct nfs_args from nfsv2fh_t to
- u_char.
- instead.
-Sat Mar 14 10:11:03 1997 Erez "HWank1" Zadok <ezk@lorien.cs.columbia.edu>
-Thu Jan 1 00:15:58 1998 Erez Zadok <ezk@chestnut.mcl.cs.columbia.edu>
- * SHARED LIBRARIES: too many change to list individually. Now,
- libamu can be built as a shared library, and other programs link
- with it.
-
-Tue Mar 11 22:24:09 1997 Erez "HWank1" Zadok <ezk@lorien.cs.columbia.edu>
-
- * aux/macros/opt_shared.m4: new macro for setting options for
- building shared am-utils libraries.
- * amd/ops_afs.c (mount_toplvl): Bug fix. Don't try to free() an
-Sun Mar 9 19:17:46 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
- * ALL SOURCES: change every direct call to free() to xfree(), so
- * fixmount/fixrmtab: cleaned up the script.
- call dxfree(), which will print the file name and line number
- * fixmount/Makefile.am (EXTRA_DIST): adde $(sbin_SCRIPTS) so that
- fixrmtab gets distributed too.
-
- * conf/nfs_prot/nfs_prot_bsdi2.h: added support for MOUNTPROC_DUMP.
- Added extern for xdr_mountlist().
-Tue Dec 23 04:24:28 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
- * aux/configure.in: trimmed down many tests for MNT2_GEN_OPT,
- MNT2_NFS_OPT, and MNTTAB_OPT that were not referenced anywhere in
- the sources.
-
-Sat Mar 8 00:23:58 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
- calloc().
- * fixmount/hlfsd ported to bsd44, hpux, and linux systems.
-
- * aux/macros/check_fixmount_style.m4: add check for bsd44 systems.
- malloc().
- * conf/fixmount/fixmount_default.c: use lockf() if flock() is
- unavailable.
- zero its bytes.
- * include/am_defs.h: include <string.h> even if don't have
- STDC_HEADERS defined (sunos4).
- (seteuid): define seteuid() to be setresuid() for systems that
- have but not the other (hpux).
- * amq/amq.c: amq does not need its own definition of xfree().
- * aux/macros/check_extern.m4: test should include <strings.h>.
- look for function malloc_verify() in libmapmalloc.a, and function
-Tue Mar 4 17:16:52 1997 Erez "HWank1" Zadok <ezk@lorien.cs.columbia.edu>
-
- * lib/xutil.c (debug_option): moved from amd/getargs.c to this
- more proper file.
- uordbytes, because it does not always exist. Rather, compute it
- * include/am_utils.h: put in structure for debug options, for all
- progams to use.
- used when debugging memory references.
- * amd/get_args.c: moved structure for debug options out.
-Mon Dec 22 03:01:30 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-Sun Mar 2 00:13:07 1997 Erez "HWank1" Zadok <ezk@lorien.cs.columbia.edu>
- Otherwise browsable_dirs fails on OpenBSD 2.2.
- * ported fixmount.
- * amd/mntfs.c (uninit_mntfs): bug fix. Moved freeing of
- * lib/ualarm.c: replacement function for systems that don't have a
- ualarm().
-Sat Dec 20 00:51:21 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
- * ported fsinfo.
- * amd/ops_host.c (host_umounted): don't use clnt_spcreateerror()
-Sun Mar 1 10:23:34 1997 Erez "HWank1" Zadok <ezk@lorien.cs.columbia.edu>
- * include/am_defs.h: add missing extern definition for free().
- * ported mk-amd-map.
-
- * buildall: added -K option to buildall, to run mkconf.
- optional function.
-Fri Feb 28 01:10:25 1997 Erez "HWank1" Zadok <ezk@shekel.mcl.cs.columbia.edu>
- if they exist.
- *******************************************************************
- *** Released am-utils-6.0a2 ***
- *******************************************************************
- * aux/configure.in: check for missing functions clnt_create and
-Thu Feb 27 13:58:59 1997 Erez "HWank1" Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * all *.[hcyl] files: add copyright line.
- * Makefile.am: updates for new sunos3 files distributed.
- * aux/macros/check_mount_type.m4: test for mount type for
- linux-like systems, by checking for loadable or statically linked
- kernel filesystem modules.
- * conf/fh_dref/fh_dref_sunos3.h: new file.
- * aux/macros/check_mnttab_type.m4: test for mount table entry
- for linux-like systems, by checking for loadable or statically
- linked kernel filesystem modules.
- * aux/macros/check_nfs_fh_dref.m4: added sunos3 case.
- * aux/configure.in: pcfs filesystems can use vfat type (linux)
- * doc/am-utils.texi (wire Selector Variable): updated manual for
- * aux/macros/check_fs_mntent.m4: test for filesystem existence for
- linux-like systems, by checking for loadable or statically linked
- kernel filesystem modules.
- in_network() function.
- * conf/trap/trap_hpux.h: ugly hack added because of stupide HPUX
- 9.0 header files. This should be removed when HPUX 9.0 is deemed
- defunct.
- functions. Converted wire, network, and netnumber all to use the
- * aux/acconfig.h: set an undefined variable for having an extern
- to clnt_sperrno().
- against all networks, not just primary.
- * include/am_defs.h: define extern for clnt_sperrno() if needed.
- * conf/nfs_prot/nfs_prot_linux.h: add special definitions for
- * aux/configure.in: test for extern clnt_sperrno().
- <rpc/des_auth.h> because it is incomplete on the same systems.
- * aux/macros/check_nfs_fh_dref.m4: HPUX's NFS fhandle dref is
- similar to irix.
- * hlfsd/homedir.c (table_add): cast uid field to int, for
- * aux/macros/check_mount_style.m4: use mount helper on HPUX.
- * include/am_defs.h: more coflicts with redhat alpha linux
- * aux/macros/check_mtype_type.m4: hpux's mount type is a char*,
- not integer (but may be mapped to one later).
- * aux/macros/{mount_headers,try_compile_anyfs,try_compile_nfs}.m4:
- * conf/mount/mount_hpux.c (mount_hpux): HPUX has confusing header
- files. They have mount(2) and vfsmount(2) which don't take same
- arguments, and they have string mount types MNTTYPE_* as well as
- integer types MOUNT_*. So I need this new mount function to map
- from string types to integer types for the vfsmount() function.
- redhat alpha linux.
- * conf/trap/trap_hpux.h (MOUNT_TRAP): instead of calling
- vfsmount(), call mount_hpux().
- the new "!" (negated) nomadic functions.
-Thu Feb 27 03:34:14 1997 Erez "HWank1" Zadok <ezk@okeeffe.cs.columbia.edu>
- rather than saying that any ARG is on a local network.
- * lib/mount_fs.c (mnt_flags): make sure SYNC option is on only if
- both MNTTAB_OPT_SYNC and MNT2_GEN_OPT_SYNC are defined.
-
-Thu Feb 27 00:26:00 1997 Erez "HWank1" Zadok <ezk@shekel.mcl.cs.columbia.edu>
-Thu Dec 18 20:57:19 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
- * conf/nfs_prot/nfs_prot_hpux.h: NFS protocol definitions for
- hpux.
-
- * include/am_defs.h: no need to include rpc/auth.h or rpc/clnt.h.
- Finally, it looks as if OpenBSD 2.2's NFS 3 implementation may be
- * aux/configure.in: no need to test for rpc/auth.h and rpc/clnt.h.
- wait until they get it working in their version of the automounter
- * buildall: added ability to configure using other shells than
- /bin/sh, on those systems where /bin/sh is buggy or limited
- (HPUX).
- maxgrp.
- * aux/macros/struct_nfs_fh.m4: reinstated the macro but have it
- defined am_nfs_fh, and also test for plain typedef "nfs_fh".
- "maxgrps". Added test for mount table entry "maxgroups".
- * aux/acconfig.h: #undef am_nfs_fh, which is being defined by a
- reinstated macro.
- * libamu/mount_fs.c (compute_nfs_args): perform more careful tests
- * aux/configure.in: check for <nfs/export.h>
-
- * include/am_defs.h: include <nfs/export.h> (HPUX) if exists.
- including 9.x, should use "ignore" as the mount type to hide from
- * aux/macros/try_compile_nfs.m4: include <nfs/export.h> (HPUX) if
- exists.
-
- * aux/macros/mount_headers.m4 (define): removed some non-working
- (on HPUX) code that attempts to recreate the fhandle_t rather than
- load it up from system headers. Also added some NFS protocol
- header inclusion. include <nfs/export.h> (HPUX) if exists.
- every where in the sources.
-Wed Feb 26 00:32:35 1997 Erez "HWank1" Zadok <ezk@okeeffe.cs.columbia.edu>
-
- * aux/macros/mount_headers.m4 (define): Use M4 changequote to
- ensure [] brackets are correctly used.
- useful for detecting internal flags and options, as well as the
- * aux/macros/expand_cpp_{string,hex,int}.m4: encapsulate
- multi-line M4 inclusions in [].
- after /etc and before /etc/local.
-Tue Feb 25 22:19:44 1997 Erez "HWank1" Zadok <ezk@shekel.mcl.cs.columbia.edu>
- * aux/configure.in, libamu/Makefile.am: added support for linking
- * conf/mtab/mtab_bsd.c (mnt_dup): use statfs field f_fstypename if
- it exists.
-
- * aux/acconfig.h: HAVE_FIELD_STRUCT_STATFS_F_FSTYPENAME, new
- config.h macro for field f_fstypename of struct statfs.
- needed.
- * aux/configure.in: testing for field f_fstypename field of struct
- statfs (NetBSD).
- netbsd).
- * aux/acconfig.h: moved all of the "static" definitions out to a
- fixed file called include/am_defs.h. Added to all */Makefile.am
- files a dependency on am_defs.h. Created am_defs.h of course, and
- then added #include <amd_defs.h> to all of the source and header
- files that required it.
- for NetBSD-1.3_BETA and similarly for OpenBSD.
-Mon Feb 24 01:27:02 1997 Erez Zadok <ezk@defiant.soscorp.com>
- * conf/nfs_prot/nfs_prot_netbsd1_3.h: new header for the slight
- * aux/acconfig.h: two more externals for xdr functions that may be
- implemented by libamu.
- mktemp().
- * conf/nfs_prot/nfs_prot_bsdi2.h: added missing RPC and XDR
- definitions.
- * amd/ops_nfs.c (mount_nfs_fh): Systems that include the mount
-Sun Feb 23 15:25:26 1997 Erez "HWank1" Zadok <ezk@shekel.mcl.cs.columbia.edu>
- "nfs3", but to "nfs" and then they set "vers=3". Setting it to
- * buildall (default): added -D option for turning on even stricker
- developer options.
- systems, set it to "nfs".
- * */Makefile.am: make sure @AMU_NFS_PROT_HEADERS@ is used to
- determine dependencies on optional NFS protocol headers.
-
- * aux/acconfig.h: define and use HAVE_NFS_PROT_HEADERS as needed.
-
- * aux/macros/check_nfs_prot_header.m4: new test to determine what
- NFS protocol headers to use.
- system mount types under nextstep for mount(2).
- * conf/nfs_prot/nfs_prot_{irix6,sunos4,bsdi2}.h: new headers to
- complete missing system headers for NFS protocol definitions.
- integer and string types for file system mount types in mount(2),
-Sun Feb 16 15:58:42 1997 Erez "HWank1" Zadok <ezk@vir.cs.columbia.edu>
- (EPERM) instead of 0 (OK). Fixes m68k-next-nextstep3 which now
- * amd/ops_nfs.c (mount_nfs_fh): encapsulated some more code in
- #ifdef's as needed.
-
- * amd/ops_afs.c (mount_toplvl): make sure TIMEO/RETRANS code is
- suitable #ifdef'ed.
-
- * include/am_compat.h: a couple more mnttab options
- (timeo/retrans) setting just in case.
-
- * amd/autil.c (host_normalize): make sure hostent->h_name is
- passed a non-const char *.
-
- * conf/mount/mount_linux.c (mount_linux): cleaned up a block of code.
- inclusion of <nfs/nfs_mount.h> which only affects nextstep3, on
- * {lib,amq,amd}/*.c (many functions): cast xdr_entry to
- XDRPROC_T_TYPE.
- * libamu/mount_fs.c (mnt_flags): support either nfs or generic
- * lib/nfs_prot_svc.c (nfs_program_2): cast xdr_entry to
- XDRPROC_T_TYPE.
-
- * lib/nfs_prot_xdr.c (xdr_entry): cast xdr_entry to
- XDRPROC_T_TYPE.
-
- * lib/wire.c (getwire): Make sure safe assignment from const to
- none is done.
- file in the am-utils' home page, as well as a few other useful
-Sat Feb 15 19:38:51 1997 Erez "HWank1" Zadok <ezk@vir.cs.columbia.edu>
-Mon Nov 17 05:22:56 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
- * aux/macros/expand_cpp_int.m4: new macro for expanding integers.
- *******************************************************************
- * aux/configure.in: added linux/fs.h support in configure and
- several M4 macros.
-
- * conf/mount/mount_linux.c (mount_linux): use macro instead of
- "ugly" fixed hex number for mount() arguments.
- ports.
-Sat Feb 15 02:09:47 1997 Erez "HWank1" Zadok <ezk@lorien.cs.columbia.edu>
-
- * amd/info_hesiod.c: removed macro HAVE_HS_ZONE_TRANSFER and
- turned all of its code always on. That code always seems to
- compile, as long as you have hesiod and libresolv.
- * scripts/amd.conf.5: corrected info for -o/-O options.
- * amd/mapc.c: removed macro HAVE_HS_ZONE_TRANSFER and turned all
- of its code always on.
- OS name.
- * aux/configure.in: removed superfluous test for hs_zone_transfer
- function (will never find it because it is an amd-internal
- function).
- -o and -O options.
- * amd/mapc.c (maptypes): must used correct new name for am-utils'
- hesiod initialization function: hesiod_am_init.
-
- * amd/info_hesiod.c (hesiod_am_init): renamed hesiod_init to
- hesiod_am_init so as not to conflict with libhesiod's
- hesiod_init() function.
- variable.
- * aux/configure.in: added test and explicit inclusion of
- libresolv.a for later resolution of library references with
- libhesiod.
- <metcalf@cag.lcs.mit.edu> to correctly set the nfs_prot headers
- * aux/macros/opt_cppflags.m4: new file. configure/compile C
- preprocessor flags.
- * doc/am-utils.texi (Distrib): typo in the subscription
- * aux/macros/opt_libs.m4: new file. configure/compile library
- flags.
- <vogel@physik-rzu.unizh.ch>.
- * Makefile.am (EXTRA_DIST_AUX): include two new macros
- opt_cppflags.m4 and opt_libs.m4.
-1997-11-15 Erez Zadok <ezk@amtrak.cs.columbia.edu>
- * aux/configure.in: test for libhesiod needs to additional
- libresolv to link completely. Additional configuration time
- options added for setting initial CPPFLAGS and LIBS.
-
-Tue Feb 10 02:15:40 1997 Erez "HWank1" Zadok <ezk@lorien.cs.columbia.edu>
- * NFS3 works on powerpc-ibm-aix4.2.1.0.
-
- *** Released am-utils-6.0a1 ***
- static. Some compilers (gcc from egcs on aix 4.2.1) corrupt the
- stack of an automatic variable when pointer to it is passed around
-Thu Feb 6 02:55:19 1997 Erez "HWank1" Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * amd/info_ndbm.c (ndbm_search,ndbm_init): fixed the code so that
- it works on freebsd, where they map dbm_pagfno a non-existing
- macro on purpose, to force you to port the code to Berkeley DB.
- * libamu/xutil.c (real_plog): syslog like behavior for normal
-Fri Jan 31 01:35:09 1997 Erez "HWank1" Zadok <ezk@lorien.cs.columbia.edu>
-
- * amd/ops_afs.c (mount_toplvl): added a sleep(1) right before the
- actual mount_toplvl, to avoid some possible race conditions.
-
-Thu Jan 30 02:31:49 1997 Erez "HWank1" Zadok <ezk@lorien.cs.columbia.edu>
-
- * amd/rpc_fwd.c: removed all TLI (HAVE_T_OPEN) code.
-
-Wed Jan 29 18:25:07 1997 Erez "HWank1" Zadok <ezk@lorien.cs.columbia.edu>
-
- * lib/wire.c (getwire): removed HAVE_T_OPEN (TLI code)
- passed to it before. So now I have to dereference the pointer
- * amd/amd.c (main): fix local address using htonl(). Free up
- buffers allocated by netdir_*() functions.
-
-Wed Jan 22 23:53:24 1997 Erez "HWank1" Zadok <ezk@lorien.cs.columbia.edu>
-
- * amd/fix-amd-map.in: new script that will convert old-style amd
- maps to new one.
- compute_nfs_args() and compute_automounter_nfs_args() functions.
-Tue Jan 21 01:18:16 1997 Erez "HWank1" Zadok <ezk@lorien.cs.columbia.edu>
- and cleaner compute_nfs_args() and compute_automounter_nfs_args()
- * FIRST AMD IN AM-UTILS FINALLY WORKS (mounts itself as toplvl,
- and replies back to simple nfs/link type mount queries).
- relates for struct nfs_args. A new function sets the numerous
- * conf/mtab/mtab_svr4.c: reorganized the code in this file to be
- easier to read, and fixed a few bugs with un/setting the lock file
- descriptor.
- libamu. This saves on overall size of code.
-Wed Jan 8 15:27:49 1997 Erez "HWank1" Zadok <ezk@lorien.cs.columbia.edu>
- mounting an automounter's mount point. Used by hlfsd and amd.
- * amd/sched.c: removed HAS_SVR3_SIGNALS code to handle older
- signals in Svr3 systems. Only stellix ever used this.
- * amq/amq.c (get_secure_amd_client): don't print any more
- * amd/rpc_fwd.c (fwd_reply): removed all code that was triggered
- by DYNAMIC_BUFFERS, since it was not in use.
- under DEBUG only.
-Tue Jan 7 00:45:59 1997 Erez "HWank1" Zadok <ezk@lorien.cs.columbia.edu>
-
- * amd/opts.c (eval_opts): removed AMD_COMPAT code. Amd no longer
- takes '=' sign as old selector. Fix your maps.
- (deslashify): removed APOLLO code that treated two '//' as one.
- for file systems based on physical media (disk, cdrom, floppy) to
-Sun Jan 5 01:25:09 1997 Erez "HWank1" Zadok <ezk@lorien.cs.columbia.edu>
- autoconf searches for all these types of mount table entries for a
- * amd/ops_nfsx.c (nfsx_init): removed HARD_NFSX_ERRORS, code which
- was not used. It made any submount error fail the whole group.
- the actual name found! Same for ufs, cdfs, pcfs, tmpfs, lofs,
- * amd/ops_nfs.c (make_nfs_auth): removed code dependent on
- HAS_NFS_QUALIFIED_NAMES.
- (mount_nfs_fh): removed macro for NFS_ARGS_NEEDS_PATH, assuming it
- is never on. So code that was triggered by #ifndef
- NFS_ARGS_NEEDS_PATH (osf1, aix3, and bsd44 variants) may have to
- be fixed later.
- Removed all ULTRIX_HACK code. Ultrix is DEAD!
- removed all PRESET_AC code, which was only on for Linux to preset
- the attribute cache values (otherwise they default to zero).
- (nfs_umounted): revobed KICK_KERNEL code (IRIX systems). Will
- have to fixed up later.
- (mount_nfs_fh): removed code that was never included, which
- attempted to set the port on which amd's nfs mounts on. This
- isn't supported by the ping algorithm yet. In any case, it is all
- done in nfs_init().
-
- * amd/srvr_nfs.c (find_nfs_srvr), amd/ops_nfs.c (mount_nfs_fh):
- removed HAS_TCP_NFS code. The whole use of NFS V.3 with TCP or
- specially hacked NFS V.2 that uses TCP (BSD 4.4 variants) will
- have to be addressed later.
-Sun Oct 26 19:32:57 1997 Erez Zadok <ezk@defiant.soscorp.com>
- * amd/nfs_subr.c (nfsproc_getattr_2): removed all code dependent
- on PRECISE_SYMLINKS.
- This works better on bsdi2 and bsdi3, because their portmapper
- * amd/mapc.c (mapc_meta_search): removed code that depended on
- HAS_DEPOT. It is known buggy code. The whole DEPOT support needs
- to be rethought.
- (mapc_add_kv): ported code to use standard regular expression
- (regexp) library.
- insecure).
- * amd/{map.c,ops_sfs.c,ops_ufs.c}: removed all code dependent on
- FLUSH_KERNEL_NAME_CACHE and the macro itself.
- *** Released am-utils-6.0a13 ***
-Sat Jan 4 15:46:58 1997 Erez "HWank1" Zadok <ezk@lorien.cs.columbia.edu>
-Fri Oct 24 05:04:37 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
- * amd/map.c (exported_ap_alloc): removed all code triggered by
- SHRINK_EXPORTED_AP and the macro itself.
- struct datum typedef.
- * amd/info_nis.c: removed HAS_NIS_RELOAD macro, and left the code
- in all the time. Assuming that there is always NIS realod
- available.
- (yp_all_fixed): removed code for BROKEN_YP_ALL. If your yp_all()
- function is broken such that it does not release filedescriptors
- it created, then you are hosed. Get a fix for yp_all from your
- vendor or switch operating systems.
-
-Tue Dec 31 15:34:36 1996 Erez "HWank1" Zadok <ezk@lorien.cs.columbia.edu>
- gid_t.
- * amd/info_hesiod.c: renamed macro HAS_HESIOD_RELOAD to
- HAVE_HS_ZONE_TRANSFER.
- * conf/transp/transp_tli.c (amu_clnt_create_best_vers): don't use
-Mon Dec 30 17:33:23 1996 Erez "HWank1" Zadok <ezk@lorien.cs.columbia.edu>
-
- * amd/{nfs,host}_ops.cremoved INFORM_MOUNTD macro, so its code is
- always included. We should always try to inform the remove mount
- daemon of mounts we performed. If we want an option for this, it
- should be a run-time option.
-
- * amd/host_ops.c: removed all that optionally did not make the
- directory mount points for amd.
-
- * HOST_EXEC code removed from everywhere. There is no indication
- that it was used anywhere. If it needs to be used, then a
- run-time switch should control it.
-
-Thu Dec 26 00:06:52 1996 Erez "HWank1" Zadok <ezk@lorien.cs.columbia.edu>
- passwdfile option. If hlfsd is started with -P passwdfile, then
- * amd/*_ops.c: removed all references to mntent_t's fields
- mnt_freq and mnt_passno, since they are no longe rused (and never
- have been).
- read and checked. All the rest are ignored. No NIS/netgroup
- * amd/am_ops.c: removed function sunos4_match, which was off
- anyway. This was one of the places where an '=' sign was allowed
- as an assignment operator (which is now ':=').
-
- * amd/afs_ops.c (afs_bgmount): removed SUNOS4_COMPAT code which
- was off anyway. This was one of the places where an '=' sign was
- allowed as an assignment operator (which is now ':=').
- -h is invoked.
-Tue Dec 24 01:53:52 1996 Erez "HWank1" Zadok <ezk@lorien.cs.columbia.edu>
-Wed Oct 22 00:16:39 1997 Erez Zadok <ezk@lorien.cs.columbia.edu>
- * amq/amq.c: ported to am-utils. Working.
-
- * conf/mount/mount_svr4.c (mount_svr4): changed mount type on svr4
- to be string, as it should be (rather than a string mapped to int
- and back mapped to string).
- which returns TRUE if 'arg' is any one of this host's networks.
-Sun Dec 22 13:26:05 1996 Erez "HWank1" Zadok <ezk@lorien.cs.columbia.edu>
- all networks names and numbers in the order of the interface (not
- * lib/mount_fs.c (mount_fs): removed MNTINFO_PREF code.
-Mon Oct 20 01:59:25 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
- * lib/umount_fs.c: split this into three files: default, osf, and
- bsd44, that are in conf/umount/umount_*.c.
- * aux/configure.in: don't add ops_ufs.o on AIX twice. My code
-Thu Dec 19 17:33:46 1996 Erez "HWank1" Zadok <ezk@lorien.cs.columbia.edu>
- * doc/Makefile.am (EXTRA_DIST): include am-utils.dvi and
- * aux/configure.in, aux/aclocal.m4, aux/acconfig.h: added new
- macro to automatically figure out if an external definition for
- sys_errlist[] exists.
- (html): generate html documentation for
- * lib/xutil.c (xfree): removed "#undef free" because it's not
- needed there. Any system that redefines free() needs help.
-
- * conf/mtab/mtab_file.c (REWRITE_MTAB_IN_PLACE): removed code that
- was dependent on REWRITE_MTAB_IN_PLACE. It does not appear to be
- in active use anywhere. If added later, it should be a run-time
- configuration option.
- ypall_callback_fxn_t. The NetBSD team compiles all sources with
- * conf/mtab/mtab_mach3.c: removed code that was #ifdef'ed not to
- be MOUNT_TABLE_ON_FILE, since mach2 always stores its mount tables
- in a file in /etc.
- function typedef.
- * lib/util.c (str3cat): removed _AIX code. AIX should have a
- working realloc, or else find a cleaner solution to this.
- (mkdirs): removed SUNOS4_WORKAROUND code. This was to do a sync()
- after immediately making directories so that fsck will be able to
- fix the filesystem in the event of an immediate crash. This was
- because a bug in UFS which is fixed by now.
- * libamu/xutil.c (amu_release_controlling_tty): new function to
- * lib/hutil.c (domain_strip): removed PARTIAL_DOMAINS triggered
- code. Does not appear to be on and used anywhere.
- (dofork): removed MACH3 code, b/c mach3 NFS bugs are fixed by now.
- and hlfsd/hlfsd.c. Also avoid setpgrp(), because it works on some
- * lib/resvport.c: split the binding of reserved ports code to a
- separate file. A #define (HAVE_T_OPEN) separates the TLI (SVR4)
- from the BSD code.
-
-Thu Dec 19 02:08:35 1996 Erez "HWank1" Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * lib/Makefile.am (amu_LIBADD): includs @LIBOBJS@ now, auto-filled
- in by automake and configure, for optional sources that need to be
- built as part of libamu.a.
-
- * aux/aclocal.m4: Make sure AC_CHECK_MOUNT_STYLE adds mountutil.o
- to LIBOBJS.
-
- * lib/memcmp.c (memcmp): new file added to replace a possible bad
- implementation of memcmp.
-
-Wed Dec 18 22:20:23 1996 Erez "HWank1" Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * converted the sources to use memset/memmove/memcmp instead of
- bzero/bcopy/bcmp.
-
- * ran all sources through gnu Indent w/ options specified in
- aux/amindent.
-
-Wed Dec 11 22:19:29 1996 Erez "HWank1" Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * At this point the initial genration of config.h via autoconf and
- some preliminary makefiles via automake is done. I will not begin
- modifying sources, so it's a good time to document from here.
-
-Wed Dec 10 22:19:29 1996 Erez "HWank1" Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- *******************************************************************
- *** Initial ChangeLog Entry ***
- *******************************************************************
-
- * amd/ops_afs.c (mount_toplvl): turn on 'ignore' option in nfs
- mount flags of toplvl mounts. Important esp. for HPUX 10. Now
- hpux-10 will mount amd's mounts points as 'ignore' (by df).
-
- * aux/configure.in: check for NFS mount option 'ignore', useful in
- HPUX 10.
-
-Thu Oct 16 03:28:33 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * aux/macros/check_hide_mount_type.m4: hpux 10 should use "ignore"
- mount type and not NFS, for the amd mount points.
-
- * conf/transp/transp_tli.c (amu_clnt_create_best_vers): don't log
- an RPC timeout as an error, but just an info message. From
- Andreas Stolcke <stolcke@speech.sri.com>
-
- * If the NFS server is down or does not support the portmapper
- call (such as certain Novell NFS servers) we mark it as version 2
- and we let the nfs code deal with the case that is down. If when
- the server comes back up, it can support NFS V.3 and/or TCP, it
- will use those. From christos@deshaw.com (Christos Zoulas).
-
- * hlfsd/homedir.c (plt_print): various compile time cleanups to
- printfs that take a long, but pass an int to print. From
- christos@deshaw.com (Christos Zoulas).
-
- * aux/macros/func_bad_yp_all.m4 (ac_cv_func_yp_all_clean,): new
- macro to determine if the OS has a bad yp_all(), based on the host
- OS name. So far only irix (all versions) have a bad yp_all, so
- they will use am_yp_all() instead (which is slower as it
- enumerates manually all of the map's entries).
-
-Thu Oct 16 03:14:37 1997 Erez Zadok <ezk@subzero.cs.columbia.edu>
-
- * amd/info_nis.c (am_yp_all): code for a replacement yp_all that
- avoids using a file-descriptor leaking yp_all() on some systems
- like irix.
-
-Wed Oct 15 21:52:35 1997 Erez Zadok <ezk>
-
- * fsinfo/fsinfo.h: avoid redefining yywrap incorrectly on DU-4.x
- systems using /usr/bin/flex.
-
- * amd/conf_tok.l (yywrap): avoid redefining yywrap for systems
- that have a modified GNU flex which does define yywrap (DU-4.x).
-
-Fri Sep 26 14:25:29 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * conf/checkmount/checkmount_bsd44.c: include prototype.
-
-Fri Sep 26 01:26:24 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- *******************************************************************
- *** Released am-utils-6.0a12 ***
- *******************************************************************
-
-Fri Sep 26 00:13:48 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * conf/nfs_prot/nfs_prot_irix6.h: completely turn off all autofs
- code in irix6 until it can be tested correctly
-
- * conf/transp/transp_tli.c (amu_clnt_create_best_vers): time out
- on clnt_create for 3 seconds, rather than wait for the much longer
- default.
-
- * conf/nfs_prot/nfs_prot_aix4_2.h: port to powerpc-ibm-aix4.2.1.0.
- Includes NFS3, untested.
-
-Thu Sep 25 11:03:11 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * amd/ops_pcfs.c (mount_pcfs): fill in uid/gid fields of
- pcfs_args_t if they exist.
-
- * amd/ops_cdfs.c (mount_cdfs): fill in ssector field of
- cdfs_args_t if it exists.
-
- * new minor ports hppa1.1-hp-hpux10.10, hppa1.1-hp-hpux9.05,
- hppa1.1-hp-hpux9.07, m68k-hp-hpux9.00, and sparc-sun-sunos4.1.4.
-
-Wed Sep 24 00:48:05 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * doc/am-utils.texi (wire-test): updated documentation for the new
- option.
-
- * wire-test/wire-test.8: updated man page for new option.
-
- * wire-test/wire-test.c (main): added a test for various
- combinations of NFS proto/vers to a remote/local host.
-
- * aux/macros/try_compile_anyfs.m4 (AC_TRY_COMPILE): include
- <isofs/cd9660/cd9660_mount.h> and <msdosfs/msdosfsmount.h> so that
- freebsd will correctly set mount options for pcfs and cdfs.
-
- * amd/ops_pcfs.c (mount_pcfs): set mask field of pcfs_args to
- 0777 (if field exists).
-
- * aux/macros/try_compile_anyfs.m4 (AC_TRY_COMPILE): include
- <msdosfs/msdosfsmount.h> if available.
-
- * minor new port: rs6000-ibm-aix4.1.4.0.
-
- * libamu/mount_fs.c (mount_fs): fixed bug that caused HPUX not to
- write the "time" field in /etc/mnttab.
-
- * conf/mtab/mtab_file.c (mnt_dup): fixed typo in macro names for
- detecting mnt_time field of mntent_t.
-
- * libamu/mtab.c (mnt_free): fixed typo in macro names for
- detecting mnt_time field of mntent_t.
-
-Tue Sep 23 15:30:03 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * conf/mtab/mtab_file.c (lock): Use flock() in preference over
- fcntl() to lock the mtab file.
-
-Mon Sep 22 23:04:58 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * conf/transp/transp_sockets.c (get_nfs_version): define
- the try_again goto label only for NFS3.
- (pmap_ping): assume timeout failure of clnt_stat.
-
- * libamu/xdr_func.c (xdr_groupnode, xdr_exportnode): cast to
- "groups *".
-
-Mon Sep 22 20:34:33 1997 Erez Zadok <ezk@lorien.cs.columbia.edu>
-
- * conf/transp/transp_sockets.c (pmap_ping): patch from Dan Riley
- <dsr@mail.lns.cornell.edu> to make sure that amd works with more
- secure portmappers that do not allow forwarding of RPC messages to
- other services.
-
- * */Makefile.am: all source files should also depend on the new
- include/am_xdr_func.h header.
-
- * include/am_xdr_func.h: new file as part of the code cleanup from
- Christos Zoulas <christos@deshaw.com>.
-
- * Lots of fixes from Christos Zoulas <christos@deshaw.com> that
- involved missing prototypes, cleaned up ones, and removal of
- unused variables.
-
- * libamu/xdr_func.c (xdr_mountres3): some code cleanup. A switch
- statement with only one case is unclean.
-
-Mon Sep 22 17:26:38 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * amd/ops_<FOO>fs.c (mount_<FOO>fs): initialize mntent_t fields to
- 0 so that all fields are initialized to zero at first. This way
- SunOS 4.x and other systems don't get /etc/mtab entries with
- random integers for the fsck/freq fields. Patch from Andreas
- Stolcke <stolcke@speech.sri.com>.
-
-Mon Sep 22 00:34:19 1997 Erez Zadok <ezk@americas.psl.cs.columbia.edu>
-
- * conf/nfs_prot/nfs_prot_sunos4.h: include <nfs/nfs_clnt.h> so
- that the important definition for HOSTNAMESZ will be found.
-
- * amd/ops_afs.c (mount_toplvl): limit hostname size to HOSTNAMESZ
- (inside the nfs_args structure) if the system uses that macro.
- Otherwise systems like SunOS refuse to NFS mount long pathnames
- and result in ENAMETOOLONG errno's.
-
-Wed Sep 17 04:56:11 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * doc/am-utils.texi (Supported Platforms): specify new support for
- solaris 2.6, and hlfsd running on 2.5.1 too.
-
-Wed Sep 17 03:55:02 1997 Erez Zadok <ezk@amsterdam.psl.cs.columbia.edu>
-
- * conf/mount/mount_svr4.c (mount_svr4): don't attemt an autofs
- mount if it is not supported or was turned off.
-
-Wed Sep 17 03:19:36 1997 Erez Zadok <ezk@americas.psl.cs.columbia.edu>
-
- * conf/nfs_prot/nfs_prot_sunos4.h: fixed so that it will nfs mount
- again. Apparently at some previous release SunOS 4 supported was
- broken and all nfs mounts resulted in ESTALE.
-
-Wed Sep 17 00:26:25 1997 Erez Zadok <ezk@amsterdam.psl.cs.columbia.edu>
-
- * conf/nfs_prot/nfs_prot_sunos5_6.h: nfs protocol headers for
- solaris 2.6.
-
- * aux/macros/check_nfs_prot_headers.m4: added solaris 2.6 nfs
- protocol header selection.
-
-Sat Sep 13 14:31:51 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * conf/transp/transp_tli.c (amu_clnt_create_best_vers): avoid
- infinite loop.
-
-Sun Sep 7 18:23:23 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- *******************************************************************
- *** Released am-utils-6.0a11 ***
- *******************************************************************
-
-Fri Sep 5 11:55:10 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * amd/amd.c (main): if plock() succeeded, don't try to display
- errno message. Patch from Chris Metcalf
- <metcalf@catfish.lcs.mit.edu.
-
-Thu Sep 4 19:17:58 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * hlfsd/homedir.c (table_add): make sure duplicate passwd entries
- are ignored. Only the first entry should ever be used, because
- that's how lookup in passwd database works.
-
- * conf/transp/transp_sockets.c (get_nfs_version): when determining
- if a remote host is up or down, use NFS v.2. Fix suggested by
- Enami Tsugutomo <enami@cv.sony.co.jp>.
-
- * conf/transp/transp_tli.c (amu_clnt_create_best_vers): new
- function to get the best possible NFS version, but also timeout
- faster than normal defaults, so remote hosts which are down can be
- detected in a reasonable time.
- (get_nfs_version): use the new "best" function.
-
-Tue Sep 2 00:41:00 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- *******************************************************************
- *** Released am-utils-6.0a10 ***
- *******************************************************************
-
-Mon Sep 1 15:39:51 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * conf/transp/transp_tli.c (get_nfs_version): don't use
- clnt_tp_create_timed() on systems that don'e have it (Solaris 2.4
- and earlier).
-
- * aux/configure.in: test for existence of clnt_tp_create_timed(),
- since Solaris 2.4 (and possibly earlier) do not have it.
-
-Mon Sep 1 15:23:18 1997 Erez Zadok <ezk@felix.psl.cs.columbia.edu>
-
- * amd/ops_autofs.c (autofs_unmount_1_svc): only display rdevid
- field if it exists (solaris 2.4's autofs does not have it).
-
-Mon Sep 1 14:45:09 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * aux/macros/type_auth_create_gidlist.m4: a new test to determine
- the correct type to the 5th argument of authunix_create().
-
-Mon Sep 1 03:44:32 1997 Erez Zadok <ezk@felix.psl.cs.columbia.edu>
-
- * libamu/xdr_func.c (xdr_umntrequest): add test for autofs
- structure umntrequest, if it has the field rdevid. Seems Solaris
- 2.4 and earlier didn't have it.
-
-Mon Sep 1 01:10:53 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * hlfsd/hlfsd.c (hlfsd_init): moved initialization upwards, so it
- can be done before primary process forks.
- (main): bug fix: wait a bit to give child a chance to initialize.
- Without this, hlfsd got into a busy infinite loop while, never
- completing the mount.
-
- * amd/info_nis.c: patch from Jason Thorpe <thorpej@nas.nasa.gov>
- to make amd works when talking to NIS+ servers in NIS
- compatibility mode.
-
-Mon Sep 1 00:46:56 1997 Erez Zadok <ezk@lorien.cs.columbia.edu>
-
- * amd/mapc.c (MAX_CHAIN): increased maximum chain size to 1024.
-
-Sun Aug 31 20:20:40 1997 Erez Zadok <ezk@lorien.cs.columbia.edu>
-
- * amd/conf.c (gopt_fully_qualified_hosts): a new function to
- process another new global variable.
-
- * amd/ops_nfs.c (make_nfs_auth): if a new global variable
- fully_qualified_hosts is on, use FQHN in RPC/NFS authentications.
- Patch from Chris Metcalf <metcalf@catfish.lcs.mit.edu>.
-
- * amd/conf.c (process_last_regular_map): If the amd.conf file only
- has a [global] section (pretty useless IMHO), do not try to
- process a map that does not exist.
-
- * scripts/amd.conf.5: fixed typos (repeated 'as' word).
-
- * doc/am-utils.texi: MAJOR DOCUMENTATION REVISION COMPLETED!!!
-
- * amd/conf.c (reset_cf_map): Bug fix. Reset 'tag' field of cfm
- structure, so it does not carry over from map entry to another.
-
-Sat Aug 30 18:39:21 1997 Erez Zadok <ezk@lorien.cs.columbia.edu>
-
- * amd/amd.c (main): fixed the meaning of the plock option. A bug
- caused it to be reversed.
-
-Sat Aug 30 15:13:18 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * hlfsd/stubs.c: don't initialize some statics here. They are
- better initialized in hlfsd_init_filehandles().
-
-Fri Aug 22 14:47:16 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * amd/conf.c (gopt_show_statfs_entries): new function and a global
- amd.conf key show_statfs_entries. Defaults to 'no'. If 'yes',
- then all maps flagged as browsable will also show a count of the
- number of entries (keys) in that map.
-
- * amd/nfs_subr.c (count_map_entries): new function to count number
- of entries in a map. Now used if browsable is turned on in a map,
- to return a count of available keys in a given map.
-
- * hlfsd/stubs.c (eq_fh): use correct memcmp(). BUG fixed! hlfsd
- confused the file handles for ".", "..", and the symlink, causing
- mess.
-
- * aux/macros/func_bad_memcmp.m4: new test, based on autoconf 2.12,
- but also defines HAVE_BAD_MEMCMP, so I avoid linkage conflicts
- with bad memcmp() in libc's (nextstep3).
-
-Thu Aug 21 17:38:41 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * aux/configure.in: check if autofs_args_t has a field named
- addr. Solaris has it for specifying the address of the daemon,
- but Irix does not. So how does irix tell the kernel the daemon's
- address? I suspect that it is hardcoded to "localhost" using a
- "private well-known port" (#define AUTOFS_PORT 2048).
-
- * conf/nfs_prot/nfs_prot_linux.h: added missing autofs
- definitions.
-
- * README.autofs: new file listing autofs support notes
-
- * very preliminary autofs code working. Call it pre-alpha
- quality.
-
-Sun Aug 17 02:25:09 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * amd/conf.c (ropt_mount_type, gopt_mount_type): don't accept
- "autofs" if system does not support it.
-
- * amd/amd.c (main): log am-utils version string (same as amd -v)
- at start of run.
-
- * conf/transp/transp_sockets.c (get_nfs_version): in order to tell
- if a remote host is available, try to contact its portmapper and
- timeout if no answer is received in 3 seconds.
-
-Thu Aug 14 16:12:04 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * aux/macros/check_extern.m4 (pattern): use a simpler pattern for
- match for external function definitions. The function could span
- multiple lines, so only match the opening parenthesis, not the
- closing one too.
-
- * aux/macros/os_cpp-flags.m4 (ac_cv_os_cppflags,): do NOT turn on
- posix mode for nextstep3. It is broken.
-
- * amd/amd.c (init_global_options): run uname() only if
- <sys/utsname.h> and uname(2) exist.
-
- * amd/rpc_fwd.c (fwd_packet): if remote host is down, the
- forwarding socket is null, so declare this an error.
-
- * include/am_utils.h (AM_ERRNO_HOST_DOWN): find best errno to set
- for when a remote host is down. Try, in order, "host down", "host
- unreachable", "invalid argument".
-
- * amd/ops_nfs.c (discard_fh): don't dereference a null pointer
- (happens when remote host is down, and fp->fh_fs is NULL).
- (prime_nfs_fhandle_cache): ditto, and set fs flags to !FSF_VALID
- and FSF_DOWN.
-
- * amd/sched.c: nobody uses "union wait" any more, or so it
- appears, so clean up that code.
-
- * conf/transp/transp_tli.c (get_nfs_version): if remote host is
- down, time it out faster than default (3 seconds).
- (get_mount_client): free netconfig entry when done with it.
-
- * conf/nfs_prot/nfs_prot_nextstep.h: initial (and somewhat ugly)
- port to nextstep3 (m68k-next-nextstep3).
-
- * fsinfo/Makefile.am (LDADD): needs to link with libamu in case
- system does not have strdup().
-
- * include/am_defs.h: complete external definition for getlogin()
- if needed.
-
- * conf/transp/transp_tli.c (get_nfs_version): no need to keep
- static versout variable.
-
- * amd/rpc_fwd.c (fwd_packet): if fwdto packet is null, remote
- server is probably down. Don't use sendto() in that case.
-
- * buildall (default): run gmake if found, before trying plain
- make. GNU make is always preferable.
-
-Tue Aug 12 21:23:58 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * aux/macros/host_macros.m4: cleanup of os_version and os
- overrides. Solaris 2.5.1 for example will come up as solaris2 and
- 2.5.1, rather than sunos5 and 5.5.1. Both can be overridden in
- the amd.conf file.
-
-Fri Aug 8 14:37:30 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- *******************************************************************
- *** Released am-utils-6.0a9 ***
- *******************************************************************
-
-Thu Aug 7 00:52:14 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * conf/nfs_prot/nfs_prot_ncr2.h: new file, for NCR2
- (i486-ncr-sysv4.3.03) headers. Needed to complete missing stuff
- from <ndbm.h> and <sys/resource.h>.
-
- * scripts/amd.conf.5: new map page.
-
- * amd/info_hesiod.c: define extern for hesiod_resolve, since bsdi3
- does not.
-
- * amd/amd.8: updated man page.
-
- * amd/get_args.c (get_args): removed defunct -h option to amd.
-
- * amq/amq.8: updated man page.
-
- * amd/info_nisplus.c (nisplus_search): prototype fixes so Sun
- SparcCompiler CC won't complain.
-
- * amd/info_hesiod.c (hesiod_search): small fixes to compile with
- hesiod-1.3, as per Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>.
-
- * aux/macros/opt_ldflags.m4: new option added to configure
- --enable-ldflags, to specify -L option for configuring/compiling.
- The older one --enable-libs is now to be used only for -l options.
-
- * amd/ops_nfs.c (mount_nfs_fh): bug fixed. Should initialize
- nc_protoname from nfs_proto if available for all TLI systems, not
- just those that have NFS V3.
-
- * amd/info_ldap.c: ldap patches from Leif Johansson
- <leifj@matematik.su.se>, adding two new amd.conf ldap variables:
- ldap_cache_seconds and ldap_cache_maxmem.
-
- * hlfsd/hlfsd.c (main): bug fixed. port number must be wrapped in
- htons().
-
-Sun Aug 3 17:20:05 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * amd/nfs_start.c (mount_automounter): register amd with the rpc
- program number that may have been overridden by amd.conf.
-
- * libamu/xutil.c (set_amd_program_number, get_amd_program_number):
- allow storing and retrieving alternate amd program numbers.
-
- * amd/conf.c (gopt_portmap_program): new function to parse
- amd.conf entry portmap_program=1234.
-
- * amq/amq.c (main): allow specifying an alternate rpc program
- number for amd via -P prognum.
-
- * new amq RPC to get the process id of the running amd. This is
- used in ctl-amd to quickly find the pid of the amd that is to be
- killed.
-
- * expanded shared libraries support. Using GNU libtool-1.0,
- am-utils now builds shared libraries on many platforms that have
- support for it and proper compilers/linkers. See "INSTALL" file
- for compatibility chart.
-
-Thu Jul 31 13:07:23 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * fsinfo/fsi_lex.l: removed code that was in support of very old
- versions of flex. No longer needed.
-
-Tue Jul 29 12:00:13 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * amd/amd.c (init_global_options): find the kernel architecture
- from uname() if possible.
-
-Mon Jul 28 03:53:59 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * new working port: i386-unknown-openbsd2.1
-
-Fri Jul 25 03:16:31 1997 Erez Zadok <ezk@felix.psl.cs.columbia.edu>
-
- * working port: sparc-sun-solaris2.4. Had to fix fhandle_t from
- structure to actual char[], because the structure was passed to
- xdr_fhandle as data and not a pointer. Surprisingly, gcc
- -fpcc-struct-return did not help.
-
- * conf/nfs_prot/nfs_prot_sunos5_4.h: special nfs protocol
- definitions for solaris 2.4 have to be different from 2.3, and
- different from 2.5.
-
- * libamu/xdr_fhstatus.c (xdr_fhstatus): minor code cleanup.
-
-Thu Jul 24 16:22:39 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * conf/mount/mount_svr4.c (mount_svr4): use STREQ to compare mount
- types, not ==. Fix from Christos Zoulas <christos@deshaw.com>.
-
- * mk-amd-map/mk-amd-map.8: man page taken from bsd44.
-
-Thu Jul 24 00:01:55 1997 Erez Zadok <ezk@moisil.cs.columbia.edu>
-
- * conf/mount/mount_linux.c: made the nfs error mapping code into a
- small function.
-
-Wed Jul 23 16:11:49 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * conf/nfs_prot/nfs_prot_linux.h (NFS_ERROR_MAPPING): special
- error mappings from errno numbers to NFS errors. From Debian
- Linux.
-
- * scripts/am-eject.in (fs): new script (taken from Debian Linux
- folks) to auto-unmount floppy/cd devices before ejecting them.
-
- * fsinfo/wr_exportfs.c (write_exportfs): from Debian folks, pass
- '5' as second arg to show_area_being_processed. I'm not sure why.
-
- * fsinfo/wr_atab.c (write_atab): from Debian folks, pass '5' as
- second arg to show_area_being_processed. I'm not sure why.
-
- * conf/mount/mount_linux.c (parse_opts): as per Debian Linux,
- ensure that you have a buffer in *xopts to strcat onto.
- (mount_linux): fixed from Debian folks to ensure that NFS mount
- sockets are connected only for kernels prior to 1.3.10 (avoids
- hangs for multi-homed hosts).
-
- * amd/mapc.c (make_entry_chain): from Debian folks: don't skip
- over amd map keys that have a prefix, and include the prefix in
- the returned readdir().
-
- * amd/info_passwd.c (passwd_init, passwd_search): format
- enhancements from the Debian Linux folks. They added
- - var0:=pw-prefix:=anydir
- - var1:=pw-rhost:=dom3.dom2.dom1
- - var2:=pw-user:=user
- - var3:=pw-home:=/anydir/dom1/dom2/dom3/user
-
- * new ports: sparc-sun-solaris2.4 and sparc-sun-sunos4.1.1.
-
- * amd/ops_afs.c (afs_retry): patches from Debian Linux. If
- afs_mount timed out, then explicitly forbid further retries after
- the timeout. (afs_bgmount): buf fix from Debian Linux. Timeout
- values (17 and 5) were mistakenly swapped.
-
-Wed Jul 23 15:53:25 1997 Erez Zadok <ezk@felix.psl.cs.columbia.edu>
-
- * conf/nfs_prot/nfs_prot_sunos5_3.h: turn off non-existent NFS V.3
- support for Solaris 2.4 (the header files incorrectly define parts
- of the NFS V.3 protocol, but the kernel does not support it).
-
-Wed Jul 23 00:07:12 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * amd/info_hesiod.c: minor cleanup to use hes_init and hesiod_init
- for determining if using old or new hesiod libraries,
- respectively.
-
- * amd/ops_nfs.c (mount_nfs_fh): If "noconn" option exists in NFS
- V.3 then use non-connected sockets (both TCP and UDP). Otherwise
- they cause hangs of mounts from multi-homed hosts when the return
- route is not the same as the outgoing route (esp. on NetBSD
- 1.2.1). If "conn" option was supplied, then don't turn on the
- "noconn" mount option. Otherwise default to "noconn" mount
- option.
-
- * aux/configure.in: better check for systems that need libgdbm and
- <ndbm.h>
-
-Tue Jul 22 04:02:05 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * hlfsd/hlfsd.c (main), amd/ops_afs.c (mount_toplvl): ensure that
- mounts are hidden from df(1) on systems that keep mount tables in
- kernel, such as osf1.
-
-Tue Jul 22 02:26:55 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- *******************************************************************
- *** Released am-utils-6.0a8 ***
- *******************************************************************
-
-Mon Jul 21 21:33:19 1997 Erez Zadok <ezk@stone.mcl.cs.columbia.edu>
-
- * hlfsd/hlfsd.c (main): bug fixed: forgot to set sin_family to
- AF_INET when hlfsd mounts itself, thus getting an errno "protocol
- family not supported".
-
-Mon Jul 21 20:46:59 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * verified that amd on NetBSD 1.2.1 (i386) works, but the OS
- itself is flaky.
-
- * verified that amd AIX 3 works w/ the new readdir() code.
-
-Mon Jul 21 18:59:30 1997 Erez Zadok <ezk@chestnut.mcl.cs.columbia.edu>
-
- * amd/mapc.c (maptypes): changed the default map caching type for
- nis and ndbm maps to "MAPC_ALL", so that all possible entries will
- be available to amd for browsable_dirs=yes.
-
-Mon Jul 21 18:04:16 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * amd/ops_afs.c (afs_readdir, afs_readdir_browsable): split
- afs_readdir into a browsable version and a non-browsable one.
- Fixed bugs that resulted in an infinite nfs_readdir loop on the
- localhost for some operating systems.
-
-Sat Jul 19 19:38:38 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * amd/ops_afs.c (afs_readdir): fixed up the browsable code to
- comply with nfs_readdir specs. It was returning all entries at
- once, even if there was not enough space in the RPC packet. Now,
- it sends a reasonably sized chunk, and sets static state to resume
- it for the next continuation RPC of readdir.
-
- * amd/conf.c (set_conf_kv): fixed bug that resulted in the first
- regular map not getting all of the [global] options defaulted from.
-
-Fri Jul 18 00:45:12 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * amq/amq.c (main): fixed so that portmapper "ping" will only fail
- upon an RPC timeout
-
- * scripts/ctl-{amd,hlfsd}.in (killproc): better method to find the
- amd/hlfsd process to kill.
-
- * amd/ops_afs.c (mount_toplvl), hlfsd/hlfsd.c (main): code to
- determine how to avoid df from seeing amd's toplvl mounts. Moved
- from libamu/mount_fs.c and include/am_utils.h. Ensure that hlfsd
- is hidden from df.
- (mount_toplvl): fixed df types for irix.
-
-Thu Jul 17 21:59:45 1997 Erez Zadok <ezk@americas.psl.cs.columbia.edu>
-
- * amq/amq.c (main): fixed bug that caused the 5 second timeout for
- TLI amq using udp to be ignored.
- (main): if amq cannot contact remote host's portmapper within 5
- seconds, timeout and fail faster than the default longer timeout
- (this is for non-TLI systems).
-
-Thu Jul 17 17:08:13 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * amq/amq.c (get_secure_amd_client): if amq cannot contact
- remote host's portmapper within 5 seconds, timeout and fail faster
- than the default TLI timeout of over 4 minutes.
-
- * amd/am_ops.c (ops_showfstypes): added styles for new bsd44
- file systems nullfs, unionfs, and umapfs.
- (ops_show1): cleanup code and and reuse this function.
- (vops): empty placeholders for nullfs, unionfs, and umapfs.
-
- * amd/ops_{nullfs, unionfs, umapfs}.c: 3 new empty templates for
- bsd44 style file systems.
-
- * fsinfo/fsinfo.8: man page for fsinfo rewritten from bsd44
- sources.
-
- * amd/conf_tok.l, fsinof/fsi_lex.c: undefine ECHO to avoid
- conflict with systems that define it in <sys/ioctl.h> and also
- define a conflicting one via lex. Newer versions of f/lex are ok.
-
-Wed Jul 16 00:17:45 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * amd/ops_nfs.c (mount_nfs_fh): fill in nfs_args' fields
- acdirmin/max and acregmin/max only if they exist.
-
- * aux/configure.in: test for nfs_args fields acdirmin and
- acregmin.
-
-Tue Jul 15 17:24:09 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * aux/configure.in: commented out checking for MNT2_GEN_OPT_* for
- "nondev" and commented back in checking for "nodev". This was a
- typo.
-
- * include/am_compat.h: more compatibility options: define "ro"
- mnttab option all the time. Define "overlay" as needed. Added
- more fillers of mnttab options (as per Daniel S. Riley
- <dsr@mail.lns.cornell.edu>), for acdirmax, acdirmin, acregmax,
- acregmin, noac, grpid, nosuid, and actimo.
-
- * libamu/mount_fs.c (mnt_flags): fixed a typo in "ro" option as
- per dsr@mail.lns.cornell.edu (Daniel S. Riley). Then cleaned up
- the same code for other options in struct opt_tab.
-
-Mon Jul 14 22:36:37 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * amd/get_args.c (get_args): moved amd.conf file parsing to before
- the switching the default log/debug options. Suggested by
- dsr@mail.lns.cornell.edu (Daniel S. Riley).
-
- * aux/update_build_version: new script to record the build version
- of amd, along with the rest of the info thet comes up with amd -v.
-
-Sun Jul 13 00:30:24 1997 Erez Zadok <ezk@decca.damtp.cam.ac.uk>
-
- * aux/macros/os_cflags.m4: new macro, to add additional
- compilation options (also used during configuration), based on the
- OS and the compiler. Used for solaris-2.6, osf, and irix6.
-
-Fri Jul 11 10:15:11 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * amd/conf_tok.l, conf_parse.y: allow values of keys to include
- white spaces, if they are double-quoted (key="some value")
-
- * amd/info_hesiod.c (hesiod_search): cleanup and minor bug fixes
- of hesiod from Danny Braniss <danny@cs.huji.ac.il>.
-
-Fri Jul 11 02:16:06 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- *******************************************************************
- *** Released am-utils-6.0a7 ***
- *******************************************************************
-
-Thu Jul 10 12:19:25 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * include/am_defs.h: fill in extern definition of innetgr() in
- case system headers don't.
-
- * aux/macros/path_prog_lex.m4 aux/configure.in: using macros that
- will show the full pathname to yacc/bison and f/lex. Some systems
- have older or bad versions of those and this way the user will
- know for sure what is being invoked.
-
- * tasks: file populated with todo items.
-
- * scripts/amd2ldif.in: Script to convert amd maps to plain text
- LDAP object files. Contributed by Leif Johansson
- <leifj@matematik.su.se>.
-
- * aux/config.guess: added recognition for sun3's running 4.2bsd,
- from Tom Schmidt <tschmidt@micron.com>. Fixed one small typo.
-
- * amd/conf.c: several variables that were local to a map, were
- also added to [global], where they apply to all maps. Each map
- can then individually override those defaults. Flags
- affected: browsable_dirs and mount_type. Options affected:
- map_type, map_options, and search_path.
-
- * amd/amd.h: eliminated several global flags each of which took an
- int, in favor of one global flags variable used as a bit field.
-
- * amd/amd.c (init_global_options): moved all global variables into
- a single struct amu_global_options, so it is easier to add new
- ones and/or identify existing ones.
-
- * amd/get_args.c (get_args): removed unused amd -m option.
-
- * amd/conf.c (gopt_cluster): added new amd.conf option for cluster
- name, same as amd -C.
-
- * amd/info_ldap.c: LDAP info map functions from Leif Johansson
- <leifj@matematik.su.se>.
-
- * amd/conf.c (gopt_ldap_base, gopt_ldap_hostports): put in global
- amd.conf options for ldap_base and ldap_hostports.
-
- * amd/opts.c (f_netgrp): new amd map function netgrp(ARG) to test
- if the current host is in the ARG host netgroup.
-
- * aux/configure.in: some systems replaced dbm in libc with GNU's
- libgdbm, so check for libgdbm, but only if dbm_open is not in
- libc already. This was a recommendation from Tom Schmidt
- <tschmidt@micron.com>.
-
- * conf/nfs_prot/nfs_prot_sunos5_3.h: port to sparc-sun-solaris2.3
- completed.
-
-Wed Jul 9 18:14:59 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * port to sparc-unknown-netbsd1.2E done, not tested. Includes NFS
- V.3.
-
-Tue Jul 8 17:35:07 1997 Erez Zadok <ezk@elk.mcl.cs.columbia.edu>
-
- * port to i386-unknown-freebsd3.0 done and working. Includes NFS
- V.3.
-
- * aux/macros/check_nfs_fh_dref.m4: freebsd3 should use
- file handle dereferencing style similar to freebsd22.
-
- * include/am_defs.h: need to include <net/if_var.h> before
- <netinet/if_ether.h> on freebsd3.
-
- * conf/nfs_prot/nfs_prot_freebsd3.h: new protocol header additions
- for freeBSD 3.0.
-
-Tue Jul 8 16:53:41 1997 Erez Zadok <ezk@moisil.cs.columbia.edu>
-
- * amd/info_nis.c (nis_reload): cast nis' callback function so
- picky compilers won't complain.
-
- * libamu/xdr_mountres3.c (xdr_mountres3): make sure this function
- gets compiled only if the system has NFS V3 and does not have
- xdr_mountres3.
-
-Tue Jul 8 12:42:03 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * COPYING: put in some legal stuff in this file.
-
-Mon Jul 7 19:10:44 1997 Erez Zadok <ezk@prometheus.soscorp.com>
-
- * NFS V3 now works under Irix5, thanks to patches from
- Andreas Stolcke <stolcke@speech.sri.com>.
-
- * conf/mount/mount_irix5.c: sparate mount_irix.c into an irix5
- version and an irix6 version, since irix5's NFS V3 code is broken
- and hacky.
-
- * amd/info_hesiod.c (hs_zone_transfer): minor fixes to buffer
- sizes for some hesiod queries. Patch from Danny Braniss
- <danny@cs.huji.ac.il>.
-
-Mon Jul 7 19:04:14 1997 Erez Zadok <ezk@glory.soscorp.com>
-
- * amd/ops_nfs.c (mount_nfs_fh): fixed NFS V.3 support for bsdi3.
-
-Sun Jul 6 14:22:24 1997 Erez Zadok <ezk@glory.soscorp.com>
-
- * aux/{configure.in,acconfig.h}: added checks for struct
- nfs_args's fields proto and sotype (bsdi3).
-
- * amd/ops_nfs.c (mount_nfs_fh): added nfsv3 option to
- nfs_args.flags for bsdi3. Set field proto to 0. Set sotype field
- to SOCK_STREAM or SOCK_DGRAM.
-
- * aux/macros/check_mount_style.m4: add case for bsdi3.
-
- * amd/info_hesiod.c: got hesiod support for bsdi3.
-
-Sun Jul 6 11:14:47 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * aux/configure.in: look for hesiod on libc (bsdi3)
-
- * amd/get_args.c (get_args): reformat usage so it fits in 80
- columns.
-
- * scripts/ctl-amd.in: changed directory name for optional tftpboot
- map to /tftpboot/.amd.
-
-Sat Jul 5 17:46:45 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- *******************************************************************
- *** Released am-utils-6.0a6 ***
- *******************************************************************
-
-Sat Jul 5 03:17:09 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * scripts/ctl-amd.in: include -T tag for tftpboot.
-
- * new port: mips-sgi-irix5.3. Compiled with gcc, but NFS V3 code
- is broken and needs work on the specific nfs_args that irix5 uses
- for V3 mounts.
-
-Sat Jul 5 01:44:25 1997 Erez Zadok <ezk@lorien.cs.columbia.edu>
-
- * amd/get_args.c (get_args): new options amd -T tag. A map with
- tag=foo matching the -T tag will be processed. All untagged maps
- get processed all the time.
-
-Fri Jul 4 16:19:26 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * aux/configure.in: need to check for strcasecmp in libucb (ncr2)
-
- * aux/macros/check_os_libs.m4: a new macro to set the usage of
- libnsl and libsocket based on the OS.
-
- * libamu/mount_fs.c (mnt_flags): used MNTTAB_OPT_GRPID if it is
- defined (problem on osf4).
-
- * conf/nfs_prot/nfs_prot_irix5.h: new file for irix5 headers.
-
- * include/am_defs.h, aux/macros/try_compile_nfs.m4,
- aux/macros/mount_headers.m4: do include <sys/proc.h> because it
- failes on irix5. Rather, put in the individual
- conf/nfs_prot/nfs_prot_*.h headers.
-
- * amd/conf.c: AIX3 doesn't like strdup() being passed a constant
- char*, so cast all strdup()'s args to a non-const char*.
-
- * amd/mapc.c (root_newmap): don't try to strdup only a "const
- char *".
-
-Fri Jul 4 15:47:10 1997 Erez Zadok <ezk@americas.psl.cs.columbia.edu>
-
- * conf/nfs_prot/nfs_prot_sunos4.h: added rpc/rpc.h and
- sys/errno.h.
-
-Thu Jul 3 17:49:00 1997 Erez Zadok <ezk@prometheus.soscorp.com>
-
- * made sure am-utils compiles, links, and runs properly on Irix
- 6.2 using "cc -32 -Wl,-woff,"
-
- * aux/macros/check_lib2.m4: a bug fix version to autoconf 2.12
- AC_CHECK_LIB. If OTHER-LIBRARIES are defined and used, then add
- them to $LIBS.
-
- * aux/configure.in: some cleanup of which libraries are needed.
- Espectially ensure that libnsl is included only on Solaris, where
- so far it is the only system on which it is absolutely necessary.
- Also no longer need to include libc explicitly.
-
- * amd/amd.c,wire-test/wire-test.c (main): convert IP address to
- network-long order before printing it.
-
- * wire-test/wire-test.c (main): also check and report on the IP
- address of the local host, since some systems have bad versions of
- get_myaddress, or ones that conflict with other versions in
- multiple libraries (SunOS 4 and Irix especially).
-
-Wed Jul 2 18:19:02 1997 Erez Zadok <ezk@starblazers.soscorp.com>
-
- * scripts/ctl-amd.in: don't use full pathname so killproc() works
- better. Also run bsd44 and irix style ps programs.
-
- * aux/macros/check_lib_funcs.m4: bug fixed: used to define usage
- of library no matter if it was found or not.
-
-Wed Jul 2 02:11:48 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * aux/macros/check_mnt2_gen_opt.m4: turned back on the checking
- for M_* macros, but ensure that <sys/stream.h> is not included at
- all so it won't conflict with other M_* macros.
-
-Tue Jul 1 21:16:51 1997 Erez Zadok <ezk@mako.cs.columbia.edu>
-
- * conf/mount/mount_irix.c (mount_irix): first arg to mount(2) on
- irix should be "spec" (host:/path), not the dir of the mnt point.
-
- * amd/ops_afs.c (afs_lookuppn): bug in enable_default_selectors
- fixed. If on, it essentially ignored the setting in a
- selector-controlled /defaults if there were 2 or more entries in it.
-
-Tue Jul 1 12:23:38 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * scripts/ctl-{amd,hlfsd}.in (killproc): if failed to find process
- using BSD style ps, then try SVR4 style ps.
-
- * include/am_utils.h (amuDebug): renamed Debug macro to amuDebug
- etc., to avoid conflicts with similar named macros in <ldap.h>.
-
- * aux/configure.in, amd/info_ldap.c, etc.: put in all the autoconf
- support needed for LDAP. Now the code has to be written mostly in
- amd/info_ldap.c.
-
- * Included additional patches from Andreas Stolcke
- <stolcke@speech.sri.com> to support using the best possible
- combination of NFS version (2,3) and protocol (udp,tcp) for any
- given host, since it appears that some Irix versions have NFS V3,
- but do not support TCP.
-
- * scripts/ctl-amd.in: updated amd control script to look for and
- use amd.conf file.
-
-Tue Jul 1 00:28:23 1997 Erez Zadok <ezk@lorien.cs.columbia.edu>
-
- * amd/mapc.c (mapc_create): now, each map in the amd.conf can be
- initialized off of a different type, or default to cycling through
- all maps until one of them matches.
-
-Mon Jun 30 20:49:13 1997 Erez Zadok <ezk@lorien.cs.columbia.edu>
-
- * amd/ops_afs.c (afs_readdir): per-map browsing (readdir) done.
- if browsable_dirs=yes is set in the map section in amd.conf, that
- map will return all entries back to a readdir(2).
-
-Sun Jun 29 16:22:11 1997 Erez Zadok <ezk@lorien.cs.columbia.edu>
-
- * rudimentary amd.conf file support included. You may even
- override things like os=sos5, to get "backwards" compatibilty with
- upl102.
-
-Sat Jun 28 13:35:02 1997 Erez Zadok <ezk@lorien.cs.columbia.edu>
-
- * amd/conf.c: new file to process amd.conf file.
-
- * amd/get_args.c (get_args): new options -H to print help.
-
- * moved enable_default_selectors to be amd.conf controlled, and
- not compiler controlled.
-
- * amd/get_args.c (get_args): new options -F <conf-file> to parse an
- amd configuration file.
-
-Wed Jun 25 23:15:42 1997 Erez Zadok <ezk@lorien.cs.columbia.edu>
-
- * converted all files that used strcmp() == 0 or != 0 to using
- the STREQ() macro.
-
-Mon Jun 23 22:31:14 1997 Erez Zadok <ezk@lorien.cs.columbia.edu>
-
- * aux/macros/check_lib_funcs.m4: new M4 macro that can be used to
- search for any number of functions in any given library.
-
-Mon Jun 23 01:04:23 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * amd/mapc.c: Included patch from Leif Johansson
- <leifj@matematik.su.se> to ensure that systems without an RE
- library can compile.
-
- * libamu/mount_fs.c (mount_fs): Included patch from Andreas
- Stolcke <stolcke@speech.sri.com>, to ensure that mount options on
- table are properly delimited by a comma.
-
- * amd/ops_nfs.c (mount_nfs_fh): Included patch from Andreas
- Stolcke <stolcke@speech.sri.com>, to allow users to override the
- proto= and vers= mount options.
-
-Sun Jun 22 01:00:11 1997 Eric Dana (edana@ncr2.bgs.com)
-
- * conf/nfs_prot/nfs_prot_svr4.h: port completed to
- i486-ncr-sysv4.3.03. Assorted source cleanups done.
-
- * include/am_defs.h, aux/macros/mount_headers.m4: don't include
- mnttab.h if sys/mnttab.h was already included, because on ncr2,
- they contain conflicting entries for struct mnttab.
-
-Sat Jun 21 23:52:15 1997 Eric Dana (edana@ncr2.bgs.com)
-
- * aux/macros/check_nfs_prot_headers.m4: added support for ncr2.
-
-Fri Jun 20 06:14:17 1997 Erez Zadok <ezk>
-
- * amd/*.c: lots of 64-bit "ugly" ports like casts to long ints.
-
- * aux/macros/struct_nfs_fh.m4: check for "struct nfssvcfh" because
- on DU-4.0 it is better than the next one to be picked (nfsv2fh_t).
-
-Wed Jun 18 18:59:49 1997 Erez Zadok <ezk@defiant.soscorp.com>
-
- * aux/macros/struct_nfs_fh.m4 (AC_TRY_COMPILE_NFS): check for
- nfsv2fh_t before fhandle_t becasue on bsdi2.1 the former is
- better.
-
-Tue Jun 10 17:06:58 1997 Erez Zadok <ezk@lorien.cs.columbia.edu>
-
- * amd/rpc_fwd.c (fwd_packet): TLI bug fix. if fwdto socket is
- NULL, set the maxlen and len fields in netbuf to zero.
-
-Wed May 28 22:52:28 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * scripts/fix-amd-map.in (name): replace all matching patterns on
- line.
-
-Sun May 25 19:33:41 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- *******************************************************************
- *** Released am-utils-6.0a5 ***
- *******************************************************************
-
-Sun May 25 13:37:24 1997 Erez Zadok <ezk@lorien.cs.columbia.edu>
-
- * amd/amq_subr.c (amqproc_getvers_1_svc): amq's RPC service
- procedure now returns the full string that amd -v returns.
-
- * amd/get_args.c (get_version_string): new function to return
- complete version/info string so it could be used more flexibly.
-
- * amd/am_ops.c (ops_showamfstypes, ops_showfstypes): put the list
- of Fs types into a string buffer, rather than a FILE*.
-
- * amd/mapc.c (mapc_showtypes): put the list of map types into a
- string buffer, rather than a FILE*.
-
-Sun May 25 01:25:36 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * amd/get_args.c (get_args): amd -v also prints user who built
- amd, hostname built on, and date of configuration.
-
-Sat May 24 13:40:50 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * scripts/lostaltmail.conf-sample: sample lostaltmail
- configuration file.
-
- * scripts/lostaltmail.in: new script lostaltmail used to redeliver
- "lost" mail that hlfsd redirected to a temp location because the
- primary home file system of the user was full.
-
- * scripts/amd2sun.in: new script amd2sun. Used to convert Sub
- automount maps to amd maps.
-
- * scripts/ctl-hlfsd.in: new script ctl-hlfsd. Used to start,
- stop, or restart hlfsd.
-
- * scripts/expn.1: man page for expn command.
-
- * scripts/ctl-amd.in: new script ctl-amd. Used to start, stop, or
- restart amd.
-
- * scripts/expn.in: new script expn. Actually taken from David
- Muir Sharnoff <muir@idiom.com>. Used by hlfsd's mail re-delivery
- script.
-
- * scripts/wait4amd.in: new script wait4amd added. Waits for amd
- to come up on a host, and then runs a command (rsh $hostname by
- default).
-
- * scripts/Makefile.am: new directory now holds all shell/perl
- scripts that belong to am-utils.
-
- * conf/mount/mount_linux.c (parse_opts): new parser for
- linux-specific mounts. Handles fs-type specific mount-options
- correctly. Currently implemented: msdos, iso9660.
-
- * amd/ops_pcfs.c (pcfs_ops): don't timeout cdfs mounts by default
- (fix for linux).
-
- * amd/ops_cdfs.c (cdfs_ops): don't timeout cdfs mounts by default
- (fix for linux).
-
- * amd/mapc.c (make_entry_chain): fixed bug that resulted in amd
- core dumps upon "ls" of a mount point; an invalid pointer was
- being returned and dereferenced.
-
- * port to Linux sparc working!
-
- * hlfsd/homedir.c (hlfsd_diskspace): close file descriptor if
- failed to write test file, or else the fd will leak.
-
-Sun May 18 00:42:41 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * amd/info_hesiod.c (hs_strip_our_domain): use strcasecmp()
- instead of strcmp().
-
- * Port to Digital Unix 4.0 (OSF) done.
-
- * hlfsd/hlfsd.c: renamed dirname to dir_name to avoid conflicts
- with dirname() function in <string.h> on OSF systems.
-
- * fsinfo/fsi_util.c (set_ether_if): take out extern defintion of
- inet_addr(). It should come from <arpa/inet.h> instead.
-
- * conf/mtab/mtab_osf.c: fixed macros and added NFS V3 specs.
-
- * include/am_utils.h: renamed FIRST/LAST to AM_FIRST/AM_LAST to
- avoid conflicts with DU 4.0 system header.
-
-Thu May 15 22:49:12 1997 Erez Zadok <ezk@subzero.cs.columbia.edu>
-
- * libamu/mount_fs.c (mount_fs): pass along NFS version so I can
- determine if to include additional options in the mount table file
- entry (such as proto=tcp, and vers=3).
-
-Thu May 15 00:42:12 1997 Erez Zadok <ezk@shekel.mcl.cs.columbia.edu>
-
- * libamu/mount_fs.c (mount_fs): include NFS version number in the
- mount table options, as well as proto={tcp,udp}.
-
-Wed May 14 14:30:19 1997 Erez Zadok <ezk@lorien.cs.columbia.edu>
-
- * NFS V3 code ported to most other systems, so it compiles for V2
- and V3 NFS systems.
-
- * NFS VERSION 3 support, first pass. Working for Solaris and
- using TCP.
-
-Sun May 11 01:14:29 1997 Erez Zadok <ezk@lorien.cs.columbia.edu>
-
- * amq/amq.c: many newline characters were missing from various
- stderr printfs.
-
-Sat May 10 13:09:06 1997 Erez Zadok <ezk@lorien.cs.columbia.edu>
-
- * conf/nfs_prot/nfs_prot_sunos5.h: protocol defintions for
- Solaris, which include NFS V3 support.
-
- * conf/nfs_prot/nfs_prot_default.h: default NFS protocol headers.
* conf/transp/transp_{tli,sockets}.c (get_mount_client): use NFS
protocol version while getting a mount client.
@@ -6141,7 +4337,7 @@ Thu Dec 19 02:08:35 1996 Erez "HWank1" Zadok <ezk@shekel.mcl.cs.columbia.edu>
Wed Dec 18 22:20:23 1996 Erez "HWank1" Zadok <ezk@shekel.mcl.cs.columbia.edu>
* converted the sources to use memset/memmove/memcmp instead of
- bzero/becopy/bcmp.
+ bzero/bcopy/bcmp.
* ran all sources through gnu Indent w/ options specified in
aux/amindent.
@@ -6151,3 +4347,9 @@ Wed Dec 11 22:19:29 1996 Erez "HWank1" Zadok <ezk@shekel.mcl.cs.columbia.edu>
* At this point the initial genration of config.h via autoconf and
some preliminary makefiles via automake is done. I will not begin
modifying sources, so it's a good time to document from here.
+
+Wed Dec 10 22:19:29 1996 Erez "HWank1" Zadok <ezk@shekel.mcl.cs.columbia.edu>
+
+ *******************************************************************
+ *** Initial ChangeLog Entry ***
+ *******************************************************************
diff --git a/contrib/amd/amd/amd.8 b/contrib/amd/amd/amd.8
index f09fea9350df..b9c8b85e374d 100644
--- a/contrib/amd/amd/amd.8
+++ b/contrib/amd/amd/amd.8
@@ -39,7 +39,7 @@
.\" %W% (Berkeley) %G%
.\"
.\" $Id: amd.8,v 1.3 1999/09/30 21:01:29 ezk Exp $
-.\" $FreeBSD$
+.\" $FreeBSD: src/contrib/amd/amd/amd.8,v 1.3.2.1 1999/11/27 04:46:21 obrien Exp $
.\"
.Dd April 19, 1994
.Dt AMD 8
diff --git a/contrib/amd/amd/amd.c b/contrib/amd/amd/amd.c
index 07022e7de4e6..80b9e5df2f3e 100644
--- a/contrib/amd/amd/amd.c
+++ b/contrib/amd/amd/amd.c
@@ -39,7 +39,7 @@
* %W% (Berkeley) %G%
*
* $Id: amd.c,v 1.6 1999/09/30 21:01:29 ezk Exp $
- * $FreeBSD$
+ * $FreeBSD: src/contrib/amd/amd/amd.c,v 1.4.2.1 1999/11/27 04:46:22 obrien Exp $
*
*/
diff --git a/contrib/amd/amd/amq_subr.c b/contrib/amd/amd/amq_subr.c
index 4fb0541772e0..420294d79bd6 100644
--- a/contrib/amd/amd/amq_subr.c
+++ b/contrib/amd/amd/amq_subr.c
@@ -39,7 +39,7 @@
* %W% (Berkeley) %G%
*
* $Id: amq_subr.c,v 1.5 1999/08/24 21:31:06 ezk Exp $
- * $FreeBSD$
+ * $FreeBSD: src/contrib/amd/amd/amq_subr.c,v 1.3.2.2 1999/11/27 04:46:26 obrien Exp $
*
*/
/*
diff --git a/contrib/amd/amd/get_args.c b/contrib/amd/amd/get_args.c
index a5f5a4bfca90..35f7976f2603 100644
--- a/contrib/amd/amd/get_args.c
+++ b/contrib/amd/amd/get_args.c
@@ -39,7 +39,7 @@
* %W% (Berkeley) %G%
*
* $Id: get_args.c,v 1.4 1999/09/30 21:01:31 ezk Exp $
- * $FreeBSD$
+ * $FreeBSD: src/contrib/amd/amd/get_args.c,v 1.3.2.1 1999/11/27 04:46:29 obrien Exp $
*
*/
diff --git a/contrib/amd/amd/srvr_nfs.c b/contrib/amd/amd/srvr_nfs.c
index b5425bf7a724..5dab6805b4cc 100644
--- a/contrib/amd/amd/srvr_nfs.c
+++ b/contrib/amd/amd/srvr_nfs.c
@@ -39,7 +39,7 @@
* %W% (Berkeley) %G%
*
* $Id: srvr_nfs.c,v 1.5 1999/09/08 23:36:39 ezk Exp $
- * $FreeBSD$
+ * $FreeBSD: src/contrib/amd/amd/srvr_nfs.c,v 1.3.2.2 1999/11/27 04:46:38 obrien Exp $
*
*/
diff --git a/contrib/amd/amq/amq.8 b/contrib/amd/amq/amq.8
index c44f03626205..e1a0806a2002 100644
--- a/contrib/amd/amq/amq.8
+++ b/contrib/amd/amq/amq.8
@@ -39,7 +39,7 @@
.\" %W% (Berkeley) %G%
.\"
.\" $Id: amq.8,v 1.2 1999/01/10 21:53:58 ezk Exp $
-.\" $FreeBSD$
+.\" $FreeBSD: src/contrib/amd/amq/amq.8,v 1.4.2.1 1999/11/27 04:46:42 obrien Exp $
.\"
.Dd March 16, 1991
.Dt AMQ 8
diff --git a/contrib/amd/amq/amq.c b/contrib/amd/amq/amq.c
index 98711ebe7392..c9a9f1c18ac5 100644
--- a/contrib/amd/amq/amq.c
+++ b/contrib/amd/amq/amq.c
@@ -39,7 +39,7 @@
* %W% (Berkeley) %G%
*
* $Id: amq.c,v 1.6 1999/09/08 23:36:40 ezk Exp $
- * $FreeBSD$
+ * $FreeBSD: src/contrib/amd/amq/amq.c,v 1.3.2.4 1999/11/27 04:46:42 obrien Exp $
*
*/
diff --git a/contrib/amd/amq/pawd.1 b/contrib/amd/amq/pawd.1
index 6713907ac108..5561dce2de43 100644
--- a/contrib/amd/amq/pawd.1
+++ b/contrib/amd/amq/pawd.1
@@ -39,7 +39,7 @@
.\" %W% (Berkeley) %G%
.\"
.\" $Id: pawd.1,v 1.2 1998/09/05 06:56:36 obrien Exp $
-.\" $FreeBSD$
+.\" $FreeBSD: src/contrib/amd/amq/pawd.1,v 1.3.2.1 1999/11/27 04:46:44 obrien Exp $
.\"
.Dd January 6, 1998
.Dt PAWD 1
diff --git a/contrib/amd/conf/nfs_prot/nfs_prot_freebsd2.h b/contrib/amd/conf/nfs_prot/nfs_prot_freebsd2.h
index e719e9985cd4..934900de36c6 100644
--- a/contrib/amd/conf/nfs_prot/nfs_prot_freebsd2.h
+++ b/contrib/amd/conf/nfs_prot/nfs_prot_freebsd2.h
@@ -39,7 +39,7 @@
* %W% (Berkeley) %G%
*
* $Id: nfs_prot_freebsd2.h,v 1.2 1999/01/10 21:54:14 ezk Exp $
- * $FreeBSD$
+ * $FreeBSD: src/contrib/amd/conf/nfs_prot/nfs_prot_freebsd2.h,v 1.3.2.1 1999/11/27 04:46:47 obrien Exp $
*
*/
diff --git a/contrib/amd/conf/nfs_prot/nfs_prot_freebsd3.h b/contrib/amd/conf/nfs_prot/nfs_prot_freebsd3.h
index 29ce9496093e..3064981c7c50 100644
--- a/contrib/amd/conf/nfs_prot/nfs_prot_freebsd3.h
+++ b/contrib/amd/conf/nfs_prot/nfs_prot_freebsd3.h
@@ -39,7 +39,7 @@
* %W% (Berkeley) %G%
*
* $Id: nfs_prot_freebsd3.h,v 1.4 1999/03/30 17:22:54 ezk Exp $
- * $FreeBSD$
+ * $FreeBSD: src/contrib/amd/conf/nfs_prot/nfs_prot_freebsd3.h,v 1.6.2.1 1999/11/27 04:46:47 obrien Exp $
*
*/
diff --git a/contrib/amd/fixmount/fixmount.8 b/contrib/amd/fixmount/fixmount.8
index 14915affd7df..6a5203671f7c 100644
--- a/contrib/amd/fixmount/fixmount.8
+++ b/contrib/amd/fixmount/fixmount.8
@@ -39,7 +39,7 @@
.\" %W% (Berkeley) %G%
.\"
.\" $Id: fixmount.8,v 1.2 1999/01/10 21:54:26 ezk Exp $
-.\" $FreeBSD$
+.\" $FreeBSD: src/contrib/amd/fixmount/fixmount.8,v 1.4.2.1 1999/11/27 04:46:51 obrien Exp $
.\"
.Dd February 26, 1993
.Dt FIXMOUNT 8
diff --git a/contrib/amd/fixmount/fixmount.c b/contrib/amd/fixmount/fixmount.c
index 628e645fc0d0..4efd2f38481e 100644
--- a/contrib/amd/fixmount/fixmount.c
+++ b/contrib/amd/fixmount/fixmount.c
@@ -39,7 +39,7 @@
* %W% (Berkeley) %G%
*
* $Id: fixmount.c,v 1.4 1999/02/04 07:24:42 ezk Exp $
- * $FreeBSD$
+ * $FreeBSD: src/contrib/amd/fixmount/fixmount.c,v 1.4.2.1 1999/11/27 04:46:52 obrien Exp $
*
*/
diff --git a/contrib/amd/fsinfo/fsinfo.8 b/contrib/amd/fsinfo/fsinfo.8
index 2bc2d51044c4..e44419f96b1b 100644
--- a/contrib/amd/fsinfo/fsinfo.8
+++ b/contrib/amd/fsinfo/fsinfo.8
@@ -34,7 +34,7 @@
.\"
.\" from: @(#)fsinfo.8 8.1 (Berkeley) 6/28/93
.\" $Id: fsinfo.8,v 1.2 1999/01/10 21:54:28 ezk Exp $
-.\" $FreeBSD$
+.\" $FreeBSD: src/contrib/amd/fsinfo/fsinfo.8,v 1.2.2.2 1999/11/27 04:46:55 obrien Exp $
.\"
.Dd June 26, 1999
.Dt FSINFO 8
diff --git a/contrib/amd/fsinfo/fsinfo.c b/contrib/amd/fsinfo/fsinfo.c
index 111d205f63f3..0825b7d35981 100644
--- a/contrib/amd/fsinfo/fsinfo.c
+++ b/contrib/amd/fsinfo/fsinfo.c
@@ -39,7 +39,7 @@
* %W% (Berkeley) %G%
*
* $Id: fsinfo.c,v 1.4 1999/02/04 07:24:44 ezk Exp $
- * $FreeBSD$
+ * $FreeBSD: src/contrib/amd/fsinfo/fsinfo.c,v 1.3.2.1 1999/11/27 04:46:55 obrien Exp $
*
*/
diff --git a/contrib/amd/hlfsd/hlfsd.8 b/contrib/amd/hlfsd/hlfsd.8
index 77a2b8077c00..4b2140cccf90 100644
--- a/contrib/amd/hlfsd/hlfsd.8
+++ b/contrib/amd/hlfsd/hlfsd.8
@@ -37,7 +37,7 @@
.\" SUCH DAMAGE.
.\"
.\" $Id: hlfsd.8,v 1.2 1999/01/10 21:54:32 ezk Exp $
-.\" $FreeBSD$
+.\" $FreeBSD: src/contrib/amd/hlfsd/hlfsd.8,v 1.3.2.2 1999/11/27 04:46:58 obrien Exp $
.\"
.\" HLFSD was written at Columbia University Computer Science Department, by
.\" Erez Zadok <ezk@cs.columbia.edu> and Alexander Dupuy <dupuy@smarts.com>
diff --git a/contrib/amd/hlfsd/hlfsd.c b/contrib/amd/hlfsd/hlfsd.c
index dc5b2ace0713..d8ee2543947d 100644
--- a/contrib/amd/hlfsd/hlfsd.c
+++ b/contrib/amd/hlfsd/hlfsd.c
@@ -39,7 +39,7 @@
* %W% (Berkeley) %G%
*
* $Id: hlfsd.c,v 1.5 1999/09/08 23:36:51 ezk Exp $
- * $FreeBSD$
+ * $FreeBSD: src/contrib/amd/hlfsd/hlfsd.c,v 1.4.2.1 1999/11/27 04:46:58 obrien Exp $
*
* HLFSD was written at Columbia University Computer Science Department, by
* Erez Zadok <ezk@cs.columbia.edu> and Alexander Dupuy <dupuy@cs.columbia.edu>
diff --git a/contrib/amd/hlfsd/homedir.c b/contrib/amd/hlfsd/homedir.c
index 582acc831a9d..a5fbb1b29415 100644
--- a/contrib/amd/hlfsd/homedir.c
+++ b/contrib/amd/hlfsd/homedir.c
@@ -39,7 +39,7 @@
* %W% (Berkeley) %G%
*
* $Id: homedir.c,v 1.4 1999/01/13 23:31:19 ezk Exp $
- * $FreeBSD$
+ * $FreeBSD: src/contrib/amd/hlfsd/homedir.c,v 1.3.2.1 1999/11/27 04:46:59 obrien Exp $
*
* HLFSD was written at Columbia University Computer Science Department, by
* Erez Zadok <ezk@cs.columbia.edu> and Alexander Dupuy <dupuy@cs.columbia.edu>
diff --git a/contrib/amd/include/am_defs.h b/contrib/amd/include/am_defs.h
index 36c695eada4c..5dfefb925f64 100644
--- a/contrib/amd/include/am_defs.h
+++ b/contrib/amd/include/am_defs.h
@@ -39,7 +39,7 @@
* %W% (Berkeley) %G%
*
* $Id: am_defs.h,v 1.11 1999/09/18 08:38:05 ezk Exp $
- * $FreeBSD$
+ * $FreeBSD: src/contrib/amd/include/am_defs.h,v 1.4.2.2 1999/11/27 04:47:01 obrien Exp $
*
*/
diff --git a/contrib/amd/libamu/mount_fs.c b/contrib/amd/libamu/mount_fs.c
index 1a4deeee07d5..6e6ed24f073e 100644
--- a/contrib/amd/libamu/mount_fs.c
+++ b/contrib/amd/libamu/mount_fs.c
@@ -39,7 +39,7 @@
* %W% (Berkeley) %G%
*
* $Id: mount_fs.c,v 1.8 1999/09/18 08:38:06 ezk Exp $
- * $FreeBSD$
+ * $FreeBSD: src/contrib/amd/libamu/mount_fs.c,v 1.1.1.2.2.2 1999/11/27 04:47:04 obrien Exp $
*
*/
diff --git a/contrib/amd/mk-amd-map/mk-amd-map.8 b/contrib/amd/mk-amd-map/mk-amd-map.8
index 99f93e122be5..7d1464c3f8b9 100644
--- a/contrib/amd/mk-amd-map/mk-amd-map.8
+++ b/contrib/amd/mk-amd-map/mk-amd-map.8
@@ -34,7 +34,7 @@
.\"
.\" from: @(#)mk-amd-map.8 8.1 (Berkeley) 6/28/93
.\" $Id: mk-amd-map.8,v 1.2 1999/01/10 21:54:41 ezk Exp $
-.\" $FreeBSD$
+.\" $FreeBSD: src/contrib/amd/mk-amd-map/mk-amd-map.8,v 1.2.2.1 1999/11/27 04:47:07 obrien Exp $
.\"
.Dd June 28, 1993
.Dt MK-AMD-MAP 8
diff --git a/contrib/amd/mk-amd-map/mk-amd-map.c b/contrib/amd/mk-amd-map/mk-amd-map.c
index 755d5bf22b4c..4977c6056794 100644
--- a/contrib/amd/mk-amd-map/mk-amd-map.c
+++ b/contrib/amd/mk-amd-map/mk-amd-map.c
@@ -39,7 +39,7 @@
* %W% (Berkeley) %G%
*
* $Id: mk-amd-map.c,v 1.4 1999/02/04 07:24:50 ezk Exp $
- * $FreeBSD$
+ * $FreeBSD: src/contrib/amd/mk-amd-map/mk-amd-map.c,v 1.6.2.1 1999/11/27 04:47:08 obrien Exp $
*/
/*
diff --git a/contrib/amd/scripts/amd.conf.5 b/contrib/amd/scripts/amd.conf.5
index 2142622a4585..59577e037a43 100644
--- a/contrib/amd/scripts/amd.conf.5
+++ b/contrib/amd/scripts/amd.conf.5
@@ -39,7 +39,7 @@
.\" %W% (Berkeley) %G%
.\"
.\" $Id: amd.conf.5,v 1.3 1999/03/30 17:23:08 ezk Exp $
-.\" $FreeBSD$
+.\" $FreeBSD: src/contrib/amd/scripts/amd.conf.5,v 1.6.2.3 1999/11/27 04:47:09 obrien Exp $
.\"
.Dd April 7, 1997
.Dt AMD.CONF 5
diff --git a/contrib/amd/wire-test/wire-test.8 b/contrib/amd/wire-test/wire-test.8
index dfb8a862a2bb..12d72dd1c796 100644
--- a/contrib/amd/wire-test/wire-test.8
+++ b/contrib/amd/wire-test/wire-test.8
@@ -39,7 +39,7 @@
.\" %W% (Berkeley) %G%
.\"
.\" $Id: wire-test.8,v 1.2 1999/01/10 21:54:44 ezk Exp $
-.\" $FreeBSD$
+.\" $FreeBSD: src/contrib/amd/wire-test/wire-test.8,v 1.2.2.1 1999/11/27 04:47:11 obrien Exp $
.\"
.Dd February 26, 1993
.Dt WIRE-TEST 8
diff --git a/contrib/amd/wire-test/wire-test.c b/contrib/amd/wire-test/wire-test.c
index c55764707e15..a8af5adc256e 100644
--- a/contrib/amd/wire-test/wire-test.c
+++ b/contrib/amd/wire-test/wire-test.c
@@ -39,7 +39,7 @@
* %W% (Berkeley) %G%
*
* $Id: wire-test.c,v 1.4 1999/02/04 07:24:54 ezk Exp $
- * $FreeBSD$
+ * $FreeBSD: src/contrib/amd/wire-test/wire-test.c,v 1.4.2.1 1999/11/27 04:47:12 obrien Exp $
*
*/
diff --git a/contrib/awk/FREEBSD-upgrade b/contrib/awk/FREEBSD-upgrade
index 97e4270e182c..e23bcea5dbd0 100644
--- a/contrib/awk/FREEBSD-upgrade
+++ b/contrib/awk/FREEBSD-upgrade
@@ -1,4 +1,4 @@
-$FreeBSD$
+$FreeBSD: src/contrib/awk/FREEBSD-upgrade,v 1.5.2.1 1999/12/08 17:57:51 sheldonh Exp $
Import of GNU awk 3.0.4
diff --git a/contrib/awk/awk.h b/contrib/awk/awk.h
index 621a98109574..dfad49cccb6f 100644
--- a/contrib/awk/awk.h
+++ b/contrib/awk/awk.h
@@ -22,7 +22,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $FreeBSD$
+ * $FreeBSD: src/contrib/awk/awk.h,v 1.4.2.1 1999/12/08 17:57:54 sheldonh Exp $
*/
/* ------------------------------ Includes ------------------------------ */
diff --git a/contrib/awk/builtin.c b/contrib/awk/builtin.c
index 0fee05459a2a..8178c583ddbf 100644
--- a/contrib/awk/builtin.c
+++ b/contrib/awk/builtin.c
@@ -22,7 +22,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $FreeBSD$
+ * $FreeBSD: src/contrib/awk/builtin.c,v 1.5.2.1 1999/12/08 17:57:55 sheldonh Exp $
*/
diff --git a/contrib/awk/doc/awk.1 b/contrib/awk/doc/awk.1
index 807f79f156b9..28322e10d63e 100644
--- a/contrib/awk/doc/awk.1
+++ b/contrib/awk/doc/awk.1
@@ -1,4 +1,4 @@
-.\" $FreeBSD$
+.\" $FreeBSD: src/contrib/awk/doc/awk.1,v 1.3.2.1 1999/12/08 17:58:01 sheldonh Exp $
.ds PX \s-1POSIX\s+1
.ds UX \s-1UNIX\s+1
.ds AN \s-1ANSI\s+1
diff --git a/contrib/awk/eval.c b/contrib/awk/eval.c
index 37c5fef86789..37adf2acd3be 100644
--- a/contrib/awk/eval.c
+++ b/contrib/awk/eval.c
@@ -22,7 +22,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $FreeBSD$
+ * $FreeBSD: src/contrib/awk/eval.c,v 1.3.2.1 1999/12/08 17:57:56 sheldonh Exp $
*/
#include "awk.h"
diff --git a/contrib/awk/field.c b/contrib/awk/field.c
index 72cbd78e8c20..19403bab9c05 100644
--- a/contrib/awk/field.c
+++ b/contrib/awk/field.c
@@ -22,7 +22,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $FreeBSD$
+ * $FreeBSD: src/contrib/awk/field.c,v 1.3.2.1 1999/12/08 17:57:56 sheldonh Exp $
*/
#include "awk.h"
diff --git a/contrib/awk/io.c b/contrib/awk/io.c
index 0a24f8af30ce..0b796170436a 100644
--- a/contrib/awk/io.c
+++ b/contrib/awk/io.c
@@ -22,7 +22,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $FreeBSD$
+ * $FreeBSD: src/contrib/awk/io.c,v 1.3.2.1 1999/12/08 17:57:57 sheldonh Exp $
*/
#include "awk.h"
diff --git a/contrib/awk/main.c b/contrib/awk/main.c
index 27452f00aed3..db972f72b1f5 100644
--- a/contrib/awk/main.c
+++ b/contrib/awk/main.c
@@ -22,7 +22,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $FreeBSD$
+ * $FreeBSD: src/contrib/awk/main.c,v 1.3.2.1 1999/12/08 17:57:57 sheldonh Exp $
*/
#include "awk.h"
diff --git a/contrib/awk/node.c b/contrib/awk/node.c
index a8892a35678b..5691757453d3 100644
--- a/contrib/awk/node.c
+++ b/contrib/awk/node.c
@@ -22,7 +22,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $FreeBSD$
+ * $FreeBSD: src/contrib/awk/node.c,v 1.3.2.1 1999/12/08 17:57:57 sheldonh Exp $
*/
#include "awk.h"
diff --git a/contrib/bind/bin/named-xfer/named-xfer.c b/contrib/bind/bin/named-xfer/named-xfer.c
index d7db8869d47b..db27743f2cdc 100644
--- a/contrib/bind/bin/named-xfer/named-xfer.c
+++ b/contrib/bind/bin/named-xfer/named-xfer.c
@@ -1,4 +1,4 @@
-/* $FreeBSD$ */
+/* $FreeBSD: src/contrib/bind/bin/named-xfer/named-xfer.c,v 1.2.2.1 1999/12/13 15:05:19 peter Exp $ */
/*
* The original version of named-xfer by Kevin Dunlap.
* Completed and integrated with named by David Waitzman
diff --git a/contrib/bind/bin/named/Makefile b/contrib/bind/bin/named/Makefile
index 96a392725fb4..1318ee43d3ad 100644
--- a/contrib/bind/bin/named/Makefile
+++ b/contrib/bind/bin/named/Makefile
@@ -14,7 +14,7 @@
## SOFTWARE.
# $Id: Makefile,v 8.47 1999/08/26 18:42:31 vixie Exp $
-# $FreeBSD$
+# $FreeBSD: src/contrib/bind/bin/named/Makefile,v 1.2.2.1 1999/12/13 15:04:45 peter Exp $
DESTDIR=
CC= cc
diff --git a/contrib/bind/bin/nslookup/commands.l b/contrib/bind/bin/nslookup/commands.l
index c480d46e52ac..e73fa0f9afae 100644
--- a/contrib/bind/bin/nslookup/commands.l
+++ b/contrib/bind/bin/nslookup/commands.l
@@ -1,5 +1,5 @@
%{
-/* $FreeBSD$ */
+/* $FreeBSD: src/contrib/bind/bin/nslookup/commands.l,v 1.1.1.1.2.1 1999/12/13 15:05:23 peter Exp $ */
/*
* Copyright (c) 1985
* The Regents of the University of California. All rights reserved.
diff --git a/contrib/bind/bin/nslookup/debug.c b/contrib/bind/bin/nslookup/debug.c
index 7dac192e5cb0..7cd4e33aeee7 100644
--- a/contrib/bind/bin/nslookup/debug.c
+++ b/contrib/bind/bin/nslookup/debug.c
@@ -1,4 +1,4 @@
-/* $FreeBSD$ */
+/* $FreeBSD: src/contrib/bind/bin/nslookup/debug.c,v 1.2.2.1 1999/12/13 15:05:24 peter Exp $ */
/*
* Copyright (c) 1985, 1989
* The Regents of the University of California. All rights reserved.
diff --git a/contrib/bind/bin/nslookup/getinfo.c b/contrib/bind/bin/nslookup/getinfo.c
index 673bad0a443b..121eb1335150 100644
--- a/contrib/bind/bin/nslookup/getinfo.c
+++ b/contrib/bind/bin/nslookup/getinfo.c
@@ -1,4 +1,4 @@
-/* $FreeBSD$ */
+/* $FreeBSD: src/contrib/bind/bin/nslookup/getinfo.c,v 1.2.2.1 1999/12/13 15:05:24 peter Exp $ */
/*
* Copyright (c) 1985, 1989
* The Regents of the University of California. All rights reserved.
diff --git a/contrib/bind/bin/nslookup/main.c b/contrib/bind/bin/nslookup/main.c
index 454fe12b1c2a..b45e19d77eed 100644
--- a/contrib/bind/bin/nslookup/main.c
+++ b/contrib/bind/bin/nslookup/main.c
@@ -1,4 +1,4 @@
-/* $FreeBSD$ */
+/* $FreeBSD: src/contrib/bind/bin/nslookup/main.c,v 1.1.1.1.2.1 1999/12/13 15:05:26 peter Exp $ */
/*
* Copyright (c) 1985, 1989
* The Regents of the University of California. All rights reserved.
diff --git a/contrib/bind/doc/man/dig.1 b/contrib/bind/doc/man/dig.1
index 3e59b056c58c..cb0bdc3ab3e2 100644
--- a/contrib/bind/doc/man/dig.1
+++ b/contrib/bind/doc/man/dig.1
@@ -1,4 +1,4 @@
-.\" $FreeBSD$
+.\" $FreeBSD: src/contrib/bind/doc/man/dig.1,v 1.1.1.1.2.1 1999/12/13 15:05:44 peter Exp $
.\" $Id: dig.1,v 8.4 1999/10/15 21:29:58 vixie Exp $
.\"
.\" ++Copyright++ 1993
diff --git a/contrib/bind/port/freebsd/include/port_after.h b/contrib/bind/port/freebsd/include/port_after.h
index 8dcd1f8654e1..bfb5b1a5b923 100644
--- a/contrib/bind/port/freebsd/include/port_after.h
+++ b/contrib/bind/port/freebsd/include/port_after.h
@@ -1,4 +1,4 @@
-/* $FreeBSD$ */
+/* $FreeBSD: src/contrib/bind/port/freebsd/include/port_after.h,v 1.3.2.1 1999/12/13 15:08:00 peter Exp $ */
#ifndef PORT_AFTER_H
#define PORT_AFTER_H
#define CAN_RECONNECT
diff --git a/contrib/binutils/bfd/VERSION b/contrib/binutils/bfd/VERSION
new file mode 100644
index 000000000000..dbe590065479
--- /dev/null
+++ b/contrib/binutils/bfd/VERSION
@@ -0,0 +1 @@
+2.8.1
diff --git a/contrib/binutils/bfd/doc/bfd.texi b/contrib/binutils/bfd/doc/bfd.texi
new file mode 100644
index 000000000000..ea0ca9e56dc9
--- /dev/null
+++ b/contrib/binutils/bfd/doc/bfd.texi
@@ -0,0 +1,585 @@
+@section @code{typedef bfd}
+A BFD has type @code{bfd}; objects of this type are the
+cornerstone of any application using BFD. Using BFD
+consists of making references though the BFD and to data in the BFD.
+
+Here is the structure that defines the type @code{bfd}. It
+contains the major data about the file and pointers
+to the rest of the data.
+@*
+.
+@example
+struct _bfd
+@{
+ /* The filename the application opened the BFD with. */
+ CONST char *filename;
+
+ /* A pointer to the target jump table. */
+ const struct bfd_target *xvec;
+
+ /* To avoid dragging too many header files into every file that
+ includes `@code{bfd.h}', IOSTREAM has been declared as a "char
+ *", and MTIME as a "long". Their correct types, to which they
+ are cast when used, are "FILE *" and "time_t". The iostream
+ is the result of an fopen on the filename. However, if the
+ BFD_IN_MEMORY flag is set, then iostream is actually a pointer
+ to a bfd_in_memory struct. */
+ PTR iostream;
+
+ /* Is the file descriptor being cached? That is, can it be closed as
+ needed, and re-opened when accessed later? */
+
+ boolean cacheable;
+
+ /* Marks whether there was a default target specified when the
+ BFD was opened. This is used to select which matching algorithm
+ to use to choose the back end. */
+
+ boolean target_defaulted;
+
+ /* The caching routines use these to maintain a
+ least-recently-used list of BFDs */
+
+ struct _bfd *lru_prev, *lru_next;
+
+ /* When a file is closed by the caching routines, BFD retains
+ state information on the file here: */
+
+ file_ptr where;
+
+ /* and here: (``once'' means at least once) */
+
+ boolean opened_once;
+
+ /* Set if we have a locally maintained mtime value, rather than
+ getting it from the file each time: */
+
+ boolean mtime_set;
+
+ /* File modified time, if mtime_set is true: */
+
+ long mtime;
+
+ /* Reserved for an unimplemented file locking extension.*/
+
+ int ifd;
+
+ /* The format which belongs to the BFD. (object, core, etc.) */
+
+ bfd_format format;
+
+ /* The direction the BFD was opened with*/
+
+ enum bfd_direction @{no_direction = 0,
+ read_direction = 1,
+ write_direction = 2,
+ both_direction = 3@} direction;
+
+ /* Format_specific flags*/
+
+ flagword flags;
+
+ /* Currently my_archive is tested before adding origin to
+ anything. I believe that this can become always an add of
+ origin, with origin set to 0 for non archive files. */
+
+ file_ptr origin;
+
+ /* Remember when output has begun, to stop strange things
+ from happening. */
+ boolean output_has_begun;
+
+ /* Pointer to linked list of sections*/
+ struct sec *sections;
+
+ /* The number of sections */
+ unsigned int section_count;
+
+ /* Stuff only useful for object files:
+ The start address. */
+ bfd_vma start_address;
+
+ /* Used for input and output*/
+ unsigned int symcount;
+
+ /* Symbol table for output BFD (with symcount entries) */
+ struct symbol_cache_entry **outsymbols;
+
+ /* Pointer to structure which contains architecture information*/
+ const struct bfd_arch_info *arch_info;
+
+ /* Stuff only useful for archives:*/
+ PTR arelt_data;
+ struct _bfd *my_archive; /* The containing archive BFD. */
+ struct _bfd *next; /* The next BFD in the archive. */
+ struct _bfd *archive_head; /* The first BFD in the archive. */
+ boolean has_armap;
+
+ /* A chain of BFD structures involved in a link. */
+ struct _bfd *link_next;
+
+ /* A field used by _bfd_generic_link_add_archive_symbols. This will
+ be used only for archive elements. */
+ int archive_pass;
+
+ /* Used by the back end to hold private data. */
+
+ union
+ @{
+ struct aout_data_struct *aout_data;
+ struct artdata *aout_ar_data;
+ struct _oasys_data *oasys_obj_data;
+ struct _oasys_ar_data *oasys_ar_data;
+ struct coff_tdata *coff_obj_data;
+ struct pe_tdata *pe_obj_data;
+ struct xcoff_tdata *xcoff_obj_data;
+ struct ecoff_tdata *ecoff_obj_data;
+ struct ieee_data_struct *ieee_data;
+ struct ieee_ar_data_struct *ieee_ar_data;
+ struct srec_data_struct *srec_data;
+ struct ihex_data_struct *ihex_data;
+ struct tekhex_data_struct *tekhex_data;
+ struct elf_obj_tdata *elf_obj_data;
+ struct nlm_obj_tdata *nlm_obj_data;
+ struct bout_data_struct *bout_data;
+ struct sun_core_struct *sun_core_data;
+ struct trad_core_struct *trad_core_data;
+ struct som_data_struct *som_data;
+ struct hpux_core_struct *hpux_core_data;
+ struct hppabsd_core_struct *hppabsd_core_data;
+ struct sgi_core_struct *sgi_core_data;
+ struct lynx_core_struct *lynx_core_data;
+ struct osf_core_struct *osf_core_data;
+ struct cisco_core_struct *cisco_core_data;
+ struct versados_data_struct *versados_data;
+ struct netbsd_core_struct *netbsd_core_data;
+ PTR any;
+ @} tdata;
+
+ /* Used by the application to hold private data*/
+ PTR usrdata;
+
+ /* Where all the allocated stuff under this BFD goes. This is a
+ struct objalloc *, but we use PTR to avoid requiring the inclusion of
+ objalloc.h. */
+ PTR memory;
+@};
+
+@end example
+@section Error reporting
+Most BFD functions return nonzero on success (check their
+individual documentation for precise semantics). On an error,
+they call @code{bfd_set_error} to set an error condition that callers
+can check by calling @code{bfd_get_error}.
+If that returns @code{bfd_error_system_call}, then check
+@code{errno}.
+
+The easiest way to report a BFD error to the user is to
+use @code{bfd_perror}.
+@*
+@subsection Type @code{bfd_error_type}
+The values returned by @code{bfd_get_error} are defined by the
+enumerated type @code{bfd_error_type}.
+@*
+.
+@example
+typedef enum bfd_error
+@{
+ bfd_error_no_error = 0,
+ bfd_error_system_call,
+ bfd_error_invalid_target,
+ bfd_error_wrong_format,
+ bfd_error_invalid_operation,
+ bfd_error_no_memory,
+ bfd_error_no_symbols,
+ bfd_error_no_armap,
+ bfd_error_no_more_archived_files,
+ bfd_error_malformed_archive,
+ bfd_error_file_not_recognized,
+ bfd_error_file_ambiguously_recognized,
+ bfd_error_no_contents,
+ bfd_error_nonrepresentable_section,
+ bfd_error_no_debug_section,
+ bfd_error_bad_value,
+ bfd_error_file_truncated,
+ bfd_error_file_too_big,
+ bfd_error_invalid_error_code
+@} bfd_error_type;
+
+@end example
+@findex bfd_get_error
+@subsubsection @code{bfd_get_error}
+@strong{Synopsis}
+@example
+bfd_error_type bfd_get_error (void);
+@end example
+@strong{Description}@*
+Return the current BFD error condition.
+@*
+@findex bfd_set_error
+@subsubsection @code{bfd_set_error}
+@strong{Synopsis}
+@example
+void bfd_set_error (bfd_error_type error_tag);
+@end example
+@strong{Description}@*
+Set the BFD error condition to be @var{error_tag}.
+@*
+@findex bfd_errmsg
+@subsubsection @code{bfd_errmsg}
+@strong{Synopsis}
+@example
+CONST char *bfd_errmsg (bfd_error_type error_tag);
+@end example
+@strong{Description}@*
+Return a string describing the error @var{error_tag}, or
+the system error if @var{error_tag} is @code{bfd_error_system_call}.
+@*
+@findex bfd_perror
+@subsubsection @code{bfd_perror}
+@strong{Synopsis}
+@example
+void bfd_perror (CONST char *message);
+@end example
+@strong{Description}@*
+Print to the standard error stream a string describing the
+last BFD error that occurred, or the last system error if
+the last BFD error was a system call failure. If @var{message}
+is non-NULL and non-empty, the error string printed is preceded
+by @var{message}, a colon, and a space. It is followed by a newline.
+@*
+@subsection BFD error handler
+Some BFD functions want to print messages describing the
+problem. They call a BFD error handler function. This
+function may be overriden by the program.
+
+The BFD error handler acts like printf.
+@*
+.
+@example
+typedef void (*bfd_error_handler_type) PARAMS ((const char *, ...));
+
+@end example
+@findex bfd_set_error_handler
+@subsubsection @code{bfd_set_error_handler}
+@strong{Synopsis}
+@example
+bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type);
+@end example
+@strong{Description}@*
+Set the BFD error handler function. Returns the previous
+function.
+@*
+@findex bfd_set_error_program_name
+@subsubsection @code{bfd_set_error_program_name}
+@strong{Synopsis}
+@example
+void bfd_set_error_program_name (const char *);
+@end example
+@strong{Description}@*
+Set the program name to use when printing a BFD error. This
+is printed before the error message followed by a colon and
+space. The string must not be changed after it is passed to
+this function.
+@*
+@section Symbols
+
+@*
+@findex bfd_get_reloc_upper_bound
+@subsubsection @code{bfd_get_reloc_upper_bound}
+@strong{Synopsis}
+@example
+long bfd_get_reloc_upper_bound(bfd *abfd, asection *sect);
+@end example
+@strong{Description}@*
+Return the number of bytes required to store the
+relocation information associated with section @var{sect}
+attached to bfd @var{abfd}. If an error occurs, return -1.
+@*
+@findex bfd_canonicalize_reloc
+@subsubsection @code{bfd_canonicalize_reloc}
+@strong{Synopsis}
+@example
+long bfd_canonicalize_reloc
+ (bfd *abfd,
+ asection *sec,
+ arelent **loc,
+ asymbol **syms);
+@end example
+@strong{Description}@*
+Call the back end associated with the open BFD
+@var{abfd} and translate the external form of the relocation
+information attached to @var{sec} into the internal canonical
+form. Place the table into memory at @var{loc}, which has
+been preallocated, usually by a call to
+@code{bfd_get_reloc_upper_bound}. Returns the number of relocs, or
+-1 on error.
+
+The @var{syms} table is also needed for horrible internal magic
+reasons.
+@*
+@findex bfd_set_reloc
+@subsubsection @code{bfd_set_reloc}
+@strong{Synopsis}
+@example
+void bfd_set_reloc
+ (bfd *abfd, asection *sec, arelent **rel, unsigned int count)
+@end example
+@strong{Description}@*
+Set the relocation pointer and count within
+section @var{sec} to the values @var{rel} and @var{count}.
+The argument @var{abfd} is ignored.
+@*
+@findex bfd_set_file_flags
+@subsubsection @code{bfd_set_file_flags}
+@strong{Synopsis}
+@example
+boolean bfd_set_file_flags(bfd *abfd, flagword flags);
+@end example
+@strong{Description}@*
+Set the flag word in the BFD @var{abfd} to the value @var{flags}.
+
+Possible errors are:
+@itemize @bullet
+
+@item
+@code{bfd_error_wrong_format} - The target bfd was not of object format.
+@item
+@code{bfd_error_invalid_operation} - The target bfd was open for reading.
+@item
+@code{bfd_error_invalid_operation} -
+The flag word contained a bit which was not applicable to the
+type of file. E.g., an attempt was made to set the @code{D_PAGED} bit
+on a BFD format which does not support demand paging.
+@end itemize
+@*
+@findex bfd_set_start_address
+@subsubsection @code{bfd_set_start_address}
+@strong{Synopsis}
+@example
+boolean bfd_set_start_address(bfd *abfd, bfd_vma vma);
+@end example
+@strong{Description}@*
+Make @var{vma} the entry point of output BFD @var{abfd}.
+@*
+@strong{Returns}@*
+Returns @code{true} on success, @code{false} otherwise.
+@*
+@findex bfd_get_mtime
+@subsubsection @code{bfd_get_mtime}
+@strong{Synopsis}
+@example
+long bfd_get_mtime(bfd *abfd);
+@end example
+@strong{Description}@*
+Return the file modification time (as read from the file system, or
+from the archive header for archive members).
+@*
+@findex bfd_get_size
+@subsubsection @code{bfd_get_size}
+@strong{Synopsis}
+@example
+long bfd_get_size(bfd *abfd);
+@end example
+@strong{Description}@*
+Return the file size (as read from file system) for the file
+associated with BFD @var{abfd}.
+
+The initial motivation for, and use of, this routine is not
+so we can get the exact size of the object the BFD applies to, since
+that might not be generally possible (archive members for example).
+It would be ideal if someone could eventually modify
+it so that such results were guaranteed.
+
+Instead, we want to ask questions like "is this NNN byte sized
+object I'm about to try read from file offset YYY reasonable?"
+As as example of where we might do this, some object formats
+use string tables for which the first @code{sizeof(long)} bytes of the
+table contain the size of the table itself, including the size bytes.
+If an application tries to read what it thinks is one of these
+string tables, without some way to validate the size, and for
+some reason the size is wrong (byte swapping error, wrong location
+for the string table, etc.), the only clue is likely to be a read
+error when it tries to read the table, or a "virtual memory
+exhausted" error when it tries to allocate 15 bazillon bytes
+of space for the 15 bazillon byte table it is about to read.
+This function at least allows us to answer the quesion, "is the
+size reasonable?".
+@*
+@findex bfd_get_gp_size
+@subsubsection @code{bfd_get_gp_size}
+@strong{Synopsis}
+@example
+int bfd_get_gp_size(bfd *abfd);
+@end example
+@strong{Description}@*
+Return the maximum size of objects to be optimized using the GP
+register under MIPS ECOFF. This is typically set by the @code{-G}
+argument to the compiler, assembler or linker.
+@*
+@findex bfd_set_gp_size
+@subsubsection @code{bfd_set_gp_size}
+@strong{Synopsis}
+@example
+void bfd_set_gp_size(bfd *abfd, int i);
+@end example
+@strong{Description}@*
+Set the maximum size of objects to be optimized using the GP
+register under ECOFF or MIPS ELF. This is typically set by
+the @code{-G} argument to the compiler, assembler or linker.
+@*
+@findex bfd_scan_vma
+@subsubsection @code{bfd_scan_vma}
+@strong{Synopsis}
+@example
+bfd_vma bfd_scan_vma(CONST char *string, CONST char **end, int base);
+@end example
+@strong{Description}@*
+Convert, like @code{strtoul}, a numerical expression
+@var{string} into a @code{bfd_vma} integer, and return that integer.
+(Though without as many bells and whistles as @code{strtoul}.)
+The expression is assumed to be unsigned (i.e., positive).
+If given a @var{base}, it is used as the base for conversion.
+A base of 0 causes the function to interpret the string
+in hex if a leading "0x" or "0X" is found, otherwise
+in octal if a leading zero is found, otherwise in decimal.
+
+Overflow is not detected.
+@*
+@findex bfd_copy_private_bfd_data
+@subsubsection @code{bfd_copy_private_bfd_data}
+@strong{Synopsis}
+@example
+boolean bfd_copy_private_bfd_data(bfd *ibfd, bfd *obfd);
+@end example
+@strong{Description}@*
+Copy private BFD information from the BFD @var{ibfd} to the
+the BFD @var{obfd}. Return @code{true} on success, @code{false} on error.
+Possible error returns are:
+
+@itemize @bullet
+
+@item
+@code{bfd_error_no_memory} -
+Not enough memory exists to create private data for @var{obfd}.
+@end itemize
+@example
+#define bfd_copy_private_bfd_data(ibfd, obfd) \
+ BFD_SEND (obfd, _bfd_copy_private_bfd_data, \
+ (ibfd, obfd))
+@end example
+@*
+@findex bfd_merge_private_bfd_data
+@subsubsection @code{bfd_merge_private_bfd_data}
+@strong{Synopsis}
+@example
+boolean bfd_merge_private_bfd_data(bfd *ibfd, bfd *obfd);
+@end example
+@strong{Description}@*
+Merge private BFD information from the BFD @var{ibfd} to the
+the output file BFD @var{obfd} when linking. Return @code{true}
+on success, @code{false} on error. Possible error returns are:
+
+@itemize @bullet
+
+@item
+@code{bfd_error_no_memory} -
+Not enough memory exists to create private data for @var{obfd}.
+@end itemize
+@example
+#define bfd_merge_private_bfd_data(ibfd, obfd) \
+ BFD_SEND (obfd, _bfd_merge_private_bfd_data, \
+ (ibfd, obfd))
+@end example
+@*
+@findex bfd_set_private_flags
+@subsubsection @code{bfd_set_private_flags}
+@strong{Synopsis}
+@example
+boolean bfd_set_private_flags(bfd *abfd, flagword flags);
+@end example
+@strong{Description}@*
+Set private BFD flag information in the BFD @var{abfd}.
+Return @code{true} on success, @code{false} on error. Possible error
+returns are:
+
+@itemize @bullet
+
+@item
+@code{bfd_error_no_memory} -
+Not enough memory exists to create private data for @var{obfd}.
+@end itemize
+@example
+#define bfd_set_private_flags(abfd, flags) \
+ BFD_SEND (abfd, _bfd_set_private_flags, \
+ (abfd, flags))
+@end example
+@*
+@findex stuff
+@subsubsection @code{stuff}
+@strong{Description}@*
+Stuff which should be documented:
+@example
+#define bfd_sizeof_headers(abfd, reloc) \
+ BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc))
+
+#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \
+ BFD_SEND (abfd, _bfd_find_nearest_line, (abfd, sec, syms, off, file, func, line))
+
+ /* Do these three do anything useful at all, for any back end? */
+#define bfd_debug_info_start(abfd) \
+ BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
+
+#define bfd_debug_info_end(abfd) \
+ BFD_SEND (abfd, _bfd_debug_info_end, (abfd))
+
+#define bfd_debug_info_accumulate(abfd, section) \
+ BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section))
+
+
+#define bfd_stat_arch_elt(abfd, stat) \
+ BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat))
+
+#define bfd_update_armap_timestamp(abfd) \
+ BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd))
+
+#define bfd_set_arch_mach(abfd, arch, mach)\
+ BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
+
+#define bfd_relax_section(abfd, section, link_info, again) \
+ BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
+
+#define bfd_link_hash_table_create(abfd) \
+ BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
+
+#define bfd_link_add_symbols(abfd, info) \
+ BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
+
+#define bfd_final_link(abfd, info) \
+ BFD_SEND (abfd, _bfd_final_link, (abfd, info))
+
+#define bfd_free_cached_info(abfd) \
+ BFD_SEND (abfd, _bfd_free_cached_info, (abfd))
+
+#define bfd_get_dynamic_symtab_upper_bound(abfd) \
+ BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd))
+
+#define bfd_print_private_bfd_data(abfd, file)\
+ BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file))
+
+#define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \
+ BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols))
+
+#define bfd_get_dynamic_reloc_upper_bound(abfd) \
+ BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd))
+
+#define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \
+ BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms))
+
+extern bfd_byte *bfd_get_relocated_section_contents
+ PARAMS ((bfd *, struct bfd_link_info *,
+ struct bfd_link_order *, bfd_byte *,
+ boolean, asymbol **));
+
+@end example
+@*
diff --git a/contrib/binutils/gas/conf.in b/contrib/binutils/gas/conf.in
new file mode 100644
index 000000000000..d56807cd88d5
--- /dev/null
+++ b/contrib/binutils/gas/conf.in
@@ -0,0 +1,127 @@
+/* conf.in. Generated automatically from configure.in by autoheader. */
+
+/* Define if using alloca.c. */
+#undef C_ALLOCA
+
+/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
+ This function is required for alloca.c support on those systems. */
+#undef CRAY_STACKSEG_END
+
+/* Define if you have alloca, as a function or macro. */
+#undef HAVE_ALLOCA
+
+/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
+#undef HAVE_ALLOCA_H
+
+/* Define as __inline if that's what the C compiler calls it. */
+#undef inline
+
+/* If using the C implementation of alloca, define if you know the
+ direction of stack growth for your system; otherwise it will be
+ automatically deduced at run-time.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown
+ */
+#undef STACK_DIRECTION
+
+/* Should gas use high-level BFD interfaces? */
+#undef BFD_ASSEMBLER
+
+/* Some assert/preprocessor combinations are incapable of handling
+ certain kinds of constructs in the argument of assert. For example,
+ quoted strings (if requoting isn't done right) or newlines. */
+#undef BROKEN_ASSERT
+
+/* If we aren't doing cross-assembling, some operations can be optimized,
+ since byte orders and value sizes don't need to be adjusted. */
+#undef CROSS_COMPILE
+
+/* Some gas code wants to know these parameters. */
+#undef TARGET_ALIAS
+#undef TARGET_CPU
+#undef TARGET_CANONICAL
+#undef TARGET_OS
+#undef TARGET_VENDOR
+
+/* Sometimes the system header files don't declare strstr. */
+#undef NEED_DECLARATION_STRSTR
+
+/* Sometimes the system header files don't declare malloc and realloc. */
+#undef NEED_DECLARATION_MALLOC
+
+/* Sometimes the system header files don't declare free. */
+#undef NEED_DECLARATION_FREE
+
+/* Sometimes the system header files don't declare sbrk. */
+#undef NEED_DECLARATION_SBRK
+
+/* Sometimes errno.h doesn't declare errno itself. */
+#undef NEED_DECLARATION_ERRNO
+
+#undef MANY_SEGMENTS
+
+/* Needed only for sparc configuration. */
+#undef SPARC_V9
+#undef SPARC_ARCH64
+
+/* Defined if using CGEN. */
+#undef USING_CGEN
+
+/* Needed only for some configurations that can produce multiple output
+ formats. */
+#undef DEFAULT_EMULATION
+#undef EMULATIONS
+#undef USE_EMULATIONS
+#undef OBJ_MAYBE_AOUT
+#undef OBJ_MAYBE_BOUT
+#undef OBJ_MAYBE_COFF
+#undef OBJ_MAYBE_ECOFF
+#undef OBJ_MAYBE_ELF
+#undef OBJ_MAYBE_GENERIC
+#undef OBJ_MAYBE_HP300
+#undef OBJ_MAYBE_IEEE
+#undef OBJ_MAYBE_SOM
+#undef OBJ_MAYBE_VMS
+
+/* Used for some of the COFF configurations, when the COFF code needs
+ to select something based on the CPU type before it knows it... */
+#undef I386COFF
+#undef M68KCOFF
+#undef M88KCOFF
+
+/* Define if you have the remove function. */
+#undef HAVE_REMOVE
+
+/* Define if you have the sbrk function. */
+#undef HAVE_SBRK
+
+/* Define if you have the unlink function. */
+#undef HAVE_UNLINK
+
+/* Define if you have the <errno.h> header file. */
+#undef HAVE_ERRNO_H
+
+/* Define if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define if you have the <stdarg.h> header file. */
+#undef HAVE_STDARG_H
+
+/* Define if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define if you have the <varargs.h> header file. */
+#undef HAVE_VARARGS_H
diff --git a/contrib/binutils/gas/config/i386coff.mt b/contrib/binutils/gas/config/i386coff.mt
new file mode 100644
index 000000000000..efda83365181
--- /dev/null
+++ b/contrib/binutils/gas/config/i386coff.mt
@@ -0,0 +1 @@
+TDEFINES=-DI386COFF
diff --git a/contrib/binutils/gas/config/sco5.mt b/contrib/binutils/gas/config/sco5.mt
new file mode 100644
index 000000000000..8879320c4e1e
--- /dev/null
+++ b/contrib/binutils/gas/config/sco5.mt
@@ -0,0 +1 @@
+TDEFINES=-DSCO_ELF
diff --git a/contrib/binutils/install.sh b/contrib/binutils/install.sh
new file mode 100755
index 000000000000..4b883b386de2
--- /dev/null
+++ b/contrib/binutils/install.sh
@@ -0,0 +1,247 @@
+#!/bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5 (mit/util/scripts/install.sh).
+#
+# Copyright 1991 by the Massachusetts Institute of Technology
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of M.I.T. not be used in advertising or
+# publicity pertaining to distribution of the software without specific,
+# written prior permission. M.I.T. makes no representations about the
+# suitability of this software for any purpose. It is provided "as is"
+# without express or implied warranty.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+#
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+transformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -c) instcmd="$cpprog"
+ shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd="$stripprog"
+ shift
+ continue;;
+
+ -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+ shift
+ continue;;
+
+ -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+ shift
+ continue;;
+
+ *) if [ x"$src" = x ]
+ then
+ src=$1
+ else
+ # this colon is to work around a 386BSD /bin/sh bug
+ :
+ dst=$1
+ fi
+ shift
+ continue;;
+ esac
+done
+
+if [ x"$src" = x ]
+then
+ echo "install: no input file specified"
+ exit 1
+else
+ true
+fi
+
+if [ x"$dir_arg" != x ]; then
+ dst=$src
+ src=""
+
+ if [ -d $dst ]; then
+ instcmd=:
+ chmodcmd=""
+ else
+ instcmd=mkdir
+ fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad
+# if $src (and thus $dsttmp) contains '*'.
+
+ if [ -f $src -o -d $src ]
+ then
+ true
+ else
+ echo "install: $src does not exist"
+ exit 1
+ fi
+
+ if [ x"$dst" = x ]
+ then
+ echo "install: no destination specified"
+ exit 1
+ else
+ true
+ fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+ if [ -d $dst ]
+ then
+ dst="$dst"/`basename $src`
+ else
+ true
+ fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+# this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='
+'
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+ pathcomp="${pathcomp}${1}"
+ shift
+
+ if [ ! -d "${pathcomp}" ] ;
+ then
+ $mkdirprog "${pathcomp}"
+ else
+ true
+ fi
+
+ pathcomp="${pathcomp}/"
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+ $doit $instcmd $dst &&
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+ if [ x"$transformarg" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ dstfile=`basename $dst $transformbasename |
+ sed $transformarg`$transformbasename
+ fi
+
+# don't allow the sed command to completely eliminate the filename
+
+ if [ x"$dstfile" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ true
+ fi
+
+# Make a temp file name in the proper directory.
+
+ dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+ $doit $instcmd $src $dsttmp &&
+
+ trap "rm -f ${dsttmp}" 0 &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing. If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+
+# Now rename the file to the real destination.
+
+ $doit $rmcmd -f $dstdir/$dstfile &&
+ $doit $mvcmd $dsttmp $dstdir/$dstfile
+
+fi &&
+
+
+exit 0
diff --git a/contrib/cvs/FREEBSD-upgrade b/contrib/cvs/FREEBSD-upgrade
index d40330c19d5d..02954fba8825 100644
--- a/contrib/cvs/FREEBSD-upgrade
+++ b/contrib/cvs/FREEBSD-upgrade
@@ -1,4 +1,4 @@
-$FreeBSD$
+$FreeBSD: src/contrib/cvs/FREEBSD-upgrade,v 1.5.2.1 1999/12/13 20:56:22 peter Exp $
MAINTAINER= peter@FreeBSD.org
diff --git a/contrib/cvs/contrib/log.pl b/contrib/cvs/contrib/log.pl
index 676d6c9fbe16..a3212bb5bfc2 100644
--- a/contrib/cvs/contrib/log.pl
+++ b/contrib/cvs/contrib/log.pl
@@ -5,7 +5,7 @@
#
# XXX -- I HATE Perl! This *will* be re-written in shell/awk/sed soon!
#
-# $FreeBSD$
+# $FreeBSD: src/contrib/cvs/contrib/log.pl,v 1.2.2.2 1999/12/13 20:56:33 peter Exp $
# Usage: log.pl [[-m user] ...] [-s] -f logfile 'dirname file ...'
#
diff --git a/contrib/cvs/diff/diff3.c b/contrib/cvs/diff/diff3.c
index c2997e92cb5f..cbb7e40dcdc2 100644
--- a/contrib/cvs/diff/diff3.c
+++ b/contrib/cvs/diff/diff3.c
@@ -13,7 +13,7 @@
*/
/*
- * $FreeBSD$
+ * $FreeBSD: src/contrib/cvs/diff/diff3.c,v 1.1.1.1.4.2 1999/12/13 20:56:37 peter Exp $
*/
/* Written by Randy Smith */
diff --git a/contrib/cvs/lib/md5.h b/contrib/cvs/lib/md5.h
index 3b5ba05891f2..9ab1ea7141d0 100644
--- a/contrib/cvs/lib/md5.h
+++ b/contrib/cvs/lib/md5.h
@@ -1,7 +1,7 @@
/* See md5.c for explanation and copyright information. */
/*
- * $FreeBSD$
+ * $FreeBSD: src/contrib/cvs/lib/md5.h,v 1.1.1.2.2.1 1999/12/13 20:56:48 peter Exp $
*/
#ifndef MD5_H
diff --git a/contrib/cvs/man/cvs.1 b/contrib/cvs/man/cvs.1
index fe9e30a2e756..d1f1224bd36f 100644
--- a/contrib/cvs/man/cvs.1
+++ b/contrib/cvs/man/cvs.1
@@ -1,4 +1,4 @@
-.\" $FreeBSD$
+.\" $FreeBSD: src/contrib/cvs/man/cvs.1,v 1.11.2.3 1999/12/13 20:56:50 peter Exp $
.de Id
.ds Rv \\$3
.ds Dt \\$4
diff --git a/contrib/cvs/src/commit.c b/contrib/cvs/src/commit.c
index 6dfd4a80602e..260ce9e617aa 100644
--- a/contrib/cvs/src/commit.c
+++ b/contrib/cvs/src/commit.c
@@ -12,7 +12,7 @@
*
* The call is: cvs commit [options] files...
*
- * $FreeBSD$
+ * $FreeBSD: src/contrib/cvs/src/commit.c,v 1.5.2.2 1999/12/13 20:56:54 peter Exp $
*/
#include <assert.h>
diff --git a/contrib/cvs/src/cvs.h b/contrib/cvs/src/cvs.h
index b889c9a8501e..afe3174a3b91 100644
--- a/contrib/cvs/src/cvs.h
+++ b/contrib/cvs/src/cvs.h
@@ -9,7 +9,7 @@
/*
* basic information used in all source files
*
- * $FreeBSD$
+ * $FreeBSD: src/contrib/cvs/src/cvs.h,v 1.9.2.2 1999/12/13 20:56:56 peter Exp $
*/
diff --git a/contrib/cvs/src/diff.c b/contrib/cvs/src/diff.c
index 15353e63f61c..adade85c9047 100644
--- a/contrib/cvs/src/diff.c
+++ b/contrib/cvs/src/diff.c
@@ -13,7 +13,7 @@
* Without any file arguments, runs diff against all the currently modified
* files.
*
- * $FreeBSD$
+ * $FreeBSD: src/contrib/cvs/src/diff.c,v 1.10.2.2 1999/12/13 20:56:56 peter Exp $
*/
#include "cvs.h"
diff --git a/contrib/cvs/src/filesubr.c b/contrib/cvs/src/filesubr.c
index 83f7fb94665e..d87f239efd32 100644
--- a/contrib/cvs/src/filesubr.c
+++ b/contrib/cvs/src/filesubr.c
@@ -18,7 +18,7 @@
file system semantics. */
/*
- * $FreeBSD$
+ * $FreeBSD: src/contrib/cvs/src/filesubr.c,v 1.2.2.2 1999/12/13 20:56:59 peter Exp $
*/
#include "cvs.h"
diff --git a/contrib/cvs/src/import.c b/contrib/cvs/src/import.c
index a449842623c2..7c77ab2c34c9 100644
--- a/contrib/cvs/src/import.c
+++ b/contrib/cvs/src/import.c
@@ -15,7 +15,7 @@
*
* Additional arguments specify more Vendor Release Tags.
*
- * $FreeBSD$
+ * $FreeBSD: src/contrib/cvs/src/import.c,v 1.5.2.2 1999/12/13 20:57:00 peter Exp $
*/
#include "cvs.h"
diff --git a/contrib/cvs/src/lock.c b/contrib/cvs/src/lock.c
index a0c0a343ebd7..d1c08ee06f87 100644
--- a/contrib/cvs/src/lock.c
+++ b/contrib/cvs/src/lock.c
@@ -9,7 +9,7 @@
*
* Lock file support for CVS.
*
- * $FreeBSD$
+ * $FreeBSD: src/contrib/cvs/src/lock.c,v 1.6.2.1 1999/12/13 20:57:01 peter Exp $
*/
/* The node Concurrency in doc/cvs.texinfo has a brief introduction to
diff --git a/contrib/cvs/src/login.c b/contrib/cvs/src/login.c
index 708dfc8d15d5..c7da8f8d80c9 100644
--- a/contrib/cvs/src/login.c
+++ b/contrib/cvs/src/login.c
@@ -6,7 +6,7 @@
*
* Allow user to log in for an authenticating server.
*
- * $FreeBSD$
+ * $FreeBSD: src/contrib/cvs/src/login.c,v 1.2.2.1 1999/12/13 20:57:02 peter Exp $
*/
#include "cvs.h"
diff --git a/contrib/cvs/src/logmsg.c b/contrib/cvs/src/logmsg.c
index e1b8ed04e8b1..208a8028388f 100644
--- a/contrib/cvs/src/logmsg.c
+++ b/contrib/cvs/src/logmsg.c
@@ -5,7 +5,7 @@
* You may distribute under the terms of the GNU General Public License as
* specified in the README file that comes with the CVS source distribution.
*
- * $FreeBSD$
+ * $FreeBSD: src/contrib/cvs/src/logmsg.c,v 1.5.2.1 1999/12/13 20:57:02 peter Exp $
*/
#include "cvs.h"
diff --git a/contrib/cvs/src/main.c b/contrib/cvs/src/main.c
index 39bfaa2cc39c..a88c7aabd9aa 100644
--- a/contrib/cvs/src/main.c
+++ b/contrib/cvs/src/main.c
@@ -10,7 +10,7 @@
* Credit to Dick Grune, Vrije Universiteit, Amsterdam, for writing
* the shell-script CVS system that this is based on.
*
- * $FreeBSD$
+ * $FreeBSD: src/contrib/cvs/src/main.c,v 1.15.2.2 1999/12/13 20:57:02 peter Exp $
*/
#include <assert.h>
diff --git a/contrib/cvs/src/mkmodules.c b/contrib/cvs/src/mkmodules.c
index 966fb3285e16..7fdeec2b9754 100644
--- a/contrib/cvs/src/mkmodules.c
+++ b/contrib/cvs/src/mkmodules.c
@@ -5,7 +5,7 @@
* You may distribute under the terms of the GNU General Public License as
* specified in the README file that comes with the CVS kit.
*
- * $FreeBSD$
+ * $FreeBSD: src/contrib/cvs/src/mkmodules.c,v 1.7.2.2 1999/12/13 20:57:03 peter Exp $
*/
#include "cvs.h"
diff --git a/contrib/cvs/src/prepend_args.c b/contrib/cvs/src/prepend_args.c
index 12322ce48bdf..64f89586f1b7 100644
--- a/contrib/cvs/src/prepend_args.c
+++ b/contrib/cvs/src/prepend_args.c
@@ -16,7 +16,7 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
-/* $FreeBSD$ */
+/* $FreeBSD: src/contrib/cvs/src/prepend_args.c,v 1.2.2.1 1999/12/13 20:57:05 peter Exp $ */
#ifdef HAVE_CONFIG_H
diff --git a/contrib/cvs/src/prepend_args.h b/contrib/cvs/src/prepend_args.h
index 6708442ec124..84b1d21a6c51 100644
--- a/contrib/cvs/src/prepend_args.h
+++ b/contrib/cvs/src/prepend_args.h
@@ -16,7 +16,7 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
-/* $FreeBSD$ */
+/* $FreeBSD: src/contrib/cvs/src/prepend_args.h,v 1.1.2.1 1999/12/13 20:57:05 peter Exp $ */
/* This code, taken from GNU Grep, originally used the "PARAM" macro, as the
current GNU coding standards requires. Older GNU code used the "PROTO"
diff --git a/contrib/cvs/src/rcs.c b/contrib/cvs/src/rcs.c
index 48be8e5ccb0a..ee7b9ac038e2 100644
--- a/contrib/cvs/src/rcs.c
+++ b/contrib/cvs/src/rcs.c
@@ -7,7 +7,7 @@
* The routines contained in this file do all the rcs file parsing and
* manipulation
*
- * $FreeBSD$
+ * $FreeBSD: src/contrib/cvs/src/rcs.c,v 1.16.2.2 1999/12/13 20:57:06 peter Exp $
*/
#include <assert.h>
diff --git a/contrib/cvs/src/rcs.h b/contrib/cvs/src/rcs.h
index 7aee90ac61ae..96a0a033515a 100644
--- a/contrib/cvs/src/rcs.h
+++ b/contrib/cvs/src/rcs.h
@@ -7,7 +7,7 @@
*
* RCS source control definitions needed by rcs.c and friends
*
- * $FreeBSD$
+ * $FreeBSD: src/contrib/cvs/src/rcs.h,v 1.5.2.2 1999/12/13 20:57:07 peter Exp $
*/
/* String which indicates a conflict if it occurs at the start of a line. */
diff --git a/contrib/cvs/src/rcscmds.c b/contrib/cvs/src/rcscmds.c
index bcdffd5ad312..f49d946424e6 100644
--- a/contrib/cvs/src/rcscmds.c
+++ b/contrib/cvs/src/rcscmds.c
@@ -8,7 +8,7 @@
* The functions in this file provide an interface for performing
* operations directly on RCS files.
*
- * $FreeBSD$
+ * $FreeBSD: src/contrib/cvs/src/rcscmds.c,v 1.5.2.2 1999/12/13 20:57:07 peter Exp $
*/
#include "cvs.h"
diff --git a/contrib/cvs/src/recurse.c b/contrib/cvs/src/recurse.c
index 209d324e44a7..cbb821f847d0 100644
--- a/contrib/cvs/src/recurse.c
+++ b/contrib/cvs/src/recurse.c
@@ -6,7 +6,7 @@
*
* General recursion handler
*
- * $FreeBSD$
+ * $FreeBSD: src/contrib/cvs/src/recurse.c,v 1.4.2.2 1999/12/13 20:57:08 peter Exp $
*/
#include "cvs.h"
diff --git a/contrib/cvs/src/server.c b/contrib/cvs/src/server.c
index 63fef8c74f0c..62718ebdd856 100644
--- a/contrib/cvs/src/server.c
+++ b/contrib/cvs/src/server.c
@@ -9,7 +9,7 @@
GNU General Public License for more details. */
/*
- * $FreeBSD$
+ * $FreeBSD: src/contrib/cvs/src/server.c,v 1.11.2.2 1999/12/13 20:57:13 peter Exp $
*/
#include <assert.h>
diff --git a/contrib/cvs/src/update.c b/contrib/cvs/src/update.c
index 89e8323b9144..a109f1219fe7 100644
--- a/contrib/cvs/src/update.c
+++ b/contrib/cvs/src/update.c
@@ -32,7 +32,7 @@
* directories added to the repository are automatically created and updated
* as well.
*
- * $FreeBSD$
+ * $FreeBSD: src/contrib/cvs/src/update.c,v 1.4.2.2 1999/12/13 20:57:15 peter Exp $
*/
#include "cvs.h"
diff --git a/contrib/diff/diff.c b/contrib/diff/diff.c
index 2b2eec0236f2..d73235271b7a 100644
--- a/contrib/diff/diff.c
+++ b/contrib/diff/diff.c
@@ -20,7 +20,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* GNU DIFF was written by Mike Haertel, David Hayes,
Richard Stallman, Len Tower, and Paul Eggert. */
-/* $FreeBSD$ */
+/* $FreeBSD: src/contrib/diff/diff.c,v 1.2.2.1 1999/12/08 06:33:18 obrien Exp $ */
#define GDIFF_MAIN
#include "diff.h"
diff --git a/contrib/diff/prepend_args.c b/contrib/diff/prepend_args.c
index 27f6da47403f..97fe15c9bc86 100644
--- a/contrib/diff/prepend_args.c
+++ b/contrib/diff/prepend_args.c
@@ -16,7 +16,7 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
-/* $FreeBSD$ */
+/* $FreeBSD: src/contrib/diff/prepend_args.c,v 1.1.2.1 1999/12/08 06:33:20 obrien Exp $ */
#ifdef HAVE_CONFIG_H
diff --git a/contrib/diff/prepend_args.h b/contrib/diff/prepend_args.h
index 3f72cc2fd112..e3d157a0afb5 100644
--- a/contrib/diff/prepend_args.h
+++ b/contrib/diff/prepend_args.h
@@ -16,6 +16,6 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
-/* $FreeBSD$ */
+/* $FreeBSD: src/contrib/diff/prepend_args.h,v 1.1.2.1 1999/12/08 06:33:20 obrien Exp $ */
void prepend_default_options PARAMS ((char const *, int *, char ***));
diff --git a/contrib/gcc/INSTALL b/contrib/gcc/INSTALL
new file mode 100644
index 000000000000..9577a45cd0de
--- /dev/null
+++ b/contrib/gcc/INSTALL
@@ -0,0 +1,1898 @@
+This file documents the installation of the GNU compiler. Copyright
+(C) 1988, 1989, 1992, 1994, 1995 Free Software Foundation, Inc. You
+may copy, distribute, and modify it freely as long as you preserve this
+copyright notice and permission notice.
+
+Installing GNU CC
+*****************
+
+ Here is the procedure for installing GNU CC on a Unix system. See
+*Note VMS Install::, for VMS systems. In this section we assume you
+compile in the same directory that contains the source files; see *Note
+Other Dir::, to find out how to compile in a separate directory on Unix
+systems.
+
+ You cannot install GNU C by itself on MSDOS; it will not compile
+under any MSDOS compiler except itself. You need to get the complete
+compilation package DJGPP, which includes binaries as well as sources,
+and includes all the necessary compilation tools and libraries.
+
+ 1. If you have built GNU CC previously in the same directory for a
+ different target machine, do `make distclean' to delete all files
+ that might be invalid. One of the files this deletes is
+ `Makefile'; if `make distclean' complains that `Makefile' does not
+ exist, it probably means that the directory is already suitably
+ clean.
+
+ 2. On a System V release 4 system, make sure `/usr/bin' precedes
+ `/usr/ucb' in `PATH'. The `cc' command in `/usr/ucb' uses
+ libraries which have bugs.
+
+ 3. Specify the host, build and target machine configurations. You do
+ this by running the file `configure'.
+
+ The "build" machine is the system which you are using, the "host"
+ machine is the system where you want to run the resulting compiler
+ (normally the build machine), and the "target" machine is the
+ system for which you want the compiler to generate code.
+
+ If you are building a compiler to produce code for the machine it
+ runs on (a native compiler), you normally do not need to specify
+ any operands to `configure'; it will try to guess the type of
+ machine you are on and use that as the build, host and target
+ machines. So you don't need to specify a configuration when
+ building a native compiler unless `configure' cannot figure out
+ what your configuration is or guesses wrong.
+
+ In those cases, specify the build machine's "configuration name"
+ with the `--build' option; the host and target will default to be
+ the same as the build machine. (If you are building a
+ cross-compiler, see *Note Cross-Compiler::.)
+
+ Here is an example:
+
+ ./configure --build=sparc-sun-sunos4.1
+
+ A configuration name may be canonical or it may be more or less
+ abbreviated.
+
+ A canonical configuration name has three parts, separated by
+ dashes. It looks like this: `CPU-COMPANY-SYSTEM'. (The three
+ parts may themselves contain dashes; `configure' can figure out
+ which dashes serve which purpose.) For example,
+ `m68k-sun-sunos4.1' specifies a Sun 3.
+
+ You can also replace parts of the configuration by nicknames or
+ aliases. For example, `sun3' stands for `m68k-sun', so
+ `sun3-sunos4.1' is another way to specify a Sun 3. You can also
+ use simply `sun3-sunos', since the version of SunOS is assumed by
+ default to be version 4. `sun3-bsd' also works, since `configure'
+ knows that the only BSD variant on a Sun 3 is SunOS.
+
+ You can specify a version number after any of the system types,
+ and some of the CPU types. In most cases, the version is
+ irrelevant, and will be ignored. So you might as well specify the
+ version if you know it.
+
+ See *Note Configurations::, for a list of supported configuration
+ names and notes on many of the configurations. You should check
+ the notes in that section before proceeding any further with the
+ installation of GNU CC.
+
+ There are four additional options you can specify independently to
+ describe variant hardware and software configurations. These are
+ `--with-gnu-as', `--with-gnu-ld', `--with-stabs' and `--nfp'.
+
+ `--with-gnu-as'
+ If you will use GNU CC with the GNU assembler (GAS), you
+ should declare this by using the `--with-gnu-as' option when
+ you run `configure'.
+
+ Using this option does not install GAS. It only modifies the
+ output of GNU CC to work with GAS. Building and installing
+ GAS is up to you.
+
+ Conversely, if you *do not* wish to use GAS and do not specify
+ `--with-gnu-as' when building GNU CC, it is up to you to make
+ sure that GAS is not installed. GNU CC searches for a
+ program named `as' in various directories; if the program it
+ finds is GAS, then it runs GAS. If you are not sure where
+ GNU CC finds the assembler it is using, try specifying `-v'
+ when you run it.
+
+ The systems where it makes a difference whether you use GAS
+ are
+ `hppa1.0-ANY-ANY', `hppa1.1-ANY-ANY', `i386-ANY-sysv',
+ `i386-ANY-isc',
+ `i860-ANY-bsd', `m68k-bull-sysv', `m68k-hp-hpux',
+ `m68k-sony-bsd',
+ `m68k-altos-sysv', `m68000-hp-hpux', `m68000-att-sysv',
+ `ANY-lynx-lynxos', and `mips-ANY'). On any other system,
+ `--with-gnu-as' has no effect.
+
+ On the systems listed above (except for the HP-PA, for ISC on
+ the 386, and for `mips-sgi-irix5.*'), if you use GAS, you
+ should also use the GNU linker (and specify `--with-gnu-ld').
+
+ `--with-gnu-ld'
+ Specify the option `--with-gnu-ld' if you plan to use the GNU
+ linker with GNU CC.
+
+ This option does not cause the GNU linker to be installed; it
+ just modifies the behavior of GNU CC to work with the GNU
+ linker. Specifically, it inhibits the installation of
+ `collect2', a program which otherwise serves as a front-end
+ for the system's linker on most configurations.
+
+ `--with-stabs'
+ On MIPS based systems and on Alphas, you must specify whether
+ you want GNU CC to create the normal ECOFF debugging format,
+ or to use BSD-style stabs passed through the ECOFF symbol
+ table. The normal ECOFF debug format cannot fully handle
+ languages other than C. BSD stabs format can handle other
+ languages, but it only works with the GNU debugger GDB.
+
+ Normally, GNU CC uses the ECOFF debugging format by default;
+ if you prefer BSD stabs, specify `--with-stabs' when you
+ configure GNU CC.
+
+ No matter which default you choose when you configure GNU CC,
+ the user can use the `-gcoff' and `-gstabs+' options to
+ specify explicitly the debug format for a particular
+ compilation.
+
+ `--with-stabs' is meaningful on the ISC system on the 386,
+ also, if `--with-gas' is used. It selects use of stabs
+ debugging information embedded in COFF output. This kind of
+ debugging information supports C++ well; ordinary COFF
+ debugging information does not.
+
+ `--with-stabs' is also meaningful on 386 systems running
+ SVR4. It selects use of stabs debugging information embedded
+ in ELF output. The C++ compiler currently (2.6.0) does not
+ support the DWARF debugging information normally used on 386
+ SVR4 platforms; stabs provide a workable alternative. This
+ requires gas and gdb, as the normal SVR4 tools can not
+ generate or interpret stabs.
+
+ `--nfp'
+ On certain systems, you must specify whether the machine has
+ a floating point unit. These systems include
+ `m68k-sun-sunosN' and `m68k-isi-bsd'. On any other system,
+ `--nfp' currently has no effect, though perhaps there are
+ other systems where it could usefully make a difference.
+
+ The `configure' script searches subdirectories of the source
+ directory for other compilers that are to be integrated into GNU
+ CC. The GNU compiler for C++, called G++ is in a subdirectory
+ named `cp'. `configure' inserts rules into `Makefile' to build
+ all of those compilers.
+
+ Here we spell out what files will be set up by `configure'.
+ Normally you need not be concerned with these files.
+
+ * A file named `config.h' is created that contains a `#include'
+ of the top-level config file for the machine you will run the
+ compiler on (*note The Configuration File:
+ (gcc.info)Config.). This file is responsible for defining
+ information about the host machine. It includes `tm.h'.
+
+ The top-level config file is located in the subdirectory
+ `config'. Its name is always `xm-SOMETHING.h'; usually
+ `xm-MACHINE.h', but there are some exceptions.
+
+ If your system does not support symbolic links, you might
+ want to set up `config.h' to contain a `#include' command
+ which refers to the appropriate file.
+
+ * A file named `tconfig.h' is created which includes the
+ top-level config file for your target machine. This is used
+ for compiling certain programs to run on that machine.
+
+ * A file named `tm.h' is created which includes the
+ machine-description macro file for your target machine. It
+ should be in the subdirectory `config' and its name is often
+ `MACHINE.h'.
+
+ * The command file `configure' also constructs the file
+ `Makefile' by adding some text to the template file
+ `Makefile.in'. The additional text comes from files in the
+ `config' directory, named `t-TARGET' and `x-HOST'. If these
+ files do not exist, it means nothing needs to be added for a
+ given target or host.
+
+ 4. The standard directory for installing GNU CC is `/usr/local/lib'.
+ If you want to install its files somewhere else, specify
+ `--prefix=DIR' when you run `configure'. Here DIR is a directory
+ name to use instead of `/usr/local' for all purposes with one
+ exception: the directory `/usr/local/include' is searched for
+ header files no matter where you install the compiler. To override
+ this name, use the `--local-prefix' option below.
+
+ 5. Specify `--local-prefix=DIR' if you want the compiler to search
+ directory `DIR/include' for locally installed header files
+ *instead* of `/usr/local/include'.
+
+ You should specify `--local-prefix' *only* if your site has a
+ different convention (not `/usr/local') for where to put
+ site-specific files.
+
+ *Do not* specify `/usr' as the `--local-prefix'! The directory
+ you use for `--local-prefix' *must not* contain any of the
+ system's standard header files. If it did contain them, certain
+ programs would be miscompiled (including GNU Emacs, on certain
+ targets), because this would override and nullify the header file
+ corrections made by the `fixincludes' script.
+
+ 6. Make sure the Bison parser generator is installed. (This is
+ unnecessary if the Bison output files `c-parse.c' and `cexp.c' are
+ more recent than `c-parse.y' and `cexp.y' and you do not plan to
+ change the `.y' files.)
+
+ Bison versions older than Sept 8, 1988 will produce incorrect
+ output for `c-parse.c'.
+
+ 7. If you have chosen a configuration for GNU CC which requires other
+ GNU tools (such as GAS or the GNU linker) instead of the standard
+ system tools, install the required tools in the build directory
+ under the names `as', `ld' or whatever is appropriate. This will
+ enable the compiler to find the proper tools for compilation of
+ the program `enquire'.
+
+ Alternatively, you can do subsequent compilation using a value of
+ the `PATH' environment variable such that the necessary GNU tools
+ come before the standard system tools.
+
+ 8. Build the compiler. Just type `make LANGUAGES=c' in the compiler
+ directory.
+
+ `LANGUAGES=c' specifies that only the C compiler should be
+ compiled. The makefile normally builds compilers for all the
+ supported languages; currently, C, C++ and Objective C. However,
+ C is the only language that is sure to work when you build with
+ other non-GNU C compilers. In addition, building anything but C
+ at this stage is a waste of time.
+
+ In general, you can specify the languages to build by typing the
+ argument `LANGUAGES="LIST"', where LIST is one or more words from
+ the list `c', `c++', and `objective-c'. If you have any
+ additional GNU compilers as subdirectories of the GNU CC source
+ directory, you may also specify their names in this list.
+
+ Ignore any warnings you may see about "statement not reached" in
+ `insn-emit.c'; they are normal. Also, warnings about "unknown
+ escape sequence" are normal in `genopinit.c' and perhaps some
+ other files. Likewise, you should ignore warnings about "constant
+ is so large that it is unsigned" in `insn-emit.c' and
+ `insn-recog.c' and a warning about a comparison always being zero
+ in `enquire.o'. Any other compilation errors may represent bugs in
+ the port to your machine or operating system, and should be
+ investigated and reported.
+
+ Some commercial compilers fail to compile GNU CC because they have
+ bugs or limitations. For example, the Microsoft compiler is said
+ to run out of macro space. Some Ultrix compilers run out of
+ expression space; then you need to break up the statement where
+ the problem happens.
+
+ 9. If you are building a cross-compiler, stop here. *Note
+ Cross-Compiler::.
+
+ 10. Move the first-stage object files and executables into a
+ subdirectory with this command:
+
+ make stage1
+
+ The files are moved into a subdirectory named `stage1'. Once
+ installation is complete, you may wish to delete these files with
+ `rm -r stage1'.
+
+ 11. If you have chosen a configuration for GNU CC which requires other
+ GNU tools (such as GAS or the GNU linker) instead of the standard
+ system tools, install the required tools in the `stage1'
+ subdirectory under the names `as', `ld' or whatever is
+ appropriate. This will enable the stage 1 compiler to find the
+ proper tools in the following stage.
+
+ Alternatively, you can do subsequent compilation using a value of
+ the `PATH' environment variable such that the necessary GNU tools
+ come before the standard system tools.
+
+ 12. Recompile the compiler with itself, with this command:
+
+ make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O2"
+
+ This is called making the stage 2 compiler.
+
+ The command shown above builds compilers for all the supported
+ languages. If you don't want them all, you can specify the
+ languages to build by typing the argument `LANGUAGES="LIST"'. LIST
+ should contain one or more words from the list `c', `c++',
+ `objective-c', and `proto'. Separate the words with spaces.
+ `proto' stands for the programs `protoize' and `unprotoize'; they
+ are not a separate language, but you use `LANGUAGES' to enable or
+ disable their installation.
+
+ If you are going to build the stage 3 compiler, then you might
+ want to build only the C language in stage 2.
+
+ Once you have built the stage 2 compiler, if you are short of disk
+ space, you can delete the subdirectory `stage1'.
+
+ On a 68000 or 68020 system lacking floating point hardware, unless
+ you have selected a `tm.h' file that expects by default that there
+ is no such hardware, do this instead:
+
+ make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O2 -msoft-float"
+
+ 13. If you wish to test the compiler by compiling it with itself one
+ more time, install any other necessary GNU tools (such as GAS or
+ the GNU linker) in the `stage2' subdirectory as you did in the
+ `stage1' subdirectory, then do this:
+
+ make stage2
+ make CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O2"
+
+ This is called making the stage 3 compiler. Aside from the `-B'
+ option, the compiler options should be the same as when you made
+ the stage 2 compiler. But the `LANGUAGES' option need not be the
+ same. The command shown above builds compilers for all the
+ supported languages; if you don't want them all, you can specify
+ the languages to build by typing the argument `LANGUAGES="LIST"',
+ as described above.
+
+ If you do not have to install any additional GNU tools, you may
+ use the command
+
+ make bootstrap LANGUAGES=LANGUAGE-LIST BOOT_CFLAGS=OPTION-LIST
+
+ instead of making `stage1', `stage2', and performing the two
+ compiler builds.
+
+ 14. Then compare the latest object files with the stage 2 object
+ files--they ought to be identical, aside from time stamps (if any).
+
+ On some systems, meaningful comparison of object files is
+ impossible; they always appear "different." This is currently
+ true on Solaris and some systems that use ELF object file format.
+ On some versions of Irix on SGI machines and DEC Unix (OSF/1) on
+ Alpha systems, you will not be able to compare the files without
+ specifying `-save-temps'; see the description of individual
+ systems above to see if you get comparison failures. You may have
+ similar problems on other systems.
+
+ Use this command to compare the files:
+
+ make compare
+
+ This will mention any object files that differ between stage 2 and
+ stage 3. Any difference, no matter how innocuous, indicates that
+ the stage 2 compiler has compiled GNU CC incorrectly, and is
+ therefore a potentially serious bug which you should investigate
+ and report.
+
+ If your system does not put time stamps in the object files, then
+ this is a faster way to compare them (using the Bourne shell):
+
+ for file in *.o; do
+ cmp $file stage2/$file
+ done
+
+ If you have built the compiler with the `-mno-mips-tfile' option on
+ MIPS machines, you will not be able to compare the files.
+
+ 15. Install the compiler driver, the compiler's passes and run-time
+ support with `make install'. Use the same value for `CC',
+ `CFLAGS' and `LANGUAGES' that you used when compiling the files
+ that are being installed. One reason this is necessary is that
+ some versions of Make have bugs and recompile files gratuitously
+ when you do this step. If you use the same variable values, those
+ files will be recompiled properly.
+
+ For example, if you have built the stage 2 compiler, you can use
+ the following command:
+
+ make install CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O" LANGUAGES="LIST"
+
+ This copies the files `cc1', `cpp' and `libgcc.a' to files `cc1',
+ `cpp' and `libgcc.a' in the directory
+ `/usr/local/lib/gcc-lib/TARGET/VERSION', which is where the
+ compiler driver program looks for them. Here TARGET is the target
+ machine type specified when you ran `configure', and VERSION is
+ the version number of GNU CC. This naming scheme permits various
+ versions and/or cross-compilers to coexist.
+
+ This also copies the driver program `xgcc' into
+ `/usr/local/bin/gcc', so that it appears in typical execution
+ search paths.
+
+ On some systems, this command causes recompilation of some files.
+ This is usually due to bugs in `make'. You should either ignore
+ this problem, or use GNU Make.
+
+ *Warning: there is a bug in `alloca' in the Sun library. To avoid
+ this bug, be sure to install the executables of GNU CC that were
+ compiled by GNU CC. (That is, the executables from stage 2 or 3,
+ not stage 1.) They use `alloca' as a built-in function and never
+ the one in the library.*
+
+ (It is usually better to install GNU CC executables from stage 2
+ or 3, since they usually run faster than the ones compiled with
+ some other compiler.)
+
+ 16. If you're going to use C++, it's likely that you need to also
+ install the libg++ distribution. It should be available from the
+ same place where you got the GNU C distribution. Just as GNU C
+ does not distribute a C runtime library, it also does not include
+ a C++ run-time library. All I/O functionality, special class
+ libraries, etc., are available in the libg++ distribution.
+
+Configurations Supported by GNU CC
+==================================
+
+ Here are the possible CPU types:
+
+ 1750a, a29k, alpha, arm, cN, clipper, dsp16xx, elxsi, h8300,
+ hppa1.0, hppa1.1, i370, i386, i486, i586, i860, i960, m68000, m68k,
+ m88k, mips, mipsel, mips64, mips64el, ns32k, powerpc, powerpcle,
+ pyramid, romp, rs6000, sh, sparc, sparclite, sparc64, vax, we32k.
+
+ Here are the recognized company names. As you can see, customary
+abbreviations are used rather than the longer official names.
+
+ acorn, alliant, altos, apollo, att, bull, cbm, convergent, convex,
+ crds, dec, dg, dolphin, elxsi, encore, harris, hitachi, hp, ibm,
+ intergraph, isi, mips, motorola, ncr, next, ns, omron, plexus,
+ sequent, sgi, sony, sun, tti, unicom, wrs.
+
+ The company name is meaningful only to disambiguate when the rest of
+the information supplied is insufficient. You can omit it, writing
+just `CPU-SYSTEM', if it is not needed. For example, `vax-ultrix4.2'
+is equivalent to `vax-dec-ultrix4.2'.
+
+ Here is a list of system types:
+
+ 386bsd, aix, acis, amigados, aos, aout, bosx, bsd, clix, coff,
+ ctix, cxux, dgux, dynix, ebmon, ecoff, elf, esix, freebsd, hms,
+ genix, gnu, gnu/linux, hiux, hpux, iris, irix, isc, luna, lynxos,
+ mach, minix, msdos, mvs, netbsd, newsos, nindy, ns, osf, osfrose,
+ ptx, riscix, riscos, rtu, sco, sim, solaris, sunos, sym, sysv,
+ udi, ultrix, unicos, uniplus, unos, vms, vsta, vxworks, winnt,
+ xenix.
+
+You can omit the system type; then `configure' guesses the operating
+system from the CPU and company.
+
+ You can add a version number to the system type; this may or may not
+make a difference. For example, you can write `bsd4.3' or `bsd4.4' to
+distinguish versions of BSD. In practice, the version number is most
+needed for `sysv3' and `sysv4', which are often treated differently.
+
+ If you specify an impossible combination such as `i860-dg-vms', then
+you may get an error message from `configure', or it may ignore part of
+the information and do the best it can with the rest. `configure'
+always prints the canonical name for the alternative that it used. GNU
+CC does not support all possible alternatives.
+
+ Often a particular model of machine has a name. Many machine names
+are recognized as aliases for CPU/company combinations. Thus, the
+machine name `sun3', mentioned above, is an alias for `m68k-sun'.
+Sometimes we accept a company name as a machine name, when the name is
+popularly used for a particular machine. Here is a table of the known
+machine names:
+
+ 3300, 3b1, 3bN, 7300, altos3068, altos, apollo68, att-7300,
+ balance, convex-cN, crds, decstation-3100, decstation, delta,
+ encore, fx2800, gmicro, hp7NN, hp8NN, hp9k2NN, hp9k3NN, hp9k7NN,
+ hp9k8NN, iris4d, iris, isi68, m3230, magnum, merlin, miniframe,
+ mmax, news-3600, news800, news, next, pbd, pc532, pmax, powerpc,
+ powerpcle, ps2, risc-news, rtpc, sun2, sun386i, sun386, sun3,
+ sun4, symmetry, tower-32, tower.
+
+Remember that a machine name specifies both the cpu type and the company
+name. If you want to install your own homemade configuration files,
+you can use `local' as the company name to access them. If you use
+configuration `CPU-local', the configuration name without the cpu prefix
+is used to form the configuration file names.
+
+ Thus, if you specify `m68k-local', configuration uses files
+`m68k.md', `local.h', `m68k.c', `xm-local.h', `t-local', and `x-local',
+all in the directory `config/m68k'.
+
+ Here is a list of configurations that have special treatment or
+special things you must know:
+
+`1750a-*-*'
+ MIL-STD-1750A processors.
+
+ Starting with GCC 2.6.1, the MIL-STD-1750A cross configuration no
+ longer supports the Tektronix Assembler, but instead produces
+ output for `as1750', an assembler/linker available under the GNU
+ Public License for the 1750A. Contact *kellogg@space.otn.dasa.de*
+ for more details on obtaining `as1750'. A similarly licensed
+ simulator for the 1750A is available from same address.
+
+ You should ignore a fatal error during the building of libgcc
+ (libgcc is not yet implemented for the 1750A.)
+
+ The `as1750' assembler requires the file `ms1750.inc', which is
+ found in the directory `config/1750a'.
+
+ GNU CC produced the same sections as the Fairchild F9450 C
+ Compiler, namely:
+
+ `Normal'
+ The program code section.
+
+ `Static'
+ The read/write (RAM) data section.
+
+ `Konst'
+ The read-only (ROM) constants section.
+
+ `Init'
+ Initialization section (code to copy KREL to SREL).
+
+ The smallest addressable unit is 16 bits (BITS_PER_UNIT is 16).
+ This means that type `char' is represented with a 16-bit word per
+ character. The 1750A's "Load/Store Upper/Lower Byte" instructions
+ are not used by GNU CC.
+
+`alpha-*-osf1'
+ Systems using processors that implement the DEC Alpha architecture
+ and are running the DEC Unix (OSF/1) operating system, for example
+ the DEC Alpha AXP systems. (VMS on the Alpha is not currently
+ supported by GNU CC.)
+
+ GNU CC writes a `.verstamp' directive to the assembler output file
+ unless it is built as a cross-compiler. It gets the version to
+ use from the system header file `/usr/include/stamp.h'. If you
+ install a new version of DEC Unix, you should rebuild GCC to pick
+ up the new version stamp.
+
+ Note that since the Alpha is a 64-bit architecture,
+ cross-compilers from 32-bit machines will not generate code as
+ efficient as that generated when the compiler is running on a
+ 64-bit machine because many optimizations that depend on being
+ able to represent a word on the target in an integral value on the
+ host cannot be performed. Building cross-compilers on the Alpha
+ for 32-bit machines has only been tested in a few cases and may
+ not work properly.
+
+ `make compare' may fail on old versions of DEC Unix unless you add
+ `-save-temps' to `CFLAGS'. On these systems, the name of the
+ assembler input file is stored in the object file, and that makes
+ comparison fail if it differs between the `stage1' and `stage2'
+ compilations. The option `-save-temps' forces a fixed name to be
+ used for the assembler input file, instead of a randomly chosen
+ name in `/tmp'. Do not add `-save-temps' unless the comparisons
+ fail without that option. If you add `-save-temps', you will have
+ to manually delete the `.i' and `.s' files after each series of
+ compilations.
+
+ GNU CC now supports both the native (ECOFF) debugging format used
+ by DBX and GDB and an encapsulated STABS format for use only with
+ GDB. See the discussion of the `--with-stabs' option of
+ `configure' above for more information on these formats and how to
+ select them.
+
+ There is a bug in DEC's assembler that produces incorrect line
+ numbers for ECOFF format when the `.align' directive is used. To
+ work around this problem, GNU CC will not emit such alignment
+ directives while writing ECOFF format debugging information even
+ if optimization is being performed. Unfortunately, this has the
+ very undesirable side-effect that code addresses when `-O' is
+ specified are different depending on whether or not `-g' is also
+ specified.
+
+ To avoid this behavior, specify `-gstabs+' and use GDB instead of
+ DBX. DEC is now aware of this problem with the assembler and
+ hopes to provide a fix shortly.
+
+`arm'
+ Advanced RISC Machines ARM-family processors. These are often
+ used in embedded applications. There are no standard Unix
+ configurations. This configuration corresponds to the basic
+ instruction sequences and will produce a.out format object modules.
+
+ You may need to make a variant of the file `arm.h' for your
+ particular configuration.
+
+`arm-*-riscix'
+ The ARM2 or ARM3 processor running RISC iX, Acorn's port of BSD
+ Unix. If you are running a version of RISC iX prior to 1.2 then
+ you must specify the version number during configuration. Note
+ that the assembler shipped with RISC iX does not support stabs
+ debugging information; a new version of the assembler, with stabs
+ support included, is now available from Acorn.
+
+`a29k'
+ AMD Am29k-family processors. These are normally used in embedded
+ applications. There are no standard Unix configurations. This
+ configuration corresponds to AMD's standard calling sequence and
+ binary interface and is compatible with other 29k tools.
+
+ You may need to make a variant of the file `a29k.h' for your
+ particular configuration.
+
+`a29k-*-bsd'
+ AMD Am29050 used in a system running a variant of BSD Unix.
+
+`decstation-*'
+ DECstations can support three different personalities: Ultrix, DEC
+ OSF/1, and OSF/rose. To configure GCC for these platforms use the
+ following configurations:
+
+ `decstation-ultrix'
+ Ultrix configuration.
+
+ `decstation-osf1'
+ Dec's version of OSF/1.
+
+ `decstation-osfrose'
+ Open Software Foundation reference port of OSF/1 which uses
+ the OSF/rose object file format instead of ECOFF. Normally,
+ you would not select this configuration.
+
+ The MIPS C compiler needs to be told to increase its table size
+ for switch statements with the `-Wf,-XNg1500' option in order to
+ compile `cp/parse.c'. If you use the `-O2' optimization option,
+ you also need to use `-Olimit 3000'. Both of these options are
+ automatically generated in the `Makefile' that the shell script
+ `configure' builds. If you override the `CC' make variable and
+ use the MIPS compilers, you may need to add `-Wf,-XNg1500 -Olimit
+ 3000'.
+
+`elxsi-elxsi-bsd'
+ The Elxsi's C compiler has known limitations that prevent it from
+ compiling GNU C. Please contact `mrs@cygnus.com' for more details.
+
+`dsp16xx'
+ A port to the AT&T DSP1610 family of processors.
+
+`h8300-*-*'
+ The calling convention and structure layout has changed in release
+ 2.6. All code must be recompiled. The calling convention now
+ passes the first three arguments in function calls in registers.
+ Structures are no longer a multiple of 2 bytes.
+
+`hppa*-*-*'
+ There are several variants of the HP-PA processor which run a
+ variety of operating systems. GNU CC must be configured to use
+ the correct processor type and operating system, or GNU CC will
+ not function correctly. The easiest way to handle this problem is
+ to *not* specify a target when configuring GNU CC, the `configure'
+ script will try to automatically determine the right processor
+ type and operating system.
+
+ `-g' does not work on HP-UX, since that system uses a peculiar
+ debugging format which GNU CC does not know about. However, `-g'
+ will work if you also use GAS and GDB in conjunction with GCC. We
+ highly recommend using GAS for all HP-PA configurations.
+
+ You should be using GAS-2.6 (or later) along with GDB-4.16 (or
+ later). These can be retrieved from all the traditional GNU ftp
+ archive sites.
+
+ GAS will need to be installed into a directory before `/bin',
+ `/usr/bin', and `/usr/ccs/bin' in your search path. You should
+ install GAS before you build GNU CC.
+
+ To enable debugging, you must configure GNU CC with the
+ `--with-gnu-as' option before building.
+
+`i370-*-*'
+ This port is very preliminary and has many known bugs. We hope to
+ have a higher-quality port for this machine soon.
+
+`i386-*-linuxoldld'
+ Use this configuration to generate a.out binaries on Linux-based
+ GNU systems, if you do not have gas/binutils version 2.5.2 or later
+ installed. This is an obsolete configuration.
+
+`i386-*-linuxaout'
+ Use this configuration to generate a.out binaries on Linux-based
+ GNU systems. This configuration is being superseded. You must use
+ gas/binutils version 2.5.2 or later.
+
+`i386-*-linux-gnulibc1'
+ Use this configuration to generate ELF binaries on Linux-based GNU
+ systems using the Linux libc version 5. You must use gas/binutils
+ version 2.5.2 or later.
+
+`i386-*-linux'
+ Use this configuration to generate ELF binaries on Linux-based GNU
+ systems using glibc 2. You must use gas/binutils version 2.8.1 or
+ later.
+
+`i386-*-sco'
+ Compilation with RCC is recommended. Also, it may be a good idea
+ to link with GNU malloc instead of the malloc that comes with the
+ system.
+
+`i386-*-sco3.2v4'
+ Use this configuration for SCO release 3.2 version 4.
+
+`i386-*-isc'
+ It may be a good idea to link with GNU malloc instead of the
+ malloc that comes with the system.
+
+ In ISC version 4.1, `sed' core dumps when building `deduced.h'.
+ Use the version of `sed' from version 4.0.
+
+`i386-*-esix'
+ It may be good idea to link with GNU malloc instead of the malloc
+ that comes with the system.
+
+`i386-ibm-aix'
+ You need to use GAS version 2.1 or later, and and LD from GNU
+ binutils version 2.2 or later.
+
+`i386-sequent-bsd'
+ Go to the Berkeley universe before compiling. In addition, you
+ probably need to create a file named `string.h' containing just
+ one line: `#include <strings.h>'.
+
+`i386-sequent-ptx1*'
+ Sequent DYNIX/ptx 1.x.
+
+`i386-sequent-ptx2*'
+ Sequent DYNIX/ptx 2.x.
+
+`i386-sun-sunos4'
+ You may find that you need another version of GNU CC to begin
+ bootstrapping with, since the current version when built with the
+ system's own compiler seems to get an infinite loop compiling part
+ of `libgcc2.c'. GNU CC version 2 compiled with GNU CC (any
+ version) seems not to have this problem.
+
+ See *Note Sun Install::, for information on installing GNU CC on
+ Sun systems.
+
+`i[345]86-*-winnt3.5'
+ This version requires a GAS that has not let been released. Until
+ it is, you can get a prebuilt binary version via anonymous ftp from
+ `cs.washington.edu:pub/gnat' or `cs.nyu.edu:pub/gnat'. You must
+ also use the Microsoft header files from the Windows NT 3.5 SDK.
+ Find these on the CDROM in the `/mstools/h' directory dated
+ 9/4/94. You must use a fixed version of Microsoft linker made
+ especially for NT 3.5, which is also is available on the NT 3.5
+ SDK CDROM. If you do not have this linker, can you also use the
+ linker from Visual C/C++ 1.0 or 2.0.
+
+ Installing GNU CC for NT builds a wrapper linker, called `ld.exe',
+ which mimics the behaviour of Unix `ld' in the specification of
+ libraries (`-L' and `-l'). `ld.exe' looks for both Unix and
+ Microsoft named libraries. For example, if you specify `-lfoo',
+ `ld.exe' will look first for `libfoo.a' and then for `foo.lib'.
+
+ You may install GNU CC for Windows NT in one of two ways,
+ depending on whether or not you have a Unix-like shell and various
+ Unix-like utilities.
+
+ 1. If you do not have a Unix-like shell and few Unix-like
+ utilities, you will use a DOS style batch script called
+ `configure.bat'. Invoke it as `configure winnt' from an
+ MSDOS console window or from the program manager dialog box.
+ `configure.bat' assumes you have already installed and have
+ in your path a Unix-like `sed' program which is used to
+ create a working `Makefile' from `Makefile.in'.
+
+ `Makefile' uses the Microsoft Nmake program maintenance
+ utility and the Visual C/C++ V8.00 compiler to build GNU CC.
+ You need only have the utilities `sed' and `touch' to use
+ this installation method, which only automatically builds the
+ compiler itself. You must then examine what `fixinc.winnt'
+ does, edit the header files by hand and build `libgcc.a'
+ manually.
+
+ 2. The second type of installation assumes you are running a
+ Unix-like shell, have a complete suite of Unix-like utilities
+ in your path, and have a previous version of GNU CC already
+ installed, either through building it via the above
+ installation method or acquiring a pre-built binary. In this
+ case, use the `configure' script in the normal fashion.
+
+`i860-intel-osf1'
+ This is the Paragon. If you have version 1.0 of the operating
+ system, you need to take special steps to build GNU CC due to
+ peculiarities of the system. Newer system versions have no
+ problem. See the section `Installation Problems' in the GNU CC
+ Manual.
+
+`*-lynx-lynxos'
+ LynxOS 2.2 and earlier comes with GNU CC 1.x already installed as
+ `/bin/gcc'. You should compile with this instead of `/bin/cc'.
+ You can tell GNU CC to use the GNU assembler and linker, by
+ specifying `--with-gnu-as --with-gnu-ld' when configuring. These
+ will produce COFF format object files and executables; otherwise
+ GNU CC will use the installed tools, which produce a.out format
+ executables.
+
+`m68000-hp-bsd'
+ HP 9000 series 200 running BSD. Note that the C compiler that
+ comes with this system cannot compile GNU CC; contact
+ `law@cs.utah.edu' to get binaries of GNU CC for bootstrapping.
+
+`m68k-*-linuxaout'
+ Use this configuration to generate a.out binaries on Linux. This
+ configuration is being superseded. You must use gas/binutils
+ version 2.5.2 or later.
+
+`m68k-*-linux-gnulibc1'
+ Use this configuration to generate ELF binaries on Linux with the
+ Linux C library 5.x.x. You must use gas/binutils version 2.8.1
+ later.
+
+`m68k-*-linux'
+ Use this configuration to generate ELF binaries on Linux-based GNU
+ systems with the GNU C library 2. You must use gas/binutils version
+ 2.8.1 or later.
+
+`m68k-altos'
+ Altos 3068. You must use the GNU assembler, linker and debugger.
+ Also, you must fix a kernel bug. Details in the file
+ `README.ALTOS'.
+
+`m68k-att-sysv'
+ AT&T 3b1, a.k.a. 7300 PC. Special procedures are needed to
+ compile GNU CC with this machine's standard C compiler, due to
+ bugs in that compiler. You can bootstrap it more easily with
+ previous versions of GNU CC if you have them.
+
+ Installing GNU CC on the 3b1 is difficult if you do not already
+ have GNU CC running, due to bugs in the installed C compiler.
+ However, the following procedure might work. We are unable to
+ test it.
+
+ 1. Comment out the `#include "config.h"' line on line 37 of
+ `cccp.c' and do `make cpp'. This makes a preliminary version
+ of GNU cpp.
+
+ 2. Save the old `/lib/cpp' and copy the preliminary GNU cpp to
+ that file name.
+
+ 3. Undo your change in `cccp.c', or reinstall the original
+ version, and do `make cpp' again.
+
+ 4. Copy this final version of GNU cpp into `/lib/cpp'.
+
+ 5. Replace every occurrence of `obstack_free' in the file
+ `tree.c' with `_obstack_free'.
+
+ 6. Run `make' to get the first-stage GNU CC.
+
+ 7. Reinstall the original version of `/lib/cpp'.
+
+ 8. Now you can compile GNU CC with itself and install it in the
+ normal fashion.
+
+`m68k-bull-sysv'
+ Bull DPX/2 series 200 and 300 with BOS-2.00.45 up to BOS-2.01. GNU
+ CC works either with native assembler or GNU assembler. You can use
+ GNU assembler with native coff generation by providing
+ `--with-gnu-as' to the configure script or use GNU assembler with
+ dbx-in-coff encapsulation by providing `--with-gnu-as --stabs'.
+ For any problem with native assembler or for availability of the
+ DPX/2 port of GAS, contact `F.Pierresteguy@frcl.bull.fr'.
+
+`m68k-crds-unox'
+ Use `configure unos' for building on Unos.
+
+ The Unos assembler is named `casm' instead of `as'. For some
+ strange reason linking `/bin/as' to `/bin/casm' changes the
+ behavior, and does not work. So, when installing GNU CC, you
+ should install the following script as `as' in the subdirectory
+ where the passes of GCC are installed:
+
+ #!/bin/sh
+ casm $*
+
+ The default Unos library is named `libunos.a' instead of `libc.a'.
+ To allow GNU CC to function, either change all references to
+ `-lc' in `gcc.c' to `-lunos' or link `/lib/libc.a' to
+ `/lib/libunos.a'.
+
+ When compiling GNU CC with the standard compiler, to overcome bugs
+ in the support of `alloca', do not use `-O' when making stage 2.
+ Then use the stage 2 compiler with `-O' to make the stage 3
+ compiler. This compiler will have the same characteristics as the
+ usual stage 2 compiler on other systems. Use it to make a stage 4
+ compiler and compare that with stage 3 to verify proper
+ compilation.
+
+ (Perhaps simply defining `ALLOCA' in `x-crds' as described in the
+ comments there will make the above paragraph superfluous. Please
+ inform us of whether this works.)
+
+ Unos uses memory segmentation instead of demand paging, so you
+ will need a lot of memory. 5 Mb is barely enough if no other
+ tasks are running. If linking `cc1' fails, try putting the object
+ files into a library and linking from that library.
+
+`m68k-hp-hpux'
+ HP 9000 series 300 or 400 running HP-UX. HP-UX version 8.0 has a
+ bug in the assembler that prevents compilation of GNU CC. To fix
+ it, get patch PHCO_4484 from HP.
+
+ In addition, if you wish to use gas `--with-gnu-as' you must use
+ gas version 2.1 or later, and you must use the GNU linker version
+ 2.1 or later. Earlier versions of gas relied upon a program which
+ converted the gas output into the native HP/UX format, but that
+ program has not been kept up to date. gdb does not understand
+ that native HP/UX format, so you must use gas if you wish to use
+ gdb.
+
+`m68k-sun'
+ Sun 3. We do not provide a configuration file to use the Sun FPA
+ by default, because programs that establish signal handlers for
+ floating point traps inherently cannot work with the FPA.
+
+ See *Note Sun Install::, for information on installing GNU CC on
+ Sun systems.
+
+`m88k-*-svr3'
+ Motorola m88k running the AT&T/Unisoft/Motorola V.3 reference port.
+ These systems tend to use the Green Hills C, revision 1.8.5, as the
+ standard C compiler. There are apparently bugs in this compiler
+ that result in object files differences between stage 2 and stage
+ 3. If this happens, make the stage 4 compiler and compare it to
+ the stage 3 compiler. If the stage 3 and stage 4 object files are
+ identical, this suggests you encountered a problem with the
+ standard C compiler; the stage 3 and 4 compilers may be usable.
+
+ It is best, however, to use an older version of GNU CC for
+ bootstrapping if you have one.
+
+`m88k-*-dgux'
+ Motorola m88k running DG/UX. To build 88open BCS native or cross
+ compilers on DG/UX, specify the configuration name as
+ `m88k-*-dguxbcs' and build in the 88open BCS software development
+ environment. To build ELF native or cross compilers on DG/UX,
+ specify `m88k-*-dgux' and build in the DG/UX ELF development
+ environment. You set the software development environment by
+ issuing `sde-target' command and specifying either `m88kbcs' or
+ `m88kdguxelf' as the operand.
+
+ If you do not specify a configuration name, `configure' guesses the
+ configuration based on the current software development
+ environment.
+
+`m88k-tektronix-sysv3'
+ Tektronix XD88 running UTekV 3.2e. Do not turn on optimization
+ while building stage1 if you bootstrap with the buggy Green Hills
+ compiler. Also, The bundled LAI System V NFS is buggy so if you
+ build in an NFS mounted directory, start from a fresh reboot, or
+ avoid NFS all together. Otherwise you may have trouble getting
+ clean comparisons between stages.
+
+`mips-mips-bsd'
+ MIPS machines running the MIPS operating system in BSD mode. It's
+ possible that some old versions of the system lack the functions
+ `memcpy', `memcmp', and `memset'. If your system lacks these, you
+ must remove or undo the definition of `TARGET_MEM_FUNCTIONS' in
+ `mips-bsd.h'.
+
+ The MIPS C compiler needs to be told to increase its table size
+ for switch statements with the `-Wf,-XNg1500' option in order to
+ compile `cp/parse.c'. If you use the `-O2' optimization option,
+ you also need to use `-Olimit 3000'. Both of these options are
+ automatically generated in the `Makefile' that the shell script
+ `configure' builds. If you override the `CC' make variable and
+ use the MIPS compilers, you may need to add `-Wf,-XNg1500 -Olimit
+ 3000'.
+
+`mips-mips-riscos*'
+ The MIPS C compiler needs to be told to increase its table size
+ for switch statements with the `-Wf,-XNg1500' option in order to
+ compile `cp/parse.c'. If you use the `-O2' optimization option,
+ you also need to use `-Olimit 3000'. Both of these options are
+ automatically generated in the `Makefile' that the shell script
+ `configure' builds. If you override the `CC' make variable and
+ use the MIPS compilers, you may need to add `-Wf,-XNg1500 -Olimit
+ 3000'.
+
+ MIPS computers running RISC-OS can support four different
+ personalities: default, BSD 4.3, System V.3, and System V.4 (older
+ versions of RISC-OS don't support V.4). To configure GCC for
+ these platforms use the following configurations:
+
+ `mips-mips-riscos`rev''
+ Default configuration for RISC-OS, revision `rev'.
+
+ `mips-mips-riscos`rev'bsd'
+ BSD 4.3 configuration for RISC-OS, revision `rev'.
+
+ `mips-mips-riscos`rev'sysv4'
+ System V.4 configuration for RISC-OS, revision `rev'.
+
+ `mips-mips-riscos`rev'sysv'
+ System V.3 configuration for RISC-OS, revision `rev'.
+
+ The revision `rev' mentioned above is the revision of RISC-OS to
+ use. You must reconfigure GCC when going from a RISC-OS revision
+ 4 to RISC-OS revision 5. This has the effect of avoiding a linker
+ bug.
+
+`mips-sgi-*'
+ In order to compile GCC on an SGI running IRIX 4, the "c.hdr.lib"
+ option must be installed from the CD-ROM supplied from Silicon
+ Graphics. This is found on the 2nd CD in release 4.0.1.
+
+ In order to compile GCC on an SGI running IRIX 5, the
+ "compiler_dev.hdr" subsystem must be installed from the IDO CD-ROM
+ supplied by Silicon Graphics.
+
+ `make compare' may fail on version 5 of IRIX unless you add
+ `-save-temps' to `CFLAGS'. On these systems, the name of the
+ assembler input file is stored in the object file, and that makes
+ comparison fail if it differs between the `stage1' and `stage2'
+ compilations. The option `-save-temps' forces a fixed name to be
+ used for the assembler input file, instead of a randomly chosen
+ name in `/tmp'. Do not add `-save-temps' unless the comparisons
+ fail without that option. If you do you `-save-temps', you will
+ have to manually delete the `.i' and `.s' files after each series
+ of compilations.
+
+ The MIPS C compiler needs to be told to increase its table size
+ for switch statements with the `-Wf,-XNg1500' option in order to
+ compile `cp/parse.c'. If you use the `-O2' optimization option,
+ you also need to use `-Olimit 3000'. Both of these options are
+ automatically generated in the `Makefile' that the shell script
+ `configure' builds. If you override the `CC' make variable and
+ use the MIPS compilers, you may need to add `-Wf,-XNg1500 -Olimit
+ 3000'.
+
+ On Irix version 4.0.5F, and perhaps on some other versions as well,
+ there is an assembler bug that reorders instructions incorrectly.
+ To work around it, specify the target configuration
+ `mips-sgi-irix4loser'. This configuration inhibits assembler
+ optimization.
+
+ In a compiler configured with target `mips-sgi-irix4', you can turn
+ off assembler optimization by using the `-noasmopt' option. This
+ compiler option passes the option `-O0' to the assembler, to
+ inhibit reordering.
+
+ The `-noasmopt' option can be useful for testing whether a problem
+ is due to erroneous assembler reordering. Even if a problem does
+ not go away with `-noasmopt', it may still be due to assembler
+ reordering--perhaps GNU CC itself was miscompiled as a result.
+
+ To enable debugging under Irix 5, you must use GNU as 2.5 or later,
+ and use the `--with-gnu-as' configure option when configuring gcc.
+ GNU as is distributed as part of the binutils package.
+
+`mips-sony-sysv'
+ Sony MIPS NEWS. This works in NEWSOS 5.0.1, but not in 5.0.2
+ (which uses ELF instead of COFF). Support for 5.0.2 will probably
+ be provided soon by volunteers. In particular, the linker does
+ not like the code generated by GCC when shared libraries are
+ linked in.
+
+`ns32k-encore'
+ Encore ns32000 system. Encore systems are supported only under
+ BSD.
+
+`ns32k-*-genix'
+ National Semiconductor ns32000 system. Genix has bugs in `alloca'
+ and `malloc'; you must get the compiled versions of these from GNU
+ Emacs.
+
+`ns32k-sequent'
+ Go to the Berkeley universe before compiling. In addition, you
+ probably need to create a file named `string.h' containing just
+ one line: `#include <strings.h>'.
+
+`ns32k-utek'
+ UTEK ns32000 system ("merlin"). The C compiler that comes with
+ this system cannot compile GNU CC; contact `tektronix!reed!mason'
+ to get binaries of GNU CC for bootstrapping.
+
+`romp-*-aos'
+`romp-*-mach'
+ The only operating systems supported for the IBM RT PC are AOS and
+ MACH. GNU CC does not support AIX running on the RT. We
+ recommend you compile GNU CC with an earlier version of itself; if
+ you compile GNU CC with `hc', the Metaware compiler, it will work,
+ but you will get mismatches between the stage 2 and stage 3
+ compilers in various files. These errors are minor differences in
+ some floating-point constants and can be safely ignored; the stage
+ 3 compiler is correct.
+
+`rs6000-*-aix'
+`powerpc-*-aix'
+ Various early versions of each release of the IBM XLC compiler
+ will not bootstrap GNU CC. Symptoms include differences between
+ the stage2 and stage3 object files, and errors when compiling
+ `libgcc.a' or `enquire'. Known problematic releases include:
+ xlc-1.2.1.8, xlc-1.3.0.0 (distributed with AIX 3.2.5), and
+ xlc-1.3.0.19. Both xlc-1.2.1.28 and xlc-1.3.0.24 (PTF 432238) are
+ known to produce working versions of GNU CC, but most other recent
+ releases correctly bootstrap GNU CC. Also, releases of AIX prior
+ to AIX 3.2.4 include a version of the IBM assembler which does not
+ accept debugging directives: assembler updates are available as
+ PTFs. Also, if you are using AIX 3.2.5 or greater and the GNU
+ assembler, you must have a version modified after October 16th,
+ 1995 in order for the GNU C compiler to build. See the file
+ `README.RS6000' for more details on of these problems.
+
+ GNU CC does not yet support the 64-bit PowerPC instructions.
+
+ Objective C does not work on this architecture because it makes
+ assumptions that are incompatible with the calling conventions.
+
+ AIX on the RS/6000 provides support (NLS) for environments outside
+ of the United States. Compilers and assemblers use NLS to support
+ locale-specific representations of various objects including
+ floating-point numbers ("." vs "," for separating decimal
+ fractions). There have been problems reported where the library
+ linked with GNU CC does not produce the same floating-point
+ formats that the assembler accepts. If you have this problem, set
+ the LANG environment variable to "C" or "En_US".
+
+ Due to changes in the way that GNU CC invokes the binder (linker)
+ for AIX 4.1, you may now receive warnings of duplicate symbols
+ from the link step that were not reported before. The assembly
+ files generated by GNU CC for AIX have always included multiple
+ symbol definitions for certain global variable and function
+ declarations in the original program. The warnings should not
+ prevent the linker from producing a correct library or runnable
+ executable.
+
+`powerpc-*-elf'
+`powerpc-*-sysv4'
+ PowerPC system in big endian mode, running System V.4.
+
+ This configuration is currently under development.
+
+`powerpc-*-eabiaix'
+ Embedded PowerPC system in big endian mode with -mcall-aix
+ selected as the default. This system is currently under
+ development.
+
+`powerpc-*-eabisim'
+ Embedded PowerPC system in big endian mode for use in running
+ under the PSIM simulator. This system is currently under
+ development.
+
+`powerpc-*-eabi'
+ Embedded PowerPC system in big endian mode.
+
+ This configuration is currently under development.
+
+`powerpcle-*-elf'
+`powerpcle-*-sysv4'
+ PowerPC system in little endian mode, running System V.4.
+
+ This configuration is currently under development.
+
+`powerpcle-*-sysv4'
+ Embedded PowerPC system in little endian mode.
+
+ This system is currently under development.
+
+`powerpcle-*-eabisim'
+ Embedded PowerPC system in little endian mode for use in running
+ under the PSIM simulator.
+
+ This system is currently under development.
+
+`powerpcle-*-eabi'
+ Embedded PowerPC system in little endian mode.
+
+ This configuration is currently under development.
+
+`vax-dec-ultrix'
+ Don't try compiling with Vax C (`vcc'). It produces incorrect code
+ in some cases (for example, when `alloca' is used).
+
+ Meanwhile, compiling `cp/parse.c' with pcc does not work because of
+ an internal table size limitation in that compiler. To avoid this
+ problem, compile just the GNU C compiler first, and use it to
+ recompile building all the languages that you want to run.
+
+`sparc-sun-*'
+ See *Note Sun Install::, for information on installing GNU CC on
+ Sun systems.
+
+`vax-dec-vms'
+ See *Note VMS Install::, for details on how to install GNU CC on
+ VMS.
+
+`we32k-*-*'
+ These computers are also known as the 3b2, 3b5, 3b20 and other
+ similar names. (However, the 3b1 is actually a 68000; see *Note
+ Configurations::.)
+
+ Don't use `-g' when compiling with the system's compiler. The
+ system's linker seems to be unable to handle such a large program
+ with debugging information.
+
+ The system's compiler runs out of capacity when compiling `stmt.c'
+ in GNU CC. You can work around this by building `cpp' in GNU CC
+ first, then use that instead of the system's preprocessor with the
+ system's C compiler to compile `stmt.c'. Here is how:
+
+ mv /lib/cpp /lib/cpp.att
+ cp cpp /lib/cpp.gnu
+ echo '/lib/cpp.gnu -traditional ${1+"$@"}' > /lib/cpp
+ chmod +x /lib/cpp
+
+ The system's compiler produces bad code for some of the GNU CC
+ optimization files. So you must build the stage 2 compiler without
+ optimization. Then build a stage 3 compiler with optimization.
+ That executable should work. Here are the necessary commands:
+
+ make LANGUAGES=c CC=stage1/xgcc CFLAGS="-Bstage1/ -g"
+ make stage2
+ make CC=stage2/xgcc CFLAGS="-Bstage2/ -g -O"
+
+ You may need to raise the ULIMIT setting to build a C++ compiler,
+ as the file `cc1plus' is larger than one megabyte.
+
+Compilation in a Separate Directory
+===================================
+
+ If you wish to build the object files and executables in a directory
+other than the one containing the source files, here is what you must
+do differently:
+
+ 1. Make sure you have a version of Make that supports the `VPATH'
+ feature. (GNU Make supports it, as do Make versions on most BSD
+ systems.)
+
+ 2. If you have ever run `configure' in the source directory, you must
+ undo the configuration. Do this by running:
+
+ make distclean
+
+ 3. Go to the directory in which you want to build the compiler before
+ running `configure':
+
+ mkdir gcc-sun3
+ cd gcc-sun3
+
+ On systems that do not support symbolic links, this directory must
+ be on the same file system as the source code directory.
+
+ 4. Specify where to find `configure' when you run it:
+
+ ../gcc/configure ...
+
+ This also tells `configure' where to find the compiler sources;
+ `configure' takes the directory from the file name that was used to
+ invoke it. But if you want to be sure, you can specify the source
+ directory with the `--srcdir' option, like this:
+
+ ../gcc/configure --srcdir=../gcc OTHER OPTIONS
+
+ The directory you specify with `--srcdir' need not be the same as
+ the one that `configure' is found in.
+
+ Now, you can run `make' in that directory. You need not repeat the
+configuration steps shown above, when ordinary source files change. You
+must, however, run `configure' again when the configuration files
+change, if your system does not support symbolic links.
+
+Building and Installing a Cross-Compiler
+========================================
+
+ GNU CC can function as a cross-compiler for many machines, but not
+all.
+
+ * Cross-compilers for the Mips as target using the Mips assembler
+ currently do not work, because the auxiliary programs
+ `mips-tdump.c' and `mips-tfile.c' can't be compiled on anything
+ but a Mips. It does work to cross compile for a Mips if you use
+ the GNU assembler and linker.
+
+ * Cross-compilers between machines with different floating point
+ formats have not all been made to work. GNU CC now has a floating
+ point emulator with which these can work, but each target machine
+ description needs to be updated to take advantage of it.
+
+ * Cross-compilation between machines of different word sizes is
+ somewhat problematic and sometimes does not work.
+
+ Since GNU CC generates assembler code, you probably need a
+cross-assembler that GNU CC can run, in order to produce object files.
+If you want to link on other than the target machine, you need a
+cross-linker as well. You also need header files and libraries suitable
+for the target machine that you can install on the host machine.
+
+Steps of Cross-Compilation
+--------------------------
+
+ To compile and run a program using a cross-compiler involves several
+steps:
+
+ * Run the cross-compiler on the host machine to produce assembler
+ files for the target machine. This requires header files for the
+ target machine.
+
+ * Assemble the files produced by the cross-compiler. You can do this
+ either with an assembler on the target machine, or with a
+ cross-assembler on the host machine.
+
+ * Link those files to make an executable. You can do this either
+ with a linker on the target machine, or with a cross-linker on the
+ host machine. Whichever machine you use, you need libraries and
+ certain startup files (typically `crt....o') for the target
+ machine.
+
+ It is most convenient to do all of these steps on the same host
+machine, since then you can do it all with a single invocation of GNU
+CC. This requires a suitable cross-assembler and cross-linker. For
+some targets, the GNU assembler and linker are available.
+
+Configuring a Cross-Compiler
+----------------------------
+
+ To build GNU CC as a cross-compiler, you start out by running
+`configure'. Use the `--target=TARGET' to specify the target type. If
+`configure' was unable to correctly identify the system you are running
+on, also specify the `--build=BUILD' option. For example, here is how
+to configure for a cross-compiler that produces code for an HP 68030
+system running BSD on a system that `configure' can correctly identify:
+
+ ./configure --target=m68k-hp-bsd4.3
+
+Tools and Libraries for a Cross-Compiler
+----------------------------------------
+
+ If you have a cross-assembler and cross-linker available, you should
+install them now. Put them in the directory `/usr/local/TARGET/bin'.
+Here is a table of the tools you should put in this directory:
+
+`as'
+ This should be the cross-assembler.
+
+`ld'
+ This should be the cross-linker.
+
+`ar'
+ This should be the cross-archiver: a program which can manipulate
+ archive files (linker libraries) in the target machine's format.
+
+`ranlib'
+ This should be a program to construct a symbol table in an archive
+ file.
+
+ The installation of GNU CC will find these programs in that
+directory, and copy or link them to the proper place to for the
+cross-compiler to find them when run later.
+
+ The easiest way to provide these files is to build the Binutils
+package and GAS. Configure them with the same `--host' and `--target'
+options that you use for configuring GNU CC, then build and install
+them. They install their executables automatically into the proper
+directory. Alas, they do not support all the targets that GNU CC
+supports.
+
+ If you want to install libraries to use with the cross-compiler,
+such as a standard C library, put them in the directory
+`/usr/local/TARGET/lib'; installation of GNU CC copies all all the
+files in that subdirectory into the proper place for GNU CC to find
+them and link with them. Here's an example of copying some libraries
+from a target machine:
+
+ ftp TARGET-MACHINE
+ lcd /usr/local/TARGET/lib
+ cd /lib
+ get libc.a
+ cd /usr/lib
+ get libg.a
+ get libm.a
+ quit
+
+The precise set of libraries you'll need, and their locations on the
+target machine, vary depending on its operating system.
+
+ Many targets require "start files" such as `crt0.o' and `crtn.o'
+which are linked into each executable; these too should be placed in
+`/usr/local/TARGET/lib'. There may be several alternatives for
+`crt0.o', for use with profiling or other compilation options. Check
+your target's definition of `STARTFILE_SPEC' to find out what start
+files it uses. Here's an example of copying these files from a target
+machine:
+
+ ftp TARGET-MACHINE
+ lcd /usr/local/TARGET/lib
+ prompt
+ cd /lib
+ mget *crt*.o
+ cd /usr/lib
+ mget *crt*.o
+ quit
+
+`libgcc.a' and Cross-Compilers
+------------------------------
+
+ Code compiled by GNU CC uses certain runtime support functions
+implicitly. Some of these functions can be compiled successfully with
+GNU CC itself, but a few cannot be. These problem functions are in the
+source file `libgcc1.c'; the library made from them is called
+`libgcc1.a'.
+
+ When you build a native compiler, these functions are compiled with
+some other compiler-the one that you use for bootstrapping GNU CC.
+Presumably it knows how to open code these operations, or else knows how
+to call the run-time emulation facilities that the machine comes with.
+But this approach doesn't work for building a cross-compiler. The
+compiler that you use for building knows about the host system, not the
+target system.
+
+ So, when you build a cross-compiler you have to supply a suitable
+library `libgcc1.a' that does the job it is expected to do.
+
+ To compile `libgcc1.c' with the cross-compiler itself does not work.
+The functions in this file are supposed to implement arithmetic
+operations that GNU CC does not know how to open code for your target
+machine. If these functions are compiled with GNU CC itself, they will
+compile into infinite recursion.
+
+ On any given target, most of these functions are not needed. If GNU
+CC can open code an arithmetic operation, it will not call these
+functions to perform the operation. It is possible that on your target
+machine, none of these functions is needed. If so, you can supply an
+empty library as `libgcc1.a'.
+
+ Many targets need library support only for multiplication and
+division. If you are linking with a library that contains functions for
+multiplication and division, you can tell GNU CC to call them directly
+by defining the macros `MULSI3_LIBCALL', and the like. These macros
+need to be defined in the target description macro file. For some
+targets, they are defined already. This may be sufficient to avoid the
+need for libgcc1.a; if so, you can supply an empty library.
+
+ Some targets do not have floating point instructions; they need other
+functions in `libgcc1.a', which do floating arithmetic. Recent
+versions of GNU CC have a file which emulates floating point. With a
+certain amount of work, you should be able to construct a floating
+point emulator that can be used as `libgcc1.a'. Perhaps future
+versions will contain code to do this automatically and conveniently.
+That depends on whether someone wants to implement it.
+
+ Some embedded targets come with all the necessary `libgcc1.a'
+routines written in C or assembler. These targets build `libgcc1.a'
+automatically and you do not need to do anything special for them.
+Other embedded targets do not need any `libgcc1.a' routines since all
+the necessary operations are supported by the hardware.
+
+ If your target system has another C compiler, you can configure GNU
+CC as a native compiler on that machine, build just `libgcc1.a' with
+`make libgcc1.a' on that machine, and use the resulting file with the
+cross-compiler. To do this, execute the following on the target
+machine:
+
+ cd TARGET-BUILD-DIR
+ ./configure --host=sparc --target=sun3
+ make libgcc1.a
+
+And then this on the host machine:
+
+ ftp TARGET-MACHINE
+ binary
+ cd TARGET-BUILD-DIR
+ get libgcc1.a
+ quit
+
+ Another way to provide the functions you need in `libgcc1.a' is to
+define the appropriate `perform_...' macros for those functions. If
+these definitions do not use the C arithmetic operators that they are
+meant to implement, you should be able to compile them with the
+cross-compiler you are building. (If these definitions already exist
+for your target file, then you are all set.)
+
+ To build `libgcc1.a' using the perform macros, use
+`LIBGCC1=libgcc1.a OLDCC=./xgcc' when building the compiler.
+Otherwise, you should place your replacement library under the name
+`libgcc1.a' in the directory in which you will build the
+cross-compiler, before you run `make'.
+
+Cross-Compilers and Header Files
+--------------------------------
+
+ If you are cross-compiling a standalone program or a program for an
+embedded system, then you may not need any header files except the few
+that are part of GNU CC (and those of your program). However, if you
+intend to link your program with a standard C library such as `libc.a',
+then you probably need to compile with the header files that go with
+the library you use.
+
+ The GNU C compiler does not come with these files, because (1) they
+are system-specific, and (2) they belong in a C library, not in a
+compiler.
+
+ If the GNU C library supports your target machine, then you can get
+the header files from there (assuming you actually use the GNU library
+when you link your program).
+
+ If your target machine comes with a C compiler, it probably comes
+with suitable header files also. If you make these files accessible
+from the host machine, the cross-compiler can use them also.
+
+ Otherwise, you're on your own in finding header files to use when
+cross-compiling.
+
+ When you have found suitable header files, put them in
+`/usr/local/TARGET/include', before building the cross compiler. Then
+installation will run fixincludes properly and install the corrected
+versions of the header files where the compiler will use them.
+
+ Provide the header files before you build the cross-compiler, because
+the build stage actually runs the cross-compiler to produce parts of
+`libgcc.a'. (These are the parts that *can* be compiled with GNU CC.)
+Some of them need suitable header files.
+
+ Here's an example showing how to copy the header files from a target
+machine. On the target machine, do this:
+
+ (cd /usr/include; tar cf - .) > tarfile
+
+ Then, on the host machine, do this:
+
+ ftp TARGET-MACHINE
+ lcd /usr/local/TARGET/include
+ get tarfile
+ quit
+ tar xf tarfile
+
+Actually Building the Cross-Compiler
+------------------------------------
+
+ Now you can proceed just as for compiling a single-machine compiler
+through the step of building stage 1. If you have not provided some
+sort of `libgcc1.a', then compilation will give up at the point where
+it needs that file, printing a suitable error message. If you do
+provide `libgcc1.a', then building the compiler will automatically
+compile and link a test program called `libgcc1-test'; if you get
+errors in the linking, it means that not all of the necessary routines
+in `libgcc1.a' are available.
+
+ You must provide the header file `float.h'. One way to do this is
+to compile `enquire' and run it on your target machine. The job of
+`enquire' is to run on the target machine and figure out by experiment
+the nature of its floating point representation. `enquire' records its
+findings in the header file `float.h'. If you can't produce this file
+by running `enquire' on the target machine, then you will need to come
+up with a suitable `float.h' in some other way (or else, avoid using it
+in your programs).
+
+ Do not try to build stage 2 for a cross-compiler. It doesn't work to
+rebuild GNU CC as a cross-compiler using the cross-compiler, because
+that would produce a program that runs on the target machine, not on the
+host. For example, if you compile a 386-to-68030 cross-compiler with
+itself, the result will not be right either for the 386 (because it was
+compiled into 68030 code) or for the 68030 (because it was configured
+for a 386 as the host). If you want to compile GNU CC into 68030 code,
+whether you compile it on a 68030 or with a cross-compiler on a 386, you
+must specify a 68030 as the host when you configure it.
+
+ To install the cross-compiler, use `make install', as usual.
+
+Installing GNU CC on the Sun
+============================
+
+ On Solaris (version 2.1), do not use the linker or other tools in
+`/usr/ucb' to build GNU CC. Use `/usr/ccs/bin'.
+
+ Make sure the environment variable `FLOAT_OPTION' is not set when
+you compile `libgcc.a'. If this option were set to `f68881' when
+`libgcc.a' is compiled, the resulting code would demand to be linked
+with a special startup file and would not link properly without special
+pains.
+
+ There is a bug in `alloca' in certain versions of the Sun library.
+To avoid this bug, install the binaries of GNU CC that were compiled by
+GNU CC. They use `alloca' as a built-in function and never the one in
+the library.
+
+ Some versions of the Sun compiler crash when compiling GNU CC. The
+problem is a segmentation fault in cpp. This problem seems to be due to
+the bulk of data in the environment variables. You may be able to avoid
+it by using the following command to compile GNU CC with Sun CC:
+
+ make CC="TERMCAP=x OBJS=x LIBFUNCS=x STAGESTUFF=x cc"
+
+Installing GNU CC on VMS
+========================
+
+ The VMS version of GNU CC is distributed in a backup saveset
+containing both source code and precompiled binaries.
+
+ To install the `gcc' command so you can use the compiler easily, in
+the same manner as you use the VMS C compiler, you must install the VMS
+CLD file for GNU CC as follows:
+
+ 1. Define the VMS logical names `GNU_CC' and `GNU_CC_INCLUDE' to
+ point to the directories where the GNU CC executables
+ (`gcc-cpp.exe', `gcc-cc1.exe', etc.) and the C include files are
+ kept respectively. This should be done with the commands:
+
+ $ assign /system /translation=concealed -
+ disk:[gcc.] gnu_cc
+ $ assign /system /translation=concealed -
+ disk:[gcc.include.] gnu_cc_include
+
+ with the appropriate disk and directory names. These commands can
+ be placed in your system startup file so they will be executed
+ whenever the machine is rebooted. You may, if you choose, do this
+ via the `GCC_INSTALL.COM' script in the `[GCC]' directory.
+
+ 2. Install the `GCC' command with the command line:
+
+ $ set command /table=sys$common:[syslib]dcltables -
+ /output=sys$common:[syslib]dcltables gnu_cc:[000000]gcc
+ $ install replace sys$common:[syslib]dcltables
+
+ 3. To install the help file, do the following:
+
+ $ library/help sys$library:helplib.hlb gcc.hlp
+
+ Now you can invoke the compiler with a command like `gcc /verbose
+ file.c', which is equivalent to the command `gcc -v -c file.c' in
+ Unix.
+
+ If you wish to use GNU C++ you must first install GNU CC, and then
+perform the following steps:
+
+ 1. Define the VMS logical name `GNU_GXX_INCLUDE' to point to the
+ directory where the preprocessor will search for the C++ header
+ files. This can be done with the command:
+
+ $ assign /system /translation=concealed -
+ disk:[gcc.gxx_include.] gnu_gxx_include
+
+ with the appropriate disk and directory name. If you are going to
+ be using libg++, this is where the libg++ install procedure will
+ install the libg++ header files.
+
+ 2. Obtain the file `gcc-cc1plus.exe', and place this in the same
+ directory that `gcc-cc1.exe' is kept.
+
+ The GNU C++ compiler can be invoked with a command like `gcc /plus
+ /verbose file.cc', which is equivalent to the command `g++ -v -c
+ file.cc' in Unix.
+
+ We try to put corresponding binaries and sources on the VMS
+distribution tape. But sometimes the binaries will be from an older
+version than the sources, because we don't always have time to update
+them. (Use the `/version' option to determine the version number of
+the binaries and compare it with the source file `version.c' to tell
+whether this is so.) In this case, you should use the binaries you get
+to recompile the sources. If you must recompile, here is how:
+
+ 1. Execute the command procedure `vmsconfig.com' to set up the files
+ `tm.h', `config.h', `aux-output.c', and `md.', and to create files
+ `tconfig.h' and `hconfig.h'. This procedure also creates several
+ linker option files used by `make-cc1.com' and a data file used by
+ `make-l2.com'.
+
+ $ @vmsconfig.com
+
+ 2. Setup the logical names and command tables as defined above. In
+ addition, define the VMS logical name `GNU_BISON' to point at the
+ to the directories where the Bison executable is kept. This
+ should be done with the command:
+
+ $ assign /system /translation=concealed -
+ disk:[bison.] gnu_bison
+
+ You may, if you choose, use the `INSTALL_BISON.COM' script in the
+ `[BISON]' directory.
+
+ 3. Install the `BISON' command with the command line:
+
+ $ set command /table=sys$common:[syslib]dcltables -
+ /output=sys$common:[syslib]dcltables -
+ gnu_bison:[000000]bison
+ $ install replace sys$common:[syslib]dcltables
+
+ 4. Type `@make-gcc' to recompile everything (alternatively, submit
+ the file `make-gcc.com' to a batch queue). If you wish to build
+ the GNU C++ compiler as well as the GNU CC compiler, you must
+ first edit `make-gcc.com' and follow the instructions that appear
+ in the comments.
+
+ 5. In order to use GCC, you need a library of functions which GCC
+ compiled code will call to perform certain tasks, and these
+ functions are defined in the file `libgcc2.c'. To compile this
+ you should use the command procedure `make-l2.com', which will
+ generate the library `libgcc2.olb'. `libgcc2.olb' should be built
+ using the compiler built from the same distribution that
+ `libgcc2.c' came from, and `make-gcc.com' will automatically do
+ all of this for you.
+
+ To install the library, use the following commands:
+
+ $ library gnu_cc:[000000]gcclib/delete=(new,eprintf)
+ $ library gnu_cc:[000000]gcclib/delete=L_*
+ $ library libgcc2/extract=*/output=libgcc2.obj
+ $ library gnu_cc:[000000]gcclib libgcc2.obj
+
+ The first command simply removes old modules that will be replaced
+ with modules from `libgcc2' under different module names. The
+ modules `new' and `eprintf' may not actually be present in your
+ `gcclib.olb'--if the VMS librarian complains about those modules
+ not being present, simply ignore the message and continue on with
+ the next command. The second command removes the modules that
+ came from the previous version of the library `libgcc2.c'.
+
+ Whenever you update the compiler on your system, you should also
+ update the library with the above procedure.
+
+ 6. You may wish to build GCC in such a way that no files are written
+ to the directory where the source files reside. An example would
+ be the when the source files are on a read-only disk. In these
+ cases, execute the following DCL commands (substituting your
+ actual path names):
+
+ $ assign dua0:[gcc.build_dir.]/translation=concealed, -
+ dua1:[gcc.source_dir.]/translation=concealed gcc_build
+ $ set default gcc_build:[000000]
+
+ where the directory `dua1:[gcc.source_dir]' contains the source
+ code, and the directory `dua0:[gcc.build_dir]' is meant to contain
+ all of the generated object files and executables. Once you have
+ done this, you can proceed building GCC as described above. (Keep
+ in mind that `gcc_build' is a rooted logical name, and thus the
+ device names in each element of the search list must be an actual
+ physical device name rather than another rooted logical name).
+
+ 7. *If you are building GNU CC with a previous version of GNU CC, you
+ also should check to see that you have the newest version of the
+ assembler*. In particular, GNU CC version 2 treats global constant
+ variables slightly differently from GNU CC version 1, and GAS
+ version 1.38.1 does not have the patches required to work with GCC
+ version 2. If you use GAS 1.38.1, then `extern const' variables
+ will not have the read-only bit set, and the linker will generate
+ warning messages about mismatched psect attributes for these
+ variables. These warning messages are merely a nuisance, and can
+ safely be ignored.
+
+ If you are compiling with a version of GNU CC older than 1.33,
+ specify `/DEFINE=("inline=")' as an option in all the
+ compilations. This requires editing all the `gcc' commands in
+ `make-cc1.com'. (The older versions had problems supporting
+ `inline'.) Once you have a working 1.33 or newer GNU CC, you can
+ change this file back.
+
+ 8. If you want to build GNU CC with the VAX C compiler, you will need
+ to make minor changes in `make-cccp.com' and `make-cc1.com' to
+ choose alternate definitions of `CC', `CFLAGS', and `LIBS'. See
+ comments in those files. However, you must also have a working
+ version of the GNU assembler (GNU as, aka GAS) as it is used as
+ the back-end for GNU CC to produce binary object modules and is
+ not included in the GNU CC sources. GAS is also needed to compile
+ `libgcc2' in order to build `gcclib' (see above); `make-l2.com'
+ expects to be able to find it operational in
+ `gnu_cc:[000000]gnu-as.exe'.
+
+ To use GNU CC on VMS, you need the VMS driver programs `gcc.exe',
+ `gcc.com', and `gcc.cld'. They are distributed with the VMS
+ binaries (`gcc-vms') rather than the GNU CC sources. GAS is also
+ included in `gcc-vms', as is Bison.
+
+ Once you have successfully built GNU CC with VAX C, you should use
+ the resulting compiler to rebuild itself. Before doing this, be
+ sure to restore the `CC', `CFLAGS', and `LIBS' definitions in
+ `make-cccp.com' and `make-cc1.com'. The second generation
+ compiler will be able to take advantage of many optimizations that
+ must be suppressed when building with other compilers.
+
+ Under previous versions of GNU CC, the generated code would
+occasionally give strange results when linked with the sharable
+`VAXCRTL' library. Now this should work.
+
+ Even with this version, however, GNU CC itself should not be linked
+with the sharable `VAXCRTL'. The version of `qsort' in `VAXCRTL' has a
+bug (known to be present in VMS versions V4.6 through V5.5) which
+causes the compiler to fail.
+
+ The executables are generated by `make-cc1.com' and `make-cccp.com'
+use the object library version of `VAXCRTL' in order to make use of the
+`qsort' routine in `gcclib.olb'. If you wish to link the compiler
+executables with the shareable image version of `VAXCRTL', you should
+edit the file `tm.h' (created by `vmsconfig.com') to define the macro
+`QSORT_WORKAROUND'.
+
+ `QSORT_WORKAROUND' is always defined when GNU CC is compiled with
+VAX C, to avoid a problem in case `gcclib.olb' is not yet available.
+
+`collect2'
+==========
+
+ Many target systems do not have support in the assembler and linker
+for "constructors"--initialization functions to be called before the
+official "start" of `main'. On such systems, GNU CC uses a utility
+called `collect2' to arrange to call these functions at start time.
+
+ The program `collect2' works by linking the program once and looking
+through the linker output file for symbols with particular names
+indicating they are constructor functions. If it finds any, it creates
+a new temporary `.c' file containing a table of them, compiles it, and
+links the program a second time including that file.
+
+ The actual calls to the constructors are carried out by a subroutine
+called `__main', which is called (automatically) at the beginning of
+the body of `main' (provided `main' was compiled with GNU CC). Calling
+`__main' is necessary, even when compiling C code, to allow linking C
+and C++ object code together. (If you use `-nostdlib', you get an
+unresolved reference to `__main', since it's defined in the standard
+GCC library. Include `-lgcc' at the end of your compiler command line
+to resolve this reference.)
+
+ The program `collect2' is installed as `ld' in the directory where
+the passes of the compiler are installed. When `collect2' needs to
+find the *real* `ld', it tries the following file names:
+
+ * `real-ld' in the directories listed in the compiler's search
+ directories.
+
+ * `real-ld' in the directories listed in the environment variable
+ `PATH'.
+
+ * The file specified in the `REAL_LD_FILE_NAME' configuration macro,
+ if specified.
+
+ * `ld' in the compiler's search directories, except that `collect2'
+ will not execute itself recursively.
+
+ * `ld' in `PATH'.
+
+ "The compiler's search directories" means all the directories where
+`gcc' searches for passes of the compiler. This includes directories
+that you specify with `-B'.
+
+ Cross-compilers search a little differently:
+
+ * `real-ld' in the compiler's search directories.
+
+ * `TARGET-real-ld' in `PATH'.
+
+ * The file specified in the `REAL_LD_FILE_NAME' configuration macro,
+ if specified.
+
+ * `ld' in the compiler's search directories.
+
+ * `TARGET-ld' in `PATH'.
+
+ `collect2' explicitly avoids running `ld' using the file name under
+which `collect2' itself was invoked. In fact, it remembers up a list
+of such names--in case one copy of `collect2' finds another copy (or
+version) of `collect2' installed as `ld' in a second place in the
+search path.
+
+ `collect2' searches for the utilities `nm' and `strip' using the
+same algorithm as above for `ld'.
+
+Standard Header File Directories
+================================
+
+ `GCC_INCLUDE_DIR' means the same thing for native and cross. It is
+where GNU CC stores its private include files, and also where GNU CC
+stores the fixed include files. A cross compiled GNU CC runs
+`fixincludes' on the header files in `$(tooldir)/include'. (If the
+cross compilation header files need to be fixed, they must be installed
+before GNU CC is built. If the cross compilation header files are
+already suitable for ANSI C and GNU CC, nothing special need be done).
+
+ `GPLUS_INCLUDE_DIR' means the same thing for native and cross. It
+is where `g++' looks first for header files. `libg++' installs only
+target independent header files in that directory.
+
+ `LOCAL_INCLUDE_DIR' is used only for a native compiler. It is
+normally `/usr/local/include'. GNU CC searches this directory so that
+users can install header files in `/usr/local/include'.
+
+ `CROSS_INCLUDE_DIR' is used only for a cross compiler. GNU CC
+doesn't install anything there.
+
+ `TOOL_INCLUDE_DIR' is used for both native and cross compilers. It
+is the place for other packages to install header files that GNU CC will
+use. For a cross-compiler, this is the equivalent of `/usr/include'.
+When you build a cross-compiler, `fixincludes' processes any header
+files in this directory.
+
diff --git a/contrib/gcc/config/alpha/config-nt.sed b/contrib/gcc/config/alpha/config-nt.sed
new file mode 100644
index 000000000000..a5027bc1882a
--- /dev/null
+++ b/contrib/gcc/config/alpha/config-nt.sed
@@ -0,0 +1,33 @@
+/^Makefile/,/^ rm -f config.run/d
+s/rm -f/del/
+s/|| cp/|| copy/
+/^config.status/,/ fi/d
+s/config.status//g
+s/\/dev\/null/NUL/g
+s/$(srcdir)\/c-parse/c-parse/g
+s/$(srcdir)\/c-gperf/c-gperf/g
+/^multilib.h/ s/multilib/not-multilib/
+/^target=/ c\
+target=winnt3.5
+/^xmake_file=/ d
+/^tmake_file=/ d
+/^out_file/ c\
+out_file=config/alpha/alpha.c
+/^out_object_file/ c\
+out_object_file=alpha.obj
+/^md_file/ c\
+md_file=config/alpha/alpha.md
+/^tm_file/ c\
+tm_file=config/alpha/winnt.h
+/^build_xm_file/ c\
+build_xm_file=config/alpha/xm-winnt.h
+/^host_xm_file/ c\
+host_xm_file=config/alpha/xm-winnt.h
+/^####target/ i\
+CC = cl \
+CLIB = libc.lib kernel32.lib \
+CFLAGS = -Dalpha -DWIN32 -D_WIN32 -D_ALPHA_ -D_M_ALPHA \\\
+ -DALMOST_STDC \
+LDFLAGS = -subsystem:console -entry:mainCRTStartup \\\
+ -stack:1000000,1000 \
+
diff --git a/contrib/gcc/config/alpha/win-nt.h b/contrib/gcc/config/alpha/win-nt.h
new file mode 100644
index 000000000000..cb3d9eb2bd95
--- /dev/null
+++ b/contrib/gcc/config/alpha/win-nt.h
@@ -0,0 +1,72 @@
+/* Definitions of target machine for GNU compiler, for DEC Alpha
+ running Windows/NT.
+ Copyright (C) 1995 Free Software Foundation, Inc.
+ Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
+
+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. */
+
+/* Say this is Windows/NT for the other config files. */
+#define WINDOWS_NT 1
+
+#include "alpha/alpha.h"
+
+/* Names to predefine in the preprocessor for this target machine. */
+
+#undef CPP_PREDEFINES
+#define CPP_PREDEFINES "-DWIN32 -D_WIN32 -DWINNT -D__STDC__=0 -DALMOST_STDC\
+ -D_M_ALPHA -D_ALPHA_ -D__alpha -D__alpha__\
+ -D_LONGLONG -D__unaligned= -D__stdcall= \
+ -Asystem(winnt) -Acpu(alpha) -Amachine(alpha)"
+
+#undef ASM_SPEC
+#undef ASM_FINAL_SPEC
+#define ASM_SPEC "-nopp -nologo %{g:-Zi}"
+
+/* Pointer is 32 bits but the hardware has 64-bit addresses, sign extended. */
+#undef POINTER_SIZE
+#define POINTER_SIZE 32
+#define POINTERS_EXTEND_UNSIGNED 0
+
+/* "long" is 32 bits. */
+#undef LONG_TYPE_SIZE
+#define LONG_TYPE_SIZE 32
+
+/* We can't do any debugging. */
+#undef SDB_DEBUGGING_INFO
+#undef DBX_DEBUGGING_INFO
+#undef MIPS_DEBUGGING_INFO
+
+#include "winnt/win-nt.h"
+
+#undef ASM_FILE_START
+#define ASM_FILE_START(FILE) \
+{ \
+ alpha_write_verstamp (FILE); \
+ fprintf (FILE, "\t.set noreorder\n"); \
+ fprintf (FILE, "\t.set volatile\n"); \
+ fprintf (FILE, "\t.set noat\n"); \
+ fprintf (FILE, "\t.globl\t__fltused\n"); \
+ ASM_OUTPUT_SOURCE_FILENAME (FILE, main_input_filename); \
+}
+
+#undef LIB_SPEC
+#define LIB_SPEC "%{mwindows:-subsystem windows -e _WinMainCRTStartup \
+ USER32.LIB%s GDI32.LIB%s COMDLG32.LIB%s WINSPOOL.LIB%s} \
+ %{!mwindows:-subsystem console -e _mainCRTStartup} \
+ %{mcrtmt:LIBCMT.LIB%s KERNEL32.LIB%s} %{!mcrtmt:LIBC.LIB%s KERNEL32.LIB%s} \
+ %{v}"
diff --git a/contrib/gcc/config/alpha/xm-winnt.h b/contrib/gcc/config/alpha/xm-winnt.h
new file mode 100644
index 000000000000..202aec3457d5
--- /dev/null
+++ b/contrib/gcc/config/alpha/xm-winnt.h
@@ -0,0 +1,35 @@
+/* Configuration for GNU compiler for an Alpha running Windows NT 3.x.
+ Copyright (C) 1995 Free Software Foundation, Inc.
+ Contributed by Douglas B. Rupp (drupp@cs.washington.edu)
+
+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 "alpha/xm-alpha.h"
+#include "winnt/xm-winnt.h"
+
+#undef HOST_BITS_PER_LONG
+#define HOST_BITS_PER_LONG 32
+
+#undef POSIX
+
+#define access _access
+#define close _close
+#define mktemp _mktemp
+#define open _open
+#define read _read
+#define write _write
diff --git a/contrib/gcc/config/i386/freebsd.h b/contrib/gcc/config/i386/freebsd.h
index 0f50f62c3e5c..95de20505c22 100644
--- a/contrib/gcc/config/i386/freebsd.h
+++ b/contrib/gcc/config/i386/freebsd.h
@@ -22,7 +22,7 @@ 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. */
-/* $FreeBSD$ */
+/* $FreeBSD: src/contrib/gcc/config/i386/freebsd.h,v 1.21.2.4 1999/12/05 20:57:57 obrien Exp $ */
/* A lie, I guess, but the general idea behind FreeBSD/ELF is that we are
supposed to be outputting something that will assemble under SVr4.
diff --git a/contrib/gcc/config/i386/freebsd.h.fixed b/contrib/gcc/config/i386/freebsd.h.fixed
deleted file mode 100644
index 0f50f62c3e5c..000000000000
--- a/contrib/gcc/config/i386/freebsd.h.fixed
+++ /dev/null
@@ -1,570 +0,0 @@
-/* Definitions for Intel 386 running FreeBSD with either a.out or ELF format
- Copyright (C) 1994, 1995 Free Software Foundation, Inc.
- Contributed by Eric Youngdale.
- Modified for stabs-in-ELF by H.J. Lu.
- Adapted from Linux version by John Polstra.
- Added support for generating "old a.out gas" on the fly by Peter Wemm.
-
-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. */
-
-/* $FreeBSD$ */
-
-/* A lie, I guess, but the general idea behind FreeBSD/ELF is that we are
- supposed to be outputting something that will assemble under SVr4.
- This gets us pretty close. */
-#include <i386/i386.h> /* Base i386 target machine definitions */
-#include <i386/att.h> /* Use the i386 AT&T assembler syntax */
-#include <linux.h> /* some common stuff */
-
-/* Don't assume anything about the header files. */
-#define NO_IMPLICIT_EXTERN_C
-
-/* This defines which switch letters take arguments. On svr4, most of
- the normal cases (defined in gcc.c) apply, and we also have -h* and
- -z* options (for the linker). We have a slightly different mix. We
- have -R (alias --rpath), no -z, --soname (-h), --assert etc. */
-
-#undef SWITCH_TAKES_ARG
-#define SWITCH_TAKES_ARG(CHAR) \
- ( (CHAR) == 'D' \
- || (CHAR) == 'U' \
- || (CHAR) == 'o' \
- || (CHAR) == 'e' \
- || (CHAR) == 'T' \
- || (CHAR) == 'u' \
- || (CHAR) == 'I' \
- || (CHAR) == 'm' \
- || (CHAR) == 'L' \
- || (CHAR) == 'A' \
- || (CHAR) == 'h' \
- || (CHAR) == 'z' /* ignored by ld */ \
- || (CHAR) == 'R')
-
-#undef WORD_SWITCH_TAKES_ARG
-#define WORD_SWITCH_TAKES_ARG(STR) \
- (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \
- || !strcmp (STR, "rpath") || !strcmp (STR, "rpath-link") \
- || !strcmp (STR, "soname") || !strcmp (STR, "defsym") \
- || !strcmp (STR, "assert") || !strcmp (STR, "dynamic-linker"))
-
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (i386 FreeBSD)");
-
-#define MASK_PROFILER_EPILOGUE 010000000000
-#define MASK_AOUT 004000000000 /* a.out not elf */
-#define MASK_UNDERSCORES 002000000000 /* use leading _ */
-
-#define TARGET_PROFILER_EPILOGUE (target_flags & MASK_PROFILER_EPILOGUE)
-#define TARGET_AOUT (target_flags & MASK_AOUT)
-#define TARGET_ELF ((target_flags & MASK_AOUT) == 0)
-#define TARGET_UNDERSCORES ((target_flags & MASK_UNDERSCORES) != 0)
-
-#undef SUBTARGET_SWITCHES
-#define SUBTARGET_SWITCHES \
- { "profiler-epilogue", MASK_PROFILER_EPILOGUE}, \
- { "no-profiler-epilogue", -MASK_PROFILER_EPILOGUE}, \
- { "aout", MASK_AOUT}, \
- { "no-aout", -MASK_AOUT}, \
- { "underscores", MASK_UNDERSCORES}, \
- { "no-underscores", -MASK_UNDERSCORES},
-
-/* The svr4 ABI for the i386 says that records and unions are returned
- in memory. */
-/* On FreeBSD, we do not. */
-#undef DEFAULT_PCC_STRUCT_RETURN
-#define DEFAULT_PCC_STRUCT_RETURN 0
-
-/* Prefix for internally generated assembler labels. If we aren't using
- underscores, we are using prefix `.'s to identify labels that should
- be ignored, as in `i386/gas.h' --karl@cs.umb.edu */
-#undef LPREFIX
-#define LPREFIX ((TARGET_UNDERSCORES) ? "L" : ".L")
-
-/* Override the default comment-starter of "/". */
-#undef ASM_COMMENT_START
-#define ASM_COMMENT_START "#"
-
-#undef COMMENT_BEGIN
-#define COMMENT_BEGIN "#"
-
-#undef ASM_APP_ON
-#define ASM_APP_ON "#APP\n"
-
-#undef ASM_APP_OFF
-#define ASM_APP_OFF "#NO_APP\n"
-
-/* Output at beginning of assembler file. */
-/* The .file command should always begin the output. */
-
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
- do { \
- output_file_directive (FILE, main_input_filename); \
- if (TARGET_ELF) \
- fprintf (FILE, "\t.version\t\"01.01\"\n"); \
- } while (0)
-
-/* Identify the front-end which produced this file. To keep symbol
- space down, and not confuse kdb, only do this if the language is
- not C. (svr4.h defines ASM_IDENTIFY_GCC but neglects this) */
-#undef ASM_IDENTIFY_LANGUAGE
-#define ASM_IDENTIFY_LANGUAGE(STREAM) \
-{ \
- if (strcmp (lang_identify (), "c") != 0) \
- output_lang_identify (STREAM); \
-}
-
-/* This is how to store into the string BUF
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
-#undef ASM_GENERATE_INTERNAL_LABEL
-#define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \
- sprintf ((BUF), "*%s%s%d", (TARGET_UNDERSCORES) ? "" : ".", \
- (PREFIX), (NUMBER))
-
-/* This is how to output an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-#undef ASM_OUTPUT_INTERNAL_LABEL
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, "%s%s%d:\n", (TARGET_UNDERSCORES) ? "" : ".", \
- PREFIX, NUM)
-
-/* This is how to output a reference to a user-level label named NAME. */
-#undef ASM_OUTPUT_LABELREF
-#define ASM_OUTPUT_LABELREF(FILE,NAME) \
- fprintf (FILE, "%s%s", (TARGET_UNDERSCORES) ? "_" : "", NAME)
-
-
-/* This is how to output an element of a case-vector that is relative.
- This is only used for PIC code. See comments by the `casesi' insn in
- i386.md for an explanation of the expression this outputs. */
-#undef ASM_OUTPUT_ADDR_DIFF_ELT
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
-
-#undef ASM_OUTPUT_ALIGN
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if ((LOG)!=0) fprintf ((FILE), "\t.p2align %d\n", (LOG))
-
-/* Align labels, etc. at 4-byte boundaries.
- For the 486, align to 16-byte boundary for sake of cache. */
-#undef ASM_OUTPUT_ALIGN_CODE
-#define ASM_OUTPUT_ALIGN_CODE(FILE) \
- fprintf ((FILE), "\t.p2align %d,0x90\n", i386_align_jumps)
-
-/* Align start of loop at 4-byte boundary. */
-#undef ASM_OUTPUT_LOOP_ALIGN
-#define ASM_OUTPUT_LOOP_ALIGN(FILE) \
- fprintf ((FILE), "\t.p2align %d,0x90\n", i386_align_loops)
-
-
-/* conditionalize the use of ".section rodata" on elf mode - otherwise .text */
-#undef USE_CONST_SECTION
-#define USE_CONST_SECTION TARGET_ELF
-
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#undef ASM_OUTPUT_CONSTRUCTOR
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- if (TARGET_ELF) { \
- ctors_section (); \
- fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } else { \
- fprintf (asm_out_file, "%s \"%s__CTOR_LIST__\",22,0,0,", ASM_STABS_OP, \
- (TARGET_UNDERSCORES) ? "_" : ""); \
- assemble_name (asm_out_file, name); \
- fputc ('\n', asm_out_file); \
- } \
- } while (0)
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-#undef ASM_OUTPUT_DESTRUCTOR
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- if (TARGET_ELF) { \
- dtors_section (); \
- fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } else { \
- fprintf (asm_out_file, "%s \"%s__DTOR_LIST__\",22,0,0,", ASM_STABS_OP, \
- (TARGET_UNDERSCORES) ? "_" : ""); \
- assemble_name (asm_out_file, name); \
- fputc ('\n', asm_out_file); \
- } \
- } while (0)
-
-/* This says how to output assembler code to declare an
- uninitialized internal linkage data object. Under SVR4,
- the linker seems to want the alignment of data objects
- to depend on their types. We do exactly that here. */
-
-#undef ASM_OUTPUT_ALIGNED_LOCAL
-#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
-do { \
- if (TARGET_ELF) { \
- fprintf ((FILE), "\t%s\t", LOCAL_ASM_OP); \
- assemble_name ((FILE), (NAME)); \
- fprintf ((FILE), "\n"); \
- ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \
- } else { \
- int rounded = (SIZE); \
- if (rounded == 0) rounded = 1; \
- rounded += (BIGGEST_ALIGNMENT / BITS_PER_UNIT) - 1; \
- rounded = (rounded / (BIGGEST_ALIGNMENT / BITS_PER_UNIT) \
- * (BIGGEST_ALIGNMENT / BITS_PER_UNIT)); \
- fputs (".lcomm ", (FILE)); \
- assemble_name ((FILE), (NAME)); \
- fprintf ((FILE), ",%u\n", (rounded)); \
- } \
-} while (0)
-
-#undef ASM_OUTPUT_ALIGNED_COMMON
-#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
-do { \
- if (TARGET_ELF) { \
- fprintf ((FILE), "\t%s\t", COMMON_ASM_OP); \
- assemble_name ((FILE), (NAME)); \
- fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \
- } else { \
- int rounded = (SIZE); \
- if (rounded == 0) rounded = 1; \
- rounded += (BIGGEST_ALIGNMENT / BITS_PER_UNIT) - 1; \
- rounded = (rounded / (BIGGEST_ALIGNMENT / BITS_PER_UNIT) \
- * (BIGGEST_ALIGNMENT / BITS_PER_UNIT)); \
- fputs (".comm ", (FILE)); \
- assemble_name ((FILE), (NAME)); \
- fprintf ((FILE), ",%u\n", (rounded)); \
- } \
-} while (0)
-
-/* Turn off svr4.h version, it chokes the old gas. The old layout
- works fine under new gas anyway. */
-#undef ASM_OUTPUT_ASCII
-
-/* How to output some space */
-#undef ASM_OUTPUT_SKIP
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
-do { \
- if (TARGET_ELF) { \
- fprintf (FILE, "\t%s\t%u\n", SKIP_ASM_OP, (SIZE)); \
- } else { \
- fprintf (FILE, "\t.space %u\n", (SIZE)); \
- } \
-} while (0)
-
-#undef ASM_OUTPUT_SOURCE_LINE
-#define ASM_OUTPUT_SOURCE_LINE(file, line) \
-do { \
- static int sym_lineno = 1; \
- if (TARGET_ELF) { \
- fprintf (file, ".stabn 68,0,%d,.LM%d-", line, sym_lineno); \
- assemble_name (file, XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));\
- fprintf (file, "\n.LM%d:\n", sym_lineno); \
- sym_lineno += 1; \
- } else { \
- fprintf (file, "\t%s %d,0,%d\n", ASM_STABD_OP, N_SLINE, lineno); \
- } \
-} while (0)
-
-/* in elf, the function stabs come first, before the relative offsets */
-#undef DBX_FUNCTION_FIRST
-#define DBX_CHECK_FUNCTION_FIRST TARGET_ELF
-
-/* tag end of file in elf mode */
-#undef DBX_OUTPUT_MAIN_SOURCE_FILE_END
-#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \
-do { \
- if (TARGET_ELF) { \
- fprintf (FILE, "\t.text\n\t.stabs \"\",%d,0,0,.Letext\n.Letext:\n", N_SO); \
- } \
-} while (0)
-
-/* stabs-in-elf has offsets relative to function beginning */
-#undef DBX_OUTPUT_LBRAC
-#define DBX_OUTPUT_LBRAC(file,name) \
-do { \
- fprintf (asmfile, "%s %d,0,0,", ASM_STABN_OP, N_LBRAC); \
- assemble_name (asmfile, buf); \
- if (TARGET_ELF) { \
- fputc ('-', asmfile); \
- assemble_name (asmfile, XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \
- } \
- fprintf (asmfile, "\n"); \
-} while (0)
-
-#undef DBX_OUTPUT_RBRAC
-#define DBX_OUTPUT_RBRAC(file,name) \
-do { \
- fprintf (asmfile, "%s %d,0,0,", ASM_STABN_OP, N_RBRAC); \
- assemble_name (asmfile, buf); \
- if (TARGET_ELF) { \
- fputc ('-', asmfile); \
- assemble_name (asmfile, XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \
- } \
- fprintf (asmfile, "\n"); \
-} while (0)
-
-
-/* Define macro used to output shift-double opcodes when the shift
- count is in %cl. Some assemblers require %cl as an argument;
- some don't.
-
- *OLD* GAS requires the %cl argument, so override i386/unix.h. */
-
-#undef AS3_SHIFT_DOUBLE
-#define AS3_SHIFT_DOUBLE(a,b,c,d) AS3 (a,b,c,d)
-
-/* Indicate that jump tables go in the text section. This is
- necessary when compiling PIC code. */
-#define JUMP_TABLES_IN_TEXT_SECTION
-
-/* override the exception table positioning */
-#define EXCEPTION_SECTION_FUNCTION \
-do { \
- if (TARGET_ELF) { \
- named_section (NULL_TREE, ".gcc_except_table"); \
- } else { \
- if (flag_pic) \
- data_section (); \
- else \
- readonly_data_section (); \
- } \
-} while (0);
-
-/* supply our own hook for calling __main() from main() */
-#define GEN_CALL__MAIN \
- do { \
- if (!(TARGET_ELF)) \
- emit_library_call (gen_rtx (SYMBOL_REF, Pmode, NAME__MAIN), 0, \
- VOIDmode, 0); \
- } while (0)
-
-/* Use dollar signs in special g++ assembler names. */
-#undef NO_DOLLAR_IN_LABEL
-
-/* Map i386 registers to the numbers dwarf expects. Of course this is different
- from what stabs expects. */
-
-#undef DWARF_DBX_REGISTER_NUMBER
-#define DWARF_DBX_REGISTER_NUMBER(n) \
-((n) == 0 ? 0 \
- : (n) == 1 ? 2 \
- : (n) == 2 ? 1 \
- : (n) == 3 ? 3 \
- : (n) == 4 ? 6 \
- : (n) == 5 ? 7 \
- : (n) == 6 ? 5 \
- : (n) == 7 ? 4 \
- : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \
- : (-1))
-
-/* Now what stabs expects in the register. */
-#define STABS_DBX_REGISTER_NUMBER(n) \
-((n) == 0 ? 0 : \
- (n) == 1 ? 2 : \
- (n) == 2 ? 1 : \
- (n) == 3 ? 3 : \
- (n) == 4 ? 6 : \
- (n) == 5 ? 7 : \
- (n) == 6 ? 4 : \
- (n) == 7 ? 5 : \
- (n) + 4)
-
-#undef DBX_REGISTER_NUMBER
-#define DBX_REGISTER_NUMBER(n) ((write_symbols == DWARF_DEBUG) \
- ? DWARF_DBX_REGISTER_NUMBER(n) \
- : STABS_DBX_REGISTER_NUMBER(n))
-
-/* Tell final.c that we don't need a label passed to mcount. */
-#define NO_PROFILE_DATA
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry. */
-/* Redefine this to not pass an unused label in %edx. */
-
-#undef FUNCTION_PROFILER
-#define FUNCTION_PROFILER(FILE, LABELNO) \
-{ \
- if (flag_pic) \
- fprintf (FILE, "\tcall *%s@GOT(%%ebx)\n", \
- TARGET_AOUT ? "mcount" : ".mcount"); \
- else \
- fprintf (FILE, "\tcall %s\n", TARGET_AOUT ? "mcount" : ".mcount"); \
-}
-
-#define FUNCTION_PROFILER_EPILOGUE(FILE) \
-{ \
- if (TARGET_PROFILER_EPILOGUE) \
- { \
- if (flag_pic) \
- fprintf (FILE, "\tcall *%s@GOT(%%ebx)\n", \
- TARGET_AOUT ? "mexitcount" : ".mexitcount"); \
- else \
- fprintf (FILE, "\tcall %s\n", \
- TARGET_AOUT ? "mexitcount" : ".mexitcount"); \
- } \
-}
-
-#undef SIZE_TYPE
-#define SIZE_TYPE "unsigned int"
-
-#undef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "int"
-
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "int"
-
-#define WCHAR_UNSIGNED 0
-
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE BITS_PER_WORD
-
-/* FREEBSD_NATIVE is defined when gcc is integrated into the FreeBSD
- source tree so it can be configured appropriately without using
- the GNU configure/build mechanism. */
-
-#ifdef FREEBSD_NATIVE
-
-/* Look for the include files in the system-defined places. */
-
-#define GPLUSPLUS_INCLUDE_DIR "/usr/include/g++"
-
-#define GCC_INCLUDE_DIR "/usr/include"
-
-/* FreeBSD has GCC_INCLUDE_DIR first. */
-#define INCLUDE_DEFAULTS \
- { \
- { GCC_INCLUDE_DIR, 0, 0 }, \
- { GPLUSPLUS_INCLUDE_DIR, 1, 1 }, \
- { 0, 0, 0 } \
- }
-
-/* Under FreeBSD, the normal location of the compiler back ends is the
- /usr/libexec directory. */
-
-#define STANDARD_EXEC_PREFIX "/usr/libexec/"
-
-/* Under FreeBSD, the normal location of the various *crt*.o files is the
- /usr/lib directory. */
-
-#define STANDARD_STARTFILE_PREFIX "/usr/lib/"
-
-/* On FreeBSD, gcc is called 'cc' */
-#define GCC_NAME "cc"
-
-/* FreeBSD is 4.4BSD derived */
-#define bsd4_4
-
-#endif /* FREEBSD_NATIVE */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dunix -Di386 -D__FreeBSD__=3 -D__FreeBSD_cc_version=340000 -Asystem(unix) -Asystem(FreeBSD) -Acpu(i386) -Amachine(i386)"
-
-#undef CPP_SPEC
-#if TARGET_CPU_DEFAULT == 2
-#define CPP_SPEC "\
-%{!maout: -D__ELF__} \
-%{munderscores: -D__UNDERSCORES__} \
-%{maout: %{!mno-underscores: -D__UNDERSCORES__}} \
-%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{!m386:-D__i486__}"
-#else
-#define CPP_SPEC "\
-%{!maout: -D__ELF__} \
-%{munderscores: -D__UNDERSCORES__} \
-%{maout: %{!mno-underscores: -D__UNDERSCORES__}} \
-%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{m486:-D__i486__}"
-#endif
-
-#undef CC1_SPEC
-#define CC1_SPEC "\
-%{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \
-%{maout: %{!mno-underscores: %{!munderscores: -munderscores }}}"
-
-#undef ASM_SPEC
-#define ASM_SPEC "%{v*: -v} %{maout: %{fpic:-k} %{fPIC:-k}}"
-
-/* Like the default, except no -lg, and no -p. */
-#undef LIB_SPEC
-#define LIB_SPEC "%{!shared:%{!pg:%{!pthread:%{!kthread:-lc}%{kthread:-lpthread -lc}}%{pthread:-lc_r}}%{pg:%{!pthread:%{!kthread:-lc_p}%{kthread:-lpthread_p -lc_p}}%{pthread:-lc_r_p}}}"
-
-/* Let gcc locate this for us according to the -m rules */
-#undef LIBGCC_SPEC
-#define LIBGCC_SPEC "%{!shared:libgcc.a%s}"
-
-/* Provide a LINK_SPEC appropriate for FreeBSD. Here we provide support
- for the special GCC options -static and -shared, which allow us to
- link things in one of these three modes by applying the appropriate
- combinations of options at link-time. We like to support here for
- as many of the other GNU linker options as possible. But I don't
- have the time to search for those flags. I am sure how to add
- support for -soname shared_object_name. H.J.
-
- When the -shared link option is used a final link is not being
- done. */
-
-#undef LINK_SPEC
-#define LINK_SPEC "\
- %{p:%e`-p' not supported; use `-pg' and gprof(1)} \
- %{maout: %{shared:-Bshareable} \
- %{!shared:%{!nostdlib:%{!r:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} \
- %{pg:-Bstatic} %{Z}} \
- %{assert*} %{R*}} \
- %{!maout: \
- -m elf_i386 \
- %{Wl,*:%*} \
- %{assert*} %{R*} %{rpath*} %{defsym*} \
- %{shared:-Bshareable %{h*} %{soname*}} \
- %{symbolic:-Bsymbolic} \
- %{!shared: \
- %{!static: \
- %{rdynamic: -export-dynamic} \
- %{!dynamic-linker: -dynamic-linker /usr/libexec/ld-elf.so.1}} \
- %{static:-Bstatic}}}"
-
-/* Get perform_* macros to build libgcc.a. */
-#include "i386/perform.h"
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "\
- %{maout: %{shared:c++rt0.o%s} \
- %{!shared:%{pg:gcrt0.o%s}%{!pg:%{static:scrt0.o%s}%{!static:crt0.o%s}}}} \
- %{!maout: %{!shared: \
- %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}} \
- crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}}"
-
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC \
- "%{!maout: %{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s}"
-
-/* This goes away when the math emulator is fixed. */
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_NO_FANCY_MATH_387 | 0301)
-
-#define HAVE_ATEXIT
-#define HAVE_PUTENV
-
-/* to assist building libgcc2.c */
-#ifndef __ELF__
-#undef OBJECT_FORMAT_ELF
-#endif
diff --git a/contrib/gcc/config/t-linux b/contrib/gcc/config/t-linux
new file mode 100644
index 000000000000..843fa1bdf79d
--- /dev/null
+++ b/contrib/gcc/config/t-linux
@@ -0,0 +1,10 @@
+# Don't run fixproto
+STMP_FIXPROTO =
+
+# Don't install "assert.h" in gcc. We use the one in glibc.
+INSTALL_ASSERT_H =
+
+# Compile crtbeginS.o and crtendS.o with pic.
+CRTSTUFF_T_CFLAGS_S = -fPIC
+# Compile libgcc2.a with pic.
+TARGET_LIBGCC2_CFLAGS = -fPIC
diff --git a/contrib/gcc/config/t-linux-gnulibc1 b/contrib/gcc/config/t-linux-gnulibc1
new file mode 100644
index 000000000000..e2be684ea239
--- /dev/null
+++ b/contrib/gcc/config/t-linux-gnulibc1
@@ -0,0 +1,13 @@
+# We are building for the Linux C library 5.
+T_CFLAGS = -DUSE_GNULIBC_1
+
+# Don't run fixproto
+STMP_FIXPROTO =
+
+# Don't install "assert.h" in gcc. We use the one in glibc.
+INSTALL_ASSERT_H =
+
+# Compile crtbeginS.o and crtendS.o with pic.
+CRTSTUFF_T_CFLAGS_S = -fPIC
+# Compile libgcc2.a with pic.
+TARGET_LIBGCC2_CFLAGS = -fPIC
diff --git a/contrib/gdb/gdb/29k-share/README b/contrib/gdb/gdb/29k-share/README
new file mode 100644
index 000000000000..5e19715ffad4
--- /dev/null
+++ b/contrib/gdb/gdb/29k-share/README
@@ -0,0 +1,9 @@
+The files in this directory are shared with other debuggers and
+debug interfaces that use Advanced Micro Devices' UDI (universal debug
+interface) protocol. The protocol provides a common interface among
+debuggers, logic analyzers, emulators, and embedded systems that use
+AMD 29000 family processors.
+
+Do not change these files without coordinating with Advanced Micro
+Devices, Embedded Processor Division, 5204 E. Ben White Blvd, Austin, TX 78741.
+Maybe postmaster@cayman.amd.com can direct you to the current maintainers.
diff --git a/contrib/gdb/gdb/29k-share/udi_soc b/contrib/gdb/gdb/29k-share/udi_soc
new file mode 100644
index 000000000000..343317f255fc
--- /dev/null
+++ b/contrib/gdb/gdb/29k-share/udi_soc
@@ -0,0 +1,9 @@
+# @(#)udi_soc 2.1 Daniel Mann
+# NOTE: the Session string must not start whith white-space characters.
+# Format of string is:
+# <session> <domain> <soc_name|host_name> <tip_exe> <pass to UDIconnect>
+soc2cayman AF_INET cayman /bin/udi_tip ...
+soc2tip AF_UNIX astring tip.exe ...
+cuba AF_UNIX soc_name ../bin.68020/udi_tip stuff to pass
+cayman AF_INET cayman this_entry_not_matter stuff to pass
+iss AF_UNIX * sun4/isstip -r osboot
diff --git a/contrib/gdb/gdb/config/mips/tm-tx39.h b/contrib/gdb/gdb/config/mips/tm-tx39.h
new file mode 100644
index 000000000000..ee99a2822590
--- /dev/null
+++ b/contrib/gdb/gdb/config/mips/tm-tx39.h
@@ -0,0 +1,39 @@
+/* Copyright (C) 1993 Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+This program 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#define TARGET_BYTE_ORDER_SELECTABLE_P 1
+#define MIPS_EABI 1
+#define MIPS_DEFAULT_FPU_TYPE MIPS_FPU_NONE
+
+#include "mips/tm-bigmips.h"
+
+#undef REGISTER_NAMES
+#define REGISTER_NAMES \
+ { "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", \
+ "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", \
+ "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", \
+ "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra", \
+ "sr", "lo", "hi", "bad", "cause","pc", \
+ "", "", "", "", "", "", "", "", \
+ "", "", "", "", "", "", "", "", \
+ "", "", "", "", "", "", "", "", \
+ "", "", "", "", "", "", "", "", \
+ "", "", "", "", \
+ "", "", "", "", "", "", "", "", \
+ "", "", "config", "cache", "debug", "depc", "epc", "" \
+ }
diff --git a/contrib/gdb/gdb/config/mips/tm-tx39l.h b/contrib/gdb/gdb/config/mips/tm-tx39l.h
new file mode 100644
index 000000000000..8ceec7296eae
--- /dev/null
+++ b/contrib/gdb/gdb/config/mips/tm-tx39l.h
@@ -0,0 +1,39 @@
+/* Copyright (C) 1993 Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+This program 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#define TARGET_BYTE_ORDER_SELECTABLE_P 1
+#define MIPS_EABI 1
+#define MIPS_DEFAULT_FPU_TYPE MIPS_FPU_NONE
+
+#include "mips/tm-mips.h"
+
+#undef REGISTER_NAMES
+#define REGISTER_NAMES \
+ { "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", \
+ "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", \
+ "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", \
+ "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra", \
+ "sr", "lo", "hi", "bad", "cause","pc", \
+ "", "", "", "", "", "", "", "", \
+ "", "", "", "", "", "", "", "", \
+ "", "", "", "", "", "", "", "", \
+ "", "", "", "", "", "", "", "", \
+ "", "", "", "", \
+ "", "", "", "", "", "", "", "", \
+ "", "", "config", "cache", "debug", "depc", "epc", "" \
+ }
diff --git a/contrib/gdb/gdb/config/mips/tm-vr4100.h b/contrib/gdb/gdb/config/mips/tm-vr4100.h
new file mode 100644
index 000000000000..843f49c2222d
--- /dev/null
+++ b/contrib/gdb/gdb/config/mips/tm-vr4100.h
@@ -0,0 +1,25 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+This program 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#define TARGET_BYTE_ORDER_SELECTABLE_P 1
+#define MIPS_EABI 1
+#define MIPS_DEFAULT_FPU_TYPE MIPS_FPU_NONE
+#define TARGET_MONITOR_PROMPT "<RISQ> "
+#define TARGET_PTR_BIT 64
+
+#include "mips/tm-bigmips64.h"
diff --git a/contrib/gdb/gdb/config/mips/tm-vr5000.h b/contrib/gdb/gdb/config/mips/tm-vr5000.h
new file mode 100644
index 000000000000..b834a7762fc8
--- /dev/null
+++ b/contrib/gdb/gdb/config/mips/tm-vr5000.h
@@ -0,0 +1,23 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+This program 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#define TARGET_BYTE_ORDER_SELECTABLE_P 1
+#define TARGET_MONITOR_PROMPT "<RISQ> "
+#define MIPS_EABI 1
+
+#include "mips/tm-bigmips64.h"
diff --git a/contrib/gdb/gdb/config/mips/tm-vr5000el.h b/contrib/gdb/gdb/config/mips/tm-vr5000el.h
new file mode 100644
index 000000000000..c6897d12ee1d
--- /dev/null
+++ b/contrib/gdb/gdb/config/mips/tm-vr5000el.h
@@ -0,0 +1,23 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+This program 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#define TARGET_BYTE_ORDER_SELECTABLE_P 1
+#define TARGET_MONITOR_PROMPT "<RISQ> "
+#define MIPS_EABI 1
+
+#include "mips/tm-mips64.h"
diff --git a/contrib/gdb/gdb/config/mips/tx39.mt b/contrib/gdb/gdb/config/mips/tx39.mt
new file mode 100644
index 000000000000..8b4c1a92c244
--- /dev/null
+++ b/contrib/gdb/gdb/config/mips/tx39.mt
@@ -0,0 +1,5 @@
+# Target: Big-endian mips board, typically an IDT.
+TDEPFILES= mips-tdep.o remote-mips.o dve3900-rom.o monitor.o dsrec.o
+TM_FILE= tm-tx39.h
+SIM_OBS = remote-sim.o
+SIM = ../sim/mips/libsim.a
diff --git a/contrib/gdb/gdb/config/mips/tx39l.mt b/contrib/gdb/gdb/config/mips/tx39l.mt
new file mode 100644
index 000000000000..35083293d458
--- /dev/null
+++ b/contrib/gdb/gdb/config/mips/tx39l.mt
@@ -0,0 +1,5 @@
+# Target: Big-endian mips board, typically an IDT.
+TDEPFILES= mips-tdep.o remote-mips.o dve3900-rom.o monitor.o dsrec.o
+TM_FILE= tm-tx39l.h
+SIM_OBS = remote-sim.o
+SIM = ../sim/mips/libsim.a
diff --git a/contrib/gdb/gdb/config/mips/vr4100.mt b/contrib/gdb/gdb/config/mips/vr4100.mt
new file mode 100644
index 000000000000..c5ae4f94a6dd
--- /dev/null
+++ b/contrib/gdb/gdb/config/mips/vr4100.mt
@@ -0,0 +1,5 @@
+# Target: Big-endian SIM monitor board.
+TDEPFILES= mips-tdep.o remote-mips.o
+TM_FILE= tm-vr4100.h
+SIM_OBS = remote-sim.o
+SIM = ../sim/mips/libsim.a
diff --git a/contrib/gdb/gdb/config/mips/vr5000.mt b/contrib/gdb/gdb/config/mips/vr5000.mt
new file mode 100644
index 000000000000..316c548de093
--- /dev/null
+++ b/contrib/gdb/gdb/config/mips/vr5000.mt
@@ -0,0 +1,7 @@
+# Target: Big-endian SIM monitor board.
+TDEPFILES= mips-tdep.o remote-mips.o
+TM_FILE= tm-vr5000.h
+SIM_OBS = remote-sim.o
+SIM = ../sim/mips/libsim.a
+GDBSERVER_DEPFILES= low-sim.o
+GDBSERVER_LIBS = ../../sim/mips/libsim.a ../../bfd/libbfd.a ../../libiberty/libiberty.a -lm
diff --git a/contrib/gdb/gdb/config/mips/vr5000el.mt b/contrib/gdb/gdb/config/mips/vr5000el.mt
new file mode 100644
index 000000000000..99687edcefc2
--- /dev/null
+++ b/contrib/gdb/gdb/config/mips/vr5000el.mt
@@ -0,0 +1,5 @@
+# Target: Little-endian SIM monitor board.
+TDEPFILES= mips-tdep.o remote-mips.o
+TM_FILE= tm-vr5000el.h
+SIM_OBS = remote-sim.o
+SIM = ../sim/mips/libsim.a
diff --git a/contrib/gdb/gdb/d10v-tdep.c b/contrib/gdb/gdb/d10v-tdep.c
new file mode 100644
index 000000000000..f4b52f62295b
--- /dev/null
+++ b/contrib/gdb/gdb/d10v-tdep.c
@@ -0,0 +1,1028 @@
+/* Target-dependent code for Mitsubishi D10V, for GDB.
+ Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+This program 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+/* Contributed by Martin Hunt, hunt@cygnus.com */
+
+#include "defs.h"
+#include "frame.h"
+#include "obstack.h"
+#include "symtab.h"
+#include "gdbtypes.h"
+#include "gdbcmd.h"
+#include "gdbcore.h"
+#include "gdb_string.h"
+#include "value.h"
+#include "inferior.h"
+#include "dis-asm.h"
+#include "symfile.h"
+#include "objfiles.h"
+
+void d10v_frame_find_saved_regs PARAMS ((struct frame_info *fi,
+ struct frame_saved_regs *fsr));
+
+int
+d10v_frame_chain_valid (chain, frame)
+ CORE_ADDR chain;
+ struct frame_info *frame; /* not used here */
+{
+ return ((chain) != 0 && (frame) != 0 && (frame)->pc > IMEM_START);
+}
+
+
+/* Should we use EXTRACT_STRUCT_VALUE_ADDRESS instead of
+ EXTRACT_RETURN_VALUE? GCC_P is true if compiled with gcc
+ and TYPE is the type (which is known to be struct, union or array).
+
+ The d10v returns anything less than 8 bytes in size in
+ registers. */
+
+int
+d10v_use_struct_convention (gcc_p, type)
+ int gcc_p;
+ struct type *type;
+{
+ return (TYPE_LENGTH (type) > 8);
+}
+
+
+/* Discard from the stack the innermost frame, restoring all saved
+ registers. */
+
+void
+d10v_pop_frame (frame)
+ struct frame_info *frame;
+{
+ CORE_ADDR fp;
+ int regnum;
+ struct frame_saved_regs fsr;
+ char raw_buffer[8];
+
+ fp = FRAME_FP (frame);
+ /* fill out fsr with the address of where each */
+ /* register was stored in the frame */
+ get_frame_saved_regs (frame, &fsr);
+
+ /* now update the current registers with the old values */
+ for (regnum = A0_REGNUM; regnum < A0_REGNUM+2 ; regnum++)
+ {
+ if (fsr.regs[regnum])
+ {
+ read_memory (fsr.regs[regnum], raw_buffer, REGISTER_RAW_SIZE(regnum));
+ write_register_bytes (REGISTER_BYTE (regnum), raw_buffer, REGISTER_RAW_SIZE(regnum));
+ }
+ }
+ for (regnum = 0; regnum < SP_REGNUM; regnum++)
+ {
+ if (fsr.regs[regnum])
+ {
+ write_register (regnum, read_memory_unsigned_integer (fsr.regs[regnum], REGISTER_RAW_SIZE(regnum)));
+ }
+ }
+ if (fsr.regs[PSW_REGNUM])
+ {
+ write_register (PSW_REGNUM, read_memory_unsigned_integer (fsr.regs[PSW_REGNUM], REGISTER_RAW_SIZE(PSW_REGNUM)));
+ }
+
+ write_register (PC_REGNUM, read_register (LR_REGNUM));
+ write_register (SP_REGNUM, fp + frame->size);
+ target_store_registers (-1);
+ flush_cached_frames ();
+}
+
+static int
+check_prologue (op)
+ unsigned short op;
+{
+ /* st rn, @-sp */
+ if ((op & 0x7E1F) == 0x6C1F)
+ return 1;
+
+ /* st2w rn, @-sp */
+ if ((op & 0x7E3F) == 0x6E1F)
+ return 1;
+
+ /* subi sp, n */
+ if ((op & 0x7FE1) == 0x01E1)
+ return 1;
+
+ /* mv r11, sp */
+ if (op == 0x417E)
+ return 1;
+
+ /* nop */
+ if (op == 0x5E00)
+ return 1;
+
+ /* st rn, @sp */
+ if ((op & 0x7E1F) == 0x681E)
+ return 1;
+
+ /* st2w rn, @sp */
+ if ((op & 0x7E3F) == 0x3A1E)
+ return 1;
+
+ return 0;
+}
+
+CORE_ADDR
+d10v_skip_prologue (pc)
+ CORE_ADDR pc;
+{
+ unsigned long op;
+ unsigned short op1, op2;
+ CORE_ADDR func_addr, func_end;
+ struct symtab_and_line sal;
+
+ /* If we have line debugging information, then the end of the */
+ /* prologue should the first assembly instruction of the first source line */
+ if (find_pc_partial_function (pc, NULL, &func_addr, &func_end))
+ {
+ sal = find_pc_line (func_addr, 0);
+ if ( sal.end && sal.end < func_end)
+ return sal.end;
+ }
+
+ if (target_read_memory (pc, (char *)&op, 4))
+ return pc; /* Can't access it -- assume no prologue. */
+
+ while (1)
+ {
+ op = (unsigned long)read_memory_integer (pc, 4);
+ if ((op & 0xC0000000) == 0xC0000000)
+ {
+ /* long instruction */
+ if ( ((op & 0x3FFF0000) != 0x01FF0000) && /* add3 sp,sp,n */
+ ((op & 0x3F0F0000) != 0x340F0000) && /* st rn, @(offset,sp) */
+ ((op & 0x3F1F0000) != 0x350F0000)) /* st2w rn, @(offset,sp) */
+ break;
+ }
+ else
+ {
+ /* short instructions */
+ if ((op & 0xC0000000) == 0x80000000)
+ {
+ op2 = (op & 0x3FFF8000) >> 15;
+ op1 = op & 0x7FFF;
+ }
+ else
+ {
+ op1 = (op & 0x3FFF8000) >> 15;
+ op2 = op & 0x7FFF;
+ }
+ if (check_prologue(op1))
+ {
+ if (!check_prologue(op2))
+ {
+ /* if the previous opcode was really part of the prologue */
+ /* and not just a NOP, then we want to break after both instructions */
+ if (op1 != 0x5E00)
+ pc += 4;
+ break;
+ }
+ }
+ else
+ break;
+ }
+ pc += 4;
+ }
+ return pc;
+}
+
+/* Given a GDB frame, determine the address of the calling function's frame.
+ This will be used to create a new GDB frame struct, and then
+ INIT_EXTRA_FRAME_INFO and INIT_FRAME_PC will be called for the new frame.
+*/
+
+CORE_ADDR
+d10v_frame_chain (frame)
+ struct frame_info *frame;
+{
+ struct frame_saved_regs fsr;
+
+ d10v_frame_find_saved_regs (frame, &fsr);
+
+ if (frame->return_pc == IMEM_START || inside_entry_file(frame->return_pc))
+ return (CORE_ADDR)0;
+
+ if (!fsr.regs[FP_REGNUM])
+ {
+ if (!fsr.regs[SP_REGNUM] || fsr.regs[SP_REGNUM] == STACK_START)
+ return (CORE_ADDR)0;
+
+ return fsr.regs[SP_REGNUM];
+ }
+
+ if (!read_memory_unsigned_integer(fsr.regs[FP_REGNUM], REGISTER_RAW_SIZE(FP_REGNUM)))
+ return (CORE_ADDR)0;
+
+ return D10V_MAKE_DADDR (read_memory_unsigned_integer (fsr.regs[FP_REGNUM], REGISTER_RAW_SIZE (FP_REGNUM)));
+}
+
+static int next_addr, uses_frame;
+
+static int
+prologue_find_regs (op, fsr, addr)
+ unsigned short op;
+ struct frame_saved_regs *fsr;
+ CORE_ADDR addr;
+{
+ int n;
+
+ /* st rn, @-sp */
+ if ((op & 0x7E1F) == 0x6C1F)
+ {
+ n = (op & 0x1E0) >> 5;
+ next_addr -= 2;
+ fsr->regs[n] = next_addr;
+ return 1;
+ }
+
+ /* st2w rn, @-sp */
+ else if ((op & 0x7E3F) == 0x6E1F)
+ {
+ n = (op & 0x1E0) >> 5;
+ next_addr -= 4;
+ fsr->regs[n] = next_addr;
+ fsr->regs[n+1] = next_addr+2;
+ return 1;
+ }
+
+ /* subi sp, n */
+ if ((op & 0x7FE1) == 0x01E1)
+ {
+ n = (op & 0x1E) >> 1;
+ if (n == 0)
+ n = 16;
+ next_addr -= n;
+ return 1;
+ }
+
+ /* mv r11, sp */
+ if (op == 0x417E)
+ {
+ uses_frame = 1;
+ return 1;
+ }
+
+ /* nop */
+ if (op == 0x5E00)
+ return 1;
+
+ /* st rn, @sp */
+ if ((op & 0x7E1F) == 0x681E)
+ {
+ n = (op & 0x1E0) >> 5;
+ fsr->regs[n] = next_addr;
+ return 1;
+ }
+
+ /* st2w rn, @sp */
+ if ((op & 0x7E3F) == 0x3A1E)
+ {
+ n = (op & 0x1E0) >> 5;
+ fsr->regs[n] = next_addr;
+ fsr->regs[n+1] = next_addr+2;
+ return 1;
+ }
+
+ return 0;
+}
+
+/* Put here the code to store, into a struct frame_saved_regs, the
+ addresses of the saved registers of frame described by FRAME_INFO.
+ This includes special registers such as pc and fp saved in special
+ ways in the stack frame. sp is even more special: the address we
+ return for it IS the sp for the next frame. */
+void
+d10v_frame_find_saved_regs (fi, fsr)
+ struct frame_info *fi;
+ struct frame_saved_regs *fsr;
+{
+ CORE_ADDR fp, pc;
+ unsigned long op;
+ unsigned short op1, op2;
+ int i;
+
+ fp = fi->frame;
+ memset (fsr, 0, sizeof (*fsr));
+ next_addr = 0;
+
+ pc = get_pc_function_start (fi->pc);
+
+ uses_frame = 0;
+ while (1)
+ {
+ op = (unsigned long)read_memory_integer (pc, 4);
+ if ((op & 0xC0000000) == 0xC0000000)
+ {
+ /* long instruction */
+ if ((op & 0x3FFF0000) == 0x01FF0000)
+ {
+ /* add3 sp,sp,n */
+ short n = op & 0xFFFF;
+ next_addr += n;
+ }
+ else if ((op & 0x3F0F0000) == 0x340F0000)
+ {
+ /* st rn, @(offset,sp) */
+ short offset = op & 0xFFFF;
+ short n = (op >> 20) & 0xF;
+ fsr->regs[n] = next_addr + offset;
+ }
+ else if ((op & 0x3F1F0000) == 0x350F0000)
+ {
+ /* st2w rn, @(offset,sp) */
+ short offset = op & 0xFFFF;
+ short n = (op >> 20) & 0xF;
+ fsr->regs[n] = next_addr + offset;
+ fsr->regs[n+1] = next_addr + offset + 2;
+ }
+ else
+ break;
+ }
+ else
+ {
+ /* short instructions */
+ if ((op & 0xC0000000) == 0x80000000)
+ {
+ op2 = (op & 0x3FFF8000) >> 15;
+ op1 = op & 0x7FFF;
+ }
+ else
+ {
+ op1 = (op & 0x3FFF8000) >> 15;
+ op2 = op & 0x7FFF;
+ }
+ if (!prologue_find_regs(op1,fsr,pc) || !prologue_find_regs(op2,fsr,pc))
+ break;
+ }
+ pc += 4;
+ }
+
+ fi->size = -next_addr;
+
+ if (!(fp & 0xffff))
+ fp = D10V_MAKE_DADDR (read_register(SP_REGNUM));
+
+ for (i=0; i<NUM_REGS-1; i++)
+ if (fsr->regs[i])
+ {
+ fsr->regs[i] = fp - (next_addr - fsr->regs[i]);
+ }
+
+ if (fsr->regs[LR_REGNUM])
+ {
+ CORE_ADDR return_pc = read_memory_unsigned_integer (fsr->regs[LR_REGNUM], REGISTER_RAW_SIZE (LR_REGNUM));
+ fi->return_pc = D10V_MAKE_IADDR (return_pc);
+ }
+ else
+ {
+ fi->return_pc = D10V_MAKE_IADDR (read_register(LR_REGNUM));
+ }
+
+ /* th SP is not normally (ever?) saved, but check anyway */
+ if (!fsr->regs[SP_REGNUM])
+ {
+ /* if the FP was saved, that means the current FP is valid, */
+ /* otherwise, it isn't being used, so we use the SP instead */
+ if (uses_frame)
+ fsr->regs[SP_REGNUM] = read_register(FP_REGNUM) + fi->size;
+ else
+ {
+ fsr->regs[SP_REGNUM] = fp + fi->size;
+ fi->frameless = 1;
+ fsr->regs[FP_REGNUM] = 0;
+ }
+ }
+}
+
+void
+d10v_init_extra_frame_info (fromleaf, fi)
+ int fromleaf;
+ struct frame_info *fi;
+{
+ fi->frameless = 0;
+ fi->size = 0;
+ fi->return_pc = 0;
+
+ /* The call dummy doesn't save any registers on the stack, so we can
+ return now. */
+ if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
+ {
+ return;
+ }
+ else
+ {
+ struct frame_saved_regs dummy;
+ d10v_frame_find_saved_regs (fi, &dummy);
+ }
+}
+
+static void
+show_regs (args, from_tty)
+ char *args;
+ int from_tty;
+{
+ int a;
+ printf_filtered ("PC=%04x (0x%x) PSW=%04x RPT_S=%04x RPT_E=%04x RPT_C=%04x\n",
+ read_register (PC_REGNUM), D10V_MAKE_IADDR (read_register (PC_REGNUM)),
+ read_register (PSW_REGNUM),
+ read_register (24),
+ read_register (25),
+ read_register (23));
+ printf_filtered ("R0-R7 %04x %04x %04x %04x %04x %04x %04x %04x\n",
+ read_register (0),
+ read_register (1),
+ read_register (2),
+ read_register (3),
+ read_register (4),
+ read_register (5),
+ read_register (6),
+ read_register (7));
+ printf_filtered ("R8-R15 %04x %04x %04x %04x %04x %04x %04x %04x\n",
+ read_register (8),
+ read_register (9),
+ read_register (10),
+ read_register (11),
+ read_register (12),
+ read_register (13),
+ read_register (14),
+ read_register (15));
+ printf_filtered ("IMAP0 %04x IMAP1 %04x DMAP %04x\n",
+ read_register (IMAP0_REGNUM),
+ read_register (IMAP1_REGNUM),
+ read_register (DMAP_REGNUM));
+ printf_filtered ("A0-A1");
+ for (a = A0_REGNUM; a <= A0_REGNUM + 1; a++)
+ {
+ char num[MAX_REGISTER_RAW_SIZE];
+ int i;
+ printf_filtered (" ");
+ read_register_gen (a, (char *)&num);
+ for (i = 0; i < MAX_REGISTER_RAW_SIZE; i++)
+ {
+ printf_filtered ("%02x", (num[i] & 0xff));
+ }
+ }
+ printf_filtered ("\n");
+}
+
+CORE_ADDR
+d10v_read_pc (pid)
+ int pid;
+{
+ int save_pid;
+ CORE_ADDR pc;
+ CORE_ADDR retval;
+
+ save_pid = inferior_pid;
+ inferior_pid = pid;
+ pc = (int) read_register (PC_REGNUM);
+ inferior_pid = save_pid;
+ retval = D10V_MAKE_IADDR (pc);
+ return retval;
+}
+
+void
+d10v_write_pc (val, pid)
+ CORE_ADDR val;
+ int pid;
+{
+ int save_pid;
+
+ save_pid = inferior_pid;
+ inferior_pid = pid;
+ write_register (PC_REGNUM, D10V_CONVERT_IADDR_TO_RAW (val));
+ inferior_pid = save_pid;
+}
+
+CORE_ADDR
+d10v_read_sp ()
+{
+ return (D10V_MAKE_DADDR (read_register (SP_REGNUM)));
+}
+
+void
+d10v_write_sp (val)
+ CORE_ADDR val;
+{
+ write_register (SP_REGNUM, D10V_CONVERT_DADDR_TO_RAW (val));
+}
+
+void
+d10v_write_fp (val)
+ CORE_ADDR val;
+{
+ write_register (FP_REGNUM, D10V_CONVERT_DADDR_TO_RAW (val));
+}
+
+CORE_ADDR
+d10v_read_fp ()
+{
+ return (D10V_MAKE_DADDR (read_register(FP_REGNUM)));
+}
+
+/* Function: push_return_address (pc)
+ Set up the return address for the inferior function call.
+ Needed for targets where we don't actually execute a JSR/BSR instruction */
+
+CORE_ADDR
+d10v_push_return_address (pc, sp)
+ CORE_ADDR pc;
+ CORE_ADDR sp;
+{
+ write_register (LR_REGNUM, D10V_CONVERT_IADDR_TO_RAW (CALL_DUMMY_ADDRESS ()));
+ return sp;
+}
+
+
+CORE_ADDR
+d10v_push_arguments (nargs, args, sp, struct_return, struct_addr)
+ int nargs;
+ value_ptr *args;
+ CORE_ADDR sp;
+ int struct_return;
+ CORE_ADDR struct_addr;
+{
+ int i;
+ int regnum = ARG1_REGNUM;
+
+ /* Fill in registers and arg lists */
+ for (i = 0; i < nargs; i++)
+ {
+ value_ptr arg = args[i];
+ struct type *type = check_typedef (VALUE_TYPE (arg));
+ char *contents = VALUE_CONTENTS (arg);
+ int len = TYPE_LENGTH (type);
+ /* printf ("push: type=%d len=%d\n", type->code, len); */
+ if (TYPE_CODE (type) == TYPE_CODE_PTR)
+ {
+ /* pointers require special handling - first convert and
+ then store */
+ long val = extract_signed_integer (contents, len);
+ len = 2;
+ if (TYPE_TARGET_TYPE (type)
+ && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC))
+ {
+ /* function pointer */
+ val = D10V_CONVERT_IADDR_TO_RAW (val);
+ }
+ else if (D10V_IADDR_P (val))
+ {
+ /* also function pointer! */
+ val = D10V_CONVERT_DADDR_TO_RAW (val);
+ }
+ else
+ {
+ /* data pointer */
+ val &= 0xFFFF;
+ }
+ if (regnum <= ARGN_REGNUM)
+ write_register (regnum++, val & 0xffff);
+ else
+ {
+ char ptr[2];
+ sp -= 2;
+ store_address (ptr, val & 0xffff, 2);
+ write_memory (sp, ptr, 2);
+ }
+ }
+ else
+ {
+ int aligned_regnum = (regnum + 1) & ~1;
+ if (len <= 2 && regnum <= ARGN_REGNUM)
+ /* fits in a single register, do not align */
+ {
+ long val = extract_unsigned_integer (contents, len);
+ write_register (regnum++, val);
+ }
+ else if (len <= (ARGN_REGNUM - aligned_regnum + 1) * 2)
+ /* value fits in remaining registers, store keeping left
+ aligned */
+ {
+ int b;
+ regnum = aligned_regnum;
+ for (b = 0; b < (len & ~1); b += 2)
+ {
+ long val = extract_unsigned_integer (&contents[b], 2);
+ write_register (regnum++, val);
+ }
+ if (b < len)
+ {
+ long val = extract_unsigned_integer (&contents[b], 1);
+ write_register (regnum++, (val << 8));
+ }
+ }
+ else
+ {
+ /* arg goes straight on stack */
+ regnum = ARGN_REGNUM + 1;
+ sp = (sp - len) & ~1;
+ write_memory (sp, contents, len);
+ }
+ }
+ }
+ return sp;
+}
+
+
+/* Given a return value in `regbuf' with a type `valtype',
+ extract and copy its value into `valbuf'. */
+
+void
+d10v_extract_return_value (type, regbuf, valbuf)
+ struct type *type;
+ char regbuf[REGISTER_BYTES];
+ char *valbuf;
+{
+ int len;
+ /* printf("RET: TYPE=%d len=%d r%d=0x%x\n",type->code, TYPE_LENGTH (type), RET1_REGNUM - R0_REGNUM, (int) extract_unsigned_integer (regbuf + REGISTER_BYTE(RET1_REGNUM), REGISTER_RAW_SIZE (RET1_REGNUM))); */
+ if (TYPE_CODE (type) == TYPE_CODE_PTR
+ && TYPE_TARGET_TYPE (type)
+ && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC))
+ {
+ /* pointer to function */
+ int num;
+ short snum;
+ snum = extract_address (regbuf + REGISTER_BYTE (RET1_REGNUM), REGISTER_RAW_SIZE (RET1_REGNUM));
+ store_address ( valbuf, 4, D10V_MAKE_IADDR(snum));
+ }
+ else if (TYPE_CODE(type) == TYPE_CODE_PTR)
+ {
+ /* pointer to data */
+ int num;
+ short snum;
+ snum = extract_address (regbuf + REGISTER_BYTE (RET1_REGNUM), REGISTER_RAW_SIZE (RET1_REGNUM));
+ store_address ( valbuf, 4, D10V_MAKE_DADDR(snum));
+ }
+ else
+ {
+ len = TYPE_LENGTH (type);
+ if (len == 1)
+ {
+ unsigned short c = extract_unsigned_integer (regbuf + REGISTER_BYTE (RET1_REGNUM), REGISTER_RAW_SIZE (RET1_REGNUM));
+ store_unsigned_integer (valbuf, 1, c);
+ }
+ else if ((len & 1) == 0)
+ memcpy (valbuf, regbuf + REGISTER_BYTE (RET1_REGNUM), len);
+ else
+ {
+ /* For return values of odd size, the first byte is in the
+ least significant part of the first register. The
+ remaining bytes in remaining registers. Interestingly,
+ when such values are passed in, the last byte is in the
+ most significant byte of that same register - wierd. */
+ memcpy (valbuf, regbuf + REGISTER_BYTE (RET1_REGNUM) + 1, len);
+ }
+ }
+}
+
+/* The following code implements access to, and display of, the D10V's
+ instruction trace buffer. The buffer consists of 64K or more
+ 4-byte words of data, of which each words includes an 8-bit count,
+ an 8-bit segment number, and a 16-bit instruction address.
+
+ In theory, the trace buffer is continuously capturing instruction
+ data that the CPU presents on its "debug bus", but in practice, the
+ ROMified GDB stub only enables tracing when it continues or steps
+ the program, and stops tracing when the program stops; so it
+ actually works for GDB to read the buffer counter out of memory and
+ then read each trace word. The counter records where the tracing
+ stops, but there is no record of where it started, so we remember
+ the PC when we resumed and then search backwards in the trace
+ buffer for a word that includes that address. This is not perfect,
+ because you will miss trace data if the resumption PC is the target
+ of a branch. (The value of the buffer counter is semi-random, any
+ trace data from a previous program stop is gone.) */
+
+/* The address of the last word recorded in the trace buffer. */
+
+#define DBBC_ADDR (0xd80000)
+
+/* The base of the trace buffer, at least for the "Board_0". */
+
+#define TRACE_BUFFER_BASE (0xf40000)
+
+static void trace_command PARAMS ((char *, int));
+
+static void untrace_command PARAMS ((char *, int));
+
+static void trace_info PARAMS ((char *, int));
+
+static void tdisassemble_command PARAMS ((char *, int));
+
+static void display_trace PARAMS ((int, int));
+
+/* True when instruction traces are being collected. */
+
+static int tracing;
+
+/* Remembered PC. */
+
+static CORE_ADDR last_pc;
+
+/* True when trace output should be displayed whenever program stops. */
+
+static int trace_display;
+
+/* True when trace listing should include source lines. */
+
+static int default_trace_show_source = 1;
+
+struct trace_buffer {
+ int size;
+ short *counts;
+ CORE_ADDR *addrs;
+} trace_data;
+
+static void
+trace_command (args, from_tty)
+ char *args;
+ int from_tty;
+{
+ /* Clear the host-side trace buffer, allocating space if needed. */
+ trace_data.size = 0;
+ if (trace_data.counts == NULL)
+ trace_data.counts = (short *) xmalloc (65536 * sizeof(short));
+ if (trace_data.addrs == NULL)
+ trace_data.addrs = (CORE_ADDR *) xmalloc (65536 * sizeof(CORE_ADDR));
+
+ tracing = 1;
+
+ printf_filtered ("Tracing is now on.\n");
+}
+
+static void
+untrace_command (args, from_tty)
+ char *args;
+ int from_tty;
+{
+ tracing = 0;
+
+ printf_filtered ("Tracing is now off.\n");
+}
+
+static void
+trace_info (args, from_tty)
+ char *args;
+ int from_tty;
+{
+ int i;
+
+ if (trace_data.size)
+ {
+ printf_filtered ("%d entries in trace buffer:\n", trace_data.size);
+
+ for (i = 0; i < trace_data.size; ++i)
+ {
+ printf_filtered ("%d: %d instruction%s at 0x%x\n",
+ i, trace_data.counts[i],
+ (trace_data.counts[i] == 1 ? "" : "s"),
+ trace_data.addrs[i]);
+ }
+ }
+ else
+ printf_filtered ("No entries in trace buffer.\n");
+
+ printf_filtered ("Tracing is currently %s.\n", (tracing ? "on" : "off"));
+}
+
+/* Print the instruction at address MEMADDR in debugged memory,
+ on STREAM. Returns length of the instruction, in bytes. */
+
+static int
+print_insn (memaddr, stream)
+ CORE_ADDR memaddr;
+ GDB_FILE *stream;
+{
+ /* If there's no disassembler, something is very wrong. */
+ if (tm_print_insn == NULL)
+ abort ();
+
+ if (TARGET_BYTE_ORDER == BIG_ENDIAN)
+ tm_print_insn_info.endian = BFD_ENDIAN_BIG;
+ else
+ tm_print_insn_info.endian = BFD_ENDIAN_LITTLE;
+ return (*tm_print_insn) (memaddr, &tm_print_insn_info);
+}
+
+void
+d10v_eva_prepare_to_trace ()
+{
+ if (!tracing)
+ return;
+
+ last_pc = read_register (PC_REGNUM);
+}
+
+/* Collect trace data from the target board and format it into a form
+ more useful for display. */
+
+void
+d10v_eva_get_trace_data ()
+{
+ int count, i, j, oldsize;
+ int trace_addr, trace_seg, trace_cnt, next_cnt;
+ unsigned int last_trace, trace_word, next_word;
+ unsigned int *tmpspace;
+
+ if (!tracing)
+ return;
+
+ tmpspace = xmalloc (65536 * sizeof(unsigned int));
+
+ last_trace = read_memory_unsigned_integer (DBBC_ADDR, 2) << 2;
+
+ /* Collect buffer contents from the target, stopping when we reach
+ the word recorded when execution resumed. */
+
+ count = 0;
+ while (last_trace > 0)
+ {
+ QUIT;
+ trace_word =
+ read_memory_unsigned_integer (TRACE_BUFFER_BASE + last_trace, 4);
+ trace_addr = trace_word & 0xffff;
+ last_trace -= 4;
+ /* Ignore an apparently nonsensical entry. */
+ if (trace_addr == 0xffd5)
+ continue;
+ tmpspace[count++] = trace_word;
+ if (trace_addr == last_pc)
+ break;
+ if (count > 65535)
+ break;
+ }
+
+ /* Move the data to the host-side trace buffer, adjusting counts to
+ include the last instruction executed and transforming the address
+ into something that GDB likes. */
+
+ for (i = 0; i < count; ++i)
+ {
+ trace_word = tmpspace[i];
+ next_word = ((i == 0) ? 0 : tmpspace[i - 1]);
+ trace_addr = trace_word & 0xffff;
+ next_cnt = (next_word >> 24) & 0xff;
+ j = trace_data.size + count - i - 1;
+ trace_data.addrs[j] = (trace_addr << 2) + 0x1000000;
+ trace_data.counts[j] = next_cnt + 1;
+ }
+
+ oldsize = trace_data.size;
+ trace_data.size += count;
+
+ free (tmpspace);
+
+ if (trace_display)
+ display_trace (oldsize, trace_data.size);
+}
+
+static void
+tdisassemble_command (arg, from_tty)
+ char *arg;
+ int from_tty;
+{
+ int i, count;
+ CORE_ADDR low, high;
+ char *space_index;
+
+ if (!arg)
+ {
+ low = 0;
+ high = trace_data.size;
+ }
+ else if (!(space_index = (char *) strchr (arg, ' ')))
+ {
+ low = parse_and_eval_address (arg);
+ high = low + 5;
+ }
+ else
+ {
+ /* Two arguments. */
+ *space_index = '\0';
+ low = parse_and_eval_address (arg);
+ high = parse_and_eval_address (space_index + 1);
+ if (high < low)
+ high = low;
+ }
+
+ printf_filtered ("Dump of trace from %d to %d:\n", low, high);
+
+ display_trace (low, high);
+
+ printf_filtered ("End of trace dump.\n");
+ gdb_flush (gdb_stdout);
+}
+
+static void
+display_trace (low, high)
+ int low, high;
+{
+ int i, count, trace_show_source, first, suppress;
+ CORE_ADDR next_address;
+
+ trace_show_source = default_trace_show_source;
+ if (!have_full_symbols () && !have_partial_symbols())
+ {
+ trace_show_source = 0;
+ printf_filtered ("No symbol table is loaded. Use the \"file\" command.\n");
+ printf_filtered ("Trace will not display any source.\n");
+ }
+
+ first = 1;
+ suppress = 0;
+ for (i = low; i < high; ++i)
+ {
+ next_address = trace_data.addrs[i];
+ count = trace_data.counts[i];
+ while (count-- > 0)
+ {
+ QUIT;
+ if (trace_show_source)
+ {
+ struct symtab_and_line sal, sal_prev;
+
+ sal_prev = find_pc_line (next_address - 4, 0);
+ sal = find_pc_line (next_address, 0);
+
+ if (sal.symtab)
+ {
+ if (first || sal.line != sal_prev.line)
+ print_source_lines (sal.symtab, sal.line, sal.line + 1, 0);
+ suppress = 0;
+ }
+ else
+ {
+ if (!suppress)
+ /* FIXME-32x64--assumes sal.pc fits in long. */
+ printf_filtered ("No source file for address %s.\n",
+ local_hex_string((unsigned long) sal.pc));
+ suppress = 1;
+ }
+ }
+ first = 0;
+ print_address (next_address, gdb_stdout);
+ printf_filtered (":");
+ printf_filtered ("\t");
+ wrap_here (" ");
+ next_address = next_address + print_insn (next_address, gdb_stdout);
+ printf_filtered ("\n");
+ gdb_flush (gdb_stdout);
+ }
+ }
+}
+
+extern void (*target_resume_hook) PARAMS ((void));
+extern void (*target_wait_loop_hook) PARAMS ((void));
+
+void
+_initialize_d10v_tdep ()
+{
+ tm_print_insn = print_insn_d10v;
+
+ target_resume_hook = d10v_eva_prepare_to_trace;
+ target_wait_loop_hook = d10v_eva_get_trace_data;
+
+ add_com ("regs", class_vars, show_regs, "Print all registers");
+
+ add_com ("trace", class_support, trace_command,
+ "Enable tracing of instruction execution.");
+
+ add_com ("untrace", class_support, untrace_command,
+ "Disable tracing of instruction execution.");
+
+ add_com ("tdisassemble", class_vars, tdisassemble_command,
+ "Disassemble the trace buffer.\n\
+Two optional arguments specify a range of trace buffer entries\n\
+as reported by info trace (NOT addresses!).");
+
+ add_info ("trace", trace_info,
+ "Display info about the trace data buffer.");
+
+ add_show_from_set (add_set_cmd ("tracedisplay", no_class,
+ var_integer, (char *)&trace_display,
+ "Set automatic display of trace.\n", &setlist),
+ &showlist);
+ add_show_from_set (add_set_cmd ("tracesource", no_class,
+ var_integer, (char *)&default_trace_show_source,
+ "Set display of source code with trace.\n", &setlist),
+ &showlist);
+
+}
diff --git a/contrib/gdb/gdb/d30v-tdep.c b/contrib/gdb/gdb/d30v-tdep.c
new file mode 100644
index 000000000000..ec4646331411
--- /dev/null
+++ b/contrib/gdb/gdb/d30v-tdep.c
@@ -0,0 +1,1396 @@
+/* Target-dependent code for Mitsubishi D30V, for GDB.
+ Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+This program 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+/* Contributed by Martin Hunt, hunt@cygnus.com */
+
+#include "defs.h"
+#include "frame.h"
+#include "obstack.h"
+#include "symtab.h"
+#include "gdbtypes.h"
+#include "gdbcmd.h"
+#include "gdbcore.h"
+#include "gdb_string.h"
+#include "value.h"
+#include "inferior.h"
+#include "dis-asm.h"
+#include "symfile.h"
+#include "objfiles.h"
+
+void d30v_frame_find_saved_regs PARAMS ((struct frame_info *fi,
+ struct frame_saved_regs *fsr));
+void d30v_frame_find_saved_regs_offsets PARAMS ((struct frame_info *fi,
+ struct frame_saved_regs *fsr));
+static void d30v_pop_dummy_frame PARAMS ((struct frame_info *fi));
+static void d30v_print_flags PARAMS ((void));
+static void print_flags_command PARAMS ((char *, int));
+
+/* the following defines assume:
+ fp is r61, lr is r62, sp is r63, and ?? is r22
+ if that changes, they will need to be updated */
+
+#define OP_MASK_ALL_BUT_RA 0x0ffc0fff /* throw away Ra, keep the rest */
+
+#define OP_STW_SPM 0x054c0fc0 /* stw Ra, @(sp-) */
+#define OP_STW_SP_R0 0x05400fc0 /* stw Ra, @(sp,r0) */
+#define OP_STW_SP_IMM0 0x05480fc0 /* st Ra, @(sp, 0x0) */
+#define OP_STW_R22P_R0 0x05440580 /* stw Ra, @(r22+,r0) */
+
+#define OP_ST2W_SPM 0x056c0fc0 /* st2w Ra, @(sp-) */
+#define OP_ST2W_SP_R0 0x05600fc0 /* st2w Ra, @(sp, r0) */
+#define OP_ST2W_SP_IMM0 0x05680fc0 /* st2w Ra, @(sp, 0x0) */
+#define OP_ST2W_R22P_R0 0x05640580 /* st2w Ra, @(r22+, r0) */
+
+#define OP_MASK_OPCODE 0x0ffc0000 /* just the opcode, ign operands */
+#define OP_NOP 0x00f00000 /* nop */
+
+#define OP_MASK_ALL_BUT_IMM 0x0fffffc0 /* throw away imm, keep the rest */
+#define OP_SUB_SP_IMM 0x082bffc0 /* sub sp,sp,imm */
+#define OP_ADD_SP_IMM 0x080bffc0 /* add sp,sp,imm */
+#define OP_ADD_R22_SP_IMM 0x08096fc0 /* add r22,sp,imm */
+#define OP_STW_FP_SP_IMM 0x054bdfc0 /* stw fp,@(sp,imm) */
+#define OP_OR_SP_R0_IMM 0x03abf000 /* or sp,r0,imm */
+
+/* no mask */
+#define OP_OR_FP_R0_SP 0x03a3d03f /* or fp,r0,sp */
+#define OP_OR_FP_SP_R0 0x03a3dfc0 /* or fp,sp,r0 */
+#define OP_OR_FP_IMM0_SP 0x03abd03f /* or fp,0x0,sp */
+#define OP_STW_FP_R22P_R0 0x0547d580 /* stw fp,@(r22+,r0) */
+#define OP_STW_LR_R22P_R0 0x0547e580 /* stw lr,@(r22+,r0) */
+
+#define OP_MASK_OP_AND_RB 0x0ff80fc0 /* keep op and rb,throw away rest */
+#define OP_STW_SP_IMM 0x05480fc0 /* stw Ra,@(sp,imm) */
+#define OP_ST2W_SP_IMM 0x05680fc0 /* st2w Ra,@(sp,imm) */
+#define OP_STW_FP_IMM 0x05480f40 /* stw Ra,@(fp,imm) */
+#define OP_STW_FP_R0 0x05400f40 /* stw Ra,@(fp,r0) */
+
+#define OP_MASK_FM_BIT 0x80000000
+#define OP_MASK_CC_BITS 0x70000000
+#define OP_MASK_SUB_INST 0x0fffffff
+
+#define EXTRACT_RA(op) (((op) >> 12) & 0x3f)
+#define EXTRACT_RB(op) (((op) >> 6) & 0x3f)
+#define EXTRACT_RC(op) (((op) & 0x3f)
+#define EXTRACT_UIMM6(op) ((op) & 0x3f)
+#define EXTRACT_IMM6(op) ((((int)EXTRACT_UIMM6(op)) << 26) >> 26)
+#define EXTRACT_IMM26(op) ((((op)&0x0ff00000) >> 2) | ((op)&0x0003ffff))
+#define EXTRACT_IMM32(opl, opr) ((EXTRACT_UIMM6(opl) << 26)|EXTRACT_IMM26(opr))
+
+
+int
+d30v_frame_chain_valid (chain, fi)
+ CORE_ADDR chain;
+ struct frame_info *fi; /* not used here */
+{
+#if 0
+ return ((chain) != 0 && (fi) != 0 && (fi)->return_pc != 0);
+#else
+ return ((chain) != 0 && (fi) != 0 && (fi)->frame <= chain);
+#endif
+}
+
+/* Discard from the stack the innermost frame, restoring all saved
+ registers. */
+
+void
+d30v_pop_frame ()
+{
+ struct frame_info *frame = get_current_frame ();
+ CORE_ADDR fp;
+ int regnum;
+ struct frame_saved_regs fsr;
+ char raw_buffer[8];
+
+ fp = FRAME_FP (frame);
+ if (frame->dummy)
+ {
+ d30v_pop_dummy_frame(frame);
+ return;
+ }
+
+ /* fill out fsr with the address of where each */
+ /* register was stored in the frame */
+ get_frame_saved_regs (frame, &fsr);
+
+ /* now update the current registers with the old values */
+ for (regnum = A0_REGNUM; regnum < A0_REGNUM+2 ; regnum++)
+ {
+ if (fsr.regs[regnum])
+ {
+ read_memory (fsr.regs[regnum], raw_buffer, 8);
+ write_register_bytes (REGISTER_BYTE (regnum), raw_buffer, 8);
+ }
+ }
+ for (regnum = 0; regnum < SP_REGNUM; regnum++)
+ {
+ if (fsr.regs[regnum])
+ {
+ write_register (regnum, read_memory_unsigned_integer (fsr.regs[regnum], 4));
+ }
+ }
+ if (fsr.regs[PSW_REGNUM])
+ {
+ write_register (PSW_REGNUM, read_memory_unsigned_integer (fsr.regs[PSW_REGNUM], 4));
+ }
+
+ write_register (PC_REGNUM, read_register(LR_REGNUM));
+ write_register (SP_REGNUM, fp + frame->size);
+ target_store_registers (-1);
+ flush_cached_frames ();
+}
+
+static int
+check_prologue (op)
+ unsigned long op;
+{
+ /* add sp,sp,imm -- observed */
+ if ((op & OP_MASK_ALL_BUT_IMM) == OP_ADD_SP_IMM)
+ return 1;
+
+ /* add r22,sp,imm -- observed */
+ if ((op & OP_MASK_ALL_BUT_IMM) == OP_ADD_R22_SP_IMM)
+ return 1;
+
+ /* or fp,r0,sp -- observed */
+ if (op == OP_OR_FP_R0_SP)
+ return 1;
+
+ /* nop */
+ if ((op & OP_MASK_OPCODE) == OP_NOP)
+ return 1;
+
+ /* stw Ra,@(sp,r0) */
+ if ((op & OP_MASK_ALL_BUT_RA) == OP_STW_SP_R0)
+ return 1;
+
+ /* stw Ra,@(sp,0x0) */
+ if ((op & OP_MASK_ALL_BUT_RA) == OP_STW_SP_IMM0)
+ return 1;
+
+ /* st2w Ra,@(sp,r0) */
+ if ((op & OP_MASK_ALL_BUT_RA) == OP_ST2W_SP_R0)
+ return 1;
+
+ /* st2w Ra,@(sp,0x0) */
+ if ((op & OP_MASK_ALL_BUT_RA) == OP_ST2W_SP_IMM0)
+ return 1;
+
+ /* stw fp, @(r22+,r0) -- observed */
+ if (op == OP_STW_FP_R22P_R0)
+ return 1;
+
+ /* stw r62, @(r22+,r0) -- observed */
+ if (op == OP_STW_LR_R22P_R0)
+ return 1;
+
+ /* stw Ra, @(fp,r0) -- observed */
+ if ((op & OP_MASK_ALL_BUT_RA) == OP_STW_FP_R0)
+ return 1; /* first arg */
+
+ /* stw Ra, @(fp,imm) -- observed */
+ if ((op & OP_MASK_OP_AND_RB) == OP_STW_FP_IMM)
+ return 1; /* second and subsequent args */
+
+ /* stw fp,@(sp,imm) -- observed */
+ if ((op & OP_MASK_ALL_BUT_IMM) == OP_STW_FP_SP_IMM)
+ return 1;
+
+ /* st2w Ra,@(r22+,r0) */
+ if ((op & OP_MASK_ALL_BUT_RA) == OP_ST2W_R22P_R0)
+ return 1;
+
+ /* stw Ra, @(sp-) */
+ if ((op & OP_MASK_ALL_BUT_RA) == OP_STW_SPM)
+ return 1;
+
+ /* st2w Ra, @(sp-) */
+ if ((op & OP_MASK_ALL_BUT_RA) == OP_ST2W_SPM)
+ return 1;
+
+ /* sub.? sp,sp,imm */
+ if ((op & OP_MASK_ALL_BUT_IMM) == OP_SUB_SP_IMM)
+ return 1;
+
+ return 0;
+}
+
+CORE_ADDR
+d30v_skip_prologue (pc)
+ CORE_ADDR pc;
+{
+ unsigned long op[2];
+ unsigned long opl, opr; /* left / right sub operations */
+ unsigned long fm0, fm1; /* left / right mode bits */
+ unsigned long cc0, cc1;
+ unsigned long op1, op2;
+ CORE_ADDR func_addr, func_end;
+ struct symtab_and_line sal;
+
+ /* If we have line debugging information, then the end of the */
+ /* prologue should the first assembly instruction of the first source line */
+ if (find_pc_partial_function (pc, NULL, &func_addr, &func_end))
+ {
+ sal = find_pc_line (func_addr, 0);
+ if ( sal.end && sal.end < func_end)
+ return sal.end;
+ }
+
+ if (target_read_memory (pc, (char *)&op[0], 8))
+ return pc; /* Can't access it -- assume no prologue. */
+
+ while (1)
+ {
+ opl = (unsigned long)read_memory_integer (pc, 4);
+ opr = (unsigned long)read_memory_integer (pc+4, 4);
+
+ fm0 = (opl & OP_MASK_FM_BIT);
+ fm1 = (opr & OP_MASK_FM_BIT);
+
+ cc0 = (opl & OP_MASK_CC_BITS);
+ cc1 = (opr & OP_MASK_CC_BITS);
+
+ opl = (opl & OP_MASK_SUB_INST);
+ opr = (opr & OP_MASK_SUB_INST);
+
+ if (fm0 && fm1)
+ {
+ /* long instruction (opl contains the opcode) */
+ if (((opl & OP_MASK_ALL_BUT_IMM) != OP_ADD_SP_IMM) && /* add sp,sp,imm */
+ ((opl & OP_MASK_ALL_BUT_IMM) != OP_ADD_R22_SP_IMM) && /* add r22,sp,imm */
+ ((opl & OP_MASK_OP_AND_RB) != OP_STW_SP_IMM) && /* stw Ra, @(sp,imm) */
+ ((opl & OP_MASK_OP_AND_RB) != OP_ST2W_SP_IMM)) /* st2w Ra, @(sp,imm) */
+ break;
+ }
+ else
+ {
+ /* short instructions */
+ if (fm0 && !fm1)
+ {
+ op1 = opr;
+ op2 = opl;
+ }
+ else
+ {
+ op1 = opl;
+ op2 = opr;
+ }
+ if (check_prologue(op1))
+ {
+ if (!check_prologue(op2))
+ {
+ /* if the previous opcode was really part of the prologue */
+ /* and not just a NOP, then we want to break after both instructions */
+ if ((op1 & OP_MASK_OPCODE) != OP_NOP)
+ pc += 8;
+ break;
+ }
+ }
+ else
+ break;
+ }
+ pc += 8;
+ }
+ return pc;
+}
+
+static int end_of_stack;
+
+/* Given a GDB frame, determine the address of the calling function's frame.
+ This will be used to create a new GDB frame struct, and then
+ INIT_EXTRA_FRAME_INFO and INIT_FRAME_PC will be called for the new frame.
+*/
+
+CORE_ADDR
+d30v_frame_chain (frame)
+ struct frame_info *frame;
+{
+ struct frame_saved_regs fsr;
+
+ d30v_frame_find_saved_regs (frame, &fsr);
+
+ if (end_of_stack)
+ return (CORE_ADDR)0;
+
+ if (frame->return_pc == IMEM_START)
+ return (CORE_ADDR)0;
+
+ if (!fsr.regs[FP_REGNUM])
+ {
+ if (!fsr.regs[SP_REGNUM] || fsr.regs[SP_REGNUM] == STACK_START)
+ return (CORE_ADDR)0;
+
+ return fsr.regs[SP_REGNUM];
+ }
+
+ if (!read_memory_unsigned_integer(fsr.regs[FP_REGNUM],4))
+ return (CORE_ADDR)0;
+
+ return read_memory_unsigned_integer(fsr.regs[FP_REGNUM],4);
+}
+
+static int next_addr, uses_frame;
+static int frame_size;
+
+static int
+prologue_find_regs (op, fsr, addr)
+ unsigned long op;
+ struct frame_saved_regs *fsr;
+ CORE_ADDR addr;
+{
+ int n;
+ int offset;
+
+ /* add sp,sp,imm -- observed */
+ if ((op & OP_MASK_ALL_BUT_IMM) == OP_ADD_SP_IMM)
+ {
+ offset = EXTRACT_IMM6(op);
+ /*next_addr += offset;*/
+ frame_size += -offset;
+ return 1;
+ }
+
+ /* add r22,sp,imm -- observed */
+ if ((op & OP_MASK_ALL_BUT_IMM) == OP_ADD_R22_SP_IMM)
+ {
+ offset = EXTRACT_IMM6(op);
+ next_addr = (offset - frame_size);
+ return 1;
+ }
+
+ /* stw Ra, @(fp, offset) -- observed */
+ if ((op & OP_MASK_OP_AND_RB) == OP_STW_FP_IMM)
+ {
+ n = EXTRACT_RA(op);
+ offset = EXTRACT_IMM6(op);
+ fsr->regs[n] = (offset - frame_size);
+ return 1;
+ }
+
+ /* stw Ra, @(fp, r0) -- observed */
+ if ((op & OP_MASK_ALL_BUT_RA) == OP_STW_FP_R0)
+ {
+ n = EXTRACT_RA(op);
+ fsr->regs[n] = (- frame_size);
+ return 1;
+ }
+
+ /* or fp,0,sp -- observed */
+ if ((op == OP_OR_FP_R0_SP) ||
+ (op == OP_OR_FP_SP_R0) ||
+ (op == OP_OR_FP_IMM0_SP))
+ {
+ uses_frame = 1;
+ return 1;
+ }
+
+ /* nop */
+ if ((op & OP_MASK_OPCODE) == OP_NOP)
+ return 1;
+
+ /* stw Ra,@(r22+,r0) -- observed */
+ if ((op & OP_MASK_ALL_BUT_RA) == OP_STW_R22P_R0)
+ {
+ n = EXTRACT_RA(op);
+ fsr->regs[n] = next_addr;
+ next_addr += 4;
+ return 1;
+ }
+#if 0 /* subsumed in pattern above */
+ /* stw fp,@(r22+,r0) -- observed */
+ if (op == OP_STW_FP_R22P_R0)
+ {
+ fsr->regs[FP_REGNUM] = next_addr; /* XXX */
+ next_addr += 4;
+ return 1;
+ }
+
+ /* stw r62,@(r22+,r0) -- observed */
+ if (op == OP_STW_LR_R22P_R0)
+ {
+ fsr->regs[LR_REGNUM] = next_addr;
+ next_addr += 4;
+ return 1;
+ }
+#endif
+ /* st2w Ra,@(r22+,r0) -- observed */
+ if ((op & OP_MASK_ALL_BUT_RA) == OP_ST2W_R22P_R0)
+ {
+ n = EXTRACT_RA(op);
+ fsr->regs[n] = next_addr;
+ fsr->regs[n+1] = next_addr + 4;
+ next_addr += 8;
+ return 1;
+ }
+
+ /* stw rn, @(sp-) */
+ if ((op & OP_MASK_ALL_BUT_RA) == OP_STW_SPM)
+ {
+ n = EXTRACT_RA(op);
+ fsr->regs[n] = next_addr;
+ next_addr -= 4;
+ return 1;
+ }
+
+ /* st2w Ra, @(sp-) */
+ else if ((op & OP_MASK_ALL_BUT_RA) == OP_ST2W_SPM)
+ {
+ n = EXTRACT_RA(op);
+ fsr->regs[n] = next_addr;
+ fsr->regs[n+1] = next_addr+4;
+ next_addr -= 8;
+ return 1;
+ }
+
+ /* sub sp,sp,imm */
+ if ((op & OP_MASK_ALL_BUT_IMM) == OP_SUB_SP_IMM)
+ {
+ offset = EXTRACT_IMM6(op);
+ frame_size += -offset;
+ return 1;
+ }
+
+ /* st rn, @(sp,0) -- observed */
+ if (((op & OP_MASK_ALL_BUT_RA) == OP_STW_SP_R0) ||
+ ((op & OP_MASK_ALL_BUT_RA) == OP_STW_SP_IMM0))
+ {
+ n = EXTRACT_RA(op);
+ fsr->regs[n] = (- frame_size);
+ return 1;
+ }
+
+ /* st2w rn, @(sp,0) */
+ if (((op & OP_MASK_ALL_BUT_RA) == OP_ST2W_SP_R0) ||
+ ((op & OP_MASK_ALL_BUT_RA) == OP_ST2W_SP_IMM0))
+ {
+ n = EXTRACT_RA(op);
+ fsr->regs[n] = (- frame_size);
+ fsr->regs[n+1] = (- frame_size) + 4;
+ return 1;
+ }
+
+ /* stw fp,@(sp,imm) -- observed */
+ if ((op & OP_MASK_ALL_BUT_IMM) == OP_STW_FP_SP_IMM)
+ {
+ offset = EXTRACT_IMM6(op);
+ fsr->regs[FP_REGNUM] = (offset - frame_size);
+ return 1;
+ }
+ return 0;
+}
+
+/* Put here the code to store, into a struct frame_saved_regs, the
+ addresses of the saved registers of frame described by FRAME_INFO.
+ This includes special registers such as pc and fp saved in special
+ ways in the stack frame. sp is even more special: the address we
+ return for it IS the sp for the next frame. */
+void
+d30v_frame_find_saved_regs (fi, fsr)
+ struct frame_info *fi;
+ struct frame_saved_regs *fsr;
+{
+ CORE_ADDR fp, pc;
+ unsigned long opl, opr;
+ unsigned long op1, op2;
+ unsigned long fm0, fm1;
+ int i;
+
+ fp = fi->frame;
+ memset (fsr, 0, sizeof (*fsr));
+ next_addr = 0;
+ frame_size = 0;
+ end_of_stack = 0;
+
+ uses_frame = 0;
+
+ d30v_frame_find_saved_regs_offsets (fi, fsr);
+
+ fi->size = frame_size;
+
+ if (!fp)
+ fp = read_register(SP_REGNUM);
+
+ for (i=0; i<NUM_REGS-1; i++)
+ if (fsr->regs[i])
+ {
+ fsr->regs[i] = fsr->regs[i] + fp + frame_size;
+ }
+
+ if (fsr->regs[LR_REGNUM])
+ fi->return_pc = read_memory_unsigned_integer(fsr->regs[LR_REGNUM],4);
+ else
+ fi->return_pc = read_register(LR_REGNUM);
+
+ /* the SP is not normally (ever?) saved, but check anyway */
+ if (!fsr->regs[SP_REGNUM])
+ {
+ /* if the FP was saved, that means the current FP is valid, */
+ /* otherwise, it isn't being used, so we use the SP instead */
+ if (uses_frame)
+ fsr->regs[SP_REGNUM] = read_register(FP_REGNUM) + fi->size;
+ else
+ {
+ fsr->regs[SP_REGNUM] = fp + fi->size;
+ fi->frameless = 1;
+ fsr->regs[FP_REGNUM] = 0;
+ }
+ }
+}
+
+void
+d30v_frame_find_saved_regs_offsets (fi, fsr)
+ struct frame_info *fi;
+ struct frame_saved_regs *fsr;
+{
+ CORE_ADDR fp, pc;
+ unsigned long opl, opr;
+ unsigned long op1, op2;
+ unsigned long fm0, fm1;
+ int i;
+
+ fp = fi->frame;
+ memset (fsr, 0, sizeof (*fsr));
+ next_addr = 0;
+ frame_size = 0;
+ end_of_stack = 0;
+
+ pc = get_pc_function_start (fi->pc);
+
+ uses_frame = 0;
+ while (pc < fi->pc)
+ {
+ opl = (unsigned long)read_memory_integer (pc, 4);
+ opr = (unsigned long)read_memory_integer (pc+4, 4);
+
+ fm0 = (opl & OP_MASK_FM_BIT);
+ fm1 = (opr & OP_MASK_FM_BIT);
+
+ opl = (opl & OP_MASK_SUB_INST);
+ opr = (opr & OP_MASK_SUB_INST);
+
+ if (fm0 && fm1)
+ {
+ /* long instruction */
+ if ((opl & OP_MASK_ALL_BUT_IMM) == OP_ADD_SP_IMM)
+ {
+ /* add sp,sp,n */
+ long offset = EXTRACT_IMM32(opl, opr);
+ frame_size += -offset;
+ }
+ else if ((opl & OP_MASK_ALL_BUT_IMM) == OP_ADD_R22_SP_IMM)
+ {
+ /* add r22,sp,offset */
+ long offset = EXTRACT_IMM32(opl,opr);
+ next_addr = (offset - frame_size);
+ }
+ else if ((opl & OP_MASK_OP_AND_RB) == OP_STW_SP_IMM)
+ {
+ /* st Ra, @(sp,imm) */
+ long offset = EXTRACT_IMM32(opl, opr);
+ short n = EXTRACT_RA(opl);
+ fsr->regs[n] = (offset - frame_size);
+ }
+ else if ((opl & OP_MASK_OP_AND_RB) == OP_ST2W_SP_IMM)
+ {
+ /* st2w Ra, @(sp,offset) */
+ long offset = EXTRACT_IMM32(opl, opr);
+ short n = EXTRACT_RA(opl);
+ fsr->regs[n] = (offset - frame_size);
+ fsr->regs[n+1] = (offset - frame_size) + 4;
+ }
+ else if ((opl & OP_MASK_ALL_BUT_IMM) == OP_OR_SP_R0_IMM)
+ {
+ end_of_stack = 1;
+ }
+ else
+ break;
+ }
+ else
+ {
+ /* short instructions */
+ if (fm0 && !fm1)
+ {
+ op2 = opl;
+ op1 = opr;
+ }
+ else
+ {
+ op1 = opl;
+ op2 = opr;
+ }
+ if (!prologue_find_regs(op1,fsr,pc) || !prologue_find_regs(op2,fsr,pc))
+ break;
+ }
+ pc += 8;
+ }
+
+#if 0
+ fi->size = frame_size;
+
+ if (!fp)
+ fp = read_register(SP_REGNUM);
+
+ for (i=0; i<NUM_REGS-1; i++)
+ if (fsr->regs[i])
+ {
+ fsr->regs[i] = fsr->regs[i] + fp + frame_size;
+ }
+
+ if (fsr->regs[LR_REGNUM])
+ fi->return_pc = read_memory_unsigned_integer(fsr->regs[LR_REGNUM],4);
+ else
+ fi->return_pc = read_register(LR_REGNUM);
+
+ /* the SP is not normally (ever?) saved, but check anyway */
+ if (!fsr->regs[SP_REGNUM])
+ {
+ /* if the FP was saved, that means the current FP is valid, */
+ /* otherwise, it isn't being used, so we use the SP instead */
+ if (uses_frame)
+ fsr->regs[SP_REGNUM] = read_register(FP_REGNUM) + fi->size;
+ else
+ {
+ fsr->regs[SP_REGNUM] = fp + fi->size;
+ fi->frameless = 1;
+ fsr->regs[FP_REGNUM] = 0;
+ }
+ }
+#endif
+}
+
+void
+d30v_init_extra_frame_info (fromleaf, fi)
+ int fromleaf;
+ struct frame_info *fi;
+{
+ struct frame_saved_regs dummy;
+
+ if (fi->next && (fi->pc == 0))
+ fi->pc = fi->next->return_pc;
+
+ d30v_frame_find_saved_regs_offsets (fi, &dummy);
+
+ if (uses_frame == 0)
+ fi->frameless = 1;
+ else
+ fi->frameless = 0;
+
+ if ((fi->next == 0) && (uses_frame == 0))
+ /* innermost frame and it's "frameless",
+ so the fi->frame field is wrong, fix it! */
+ fi->frame = read_sp ();
+
+ if (dummy.regs[LR_REGNUM])
+ {
+ /* it was saved, grab it! */
+ dummy.regs[LR_REGNUM] += (fi->frame + frame_size);
+ fi->return_pc = read_memory_unsigned_integer(dummy.regs[LR_REGNUM],4);
+ }
+ else
+ fi->return_pc = read_register(LR_REGNUM);
+}
+
+void
+d30v_init_frame_pc (fromleaf, prev)
+ int fromleaf;
+ struct frame_info *prev;
+{
+ /* default value, put here so we can breakpoint on it and
+ see if the default value is really the right thing to use */
+ prev->pc = (fromleaf ? SAVED_PC_AFTER_CALL (prev->next) : \
+ prev->next ? FRAME_SAVED_PC (prev->next) : read_pc ());
+}
+
+static void d30v_print_register PARAMS ((int regnum, int tabular));
+
+static void
+d30v_print_register (regnum, tabular)
+ int regnum;
+ int tabular;
+{
+ if (regnum < A0_REGNUM)
+ {
+ if (tabular)
+ printf_filtered ("%08x", read_register (regnum));
+ else
+ printf_filtered ("0x%x %d", read_register (regnum),
+ read_register (regnum));
+ }
+ else
+ {
+ char regbuf[MAX_REGISTER_RAW_SIZE];
+
+ read_relative_register_raw_bytes (regnum, regbuf);
+
+ val_print (REGISTER_VIRTUAL_TYPE (regnum), regbuf, 0, 0,
+ gdb_stdout, 'x', 1, 0, Val_pretty_default);
+
+ if (!tabular)
+ {
+ printf_filtered (" ");
+ val_print (REGISTER_VIRTUAL_TYPE (regnum), regbuf, 0, 0,
+ gdb_stdout, 'd', 1, 0, Val_pretty_default);
+ }
+ }
+}
+
+static void
+d30v_print_flags ()
+{
+ long psw = read_register (PSW_REGNUM);
+ printf_filtered ("flags #1");
+ printf_filtered (" (sm) %d", (psw & PSW_SM) != 0);
+ printf_filtered (" (ea) %d", (psw & PSW_EA) != 0);
+ printf_filtered (" (db) %d", (psw & PSW_DB) != 0);
+ printf_filtered (" (ds) %d", (psw & PSW_DS) != 0);
+ printf_filtered (" (ie) %d", (psw & PSW_IE) != 0);
+ printf_filtered (" (rp) %d", (psw & PSW_RP) != 0);
+ printf_filtered (" (md) %d\n", (psw & PSW_MD) != 0);
+
+ printf_filtered ("flags #2");
+ printf_filtered (" (f0) %d", (psw & PSW_F0) != 0);
+ printf_filtered (" (f1) %d", (psw & PSW_F1) != 0);
+ printf_filtered (" (f2) %d", (psw & PSW_F2) != 0);
+ printf_filtered (" (f3) %d", (psw & PSW_F3) != 0);
+ printf_filtered (" (s) %d", (psw & PSW_S) != 0);
+ printf_filtered (" (v) %d", (psw & PSW_V) != 0);
+ printf_filtered (" (va) %d", (psw & PSW_VA) != 0);
+ printf_filtered (" (c) %d\n", (psw & PSW_C) != 0);
+}
+
+static void
+print_flags_command (args, from_tty)
+ char *args;
+ int from_tty;
+{
+ d30v_print_flags ();
+}
+
+void
+d30v_do_registers_info (regnum, fpregs)
+ int regnum;
+ int fpregs;
+{
+ long long num1, num2;
+ long psw;
+
+ if (regnum != -1)
+ {
+ if (REGISTER_NAME (0) == NULL || REGISTER_NAME (0)[0] == '\000')
+ return;
+
+ printf_filtered ("%s ", REGISTER_NAME (regnum));
+ d30v_print_register (regnum, 0);
+
+ printf_filtered ("\n");
+ return;
+ }
+
+ /* Have to print all the registers. Format them nicely. */
+
+ printf_filtered ("PC=");
+ print_address (read_pc (), gdb_stdout);
+
+ printf_filtered (" PSW=");
+ d30v_print_register (PSW_REGNUM, 1);
+
+ printf_filtered (" BPC=");
+ print_address (read_register (BPC_REGNUM), gdb_stdout);
+
+ printf_filtered (" BPSW=");
+ d30v_print_register (BPSW_REGNUM, 1);
+ printf_filtered ("\n");
+
+ printf_filtered ("DPC=");
+ print_address (read_register (DPC_REGNUM), gdb_stdout);
+
+ printf_filtered (" DPSW=");
+ d30v_print_register (DPSW_REGNUM, 1);
+
+ printf_filtered (" IBA=");
+ print_address (read_register (IBA_REGNUM), gdb_stdout);
+ printf_filtered ("\n");
+
+ printf_filtered ("RPT_C=");
+ d30v_print_register (RPT_C_REGNUM, 1);
+
+ printf_filtered (" RPT_S=");
+ print_address (read_register (RPT_S_REGNUM), gdb_stdout);
+
+ printf_filtered (" RPT_E=");
+ print_address (read_register (RPT_E_REGNUM), gdb_stdout);
+ printf_filtered ("\n");
+
+ printf_filtered ("MOD_S=");
+ print_address (read_register (MOD_S_REGNUM), gdb_stdout);
+
+ printf_filtered (" MOD_E=");
+ print_address (read_register (MOD_E_REGNUM), gdb_stdout);
+ printf_filtered ("\n");
+
+ printf_filtered ("EIT_VB=");
+ print_address (read_register (EIT_VB_REGNUM), gdb_stdout);
+
+ printf_filtered (" INT_S=");
+ d30v_print_register (INT_S_REGNUM, 1);
+
+ printf_filtered (" INT_M=");
+ d30v_print_register (INT_M_REGNUM, 1);
+ printf_filtered ("\n");
+
+ d30v_print_flags ();
+ for (regnum = 0; regnum <= 63;)
+ {
+ int i;
+
+ printf_filtered ("R%d-R%d ", regnum, regnum + 7);
+ if (regnum < 10)
+ printf_filtered (" ");
+ if (regnum + 7 < 10)
+ printf_filtered (" ");
+
+ for (i = 0; i < 8; i++)
+ {
+ printf_filtered (" ");
+ d30v_print_register (regnum++, 1);
+ }
+
+ printf_filtered ("\n");
+ }
+
+ printf_filtered ("A0-A1 ");
+
+ d30v_print_register (A0_REGNUM, 1);
+ printf_filtered (" ");
+ d30v_print_register (A1_REGNUM, 1);
+ printf_filtered ("\n");
+}
+
+CORE_ADDR
+d30v_fix_call_dummy (dummyname, start_sp, fun, nargs, args, type, gcc_p)
+ char *dummyname;
+ CORE_ADDR start_sp;
+ CORE_ADDR fun;
+ int nargs;
+ value_ptr *args;
+ struct type *type;
+ int gcc_p;
+{
+ int regnum;
+ CORE_ADDR sp;
+ char buffer[MAX_REGISTER_RAW_SIZE];
+ struct frame_info *frame = get_current_frame ();
+ frame->dummy = start_sp;
+ /*start_sp |= DMEM_START;*/
+
+ sp = start_sp;
+ for (regnum = 0; regnum < NUM_REGS; regnum++)
+ {
+ sp -= REGISTER_RAW_SIZE(regnum);
+ store_address (buffer, REGISTER_RAW_SIZE(regnum), read_register(regnum));
+ write_memory (sp, buffer, REGISTER_RAW_SIZE(regnum));
+ }
+ write_register (SP_REGNUM, (LONGEST)sp);
+ /* now we need to load LR with the return address */
+ write_register (LR_REGNUM, (LONGEST)d30v_call_dummy_address());
+ return sp;
+}
+
+static void
+d30v_pop_dummy_frame (fi)
+ struct frame_info *fi;
+{
+ CORE_ADDR sp = fi->dummy;
+ int regnum;
+
+ for (regnum = 0; regnum < NUM_REGS; regnum++)
+ {
+ sp -= REGISTER_RAW_SIZE(regnum);
+ write_register(regnum, read_memory_unsigned_integer (sp, REGISTER_RAW_SIZE(regnum)));
+ }
+ flush_cached_frames (); /* needed? */
+}
+
+
+CORE_ADDR
+d30v_push_arguments (nargs, args, sp, struct_return, struct_addr)
+ int nargs;
+ value_ptr *args;
+ CORE_ADDR sp;
+ int struct_return;
+ CORE_ADDR struct_addr;
+{
+ int i, len, index=0, regnum=2;
+ char buffer[4], *contents;
+ LONGEST val;
+ CORE_ADDR ptrs[10];
+
+#if 0
+ /* Pass 1. Put all large args on stack */
+ for (i = 0; i < nargs; i++)
+ {
+ value_ptr arg = args[i];
+ struct type *arg_type = check_typedef (VALUE_TYPE (arg));
+ len = TYPE_LENGTH (arg_type);
+ contents = VALUE_CONTENTS(arg);
+ val = extract_signed_integer (contents, len);
+ if (len > 4)
+ {
+ /* put on stack and pass pointers */
+ sp -= len;
+ write_memory (sp, contents, len);
+ ptrs[index++] = sp;
+ }
+ }
+#endif
+ index = 0;
+
+ for (i = 0; i < nargs; i++)
+ {
+ value_ptr arg = args[i];
+ struct type *arg_type = check_typedef (VALUE_TYPE (arg));
+ len = TYPE_LENGTH (arg_type);
+ contents = VALUE_CONTENTS(arg);
+ if (len > 4)
+ {
+ /* we need multiple registers */
+ int ndx;
+
+ for (ndx = 0; len > 0; ndx += 8, len -= 8)
+ {
+ if (regnum & 1)
+ regnum++; /* all args > 4 bytes start in even register */
+
+ if (regnum < 18)
+ {
+ val = extract_signed_integer (&contents[ndx], 4);
+ write_register (regnum++, val);
+
+ if (len >= 8)
+ val = extract_signed_integer (&contents[ndx+4], 4);
+ else
+ val = extract_signed_integer (&contents[ndx+4], len-4);
+ write_register (regnum++, val);
+ }
+ else
+ {
+ /* no more registers available. put it on the stack */
+
+ /* all args > 4 bytes are padded to a multiple of 8 bytes
+ and start on an 8 byte boundary */
+ if (sp & 7)
+ sp -= (sp & 7); /* align it */
+
+ sp -= ((len + 7) & ~7); /* allocate space */
+ write_memory (sp, &contents[ndx], len);
+ break;
+ }
+ }
+ }
+ else
+ {
+ if (regnum < 18 )
+ {
+ val = extract_signed_integer (contents, len);
+ write_register (regnum++, val);
+ }
+ else
+ {
+ /* all args are padded to a multiple of 4 bytes (at least) */
+ sp -= ((len + 3) & ~3);
+ write_memory (sp, contents, len);
+ }
+ }
+ }
+ if (sp & 7)
+ /* stack pointer is not on an 8 byte boundary -- align it */
+ sp -= (sp & 7);
+ return sp;
+}
+
+
+/* pick an out-of-the-way place to set the return value */
+/* for an inferior function call. The link register is set to this */
+/* value and a momentary breakpoint is set there. When the breakpoint */
+/* is hit, the dummy frame is popped and the previous environment is */
+/* restored. */
+
+CORE_ADDR
+d30v_call_dummy_address ()
+{
+ CORE_ADDR entry;
+ struct minimal_symbol *sym;
+
+ entry = entry_point_address ();
+
+ if (entry != 0)
+ return entry;
+
+ sym = lookup_minimal_symbol ("_start", NULL, symfile_objfile);
+
+ if (!sym || MSYMBOL_TYPE (sym) != mst_text)
+ return 0;
+ else
+ return SYMBOL_VALUE_ADDRESS (sym);
+}
+
+/* Given a return value in `regbuf' with a type `valtype',
+ extract and copy its value into `valbuf'. */
+
+void
+d30v_extract_return_value (valtype, regbuf, valbuf)
+ struct type *valtype;
+ char regbuf[REGISTER_BYTES];
+ char *valbuf;
+{
+ memcpy (valbuf, regbuf + REGISTER_BYTE (2), TYPE_LENGTH (valtype));
+}
+
+/* The following code implements access to, and display of, the D30V's
+ instruction trace buffer. The buffer consists of 64K or more
+ 4-byte words of data, of which each words includes an 8-bit count,
+ an 8-bit segment number, and a 16-bit instruction address.
+
+ In theory, the trace buffer is continuously capturing instruction
+ data that the CPU presents on its "debug bus", but in practice, the
+ ROMified GDB stub only enables tracing when it continues or steps
+ the program, and stops tracing when the program stops; so it
+ actually works for GDB to read the buffer counter out of memory and
+ then read each trace word. The counter records where the tracing
+ stops, but there is no record of where it started, so we remember
+ the PC when we resumed and then search backwards in the trace
+ buffer for a word that includes that address. This is not perfect,
+ because you will miss trace data if the resumption PC is the target
+ of a branch. (The value of the buffer counter is semi-random, any
+ trace data from a previous program stop is gone.) */
+
+/* The address of the last word recorded in the trace buffer. */
+
+#define DBBC_ADDR (0xd80000)
+
+/* The base of the trace buffer, at least for the "Board_0". */
+
+#define TRACE_BUFFER_BASE (0xf40000)
+
+static void trace_command PARAMS ((char *, int));
+
+static void untrace_command PARAMS ((char *, int));
+
+static void trace_info PARAMS ((char *, int));
+
+static void tdisassemble_command PARAMS ((char *, int));
+
+static void display_trace PARAMS ((int, int));
+
+/* True when instruction traces are being collected. */
+
+static int tracing;
+
+/* Remembered PC. */
+
+static CORE_ADDR last_pc;
+
+/* True when trace output should be displayed whenever program stops. */
+
+static int trace_display;
+
+/* True when trace listing should include source lines. */
+
+static int default_trace_show_source = 1;
+
+struct trace_buffer {
+ int size;
+ short *counts;
+ CORE_ADDR *addrs;
+} trace_data;
+
+static void
+trace_command (args, from_tty)
+ char *args;
+ int from_tty;
+{
+ /* Clear the host-side trace buffer, allocating space if needed. */
+ trace_data.size = 0;
+ if (trace_data.counts == NULL)
+ trace_data.counts = (short *) xmalloc (65536 * sizeof(short));
+ if (trace_data.addrs == NULL)
+ trace_data.addrs = (CORE_ADDR *) xmalloc (65536 * sizeof(CORE_ADDR));
+
+ tracing = 1;
+
+ printf_filtered ("Tracing is now on.\n");
+}
+
+static void
+untrace_command (args, from_tty)
+ char *args;
+ int from_tty;
+{
+ tracing = 0;
+
+ printf_filtered ("Tracing is now off.\n");
+}
+
+static void
+trace_info (args, from_tty)
+ char *args;
+ int from_tty;
+{
+ int i;
+
+ if (trace_data.size)
+ {
+ printf_filtered ("%d entries in trace buffer:\n", trace_data.size);
+
+ for (i = 0; i < trace_data.size; ++i)
+ {
+ printf_filtered ("%d: %d instruction%s at 0x%x\n",
+ i, trace_data.counts[i],
+ (trace_data.counts[i] == 1 ? "" : "s"),
+ trace_data.addrs[i]);
+ }
+ }
+ else
+ printf_filtered ("No entries in trace buffer.\n");
+
+ printf_filtered ("Tracing is currently %s.\n", (tracing ? "on" : "off"));
+}
+
+/* Print the instruction at address MEMADDR in debugged memory,
+ on STREAM. Returns length of the instruction, in bytes. */
+
+static int
+print_insn (memaddr, stream)
+ CORE_ADDR memaddr;
+ GDB_FILE *stream;
+{
+ /* If there's no disassembler, something is very wrong. */
+ if (tm_print_insn == NULL)
+ abort ();
+
+ if (TARGET_BYTE_ORDER == BIG_ENDIAN)
+ tm_print_insn_info.endian = BFD_ENDIAN_BIG;
+ else
+ tm_print_insn_info.endian = BFD_ENDIAN_LITTLE;
+ return (*tm_print_insn) (memaddr, &tm_print_insn_info);
+}
+
+void
+d30v_eva_prepare_to_trace ()
+{
+ if (!tracing)
+ return;
+
+ last_pc = read_register (PC_REGNUM);
+}
+
+/* Collect trace data from the target board and format it into a form
+ more useful for display. */
+
+void
+d30v_eva_get_trace_data ()
+{
+ int count, i, j, oldsize;
+ int trace_addr, trace_seg, trace_cnt, next_cnt;
+ unsigned int last_trace, trace_word, next_word;
+ unsigned int *tmpspace;
+
+ if (!tracing)
+ return;
+
+ tmpspace = xmalloc (65536 * sizeof(unsigned int));
+
+ last_trace = read_memory_unsigned_integer (DBBC_ADDR, 2) << 2;
+
+ /* Collect buffer contents from the target, stopping when we reach
+ the word recorded when execution resumed. */
+
+ count = 0;
+ while (last_trace > 0)
+ {
+ QUIT;
+ trace_word =
+ read_memory_unsigned_integer (TRACE_BUFFER_BASE + last_trace, 4);
+ trace_addr = trace_word & 0xffff;
+ last_trace -= 4;
+ /* Ignore an apparently nonsensical entry. */
+ if (trace_addr == 0xffd5)
+ continue;
+ tmpspace[count++] = trace_word;
+ if (trace_addr == last_pc)
+ break;
+ if (count > 65535)
+ break;
+ }
+
+ /* Move the data to the host-side trace buffer, adjusting counts to
+ include the last instruction executed and transforming the address
+ into something that GDB likes. */
+
+ for (i = 0; i < count; ++i)
+ {
+ trace_word = tmpspace[i];
+ next_word = ((i == 0) ? 0 : tmpspace[i - 1]);
+ trace_addr = trace_word & 0xffff;
+ next_cnt = (next_word >> 24) & 0xff;
+ j = trace_data.size + count - i - 1;
+ trace_data.addrs[j] = (trace_addr << 2) + 0x1000000;
+ trace_data.counts[j] = next_cnt + 1;
+ }
+
+ oldsize = trace_data.size;
+ trace_data.size += count;
+
+ free (tmpspace);
+
+ if (trace_display)
+ display_trace (oldsize, trace_data.size);
+}
+
+static void
+tdisassemble_command (arg, from_tty)
+ char *arg;
+ int from_tty;
+{
+ int i, count;
+ CORE_ADDR low, high;
+ char *space_index;
+
+ if (!arg)
+ {
+ low = 0;
+ high = trace_data.size;
+ }
+ else if (!(space_index = (char *) strchr (arg, ' ')))
+ {
+ low = parse_and_eval_address (arg);
+ high = low + 5;
+ }
+ else
+ {
+ /* Two arguments. */
+ *space_index = '\0';
+ low = parse_and_eval_address (arg);
+ high = parse_and_eval_address (space_index + 1);
+ if (high < low)
+ high = low;
+ }
+
+ printf_filtered ("Dump of trace from %d to %d:\n", low, high);
+
+ display_trace (low, high);
+
+ printf_filtered ("End of trace dump.\n");
+ gdb_flush (gdb_stdout);
+}
+
+static void
+display_trace (low, high)
+ int low, high;
+{
+ int i, count, trace_show_source, first, suppress;
+ CORE_ADDR next_address;
+
+ trace_show_source = default_trace_show_source;
+ if (!have_full_symbols () && !have_partial_symbols())
+ {
+ trace_show_source = 0;
+ printf_filtered ("No symbol table is loaded. Use the \"file\" command.\n");
+ printf_filtered ("Trace will not display any source.\n");
+ }
+
+ first = 1;
+ suppress = 0;
+ for (i = low; i < high; ++i)
+ {
+ next_address = trace_data.addrs[i];
+ count = trace_data.counts[i];
+ while (count-- > 0)
+ {
+ QUIT;
+ if (trace_show_source)
+ {
+ struct symtab_and_line sal, sal_prev;
+
+ sal_prev = find_pc_line (next_address - 4, 0);
+ sal = find_pc_line (next_address, 0);
+
+ if (sal.symtab)
+ {
+ if (first || sal.line != sal_prev.line)
+ print_source_lines (sal.symtab, sal.line, sal.line + 1, 0);
+ suppress = 0;
+ }
+ else
+ {
+ if (!suppress)
+ /* FIXME-32x64--assumes sal.pc fits in long. */
+ printf_filtered ("No source file for address %s.\n",
+ local_hex_string((unsigned long) sal.pc));
+ suppress = 1;
+ }
+ }
+ first = 0;
+ print_address (next_address, gdb_stdout);
+ printf_filtered (":");
+ printf_filtered ("\t");
+ wrap_here (" ");
+ next_address = next_address + print_insn (next_address, gdb_stdout);
+ printf_filtered ("\n");
+ gdb_flush (gdb_stdout);
+ }
+ }
+}
+
+extern void (*target_resume_hook) PARAMS ((void));
+extern void (*target_wait_loop_hook) PARAMS ((void));
+
+void
+_initialize_d30v_tdep ()
+{
+ tm_print_insn = print_insn_d30v;
+
+ target_resume_hook = d30v_eva_prepare_to_trace;
+ target_wait_loop_hook = d30v_eva_get_trace_data;
+
+ add_info ("flags", print_flags_command, "Print d30v flags.");
+
+ add_com ("trace", class_support, trace_command,
+ "Enable tracing of instruction execution.");
+
+ add_com ("untrace", class_support, untrace_command,
+ "Disable tracing of instruction execution.");
+
+ add_com ("tdisassemble", class_vars, tdisassemble_command,
+ "Disassemble the trace buffer.\n\
+Two optional arguments specify a range of trace buffer entries\n\
+as reported by info trace (NOT addresses!).");
+
+ add_info ("trace", trace_info,
+ "Display info about the trace data buffer.");
+
+ add_show_from_set (add_set_cmd ("tracedisplay", no_class,
+ var_integer, (char *)&trace_display,
+ "Set automatic display of trace.\n", &setlist),
+ &showlist);
+ add_show_from_set (add_set_cmd ("tracesource", no_class,
+ var_integer, (char *)&default_trace_show_source,
+ "Set display of source code with trace.\n", &setlist),
+ &showlist);
+
+}
diff --git a/contrib/gdb/gdb/dbug-rom.c b/contrib/gdb/gdb/dbug-rom.c
new file mode 100644
index 000000000000..fa9c97440ed8
--- /dev/null
+++ b/contrib/gdb/gdb/dbug-rom.c
@@ -0,0 +1,164 @@
+/* Remote debugging interface to dBUG ROM monitor for GDB, the GNU debugger.
+ Copyright 1996 Free Software Foundation, Inc.
+
+ Written by Stan Shebs of Cygnus Support.
+
+This file is part of GDB.
+
+This program 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+/* dBUG is a monitor supplied on various Motorola boards, including
+ m68k, ColdFire, and PowerPC-based designs. The code here assumes
+ the ColdFire, and (as of 9/25/96) has only been tested with a
+ ColdFire IDP board. */
+
+#include "defs.h"
+#include "gdbcore.h"
+#include "target.h"
+#include "monitor.h"
+#include "serial.h"
+
+static void dbug_open PARAMS ((char *args, int from_tty));
+
+static void
+dbug_supply_register (regname, regnamelen, val, vallen)
+ char *regname;
+ int regnamelen;
+ char *val;
+ int vallen;
+{
+ int regno;
+
+ if (regnamelen != 2)
+ return;
+
+ switch (regname[0])
+ {
+ case 'S':
+ if (regname[1] != 'R')
+ return;
+ regno = PS_REGNUM;
+ break;
+ case 'P':
+ if (regname[1] != 'C')
+ return;
+ regno = PC_REGNUM;
+ break;
+ case 'D':
+ if (regname[1] < '0' || regname[1] > '7')
+ return;
+ regno = regname[1] - '0' + D0_REGNUM;
+ break;
+ case 'A':
+ if (regname[1] < '0' || regname[1] > '7')
+ return;
+ regno = regname[1] - '0' + A0_REGNUM;
+ break;
+ default:
+ return;
+ }
+
+ monitor_supply_register (regno, val);
+}
+
+/* This array of registers needs to match the indexes used by GDB. The
+ whole reason this exists is because the various ROM monitors use
+ different names than GDB does, and don't support all the registers
+ either. So, typing "info reg sp" becomes an "A7". */
+
+static char *dbug_regnames[NUM_REGS] =
+{
+ "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
+ "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7",
+ "SR", "PC"
+ /* no float registers */
+};
+static struct target_ops dbug_ops;
+static struct monitor_ops dbug_cmds ;
+
+static char *dbug_inits[] = {"\r", NULL};
+
+
+static void
+init_dbug_cmds(void)
+{
+ dbug_cmds.flags = MO_CLR_BREAK_USES_ADDR | MO_GETMEM_NEEDS_RANGE | MO_FILL_USES_ADDR;
+ dbug_cmds.init = dbug_inits; /* Init strings */
+ dbug_cmds.cont = "go\r"; /* continue command */
+ dbug_cmds.step = "step\r"; /* single step */
+ dbug_cmds.stop = NULL; /* interrupt command */
+ dbug_cmds.set_break = "br %x\r"; /* set a breakpoint */
+ dbug_cmds.clr_break = "br -c %x\r"; /* clear a breakpoint */
+ dbug_cmds.clr_all_break = "br -c\r"; /* clear all breakpoints */
+ dbug_cmds.fill = "bf.b %x %x %x"; /* fill (start end val) */
+ dbug_cmds.setmem.cmdb = "mm.b %x %x\r"; /* setmem.cmdb (addr, value) */
+ dbug_cmds.setmem.cmdw = "mm.w %x %x\r"; /* setmem.cmdw (addr, value) */
+ dbug_cmds.setmem.cmdl = "mm.l %x %x\r"; /* setmem.cmdl (addr, value) */
+ dbug_cmds.setmem.cmdll = NULL; /* setmem.cmdll (addr, value) */
+ dbug_cmds.setmem.resp_delim = NULL; /* setmem.resp_delim */
+ dbug_cmds.setmem.term = NULL; /* setmem.term */
+ dbug_cmds.setmem.term_cmd = NULL; /* setmem.term_cmd */
+ dbug_cmds.getmem.cmdb = "md.b %x %x\r"; /* getmem.cmdb (addr, addr2) */
+ dbug_cmds.getmem.cmdw = "md.w %x %x\r"; /* getmem.cmdw (addr, addr2) */
+ dbug_cmds.getmem.cmdl = "md.l %x %x\r"; /* getmem.cmdl (addr, addr2) */
+ dbug_cmds.getmem.cmdll = NULL; /* getmem.cmdll (addr, addr2) */
+ dbug_cmds.getmem.resp_delim = ":"; /* getmem.resp_delim */
+ dbug_cmds.getmem.term = NULL; /* getmem.term */
+ dbug_cmds.getmem.term_cmd = NULL; /* getmem.term_cmd */
+ dbug_cmds.setreg.cmd = "rm %s %x\r"; /* setreg.cmd (name, value) */
+ dbug_cmds.setreg.resp_delim = NULL; /* setreg.resp_delim */
+ dbug_cmds.setreg.term = NULL; /* setreg.term */
+ dbug_cmds.setreg.term_cmd = NULL; /* setreg.term_cmd */
+ dbug_cmds.getreg.cmd = "rd %s\r"; /* getreg.cmd (name) */
+ dbug_cmds.getreg.resp_delim = ":"; /* getreg.resp_delim */
+ dbug_cmds.getreg.term = NULL; /* getreg.term */
+ dbug_cmds.getreg.term_cmd = NULL; /* getreg.term_cmd */
+ dbug_cmds.dump_registers = "rd\r"; /* dump_registers */
+ dbug_cmds.register_pattern = "\\(\\w+\\) +:\\([0-9a-fA-F]+\\b\\)"; /* register_pattern */
+ dbug_cmds.supply_register = dbug_supply_register; /* supply_register */
+ dbug_cmds.load_routine = NULL; /* load_routine (defaults to SRECs) */
+ dbug_cmds.load = "dl\r"; /* download command */
+ dbug_cmds.loadresp = "\n"; /* load response */
+ dbug_cmds.prompt = "dBUG>"; /* monitor command prompt */
+ dbug_cmds.line_term = "\r"; /* end-of-line terminator */
+ dbug_cmds.cmd_end = NULL; /* optional command terminator */
+ dbug_cmds.target = &dbug_ops ; /* target operations */
+ dbug_cmds.stopbits = SERIAL_1_STOPBITS; /* number of stop bits */
+ dbug_cmds.regnames = dbug_regnames; /* registers names */
+ dbug_cmds.magic = MONITOR_OPS_MAGIC ; /* magic */
+} /* init_debug_ops */
+
+static void
+dbug_open(args, from_tty)
+ char *args;
+ int from_tty;
+{
+ monitor_open (args, &dbug_cmds, from_tty);
+}
+
+void
+_initialize_dbug_rom ()
+{
+ init_dbug_cmds() ;
+ init_monitor_ops (&dbug_ops);
+
+ dbug_ops.to_shortname = "dbug";
+ dbug_ops.to_longname = "dBUG monitor";
+ dbug_ops.to_doc = "Debug via the dBUG monitor.\n\
+Specify the serial device it is connected to (e.g. /dev/ttya).";
+ dbug_ops.to_open = dbug_open;
+
+ add_target (&dbug_ops);
+}
diff --git a/contrib/gdb/gdb/debugify.c b/contrib/gdb/gdb/debugify.c
new file mode 100644
index 000000000000..841b58913948
--- /dev/null
+++ b/contrib/gdb/gdb/debugify.c
@@ -0,0 +1,109 @@
+
+/* Debug macros for developemnt.
+ Copyright 1997
+ Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+This program 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#define DEBUGIFY
+#include "debugify.h"
+#include "config.h"
+
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#define REDIRECT
+
+static FILE *fout = NULL;
+static char fname[128];
+static int file_cnt = 0; /* count number of open files */
+
+void
+puts_dbg (data)
+ const char *data;
+{
+ FILE *fdbg;
+
+ fdbg = fopen ("dbg.log", "a+");
+ if (fdbg == NULL)
+ return;
+ fprintf (fdbg, data);
+ fclose (fdbg);
+}
+
+/* Can't easily get the message back to gdb... write to a log instead. */
+void
+fputs_dbg (data, fakestream)
+ const char *data;
+ FILE *fakestream;
+{
+#ifdef REDIRECT
+ puts_dbg (data);
+#else /* REDIRECT */
+
+ if (fakestream == stdout || fakestream == stderr || fakestream == NULL)
+ {
+ if (fout == NULL)
+ {
+ for (file_cnt = 0; file_cnt < 20; file_cnt++)
+ {
+ sprintf (fname, "dbg%d.log", file_cnt);
+ if ((fout = fopen (fname), "r") != NULL)
+ fclose (fout);
+ else
+ break;
+ }
+ fout = fopen (fname, "w");
+ if (fout == NULL)
+ return;
+ }
+ fakestream = fout;
+ }
+ fprintf (fakestream, data);
+ fflush (fakestream);
+#endif /* REDIRECT */
+}
+
+void
+#ifdef ANSI_PROTOTYPES
+printf_dbg (const char *format,...)
+#else
+printf_dbg (va_alist)
+ va_dcl
+#endif
+{
+ va_list args;
+ char buf[256];
+#ifdef ANSI_PROTOTYPES
+ va_start (args, format);
+#else
+ char *format;
+
+ va_start (args);
+ format = va_arg (args, char *);
+#endif
+ vsprintf (buf, format, args);
+ puts_dbg (buf);
+ va_end (args);
+}
diff --git a/contrib/gdb/gdb/debugify.h b/contrib/gdb/gdb/debugify.h
new file mode 100644
index 000000000000..b4ae92bc93b7
--- /dev/null
+++ b/contrib/gdb/gdb/debugify.h
@@ -0,0 +1,83 @@
+
+/* Debug macros for development.
+ Copyright 1997
+ Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+This program 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifndef _DEBUGIFY_H_
+#define _DEBUGIFY_H_
+
+#include "ansidecl.h"
+
+#ifdef ANSI_PROTOTYPES
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+
+#ifdef DEBUGIFY
+#include <assert.h>
+#ifdef TO_SCREEN
+#ifdef _Win32
+#define DBG(x) OutputDebugString x
+#else
+#define DBG(x) printf x
+#endif
+#elif TO_GDB
+#define DBG(x) printf_unfiltered x
+#elif TO_POPUP
+#ifdef _Win32
+#define DBG(x) MessageBox x
+#else
+#define DBG(x) printf x
+#endif
+#else /* default: TO_FILE "gdb.log" */
+#define DBG(x) printf_dbg x
+#endif
+
+#define ASSERT(x) assert(x)
+
+#else /* DEBUGIFY */
+#define DBG(x)
+#define ASSERT(x)
+#endif
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#ifdef REDIRECT
+#define printf_unfiltered printf_dbg
+#define fputs_unfiltered fputs_dbg
+ extern void fputs_dbg PARAMS ((const char *fmt, FILE * fakestream));
+#endif /* REDIRECT */
+
+ extern void puts_dbg PARAMS ((const char *fmt));
+#ifdef ANSI_PROTOTYPES
+ extern void printf_dbg PARAMS ((const char *fmt,...));
+#else
+ extern void printf_dbg PARAMS ((va_alist va_dcl));
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _DEBUGIFY_H_ */
diff --git a/contrib/gdb/gdb/dve3900-rom.c b/contrib/gdb/gdb/dve3900-rom.c
new file mode 100644
index 000000000000..c76da776d60a
--- /dev/null
+++ b/contrib/gdb/gdb/dve3900-rom.c
@@ -0,0 +1,962 @@
+/* Remote debugging interface for Densan DVE-R3900 ROM monitor for
+ GDB, the GNU debugger.
+ Copyright 1997 Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+This program 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#include "defs.h"
+#include "gdbcore.h"
+#include "target.h"
+#include "monitor.h"
+#include "serial.h"
+#include "inferior.h"
+#include "command.h"
+#include "gdb_string.h"
+#include <time.h>
+
+/* Type of function passed to bfd_map_over_sections. */
+
+typedef void (*section_map_func) PARAMS ((bfd *abfd, asection *sect, PTR obj));
+
+/* Packet escape character used by Densan monitor. */
+
+#define PESC 0xdc
+
+/* Maximum packet size. This is actually smaller than necessary
+ just to be safe. */
+
+#define MAXPSIZE 1024
+
+/* External functions. */
+
+extern void report_transfer_performance PARAMS ((unsigned long,
+ time_t, time_t));
+
+/* Certain registers are "bitmapped", in that the monitor can only display
+ them or let the user modify them as a series of named bitfields.
+ This structure describes a field in a bitmapped register. */
+
+struct bit_field
+{
+ char *prefix; /* string appearing before the value */
+ char *suffix; /* string appearing after the value */
+ char *user_name; /* name used by human when entering field value */
+ int length; /* number of bits in the field */
+ int start; /* starting (least significant) bit number of field */
+};
+
+/* Local functions for register manipulation. */
+
+static void r3900_supply_register PARAMS ((char *regname, int regnamelen,
+ char *val, int vallen));
+static void fetch_bad_vaddr PARAMS ((void));
+static unsigned long fetch_fields PARAMS ((struct bit_field *bf));
+static void fetch_bitmapped_register PARAMS ((int regno,
+ struct bit_field *bf));
+static void r3900_fetch_registers PARAMS ((int regno));
+static void store_bitmapped_register PARAMS ((int regno,
+ struct bit_field *bf));
+static void r3900_store_registers PARAMS ((int regno));
+
+/* Local functions for fast binary loading. */
+
+static void write_long PARAMS ((char *buf, long n));
+static void write_long_le PARAMS ((char *buf, long n));
+static int debug_readchar PARAMS ((int hex));
+static void debug_write PARAMS ((unsigned char *buf, int buflen));
+static void ignore_packet PARAMS ((void));
+static void send_packet PARAMS ((char type, unsigned char *buf, int buflen,
+ int seq));
+static void process_read_request PARAMS ((unsigned char *buf, int buflen));
+static void count_section PARAMS ((bfd *abfd, asection *s,
+ unsigned int *section_count));
+static void load_section PARAMS ((bfd *abfd, asection *s,
+ unsigned int *data_count));
+static void r3900_load PARAMS ((char *filename, int from_tty));
+
+/* Miscellaneous local functions. */
+
+static void r3900_open PARAMS ((char *args, int from_tty));
+
+
+/* Pointers to static functions in monitor.c for fetching and storing
+ registers. We can't use these function in certain cases where the Densan
+ monitor acts perversely: for registers that it displays in bit-map
+ format, and those that can't be modified at all. In those cases
+ we have to use our own functions to fetch and store their values. */
+
+static void (*orig_monitor_fetch_registers) PARAMS ((int regno));
+static void (*orig_monitor_store_registers) PARAMS ((int regno));
+
+/* Pointer to static function in monitor. for loading programs.
+ We use this function for loading S-records via the serial link. */
+
+static void (*orig_monitor_load) PARAMS ((char *file, int from_tty));
+
+/* This flag is set if a fast ethernet download should be used. */
+
+static int ethernet = 0;
+
+/* This array of registers needs to match the indexes used by GDB. The
+ whole reason this exists is because the various ROM monitors use
+ different names than GDB does, and don't support all the registers
+ either. */
+
+static char *r3900_regnames[NUM_REGS] =
+{
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
+ "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
+ "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
+ "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
+
+ "S", /* PS_REGNUM */
+ "l", /* LO_REGNUM */
+ "h", /* HI_REGNUM */
+ "B", /* BADVADDR_REGNUM */
+ "Pcause", /* CAUSE_REGNUM */
+ "p" /* PC_REGNUM */
+};
+
+
+/* Table of register names produced by monitor's register dump command. */
+
+static struct reg_entry
+{
+ char *name;
+ int regno;
+} reg_table[] =
+{
+ { "r0_zero", 0 }, { "r1_at", 1 }, { "r2_v0", 2 }, { "r3_v1", 3 },
+ { "r4_a0", 4 }, { "r5_a1", 5 }, { "r6_a2", 6 }, { "r7_a3", 7 },
+ { "r8_t0", 8 }, { "r9_t1", 9 }, { "r10_t2", 10 }, { "r11_t3", 11 },
+ { "r12_t4", 12 }, { "r13_t5", 13 }, { "r14_t6", 14 }, { "r15_t7", 15 },
+ { "r16_s0", 16 }, { "r17_s1", 17 }, { "r18_s2", 18 }, { "r19_s3", 19 },
+ { "r20_s4", 20 }, { "r21_s5", 21 }, { "r22_s6", 22 }, { "r23_s7", 23 },
+ { "r24_t8", 24 }, { "r25_t9", 25 }, { "r26_k0", 26 }, { "r27_k1", 27 },
+ { "r28_gp", 28 }, { "r29_sp", 29 }, { "r30_fp", 30 }, { "r31_ra", 31 },
+ { "HI", HI_REGNUM },
+ { "LO", LO_REGNUM },
+ { "PC", PC_REGNUM },
+ { "BadV", BADVADDR_REGNUM },
+ { NULL, 0 }
+};
+
+
+/* The monitor displays the cache register along with the status register,
+ as if they were a single register. So when we want to fetch the
+ status register, parse but otherwise ignore the fields of the
+ cache register that the monitor displays. Register fields that should
+ be ignored have a length of zero in the tables below. */
+
+static struct bit_field status_fields [] =
+{
+ /* Status register portion */
+ { "SR[<CU=", " ", "cu", 4, 28 },
+ { "RE=", " ", "re", 1, 25 },
+ { "BEV=", " ", "bev", 1, 22 },
+ { "TS=", " ", "ts", 1, 21 },
+ { "Nmi=", " ", "nmi", 1, 20 },
+ { "INT=", " ", "int", 6, 10 },
+ { "SW=", ">]", "sw", 2, 8 },
+ { "[<KUO=", " ", "kuo", 1, 5 },
+ { "IEO=", " ", "ieo", 1, 4 },
+ { "KUP=", " ", "kup", 1, 3 },
+ { "IEP=", " ", "iep", 1, 2 },
+ { "KUC=", " ", "kuc", 1, 1 },
+ { "IEC=", ">]", "iec", 1, 0 },
+
+ /* Cache register portion (dummy for parsing only) */
+ { "CR[<IalO="," ", "ialo", 0, 13 },
+ { "DalO=", " ", "dalo", 0, 12 },
+ { "IalP=", " ", "ialp", 0, 11 },
+ { "DalP=", " ", "dalp", 0, 10 },
+ { "IalC=", " ", "ialc", 0, 9 },
+ { "DalC=", ">] ", "dalc", 0, 8 },
+
+ { NULL, NULL, 0, 0 } /* end of table marker */
+};
+
+
+#if 0 /* FIXME: Enable when we add support for modifying cache register. */
+static struct bit_field cache_fields [] =
+{
+ /* Status register portion (dummy for parsing only) */
+ { "SR[<CU=", " ", "cu", 0, 28 },
+ { "RE=", " ", "re", 0, 25 },
+ { "BEV=", " ", "bev", 0, 22 },
+ { "TS=", " ", "ts", 0, 21 },
+ { "Nmi=", " ", "nmi", 0, 20 },
+ { "INT=", " ", "int", 0, 10 },
+ { "SW=", ">]", "sw", 0, 8 },
+ { "[<KUO=", " ", "kuo", 0, 5 },
+ { "IEO=", " ", "ieo", 0, 4 },
+ { "KUP=", " ", "kup", 0, 3 },
+ { "IEP=", " ", "iep", 0, 2 },
+ { "KUC=", " ", "kuc", 0, 1 },
+ { "IEC=", ">]", "iec", 0, 0 },
+
+ /* Cache register portion */
+ { "CR[<IalO="," ", "ialo", 1, 13 },
+ { "DalO=", " ", "dalo", 1, 12 },
+ { "IalP=", " ", "ialp", 1, 11 },
+ { "DalP=", " ", "dalp", 1, 10 },
+ { "IalC=", " ", "ialc", 1, 9 },
+ { "DalC=", ">] ", "dalc", 1, 8 },
+
+ { NULL, NULL, NULL, 0, 0 } /* end of table marker */
+};
+#endif
+
+
+static struct bit_field cause_fields[] =
+{
+ { "<BD=", " ", "bd", 1, 31 },
+ { "CE=", " ", "ce", 2, 28 },
+ { "IP=", " ", "ip", 6, 10 },
+ { "SW=", " ", "sw", 2, 8 },
+ { "EC=", ">]" , "ec", 5, 2 },
+
+ { NULL, NULL, NULL, 0, 0 } /* end of table marker */
+};
+
+
+/* The monitor prints register values in the form
+
+ regname = xxxx xxxx
+
+ We look up the register name in a table, and remove the embedded space in
+ the hex value before passing it to monitor_supply_register. */
+
+static void
+r3900_supply_register (regname, regnamelen, val, vallen)
+ char *regname;
+ int regnamelen;
+ char *val;
+ int vallen;
+{
+ int regno = -1;
+ int i;
+ char valbuf[10];
+ char *p;
+
+ /* Perform some sanity checks on the register name and value. */
+ if (regnamelen < 2 || regnamelen > 7 || vallen != 9)
+ return;
+
+ /* Look up the register name. */
+ for (i = 0; reg_table[i].name != NULL; i++)
+ {
+ int rlen = strlen (reg_table[i].name);
+ if (rlen == regnamelen && strncmp (regname, reg_table[i].name, rlen) == 0)
+ {
+ regno = reg_table[i].regno;
+ break;
+ }
+ }
+ if (regno == -1)
+ return;
+
+ /* Copy the hex value to a buffer and eliminate the embedded space. */
+ for (i = 0, p = valbuf; i < vallen; i++)
+ if (val[i] != ' ')
+ *p++ = val[i];
+ *p = '\0';
+
+ monitor_supply_register (regno, valbuf);
+}
+
+
+/* Fetch the BadVaddr register. Unlike the other registers, this
+ one can't be modified, and the monitor won't even prompt to let
+ you modify it. */
+
+static void
+fetch_bad_vaddr()
+{
+ char buf[20];
+
+ monitor_printf ("xB\r");
+ monitor_expect ("BadV=", NULL, 0);
+ monitor_expect_prompt (buf, sizeof(buf));
+ monitor_supply_register (BADVADDR_REGNUM, buf);
+}
+
+
+/* Read a series of bit fields from the monitor, and return their
+ combined binary value. */
+
+static unsigned long
+fetch_fields (bf)
+ struct bit_field *bf;
+{
+ char buf[20];
+ unsigned long val = 0;
+ unsigned long bits;
+
+ for ( ; bf->prefix != NULL; bf++)
+ {
+ monitor_expect (bf->prefix, NULL, 0); /* get prefix */
+ monitor_expect (bf->suffix, buf, sizeof (buf)); /* hex value, suffix */
+ if (bf->length != 0)
+ {
+ bits = strtoul (buf, NULL, 16); /* get field value */
+ bits &= ((1 << bf->length) - 1); /* mask out useless bits */
+ val |= bits << bf->start; /* insert into register */
+ }
+
+ }
+
+ return val;
+}
+
+
+static void
+fetch_bitmapped_register (regno, bf)
+ int regno;
+ struct bit_field *bf;
+{
+ unsigned long val;
+ unsigned char regbuf[MAX_REGISTER_RAW_SIZE];
+
+ monitor_printf ("x%s\r", r3900_regnames[regno]);
+ val = fetch_fields (bf);
+ monitor_printf (".\r");
+ monitor_expect_prompt (NULL, 0);
+
+ /* supply register stores in target byte order, so swap here */
+
+ store_unsigned_integer (regbuf, REGISTER_RAW_SIZE (regno), val);
+ supply_register (regno, regbuf);
+
+}
+
+
+/* Fetch all registers (if regno is -1), or one register from the
+ monitor. For most registers, we can use the generic monitor_
+ monitor_fetch_registers function. But others are displayed in
+ a very unusual fashion by the monitor, and must be handled specially. */
+
+static void
+r3900_fetch_registers (regno)
+ int regno;
+{
+ switch (regno)
+ {
+ case BADVADDR_REGNUM:
+ fetch_bad_vaddr ();
+ return;
+ case PS_REGNUM:
+ fetch_bitmapped_register (PS_REGNUM, status_fields);
+ return;
+ case CAUSE_REGNUM:
+ fetch_bitmapped_register (CAUSE_REGNUM, cause_fields);
+ return;
+ default:
+ orig_monitor_fetch_registers (regno);
+ }
+}
+
+
+/* Write the new value of the bitmapped register to the monitor. */
+
+static void
+store_bitmapped_register (regno, bf)
+ int regno;
+ struct bit_field *bf;
+{
+ unsigned long oldval, newval;
+
+ /* Fetch the current value of the register. */
+ monitor_printf ("x%s\r", r3900_regnames[regno]);
+ oldval = fetch_fields (bf);
+ newval = read_register (regno);
+
+ /* To save time, write just the fields that have changed. */
+ for ( ; bf->prefix != NULL; bf++)
+ {
+ if (bf->length != 0)
+ {
+ unsigned long oldbits, newbits, mask;
+
+ mask = (1 << bf->length) - 1;
+ oldbits = (oldval >> bf->start) & mask;
+ newbits = (newval >> bf->start) & mask;
+ if (oldbits != newbits)
+ monitor_printf ("%s %x ", bf->user_name, newbits);
+ }
+ }
+
+ monitor_printf (".\r");
+ monitor_expect_prompt (NULL, 0);
+}
+
+
+static void
+r3900_store_registers (regno)
+ int regno;
+{
+ switch (regno)
+ {
+ case PS_REGNUM:
+ store_bitmapped_register (PS_REGNUM, status_fields);
+ return;
+ case CAUSE_REGNUM:
+ store_bitmapped_register (CAUSE_REGNUM, cause_fields);
+ return;
+ default:
+ orig_monitor_store_registers (regno);
+ }
+}
+
+
+/* Write a 4-byte integer to the buffer in big-endian order. */
+
+static void
+write_long (buf, n)
+ char *buf;
+ long n;
+{
+ buf[0] = (n >> 24) & 0xff;
+ buf[1] = (n >> 16) & 0xff;
+ buf[2] = (n >> 8) & 0xff;
+ buf[3] = n & 0xff;
+}
+
+
+/* Write a 4-byte integer to the buffer in little-endian order. */
+
+static void
+write_long_le (buf, n)
+ char *buf;
+ long n;
+{
+ buf[0] = n & 0xff;
+ buf[1] = (n >> 8) & 0xff;
+ buf[2] = (n >> 16) & 0xff;
+ buf[3] = (n >> 24) & 0xff;
+}
+
+
+/* Read a character from the monitor. If remote debugging is on,
+ print the received character. If HEX is non-zero, print the
+ character in hexadecimal; otherwise, print it in ASCII. */
+
+static int
+debug_readchar (hex)
+ int hex;
+{
+ char buf [10];
+ int c = monitor_readchar ();
+
+ if (remote_debug > 0)
+ {
+ if (hex)
+ sprintf (buf, "[%02x]", c & 0xff);
+ else if (c == '\0')
+ strcpy (buf, "\\0");
+ else
+ {
+ buf[0] = c;
+ buf[1] = '\0';
+ }
+ puts_debug ("Read -->", buf, "<--");
+ }
+ return c;
+}
+
+
+/* Send a buffer of characters to the monitor. If remote debugging is on,
+ print the sent buffer in hex. */
+
+static void
+debug_write (buf, buflen)
+ unsigned char *buf;
+ int buflen;
+{
+ char s[10];
+
+ monitor_write (buf, buflen);
+
+ if (remote_debug > 0)
+ {
+ while (buflen-- > 0)
+ {
+ sprintf (s, "[%02x]", *buf & 0xff);
+ puts_debug ("Sent -->", s, "<--");
+ buf++;
+ }
+ }
+}
+
+
+/* Ignore a packet sent to us by the monitor. It send packets
+ when its console is in "communications interface" mode. A packet
+ is of this form:
+
+ start of packet flag (one byte: 0xdc)
+ packet type (one byte)
+ length (low byte)
+ length (high byte)
+ data (length bytes)
+
+ The last two bytes of the data field are a checksum, but we don't
+ bother to verify it.
+*/
+
+static void
+ignore_packet ()
+{
+ int c;
+ int len;
+
+ /* Ignore lots of trash (messages about section addresses, for example)
+ until we see the start of a packet. */
+ for (len = 0; len < 256; len++)
+ {
+ c = debug_readchar (0);
+ if (c == PESC)
+ break;
+ }
+ if (len == 8)
+ error ("Packet header byte not found; %02x seen instead.", c);
+
+ /* Read the packet type and length. */
+ c = debug_readchar (1); /* type */
+
+ c = debug_readchar (1); /* low byte of length */
+ len = c & 0xff;
+
+ c = debug_readchar (1); /* high byte of length */
+ len += (c & 0xff) << 8;
+
+ /* Ignore the rest of the packet. */
+ while (len-- > 0)
+ c = debug_readchar (1);
+}
+
+
+/* Encapsulate some data into a packet and send it to the monitor.
+
+ The 'p' packet is a special case. This is a packet we send
+ in response to a read ('r') packet from the monitor. This function
+ appends a one-byte sequence number to the data field of such a packet.
+*/
+
+static void
+send_packet (type, buf, buflen, seq)
+ char type;
+ unsigned char *buf;
+ int buflen, seq;
+{
+ unsigned char hdr[4];
+ int len = buflen;
+ int sum, i;
+
+ /* If this is a 'p' packet, add one byte for a sequence number. */
+ if (type == 'p')
+ len++;
+
+ /* If the buffer has a non-zero length, add two bytes for a checksum. */
+ if (len > 0)
+ len += 2;
+
+ /* Write the packet header. */
+ hdr[0] = PESC;
+ hdr[1] = type;
+ hdr[2] = len & 0xff;
+ hdr[3] = (len >> 8) & 0xff;
+ debug_write (hdr, sizeof (hdr));
+
+ if (len)
+ {
+ /* Write the packet data. */
+ debug_write (buf, buflen);
+
+ /* Write the sequence number if this is a 'p' packet. */
+ if (type == 'p')
+ {
+ hdr[0] = seq;
+ debug_write (hdr, 1);
+ }
+
+ /* Write the checksum. */
+ sum = 0;
+ for (i = 0; i < buflen; i++)
+ {
+ int tmp = (buf[i] & 0xff);
+ if (i & 1)
+ sum += tmp;
+ else
+ sum += tmp << 8;
+ }
+ if (type == 'p')
+ {
+ if (buflen & 1)
+ sum += (seq & 0xff);
+ else
+ sum += (seq & 0xff) << 8;
+ }
+ sum = (sum & 0xffff) + ((sum >> 16) & 0xffff);
+ sum += (sum >> 16) & 1;
+ sum = ~sum;
+
+ hdr[0] = (sum >> 8) & 0xff;
+ hdr[1] = sum & 0xff;
+ debug_write (hdr, 2);
+ }
+}
+
+
+/* Respond to an expected read request from the monitor by sending
+ data in chunks. Handle all acknowledgements and handshaking packets.
+
+ The monitor expects a response consisting of a one or more 'p' packets,
+ each followed by a portion of the data requested. The 'p' packet
+ contains only a four-byte integer, the value of which is the number
+ of bytes of data we are about to send. Following the 'p' packet,
+ the monitor expects the data bytes themselves in raw, unpacketized,
+ form, without even a checksum.
+ */
+
+static void
+process_read_request (buf, buflen)
+ unsigned char *buf;
+ int buflen;
+{
+ unsigned char len[4];
+ int i, chunk;
+ unsigned char seq;
+
+ /* Discard the read request. FIXME: we have to hope it's for
+ the exact number of bytes we want to send; should check for this. */
+ ignore_packet ();
+
+ for (i = chunk = 0, seq = 0; i < buflen; i += chunk, seq++)
+ {
+ /* Don't send more than MAXPSIZE bytes at a time. */
+ chunk = buflen - i;
+ if (chunk > MAXPSIZE)
+ chunk = MAXPSIZE;
+
+ /* Write a packet containing the number of bytes we are sending. */
+ write_long_le (len, chunk);
+ send_packet ('p', len, sizeof (len), seq);
+
+ /* Write the data in raw form following the packet. */
+ debug_write (&buf[i], chunk);
+
+ /* Discard the ACK packet. */
+ ignore_packet ();
+ }
+
+ /* Send an "end of data" packet. */
+ send_packet ('e', "", 0, 0);
+}
+
+
+/* Count loadable sections (helper function for r3900_load). */
+
+static void
+count_section (abfd, s, section_count)
+ bfd *abfd;
+ asection *s;
+ unsigned int *section_count;
+{
+ if (s->flags & SEC_LOAD && bfd_section_size (abfd, s) != 0)
+ (*section_count)++;
+}
+
+
+/* Load a single BFD section (helper function for r3900_load).
+
+ WARNING: this code is filled with assumptions about how
+ the Densan monitor loads programs. The monitor issues
+ packets containing read requests, but rather than respond
+ to them in an general way, we expect them to following
+ a certain pattern.
+
+ For example, we know that the monitor will start loading by
+ issuing an 8-byte read request for the binary file header.
+ We know this is coming and ignore the actual contents
+ of the read request packet.
+*/
+
+static void
+load_section (abfd, s, data_count)
+ bfd *abfd;
+ asection *s;
+ unsigned int *data_count;
+{
+ if (s->flags & SEC_LOAD)
+ {
+ bfd_size_type section_size = bfd_section_size (abfd, s);
+ bfd_vma section_base = bfd_section_lma (abfd, s);
+ unsigned char *buffer;
+ unsigned char header[8];
+
+ /* Don't output zero-length sections. */
+ if (section_size == 0)
+ return;
+ if (data_count)
+ *data_count += section_size;
+
+ /* Print some fluff about the section being loaded. */
+ printf_filtered ("Loading section %s, size 0x%lx lma ",
+ bfd_section_name (abfd, s), (long)section_size);
+ print_address_numeric (section_base, 1, gdb_stdout);
+ printf_filtered ("\n");
+ gdb_flush (gdb_stdout);
+
+ /* Write the section header (location and size). */
+ write_long (&header[0], (long)section_base);
+ write_long (&header[4], (long)section_size);
+ process_read_request (header, sizeof (header));
+
+ /* Read the section contents into a buffer, write it out,
+ then free the buffer. */
+ buffer = (unsigned char *) xmalloc (section_size);
+ bfd_get_section_contents (abfd, s, buffer, 0, section_size);
+ process_read_request (buffer, section_size);
+ free (buffer);
+ }
+}
+
+
+/* When the ethernet is used as the console port on the Densan board,
+ we can use the "Rm" command to do a fast binary load. The format
+ of the download data is:
+
+ number of sections (4 bytes)
+ starting address (4 bytes)
+ repeat for each section:
+ location address (4 bytes)
+ section size (4 bytes)
+ binary data
+
+ The 4-byte fields are all in big-endian order.
+
+ Using this command is tricky because we have to put the monitor
+ into a special funky "communications interface" mode, in which
+ it sends and receives packets of data along with the normal prompt.
+ */
+
+static void
+r3900_load (filename, from_tty)
+ char *filename;
+ int from_tty;
+{
+ bfd *abfd;
+ unsigned int data_count = 0;
+ time_t start_time, end_time; /* for timing of download */
+ int section_count = 0;
+ unsigned char buffer[8];
+
+ /* If we are not using the ethernet, use the normal monitor load,
+ which sends S-records over the serial link. */
+ if (!ethernet)
+ {
+ orig_monitor_load (filename, from_tty);
+ return;
+ }
+
+ /* Open the file. */
+ if (filename == NULL || filename[0] == 0)
+ filename = get_exec_file (1);
+ abfd = bfd_openr (filename, 0);
+ if (!abfd)
+ error ("Unable to open file %s\n", filename);
+ if (bfd_check_format (abfd, bfd_object) == 0)
+ error ("File is not an object file\n");
+
+ /* Output the "vconsi" command to get the monitor in the communication
+ state where it will accept a load command. This will cause
+ the monitor to emit a packet before each prompt, so ignore the packet. */
+ monitor_printf ("vconsi\r");
+ ignore_packet ();
+ monitor_expect_prompt (NULL, 0);
+
+ /* Output the "Rm" (load) command and respond to the subsequent "open"
+ packet by sending an ACK packet. */
+ monitor_printf ("Rm\r");
+ ignore_packet ();
+ send_packet ('a', "", 0, 0);
+
+ /* Output the fast load header (number of sections and starting address). */
+ bfd_map_over_sections ((bfd *) abfd, (section_map_func) count_section,
+ &section_count);
+ write_long (&buffer[0], (long)section_count);
+ if (exec_bfd)
+ write_long (&buffer[4], (long)bfd_get_start_address (exec_bfd));
+ else
+ write_long (&buffer[4], 0);
+ process_read_request (buffer, sizeof (buffer));
+
+ /* Output the section data. */
+ start_time = time (NULL);
+ bfd_map_over_sections (abfd, (section_map_func) load_section, &data_count);
+ end_time = time (NULL);
+
+ /* Acknowledge the close packet and put the monitor back into
+ "normal" mode so it won't send packets any more. */
+ ignore_packet ();
+ send_packet ('a', "", 0, 0);
+ monitor_expect_prompt (NULL, 0);
+ monitor_printf ("vconsx\r");
+ monitor_expect_prompt (NULL, 0);
+
+ /* Print start address and download performance information. */
+ printf_filtered ("Start address 0x%lx\n", (long)bfd_get_start_address (abfd));
+ report_transfer_performance (data_count, start_time, end_time);
+
+ /* Finally, make the PC point at the start address */
+ if (exec_bfd)
+ write_pc (bfd_get_start_address (exec_bfd));
+
+ inferior_pid = 0; /* No process now */
+
+ /* This is necessary because many things were based on the PC at the
+ time that we attached to the monitor, which is no longer valid
+ now that we have loaded new code (and just changed the PC).
+ Another way to do this might be to call normal_stop, except that
+ the stack may not be valid, and things would get horribly
+ confused... */
+ clear_symtab_users ();
+}
+
+
+/* Commands to send to the monitor when first connecting:
+ * The bare carriage return forces a prompt from the monitor
+ (monitor doesn't prompt immediately after a reset).
+ * The "vconsx" switches the monitor back to interactive mode
+ in case an aborted download had left it in packet mode.
+ * The "Xtr" command causes subsequent "t" (trace) commands to display
+ the general registers only.
+ * The "Xxr" command does the same thing for the "x" (examine
+ registers) command.
+ * The "bx" command clears all breakpoints.
+*/
+
+static char *r3900_inits[] = {"\r", "vconsx\r", "Xtr\r", "Xxr\r", "bx\r", NULL};
+static char *dummy_inits[] = { NULL };
+
+static struct target_ops r3900_ops;
+static struct monitor_ops r3900_cmds;
+
+static void
+r3900_open (args, from_tty)
+ char *args;
+ int from_tty;
+{
+ char buf[64];
+ int i;
+
+ monitor_open (args, &r3900_cmds, from_tty);
+
+ /* We have to handle sending the init strings ourselves, because
+ the first two strings we send (carriage returns) may not be echoed
+ by the monitor, but the rest will be. */
+ monitor_printf_noecho ("\r\r");
+ for (i = 0; r3900_inits[i] != NULL; i++)
+ {
+ monitor_printf (r3900_inits[i]);
+ monitor_expect_prompt (NULL, 0);
+ }
+
+ /* Attempt to determine whether the console device is ethernet or serial.
+ This will tell us which kind of load to use (S-records over a serial
+ link, or the Densan fast binary multi-section format over the net). */
+
+ ethernet = 0;
+ monitor_printf ("v\r");
+ if (monitor_expect ("console device :", NULL, 0) != -1)
+ if (monitor_expect ("\n", buf, sizeof (buf)) != -1)
+ if (strstr (buf, "ethernet") != NULL)
+ ethernet = 1;
+ monitor_expect_prompt (NULL, 0);
+}
+
+void
+_initialize_r3900_rom ()
+{
+ r3900_cmds.flags = MO_NO_ECHO_ON_OPEN |
+ MO_ADDR_BITS_REMOVE |
+ MO_CLR_BREAK_USES_ADDR |
+ MO_GETMEM_READ_SINGLE |
+ MO_PRINT_PROGRAM_OUTPUT;
+
+ r3900_cmds.init = dummy_inits;
+ r3900_cmds.cont = "g\r";
+ r3900_cmds.step = "t\r";
+ r3900_cmds.set_break = "b %A\r"; /* COREADDR */
+ r3900_cmds.clr_break = "b %A,0\r"; /* COREADDR */
+ r3900_cmds.fill = "fx %A s %x %x\r"; /* COREADDR, len, val */
+
+ r3900_cmds.setmem.cmdb = "sx %A %x\r"; /* COREADDR, val */
+ r3900_cmds.setmem.cmdw = "sh %A %x\r"; /* COREADDR, val */
+ r3900_cmds.setmem.cmdl = "sw %A %x\r"; /* COREADDR, val */
+
+ r3900_cmds.getmem.cmdb = "sx %A\r"; /* COREADDR */
+ r3900_cmds.getmem.cmdw = "sh %A\r"; /* COREADDR */
+ r3900_cmds.getmem.cmdl = "sw %A\r"; /* COREADDR */
+ r3900_cmds.getmem.resp_delim = " : ";
+ r3900_cmds.getmem.term = " ";
+ r3900_cmds.getmem.term_cmd = ".\r";
+
+ r3900_cmds.setreg.cmd = "x%s %x\r"; /* regname, val */
+
+ r3900_cmds.getreg.cmd = "x%s\r"; /* regname */
+ r3900_cmds.getreg.resp_delim = "=";
+ r3900_cmds.getreg.term = " ";
+ r3900_cmds.getreg.term_cmd = ".\r";
+
+ r3900_cmds.dump_registers = "x\r";
+ r3900_cmds.register_pattern =
+ "\\([a-zA-Z0-9_]+\\) *=\\([0-9a-f]+ [0-9a-f]+\\b\\)";
+ r3900_cmds.supply_register = r3900_supply_register;
+ /* S-record download, via "keyboard port". */
+ r3900_cmds.load = "r0\r";
+ r3900_cmds.prompt = "#";
+ r3900_cmds.line_term = "\r";
+ r3900_cmds.target = &r3900_ops;
+ r3900_cmds.stopbits = SERIAL_1_STOPBITS;
+ r3900_cmds.regnames = r3900_regnames;
+ r3900_cmds.magic = MONITOR_OPS_MAGIC;
+
+ init_monitor_ops (&r3900_ops);
+
+ r3900_ops.to_shortname = "r3900";
+ r3900_ops.to_longname = "R3900 monitor";
+ r3900_ops.to_doc = "Debug using the DVE R3900 monitor.\n\
+Specify the serial device it is connected to (e.g. /dev/ttya).";
+ r3900_ops.to_open = r3900_open;
+
+ /* Override the functions to fetch and store registers. But save the
+ addresses of the default functions, because we will use those functions
+ for "normal" registers. */
+
+ orig_monitor_fetch_registers = r3900_ops.to_fetch_registers;
+ orig_monitor_store_registers = r3900_ops.to_store_registers;
+ r3900_ops.to_fetch_registers = r3900_fetch_registers;
+ r3900_ops.to_store_registers = r3900_store_registers;
+
+ /* Override the load function, but save the address of the default
+ function to use when loading S-records over a serial link. */
+ orig_monitor_load = r3900_ops.to_load;
+ r3900_ops.to_load = r3900_load;
+
+ add_target (&r3900_ops);
+}
diff --git a/contrib/gdb/gdb/mn10200-tdep.c b/contrib/gdb/gdb/mn10200-tdep.c
new file mode 100644
index 000000000000..cb7ead093137
--- /dev/null
+++ b/contrib/gdb/gdb/mn10200-tdep.c
@@ -0,0 +1,919 @@
+/* Target-dependent code for the Matsushita MN10200 for GDB, the GNU debugger.
+ Copyright 1997 Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+This program 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#include "defs.h"
+#include "frame.h"
+#include "inferior.h"
+#include "obstack.h"
+#include "target.h"
+#include "value.h"
+#include "bfd.h"
+#include "gdb_string.h"
+#include "gdbcore.h"
+#include "symfile.h"
+
+
+/* Should call_function allocate stack space for a struct return? */
+int
+mn10200_use_struct_convention (gcc_p, type)
+ int gcc_p;
+ struct type *type;
+{
+ return (TYPE_NFIELDS (type) > 1 || TYPE_LENGTH (type) > 8);
+}
+
+
+
+/* The main purpose of this file is dealing with prologues to extract
+ information about stack frames and saved registers.
+
+ For reference here's how prologues look on the mn10200:
+
+ With frame pointer:
+ mov fp,a0
+ mov sp,fp
+ add <size>,sp
+ Register saves for d2, d3, a1, a2 as needed. Saves start
+ at fp - <size> + <outgoing_args_size> and work towards higher
+ addresses. Note that the saves are actually done off the stack
+ pointer in the prologue! This makes for smaller code and easier
+ prologue scanning as the displacement fields will unlikely
+ be more than 8 bits!
+
+ Without frame pointer:
+ add <size>,sp
+ Register saves for d2, d3, a1, a2 as needed. Saves start
+ at sp + <outgoing_args_size> and work towards higher addresses.
+
+ Out of line prologue:
+ add <local size>,sp -- optional
+ jsr __prologue
+ add <outgoing_size>,sp -- optional
+
+ The stack pointer remains constant throughout the life of most
+ functions. As a result the compiler will usually omit the
+ frame pointer, so we must handle frame pointerless functions. */
+
+/* Analyze the prologue to determine where registers are saved,
+ the end of the prologue, etc etc. Return the end of the prologue
+ scanned.
+
+ We store into FI (if non-null) several tidbits of information:
+
+ * stack_size -- size of this stack frame. Note that if we stop in
+ certain parts of the prologue/epilogue we may claim the size of the
+ current frame is zero. This happens when the current frame has
+ not been allocated yet or has already been deallocated.
+
+ * fsr -- Addresses of registers saved in the stack by this frame.
+
+ * status -- A (relatively) generic status indicator. It's a bitmask
+ with the following bits:
+
+ MY_FRAME_IN_SP: The base of the current frame is actually in
+ the stack pointer. This can happen for frame pointerless
+ functions, or cases where we're stopped in the prologue/epilogue
+ itself. For these cases mn10200_analyze_prologue will need up
+ update fi->frame before returning or analyzing the register
+ save instructions.
+
+ MY_FRAME_IN_FP: The base of the current frame is in the
+ frame pointer register ($a2).
+
+ CALLER_A2_IN_A0: $a2 from the caller's frame is temporarily
+ in $a0. This can happen if we're stopped in the prologue.
+
+ NO_MORE_FRAMES: Set this if the current frame is "start" or
+ if the first instruction looks like mov <imm>,sp. This tells
+ frame chain to not bother trying to unwind past this frame. */
+
+#define MY_FRAME_IN_SP 0x1
+#define MY_FRAME_IN_FP 0x2
+#define CALLER_A2_IN_A0 0x4
+#define NO_MORE_FRAMES 0x8
+
+static CORE_ADDR
+mn10200_analyze_prologue (fi, pc)
+ struct frame_info *fi;
+ CORE_ADDR pc;
+{
+ CORE_ADDR func_addr, func_end, addr, stop;
+ CORE_ADDR stack_size;
+ unsigned char buf[4];
+ int status;
+ char *name;
+ int out_of_line_prologue = 0;
+
+ /* Use the PC in the frame if it's provided to look up the
+ start of this function. */
+ pc = (fi ? fi->pc : pc);
+
+ /* Find the start of this function. */
+ status = find_pc_partial_function (pc, &name, &func_addr, &func_end);
+
+ /* Do nothing if we couldn't find the start of this function or if we're
+ stopped at the first instruction in the prologue. */
+ if (status == 0)
+ return pc;
+
+ /* If we're in start, then give up. */
+ if (strcmp (name, "start") == 0)
+ {
+ if (fi)
+ fi->status = NO_MORE_FRAMES;
+ return pc;
+ }
+
+ /* At the start of a function our frame is in the stack pointer. */
+ if (fi)
+ fi->status = MY_FRAME_IN_SP;
+
+ /* If we're physically on an RTS instruction, then our frame has already
+ been deallocated.
+
+ fi->frame is bogus, we need to fix it. */
+ if (fi && fi->pc + 1 == func_end)
+ {
+ status = target_read_memory (fi->pc, buf, 1);
+ if (status != 0)
+ {
+ if (fi->next == NULL)
+ fi->frame = read_sp ();
+ return fi->pc;
+ }
+
+ if (buf[0] == 0xfe)
+ {
+ if (fi->next == NULL)
+ fi->frame = read_sp ();
+ return fi->pc;
+ }
+ }
+
+ /* Similarly if we're stopped on the first insn of a prologue as our
+ frame hasn't been allocated yet. */
+ if (fi && fi->pc == func_addr)
+ {
+ if (fi->next == NULL)
+ fi->frame = read_sp ();
+ return fi->pc;
+ }
+
+ /* Figure out where to stop scanning. */
+ stop = fi ? fi->pc : func_end;
+
+ /* Don't walk off the end of the function. */
+ stop = stop > func_end ? func_end : stop;
+
+ /* Start scanning on the first instruction of this function. */
+ addr = func_addr;
+
+ status = target_read_memory (addr, buf, 2);
+ if (status != 0)
+ {
+ if (fi && fi->next == NULL && fi->status & MY_FRAME_IN_SP)
+ fi->frame = read_sp ();
+ return addr;
+ }
+
+ /* First see if this insn sets the stack pointer; if so, it's something
+ we won't understand, so quit now. */
+ if (buf[0] == 0xdf
+ || (buf[0] == 0xf4 && buf[1] == 0x77))
+ {
+ if (fi)
+ fi->status = NO_MORE_FRAMES;
+ return addr;
+ }
+
+ /* Now see if we have a frame pointer.
+
+ Search for mov a2,a0 (0xf278)
+ then mov a3,a2 (0xf27e). */
+
+ if (buf[0] == 0xf2 && buf[1] == 0x78)
+ {
+ /* Our caller's $a2 will be found in $a0 now. Note it for
+ our callers. */
+ if (fi)
+ fi->status |= CALLER_A2_IN_A0;
+ addr += 2;
+ if (addr >= stop)
+ {
+ /* We still haven't allocated our local stack. Handle this
+ as if we stopped on the first or last insn of a function. */
+ if (fi && fi->next == NULL)
+ fi->frame = read_sp ();
+ return addr;
+ }
+
+ status = target_read_memory (addr, buf, 2);
+ if (status != 0)
+ {
+ if (fi && fi->next == NULL)
+ fi->frame = read_sp ();
+ return addr;
+ }
+ if (buf[0] == 0xf2 && buf[1] == 0x7e)
+ {
+ addr += 2;
+
+ /* Our frame pointer is valid now. */
+ if (fi)
+ {
+ fi->status |= MY_FRAME_IN_FP;
+ fi->status &= ~MY_FRAME_IN_SP;
+ }
+ if (addr >= stop)
+ return addr;
+ }
+ else
+ {
+ if (fi && fi->next == NULL)
+ fi->frame = read_sp ();
+ return addr;
+ }
+ }
+
+ /* Next we should allocate the local frame.
+
+ Search for add imm8,a3 (0xd3XX)
+ or add imm16,a3 (0xf70bXXXX)
+ or add imm24,a3 (0xf467XXXXXX).
+
+ If none of the above was found, then this prologue has
+ no stack, and therefore can't have any register saves,
+ so quit now. */
+ status = target_read_memory (addr, buf, 2);
+ if (status != 0)
+ {
+ if (fi && fi->next == NULL && (fi->status & MY_FRAME_IN_SP))
+ fi->frame = read_sp ();
+ return addr;
+ }
+ if (buf[0] == 0xd3)
+ {
+ stack_size = extract_signed_integer (&buf[1], 1);
+ if (fi)
+ fi->stack_size = stack_size;
+ addr += 2;
+ if (addr >= stop)
+ {
+ if (fi && fi->next == NULL && (fi->status & MY_FRAME_IN_SP))
+ fi->frame = read_sp () - stack_size;
+ return addr;
+ }
+ }
+ else if (buf[0] == 0xf7 && buf[1] == 0x0b)
+ {
+ status = target_read_memory (addr + 2, buf, 2);
+ if (status != 0)
+ {
+ if (fi && fi->next == NULL && (fi->status & MY_FRAME_IN_SP))
+ fi->frame = read_sp ();
+ return addr;
+ }
+ stack_size = extract_signed_integer (buf, 2);
+ if (fi)
+ fi->stack_size = stack_size;
+ addr += 4;
+ if (addr >= stop)
+ {
+ if (fi && fi->next == NULL && (fi->status & MY_FRAME_IN_SP))
+ fi->frame = read_sp () - stack_size;
+ return addr;
+ }
+ }
+ else if (buf[0] == 0xf4 && buf[1] == 0x67)
+ {
+ status = target_read_memory (addr + 2, buf, 3);
+ if (status != 0)
+ {
+ if (fi && fi->next == NULL && (fi->status & MY_FRAME_IN_SP))
+ fi->frame = read_sp ();
+ return addr;
+ }
+ stack_size = extract_signed_integer (buf, 3);
+ if (fi)
+ fi->stack_size = stack_size;
+ addr += 5;
+ if (addr >= stop)
+ {
+ if (fi && fi->next == NULL && (fi->status & MY_FRAME_IN_SP))
+ fi->frame = read_sp () - stack_size;
+ return addr;
+ }
+ }
+
+ /* Now see if we have a call to __prologue for an out of line
+ prologue. */
+ status = target_read_memory (addr, buf, 2);
+ if (status != 0)
+ return addr;
+
+ /* First check for 16bit pc-relative call to __prologue. */
+ if (buf[0] == 0xfd)
+ {
+ CORE_ADDR temp;
+ status = target_read_memory (addr + 1, buf, 2);
+ if (status != 0)
+ {
+ if (fi && fi->next == NULL && (fi->status & MY_FRAME_IN_SP))
+ fi->frame = read_sp ();
+ return addr;
+ }
+
+ /* Get the PC this instruction will branch to. */
+ temp = (extract_signed_integer (buf, 2) + addr + 3) & 0xffffff;
+
+ /* Get the name of the function at the target address. */
+ status = find_pc_partial_function (temp, &name, NULL, NULL);
+ if (status == 0)
+ {
+ if (fi && fi->next == NULL && (fi->status & MY_FRAME_IN_SP))
+ fi->frame = read_sp ();
+ return addr;
+ }
+
+ /* Note if it is an out of line prologue. */
+ out_of_line_prologue = (strcmp (name, "__prologue") == 0);
+
+ /* This sucks up 3 bytes of instruction space. */
+ if (out_of_line_prologue)
+ addr += 3;
+
+ if (addr >= stop)
+ {
+ if (fi && fi->next == NULL)
+ {
+ fi->stack_size -= 16;
+ fi->frame = read_sp () - fi->stack_size;
+ }
+ return addr;
+ }
+ }
+ /* Now check for the 24bit pc-relative call to __prologue. */
+ else if (buf[0] == 0xf4 && buf[1] == 0xe1)
+ {
+ CORE_ADDR temp;
+ status = target_read_memory (addr + 2, buf, 3);
+ if (status != 0)
+ {
+ if (fi && fi->next == NULL && (fi->status & MY_FRAME_IN_SP))
+ fi->frame = read_sp ();
+ return addr;
+ }
+
+ /* Get the PC this instruction will branch to. */
+ temp = (extract_signed_integer (buf, 3) + addr + 5) & 0xffffff;
+
+ /* Get the name of the function at the target address. */
+ status = find_pc_partial_function (temp, &name, NULL, NULL);
+ if (status == 0)
+ {
+ if (fi && fi->next == NULL && (fi->status & MY_FRAME_IN_SP))
+ fi->frame = read_sp ();
+ return addr;
+ }
+
+ /* Note if it is an out of line prologue. */
+ out_of_line_prologue = (strcmp (name, "__prologue") == 0);
+
+ /* This sucks up 5 bytes of instruction space. */
+ if (out_of_line_prologue)
+ addr += 5;
+
+ if (addr >= stop)
+ {
+ if (fi && fi->next == NULL && (fi->status & MY_FRAME_IN_SP))
+ {
+ fi->stack_size -= 16;
+ fi->frame = read_sp () - fi->stack_size;
+ }
+ return addr;
+ }
+ }
+
+ /* Now actually handle the out of line prologue. */
+ if (out_of_line_prologue)
+ {
+ int outgoing_args_size = 0;
+
+ /* First adjust the stack size for this function. The out of
+ line prologue saves 4 registers (16bytes of data). */
+ if (fi)
+ fi->stack_size -= 16;
+
+ /* Update fi->frame if necessary. */
+ if (fi && fi->next == NULL)
+ fi->frame = read_sp () - fi->stack_size;
+
+ /* After the out of line prologue, there may be another
+ stack adjustment for the outgoing arguments.
+
+ Search for add imm8,a3 (0xd3XX)
+ or add imm16,a3 (0xf70bXXXX)
+ or add imm24,a3 (0xf467XXXXXX). */
+
+ status = target_read_memory (addr, buf, 2);
+ if (status != 0)
+ {
+ if (fi)
+ {
+ fi->fsr.regs[2] = fi->frame + fi->stack_size + 4;
+ fi->fsr.regs[3] = fi->frame + fi->stack_size + 8;
+ fi->fsr.regs[5] = fi->frame + fi->stack_size + 12;
+ fi->fsr.regs[6] = fi->frame + fi->stack_size + 16;
+ }
+ return addr;
+ }
+
+ if (buf[0] == 0xd3)
+ {
+ outgoing_args_size = extract_signed_integer (&buf[1], 1);
+ addr += 2;
+ }
+ else if (buf[0] == 0xf7 && buf[1] == 0x0b)
+ {
+ status = target_read_memory (addr + 2, buf, 2);
+ if (status != 0)
+ {
+ if (fi)
+ {
+ fi->fsr.regs[2] = fi->frame + fi->stack_size + 4;
+ fi->fsr.regs[3] = fi->frame + fi->stack_size + 8;
+ fi->fsr.regs[5] = fi->frame + fi->stack_size + 12;
+ fi->fsr.regs[6] = fi->frame + fi->stack_size + 16;
+ }
+ return addr;
+ }
+ outgoing_args_size = extract_signed_integer (buf, 2);
+ addr += 4;
+ }
+ else if (buf[0] == 0xf4 && buf[1] == 0x67)
+ {
+ status = target_read_memory (addr + 2, buf, 3);
+ if (status != 0)
+ {
+ if (fi && fi->next == NULL)
+ {
+ fi->fsr.regs[2] = fi->frame + fi->stack_size + 4;
+ fi->fsr.regs[3] = fi->frame + fi->stack_size + 8;
+ fi->fsr.regs[5] = fi->frame + fi->stack_size + 12;
+ fi->fsr.regs[6] = fi->frame + fi->stack_size + 16;
+ }
+ return addr;
+ }
+ outgoing_args_size = extract_signed_integer (buf, 3);
+ addr += 5;
+ }
+ else
+ outgoing_args_size = 0;
+
+ /* Now that we know the size of the outgoing arguments, fix
+ fi->frame again if this is the innermost frame. */
+ if (fi && fi->next == NULL)
+ fi->frame -= outgoing_args_size;
+
+ /* Note the register save information and update the stack
+ size for this frame too. */
+ if (fi)
+ {
+ fi->fsr.regs[2] = fi->frame + fi->stack_size + 4;
+ fi->fsr.regs[3] = fi->frame + fi->stack_size + 8;
+ fi->fsr.regs[5] = fi->frame + fi->stack_size + 12;
+ fi->fsr.regs[6] = fi->frame + fi->stack_size + 16;
+ fi->stack_size += outgoing_args_size;
+ }
+ /* There can be no more prologue insns, so return now. */
+ return addr;
+ }
+
+ /* At this point fi->frame needs to be correct.
+
+ If MY_FRAME_IN_SP is set and we're the innermost frame, then we
+ need to fix fi->frame so that backtracing, find_frame_saved_regs,
+ etc work correctly. */
+ if (fi && fi->next == NULL && (fi->status & MY_FRAME_IN_SP) != 0)
+ fi->frame = read_sp () - fi->stack_size;
+
+ /* And last we have the register saves. These are relatively
+ simple because they're physically done off the stack pointer,
+ and thus the number of different instructions we need to
+ check is greatly reduced because we know the displacements
+ will be small.
+
+ Search for movx d2,(X,a3) (0xf55eXX)
+ then movx d3,(X,a3) (0xf55fXX)
+ then mov a1,(X,a3) (0x5dXX) No frame pointer case
+ then mov a2,(X,a3) (0x5eXX) No frame pointer case
+ or mov a0,(X,a3) (0x5cXX) Frame pointer case. */
+
+ status = target_read_memory (addr, buf, 2);
+ if (status != 0)
+ return addr;
+ if (buf[0] == 0xf5 && buf[1] == 0x5e)
+ {
+ if (fi)
+ {
+ status = target_read_memory (addr + 2, buf, 1);
+ if (status != 0)
+ return addr;
+ fi->fsr.regs[2] = (fi->frame + stack_size
+ + extract_signed_integer (buf, 1));
+ }
+ addr += 3;
+ if (addr >= stop)
+ return addr;
+ status = target_read_memory (addr, buf, 2);
+ if (status != 0)
+ return addr;
+ }
+ if (buf[0] == 0xf5 && buf[1] == 0x5f)
+ {
+ if (fi)
+ {
+ status = target_read_memory (addr + 2, buf, 1);
+ if (status != 0)
+ return addr;
+ fi->fsr.regs[3] = (fi->frame + stack_size
+ + extract_signed_integer (buf, 1));
+ }
+ addr += 3;
+ if (addr >= stop)
+ return addr;
+ status = target_read_memory (addr, buf, 2);
+ if (status != 0)
+ return addr;
+ }
+ if (buf[0] == 0x5d)
+ {
+ if (fi)
+ {
+ status = target_read_memory (addr + 1, buf, 1);
+ if (status != 0)
+ return addr;
+ fi->fsr.regs[5] = (fi->frame + stack_size
+ + extract_signed_integer (buf, 1));
+ }
+ addr += 2;
+ if (addr >= stop)
+ return addr;
+ status = target_read_memory (addr, buf, 2);
+ if (status != 0)
+ return addr;
+ }
+ if (buf[0] == 0x5e || buf[0] == 0x5c)
+ {
+ if (fi)
+ {
+ status = target_read_memory (addr + 1, buf, 1);
+ if (status != 0)
+ return addr;
+ fi->fsr.regs[6] = (fi->frame + stack_size
+ + extract_signed_integer (buf, 1));
+ fi->status &= ~CALLER_A2_IN_A0;
+ }
+ addr += 2;
+ if (addr >= stop)
+ return addr;
+ return addr;
+ }
+ return addr;
+}
+
+/* Function: frame_chain
+ Figure out and return the caller's frame pointer given current
+ frame_info struct.
+
+ We don't handle dummy frames yet but we would probably just return the
+ stack pointer that was in use at the time the function call was made? */
+
+CORE_ADDR
+mn10200_frame_chain (fi)
+ struct frame_info *fi;
+{
+ struct frame_info dummy_frame;
+
+ /* Walk through the prologue to determine the stack size,
+ location of saved registers, end of the prologue, etc. */
+ if (fi->status == 0)
+ mn10200_analyze_prologue (fi, (CORE_ADDR)0);
+
+ /* Quit now if mn10200_analyze_prologue set NO_MORE_FRAMES. */
+ if (fi->status & NO_MORE_FRAMES)
+ return 0;
+
+ /* Now that we've analyzed our prologue, determine the frame
+ pointer for our caller.
+
+ If our caller has a frame pointer, then we need to
+ find the entry value of $a2 to our function.
+
+ If CALLER_A2_IN_A0, then the chain is in $a0.
+
+ If fsr.regs[6] is nonzero, then it's at the memory
+ location pointed to by fsr.regs[6].
+
+ Else it's still in $a2.
+
+ If our caller does not have a frame pointer, then his
+ frame base is fi->frame + -caller's stack size + 4. */
+
+ /* The easiest way to get that info is to analyze our caller's frame.
+
+ So we set up a dummy frame and call mn10200_analyze_prologue to
+ find stuff for us. */
+ dummy_frame.pc = FRAME_SAVED_PC (fi);
+ dummy_frame.frame = fi->frame;
+ memset (dummy_frame.fsr.regs, '\000', sizeof dummy_frame.fsr.regs);
+ dummy_frame.status = 0;
+ dummy_frame.stack_size = 0;
+ mn10200_analyze_prologue (&dummy_frame);
+
+ if (dummy_frame.status & MY_FRAME_IN_FP)
+ {
+ /* Our caller has a frame pointer. So find the frame in $a2, $a0,
+ or in the stack. */
+ if (fi->fsr.regs[6])
+ return (read_memory_integer (fi->fsr.regs[FP_REGNUM], REGISTER_SIZE)
+ & 0xffffff);
+ else if (fi->status & CALLER_A2_IN_A0)
+ return read_register (4);
+ else
+ return read_register (FP_REGNUM);
+ }
+ else
+ {
+ /* Our caller does not have a frame pointer. So his frame starts
+ at the base of our frame (fi->frame) + <his size> + 4 (saved pc). */
+ return fi->frame + -dummy_frame.stack_size + 4;
+ }
+}
+
+/* Function: skip_prologue
+ Return the address of the first inst past the prologue of the function. */
+
+CORE_ADDR
+mn10200_skip_prologue (pc)
+ CORE_ADDR pc;
+{
+ /* We used to check the debug symbols, but that can lose if
+ we have a null prologue. */
+ return mn10200_analyze_prologue (NULL, pc);
+}
+
+/* Function: pop_frame
+ This routine gets called when either the user uses the `return'
+ command, or the call dummy breakpoint gets hit. */
+
+void
+mn10200_pop_frame (frame)
+ struct frame_info *frame;
+{
+ int regnum;
+
+ if (PC_IN_CALL_DUMMY(frame->pc, frame->frame, frame->frame))
+ generic_pop_dummy_frame ();
+ else
+ {
+ write_register (PC_REGNUM, FRAME_SAVED_PC (frame));
+
+ /* Restore any saved registers. */
+ for (regnum = 0; regnum < NUM_REGS; regnum++)
+ if (frame->fsr.regs[regnum] != 0)
+ {
+ ULONGEST value;
+
+ value = read_memory_unsigned_integer (frame->fsr.regs[regnum],
+ REGISTER_RAW_SIZE (regnum));
+ write_register (regnum, value);
+ }
+
+ /* Actually cut back the stack. */
+ write_register (SP_REGNUM, FRAME_FP (frame));
+
+ /* Don't we need to set the PC?!? XXX FIXME. */
+ }
+
+ /* Throw away any cached frame information. */
+ flush_cached_frames ();
+}
+
+/* Function: push_arguments
+ Setup arguments for a call to the target. Arguments go in
+ order on the stack. */
+
+CORE_ADDR
+mn10200_push_arguments (nargs, args, sp, struct_return, struct_addr)
+ int nargs;
+ value_ptr *args;
+ CORE_ADDR sp;
+ unsigned char struct_return;
+ CORE_ADDR struct_addr;
+{
+ int argnum = 0;
+ int len = 0;
+ int stack_offset = 0;
+ int regsused = struct_return ? 1 : 0;
+
+ /* This should be a nop, but align the stack just in case something
+ went wrong. Stacks are two byte aligned on the mn10200. */
+ sp &= ~1;
+
+ /* Now make space on the stack for the args.
+
+ XXX This doesn't appear to handle pass-by-invisible reference
+ arguments. */
+ for (argnum = 0; argnum < nargs; argnum++)
+ {
+ int arg_length = (TYPE_LENGTH (VALUE_TYPE (args[argnum])) + 1) & ~1;
+
+ /* If we've used all argument registers, then this argument is
+ pushed. */
+ if (regsused >= 2 || arg_length > 4)
+ {
+ regsused = 2;
+ len += arg_length;
+ }
+ /* We know we've got some arg register space left. If this argument
+ will fit entirely in regs, then put it there. */
+ else if (arg_length <= 2
+ || TYPE_CODE (VALUE_TYPE (args[argnum])) == TYPE_CODE_PTR)
+ {
+ regsused++;
+ }
+ else if (regsused == 0)
+ {
+ regsused = 2;
+ }
+ else
+ {
+ regsused = 2;
+ len += arg_length;
+ }
+ }
+
+ /* Allocate stack space. */
+ sp -= len;
+
+ regsused = struct_return ? 1 : 0;
+ /* Push all arguments onto the stack. */
+ for (argnum = 0; argnum < nargs; argnum++)
+ {
+ int len;
+ char *val;
+
+ /* XXX Check this. What about UNIONS? */
+ if (TYPE_CODE (VALUE_TYPE (*args)) == TYPE_CODE_STRUCT
+ && TYPE_LENGTH (VALUE_TYPE (*args)) > 8)
+ {
+ /* XXX Wrong, we want a pointer to this argument. */
+ len = TYPE_LENGTH (VALUE_TYPE (*args));
+ val = (char *)VALUE_CONTENTS (*args);
+ }
+ else
+ {
+ len = TYPE_LENGTH (VALUE_TYPE (*args));
+ val = (char *)VALUE_CONTENTS (*args);
+ }
+
+ if (regsused < 2
+ && (len <= 2
+ || TYPE_CODE (VALUE_TYPE (*args)) == TYPE_CODE_PTR))
+ {
+ write_register (regsused, extract_unsigned_integer (val, 4));
+ regsused++;
+ }
+ else if (regsused == 0 && len == 4)
+ {
+ write_register (regsused, extract_unsigned_integer (val, 2));
+ write_register (regsused + 1, extract_unsigned_integer (val + 2, 2));
+ regsused = 2;
+ }
+ else
+ {
+ regsused = 2;
+ while (len > 0)
+ {
+ write_memory (sp + stack_offset, val, 2);
+
+ len -= 2;
+ val += 2;
+ stack_offset += 2;
+ }
+ }
+ args++;
+ }
+
+ return sp;
+}
+
+/* Function: push_return_address (pc)
+ Set up the return address for the inferior function call.
+ Needed for targets where we don't actually execute a JSR/BSR instruction */
+
+CORE_ADDR
+mn10200_push_return_address (pc, sp)
+ CORE_ADDR pc;
+ CORE_ADDR sp;
+{
+ unsigned char buf[4];
+
+ store_unsigned_integer (buf, 4, CALL_DUMMY_ADDRESS ());
+ write_memory (sp - 4, buf, 4);
+ return sp - 4;
+}
+
+/* Function: store_struct_return (addr,sp)
+ Store the structure value return address for an inferior function
+ call. */
+
+CORE_ADDR
+mn10200_store_struct_return (addr, sp)
+ CORE_ADDR addr;
+ CORE_ADDR sp;
+{
+ /* The structure return address is passed as the first argument. */
+ write_register (0, addr);
+ return sp;
+}
+
+/* Function: frame_saved_pc
+ Find the caller of this frame. We do this by seeing if RP_REGNUM
+ is saved in the stack anywhere, otherwise we get it from the
+ registers. If the inner frame is a dummy frame, return its PC
+ instead of RP, because that's where "caller" of the dummy-frame
+ will be found. */
+
+CORE_ADDR
+mn10200_frame_saved_pc (fi)
+ struct frame_info *fi;
+{
+ /* The saved PC will always be at the base of the current frame. */
+ return (read_memory_integer (fi->frame, REGISTER_SIZE) & 0xffffff);
+}
+
+void
+get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
+ char *raw_buffer;
+ int *optimized;
+ CORE_ADDR *addrp;
+ struct frame_info *frame;
+ int regnum;
+ enum lval_type *lval;
+{
+ generic_get_saved_register (raw_buffer, optimized, addrp,
+ frame, regnum, lval);
+}
+
+/* Function: init_extra_frame_info
+ Setup the frame's frame pointer, pc, and frame addresses for saved
+ registers. Most of the work is done in mn10200_analyze_prologue().
+
+ Note that when we are called for the last frame (currently active frame),
+ that fi->pc and fi->frame will already be setup. However, fi->frame will
+ be valid only if this routine uses FP. For previous frames, fi-frame will
+ always be correct. mn10200_analyze_prologue will fix fi->frame if
+ it's not valid.
+
+ We can be called with the PC in the call dummy under two circumstances.
+ First, during normal backtracing, second, while figuring out the frame
+ pointer just prior to calling the target function (see run_stack_dummy). */
+
+void
+mn10200_init_extra_frame_info (fi)
+ struct frame_info *fi;
+{
+ if (fi->next)
+ fi->pc = FRAME_SAVED_PC (fi->next);
+
+ memset (fi->fsr.regs, '\000', sizeof fi->fsr.regs);
+ fi->status = 0;
+ fi->stack_size = 0;
+
+ mn10200_analyze_prologue (fi, 0);
+}
+
+void
+_initialize_mn10200_tdep ()
+{
+ tm_print_insn = print_insn_mn10200;
+}
+
diff --git a/contrib/gdb/gdb/mn10300-tdep.c b/contrib/gdb/gdb/mn10300-tdep.c
new file mode 100644
index 000000000000..6c43176193b8
--- /dev/null
+++ b/contrib/gdb/gdb/mn10300-tdep.c
@@ -0,0 +1,791 @@
+/* Target-dependent code for the Matsushita MN10300 for GDB, the GNU debugger.
+ Copyright 1996, 1997, 1998 Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+This program 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#include "defs.h"
+#include "frame.h"
+#include "inferior.h"
+#include "obstack.h"
+#include "target.h"
+#include "value.h"
+#include "bfd.h"
+#include "gdb_string.h"
+#include "gdbcore.h"
+#include "symfile.h"
+
+static char *mn10300_generic_register_names[] =
+{ "d0", "d1", "d2", "d3", "a0", "a1", "a2", "a3",
+ "sp", "pc", "mdr", "psw", "lir", "lar", "", "",
+ "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "fp" };
+
+char **mn10300_register_names = mn10300_generic_register_names;
+
+static CORE_ADDR mn10300_analyze_prologue PARAMS ((struct frame_info *fi,
+ CORE_ADDR pc));
+
+/* Additional info used by the frame */
+
+struct frame_extra_info
+{
+ int status;
+ int stack_size;
+};
+
+static struct frame_info *analyze_dummy_frame PARAMS ((CORE_ADDR, CORE_ADDR));
+static struct frame_info *
+analyze_dummy_frame (pc, frame)
+ CORE_ADDR pc;
+ CORE_ADDR frame;
+{
+ static struct frame_info *dummy = NULL;
+ if (dummy == NULL)
+ {
+ dummy = xmalloc (sizeof (struct frame_info));
+ dummy->saved_regs = xmalloc (SIZEOF_FRAME_SAVED_REGS);
+ dummy->extra_info = xmalloc (sizeof (struct frame_extra_info));
+ }
+ dummy->next = NULL;
+ dummy->prev = NULL;
+ dummy->pc = pc;
+ dummy->frame = frame;
+ dummy->extra_info->status = 0;
+ dummy->extra_info->stack_size = 0;
+ memset (dummy->saved_regs, '\000', SIZEOF_FRAME_SAVED_REGS);
+ mn10300_analyze_prologue (dummy, 0);
+ return dummy;
+}
+
+/* Values for frame_info.status */
+
+#define MY_FRAME_IN_SP 0x1
+#define MY_FRAME_IN_FP 0x2
+#define NO_MORE_FRAMES 0x4
+
+
+/* Should call_function allocate stack space for a struct return? */
+int
+mn10300_use_struct_convention (gcc_p, type)
+ int gcc_p;
+ struct type *type;
+{
+ return (TYPE_NFIELDS (type) > 1 || TYPE_LENGTH (type) > 8);
+}
+
+/* The breakpoint instruction must be the same size as the smallest
+ instruction in the instruction set.
+
+ The Matsushita mn10x00 processors have single byte instructions
+ so we need a single byte breakpoint. Matsushita hasn't defined
+ one, so we defined it ourselves. */
+
+unsigned char *
+mn10300_breakpoint_from_pc (bp_addr, bp_size)
+ CORE_ADDR *bp_addr;
+ int *bp_size;
+{
+ static char breakpoint[] = {0xff};
+ *bp_size = 1;
+ return breakpoint;
+}
+
+
+/* Fix fi->frame if it's bogus at this point. This is a helper
+ function for mn10300_analyze_prologue. */
+
+static void
+fix_frame_pointer (fi, stack_size)
+ struct frame_info *fi;
+ int stack_size;
+{
+ if (fi && fi->next == NULL)
+ {
+ if (fi->extra_info->status & MY_FRAME_IN_SP)
+ fi->frame = read_sp () - stack_size;
+ else if (fi->extra_info->status & MY_FRAME_IN_FP)
+ fi->frame = read_register (A3_REGNUM);
+ }
+}
+
+
+/* Set offsets of registers saved by movm instruction.
+ This is a helper function for mn10300_analyze_prologue. */
+
+static void
+set_movm_offsets (fi, movm_args)
+ struct frame_info *fi;
+ int movm_args;
+{
+ int offset = 0;
+
+ if (fi == NULL || movm_args == 0)
+ return;
+
+ if (movm_args & 0x10)
+ {
+ fi->saved_regs[A3_REGNUM] = fi->frame + offset;
+ offset += 4;
+ }
+ if (movm_args & 0x20)
+ {
+ fi->saved_regs[A2_REGNUM] = fi->frame + offset;
+ offset += 4;
+ }
+ if (movm_args & 0x40)
+ {
+ fi->saved_regs[D3_REGNUM] = fi->frame + offset;
+ offset += 4;
+ }
+ if (movm_args & 0x80)
+ {
+ fi->saved_regs[D2_REGNUM] = fi->frame + offset;
+ offset += 4;
+ }
+}
+
+
+/* The main purpose of this file is dealing with prologues to extract
+ information about stack frames and saved registers.
+
+ For reference here's how prologues look on the mn10300:
+
+ With frame pointer:
+ movm [d2,d3,a2,a3],sp
+ mov sp,a3
+ add <size>,sp
+
+ Without frame pointer:
+ movm [d2,d3,a2,a3],sp (if needed)
+ add <size>,sp
+
+ One day we might keep the stack pointer constant, that won't
+ change the code for prologues, but it will make the frame
+ pointerless case much more common. */
+
+/* Analyze the prologue to determine where registers are saved,
+ the end of the prologue, etc etc. Return the end of the prologue
+ scanned.
+
+ We store into FI (if non-null) several tidbits of information:
+
+ * stack_size -- size of this stack frame. Note that if we stop in
+ certain parts of the prologue/epilogue we may claim the size of the
+ current frame is zero. This happens when the current frame has
+ not been allocated yet or has already been deallocated.
+
+ * fsr -- Addresses of registers saved in the stack by this frame.
+
+ * status -- A (relatively) generic status indicator. It's a bitmask
+ with the following bits:
+
+ MY_FRAME_IN_SP: The base of the current frame is actually in
+ the stack pointer. This can happen for frame pointerless
+ functions, or cases where we're stopped in the prologue/epilogue
+ itself. For these cases mn10300_analyze_prologue will need up
+ update fi->frame before returning or analyzing the register
+ save instructions.
+
+ MY_FRAME_IN_FP: The base of the current frame is in the
+ frame pointer register ($a2).
+
+ NO_MORE_FRAMES: Set this if the current frame is "start" or
+ if the first instruction looks like mov <imm>,sp. This tells
+ frame chain to not bother trying to unwind past this frame. */
+
+static CORE_ADDR
+mn10300_analyze_prologue (fi, pc)
+ struct frame_info *fi;
+ CORE_ADDR pc;
+{
+ CORE_ADDR func_addr, func_end, addr, stop;
+ CORE_ADDR stack_size;
+ int imm_size;
+ unsigned char buf[4];
+ int status, movm_args = 0;
+ char *name;
+
+ /* Use the PC in the frame if it's provided to look up the
+ start of this function. */
+ pc = (fi ? fi->pc : pc);
+
+ /* Find the start of this function. */
+ status = find_pc_partial_function (pc, &name, &func_addr, &func_end);
+
+ /* Do nothing if we couldn't find the start of this function or if we're
+ stopped at the first instruction in the prologue. */
+ if (status == 0)
+ return pc;
+
+ /* If we're in start, then give up. */
+ if (strcmp (name, "start") == 0)
+ {
+ if (fi != NULL)
+ fi->extra_info->status = NO_MORE_FRAMES;
+ return pc;
+ }
+
+ /* At the start of a function our frame is in the stack pointer. */
+ if (fi)
+ fi->extra_info->status = MY_FRAME_IN_SP;
+
+ /* Get the next two bytes into buf, we need two because rets is a two
+ byte insn and the first isn't enough to uniquely identify it. */
+ status = read_memory_nobpt (pc, buf, 2);
+ if (status != 0)
+ return pc;
+
+ /* If we're physically on an "rets" instruction, then our frame has
+ already been deallocated. Note this can also be true for retf
+ and ret if they specify a size of zero.
+
+ In this case fi->frame is bogus, we need to fix it. */
+ if (fi && buf[0] == 0xf0 && buf[1] == 0xfc)
+ {
+ if (fi->next == NULL)
+ fi->frame = read_sp ();
+ return fi->pc;
+ }
+
+ /* Similarly if we're stopped on the first insn of a prologue as our
+ frame hasn't been allocated yet. */
+ if (fi && fi->pc == func_addr)
+ {
+ if (fi->next == NULL)
+ fi->frame = read_sp ();
+ return fi->pc;
+ }
+
+ /* Figure out where to stop scanning. */
+ stop = fi ? fi->pc : func_end;
+
+ /* Don't walk off the end of the function. */
+ stop = stop > func_end ? func_end : stop;
+
+ /* Start scanning on the first instruction of this function. */
+ addr = func_addr;
+
+ /* Suck in two bytes. */
+ status = read_memory_nobpt (addr, buf, 2);
+ if (status != 0)
+ {
+ fix_frame_pointer (fi, 0);
+ return addr;
+ }
+
+ /* First see if this insn sets the stack pointer; if so, it's something
+ we won't understand, so quit now. */
+ if (buf[0] == 0xf2 && (buf[1] & 0xf3) == 0xf0)
+ {
+ if (fi)
+ fi->extra_info->status = NO_MORE_FRAMES;
+ return addr;
+ }
+
+ /* Now look for movm [regs],sp, which saves the callee saved registers.
+
+ At this time we don't know if fi->frame is valid, so we only note
+ that we encountered a movm instruction. Later, we'll set the entries
+ in fsr.regs as needed. */
+ if (buf[0] == 0xcf)
+ {
+ /* Extract the register list for the movm instruction. */
+ status = read_memory_nobpt (addr + 1, buf, 1);
+ movm_args = *buf;
+
+ addr += 2;
+
+ /* Quit now if we're beyond the stop point. */
+ if (addr >= stop)
+ {
+ /* Fix fi->frame since it's bogus at this point. */
+ if (fi && fi->next == NULL)
+ fi->frame = read_sp ();
+
+ /* Note if/where callee saved registers were saved. */
+ set_movm_offsets (fi, movm_args);
+ return addr;
+ }
+
+ /* Get the next two bytes so the prologue scan can continue. */
+ status = read_memory_nobpt (addr, buf, 2);
+ if (status != 0)
+ {
+ /* Fix fi->frame since it's bogus at this point. */
+ if (fi && fi->next == NULL)
+ fi->frame = read_sp ();
+
+ /* Note if/where callee saved registers were saved. */
+ set_movm_offsets (fi, movm_args);
+ return addr;
+ }
+ }
+
+ /* Now see if we set up a frame pointer via "mov sp,a3" */
+ if (buf[0] == 0x3f)
+ {
+ addr += 1;
+
+ /* The frame pointer is now valid. */
+ if (fi)
+ {
+ fi->extra_info->status |= MY_FRAME_IN_FP;
+ fi->extra_info->status &= ~MY_FRAME_IN_SP;
+ }
+
+ /* Quit now if we're beyond the stop point. */
+ if (addr >= stop)
+ {
+ /* Fix fi->frame if it's bogus at this point. */
+ fix_frame_pointer (fi, 0);
+
+ /* Note if/where callee saved registers were saved. */
+ set_movm_offsets (fi, movm_args);
+ return addr;
+ }
+
+ /* Get two more bytes so scanning can continue. */
+ status = read_memory_nobpt (addr, buf, 2);
+ if (status != 0)
+ {
+ /* Fix fi->frame if it's bogus at this point. */
+ fix_frame_pointer (fi, 0);
+
+ /* Note if/where callee saved registers were saved. */
+ set_movm_offsets (fi, movm_args);
+ return addr;
+ }
+ }
+
+ /* Next we should allocate the local frame. No more prologue insns
+ are found after allocating the local frame.
+
+ Search for add imm8,sp (0xf8feXX)
+ or add imm16,sp (0xfafeXXXX)
+ or add imm32,sp (0xfcfeXXXXXXXX).
+
+ If none of the above was found, then this prologue has no
+ additional stack. */
+
+ status = read_memory_nobpt (addr, buf, 2);
+ if (status != 0)
+ {
+ /* Fix fi->frame if it's bogus at this point. */
+ fix_frame_pointer (fi, 0);
+
+ /* Note if/where callee saved registers were saved. */
+ set_movm_offsets (fi, movm_args);
+ return addr;
+ }
+
+ imm_size = 0;
+ if (buf[0] == 0xf8 && buf[1] == 0xfe)
+ imm_size = 1;
+ else if (buf[0] == 0xfa && buf[1] == 0xfe)
+ imm_size = 2;
+ else if (buf[0] == 0xfc && buf[1] == 0xfe)
+ imm_size = 4;
+
+ if (imm_size != 0)
+ {
+ /* Suck in imm_size more bytes, they'll hold the size of the
+ current frame. */
+ status = read_memory_nobpt (addr + 2, buf, imm_size);
+ if (status != 0)
+ {
+ /* Fix fi->frame if it's bogus at this point. */
+ fix_frame_pointer (fi, 0);
+
+ /* Note if/where callee saved registers were saved. */
+ set_movm_offsets (fi, movm_args);
+ return addr;
+ }
+
+ /* Note the size of the stack in the frame info structure. */
+ stack_size = extract_signed_integer (buf, imm_size);
+ if (fi)
+ fi->extra_info->stack_size = stack_size;
+
+ /* We just consumed 2 + imm_size bytes. */
+ addr += 2 + imm_size;
+
+ /* No more prologue insns follow, so begin preparation to return. */
+ /* Fix fi->frame if it's bogus at this point. */
+ fix_frame_pointer (fi, stack_size);
+
+ /* Note if/where callee saved registers were saved. */
+ set_movm_offsets (fi, movm_args);
+ return addr;
+ }
+
+ /* We never found an insn which allocates local stack space, regardless
+ this is the end of the prologue. */
+ /* Fix fi->frame if it's bogus at this point. */
+ fix_frame_pointer (fi, 0);
+
+ /* Note if/where callee saved registers were saved. */
+ set_movm_offsets (fi, movm_args);
+ return addr;
+}
+
+/* Function: frame_chain
+ Figure out and return the caller's frame pointer given current
+ frame_info struct.
+
+ We don't handle dummy frames yet but we would probably just return the
+ stack pointer that was in use at the time the function call was made? */
+
+CORE_ADDR
+mn10300_frame_chain (fi)
+ struct frame_info *fi;
+{
+ struct frame_info *dummy;
+ /* Walk through the prologue to determine the stack size,
+ location of saved registers, end of the prologue, etc. */
+ if (fi->extra_info->status == 0)
+ mn10300_analyze_prologue (fi, (CORE_ADDR)0);
+
+ /* Quit now if mn10300_analyze_prologue set NO_MORE_FRAMES. */
+ if (fi->extra_info->status & NO_MORE_FRAMES)
+ return 0;
+
+ /* Now that we've analyzed our prologue, determine the frame
+ pointer for our caller.
+
+ If our caller has a frame pointer, then we need to
+ find the entry value of $a3 to our function.
+
+ If fsr.regs[A3_REGNUM] is nonzero, then it's at the memory
+ location pointed to by fsr.regs[A3_REGNUM].
+
+ Else it's still in $a3.
+
+ If our caller does not have a frame pointer, then his
+ frame base is fi->frame + -caller's stack size. */
+
+ /* The easiest way to get that info is to analyze our caller's frame.
+ So we set up a dummy frame and call mn10300_analyze_prologue to
+ find stuff for us. */
+ dummy = analyze_dummy_frame (FRAME_SAVED_PC (fi), fi->frame);
+
+ if (dummy->extra_info->status & MY_FRAME_IN_FP)
+ {
+ /* Our caller has a frame pointer. So find the frame in $a3 or
+ in the stack. */
+ if (fi->saved_regs[A3_REGNUM])
+ return (read_memory_integer (fi->saved_regs[A3_REGNUM], REGISTER_SIZE));
+ else
+ return read_register (A3_REGNUM);
+ }
+ else
+ {
+ int adjust = 0;
+
+ adjust += (fi->saved_regs[D2_REGNUM] ? 4 : 0);
+ adjust += (fi->saved_regs[D3_REGNUM] ? 4 : 0);
+ adjust += (fi->saved_regs[A2_REGNUM] ? 4 : 0);
+ adjust += (fi->saved_regs[A3_REGNUM] ? 4 : 0);
+
+ /* Our caller does not have a frame pointer. So his frame starts
+ at the base of our frame (fi->frame) + register save space
+ + <his size>. */
+ return fi->frame + adjust + -dummy->extra_info->stack_size;
+ }
+}
+
+/* Function: skip_prologue
+ Return the address of the first inst past the prologue of the function. */
+
+CORE_ADDR
+mn10300_skip_prologue (pc)
+ CORE_ADDR pc;
+{
+ /* We used to check the debug symbols, but that can lose if
+ we have a null prologue. */
+ return mn10300_analyze_prologue (NULL, pc);
+}
+
+
+/* Function: pop_frame
+ This routine gets called when either the user uses the `return'
+ command, or the call dummy breakpoint gets hit. */
+
+void
+mn10300_pop_frame (frame)
+ struct frame_info *frame;
+{
+ int regnum;
+
+ if (PC_IN_CALL_DUMMY(frame->pc, frame->frame, frame->frame))
+ generic_pop_dummy_frame ();
+ else
+ {
+ write_register (PC_REGNUM, FRAME_SAVED_PC (frame));
+
+ /* Restore any saved registers. */
+ for (regnum = 0; regnum < NUM_REGS; regnum++)
+ if (frame->saved_regs[regnum] != 0)
+ {
+ ULONGEST value;
+
+ value = read_memory_unsigned_integer (frame->saved_regs[regnum],
+ REGISTER_RAW_SIZE (regnum));
+ write_register (regnum, value);
+ }
+
+ /* Actually cut back the stack. */
+ write_register (SP_REGNUM, FRAME_FP (frame));
+
+ /* Don't we need to set the PC?!? XXX FIXME. */
+ }
+
+ /* Throw away any cached frame information. */
+ flush_cached_frames ();
+}
+
+/* Function: push_arguments
+ Setup arguments for a call to the target. Arguments go in
+ order on the stack. */
+
+CORE_ADDR
+mn10300_push_arguments (nargs, args, sp, struct_return, struct_addr)
+ int nargs;
+ value_ptr *args;
+ CORE_ADDR sp;
+ unsigned char struct_return;
+ CORE_ADDR struct_addr;
+{
+ int argnum = 0;
+ int len = 0;
+ int stack_offset = 0;
+ int regsused = struct_return ? 1 : 0;
+
+ /* This should be a nop, but align the stack just in case something
+ went wrong. Stacks are four byte aligned on the mn10300. */
+ sp &= ~3;
+
+ /* Now make space on the stack for the args.
+
+ XXX This doesn't appear to handle pass-by-invisible reference
+ arguments. */
+ for (argnum = 0; argnum < nargs; argnum++)
+ {
+ int arg_length = (TYPE_LENGTH (VALUE_TYPE (args[argnum])) + 3) & ~3;
+
+ while (regsused < 2 && arg_length > 0)
+ {
+ regsused++;
+ arg_length -= 4;
+ }
+ len += arg_length;
+ }
+
+ /* Allocate stack space. */
+ sp -= len;
+
+ regsused = struct_return ? 1 : 0;
+ /* Push all arguments onto the stack. */
+ for (argnum = 0; argnum < nargs; argnum++)
+ {
+ int len;
+ char *val;
+
+ /* XXX Check this. What about UNIONS? */
+ if (TYPE_CODE (VALUE_TYPE (*args)) == TYPE_CODE_STRUCT
+ && TYPE_LENGTH (VALUE_TYPE (*args)) > 8)
+ {
+ /* XXX Wrong, we want a pointer to this argument. */
+ len = TYPE_LENGTH (VALUE_TYPE (*args));
+ val = (char *)VALUE_CONTENTS (*args);
+ }
+ else
+ {
+ len = TYPE_LENGTH (VALUE_TYPE (*args));
+ val = (char *)VALUE_CONTENTS (*args);
+ }
+
+ while (regsused < 2 && len > 0)
+ {
+ write_register (regsused, extract_unsigned_integer (val, 4));
+ val += 4;
+ len -= 4;
+ regsused++;
+ }
+
+ while (len > 0)
+ {
+ write_memory (sp + stack_offset, val, 4);
+ len -= 4;
+ val += 4;
+ stack_offset += 4;
+ }
+
+ args++;
+ }
+
+ /* Make space for the flushback area. */
+ sp -= 8;
+ return sp;
+}
+
+/* Function: push_return_address (pc)
+ Set up the return address for the inferior function call.
+ Needed for targets where we don't actually execute a JSR/BSR instruction */
+
+CORE_ADDR
+mn10300_push_return_address (pc, sp)
+ CORE_ADDR pc;
+ CORE_ADDR sp;
+{
+ unsigned char buf[4];
+
+ store_unsigned_integer (buf, 4, CALL_DUMMY_ADDRESS ());
+ write_memory (sp - 4, buf, 4);
+ return sp - 4;
+}
+
+/* Function: store_struct_return (addr,sp)
+ Store the structure value return address for an inferior function
+ call. */
+
+CORE_ADDR
+mn10300_store_struct_return (addr, sp)
+ CORE_ADDR addr;
+ CORE_ADDR sp;
+{
+ /* The structure return address is passed as the first argument. */
+ write_register (0, addr);
+ return sp;
+}
+
+/* Function: frame_saved_pc
+ Find the caller of this frame. We do this by seeing if RP_REGNUM
+ is saved in the stack anywhere, otherwise we get it from the
+ registers. If the inner frame is a dummy frame, return its PC
+ instead of RP, because that's where "caller" of the dummy-frame
+ will be found. */
+
+CORE_ADDR
+mn10300_frame_saved_pc (fi)
+ struct frame_info *fi;
+{
+ int adjust = 0;
+
+ adjust += (fi->saved_regs[D2_REGNUM] ? 4 : 0);
+ adjust += (fi->saved_regs[D3_REGNUM] ? 4 : 0);
+ adjust += (fi->saved_regs[A2_REGNUM] ? 4 : 0);
+ adjust += (fi->saved_regs[A3_REGNUM] ? 4 : 0);
+
+ return (read_memory_integer (fi->frame + adjust, REGISTER_SIZE));
+}
+
+void
+get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
+ char *raw_buffer;
+ int *optimized;
+ CORE_ADDR *addrp;
+ struct frame_info *frame;
+ int regnum;
+ enum lval_type *lval;
+{
+ generic_get_saved_register (raw_buffer, optimized, addrp,
+ frame, regnum, lval);
+}
+
+/* Function: mn10300_init_extra_frame_info
+ Setup the frame's frame pointer, pc, and frame addresses for saved
+ registers. Most of the work is done in mn10300_analyze_prologue().
+
+ Note that when we are called for the last frame (currently active frame),
+ that fi->pc and fi->frame will already be setup. However, fi->frame will
+ be valid only if this routine uses FP. For previous frames, fi-frame will
+ always be correct. mn10300_analyze_prologue will fix fi->frame if
+ it's not valid.
+
+ We can be called with the PC in the call dummy under two circumstances.
+ First, during normal backtracing, second, while figuring out the frame
+ pointer just prior to calling the target function (see run_stack_dummy). */
+
+void
+mn10300_init_extra_frame_info (fi)
+ struct frame_info *fi;
+{
+ if (fi->next)
+ fi->pc = FRAME_SAVED_PC (fi->next);
+
+ frame_saved_regs_zalloc (fi);
+ fi->extra_info = (struct frame_extra_info *)
+ frame_obstack_alloc (sizeof (struct frame_extra_info));
+
+ fi->extra_info->status = 0;
+ fi->extra_info->stack_size = 0;
+
+ mn10300_analyze_prologue (fi, 0);
+}
+
+/* Function: mn10300_virtual_frame_pointer
+ Return the register that the function uses for a frame pointer,
+ plus any necessary offset to be applied to the register before
+ any frame pointer offsets. */
+
+void
+mn10300_virtual_frame_pointer (pc, reg, offset)
+ CORE_ADDR pc;
+ long *reg;
+ long *offset;
+{
+ struct frame_info *dummy = analyze_dummy_frame (pc, 0);
+ /* Set up a dummy frame_info, Analyze the prolog and fill in the
+ extra info. */
+ /* Results will tell us which type of frame it uses. */
+ if (dummy->extra_info->status & MY_FRAME_IN_SP)
+ {
+ *reg = SP_REGNUM;
+ *offset = -(dummy->extra_info->stack_size);
+ }
+ else
+ {
+ *reg = A3_REGNUM;
+ *offset = 0;
+ }
+}
+
+/* This can be made more generic later. */
+static void
+set_machine_hook (filename)
+ char *filename;
+{
+ int i;
+
+ if (bfd_get_mach (exec_bfd) == bfd_mach_mn10300
+ || bfd_get_mach (exec_bfd) == 0)
+ {
+ mn10300_register_names = mn10300_generic_register_names;
+ }
+
+}
+
+void
+_initialize_mn10300_tdep ()
+{
+/* printf("_initialize_mn10300_tdep\n"); */
+
+ tm_print_insn = print_insn_mn10300;
+
+ specify_exec_file_hook (set_machine_hook);
+}
+
diff --git a/contrib/gdb/gdb/ser-ocd.c b/contrib/gdb/gdb/ser-ocd.c
new file mode 100644
index 000000000000..971f84e049c4
--- /dev/null
+++ b/contrib/gdb/gdb/ser-ocd.c
@@ -0,0 +1,209 @@
+/* Remote serial interface for Macraigor Systems implementation of
+ On-Chip Debugging using serial target box or serial wiggler
+
+ Copyright 1994, 1997 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#include "defs.h"
+#include "serial.h"
+
+#ifdef _WIN32
+#include <windows.h>
+#endif
+
+static int ser_ocd_open PARAMS ((serial_t scb, const char *name));
+static void ser_ocd_raw PARAMS ((serial_t scb));
+static int ser_ocd_readchar PARAMS ((serial_t scb, int timeout));
+static int ser_ocd_setbaudrate PARAMS ((serial_t scb, int rate));
+static int ser_ocd_write PARAMS ((serial_t scb, const char *str, int len));
+static void ser_ocd_close PARAMS ((serial_t scb));
+static serial_ttystate ser_ocd_get_tty_state PARAMS ((serial_t scb));
+static int ser_ocd_set_tty_state PARAMS ((serial_t scb, serial_ttystate state));
+
+#ifdef _WIN32
+/* On Windows, this function pointer is initialized to a function in
+ the wiggler DLL. */
+static int (*dll_do_command) PARAMS ((const char *, char *));
+#endif
+
+static int
+ocd_open (scb, name)
+ serial_t scb;
+ const char *name;
+{
+#ifdef _WIN32
+ /* Find the wiggler DLL which talks to the board. */
+ if (dll_do_command == NULL)
+ {
+ HINSTANCE handle;
+
+ /* FIXME: Should the user be able to configure this? */
+ handle = LoadLibrary ("Wigglers.dll");
+ if (handle == NULL)
+ error ("Can't load Wigglers.dll");
+
+ dll_do_command = ((int (*) PARAMS ((const char *, char *)))
+ GetProcAddress (handle, "do_command"));
+ if (dll_do_command == NULL)
+ error ("Can't find do_command function in Wigglers.dll");
+ }
+#else
+ /* No wiggler DLLs on Unix yet, fail. */
+ error ("Wiggler library not available for this type of host.");
+#endif /* _WIN32 */
+ return 0;
+}
+
+static int
+ocd_noop (scb)
+ serial_t scb;
+{
+ return 0;
+}
+
+static void
+ocd_raw (scb)
+ serial_t scb;
+{
+ /* Always in raw mode */
+}
+
+static void
+ocd_readremote ()
+{
+}
+
+/* We need a buffer to store responses from the Wigglers.dll */
+#define WIGGLER_BUFF_SIZE 512
+unsigned char from_wiggler_buffer[WIGGLER_BUFF_SIZE];
+unsigned char * wiggler_buffer_ptr; /* curr spot in buffer */
+
+static int
+ocd_readchar (scb, timeout)
+ serial_t scb;
+ int timeout;
+{
+ /* Catch attempts at reading past the end of the buffer */
+ if (wiggler_buffer_ptr >
+ (from_wiggler_buffer + (sizeof (char *) * WIGGLER_BUFF_SIZE)))
+ error ("ocd_readchar asked to read past the end of the buffer!");
+
+ return (int) *wiggler_buffer_ptr++; /* return curr char and increment ptr */
+}
+
+struct ocd_ttystate {
+ int dummy;
+};
+
+/* ocd_{get set}_tty_state() are both dummys to fill out the function
+ vector. Someday, they may do something real... */
+
+static serial_ttystate
+ocd_get_tty_state (scb)
+ serial_t scb;
+{
+ struct ocd_ttystate *state;
+
+ state = (struct ocd_ttystate *) xmalloc (sizeof *state);
+
+ return (serial_ttystate) state;
+}
+
+static int
+ocd_set_tty_state (scb, ttystate)
+ serial_t scb;
+ serial_ttystate ttystate;
+{
+ return 0;
+}
+
+static int
+ocd_noflush_set_tty_state (scb, new_ttystate, old_ttystate)
+ serial_t scb;
+ serial_ttystate new_ttystate;
+ serial_ttystate old_ttystate;
+{
+ return 0;
+}
+
+static void
+ocd_print_tty_state (scb, ttystate)
+ serial_t scb;
+ serial_ttystate ttystate;
+{
+ /* Nothing to print. */
+ return;
+}
+
+static int
+ocd_setbaudrate (scb, rate)
+ serial_t scb;
+ int rate;
+{
+ return 0;
+}
+
+static int
+ocd_write (scb, str, len)
+ serial_t scb;
+ const char *str;
+ int len;
+{
+ char c;
+
+#ifdef _WIN32
+ /* send packet to Wigglers.dll and store response so we can give it to
+ remote-wiggler.c when get_packet is run */
+ dll_do_command (str, from_wiggler_buffer);
+ wiggler_buffer_ptr = from_wiggler_buffer;
+#endif
+
+ return 0;
+}
+
+static void
+ocd_close (scb)
+ serial_t scb;
+{
+}
+
+static struct serial_ops ocd_ops =
+{
+ "ocd",
+ 0,
+ ocd_open,
+ ocd_close,
+ ocd_readchar,
+ ocd_write,
+ ocd_noop, /* flush output */
+ ocd_noop, /* flush input */
+ ocd_noop, /* send break -- currently used only for nindy */
+ ocd_raw,
+ ocd_get_tty_state,
+ ocd_set_tty_state,
+ ocd_print_tty_state,
+ ocd_noflush_set_tty_state,
+ ocd_setbaudrate,
+ ocd_noop, /* wait for output to drain */
+};
+
+void
+_initialize_ser_ocd_bdm ()
+{
+ serial_add_interface (&ocd_ops);
+}
diff --git a/contrib/gdb/gdb/sh-stub.c b/contrib/gdb/gdb/sh-stub.c
new file mode 100644
index 000000000000..a036cff60628
--- /dev/null
+++ b/contrib/gdb/gdb/sh-stub.c
@@ -0,0 +1,1549 @@
+/* sh-stub.c -- debugging stub for the Hitachi-SH.
+
+ NOTE!! This code has to be compiled with optimization, otherwise the
+ function inlining which generates the exception handlers won't work.
+
+*/
+
+/* This is originally based on an m68k software stub written by Glenn
+ Engel at HP, but has changed quite a bit.
+
+ Modifications for the SH by Ben Lee and Steve Chamberlain
+
+*/
+
+/****************************************************************************
+
+ 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.
+
+****************************************************************************/
+
+
+/* Remote communication protocol.
+
+ A debug packet whose contents are <data>
+ is encapsulated for transmission in the form:
+
+ $ <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.
+
+ Receiver responds with:
+
+ + - if CSUM is correct and ready for next packet
+ - - if CSUM is incorrect
+
+ <data> is as follows:
+ All values are encoded in ascii hex digits.
+
+ Request Packet
+
+ read registers g
+ reply XX....X Each byte of register data
+ is described by two hex digits.
+ Registers are in the internal order
+ for GDB, and the bytes in a register
+ are in the same order the machine uses.
+ or ENN for an error.
+
+ write regs GXX..XX Each byte of register data
+ is described by two hex digits.
+ reply OK for success
+ ENN for an error
+
+ write reg Pn...=r... Write register n... with value r...,
+ which contains two hex digits for each
+ byte in the register (target byte
+ order).
+ reply OK for success
+ ENN for an error
+ (not supported by all stubs).
+
+ read mem mAA..AA,LLLL AA..AA is address, LLLL is length.
+ reply XX..XX XX..XX is mem contents
+ Can be fewer bytes than requested
+ if able to read only part of the data.
+ or ENN NN is errno
+
+ write mem MAA..AA,LLLL:XX..XX
+ AA..AA is address,
+ LLLL is number of bytes,
+ XX..XX is data
+ reply OK for success
+ ENN for an error (this includes the case
+ where only part of the data was
+ written).
+
+ cont cAA..AA AA..AA is address to resume
+ If AA..AA is omitted,
+ resume at same address.
+
+ step sAA..AA AA..AA is address to resume
+ If AA..AA is omitted,
+ resume at same address.
+
+ last signal ? Reply the current reason for stopping.
+ This is the same reply as is generated
+ for step or cont : SAA where AA is the
+ signal number.
+
+ There is no immediate reply to step or cont.
+ The reply comes when the machine stops.
+ It is SAA AA is the "signal number"
+
+ or... TAAn...:r...;n:r...;n...:r...;
+ AA = signal number
+ n... = register number
+ r... = register contents
+ or... WAA The process exited, and AA is
+ the exit status. This is only
+ applicable for certains sorts of
+ targets.
+ kill request k
+
+ toggle debug d toggle debug flag (see 386 & 68k stubs)
+ reset r reset -- see sparc stub.
+ reserved <other> On other requests, the stub should
+ ignore the request and send an empty
+ response ($#<checksum>). This way
+ we can extend the protocol and GDB
+ can tell whether the stub it is
+ talking to uses the old or the new.
+ search tAA:PP,MM Search backwards starting at address
+ AA for a match with pattern PP and
+ mask MM. PP and MM are 4 bytes.
+ Not supported by all stubs.
+
+ general query qXXXX Request info about XXXX.
+ general set QXXXX=yyyy Set value of XXXX to yyyy.
+ query sect offs qOffsets Get section offsets. Reply is
+ Text=xxx;Data=yyy;Bss=zzz
+ console output Otext Send text to stdout. Only comes from
+ remote target.
+
+ Responses can be run-length encoded to save space. A '*' means that
+ the next character is an ASCII encoding giving a repeat count which
+ stands for that many repititions of the character preceding the '*'.
+ The encoding is n+29, yielding a printable character where n >=3
+ (which is where rle starts to win). Don't use an n > 126.
+
+ So
+ "0* " means the same as "0000". */
+
+#include <string.h>
+#include <setjmp.h>
+
+
+
+#define COND_BR_MASK 0xff00
+#define UCOND_DBR_MASK 0xe000
+#define UCOND_RBR_MASK 0xf0df
+#define TRAPA_MASK 0xff00
+
+#define COND_DISP 0x00ff
+#define UCOND_DISP 0x0fff
+#define UCOND_REG 0x0f00
+
+#define BF_INSTR 0x8b00
+#define BT_INSTR 0x8900
+#define BRA_INSTR 0xa000
+#define BSR_INSTR 0xb000
+#define JMP_INSTR 0x402b
+#define JSR_INSTR 0x400b
+#define RTS_INSTR 0x000b
+#define RTE_INSTR 0x002b
+#define TRAPA_INSTR 0xc300
+
+#define SSTEP_INSTR 0xc3ff
+
+#define T_BIT_MASK 0x0001
+/*
+ * BUFMAX defines the maximum number of characters in inbound/outbound
+ * buffers at least NUMREGBYTES*2 are needed for register packets
+ */
+#define BUFMAX 1024
+
+/*
+ * Number of bytes for registers
+ */
+#define NUMREGBYTES 112 /* 92 */
+
+/*
+ * typedef
+ */
+typedef void (*Function) ();
+
+/*
+ * Forward declarations
+ */
+
+static int hex (char);
+static char *mem2hex (char *, char *, int);
+static char *hex2mem (char *, char *, int);
+static int hexToInt (char **, int *);
+static void getpacket (char *);
+static void putpacket (char *);
+static void handle_buserror (void);
+static int computeSignal (int exceptionVector);
+static void handle_exception (int exceptionVector);
+void init_serial();
+
+void putDebugChar (char);
+char getDebugChar (void);
+
+/* These are in the file but in asm statements so the compiler can't see them */
+void catch_exception_4 (void);
+void catch_exception_6 (void);
+void catch_exception_9 (void);
+void catch_exception_10 (void);
+void catch_exception_11 (void);
+void catch_exception_32 (void);
+void catch_exception_33 (void);
+void catch_exception_255 (void);
+
+
+
+#define catch_exception_random catch_exception_255 /* Treat all odd ones like 255 */
+
+void breakpoint (void);
+
+
+#define init_stack_size 8*1024 /* if you change this you should also modify BINIT */
+#define stub_stack_size 8*1024
+
+int init_stack[init_stack_size] __attribute__ ((section ("stack"))) = {0};
+int stub_stack[stub_stack_size] __attribute__ ((section ("stack"))) = {0};
+
+typedef struct
+ {
+ void (*func_cold) ();
+ int *stack_cold;
+ void (*func_warm) ();
+ int *stack_warm;
+ void (*(handler[256 - 4])) ();
+ }
+vec_type;
+
+
+void INIT ();
+void BINIT ();
+
+/* When you link take care that this is at address 0 -
+ or wherever your vbr points */
+
+#define CPU_BUS_ERROR_VEC 9
+#define DMA_BUS_ERROR_VEC 10
+#define NMI_VEC 11
+#define INVALID_INSN_VEC 4
+#define INVALID_SLOT_VEC 6
+#define TRAP_VEC 32
+#define IO_VEC 33
+#define USER_VEC 255
+
+
+#define BCR (*(volatile short *)(0x05FFFFA0)) /* Bus control register */
+#define BAS (0x800) /* Byte access select */
+#define WCR1 (*(volatile short *)(0x05ffffA2)) /* Wait state control register */
+
+const vec_type vectable =
+{
+ &BINIT, /* 0: Power-on reset PC */
+ init_stack + init_stack_size, /* 1: Power-on reset SP */
+ &BINIT, /* 2: Manual reset PC */
+ init_stack + init_stack_size, /* 3: Manual reset SP */
+{
+ &catch_exception_4, /* 4: General invalid instruction */
+ &catch_exception_random, /* 5: Reserved for system */
+ &catch_exception_6, /* 6: Invalid slot instruction */
+ &catch_exception_random, /* 7: Reserved for system */
+ &catch_exception_random, /* 8: Reserved for system */
+ &catch_exception_9, /* 9: CPU bus error */
+ &catch_exception_10, /* 10: DMA bus error */
+ &catch_exception_11, /* 11: NMI */
+ &catch_exception_random, /* 12: User break */
+ &catch_exception_random, /* 13: Reserved for system */
+ &catch_exception_random, /* 14: Reserved for system */
+ &catch_exception_random, /* 15: Reserved for system */
+ &catch_exception_random, /* 16: Reserved for system */
+ &catch_exception_random, /* 17: Reserved for system */
+ &catch_exception_random, /* 18: Reserved for system */
+ &catch_exception_random, /* 19: Reserved for system */
+ &catch_exception_random, /* 20: Reserved for system */
+ &catch_exception_random, /* 21: Reserved for system */
+ &catch_exception_random, /* 22: Reserved for system */
+ &catch_exception_random, /* 23: Reserved for system */
+ &catch_exception_random, /* 24: Reserved for system */
+ &catch_exception_random, /* 25: Reserved for system */
+ &catch_exception_random, /* 26: Reserved for system */
+ &catch_exception_random, /* 27: Reserved for system */
+ &catch_exception_random, /* 28: Reserved for system */
+ &catch_exception_random, /* 29: Reserved for system */
+ &catch_exception_random, /* 30: Reserved for system */
+ &catch_exception_random, /* 31: Reserved for system */
+ &catch_exception_32, /* 32: Trap instr (user vectors) */
+ &catch_exception_33, /* 33: Trap instr (user vectors) */
+ &catch_exception_random, /* 34: Trap instr (user vectors) */
+ &catch_exception_random, /* 35: Trap instr (user vectors) */
+ &catch_exception_random, /* 36: Trap instr (user vectors) */
+ &catch_exception_random, /* 37: Trap instr (user vectors) */
+ &catch_exception_random, /* 38: Trap instr (user vectors) */
+ &catch_exception_random, /* 39: Trap instr (user vectors) */
+ &catch_exception_random, /* 40: Trap instr (user vectors) */
+ &catch_exception_random, /* 41: Trap instr (user vectors) */
+ &catch_exception_random, /* 42: Trap instr (user vectors) */
+ &catch_exception_random, /* 43: Trap instr (user vectors) */
+ &catch_exception_random, /* 44: Trap instr (user vectors) */
+ &catch_exception_random, /* 45: Trap instr (user vectors) */
+ &catch_exception_random, /* 46: Trap instr (user vectors) */
+ &catch_exception_random, /* 47: Trap instr (user vectors) */
+ &catch_exception_random, /* 48: Trap instr (user vectors) */
+ &catch_exception_random, /* 49: Trap instr (user vectors) */
+ &catch_exception_random, /* 50: Trap instr (user vectors) */
+ &catch_exception_random, /* 51: Trap instr (user vectors) */
+ &catch_exception_random, /* 52: Trap instr (user vectors) */
+ &catch_exception_random, /* 53: Trap instr (user vectors) */
+ &catch_exception_random, /* 54: Trap instr (user vectors) */
+ &catch_exception_random, /* 55: Trap instr (user vectors) */
+ &catch_exception_random, /* 56: Trap instr (user vectors) */
+ &catch_exception_random, /* 57: Trap instr (user vectors) */
+ &catch_exception_random, /* 58: Trap instr (user vectors) */
+ &catch_exception_random, /* 59: Trap instr (user vectors) */
+ &catch_exception_random, /* 60: Trap instr (user vectors) */
+ &catch_exception_random, /* 61: Trap instr (user vectors) */
+ &catch_exception_random, /* 62: Trap instr (user vectors) */
+ &catch_exception_random, /* 63: Trap instr (user vectors) */
+ &catch_exception_random, /* 64: IRQ0 */
+ &catch_exception_random, /* 65: IRQ1 */
+ &catch_exception_random, /* 66: IRQ2 */
+ &catch_exception_random, /* 67: IRQ3 */
+ &catch_exception_random, /* 68: IRQ4 */
+ &catch_exception_random, /* 69: IRQ5 */
+ &catch_exception_random, /* 70: IRQ6 */
+ &catch_exception_random, /* 71: IRQ7 */
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_random,
+ &catch_exception_255}};
+
+
+char in_nmi; /* Set when handling an NMI, so we don't reenter */
+int dofault; /* Non zero, bus errors will raise exception */
+
+int *stub_sp;
+
+/* debug > 0 prints ill-formed commands in valid packets & checksum errors */
+int remote_debug;
+
+/* jump buffer used for setjmp/longjmp */
+jmp_buf remcomEnv;
+
+enum regnames
+ {
+ R0, R1, R2, R3, R4, R5, R6, R7,
+ R8, R9, R10, R11, R12, R13, R14,
+ R15, PC, PR, GBR, VBR, MACH, MACL, SR,
+ TICKS, STALLS, CYCLES, INSTS, PLR
+ };
+
+typedef struct
+ {
+ short *memAddr;
+ short oldInstr;
+ }
+stepData;
+
+int registers[NUMREGBYTES / 4];
+stepData instrBuffer;
+char stepped;
+static const char hexchars[] = "0123456789abcdef";
+char remcomInBuffer[BUFMAX];
+char remcomOutBuffer[BUFMAX];
+
+char highhex(int x)
+{
+ return hexchars[(x >> 4) & 0xf];
+}
+
+char lowhex(int x)
+{
+ return hexchars[x & 0xf];
+}
+
+/*
+ * Assembly macros
+ */
+
+#define BREAKPOINT() asm("trapa #0x20"::);
+
+
+/*
+ * Routines to handle hex data
+ */
+
+static int
+hex (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);
+}
+
+/* convert the memory, pointed to by mem into hex, placing result in buf */
+/* return a pointer to the last char put in buf (null) */
+static char *
+mem2hex (char *mem, char *buf, int count)
+{
+ int i;
+ int ch;
+ for (i = 0; i < count; i++)
+ {
+ ch = *mem++;
+ *buf++ = highhex (ch);
+ *buf++ = lowhex (ch);
+ }
+ *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 char *
+hex2mem (char *buf, char *mem, int count)
+{
+ int i;
+ unsigned char ch;
+ for (i = 0; i < count; i++)
+ {
+ ch = hex (*buf++) << 4;
+ ch = ch + hex (*buf++);
+ *mem++ = ch;
+ }
+ return (mem);
+}
+
+/**********************************************/
+/* WHILE WE FIND NICE HEX CHARS, BUILD AN INT */
+/* RETURN NUMBER OF CHARS PROCESSED */
+/**********************************************/
+static int
+hexToInt (char **ptr, int *intValue)
+{
+ int numChars = 0;
+ int hexValue;
+
+ *intValue = 0;
+
+ while (**ptr)
+ {
+ hexValue = hex (**ptr);
+ if (hexValue >= 0)
+ {
+ *intValue = (*intValue << 4) | hexValue;
+ numChars++;
+ }
+ else
+ break;
+
+ (*ptr)++;
+ }
+
+ return (numChars);
+}
+
+/*
+ * Routines to get and put packets
+ */
+
+/* scan for the sequence $<data>#<checksum> */
+
+static
+void
+getpacket (char *buffer)
+{
+ unsigned char checksum;
+ unsigned char xmitcsum;
+ int i;
+ int count;
+ char ch;
+ do
+ {
+ /* wait around for the start character, ignore all other characters */
+ 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;
+ }
+ buffer[count] = 0;
+
+ if (ch == '#')
+ {
+ xmitcsum = hex (getDebugChar ()) << 4;
+ xmitcsum += hex (getDebugChar ());
+ 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. The host get's one chance to read it.
+ This routine does not wait for a positive acknowledge. */
+
+static void
+putpacket (register char *buffer)
+{
+ register int checksum;
+ register int count;
+
+ /* $<packet info>#<checksum>. */
+ do
+ {
+ char *src = buffer;
+ putDebugChar ('$');
+ checksum = 0;
+
+ while (*src)
+ {
+ int runlen;
+
+ /* Do run length encoding */
+ for (runlen = 0; runlen < 100; runlen ++)
+ {
+ if (src[0] != src[runlen])
+ {
+ if (runlen > 3)
+ {
+ int encode;
+ /* Got a useful amount */
+ putDebugChar (*src);
+ checksum += *src;
+ putDebugChar ('*');
+ checksum += '*';
+ checksum += (encode = runlen + ' ' - 4);
+ putDebugChar (encode);
+ src += runlen;
+ }
+ else
+ {
+ putDebugChar (*src);
+ checksum += *src;
+ src++;
+ }
+ break;
+ }
+ }
+ }
+
+
+ putDebugChar ('#');
+ putDebugChar (highhex(checksum));
+ putDebugChar (lowhex(checksum));
+ }
+ while (getDebugChar() != '+');
+
+}
+
+
+/* a bus error has occurred, perform a longjmp
+ to return execution and allow handling of the error */
+
+void
+handle_buserror (void)
+{
+ longjmp (remcomEnv, 1);
+}
+
+/*
+ * this function takes the SH-1 exception number and attempts to
+ * translate this number into a unix compatible signal value
+ */
+static int
+computeSignal (int exceptionVector)
+{
+ int sigval;
+ switch (exceptionVector)
+ {
+ case INVALID_INSN_VEC:
+ sigval = 4;
+ break;
+ case INVALID_SLOT_VEC:
+ sigval = 4;
+ break;
+ case CPU_BUS_ERROR_VEC:
+ sigval = 10;
+ break;
+ case DMA_BUS_ERROR_VEC:
+ sigval = 10;
+ break;
+ case NMI_VEC:
+ sigval = 2;
+ break;
+
+ case TRAP_VEC:
+ case USER_VEC:
+ sigval = 5;
+ break;
+
+ default:
+ sigval = 7; /* "software generated"*/
+ break;
+ }
+ return (sigval);
+}
+
+void
+doSStep (void)
+{
+ short *instrMem;
+ int displacement;
+ int reg;
+ unsigned short opcode;
+
+ instrMem = (short *) registers[PC];
+
+ opcode = *instrMem;
+ stepped = 1;
+
+ if ((opcode & COND_BR_MASK) == BT_INSTR)
+ {
+ if (registers[SR] & T_BIT_MASK)
+ {
+ displacement = (opcode & COND_DISP) << 1;
+ if (displacement & 0x80)
+ displacement |= 0xffffff00;
+ /*
+ * Remember PC points to second instr.
+ * after PC of branch ... so add 4
+ */
+ instrMem = (short *) (registers[PC] + displacement + 4);
+ }
+ else
+ instrMem += 1;
+ }
+ else if ((opcode & COND_BR_MASK) == BF_INSTR)
+ {
+ if (registers[SR] & T_BIT_MASK)
+ instrMem += 1;
+ else
+ {
+ displacement = (opcode & COND_DISP) << 1;
+ if (displacement & 0x80)
+ displacement |= 0xffffff00;
+ /*
+ * Remember PC points to second instr.
+ * after PC of branch ... so add 4
+ */
+ instrMem = (short *) (registers[PC] + displacement + 4);
+ }
+ }
+ else if ((opcode & UCOND_DBR_MASK) == BRA_INSTR)
+ {
+ displacement = (opcode & UCOND_DISP) << 1;
+ if (displacement & 0x0800)
+ displacement |= 0xfffff000;
+
+ /*
+ * Remember PC points to second instr.
+ * after PC of branch ... so add 4
+ */
+ instrMem = (short *) (registers[PC] + displacement + 4);
+ }
+ else if ((opcode & UCOND_RBR_MASK) == JSR_INSTR)
+ {
+ reg = (char) ((opcode & UCOND_REG) >> 8);
+
+ instrMem = (short *) registers[reg];
+ }
+ else if (opcode == RTS_INSTR)
+ instrMem = (short *) registers[PR];
+ else if (opcode == RTE_INSTR)
+ instrMem = (short *) registers[15];
+ else if ((opcode & TRAPA_MASK) == TRAPA_INSTR)
+ instrMem = (short *) ((opcode & ~TRAPA_MASK) << 2);
+ else
+ instrMem += 1;
+
+ instrBuffer.memAddr = instrMem;
+ instrBuffer.oldInstr = *instrMem;
+ *instrMem = SSTEP_INSTR;
+}
+
+
+/* Undo the effect of a previous doSStep. If we single stepped,
+ restore the old instruction. */
+
+void
+undoSStep (void)
+{
+ if (stepped)
+ { short *instrMem;
+ instrMem = instrBuffer.memAddr;
+ *instrMem = instrBuffer.oldInstr;
+ }
+ stepped = 0;
+}
+
+/*
+This function does all exception handling. It only does two things -
+it figures out why it was called and tells gdb, and then it reacts
+to gdb's requests.
+
+When in the monitor mode we talk a human on the serial line rather than gdb.
+
+*/
+
+
+void
+gdb_handle_exception (int exceptionVector)
+{
+ int sigval;
+ int addr, length;
+ char *ptr;
+
+ /* reply to host that an exception has occurred */
+ sigval = computeSignal (exceptionVector);
+ remcomOutBuffer[0] = 'S';
+ remcomOutBuffer[1] = highhex(sigval);
+ remcomOutBuffer[2] = lowhex (sigval);
+ remcomOutBuffer[3] = 0;
+
+ putpacket (remcomOutBuffer);
+
+ /*
+ * exception 255 indicates a software trap
+ * inserted in place of code ... so back up
+ * PC by one instruction, since this instruction
+ * will later be replaced by its original one!
+ */
+ if (exceptionVector == 0xff
+ || exceptionVector == 0x20)
+ registers[PC] -= 2;
+
+ /*
+ * Do the thangs needed to undo
+ * any stepping we may have done!
+ */
+ undoSStep ();
+
+ while (1)
+ {
+ remcomOutBuffer[0] = 0;
+ getpacket (remcomInBuffer);
+
+ switch (remcomInBuffer[0])
+ {
+ case '?':
+ remcomOutBuffer[0] = 'S';
+ remcomOutBuffer[1] = highhex (sigval);
+ remcomOutBuffer[2] = lowhex (sigval);
+ remcomOutBuffer[3] = 0;
+ break;
+ case 'd':
+ remote_debug = !(remote_debug); /* toggle debug flag */
+ break;
+ case 'g': /* return the value of the CPU registers */
+ mem2hex ((char *) registers, remcomOutBuffer, NUMREGBYTES);
+ break;
+ case 'G': /* set the value of the CPU registers - return OK */
+ hex2mem (&remcomInBuffer[1], (char *) registers, NUMREGBYTES);
+ strcpy (remcomOutBuffer, "OK");
+ break;
+
+ /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */
+ case 'm':
+ if (setjmp (remcomEnv) == 0)
+ {
+ dofault = 0;
+ /* TRY, TO READ %x,%x. IF SUCCEED, SET PTR = 0 */
+ ptr = &remcomInBuffer[1];
+ if (hexToInt (&ptr, &addr))
+ if (*(ptr++) == ',')
+ if (hexToInt (&ptr, &length))
+ {
+ ptr = 0;
+ mem2hex ((char *) addr, remcomOutBuffer, length);
+ }
+ if (ptr)
+ strcpy (remcomOutBuffer, "E01");
+ }
+ else
+ strcpy (remcomOutBuffer, "E03");
+
+ /* restore handler for bus error */
+ dofault = 1;
+ break;
+
+ /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */
+ case 'M':
+ if (setjmp (remcomEnv) == 0)
+ {
+ dofault = 0;
+
+ /* TRY, TO READ '%x,%x:'. IF SUCCEED, SET PTR = 0 */
+ ptr = &remcomInBuffer[1];
+ if (hexToInt (&ptr, &addr))
+ if (*(ptr++) == ',')
+ if (hexToInt (&ptr, &length))
+ if (*(ptr++) == ':')
+ {
+ hex2mem (ptr, (char *) addr, length);
+ ptr = 0;
+ strcpy (remcomOutBuffer, "OK");
+ }
+ if (ptr)
+ strcpy (remcomOutBuffer, "E02");
+ }
+ else
+ strcpy (remcomOutBuffer, "E03");
+
+ /* restore handler for bus error */
+ dofault = 1;
+ break;
+
+ /* cAA..AA Continue at address AA..AA(optional) */
+ /* sAA..AA Step one instruction from AA..AA(optional) */
+ case 'c':
+ case 's':
+ {
+ /* tRY, to read optional parameter, pc unchanged if no parm */
+ ptr = &remcomInBuffer[1];
+ if (hexToInt (&ptr, &addr))
+ registers[PC] = addr;
+
+ if (remcomInBuffer[0] == 's')
+ doSStep ();
+ }
+ return;
+ break;
+
+ /* kill the program */
+ case 'k': /* do nothing */
+ break;
+ } /* switch */
+
+ /* reply to the request */
+ putpacket (remcomOutBuffer);
+ }
+}
+
+
+#define GDBCOOKIE 0x5ac
+static int ingdbmode;
+/* We've had an exception - choose to go into the monitor or
+ the gdb stub */
+void handle_exception(int exceptionVector)
+{
+#ifdef MONITOR
+ if (ingdbmode != GDBCOOKIE)
+ monitor_handle_exception (exceptionVector);
+ else
+#endif
+ gdb_handle_exception (exceptionVector);
+
+}
+
+void
+gdb_mode()
+{
+ ingdbmode = GDBCOOKIE;
+ breakpoint();
+}
+/* This function will generate a breakpoint exception. It is used at the
+ beginning of a program to sync up with a debugger and can be used
+ otherwise as a quick means to stop program execution and "break" into
+ the debugger. */
+
+void
+breakpoint (void)
+{
+ BREAKPOINT ();
+}
+
+asm ("_BINIT: mov.l L1,r15");
+asm ("bra _INIT");
+asm ("nop");
+asm ("L1: .long _init_stack + 8*1024*4");
+void
+INIT (void)
+{
+ /* First turn on the ram */
+ WCR1 = 0; /* Never sample wait */
+ BCR = BAS; /* use lowbyte/high byte */
+
+ init_serial();
+
+#ifdef MONITOR
+ reset_hook ();
+#endif
+
+
+ in_nmi = 0;
+ dofault = 1;
+ stepped = 0;
+
+ stub_sp = stub_stack + stub_stack_size;
+ breakpoint ();
+
+ while (1)
+ ;
+}
+
+
+static void sr()
+{
+
+
+ /* Calling Reset does the same as pressing the button */
+ asm (".global _Reset
+ .global _WarmReset
+_Reset:
+_WarmReset:
+ mov.l L_sp,r15
+ bra _INIT
+ nop
+ .align 2
+L_sp: .long _init_stack + 8000");
+
+ asm("saveRegisters:
+ mov.l @(L_reg, pc), r0
+ mov.l @r15+, r1 ! pop R0
+ mov.l r2, @(0x08, r0) ! save R2
+ mov.l r1, @r0 ! save R0
+ mov.l @r15+, r1 ! pop R1
+ mov.l r3, @(0x0c, r0) ! save R3
+ mov.l r1, @(0x04, r0) ! save R1
+ mov.l r4, @(0x10, r0) ! save R4
+ mov.l r5, @(0x14, r0) ! save R5
+ mov.l r6, @(0x18, r0) ! save R6
+ mov.l r7, @(0x1c, r0) ! save R7
+ mov.l r8, @(0x20, r0) ! save R8
+ mov.l r9, @(0x24, r0) ! save R9
+ mov.l r10, @(0x28, r0) ! save R10
+ mov.l r11, @(0x2c, r0) ! save R11
+ mov.l r12, @(0x30, r0) ! save R12
+ mov.l r13, @(0x34, r0) ! save R13
+ mov.l r14, @(0x38, r0) ! save R14
+ mov.l @r15+, r4 ! save arg to handleException
+ add #8, r15 ! hide PC/SR values on stack
+ mov.l r15, @(0x3c, r0) ! save R15
+ add #-8, r15 ! save still needs old SP value
+ add #92, r0 ! readjust register pointer
+ mov r15, r2
+ add #4, r2
+ mov.l @r2, r2 ! R2 has SR
+ mov.l @r15, r1 ! R1 has PC
+ mov.l r2, @-r0 ! save SR
+ sts.l macl, @-r0 ! save MACL
+ sts.l mach, @-r0 ! save MACH
+ stc.l vbr, @-r0 ! save VBR
+ stc.l gbr, @-r0 ! save GBR
+ sts.l pr, @-r0 ! save PR
+ mov.l @(L_stubstack, pc), r2
+ mov.l @(L_hdl_except, pc), r3
+ mov.l @r2, r15
+ jsr @r3
+ mov.l r1, @-r0 ! save PC
+ mov.l @(L_stubstack, pc), r0
+ mov.l @(L_reg, pc), r1
+ bra restoreRegisters
+ mov.l r15, @r0 ! save __stub_stack
+
+ .align 2
+L_reg:
+ .long _registers
+L_stubstack:
+ .long _stub_sp
+L_hdl_except:
+ .long _handle_exception");
+
+}
+
+static void rr()
+{
+asm("
+ .align 2
+ .global _resume
+_resume:
+ mov r4,r1
+restoreRegisters:
+ add #8, r1 ! skip to R2
+ mov.l @r1+, r2 ! restore R2
+ mov.l @r1+, r3 ! restore R3
+ mov.l @r1+, r4 ! restore R4
+ mov.l @r1+, r5 ! restore R5
+ mov.l @r1+, r6 ! restore R6
+ mov.l @r1+, r7 ! restore R7
+ mov.l @r1+, r8 ! restore R8
+ mov.l @r1+, r9 ! restore R9
+ mov.l @r1+, r10 ! restore R10
+ mov.l @r1+, r11 ! restore R11
+ mov.l @r1+, r12 ! restore R12
+ mov.l @r1+, r13 ! restore R13
+ mov.l @r1+, r14 ! restore R14
+ mov.l @r1+, r15 ! restore programs stack
+ mov.l @r1+, r0
+ add #-8, r15 ! uncover PC/SR on stack
+ mov.l r0, @r15 ! restore PC onto stack
+ lds.l @r1+, pr ! restore PR
+ ldc.l @r1+, gbr ! restore GBR
+ ldc.l @r1+, vbr ! restore VBR
+ lds.l @r1+, mach ! restore MACH
+ lds.l @r1+, macl ! restore MACL
+ mov.l @r1, r0
+ add #-88, r1 ! readjust reg pointer to R1
+ mov.l r0, @(4, r15) ! restore SR onto stack+4
+ mov.l r2, @-r15
+ mov.l L_in_nmi, r0
+ mov #0, r2
+ mov.b r2, @r0
+ mov.l @r15+, r2
+ mov.l @r1+, r0 ! restore R0
+ rte
+ mov.l @r1, r1 ! restore R1
+
+");
+}
+
+
+static __inline__ void code_for_catch_exception(int n)
+{
+ asm(" .globl _catch_exception_%O0" : : "i" (n) );
+ asm(" _catch_exception_%O0:" :: "i" (n) );
+
+ asm(" add #-4, r15 ! reserve spot on stack ");
+ asm(" mov.l r1, @-r15 ! push R1 ");
+
+ if (n == NMI_VEC)
+ {
+ /* Special case for NMI - make sure that they don't nest */
+ asm(" mov.l r0, @-r15 ! push R0");
+ asm(" mov.l L_in_nmi, r0");
+ asm(" tas.b @r0 ! Fend off against addtnl NMIs");
+ asm(" bt noNMI");
+ asm(" mov.l @r15+, r0");
+ asm(" mov.l @r15+, r1");
+ asm(" add #4, r15");
+ asm(" rte");
+ asm(" nop");
+ asm(".align 2");
+ asm("L_in_nmi: .long _in_nmi");
+ asm("noNMI:");
+ }
+ else
+ {
+
+ if (n == CPU_BUS_ERROR_VEC)
+ {
+ /* Exception 9 (bus errors) are disasbleable - so that you
+ can probe memory and get zero instead of a fault.
+ Because the vector table may be in ROM we don't revector
+ the interrupt like all the other stubs, we check in here
+ */
+ asm("mov.l L_dofault,r1");
+ asm("mov.l @r1,r1");
+ asm("tst r1,r1");
+ asm("bf faultaway");
+ asm("bsr _handle_buserror");
+ asm(".align 2");
+ asm("L_dofault: .long _dofault");
+ asm("faultaway:");
+ }
+ asm(" mov #15<<4, r1 ");
+ asm(" ldc r1, sr ! disable interrupts ");
+ asm(" mov.l r0, @-r15 ! push R0 ");
+ }
+
+ /* Prepare for saving context, we've already pushed r0 and r1, stick exception number
+ into the frame */
+ asm(" mov r15, r0 ");
+ asm(" add #8, r0 ");
+ asm(" mov %0,r1" :: "i" (n) );
+ asm(" extu.b r1,r1 ");
+ asm(" bra saveRegisters ! save register values ");
+ asm(" mov.l r1, @r0 ! save exception # ");
+}
+
+
+static void
+exceptions()
+{
+ code_for_catch_exception (CPU_BUS_ERROR_VEC);
+ code_for_catch_exception (DMA_BUS_ERROR_VEC);
+ code_for_catch_exception (INVALID_INSN_VEC);
+ code_for_catch_exception (INVALID_SLOT_VEC);
+ code_for_catch_exception (NMI_VEC);
+ code_for_catch_exception (TRAP_VEC);
+ code_for_catch_exception (USER_VEC);
+ code_for_catch_exception (IO_VEC);
+}
+
+
+
+
+
+
+/* Support for Serial I/O using on chip uart */
+
+#define SMR0 (*(volatile char *)(0x05FFFEC0)) /* Channel 0 serial mode register */
+#define BRR0 (*(volatile char *)(0x05FFFEC1)) /* Channel 0 bit rate register */
+#define SCR0 (*(volatile char *)(0x05FFFEC2)) /* Channel 0 serial control register */
+#define TDR0 (*(volatile char *)(0x05FFFEC3)) /* Channel 0 transmit data register */
+#define SSR0 (*(volatile char *)(0x05FFFEC4)) /* Channel 0 serial status register */
+#define RDR0 (*(volatile char *)(0x05FFFEC5)) /* Channel 0 receive data register */
+
+#define SMR1 (*(volatile char *)(0x05FFFEC8)) /* Channel 1 serial mode register */
+#define BRR1 (*(volatile char *)(0x05FFFEC9)) /* Channel 1 bit rate register */
+#define SCR1 (*(volatile char *)(0x05FFFECA)) /* Channel 1 serial control register */
+#define TDR1 (*(volatile char *)(0x05FFFECB)) /* Channel 1 transmit data register */
+#define SSR1 (*(volatile char *)(0x05FFFECC)) /* Channel 1 serial status register */
+#define RDR1 (*(volatile char *)(0x05FFFECD)) /* Channel 1 receive data register */
+
+/*
+ * Serial mode register bits
+ */
+
+#define SYNC_MODE 0x80
+#define SEVEN_BIT_DATA 0x40
+#define PARITY_ON 0x20
+#define ODD_PARITY 0x10
+#define STOP_BITS_2 0x08
+#define ENABLE_MULTIP 0x04
+#define PHI_64 0x03
+#define PHI_16 0x02
+#define PHI_4 0x01
+
+/*
+ * Serial control register bits
+ */
+#define SCI_TIE 0x80 /* Transmit interrupt enable */
+#define SCI_RIE 0x40 /* Receive interrupt enable */
+#define SCI_TE 0x20 /* Transmit enable */
+#define SCI_RE 0x10 /* Receive enable */
+#define SCI_MPIE 0x08 /* Multiprocessor interrupt enable */
+#define SCI_TEIE 0x04 /* Transmit end interrupt enable */
+#define SCI_CKE1 0x02 /* Clock enable 1 */
+#define SCI_CKE0 0x01 /* Clock enable 0 */
+
+/*
+ * Serial status register bits
+ */
+#define SCI_TDRE 0x80 /* Transmit data register empty */
+#define SCI_RDRF 0x40 /* Receive data register full */
+#define SCI_ORER 0x20 /* Overrun error */
+#define SCI_FER 0x10 /* Framing error */
+#define SCI_PER 0x08 /* Parity error */
+#define SCI_TEND 0x04 /* Transmit end */
+#define SCI_MPB 0x02 /* Multiprocessor bit */
+#define SCI_MPBT 0x01 /* Multiprocessor bit transfer */
+
+
+/*
+ * Port B IO Register (PBIOR)
+ */
+#define PBIOR (*(volatile char *)(0x05FFFFC6))
+#define PB15IOR 0x8000
+#define PB14IOR 0x4000
+#define PB13IOR 0x2000
+#define PB12IOR 0x1000
+#define PB11IOR 0x0800
+#define PB10IOR 0x0400
+#define PB9IOR 0x0200
+#define PB8IOR 0x0100
+#define PB7IOR 0x0080
+#define PB6IOR 0x0040
+#define PB5IOR 0x0020
+#define PB4IOR 0x0010
+#define PB3IOR 0x0008
+#define PB2IOR 0x0004
+#define PB1IOR 0x0002
+#define PB0IOR 0x0001
+
+/*
+ * Port B Control Register (PBCR1)
+ */
+#define PBCR1 (*(volatile short *)(0x05FFFFCC))
+#define PB15MD1 0x8000
+#define PB15MD0 0x4000
+#define PB14MD1 0x2000
+#define PB14MD0 0x1000
+#define PB13MD1 0x0800
+#define PB13MD0 0x0400
+#define PB12MD1 0x0200
+#define PB12MD0 0x0100
+#define PB11MD1 0x0080
+#define PB11MD0 0x0040
+#define PB10MD1 0x0020
+#define PB10MD0 0x0010
+#define PB9MD1 0x0008
+#define PB9MD0 0x0004
+#define PB8MD1 0x0002
+#define PB8MD0 0x0001
+
+#define PB15MD PB15MD1|PB14MD0
+#define PB14MD PB14MD1|PB14MD0
+#define PB13MD PB13MD1|PB13MD0
+#define PB12MD PB12MD1|PB12MD0
+#define PB11MD PB11MD1|PB11MD0
+#define PB10MD PB10MD1|PB10MD0
+#define PB9MD PB9MD1|PB9MD0
+#define PB8MD PB8MD1|PB8MD0
+
+#define PB_TXD1 PB11MD1
+#define PB_RXD1 PB10MD1
+#define PB_TXD0 PB9MD1
+#define PB_RXD0 PB8MD1
+
+/*
+ * Port B Control Register (PBCR2)
+ */
+#define PBCR2 0x05FFFFCE
+#define PB7MD1 0x8000
+#define PB7MD0 0x4000
+#define PB6MD1 0x2000
+#define PB6MD0 0x1000
+#define PB5MD1 0x0800
+#define PB5MD0 0x0400
+#define PB4MD1 0x0200
+#define PB4MD0 0x0100
+#define PB3MD1 0x0080
+#define PB3MD0 0x0040
+#define PB2MD1 0x0020
+#define PB2MD0 0x0010
+#define PB1MD1 0x0008
+#define PB1MD0 0x0004
+#define PB0MD1 0x0002
+#define PB0MD0 0x0001
+
+#define PB7MD PB7MD1|PB7MD0
+#define PB6MD PB6MD1|PB6MD0
+#define PB5MD PB5MD1|PB5MD0
+#define PB4MD PB4MD1|PB4MD0
+#define PB3MD PB3MD1|PB3MD0
+#define PB2MD PB2MD1|PB2MD0
+#define PB1MD PB1MD1|PB1MD0
+#define PB0MD PB0MD1|PB0MD0
+
+
+#ifdef MHZ
+#define BPS 32 * 9600 * MHZ / ( BAUD * 10)
+#else
+#define BPS 32 /* 9600 for 10 Mhz */
+#endif
+
+void handleError (char theSSR);
+
+void
+nop ()
+{
+
+}
+void
+init_serial()
+{
+ int i;
+
+ /* Clear TE and RE in Channel 1's SCR */
+ SCR1 &= ~(SCI_TE | SCI_RE);
+
+ /* Set communication to be async, 8-bit data, no parity, 1 stop bit and use internal clock */
+
+ SMR1 = 0;
+ BRR1 = BPS;
+
+ SCR1 &= ~(SCI_CKE1 | SCI_CKE0);
+
+ /* let the hardware settle */
+
+ for (i = 0; i < 1000; i++)
+ nop ();
+
+ /* Turn on in and out */
+ SCR1 |= SCI_RE | SCI_TE;
+
+ /* Set the PFC to make RXD1 (pin PB8) an input pin and TXD1 (pin PB9) an output pin */
+ PBCR1 &= ~(PB_TXD1 | PB_RXD1);
+ PBCR1 |= PB_TXD1 | PB_RXD1;
+}
+
+
+int
+getDebugCharReady (void)
+{
+ char mySSR;
+ mySSR = SSR1 & ( SCI_PER | SCI_FER | SCI_ORER );
+ if ( mySSR )
+ handleError ( mySSR );
+ return SSR1 & SCI_RDRF ;
+}
+
+char
+getDebugChar (void)
+{
+ char ch;
+ char mySSR;
+
+ while ( ! getDebugCharReady())
+ ;
+
+ ch = RDR1;
+ SSR1 &= ~SCI_RDRF;
+
+ mySSR = SSR1 & (SCI_PER | SCI_FER | SCI_ORER);
+
+ if (mySSR)
+ handleError (mySSR);
+
+ return ch;
+}
+
+int
+putDebugCharReady()
+{
+ return (SSR1 & SCI_TDRE);
+}
+
+void
+putDebugChar (char ch)
+{
+ while (!putDebugCharReady())
+ ;
+
+ /*
+ * Write data into TDR and clear TDRE
+ */
+ TDR1 = ch;
+ SSR1 &= ~SCI_TDRE;
+}
+
+void
+handleError (char theSSR)
+{
+ SSR1 &= ~(SCI_ORER | SCI_PER | SCI_FER);
+}
+
diff --git a/contrib/gdb/gdb/sparclet-rom.c b/contrib/gdb/gdb/sparclet-rom.c
new file mode 100644
index 000000000000..992cca1ab51c
--- /dev/null
+++ b/contrib/gdb/gdb/sparclet-rom.c
@@ -0,0 +1,296 @@
+/* Remote target glue for the SPARC Sparclet ROM monitor.
+ Copyright 1995, 1996 Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+This program 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+
+#include "defs.h"
+#include "gdbcore.h"
+#include "target.h"
+#include "monitor.h"
+#include "serial.h"
+#include "srec.h"
+#include "symtab.h"
+#include "symfile.h" /* for generic_load */
+#include <time.h>
+
+extern void report_transfer_performance PARAMS ((unsigned long, time_t, time_t));
+
+static struct target_ops sparclet_ops;
+
+static void sparclet_open PARAMS ((char *args, int from_tty));
+
+/* This array of registers need to match the indexes used by GDB.
+ This exists because the various ROM monitors use different strings
+ than does GDB, and don't necessarily support all the registers
+ either. So, typing "info reg sp" becomes a "r30". */
+
+/*PSR 0x00000080 impl ver icc AW LE EE EC EF PIL S PS ET CWP WIM
+ 0x0 0x0 0x0 0 0 0 0 0 0x0 1 0 0 0x00 0x2
+ 0000010
+ INS LOCALS OUTS GLOBALS
+ 0 0x00000000 0x00000000 0x00000000 0x00000000
+ 1 0x00000000 0x00000000 0x00000000 0x00000000
+ 2 0x00000000 0x00000000 0x00000000 0x00000000
+ 3 0x00000000 0x00000000 0x00000000 0x00000000
+ 4 0x00000000 0x00000000 0x00000000 0x00000000
+ 5 0x00000000 0x00001000 0x00000000 0x00000000
+ 6 0x00000000 0x00000000 0x123f0000 0x00000000
+ 7 0x00000000 0x00000000 0x00000000 0x00000000
+pc: 0x12010000 0x00000000 unimp
+npc: 0x12010004 0x00001000 unimp 0x1000
+tbr: 0x00000000
+y: 0x00000000
+*/
+/* these correspond to the offsets from tm-* files from config directories */
+
+/* is wim part of psr?? */
+/* monitor wants lower case */
+static char *sparclet_regnames[NUM_REGS] = REGISTER_NAMES;
+
+
+/* Function: sparclet_supply_register
+ Just returns with no action.
+ This function is required, because parse_register_dump (monitor.c)
+ expects to be able to call it. If we don't supply something, it will
+ call a null pointer and core-dump. Since this function does not
+ actually do anything, GDB will request the registers individually. */
+
+static void
+sparclet_supply_register (regname, regnamelen, val, vallen)
+ char *regname;
+ int regnamelen;
+ char *val;
+ int vallen;
+{
+ return;
+}
+
+static void
+sparclet_load (desc, file, hashmark)
+ serial_t desc;
+ char *file;
+ int hashmark;
+{
+ bfd *abfd;
+ asection *s;
+ int i;
+ CORE_ADDR load_offset;
+ time_t start_time, end_time;
+ unsigned long data_count = 0;
+
+ /* enable user to specify address for downloading as 2nd arg to load */
+
+ i = sscanf(file, "%*s 0x%lx", &load_offset);
+ if (i >= 1 )
+ {
+ char *p;
+
+ for (p = file; *p != '\000' && !isspace (*p); p++);
+
+ *p = '\000';
+ }
+ else
+ load_offset = 0;
+
+ abfd = bfd_openr (file, 0);
+ if (!abfd)
+ {
+ printf_filtered ("Unable to open file %s\n", file);
+ return;
+ }
+
+ if (bfd_check_format (abfd, bfd_object) == 0)
+ {
+ printf_filtered ("File is not an object file\n");
+ return;
+ }
+
+ start_time = time (NULL);
+
+ for (s = abfd->sections; s; s = s->next)
+ if (s->flags & SEC_LOAD)
+ {
+ bfd_size_type section_size;
+ bfd_vma vma;
+
+ vma = bfd_get_section_vma (abfd, s) + load_offset;
+ section_size = bfd_section_size (abfd, s);
+
+ data_count += section_size;
+
+ printf_filtered ("%s\t: 0x%4x .. 0x%4x ",
+ bfd_get_section_name (abfd, s), vma,
+ vma + section_size);
+ gdb_flush (gdb_stdout);
+
+ monitor_printf ("load c r %x %x\r", vma, section_size);
+
+ monitor_expect ("load: loading ", NULL, 0);
+ monitor_expect ("\r", NULL, 0);
+
+ for (i = 0; i < section_size; i += 2048)
+ {
+ int numbytes;
+ char buf[2048];
+
+ numbytes = min (sizeof buf, section_size - i);
+
+ bfd_get_section_contents (abfd, s, buf, i, numbytes);
+
+ SERIAL_WRITE (desc, buf, numbytes);
+
+ if (hashmark)
+ {
+ putchar_unfiltered ('#');
+ gdb_flush (gdb_stdout);
+ }
+ } /* Per-packet (or S-record) loop */
+
+ monitor_expect_prompt (NULL, 0);
+
+ putchar_unfiltered ('\n');
+ } /* Loadable sections */
+
+ monitor_printf ("reg pc %x\r", bfd_get_start_address (abfd));
+ monitor_expect_prompt (NULL, 0);
+ monitor_printf ("reg npc %x\r", bfd_get_start_address (abfd) + 4);
+ monitor_expect_prompt (NULL, 0);
+
+ monitor_printf ("run\r");
+
+ end_time = time (NULL);
+
+ if (hashmark)
+ putchar_unfiltered ('\n');
+
+ report_transfer_performance (data_count, start_time, end_time);
+
+ pop_target ();
+ push_remote_target (monitor_get_dev_name (), 1);
+
+ return_to_top_level (RETURN_QUIT);
+}
+
+/* Define the monitor command strings. Since these are passed directly
+ through to a printf style function, we may include formatting
+ strings. We also need a CR or LF on the end. */
+
+/* need to pause the monitor for timing reasons, so slow it down */
+
+static char *sparclet_inits[] = {"\n\r\r\n", NULL};
+
+static struct monitor_ops sparclet_cmds ;
+
+static void
+init_sparclet_cmds(void)
+{
+ sparclet_cmds.flags = MO_CLR_BREAK_USES_ADDR |
+ MO_HEX_PREFIX |
+ MO_NO_ECHO_ON_OPEN |
+ MO_NO_ECHO_ON_SETMEM |
+ MO_RUN_FIRST_TIME |
+ MO_GETMEM_READ_SINGLE ; /* flags */
+ sparclet_cmds.init = sparclet_inits; /* Init strings */
+ sparclet_cmds.cont = "cont\r"; /* continue command */
+ sparclet_cmds.step = "step\r"; /* single step */
+ sparclet_cmds.stop = "\r"; /* break interrupts the program */
+ sparclet_cmds.set_break = "+bp %x\r"; /* set a breakpoint */
+ sparclet_cmds.clr_break = "-bp %x\r" ; /* can't use "br" because only 2 hw bps are supported */
+ sparclet_cmds.clr_all_break = "-bp %x\r"; /* clear a breakpoint */
+ "-bp\r" ; /* clear all breakpoints */
+ sparclet_cmds.fill = "fill %x -n %x -v %x -b\r"; /* fill (start length val) */
+ /* can't use "fi" because it takes words, not bytes */
+ /* ex [addr] [-n count] [-b|-s|-l] default: ex cur -n 1 -b */
+ sparclet_cmds.setmem.cmdb = "ex %x -b\r%x\rq\r"; /* setmem.cmdb (addr, value) */
+ sparclet_cmds.setmem.cmdw = "ex %x -s\r%x\rq\r"; /* setmem.cmdw (addr, value) */
+ sparclet_cmds.setmem.cmdl = "ex %x -l\r%x\rq\r"; /* setmem.cmdl (addr, value) */
+ sparclet_cmds.setmem.cmdll = NULL; /* setmem.cmdll (addr, value) */
+ sparclet_cmds.setmem.resp_delim = NULL; /*": " */ /* setmem.resp_delim */
+ sparclet_cmds.setmem.term = NULL; /*"? " */ /* setmem.term */
+ sparclet_cmds.setmem.term_cmd = NULL; /*"q\r" */ /* setmem.term_cmd */
+ /* since the parsing of multiple bytes is difficult due to
+ interspersed addresses, we'll only read 1 value at a time,
+ even tho these can handle a count */
+ /* we can use -n to set count to read, but may have to parse? */
+ sparclet_cmds.getmem.cmdb = "ex %x -n 1 -b\r"; /* getmem.cmdb (addr, #bytes) */
+ sparclet_cmds.getmem.cmdw = "ex %x -n 1 -s\r"; /* getmem.cmdw (addr, #swords) */
+ sparclet_cmds.getmem.cmdl = "ex %x -n 1 -l\r"; /* getmem.cmdl (addr, #words) */
+ sparclet_cmds.getmem.cmdll = NULL; /* getmem.cmdll (addr, #dwords) */
+ sparclet_cmds.getmem.resp_delim = ": "; /* getmem.resp_delim */
+ sparclet_cmds.getmem.term = NULL; /* getmem.term */
+ sparclet_cmds.getmem.term_cmd = NULL; /* getmem.term_cmd */
+ sparclet_cmds.setreg.cmd = "reg %s 0x%x\r"; /* setreg.cmd (name, value) */
+ sparclet_cmds.setreg.resp_delim = NULL; /* setreg.resp_delim */
+ sparclet_cmds.setreg.term = NULL; /* setreg.term */
+ sparclet_cmds.setreg.term_cmd = NULL ; /* setreg.term_cmd */
+ sparclet_cmds.getreg.cmd = "reg %s\r"; /* getreg.cmd (name) */
+ sparclet_cmds.getreg.resp_delim = " "; /* getreg.resp_delim */
+ sparclet_cmds.getreg.term = NULL; /* getreg.term */
+ sparclet_cmds.getreg.term_cmd = NULL; /* getreg.term_cmd */
+ sparclet_cmds.dump_registers = "reg\r"; /* dump_registers */
+ sparclet_cmds.register_pattern = "\\(\\w+\\)=\\([0-9a-fA-F]+\\)"; /* register_pattern */
+ sparclet_cmds.supply_register = sparclet_supply_register; /* supply_register */
+ sparclet_cmds.load_routine = sparclet_load; /* load_routine */
+ sparclet_cmds.load = NULL; /* download command (srecs on console) */
+ sparclet_cmds.loadresp = NULL; /* load response */
+ sparclet_cmds.prompt = "monitor>"; /* monitor command prompt */
+ /* yikes! gdb core dumps without this delimitor!! */
+ sparclet_cmds.line_term = "\r"; /* end-of-command delimitor */
+ sparclet_cmds.cmd_end = NULL; /* optional command terminator */
+ sparclet_cmds.target = &sparclet_ops; /* target operations */
+ sparclet_cmds.stopbits = SERIAL_1_STOPBITS; /* number of stop bits */
+ sparclet_cmds.regnames = sparclet_regnames; /* registers names */
+ sparclet_cmds.magic = MONITOR_OPS_MAGIC ; /* magic */
+};
+
+static void
+sparclet_open (args, from_tty)
+ char *args;
+ int from_tty;
+{
+ monitor_open (args, &sparclet_cmds, from_tty);
+}
+
+void
+_initialize_sparclet ()
+{
+ int i;
+ init_sparclet_cmds() ;
+
+ for (i = 0; i < NUM_REGS; i++)
+ if (sparclet_regnames[i][0] == 'c' ||
+ sparclet_regnames[i][0] == 'a')
+ sparclet_regnames[i] = 0; /* mon can't report c* or a* regs */
+
+ sparclet_regnames[0] = 0; /* mon won't report %G0 */
+
+ init_monitor_ops (&sparclet_ops);
+ sparclet_ops.to_shortname = "sparclet"; /* for the target command */
+ sparclet_ops.to_longname = "SPARC Sparclet monitor";
+ /* use SW breaks; target only supports 2 HW breakpoints */
+ sparclet_ops.to_insert_breakpoint = memory_insert_breakpoint;
+ sparclet_ops.to_remove_breakpoint = memory_remove_breakpoint;
+
+ sparclet_ops.to_doc =
+ "Use a board running the Sparclet debug monitor.\n\
+Specify the serial device it is connected to (e.g. /dev/ttya).";
+
+ sparclet_ops.to_open = sparclet_open;
+ add_target (&sparclet_ops);
+}
+
diff --git a/contrib/gdb/gdb/sparclet-stub.c b/contrib/gdb/gdb/sparclet-stub.c
new file mode 100644
index 000000000000..ecf670b11526
--- /dev/null
+++ b/contrib/gdb/gdb/sparclet-stub.c
@@ -0,0 +1,1232 @@
+/****************************************************************************
+
+ 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.
+
+****************************************************************************/
+
+/****************************************************************************
+ * Header: remcom.c,v 1.34 91/03/09 12:29:49 glenne Exp $
+ *
+ * Module name: remcom.c $
+ * Revision: 1.34 $
+ * Date: 91/03/09 12:29:49 $
+ * Contributor: Lake Stevens Instrument Division$
+ *
+ * Description: low level support for gdb debugger. $
+ *
+ * Considerations: only works on target hardware $
+ *
+ * Written by: Glenn Engel $
+ * ModuleState: Experimental $
+ *
+ * NOTES: See Below $
+ *
+ * Modified for SPARC by Stu Grossman, Cygnus Support.
+ * Based on sparc-stub.c, it's modified for SPARClite Debug Unit hardware
+ * breakpoint support to create sparclite-stub.c, by Kung Hsu, Cygnus Support.
+ *
+ * This code has been extensively tested on the Fujitsu SPARClite demo board.
+ *
+ * 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 by executing a trap #1.
+ *
+ *************
+ *
+ * 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
+ * P set the value of a single CPU register OK or P01 (???)
+ *
+ * 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 <string.h>
+#include <signal.h>
+
+/************************************************************************
+ *
+ * external low-level support routines
+ */
+
+extern void putDebugChar(); /* write a single character */
+extern int getDebugChar(); /* read and return a single char */
+
+/************************************************************************/
+/* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/
+/* at least NUMREGBYTES*2 are needed for register packets */
+#define BUFMAX 2048
+
+static int initialized = 0; /* !0 means we've been initialized */
+static int remote_debug = 0; /* turn on verbose debugging */
+
+extern void breakinst();
+void _cprint();
+static void hw_breakpoint();
+static void set_mem_fault_trap();
+static void get_in_break_mode();
+static unsigned char *mem2hex();
+
+static const char hexchars[]="0123456789abcdef";
+
+#define NUMREGS 121
+
+static unsigned long saved_stack_pointer;
+
+/* Number of bytes of registers. */
+#define NUMREGBYTES (NUMREGS * 4)
+enum regnames { G0, G1, G2, G3, G4, G5, G6, G7,
+ O0, O1, O2, O3, O4, O5, SP, O7,
+ L0, L1, L2, L3, L4, L5, L6, L7,
+ I0, I1, I2, I3, I4, I5, FP, I7,
+
+ F0, F1, F2, F3, F4, F5, F6, F7,
+ F8, F9, F10, F11, F12, F13, F14, F15,
+ F16, F17, F18, F19, F20, F21, F22, F23,
+ F24, F25, F26, F27, F28, F29, F30, F31,
+
+ Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR,
+ CCSR, CCPR, CCCRCR, CCOR, CCOBR, CCIBR, CCIR, UNUSED1,
+
+ ASR1, ASR15, ASR17, ASR18, ASR19, ASR20, ASR21, ASR22,
+ /* the following not actually implemented */
+ AWR0, AWR1, AWR2, AWR3, AWR4, AWR5, AWR6, AWR7,
+ AWR8, AWR9, AWR10, AWR11, AWR12, AWR13, AWR14, AWR15,
+ AWR16, AWR17, AWR18, AWR19, AWR20, AWR21, AWR22, AWR23,
+ AWR24, AWR25, AWR26, AWR27, AWR28, AWR29, AWR30, AWR31,
+ APSR
+};
+
+/*************************** ASSEMBLY CODE MACROS *************************/
+/* */
+
+extern void trap_low();
+
+asm("
+ .reserve trapstack, 1000 * 4, \"bss\", 8
+
+ .data
+ .align 4
+
+in_trap_handler:
+ .word 0
+
+ .text
+ .align 4
+
+! This function is called when any SPARC trap (except window overflow or
+! underflow) occurs. It makes sure that the invalid register window is still
+! available before jumping into C code. It will also restore the world if you
+! return from handle_exception.
+!
+! On entry, trap_low expects l1 and l2 to contain pc and npc respectivly.
+
+ .globl _trap_low
+_trap_low:
+ mov %psr, %l0
+ mov %wim, %l3
+
+ srl %l3, %l0, %l4 ! wim >> cwp
+ and %l4, 0xff, %l4 ! Mask off windows 28, 29
+ cmp %l4, 1
+ bne window_fine ! Branch if not in the invalid window
+ nop
+
+! Handle window overflow
+
+ mov %g1, %l4 ! Save g1, we use it to hold the wim
+ srl %l3, 1, %g1 ! Rotate wim right
+ and %g1, 0xff, %g1 ! Mask off windows 28, 29
+ tst %g1
+ bg good_wim ! Branch if new wim is non-zero
+ nop
+
+! At this point, we need to bring a 1 into the high order bit of the wim.
+! Since we don't want to make any assumptions about the number of register
+! windows, we figure it out dynamically so as to setup the wim correctly.
+
+ ! The normal way doesn't work on the sparclet as register windows
+ ! 28 and 29 are special purpose windows.
+ !not %g1 ! Fill g1 with ones
+ !mov %g1, %wim ! Fill the wim with ones
+ !nop
+ !nop
+ !nop
+ !mov %wim, %g1 ! Read back the wim
+ !inc %g1 ! Now g1 has 1 just to left of wim
+ !srl %g1, 1, %g1 ! Now put 1 at top of wim
+
+ mov 0x80, %g1 ! Hack for sparclet
+
+ ! This doesn't work on the sparclet.
+ !mov %g0, %wim ! Clear wim so that subsequent save
+ ! won't trap
+ andn %l3, 0xff, %l5 ! Clear wim but not windows 28, 29
+ mov %l5, %wim
+ nop
+ nop
+ nop
+
+good_wim:
+ save %g0, %g0, %g0 ! Slip into next window
+ mov %g1, %wim ! Install the new wim
+
+ std %l0, [%sp + 0 * 4] ! save L & I registers
+ std %l2, [%sp + 2 * 4]
+ std %l4, [%sp + 4 * 4]
+ std %l6, [%sp + 6 * 4]
+
+ std %i0, [%sp + 8 * 4]
+ std %i2, [%sp + 10 * 4]
+ std %i4, [%sp + 12 * 4]
+ std %i6, [%sp + 14 * 4]
+
+ restore ! Go back to trap window.
+ mov %l4, %g1 ! Restore %g1
+
+window_fine:
+ sethi %hi(in_trap_handler), %l4
+ ld [%lo(in_trap_handler) + %l4], %l5
+ tst %l5
+ bg recursive_trap
+ inc %l5
+
+ set trapstack+1000*4, %sp ! Switch to trap stack
+
+recursive_trap:
+ st %l5, [%lo(in_trap_handler) + %l4]
+ sub %sp,(16+1+6+1+88)*4,%sp ! Make room for input & locals
+ ! + hidden arg + arg spill
+ ! + doubleword alignment
+ ! + registers[121]
+
+ std %g0, [%sp + (24 + 0) * 4] ! registers[Gx]
+ std %g2, [%sp + (24 + 2) * 4]
+ std %g4, [%sp + (24 + 4) * 4]
+ std %g6, [%sp + (24 + 6) * 4]
+
+ std %i0, [%sp + (24 + 8) * 4] ! registers[Ox]
+ std %i2, [%sp + (24 + 10) * 4]
+ std %i4, [%sp + (24 + 12) * 4]
+ std %i6, [%sp + (24 + 14) * 4]
+
+ ! FP regs (sparclet doesn't have fpu)
+
+ mov %y, %l4
+ mov %tbr, %l5
+ st %l4, [%sp + (24 + 64) * 4] ! Y
+ st %l0, [%sp + (24 + 65) * 4] ! PSR
+ st %l3, [%sp + (24 + 66) * 4] ! WIM
+ st %l5, [%sp + (24 + 67) * 4] ! TBR
+ st %l1, [%sp + (24 + 68) * 4] ! PC
+ st %l2, [%sp + (24 + 69) * 4] ! NPC
+ ! CPSR and FPSR not impl
+ or %l0, 0xf20, %l4
+ mov %l4, %psr ! Turn on traps, disable interrupts
+ nop
+ nop
+ nop
+
+! Save coprocessor state.
+! See SK/demo/hdlc_demo/ldc_swap_context.S.
+
+ mov %psr, %l0
+ sethi %hi(0x2000), %l5 ! EC bit in PSR
+ or %l5, %l0, %l5
+ mov %l5, %psr ! enable coprocessor
+ nop ! 3 nops after write to %psr (needed?)
+ nop
+ nop
+ crdcxt %ccsr, %l1 ! capture CCSR
+ mov 0x6, %l2
+ cwrcxt %l2, %ccsr ! set CCP state machine for CCFR
+ crdcxt %ccfr, %l2 ! capture CCOR
+ cwrcxt %l2, %ccfr ! tickle CCFR
+ crdcxt %ccfr, %l3 ! capture CCOBR
+ cwrcxt %l3, %ccfr ! tickle CCFR
+ crdcxt %ccfr, %l4 ! capture CCIBR
+ cwrcxt %l4, %ccfr ! tickle CCFR
+ crdcxt %ccfr, %l5 ! capture CCIR
+ cwrcxt %l5, %ccfr ! tickle CCFR
+ crdcxt %ccpr, %l6 ! capture CCPR
+ crdcxt %cccrcr, %l7 ! capture CCCRCR
+ st %l1, [%sp + (24 + 72) * 4] ! save CCSR
+ st %l2, [%sp + (24 + 75) * 4] ! save CCOR
+ st %l3, [%sp + (24 + 76) * 4] ! save CCOBR
+ st %l4, [%sp + (24 + 77) * 4] ! save CCIBR
+ st %l5, [%sp + (24 + 78) * 4] ! save CCIR
+ st %l6, [%sp + (24 + 73) * 4] ! save CCPR
+ st %l7, [%sp + (24 + 74) * 4] ! save CCCRCR
+ mov %l0, %psr ! restore original PSR
+ nop ! 3 nops after write to %psr (needed?)
+ nop
+ nop
+
+! End of saving coprocessor state.
+! Save asr regs
+
+! Part of this is silly -- we should not display ASR15 or ASR19 at all.
+
+ sethi %hi(0x01000000), %l6
+ st %l6, [%sp + (24 + 81) * 4] ! ASR15 == NOP
+ sethi %hi(0xdeadc0de), %l6
+ or %l6, %lo(0xdeadc0de), %l6
+ st %l6, [%sp + (24 + 84) * 4] ! ASR19 == DEADC0DE
+
+ rd %asr1, %l4
+ st %l4, [%sp + (24 + 80) * 4]
+! rd %asr15, %l4 ! must not read ASR15
+! st %l4, [%sp + (24 + 81) * 4] ! (illegal instr trap)
+ rd %asr17, %l4
+ st %l4, [%sp + (24 + 82) * 4]
+ rd %asr18, %l4
+ st %l4, [%sp + (24 + 83) * 4]
+! rd %asr19, %l4 ! must not read asr19
+! st %l4, [%sp + (24 + 84) * 4] ! (halts the CPU)
+ rd %asr20, %l4
+ st %l4, [%sp + (24 + 85) * 4]
+ rd %asr21, %l4
+ st %l4, [%sp + (24 + 86) * 4]
+ rd %asr22, %l4
+ st %l4, [%sp + (24 + 87) * 4]
+
+! End of saving asr regs
+
+ call _handle_exception
+ add %sp, 24 * 4, %o0 ! Pass address of registers
+
+! Reload all of the registers that aren't on the stack
+
+ ld [%sp + (24 + 1) * 4], %g1 ! registers[Gx]
+ ldd [%sp + (24 + 2) * 4], %g2
+ ldd [%sp + (24 + 4) * 4], %g4
+ ldd [%sp + (24 + 6) * 4], %g6
+
+ ldd [%sp + (24 + 8) * 4], %i0 ! registers[Ox]
+ ldd [%sp + (24 + 10) * 4], %i2
+ ldd [%sp + (24 + 12) * 4], %i4
+ ldd [%sp + (24 + 14) * 4], %i6
+
+ ! FP regs (sparclet doesn't have fpu)
+
+! Update the coprocessor registers.
+! See SK/demo/hdlc_demo/ldc_swap_context.S.
+
+ mov %psr, %l0
+ sethi %hi(0x2000), %l5 ! EC bit in PSR
+ or %l5, %l0, %l5
+ mov %l5, %psr ! enable coprocessor
+ nop ! 3 nops after write to %psr (needed?)
+ nop
+ nop
+
+ mov 0x6, %l2
+ cwrcxt %l2, %ccsr ! set CCP state machine for CCFR
+
+ ld [%sp + (24 + 72) * 4], %l1 ! saved CCSR
+ ld [%sp + (24 + 75) * 4], %l2 ! saved CCOR
+ ld [%sp + (24 + 76) * 4], %l3 ! saved CCOBR
+ ld [%sp + (24 + 77) * 4], %l4 ! saved CCIBR
+ ld [%sp + (24 + 78) * 4], %l5 ! saved CCIR
+ ld [%sp + (24 + 73) * 4], %l6 ! saved CCPR
+ ld [%sp + (24 + 74) * 4], %l7 ! saved CCCRCR
+
+ cwrcxt %l2, %ccfr ! restore CCOR
+ cwrcxt %l3, %ccfr ! restore CCOBR
+ cwrcxt %l4, %ccfr ! restore CCIBR
+ cwrcxt %l5, %ccfr ! restore CCIR
+ cwrcxt %l6, %ccpr ! restore CCPR
+ cwrcxt %l7, %cccrcr ! restore CCCRCR
+ cwrcxt %l1, %ccsr ! restore CCSR
+
+ mov %l0, %psr ! restore PSR
+ nop ! 3 nops after write to %psr (needed?)
+ nop
+ nop
+
+! End of coprocessor handling stuff.
+! Update asr regs
+
+ ld [%sp + (24 + 80) * 4], %l4
+ wr %l4, %asr1
+! ld [%sp + (24 + 81) * 4], %l4 ! can't write asr15
+! wr %l4, %asr15
+ ld [%sp + (24 + 82) * 4], %l4
+ wr %l4, %asr17
+ ld [%sp + (24 + 83) * 4], %l4
+ wr %l4, %asr18
+! ld [%sp + (24 + 84) * 4], %l4 ! can't write asr19
+! wr %l4, %asr19
+! ld [%sp + (24 + 85) * 4], %l4 ! can't write asr20
+! wr %l4, %asr20
+! ld [%sp + (24 + 86) * 4], %l4 ! can't write asr21
+! wr %l4, %asr21
+ ld [%sp + (24 + 87) * 4], %l4
+ wr %l4, %asr22
+
+! End of restoring asr regs
+
+
+ ldd [%sp + (24 + 64) * 4], %l0 ! Y & PSR
+ ldd [%sp + (24 + 68) * 4], %l2 ! PC & NPC
+
+ restore ! Ensure that previous window is valid
+ save %g0, %g0, %g0 ! by causing a window_underflow trap
+
+ mov %l0, %y
+ mov %l1, %psr ! Make sure that traps are disabled
+ ! for rett
+ nop ! 3 nops after write to %psr (needed?)
+ nop
+ nop
+
+ sethi %hi(in_trap_handler), %l4
+ ld [%lo(in_trap_handler) + %l4], %l5
+ dec %l5
+ st %l5, [%lo(in_trap_handler) + %l4]
+
+ jmpl %l2, %g0 ! Restore old PC
+ rett %l3 ! Restore old nPC
+");
+
+/* 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 */
+ while ((ch = (getDebugChar() & 0x7f)) != '$')
+ ;
+
+ checksum = 0;
+ xmitcsum = -1;
+
+ count = 0;
+
+ /* now, read until a # or end of buffer is found */
+ while (count < BUFMAX)
+ {
+ ch = getDebugChar() & 0x7f;
+ if (ch == '#')
+ break;
+ checksum = checksum + ch;
+ buffer[count] = ch;
+ count = count + 1;
+ }
+
+ if (count >= BUFMAX)
+ continue;
+
+ buffer[count] = 0;
+
+ if (ch == '#')
+ {
+ xmitcsum = hex(ch = getDebugChar() & 0x7f) << 4;
+ xmitcsum |= hex(ch = getDebugChar() & 0x7f);
+
+ 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])
+ {
+ putDebugChar(ch);
+ checksum += ch;
+ count += 1;
+ }
+
+ putDebugChar('#');
+ putDebugChar(hexchars[checksum >> 4]);
+ putDebugChar(hexchars[checksum & 0xf]);
+
+ }
+ while ((getDebugChar() & 0x7f) != '+');
+}
+
+static char remcomInBuffer[BUFMAX];
+static char remcomOutBuffer[BUFMAX];
+
+/* Indicate to caller of mem2hex or hex2mem that there has been an
+ error. */
+static volatile int mem_err = 0;
+
+/* 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;
+
+ set_mem_fault_trap(may_fault);
+
+ while (count-- > 0)
+ {
+ ch = *mem++;
+ if (mem_err)
+ return 0;
+ *buf++ = hexchars[ch >> 4];
+ *buf++ = hexchars[ch & 0xf];
+ }
+
+ *buf = 0;
+
+ set_mem_fault_trap(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 char *
+hex2mem(buf, mem, count, may_fault)
+ unsigned char *buf;
+ unsigned char *mem;
+ int count;
+ int may_fault;
+{
+ int i;
+ unsigned char ch;
+
+ set_mem_fault_trap(may_fault);
+
+ for (i=0; i<count; i++)
+ {
+ ch = hex(*buf++) << 4;
+ ch |= hex(*buf++);
+ *mem++ = ch;
+ if (mem_err)
+ return 0;
+ }
+
+ set_mem_fault_trap(0);
+
+ return mem;
+}
+
+/* This table contains the mapping between SPARC hardware trap types, and
+ signals, which are primarily what GDB understands. It also indicates
+ which hardware traps we need to commandeer when initializing the stub. */
+
+static struct hard_trap_info
+{
+ unsigned char tt; /* Trap type code for SPARClite */
+ unsigned char signo; /* Signal that we map this trap into */
+} hard_trap_info[] = {
+ {1, SIGSEGV}, /* instruction access exception */
+ {0x3b, SIGSEGV}, /* instruction access error */
+ {2, SIGILL}, /* illegal instruction */
+ {3, SIGILL}, /* privileged instruction */
+ {4, SIGEMT}, /* fp disabled */
+ {0x24, SIGEMT}, /* cp disabled */
+ {7, SIGBUS}, /* mem address not aligned */
+ {0x29, SIGSEGV}, /* data access exception */
+ {10, SIGEMT}, /* tag overflow */
+ {128+1, SIGTRAP}, /* ta 1 - normal breakpoint instruction */
+ {0, 0} /* Must be last */
+};
+
+/* Set up exception handlers for tracing and breakpoints */
+
+void
+set_debug_traps()
+{
+ struct hard_trap_info *ht;
+
+ for (ht = hard_trap_info; ht->tt && ht->signo; ht++)
+ exceptionHandler(ht->tt, trap_low);
+
+ /* In case GDB is started before us, ack any packets (presumably
+ "$?#xx") sitting there. */
+ putDebugChar ('+');
+
+ initialized = 1;
+}
+
+asm ("
+! Trap handler for memory errors. This just sets mem_err to be non-zero. It
+! assumes that %l1 is non-zero. This should be safe, as it is doubtful that
+! 0 would ever contain code that could mem fault. This routine will skip
+! past the faulting instruction after setting mem_err.
+
+ .text
+ .align 4
+
+_fltr_set_mem_err:
+ sethi %hi(_mem_err), %l0
+ st %l1, [%l0 + %lo(_mem_err)]
+ jmpl %l2, %g0
+ rett %l2+4
+");
+
+static void
+set_mem_fault_trap(enable)
+ int enable;
+{
+ extern void fltr_set_mem_err();
+ mem_err = 0;
+
+ if (enable)
+ exceptionHandler(0x29, fltr_set_mem_err);
+ else
+ exceptionHandler(0x29, trap_low);
+}
+
+asm ("
+ .text
+ .align 4
+
+_dummy_hw_breakpoint:
+ jmpl %l2, %g0
+ rett %l2+4
+ nop
+ nop
+");
+
+static void
+set_hw_breakpoint_trap(enable)
+ int enable;
+{
+ extern void dummy_hw_breakpoint();
+
+ if (enable)
+ exceptionHandler(255, dummy_hw_breakpoint);
+ else
+ exceptionHandler(255, trap_low);
+}
+
+static void
+get_in_break_mode()
+{
+#if 0
+ int x;
+ mesg("get_in_break_mode, sp = ");
+ phex(&x);
+#endif
+ set_hw_breakpoint_trap(1);
+
+ asm("
+ sethi %hi(0xff10), %l4
+ or %l4, %lo(0xff10), %l4
+ sta %g0, [%l4]0x1
+ nop
+ nop
+ nop
+ ");
+
+ set_hw_breakpoint_trap(0);
+}
+
+/* Convert the SPARC hardware trap type code 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(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);
+}
+
+/*
+ * This function does all command procesing for interfacing to gdb. It
+ * returns 1 if you should skip the instruction at the trap address, 0
+ * otherwise.
+ */
+
+static void
+handle_exception (registers)
+ unsigned long *registers;
+{
+ int tt; /* Trap type */
+ int sigval;
+ int addr;
+ int length;
+ char *ptr;
+ unsigned long *sp;
+ unsigned long dsr;
+
+/* First, we must force all of the windows to be spilled out */
+
+ asm("
+ ! Ugh. sparclet has broken save
+ !save %sp, -64, %sp
+ save
+ add %fp,-64,%sp
+ !save %sp, -64, %sp
+ save
+ add %fp,-64,%sp
+ !save %sp, -64, %sp
+ save
+ add %fp,-64,%sp
+ !save %sp, -64, %sp
+ save
+ add %fp,-64,%sp
+ !save %sp, -64, %sp
+ save
+ add %fp,-64,%sp
+ !save %sp, -64, %sp
+ save
+ add %fp,-64,%sp
+ !save %sp, -64, %sp
+ save
+ add %fp,-64,%sp
+ !save %sp, -64, %sp
+ save
+ add %fp,-64,%sp
+ restore
+ restore
+ restore
+ restore
+ restore
+ restore
+ restore
+ restore
+");
+
+ if (registers[PC] == (unsigned long)breakinst)
+ {
+ registers[PC] = registers[NPC];
+ registers[NPC] += 4;
+ }
+ sp = (unsigned long *)registers[SP];
+
+ tt = (registers[TBR] >> 4) & 0xff;
+
+ /* reply to host that an exception has occurred */
+ sigval = computeSignal(tt);
+ ptr = remcomOutBuffer;
+
+ *ptr++ = 'T';
+ *ptr++ = hexchars[sigval >> 4];
+ *ptr++ = hexchars[sigval & 0xf];
+
+ *ptr++ = hexchars[PC >> 4];
+ *ptr++ = hexchars[PC & 0xf];
+ *ptr++ = ':';
+ ptr = mem2hex((char *)&registers[PC], ptr, 4, 0);
+ *ptr++ = ';';
+
+ *ptr++ = hexchars[FP >> 4];
+ *ptr++ = hexchars[FP & 0xf];
+ *ptr++ = ':';
+ ptr = mem2hex(sp + 8 + 6, ptr, 4, 0); /* FP */
+ *ptr++ = ';';
+
+ *ptr++ = hexchars[SP >> 4];
+ *ptr++ = hexchars[SP & 0xf];
+ *ptr++ = ':';
+ ptr = mem2hex((char *)&sp, ptr, 4, 0);
+ *ptr++ = ';';
+
+ *ptr++ = hexchars[NPC >> 4];
+ *ptr++ = hexchars[NPC & 0xf];
+ *ptr++ = ':';
+ ptr = mem2hex((char *)&registers[NPC], ptr, 4, 0);
+ *ptr++ = ';';
+
+ *ptr++ = hexchars[O7 >> 4];
+ *ptr++ = hexchars[O7 & 0xf];
+ *ptr++ = ':';
+ ptr = mem2hex((char *)&registers[O7], ptr, 4, 0);
+ *ptr++ = ';';
+
+ *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':
+ remote_debug = !(remote_debug); /* toggle debug flag */
+ break;
+
+ case 'g': /* return the value of the CPU registers */
+ {
+ ptr = remcomOutBuffer;
+ ptr = mem2hex((char *)registers, ptr, 16 * 4, 0); /* G & O regs */
+ ptr = mem2hex(sp + 0, ptr, 16 * 4, 0); /* L & I regs */
+ memset(ptr, '0', 32 * 8); /* Floating point */
+ ptr = mem2hex((char *)&registers[Y],
+ ptr + 32 * 4 * 2,
+ 8 * 4,
+ 0); /* Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR */
+ ptr = mem2hex((char *)&registers[CCSR],
+ ptr,
+ 8 * 4,
+ 0); /* CCSR, CCPR, CCCRCR, CCOR, CCOBR, CCIBR, CCIR */
+ ptr = mem2hex((char *)&registers[ASR1],
+ ptr,
+ 8 * 4,
+ 0); /* ASR1,ASR15,ASR17,ASR18,ASR19,ASR20,ASR21,ASR22 */
+#if 0 /* not implemented */
+ ptr = mem2hex((char *) &registers[AWR0],
+ ptr,
+ 32 * 4,
+ 0); /* Alternate Window Registers */
+#endif
+ }
+ break;
+
+ case 'G': /* set value of all the CPU registers - return OK */
+ case 'P': /* set value of one CPU register - return OK */
+ {
+ unsigned long *newsp, psr;
+
+ psr = registers[PSR];
+
+ ptr = &remcomInBuffer[1];
+
+ if (remcomInBuffer[0] == 'P') /* do a single register */
+ {
+ int regno;
+
+ if (hexToInt (&ptr, &regno)
+ && *ptr++ == '=')
+ if (regno >= L0 && regno <= I7)
+ hex2mem (ptr, sp + regno - L0, 4, 0);
+ else
+ hex2mem (ptr, (char *)&registers[regno], 4, 0);
+ else
+ {
+ strcpy (remcomOutBuffer, "P01");
+ break;
+ }
+ }
+ else
+ {
+ hex2mem(ptr, (char *)registers, 16 * 4, 0); /* G & O regs */
+ hex2mem(ptr + 16 * 4 * 2, sp + 0, 16 * 4, 0); /* L & I regs */
+ hex2mem(ptr + 64 * 4 * 2, (char *)&registers[Y],
+ 8 * 4, 0); /* Y,PSR,WIM,TBR,PC,NPC,FPSR,CPSR */
+ hex2mem(ptr + 72 * 4 * 2, (char *)&registers[CCSR],
+ 8 * 4, 0); /* CCSR,CCPR,CCCRCR,CCOR,CCOBR,CCIBR,CCIR */
+ hex2mem(ptr + 80 * 4 * 2, (char *)&registers[ASR1],
+ 8 * 4, 0); /* ASR1 ... ASR22 */
+#if 0 /* not implemented */
+ hex2mem(ptr + 88 * 4 * 2, (char *)&registers[AWR0],
+ 8 * 4, 0); /* Alternate Window Registers */
+#endif
+ }
+ /* See if the stack pointer has moved. If so, then copy the saved
+ locals and ins to the new location. This keeps the window
+ overflow and underflow routines happy. */
+
+ newsp = (unsigned long *)registers[SP];
+ if (sp != newsp)
+ sp = memcpy(newsp, sp, 16 * 4);
+
+ /* Don't allow CWP to be modified. */
+
+ if (psr != registers[PSR])
+ registers[PSR] = (psr & 0x1f) | (registers[PSR] & ~0x1f);
+
+ strcpy(remcomOutBuffer,"OK");
+ }
+ 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;
+
+ /* kill the program */
+ case 'k' : /* do nothing */
+ break;
+#if 0
+ case 't': /* Test feature */
+ asm (" std %f30,[%sp]");
+ break;
+#endif
+ case 'r': /* Reset */
+ asm ("call 0
+ nop ");
+ break;
+
+#if 0
+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"); /* Ack before changing speed */
+ set_timer_3(baudrate); /* Set it */
+ }
+x1: break;
+#endif
+ } /* switch */
+
+ /* reply to the request */
+ putpacket(remcomOutBuffer);
+ }
+}
+
+/* This function will generate a breakpoint exception. It is used at the
+ beginning of a program to sync up with a debugger and can be used
+ otherwise as a quick means to stop program execution and "break" into
+ the debugger. */
+
+void
+breakpoint()
+{
+ if (!initialized)
+ return;
+
+ asm(" .globl _breakinst
+
+ _breakinst: ta 1
+ ");
+}
+
+static void
+hw_breakpoint()
+{
+ asm("
+ ta 127
+ ");
+}
+
+#if 0 /* experimental and never finished, left here for reference */
+static void
+splet_temp(void)
+{
+ asm(" sub %sp,(16+1+6+1+121)*4,%sp ! Make room for input & locals
+ ! + hidden arg + arg spill
+ ! + doubleword alignment
+ ! + registers[121]
+
+! Leave a trail of breadcrumbs! (save register save area for debugging)
+ mov %sp, %l0
+ add %l0, 24*4, %l0
+ sethi %hi(_debug_registers), %l1
+ st %l0, [%lo(_debug_registers) + %l1]
+
+! Save the Alternate Register Set: (not implemented yet)
+! To save the Alternate Register set, we must:
+! 1) Save the current SP in some global location.
+! 2) Swap the register sets.
+! 3) Save the Alternate SP in the Y register
+! 4) Fetch the SP that we saved in step 1.
+! 5) Use that to save the rest of the regs (not forgetting ASP in Y)
+! 6) Restore the Alternate SP from Y
+! 7) Swap the registers back.
+
+! 1) Copy the current stack pointer to global _SAVED_STACK_POINTER:
+ sethi %hi(_saved_stack_pointer), %l0
+ st %sp, [%lo(_saved_stack_pointer) + %l0]
+
+! 2) Swap the register sets:
+ mov %psr, %l1
+ sethi %hi(0x10000), %l2
+ xor %l1, %l2, %l1
+ mov %l1, %psr
+ nop ! 3 nops after write to %psr (needed?)
+ nop
+ nop
+
+! 3) Save Alternate L0 in Y
+ wr %l0, 0, %y
+
+! 4) Load former SP into alternate SP, using L0
+ sethi %hi(_saved_stack_pointer), %l0
+ or %lo(_saved_stack_pointer), %l0, %l0
+ swap [%l0], %sp
+
+! 4.5) Restore alternate L0
+ rd %y, %l0
+
+! 5) Save the Alternate Window Registers
+ st %r0, [%sp + (24 + 88) * 4] ! AWR0
+ st %r1, [%sp + (24 + 89) * 4] ! AWR1
+ st %r2, [%sp + (24 + 90) * 4] ! AWR2
+ st %r3, [%sp + (24 + 91) * 4] ! AWR3
+ st %r4, [%sp + (24 + 92) * 4] ! AWR4
+ st %r5, [%sp + (24 + 93) * 4] ! AWR5
+ st %r6, [%sp + (24 + 94) * 4] ! AWR6
+ st %r7, [%sp + (24 + 95) * 4] ! AWR7
+ st %r8, [%sp + (24 + 96) * 4] ! AWR8
+ st %r9, [%sp + (24 + 97) * 4] ! AWR9
+ st %r10, [%sp + (24 + 98) * 4] ! AWR10
+ st %r11, [%sp + (24 + 99) * 4] ! AWR11
+ st %r12, [%sp + (24 + 100) * 4] ! AWR12
+ st %r13, [%sp + (24 + 101) * 4] ! AWR13
+! st %r14, [%sp + (24 + 102) * 4] ! AWR14 (SP)
+ st %r15, [%sp + (24 + 103) * 4] ! AWR15
+ st %r16, [%sp + (24 + 104) * 4] ! AWR16
+ st %r17, [%sp + (24 + 105) * 4] ! AWR17
+ st %r18, [%sp + (24 + 106) * 4] ! AWR18
+ st %r19, [%sp + (24 + 107) * 4] ! AWR19
+ st %r20, [%sp + (24 + 108) * 4] ! AWR20
+ st %r21, [%sp + (24 + 109) * 4] ! AWR21
+ st %r22, [%sp + (24 + 110) * 4] ! AWR22
+ st %r23, [%sp + (24 + 111) * 4] ! AWR23
+ st %r24, [%sp + (24 + 112) * 4] ! AWR24
+ st %r25, [%sp + (24 + 113) * 4] ! AWR25
+ st %r26, [%sp + (24 + 114) * 4] ! AWR26
+ st %r27, [%sp + (24 + 115) * 4] ! AWR27
+ st %r28, [%sp + (24 + 116) * 4] ! AWR28
+ st %r29, [%sp + (24 + 117) * 4] ! AWR29
+ st %r30, [%sp + (24 + 118) * 4] ! AWR30
+ st %r31, [%sp + (24 + 119) * 4] ! AWR21
+
+! Get the Alternate PSR (I hope...)
+
+ rd %psr, %l2
+ st %l2, [%sp + (24 + 120) * 4] ! APSR
+
+! Don't forget the alternate stack pointer
+
+ rd %y, %l3
+ st %l3, [%sp + (24 + 102) * 4] ! AWR14 (SP)
+
+! 6) Restore the Alternate SP (saved in Y)
+
+ rd %y, %o6
+
+
+! 7) Swap the registers back:
+
+ mov %psr, %l1
+ sethi %hi(0x10000), %l2
+ xor %l1, %l2, %l1
+ mov %l1, %psr
+ nop ! 3 nops after write to %psr (needed?)
+ nop
+ nop
+");
+}
+
+#endif
diff --git a/contrib/groff/nroff/nroff.man b/contrib/groff/nroff/nroff.man
index 6d64bea3a67d..ce71003c0c8b 100644
--- a/contrib/groff/nroff/nroff.man
+++ b/contrib/groff/nroff/nroff.man
@@ -16,7 +16,7 @@ versions, except that this permission notice may be included in
translations approved by the Free Software Foundation instead of in
the original English.
- $FreeBSD$
+ $FreeBSD: src/contrib/groff/nroff/nroff.man,v 1.2.4.1 1999/11/02 12:33:21 phantom Exp $
..
.TH @G@NROFF @MAN1EXT@ "@MDATE@" "Groff Version @VERSION@"
diff --git a/contrib/groff/nroff/nroff.sh b/contrib/groff/nroff/nroff.sh
index 57e5d454938b..5ab6044593dc 100755
--- a/contrib/groff/nroff/nroff.sh
+++ b/contrib/groff/nroff/nroff.sh
@@ -1,6 +1,6 @@
#!/bin/sh
# Emulate nroff with groff.
-# $FreeBSD$
+# $FreeBSD: src/contrib/groff/nroff/nroff.sh,v 1.4.2.5 1999/11/02 12:33:21 phantom Exp $
prog="$0"
# Default device.
diff --git a/contrib/isc-dhcp/TODO b/contrib/isc-dhcp/TODO
new file mode 100644
index 000000000000..f1391360b56a
--- /dev/null
+++ b/contrib/isc-dhcp/TODO
@@ -0,0 +1,31 @@
+Things to do, not in any particular order...
+
+- Dynamic DNS support
+
+- SNMP support
+
+- Asynchronous DNS support (look up names while serving other requests)
+
+- Authentication heirarchies (particularly by MAC address or by DHCP
+ Authentication Protocol key).
+
+- Authentication protocol
+
+- Server-to-server protocol
+
+- Token ring support for bpf/nit interfaces
+
+- FDDI support for bpf/nit interfaces (mostly done)
+
+- Other network hardware support for low-level interfaces?
+
+- Standard socket API for sending to all-ones broadcast and figuring
+ out which interface a packet came in on?
+
+- IPv6/DHCPv6 support
+
+- Dhcpd running on MacOS Open Transport
+
+- Dhcpd running on Windows/NT
+
+- Dhcpd running on Windows95
diff --git a/contrib/isc-dhcp/client/scripts/freebsd b/contrib/isc-dhcp/client/scripts/freebsd
index 5a4ab0b5c40d..e8d0463f1667 100755
--- a/contrib/isc-dhcp/client/scripts/freebsd
+++ b/contrib/isc-dhcp/client/scripts/freebsd
@@ -1,6 +1,6 @@
#!/bin/sh
-# $FreeBSD$
+# $FreeBSD: src/contrib/isc-dhcp/client/scripts/freebsd,v 1.1.1.2.2.7 1999/12/12 01:17:30 obrien Exp $
if [ -x /usr/bin/logger ]; then
LOGGER="/usr/bin/logger -s -p user.notice -t dhclient"
diff --git a/contrib/isc-dhcp/common/tables.c b/contrib/isc-dhcp/common/tables.c
index 2accc5751a34..df8d1a58db11 100644
--- a/contrib/isc-dhcp/common/tables.c
+++ b/contrib/isc-dhcp/common/tables.c
@@ -40,7 +40,7 @@
* Enterprises, see ``http://www.vix.com''.
*/
-/* $FreeBSD$ */
+/* $FreeBSD: src/contrib/isc-dhcp/common/tables.c,v 1.1.1.2.2.3 1999/12/08 06:43:26 obrien Exp $ */
#ifndef lint
static char copyright[] =
diff --git a/contrib/nvi/ex/ex.c b/contrib/nvi/ex/ex.c
index ecdae4b86934..b7663c9e1f03 100644
--- a/contrib/nvi/ex/ex.c
+++ b/contrib/nvi/ex/ex.c
@@ -7,7 +7,7 @@
* See the LICENSE file for redistribution information.
*/
-/* $FreeBSD$ */
+/* $FreeBSD: src/contrib/nvi/ex/ex.c,v 1.1.1.1.4.1 1999/09/15 08:57:36 ru Exp $ */
#include "config.h"
diff --git a/contrib/perl5/ext/POSIX/POSIX.xs b/contrib/perl5/ext/POSIX/POSIX.xs
index 093cc9957797..a2f387fdab8c 100644
--- a/contrib/perl5/ext/POSIX/POSIX.xs
+++ b/contrib/perl5/ext/POSIX/POSIX.xs
@@ -1,4 +1,4 @@
-/* $FreeBSD$ */
+/* $FreeBSD: src/contrib/perl5/ext/POSIX/POSIX.xs,v 1.1.1.1.2.2 1999/11/13 20:08:57 ache Exp $ */
#ifdef WIN32
#define _POSIX_
#endif
diff --git a/contrib/perl5/pp.c b/contrib/perl5/pp.c
index 1d4dbcc83d34..c765d9b4dece 100644
--- a/contrib/perl5/pp.c
+++ b/contrib/perl5/pp.c
@@ -5,7 +5,7 @@
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file.
*
- * $FreeBSD$
+ * $FreeBSD: src/contrib/perl5/pp.c,v 1.1.1.1.2.2 1999/12/13 19:16:47 ache Exp $
*/
/*
diff --git a/contrib/tcpdump/ethertype.h b/contrib/tcpdump/ethertype.h
index 487183a5b9bf..de7a6f19b252 100644
--- a/contrib/tcpdump/ethertype.h
+++ b/contrib/tcpdump/ethertype.h
@@ -19,7 +19,7 @@
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* @(#) $Header: ethertype.h,v 1.6 96/07/14 18:21:49 leres Exp $ (LBL)
- * $FreeBSD$
+ * $FreeBSD: src/contrib/tcpdump/ethertype.h,v 1.2.4.1 1999/11/21 10:51:24 brian Exp $
*/
/* Types missing from some systems */
diff --git a/contrib/tcpdump/interface.h b/contrib/tcpdump/interface.h
index 7287a48134ae..8f80150a471e 100644
--- a/contrib/tcpdump/interface.h
+++ b/contrib/tcpdump/interface.h
@@ -19,7 +19,7 @@
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* @(#) $Header: interface.h,v 1.105 97/04/26 13:39:58 leres Exp $ (LBL)
- * $FreeBSD$
+ * $FreeBSD: src/contrib/tcpdump/interface.h,v 1.1.1.3.2.2 1999/11/21 10:51:25 brian Exp $
*/
#ifndef tcpdump_interface_h
diff --git a/contrib/tcpdump/ppp.h b/contrib/tcpdump/ppp.h
index 8bf94e3c82be..099bfd49d1f4 100644
--- a/contrib/tcpdump/ppp.h
+++ b/contrib/tcpdump/ppp.h
@@ -15,7 +15,7 @@
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
- * $FreeBSD$
+ * $FreeBSD: src/contrib/tcpdump/ppp.h,v 1.1.1.1.2.1 1999/11/21 10:51:26 brian Exp $
*/
#undef PPP_ADDRESS
#define PPP_ADDRESS 0xff /* The address byte value */
diff --git a/contrib/tcpdump/print-ether.c b/contrib/tcpdump/print-ether.c
index 4f267eaa4992..3ca26dd72023 100644
--- a/contrib/tcpdump/print-ether.c
+++ b/contrib/tcpdump/print-ether.c
@@ -18,7 +18,7 @@
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $FreeBSD$
+ * $FreeBSD: src/contrib/tcpdump/print-ether.c,v 1.7.2.1 1999/11/21 10:51:26 brian Exp $
*/
#ifndef lint
static const char rcsid[] =
diff --git a/contrib/tcpdump/print-ppp.c b/contrib/tcpdump/print-ppp.c
index b5052c7fffe4..6b24d519375c 100644
--- a/contrib/tcpdump/print-ppp.c
+++ b/contrib/tcpdump/print-ppp.c
@@ -18,7 +18,7 @@
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $FreeBSD$
+ * $FreeBSD: src/contrib/tcpdump/print-ppp.c,v 1.7.2.2 1999/11/27 18:05:26 brian Exp $
*/
#ifndef lint