+2002-05-28 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * Remove amd-udi subdirectory - it is obsolete.
+
2002-05-17 Nick Clifton <nickc@cambridge.redhat.com>
* Remove msdos subdirectory - it is obsolete.
+++ /dev/null
-#
-# Makefile for utils/amd-udi/mondfe and montip tools
-# Copyright (C) 1993 Free Software Foundation
-#
-# This file is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-# Written by Jeffrey Wheat (cassidy@cygnus.com)
-#
-
-#### Start of system configuration section. ####
-
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-CC = @CC@
-
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-
-DEFS = @DEFS@
-LIBS = @LIBS@
-RANLIB = @RANLIB@
-
-AR = ar
-AR_FLAGS = rv
-
-CFLAGS = -g
-
-LD = ld
-LDFLAGS = -g
-
-MV = mv
-RM = rm
-
-prefix = /usr/local
-exec_prefix = $(prefix)
-
-bindir = $(exec_prefix)/bin
-libdir = $(exec_prefix)/lib
-
-mandir = $(prefix)/man
-man1dir = $(mandir)/man1
-man2dir = $(mandir)/man2
-man3dir = $(mandir)/man3
-man4dir = $(mandir)/man4
-man5dir = $(mandir)/man5
-man6dir = $(mandir)/man6
-man7dir = $(mandir)/man7
-man8dir = $(mandir)/man8
-
-SHELL = /bin/sh
-
-INSTALL = install -c
-INSTALL_DATA = $(INSTALL)
-INSTALL_PROGRAM = $(INSTALL)
-
-#### End of system configuration section. ####
-
-SHELL = /bin/sh
-
-MAKEINFO = makeinfo
-TEXI2DVI = texi2dvi
-
-SUBDIRS = udi mondfe montip
-
-# These are roughly topologically sorted in order to make porting more
-# streamlined.
-FLAGS_TO_PASS = \
- "CC=$(CC)" \
- "CFLAGS=$(CFLAGS)" \
- "AR=$(AR)" \
- "RANLIB=$(RANLIB)" \
- "AR_FLAGS=$(AR_FLAGS)" \
- "LD=$(LD)" \
- "LDFLAGS=$(LDFLAGS)" \
- "AS=$(AS)" \
- "MV=$(MV)" \
- "RM=$(RM)" \
- "CROSS_CFLAGS=$(CROSS_CFLAGS)" \
- "TARGET_CFLAGS=$(TARGET_CFLAGS)" \
- "INCLUDES=$(INCLUDES)"
-
-all:
- @for dir in ${SUBDIRS}; do \
- if [ -d $$dir ]; then \
- (rootme=`pwd`/ ; export rootme ; \
- rootsrc=`cd $(srcdir); pwd`/ ; export rootsrc ; \
- cd $$dir; $(MAKE) $(FLAGS_TO_PASS)); \
- fi; \
- done
-
-install:
- @for dir in ${SUBDIRS}; do \
- echo "$$dir:"; \
- if [ -d $$dir ]; then \
- (cd $$dir; $(MAKE) install); \
- fi; \
- done
-
-clean mostlyclean:
- -rm -f *~ core *.o a.out
- @for dir in ${SUBDIRS}; do \
- echo "$$dir:"; \
- if [ -d $$dir ]; then \
- (cd $$dir; $(MAKE) $@); \
- fi; \
- done
-
-distclean maintainer-clean realclean: clean
- @for dir in ${SUBDIRS}; do \
- echo "$$dir:"; \
- (cd $$dir; $(MAKE) $@); \
- done
- -rm -f *~ core
- -rm -f Makefile config.status
-
-.c.o:
- $(CC) -c $(CFLAGS) $(INCLUDE) $(CPPFLAGS) $(DEFS) $<
-
-install-info: info
-
-installcheck:
-
-check:
-
-Makefile: Makefile.in configure.in
- $(SHELL) ./config.status
-
-configure: configure.in
- autoconf
-
-TAGS: $(SRCS)
- etags $(SRCS)
-
-# Prevent GNU make v3 from overflowing arg limit on SysV.
-.NOEXPORT:
+++ /dev/null
-#! /bin/sh
-
-# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.12
-# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
-#
-# This configure script is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
-
-# Defaults:
-ac_help=
-ac_default_prefix=/usr/local
-# Any additions from configure.in:
-
-# Initialize some variables set by options.
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-build=NONE
-cache_file=./config.cache
-exec_prefix=NONE
-host=NONE
-no_create=
-nonopt=NONE
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-srcdir=
-target=NONE
-verbose=
-x_includes=NONE
-x_libraries=NONE
-bindir='${exec_prefix}/bin'
-sbindir='${exec_prefix}/sbin'
-libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
-sysconfdir='${prefix}/etc'
-sharedstatedir='${prefix}/com'
-localstatedir='${prefix}/var'
-libdir='${exec_prefix}/lib'
-includedir='${prefix}/include'
-oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
-
-# Initialize some other variables.
-subdirs=
-MFLAGS= MAKEFLAGS=
-# Maximum number of lines to put in a shell here document.
-ac_max_here_lines=12
-
-ac_prev=
-for ac_option
-do
-
- # If the previous option needs an argument, assign it.
- if test -n "$ac_prev"; then
- eval "$ac_prev=\$ac_option"
- ac_prev=
- continue
- fi
-
- case "$ac_option" in
- -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) ac_optarg= ;;
- esac
-
- # Accept the important Cygnus configure options, so we can diagnose typos.
-
- case "$ac_option" in
-
- -bindir | --bindir | --bindi | --bind | --bin | --bi)
- ac_prev=bindir ;;
- -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
- bindir="$ac_optarg" ;;
-
- -build | --build | --buil | --bui | --bu)
- ac_prev=build ;;
- -build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build="$ac_optarg" ;;
-
- -cache-file | --cache-file | --cache-fil | --cache-fi \
- | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
- ac_prev=cache_file ;;
- -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
- | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
- cache_file="$ac_optarg" ;;
-
- -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
- ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
- | --da=*)
- datadir="$ac_optarg" ;;
-
- -disable-* | --disable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- eval "enable_${ac_feature}=no" ;;
-
- -enable-* | --enable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "enable_${ac_feature}='$ac_optarg'" ;;
-
- -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
- | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
- | --exec | --exe | --ex)
- ac_prev=exec_prefix ;;
- -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
- | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
- | --exec=* | --exe=* | --ex=*)
- exec_prefix="$ac_optarg" ;;
-
- -gas | --gas | --ga | --g)
- # Obsolete; use --with-gas.
- with_gas=yes ;;
-
- -help | --help | --hel | --he)
- # Omit some internal or obsolete options to make the list less imposing.
- # This message is too long to be a string in the A/UX 3.1 sh.
- cat << EOF
-Usage: configure [options] [host]
-Options: [defaults in brackets after descriptions]
-Configuration:
- --cache-file=FILE cache test results in FILE
- --help print this message
- --no-create do not create output files
- --quiet, --silent do not print \`checking...' messages
- --version print the version of autoconf that created configure
-Directory and file names:
- --prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [same as prefix]
- --bindir=DIR user executables in DIR [EPREFIX/bin]
- --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
- --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data in DIR
- [PREFIX/share]
- --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data in DIR
- [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
- --libdir=DIR object code libraries in DIR [EPREFIX/lib]
- --includedir=DIR C header files in DIR [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
- --infodir=DIR info documentation in DIR [PREFIX/info]
- --mandir=DIR man documentation in DIR [PREFIX/man]
- --srcdir=DIR find the sources in DIR [configure dir or ..]
- --program-prefix=PREFIX prepend PREFIX to installed program names
- --program-suffix=SUFFIX append SUFFIX to installed program names
- --program-transform-name=PROGRAM
- run sed PROGRAM on installed program names
-EOF
- cat << EOF
-Host type:
- --build=BUILD configure for building on BUILD [BUILD=HOST]
- --host=HOST configure for HOST [guessed]
- --target=TARGET configure for TARGET [TARGET=HOST]
-Features and packages:
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --x-includes=DIR X include files are in DIR
- --x-libraries=DIR X library files are in DIR
-EOF
- if test -n "$ac_help"; then
- echo "--enable and --with options recognized:$ac_help"
- fi
- exit 0 ;;
-
- -host | --host | --hos | --ho)
- ac_prev=host ;;
- -host=* | --host=* | --hos=* | --ho=*)
- host="$ac_optarg" ;;
-
- -includedir | --includedir | --includedi | --included | --include \
- | --includ | --inclu | --incl | --inc)
- ac_prev=includedir ;;
- -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
- | --includ=* | --inclu=* | --incl=* | --inc=*)
- includedir="$ac_optarg" ;;
-
- -infodir | --infodir | --infodi | --infod | --info | --inf)
- ac_prev=infodir ;;
- -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
- infodir="$ac_optarg" ;;
-
- -libdir | --libdir | --libdi | --libd)
- ac_prev=libdir ;;
- -libdir=* | --libdir=* | --libdi=* | --libd=*)
- libdir="$ac_optarg" ;;
-
- -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
- | --libexe | --libex | --libe)
- ac_prev=libexecdir ;;
- -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
- | --libexe=* | --libex=* | --libe=*)
- libexecdir="$ac_optarg" ;;
-
- -localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst \
- | --locals | --local | --loca | --loc | --lo)
- ac_prev=localstatedir ;;
- -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* \
- | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
- localstatedir="$ac_optarg" ;;
-
- -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
- ac_prev=mandir ;;
- -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
- mandir="$ac_optarg" ;;
-
- -nfp | --nfp | --nf)
- # Obsolete; use --without-fp.
- with_fp=no ;;
-
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c)
- no_create=yes ;;
-
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
- no_recursion=yes ;;
-
- -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
- | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
- | --oldin | --oldi | --old | --ol | --o)
- ac_prev=oldincludedir ;;
- -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
- | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
- | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
- oldincludedir="$ac_optarg" ;;
-
- -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
- ac_prev=prefix ;;
- -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
- prefix="$ac_optarg" ;;
-
- -program-prefix | --program-prefix | --program-prefi | --program-pref \
- | --program-pre | --program-pr | --program-p)
- ac_prev=program_prefix ;;
- -program-prefix=* | --program-prefix=* | --program-prefi=* \
- | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
- program_prefix="$ac_optarg" ;;
-
- -program-suffix | --program-suffix | --program-suffi | --program-suff \
- | --program-suf | --program-su | --program-s)
- ac_prev=program_suffix ;;
- -program-suffix=* | --program-suffix=* | --program-suffi=* \
- | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
- program_suffix="$ac_optarg" ;;
-
- -program-transform-name | --program-transform-name \
- | --program-transform-nam | --program-transform-na \
- | --program-transform-n | --program-transform- \
- | --program-transform | --program-transfor \
- | --program-transfo | --program-transf \
- | --program-trans | --program-tran \
- | --progr-tra | --program-tr | --program-t)
- ac_prev=program_transform_name ;;
- -program-transform-name=* | --program-transform-name=* \
- | --program-transform-nam=* | --program-transform-na=* \
- | --program-transform-n=* | --program-transform-=* \
- | --program-transform=* | --program-transfor=* \
- | --program-transfo=* | --program-transf=* \
- | --program-trans=* | --program-tran=* \
- | --progr-tra=* | --program-tr=* | --program-t=*)
- program_transform_name="$ac_optarg" ;;
-
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil)
- silent=yes ;;
-
- -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
- ac_prev=sbindir ;;
- -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
- | --sbi=* | --sb=*)
- sbindir="$ac_optarg" ;;
-
- -sharedstatedir | --sharedstatedir | --sharedstatedi \
- | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
- | --sharedst | --shareds | --shared | --share | --shar \
- | --sha | --sh)
- ac_prev=sharedstatedir ;;
- -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
- | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
- | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
- | --sha=* | --sh=*)
- sharedstatedir="$ac_optarg" ;;
-
- -site | --site | --sit)
- ac_prev=site ;;
- -site=* | --site=* | --sit=*)
- site="$ac_optarg" ;;
-
- -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
- ac_prev=srcdir ;;
- -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- srcdir="$ac_optarg" ;;
-
- -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
- | --syscon | --sysco | --sysc | --sys | --sy)
- ac_prev=sysconfdir ;;
- -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
- | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
- sysconfdir="$ac_optarg" ;;
-
- -target | --target | --targe | --targ | --tar | --ta | --t)
- ac_prev=target ;;
- -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target="$ac_optarg" ;;
-
- -v | -verbose | --verbose | --verbos | --verbo | --verb)
- verbose=yes ;;
-
- -version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.12"
- exit 0 ;;
-
- -with-* | --with-*)
- ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "with_${ac_package}='$ac_optarg'" ;;
-
- -without-* | --without-*)
- ac_package=`echo $ac_option|sed -e 's/-*without-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- eval "with_${ac_package}=no" ;;
-
- --x)
- # Obsolete; use --with-x.
- with_x=yes ;;
-
- -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
- | --x-incl | --x-inc | --x-in | --x-i)
- ac_prev=x_includes ;;
- -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
- | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
- x_includes="$ac_optarg" ;;
-
- -x-libraries | --x-libraries | --x-librarie | --x-librari \
- | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
- ac_prev=x_libraries ;;
- -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
- | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
- x_libraries="$ac_optarg" ;;
-
- -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
- ;;
-
- *)
- if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
- echo "configure: warning: $ac_option: invalid host type" 1>&2
- fi
- if test "x$nonopt" != xNONE; then
- { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
- fi
- nonopt="$ac_option"
- ;;
-
- esac
-done
-
-if test -n "$ac_prev"; then
- { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
-fi
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-# File descriptor usage:
-# 0 standard input
-# 1 file creation
-# 2 errors and warnings
-# 3 some systems may open it to /dev/tty
-# 4 used on the Kubota Titan
-# 6 checking for... messages and results
-# 5 compiler messages saved in config.log
-if test "$silent" = yes; then
- exec 6>/dev/null
-else
- exec 6>&1
-fi
-exec 5>./config.log
-
-echo "\
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-" 1>&5
-
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Also quote any args containing shell metacharacters.
-ac_configure_args=
-for ac_arg
-do
- case "$ac_arg" in
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c) ;;
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
- ac_configure_args="$ac_configure_args '$ac_arg'" ;;
- *) ac_configure_args="$ac_configure_args $ac_arg" ;;
- esac
-done
-
-# NLS nuisances.
-# Only set these to C if already set. These must not be set unconditionally
-# because not all systems understand e.g. LANG=C (notably SCO).
-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
-# Non-C LC_CTYPE values break the ctype check.
-if test "${LANG+set}" = set; then LANG=C; export LANG; fi
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo > confdefs.h
-
-# A filename unique to this package, relative to the directory that
-# configure is in, which we can look for to find out if srcdir is correct.
-ac_unique_file=mondfe/bkpt.c
-
-# Find the source files, if location was not specified.
-if test -z "$srcdir"; then
- ac_srcdir_defaulted=yes
- # Try the directory containing this script, then its parent.
- ac_prog=$0
- ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
- test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
- srcdir=$ac_confdir
- if test ! -r $srcdir/$ac_unique_file; then
- srcdir=..
- fi
-else
- ac_srcdir_defaulted=no
-fi
-if test ! -r $srcdir/$ac_unique_file; then
- if test "$ac_srcdir_defaulted" = yes; then
- { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
- else
- { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
- fi
-fi
-srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
-
-# Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
- fi
-fi
-for ac_site_file in $CONFIG_SITE; do
- if test -r "$ac_site_file"; then
- echo "loading site script $ac_site_file"
- . "$ac_site_file"
- fi
-done
-
-if test -r "$cache_file"; then
- echo "loading cache $cache_file"
- . $cache_file
-else
- echo "creating cache $cache_file"
- > $cache_file
-fi
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
- # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
- if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
- ac_n= ac_c='
-' ac_t=' '
- else
- ac_n=-n ac_c= ac_t=
- fi
-else
- ac_n= ac_c='\c' ac_t=
-fi
-
-
-
-CC=${CC-cc}
-
-
-echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:527: checking how to run the C preprocessor" >&5
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
- CPP=
-fi
-if test -z "$CPP"; then
-if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- # This must be in double quotes, not single quotes, because CPP may get
- # substituted into the Makefile and "${CC-cc}" will confuse make.
- CPP="${CC-cc} -E"
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp.
- cat > conftest.$ac_ext <<EOF
-#line 542 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:548: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
-if test -z "$ac_err"; then
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP="${CC-cc} -E -traditional-cpp"
- cat > conftest.$ac_ext <<EOF
-#line 559 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:565: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
-if test -z "$ac_err"; then
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP=/lib/cpp
-fi
-rm -f conftest*
-fi
-rm -f conftest*
- ac_cv_prog_CPP="$CPP"
-fi
- CPP="$ac_cv_prog_CPP"
-else
- ac_cv_prog_CPP="$CPP"
-fi
-echo "$ac_t""$CPP" 1>&6
-
-# Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:590: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$RANLIB"; then
- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_RANLIB="ranlib"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
-fi
-fi
-RANLIB="$ac_cv_prog_RANLIB"
-if test -n "$RANLIB"; then
- echo "$ac_t""$RANLIB" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-for ac_hdr in string.h stdlib.h unistd.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:621: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 626 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:631: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
-
-trap '' 1 2 15
-cat > confcache <<\EOF
-# This file is a shell script that caches the results of configure
-# tests run on this system so they can be shared between configure
-# scripts and configure runs. It is not useful on other systems.
-# If it contains results you don't want to keep, you may remove or edit it.
-#
-# By default, configure uses ./config.cache as the cache file,
-# creating it if it does not exist already. You can give configure
-# the --cache-file=FILE option to use a different cache file; that is
-# what configure does when it calls configure scripts in
-# subdirectories, so they share the cache.
-# Giving --cache-file=/dev/null disables caching, for debugging configure.
-# config.status only pays attention to the cache file if you give it the
-# --recheck option to rerun configure.
-#
-EOF
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
-# Ultrix sh set writes to stderr and can't be redirected directly,
-# and sets the high bit in the cache file unless we assign to the vars.
-(set) 2>&1 |
- case `(ac_space=' '; set) 2>&1` in
- *ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote substitution
- # turns \\\\ into \\, and sed turns \\ into \).
- sed -n \
- -e "s/'/'\\\\''/g" \
- -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
- ;;
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
- ;;
- esac >> confcache
-if cmp -s $cache_file confcache; then
- :
-else
- if test -w $cache_file; then
- echo "updating cache $cache_file"
- cat confcache > $cache_file
- else
- echo "not updating unwritable cache $cache_file"
- fi
-fi
-rm -f confcache
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
-# Any assignment to VPATH causes Sun make to only execute
-# the first set of double-colon rules, so remove it if not needed.
-# If there is a colon in the path, we need to keep it.
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
-fi
-
-trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
-
-# Transform confdefs.h into DEFS.
-# Protect against shell expansion while executing Makefile rules.
-# Protect against Makefile macro expansion.
-cat > conftest.defs <<\EOF
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
-s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g
-s%\[%\\&%g
-s%\]%\\&%g
-s%\$%$$%g
-EOF
-DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
-rm -f conftest.defs
-
-
-# Without the "./", some shells look in PATH for config.status.
-: ${CONFIG_STATUS=./config.status}
-
-echo creating $CONFIG_STATUS
-rm -f $CONFIG_STATUS
-cat > $CONFIG_STATUS <<EOF
-#! /bin/sh
-# Generated automatically by configure.
-# Run this file to recreate the current configuration.
-# This directory was configured as follows,
-# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-#
-# $0 $ac_configure_args
-#
-# Compiler output produced by configure, useful for debugging
-# configure, is in ./config.log if it exists.
-
-ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
-for ac_option
-do
- case "\$ac_option" in
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
- exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
- -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- echo "$CONFIG_STATUS generated by autoconf version 2.12"
- exit 0 ;;
- -help | --help | --hel | --he | --h)
- echo "\$ac_cs_usage"; exit 0 ;;
- *) echo "\$ac_cs_usage"; exit 1 ;;
- esac
-done
-
-ac_given_srcdir=$srcdir
-
-trap 'rm -fr `echo "Makefile mondfe/Makefile montip/Makefile udi/Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-# Protect against being on the right side of a sed subst in config.status.
-sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
- s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
-$ac_vpsub
-$extrasub
-s%@CFLAGS@%$CFLAGS%g
-s%@CPPFLAGS@%$CPPFLAGS%g
-s%@CXXFLAGS@%$CXXFLAGS%g
-s%@DEFS@%$DEFS%g
-s%@LDFLAGS@%$LDFLAGS%g
-s%@LIBS@%$LIBS%g
-s%@exec_prefix@%$exec_prefix%g
-s%@prefix@%$prefix%g
-s%@program_transform_name@%$program_transform_name%g
-s%@bindir@%$bindir%g
-s%@sbindir@%$sbindir%g
-s%@libexecdir@%$libexecdir%g
-s%@datadir@%$datadir%g
-s%@sysconfdir@%$sysconfdir%g
-s%@sharedstatedir@%$sharedstatedir%g
-s%@localstatedir@%$localstatedir%g
-s%@libdir@%$libdir%g
-s%@includedir@%$includedir%g
-s%@oldincludedir@%$oldincludedir%g
-s%@infodir@%$infodir%g
-s%@mandir@%$mandir%g
-s%@CC@%$CC%g
-s%@CPP@%$CPP%g
-s%@RANLIB@%$RANLIB%g
-
-CEOF
-EOF
-
-cat >> $CONFIG_STATUS <<\EOF
-
-# Split the substitutions into bite-sized pieces for seds with
-# small command number limits, like on Digital OSF/1 and HP-UX.
-ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
-ac_file=1 # Number of current file.
-ac_beg=1 # First line for current file.
-ac_end=$ac_max_sed_cmds # Line after last line for current file.
-ac_more_lines=:
-ac_sed_cmds=""
-while $ac_more_lines; do
- if test $ac_beg -gt 1; then
- sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
- else
- sed "${ac_end}q" conftest.subs > conftest.s$ac_file
- fi
- if test ! -s conftest.s$ac_file; then
- ac_more_lines=false
- rm -f conftest.s$ac_file
- else
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f conftest.s$ac_file"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
- fi
- ac_file=`expr $ac_file + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_cmds`
- fi
-done
-if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
-fi
-EOF
-
-cat >> $CONFIG_STATUS <<EOF
-
-CONFIG_FILES=\${CONFIG_FILES-"Makefile mondfe/Makefile montip/Makefile udi/Makefile"}
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case "$ac_file" in
- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
- *) ac_file_in="${ac_file}.in" ;;
- esac
-
- # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
-
- # Remove last slash and all that follows it. Not all systems have dirname.
- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- # The file is in a subdirectory.
- test ! -d "$ac_dir" && mkdir "$ac_dir"
- ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
- # A "../" for each directory in $ac_dir_suffix.
- ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
- else
- ac_dir_suffix= ac_dots=
- fi
-
- case "$ac_given_srcdir" in
- .) srcdir=.
- if test -z "$ac_dots"; then top_srcdir=.
- else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
- /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
- *) # Relative path.
- srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
- top_srcdir="$ac_dots$ac_given_srcdir" ;;
- esac
-
-
- echo creating "$ac_file"
- rm -f "$ac_file"
- configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
- case "$ac_file" in
- *Makefile*) ac_comsub="1i\\
-# $configure_input" ;;
- *) ac_comsub= ;;
- esac
-
- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
- sed -e "$ac_comsub
-s%@configure_input@%$configure_input%g
-s%@srcdir@%$srcdir%g
-s%@top_srcdir@%$top_srcdir%g
-" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
-fi; done
-rm -f conftest.s*
-
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-
-exit 0
-EOF
-chmod +x $CONFIG_STATUS
-rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
-
+++ /dev/null
-AC_INIT(mondfe/bkpt.c)
-
-CC=${CC-cc}
-AC_SUBST(CC)
-
-AC_PROG_CPP
-AC_PROG_RANLIB
-
-AC_HAVE_HEADERS(string.h stdlib.h unistd.h)
-
-AC_OUTPUT(Makefile mondfe/Makefile montip/Makefile udi/Makefile)
+++ /dev/null
-/* @(#)coff.h 1.8 91/12/16 16:48:10, AMD */
-/*
-******************************************************************
-** 29K COFF Declarations **
-** **
-** **
-** This file contains the declarations required to define **
-** the COFF format as proposed for use by AMD for the 29K **
-** family of RISC microprocessors. **
-** **
-** No attempt is made here to describe in detail those portions **
-** of COFF which have not been modified or extended. Pertinent **
-** #define's and struct's are included for completeness. Those **
-** declarations are distributed in several System V headers. **
-** **
-** For a better and more complete description of COFF with **
-** general and 29K Family specific clarifications, see the **
-** AMD's "Programmer's Guide to the Common Object File Format **
-** (COFF) for the Am29000" Application Note, order number 11963.**
-** **
-** For non-29K-Family specific COFF information, consult AT&T **
-** UNIX System V Release 3, Programmer's Guide, Chapter 11 **
-** (Manual 307-225, Issue 1). **
-** **
-** **
-** Revision history: **
-** **
-** 0.01 JG - first published **
-** 0.02 JG - added relocation type R_IFAR and renumbered **
-** 0.03 RC - COFF spec now compiles without error **
-** 0.04 RC - removed R_IPAIR and R_IFAR and renumbered **
-** 0.05 RC - added R_HWORD relocation type **
-** 0.06 RC - section types **
-** changed value of STYP_BSSREG **
-** replaced STYP_RDATA and STYP_IDATA **
-** with STYP_LIT, STYP_ABS, and STYP_ENVIR **
-** - relocation types **
-** added R_IABS **
-** replaced R_IBYTE with R_BYTE and renumbered **
-** - changed comments and removed comments **
-** 0.07 RC - relocation types **
-** Added R_IHCONST to support relocation offsets **
-** for CONSTH instruction. Added commentary, **
-** and renumbered to make room for R_IHCONST, **
-** putting the (as yet unused) global reloc **
-** types at the end. **
-** - bug fix (typo) **
-** Added slash to terminate comment field on **
-** C_EXT so now C_STAT is defined. **
-** 0.08 RC - official magic numbers assigned by AT&T. **
-** 0.09 RC - support multiple address spaces by adding magic **
-** a.out header numbers SASMAGIC and MASMAGIC. **
-** 0.10 RC - No changes. Just added the comments below and **
-** corrected comments on tsize, dsize, and bsize. **
-** - All portions of the COFF file described as C **
-** structs must use Host Endian byte ordering. **
-** Files created on a machine with a byte **
-** ordering different from the host may be **
-** converted using the UNIX conv(1) command. **
-** - Assemblers and compilers must create section **
-** headers for .text, .data, and .bss (in that **
-** order) even if they are 0 length. **
-** - tsize, dsize, and bsize are the size of .text, **
-** .data, and .bss respectively. Other sections **
-** of type STYP_TEXT, STYP_DATA, and STYP_BSS **
-** are not included in the byte count. **
-** - Assemblers and compilers must create output **
-** sections to the exact byte length (and not **
-** round them up). The linker will take care **
-** of rounding. **
-** 2.1.01 - Added C_STARTOF storage class for support of **
-** assembler $startof(sect_name) and **
-** $sizeof(sect_name) operators. **
-** 2.1.02 - Added a few more defines for completeness. **
-** 2.1.03 - Added more magic numbers for completeness. **
-******************************************************************
-*/
-
-/*
-** Overall structure of a COFF file
-*/
-
-/*
- *--------------------------------*
- | File Header |
- ----------------------------------
- | Optional Information |
- ----------------------------------
- | Section 1 Header |
- ----------------------------------
- | ... |
- ----------------------------------
- | Section n Header |
- ----------------------------------
- | Raw Data for Section 1 |
- ----------------------------------
- | ... |
- ----------------------------------
- | Raw Data for Section n |
- ----------------------------------
- | Relocation Info for Section 1 |
- ----------------------------------
- | ... |
- ----------------------------------
- | Relocation Info for Section n |
- ----------------------------------
- | Line Numbers for Section 1 |
- ----------------------------------
- | ... |
- ----------------------------------
- | Line Numbers for Section n |
- ----------------------------------
- | Symbol Table |
- ----------------------------------
- | String Table |
- *--------------------------------*
-*/
-
-/****************************************************************/
-
-
-/*
-** File Header and related definitions
-*/
-
-struct filehdr
-{
- unsigned short f_magic; /* magic number */
- unsigned short f_nscns; /* number of sections */
- long f_timdat; /* time & date stamp */
- long f_symptr; /* file pointer to symtab */
- long f_nsyms; /* number of symtab entries */
- unsigned short f_opthdr; /* sizeof(optional hdr) */
- unsigned short f_flags; /* flags */
-};
-
-#define FILHDR struct filehdr
-#define FILHSZ sizeof (FILHDR)
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
-
-/*
-** Magic numbers currently known to us,
-** Plus 29K magic numbers assigned by AT&T.
-*/
-
-#define M68MAGIC 0210
-#define M68TVMAGIC 0211
-#define B16MAGIC 0502
-#define BTVMAGIC 0503
-#define IAPX16 0504
-#define IAPX16TV 0505
-#define IAPX20 0506
-#define IAPX20TV 0507
-#define X86MAGIC 0510
-#define XTVMAGIC 0511
-#define I286SMAGIC 0512
-#define I386MAGIC 0514
-#define MC68MAGIC 0520
-#define MC68KWRMAGIC 0520 /* 68K writeable text sections */
-#define MC68TVMAGIC 0521
-#define MC68KPGMAGIC 0522 /* 68K demand paged text (shared with i286) */
-#define I286LMAGIC 0522 /* i286 (shared with 68K) */
-/* 0524 * reserved for NSC */
-/* 0525 * reserved for NSC */
-/* 0544 * reserved for Zilog */
-/* 0545 * reserved for Zilog */
-#define N3BMAGIC 0550 /* 3B20S executable, no TV */
-#define NTVMAGIC 0551 /* 3B20 executable with TV */
-#define FBOMAGIC 0560 /* WE*-32 (Forward Byte Ordering) */
-#define WE32MAGIC 0560 /* WE 32000, no TV */
-#define MTVMAGIC 0561 /* WE 32000 with TV */
-#define RBOMAGIC 0562 /* WE-32 (Reverse Byte Ordering) */
-#define VAXWRMAGIC 0570 /* VAX-11/750 and VAX-11/780 */
- /* (writable text sections) */
-#define VAXROMAGIC 0575 /* VAX-11/750 and VAX-11780 */
- /* (read-only text sections) */
-#define U370WRMAGIC 0530 /* IBM 370 (writable text sections) */
-#define AMDWRMAGIC 0531 /* Amdahl 470/580 writable text sections */
-#define AMDROMAGIC 0534 /* Amdahl 470/580 read only sharable text */
-#define U370ROMAGIC 0535 /* IBM 370 (read-only sharable text sections) */
-
-#define SIPFBOMAGIC 0572 /* 29K Family (Byte 0 is MSB - Big Endian) */
-#define SIPRBOMAGIC 0573 /* 29K Family (Byte 0 is LSB - Little Endian) */
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
-
-/*
-** File header flags currently known to us.
-**
-** Am29000 will use the F_AR32WR and F_AR32W flags to indicate
-** the byte ordering in the file.
-*/
-
-#define F_RELFLG 00001 /* Relocation information stripped */
- /* from the file. */
-#define F_EXEC 00002 /* File is executable (i.e. no */
- /* unresolved external references). */
-#define F_LNNO 00004 /* Line numbers stripped from */
- /* the file. */
-#define F_LSYMS 00010 /* Local symbols stripped from */
- /* the file. */
-#define F_MINMAL 00020 /* Not used by UNIX. */
-#define F_UPDATE 00040 /* Not used by UNIX. */
-#define F_SWABD 00100 /* Not used by UNIX. */
-#define F_AR16WR 00200 /* File has the byte ordering used */
- /* by the PDP*-11/70 processor. */
-#define F_AR32WR 00400 /* File has 32 bits per word, */
- /* least significant byte first. */
-#define F_AR32W 01000 /* File has 32 bits per word, */
- /* most significant byte first. */
-#define F_PATCH 02000 /* Not used by UNIX. */
-#define F_BM32BRST 0010000 /* 32100 required; has RESTORE work-around. */
-#define F_BM32B 0020000 /* 32100 required. */
-#define F_BM32MAU 0040000 /* MAU required. */
-#define F_BM32ID 0160000 /* WE 32000 processor ID field. */
-
-/*--------------------------------------------------------------*/
-
-/*
-** Optional (a.out) header
-*/
-
-typedef struct aouthdr
-{
- short magic; /* magic number */
- short vstamp; /* version stamp */
- long tsize; /* size of .text in bytes */
- long dsize; /* size of .data (initialized data) */
- long bsize; /* size of .bss (uninitialized data) */
- long entry; /* entry point */
- long text_start; /* base of text used for this file */
- long data_start; /* base of data used for this file */
-} AOUTHDR;
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
-
-/*
-** Magic a.out header numbers for cross development (non-UNIX),
-** support of separate I and D address spaces.
-*/
-
-#define SASMAGIC 010000 /* Single Address Space */
-#define MASMAGIC 020000 /* Multiple (separate I & D) Address Spaces */
-
-/*--------------------------------------------------------------*/
-
-/*
-** Section header and related definitions
-*/
-
-struct scnhdr
-{
- char s_name[8]; /* section name */
- long s_paddr; /* physical address */
- long s_vaddr; /* virtual address */
- long s_size; /* section size */
- long s_scnptr; /* file ptr to raw data for section */
- long s_relptr; /* file ptr to relocation */
- long s_lnnoptr; /* file ptr to line numbers */
- unsigned short s_nreloc; /* number of relocation entries */
- unsigned short s_nlnno; /* number of line number entries */
- long s_flags; /* flags */
-};
-
-#define SCNHDR struct scnhdr
-#define SCNHSZ sizeof (SCNHDR)
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
-
-/*
-** Section types - with additional section type for global
-** registers which will be relocatable for the Am29000.
-**
-** In instances where it is necessary for a linker to produce an
-** output file which contains text or data not based at virtual
-** address 0, e.g. for a ROM, then the linker should accept
-** address base information as command input and use PAD sections
-** to skip over unused addresses.
-*/
-
-#define STYP_REG 0x00 /* Regular section (allocated, */
- /* relocated, loaded) */
-#define STYP_DSECT 0x01 /* Dummy section (not allocated, */
- /* relocated, not loaded) */
-#define STYP_NOLOAD 0x02 /* Noload section (allocated, */
- /* relocated, not loaded) */
-#define STYP_GROUP 0x04 /* Grouped section (formed from */
- /* input sections) */
-#define STYP_PAD 0x08 /* Padded section (not allocated, */
- /* not relocated, loaded) */
-#define STYP_COPY 0x10 /* Copy section (for a decision */
- /* function used in updating fields; */
- /* not allocated, not relocated, */
- /* loaded, relocation and line */
- /* number entries processed */
- /* normally) */
-#define STYP_TEXT 0x20 /* Section contains executable text */
-#define STYP_DATA 0x40 /* Section contains initialized data */
-#define STYP_BSS 0x80 /* Section contains only uninitialized data */
-#define STYP_INFO 0x200 /* Comment section (not allocated, */
- /* not relocated, not loaded) */
-#define STYP_OVER 0x400 /* Overlay section (relocated, */
- /* not allocated, not loaded) */
-#define STYP_LIB 0x800 /* For .lib section (like STYP_INFO) */
-
-#define STYP_BSSREG 0x1200 /* Global register area (like STYP_INFO) */
-#define STYP_ENVIR 0x2200 /* Environment (like STYP_INFO) */
-#define STYP_ABS 0x4000 /* Absolute (allocated, not reloc, loaded) */
-#define STYP_LIT 0x8020 /* Literal data (like STYP_TEXT) */
-
-/*
-NOTE: The use of STYP_BSSREG for relocation is not yet defined.
-*/
-
-/*--------------------------------------------------------------*/
-
-/*
-** Relocation information declaration and related definitions
-*/
-
-struct reloc
-{
- long r_vaddr; /* (virtual) address of reference */
- long r_symndx; /* index into symbol table */
- unsigned short r_type; /* relocation type */
-};
-
-#define RELOC struct reloc
-#define RELSZ 10 /* sizeof (RELOC) */
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
-
-/*
-** Relocation types for the Am29000
-*/
-
-#define R_ABS 0 /* reference is absolute */
-
-#define R_IREL 030 /* instruction relative (jmp/call) */
-#define R_IABS 031 /* instruction absolute (jmp/call) */
-#define R_ILOHALF 032 /* instruction low half (const) */
-#define R_IHIHALF 033 /* instruction high half (consth) part 1 */
-#define R_IHCONST 034 /* instruction high half (consth) part 2 */
- /* constant offset of R_IHIHALF relocation */
-#define R_BYTE 035 /* relocatable byte value */
-#define R_HWORD 036 /* relocatable halfword value */
-#define R_WORD 037 /* relocatable word value */
-
-#define R_IGLBLRC 040 /* instruction global register RC */
-#define R_IGLBLRA 041 /* instruction global register RA */
-#define R_IGLBLRB 042 /* instruction global register RB */
-
-/*
-NOTE:
-All the "I" forms refer to Am29000 instruction formats. The linker is
-expected to know how the numeric information is split and/or aligned
-within the instruction word(s). R_BYTE works for instructions, too.
-
-If the parameter to a CONSTH instruction is a relocatable type, two
-relocation records are written. The first has an r_type of R_IHIHALF
-(33 octal) and a normal r_vaddr and r_symndx. The second relocation
-record has an r_type of R_IHCONST (34 octal), a normal r_vaddr (which
-is redundant), and an r_symndx containing the 32-bit constant offset
-to the relocation instead of the actual symbol table index. This
-second record is always written, even if the constant offset is zero.
-The constant fields of the instruction are set to zero.
-*/
-
-/*--------------------------------------------------------------*/
-
-/*
-** Line number entry declaration and related definitions
-*/
-
-struct lineno
-{
- union
- {
- long l_symndx; /* sym table index of function name */
- long l_paddr; /* (physical) address of line number */
- } l_addr;
- unsigned short l_lnno; /* line number */
-};
-
-#define LINENO struct lineno
-#define LINESZ 6 /* sizeof (LINENO) */
-
-/*--------------------------------------------------------------*/
-
-/*
-** Symbol entry declaration and related definitions
-*/
-
-#define SYMNMLEN 8 /* Number of characters in a symbol name */
-
-struct syment
-{
- union
- {
- char _n_name [SYMNMLEN]; /* symbol name */
- struct
- {
- long _n_zeroes; /* symbol name */
- long _n_offset; /* offset into string table */
- } _n_n;
- char *_n_nptr[2]; /* allows for overlaying */
- } _n;
-#ifndef pdp11
- unsigned
-#endif
- long n_value; /* value of symbol */
- short n_scnum; /* section number */
- unsigned short n_type; /* type and derived type */
- char n_sclass; /* storage class */
- char n_numaux; /* number of aux entries */
-};
-
-#define n_name _n._n_name
-#define n_nptr _n._n_nptr[1]
-#define n_zeroes _n._n_n._n_zeroes
-#define n_offset _n._n_n._n_offset
-
-#define SYMENT struct syment
-#define SYMESZ 18
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
-
-/*
-** Storage class definitions - new classes for global registers.
-*/
-
-#define C_EFCN -1 /* physical end of a function */
-#define C_NULL 0 /* - */
-#define C_AUTO 1 /* automatic variable */
-#define C_EXT 2 /* external symbol */
-#define C_STAT 3 /* static */
-#define C_REG 4 /* (local) register variable */
-#define C_EXTDEF 5 /* external definition */
-#define C_LABEL 6 /* label */
-#define C_ULABEL 7 /* undefined label */
-#define C_MOS 8 /* member of structure */
-#define C_ARG 9 /* function argument */
-#define C_STRTAG 10 /* structure tag */
-#define C_MOU 11 /* member of union */
-#define C_UNTAG 12 /* union tag */
-#define C_TPDEF 13 /* type definition */
-#define C_UNSTATIC 14 /* uninitialized static */
-#define C_USTATIC 14 /* uninitialized static */
-#define C_ENTAG 15 /* enumeration tag */
-#define C_MOE 16 /* member of enumeration */
-#define C_REGPARM 17 /* register parameter */
-#define C_FIELD 18 /* bit field */
-
-#define C_GLBLREG 19 /* global register */
-#define C_EXTREG 20 /* external global register */
-#define C_DEFREG 21 /* ext. def. of global register */
-#define C_STARTOF 22 /* as29 $SIZEOF and $STARTOF symbols */
-
-
-#define C_BLOCK 100 /* beginning and end of block */
-#define C_FCN 101 /* beginning and end of function */
-#define C_EOS 102 /* end of structure */
-#define C_FILE 103 /* file name */
-#define C_LINE 104 /* used only by utility programs */
-#define C_ALIAS 105 /* duplicated tag */
-#define C_HIDDEN 106 /* like static, used to avoid name */
- /* conflicts */
-#define C_SHADOW 107 /* shadow symbol */
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
-
-/*
-** Special section number definitions used in symbol entries.
-** (Section numbers 1-65535 are used to indicate the section
-** where the symbol was defined.)
-*/
-
-#define N_DEBUG -2 /* special symbolic debugging symbol */
-#define N_ABS -1 /* absolute symbol */
-#define N_UNDEF 0 /* undefined external symbol */
-#define N_SCNUM 1-65535 /* section num where symbol defined */
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
-
-/*
-** Fundamental symbol types.
-*/
-
-#define T_NULL 0 /* type not assigned */
-#define T_VOID 1 /* void */
-#define T_CHAR 2 /* character */
-#define T_SHORT 3 /* short integer */
-#define T_INT 4 /* integer */
-#define T_LONG 5 /* long integer */
-#define T_FLOAT 6 /* floating point */
-#define T_DOUBLE 7 /* double word */
-#define T_STRUCT 8 /* structure */
-#define T_UNION 9 /* union */
-#define T_ENUM 10 /* enumeration */
-#define T_MOE 11 /* member of enumeration */
-#define T_UCHAR 12 /* unsigned character */
-#define T_USHORT 13 /* unsigned short */
-#define T_UINT 14 /* unsigned integer */
-#define T_ULONG 15 /* unsigned long */
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
-
-/*
-** Derived symbol types.
-*/
-
-#define DT_NON 0 /* no derived type */
-#define DT_PTR 1 /* pointer */
-#define DT_FCN 2 /* function */
-#define DT_ARY 3 /* array */
-
-/*--------------------------------------------------------------*/
-
-/*
-** Auxiliary symbol table entry declaration and related
-** definitions.
-*/
-
-#define FILNMLEN 14 /* Number of characters in a file name */
-#define DIMNUM 4 /* Number of array dimensions in auxiliary entry */
-
-union auxent
-{
- struct
- {
- long x_tagndx; /* str, un, or enum tag indx */
- union
- {
- struct
- {
- unsigned short x_lnno; /* declaration line number */
- unsigned short x_size; /* str, union, array size */
- } x_lnsz;
- long x_size; /* size of functions */
- } x_misc;
- union
- {
- struct /* if ISFCN, tag, or .bb */
- {
- long x_lnnoptr; /* ptr to fcn line # */
- long x_endndx; /* entry ndx past block end */
- } x_fcn;
- struct /* if ISARY, up to 4 dimen */
- {
- unsigned short x_dimen[DIMNUM];
- } x_ary;
- } x_fcnary;
- unsigned short x_tvndx; /* tv index */
- } x_sym;
- struct
- {
- char x_fname[FILNMLEN];
- } x_file;
- struct
- {
- long x_scnlen; /* section length */
- unsigned short x_nreloc; /* number of relocation entries */
- unsigned short x_nlinno; /* number of line numbers */
- } x_scn;
- struct
- {
- long x_tvfill; /* tv fill value */
- unsigned short x_tvlen; /* length of tv */
- unsigned short x_tvrna[2]; /* tv range */
- } x_tv; /* info about tv section (in auxent of symbol tv)) */
-};
-
-#define AUXENT union auxent
-#define AUXESZ 18 /* sizeof(AUXENT) */
-
+++ /dev/null
-/* @(#)eb030.h 5.18 93/07/30 16:39:43, Srini, AMD */
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- ** This file defines values used in accessing the EB29030 board.
- *****************************************************************************
- */
-
-/* Control Port Register (PC_port_base+0) */
-#define EB030_RESET 0x80 /* (0=Reset EB030, 1=Reset Am29030 */
-#define EB030_DRQEN 0x40 /* Enable DMA requests */
-#define EB030_IRQEN 0x20 /* Enable interrupts */
-
-/*
-** Shared memory definitions
-*/
-
-/*
-** The "anchors" defined below represent addresses in the Am29000
-** data memory space. At these addresses are pointers to shared
-** memory buffers.
-*/
-
-#define EB030_RECV_BUF_PTR 0x0400 /* Host receive buffer pointer */
-
-#define EB030_SEND_BUF 0x0404 /* Host send buffer */
-
+++ /dev/null
-/* @(#)eb29k.h 5.18 93/07/30 16:39:45, Srini, AMD. */
-/******************************************************************************
- * Copyright 1992 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Systems Engineering
- * Mail Stop 573
- * 5204 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- * 29k-support@AMD.COM
- ****************************************************************************
- * Engineer: Srini Subramanian.
- ****************************************************************************
- ** This file defines values used in accessing the EB29K board.
- ****************************************************************************
- */
-
-/* Control Port Register (PC_port_base+0) */
-#define EB29K_RESET 0x80 /* (0=Reset EB29K, 1=Reset Am29000 */
-#define EB29K_DRQEN 0x40 /* Enable DMA requests */
-#define EB29K_IRQEN 0x20 /* Enable interrupts */
-
-/* Address Register (PC_port_base+2) */
-#define EB29K_I_MEM 0x00 /* Set window to Instruction Memory */
-#define EB29K_D_MEM 0x80 /* Set window to Data Memory */
-
-/*
-** Shared memory definitions
-*/
-
-/*
-** The "anchors" defined below represent addresses in the Am29000
-** data memory space. At these addresses are pointers to shared
-** memory buffers.
-*/
-
-#define EB29K_RECV_BUF_PTR 0x80000400 /* Host receive buffer pointer */
-
-#define EB29K_SEND_BUF 0x80000404 /* Host send buffer */
-
+++ /dev/null
-/* @(#)error.h 5.18 93/07/30 16:39:48, Srini, AMD */
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- ** This header file describes the errors which may be returned
- ** by the monitor.
- **
- ** All of the #define'ed error codes below begin with the leters
- ** "EM" (for "Error Monitor"). This should avoid colisions with
- ** other #define's in the system.
- **
- *****************************************************************************
- */
-
-#ifndef _ERROR_H_INCLUDED_
-#define _ERROR_H_INCLUDED_
-
-/* General errors */
-#define EMUSAGE 1 /* Bad args / flags */
-#define EMFAIL 2 /* Unrecoverable error */
-#define EMBADADDR 3 /* Illegal address */
-#define EMBADREG 4 /* Illegal register */
-#define EMSYNTAX 5 /* Illegal command syntax */
-#define EMACCESS 6 /* Could not access memory */
-#define EMALLOC 7 /* Could not allocate memory */
-#define EMTARGET 8 /* Unknown target type */
-#define EMHINIT 9 /* Could not initialize host */
-#define EMCOMM 10 /* Could not open communication channel */
-
-/* Message errors */
-#define EMBADMSG 11 /* Unknown message type */
-#define EMMSG2BIG 12 /* Message to large for buffer */
-
-#define EMRESET 13 /* Could not RESET target */
-#define EMCONFIG 14 /* Could not get target CONFIG */
-#define EMSTATUS 15 /* Could not get target STATUS */
-#define EMREAD 16 /* Could not READ target memory */
-#define EMWRITE 17 /* Could not WRITE target memory */
-#define EMBKPTSET 18 /* Could not set breakpoint */
-#define EMBKPTRM 19 /* Could not remove breakpoint */
-#define EMBKPTSTAT 20 /* Could not get breakpoint status */
-#define EMBKPTNONE 21 /* All breakpoints in use */
-#define EMBKPTUSED 22 /* Breakpoints already in use */
-#define EMCOPY 23 /* Could not COPY target memory */
-#define EMFILL 24 /* Could not FILL target memory */
-#define EMINIT 25 /* Could not initialize target memory */
-#define EMGO 26 /* Could not start execution */
-#define EMSTEP 27 /* Could not single step */
-#define EMBREAK 28 /* Could not BREAK */
-#define EMHIF 29 /* Could not perform HIF service */
-#define EMCHANNEL0 30 /* Could not read CHANNEL0 */
-#define EMCHANNEL1 31 /* Could not write CHANNEL1 */
-
-/* COFF file loader errors */
-#define EMOPEN 32 /* Could not open COFF file */
-#define EMHDR 33 /* Could not read COFF header */
-#define EMMAGIC 34 /* Bad magic number */
-#define EMAOUT 35 /* Could not read COFF a.out header */
-#define EMSCNHDR 36 /* Could not read COFF section header */
-#define EMSCN 37 /* Could not read COFF section */
-#define EMCLOSE 38 /* Could not close COFF file */
-
-/* Log file errors */
-#define EMLOGOPEN 39 /* Could not open log file */
-#define EMLOGREAD 40 /* Could not read log file */
-#define EMLOGWRITE 41 /* Could not write to log file */
-#define EMLOGCLOSE 42 /* Could not close log file */
-
-/* Command file errors */
-#define EMCMDOPEN 43 /* Could not open command file */
-#define EMCMDREAD 44 /* Could not read command file */
-#define EMCMDWRITE 45 /* Could not write to command file */
-#define EMCMDCLOSE 46 /* Could not close comand file */
-
-#define EMTIMEOUT 47 /* Host timed out waiting for a message */
-#define EMCOMMTYPE 48 /* A '-t' flag must be specified */
-#define EMCOMMERR 49 /* Communication error */
-#define EMBAUD 50 /* Invalid baud rate specified */
-
-#define EMTIPINIT 51 /* Failed TIP init */
-#define EMIOSETF 52 /* I/O set up failure */
-#define EMIORESETF 53 /* I/O reset failure */
-#define EMLOADF 54 /* Loading COFF file failed */
-#define EMNOFILE 55 /* No program to run. */
-#define EMECHOPEN 56 /* Could not open echo file */
-#define EMCTRLC 57 /* Ctrl-C encountered */
-#define EMNOSUCHCMD 58 /* Unrecognized command */
-#define EMNOPROCESS 59 /* create process */
-#define EMNOTCOMP 60 /* Not compatible */
-#define EMFATAL 61 /* UDIWait failed */
-#define EMNOINITP 62 /* No initialize process */
-#define EMDOSERR 63 /* DOS err on escape */
-#define EMSYSERR 64 /* system err on escape */
-#define EMINVECHOFILE 65 /* invalid echo file */
-#define EMCMDFILENEST 66 /* command file nesting */
-
-extern char *error_msg[];
-
-#endif /* _ERROR_H_INCLUDED_ */
+++ /dev/null
-/* @(#)help.h 5.20 93/08/23 15:31:16, Srini, AMD */
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- * This header file defines the help screen for different functions.
- *****************************************************************************
- */
-/*
-** External variables
-*/
-
-extern char *help_main[];
-
-extern char *help_a[];
-
-extern char *help_b[];
-
-extern char *help_c[];
-extern char *help_caps[];
-extern char *help_cp[];
-extern char *help_con[];
-extern char *help_ch0[];
-
-extern char *help_d[];
-extern char *help_disc[];
-extern char *help_dp[];
-
-extern char *help_e[];
-extern char *help_ex[];
-extern char *help_esc[];
-extern char *help_eon[];
-
-extern char *help_f[];
-
-extern char *help_g[];
-
-extern char *help_h[];
-
-extern char *help_i[];
-extern char *help_init[];
-
-extern char *help_k[];
-
-extern char *help_l[];
-extern char *help_logon[];
-
-extern char *help_m[];
-
-extern char *help_pid[];
-
-extern char *help_q[];
-extern char *help_qoff[];
-
-extern char *help_r[];
-
-extern char *help_s[];
-extern char *help_sid[];
-
-extern char *help_t[];
-extern char *help_tip[];
-
-extern char *help_x[];
-
-extern char *help_y[];
-
-extern char *help_zc[];
-extern char *help_ze[];
-extern char *help_zl[];
+++ /dev/null
-/* @(#)hif.h 5.19 93/10/26 11:33:44, Srini, AMD */
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- * This header file defines the error codes, service numbers for the HIF
- * kernel.
- *****************************************************************************
- */
-
-#ifndef _HIF_H_INCLUDED_
-#define _HIF_H_INCLUDED_
-
-#define MAX_ENV 256
-#define MAX_FILENAME 256
-
-#define MAX_OPEN_FILES 20
-
-#define HIF_SUCCESS 0x80000000
-
-/*
-** HIF services
-*/
-
-#define HIF_exit 1
-#define HIF_open 17
-#define HIF_close 18
-#define HIF_read 19
-#define HIF_write 20
-#define HIF_lseek 21
-#define HIF_remove 22
-#define HIF_rename 23
-#define HIF_ioctl 24
-#define HIF_iowait 25
-#define HIF_iostat 26
-#define HIF_tmpnam 33
-#define HIF_time 49
-#define HIF_getenv 65
-#define HIF_gettz 66
-
-
-/*
-** HIF Error codes
-*/
-
-#define HIF_EPERM 1
-#define HIF_ENOENT 2
-#define HIF_ESRCH 3
-#define HIF_EINTR 4
-#define HIF_EIO 5
-#define HIF_ENXIO 6
-#define HIF_E2BIG 7
-#define HIF_ENOEXEC 8
-#define HIF_EBADF 9
-#define HIF_ECHILD 10
-#define HIF_EAGAIN 11
-#define HIF_ENOMEM 12
-#define HIF_EACCESS 13
-#define HIF_EFAULT 14
-#define HIF_ENOTBLK 15
-#define HIF_EBUSY 16
-#define HIF_EEXIST 17
-#define HIF_EXDEV 18
-#define HIF_ENODEV 19
-#define HIF_ENOTDIR 20
-#define HIF_EISDIR 21
-#define HIF_EINVAL 22
-#define HIF_ENFILE 23
-#define HIF_EMFILE 24
-#define HIF_ENOTTY 25
-#define HIF_ETXTBSY 26
-#define HIF_EFBIG 27
-#define HIF_ENOSPC 28
-#define HIF_ESPIPE 29
-#define HIF_EROFS 30
-#define HIF_EMLINK 31
-#define HIF_EPIPE 32
-#define HIF_EDOM 33
-#define HIF_ERANGE 34
-#define HIF_EWOULDBLOCK 35
-#define HIF_EINPROGRESS 36
-#define HIF_EALREADY 37
-#define HIF_ENOTSOCK 38
-#define HIF_EDESTADDRREQ 39
-#define HIF_EMSGSIZE 40
-#define HIF_EPROTOTYPE 41
-#define HIF_ENOPROTOOPT 42
-#define HIF_EPROTONOSUPPORT 43
-#define HIF_ESOCKTNOSUPPORT 44
-#define HIF_EOPNOTSUPP 45
-#define HIF_EPFNOSUPPORT 46
-#define HIF_EAFNOSUPPORT 47
-#define HIF_EADDRINUSE 48
-#define HIF_EADDRNOTAVAIL 49
-#define HIF_ENETDOWN 50
-#define HIF_ENETUNREACH 51
-#define HIF_ENETRESET 52
-#define HIF_ECONNABORTED 53
-#define HIF_ECONNRESET 54
-#define HIF_ENOBUFS 55
-#define HIF_EISCONN 56
-#define HIF_ENOTCONN 57
-#define HIF_ESHUTDOWN 58
-#define HIF_ETOOMANYREFS 59
-#define HIF_ETIMEDOUT 60
-#define HIF_ECONNREFUSED 61
-#define HIF_ELOOP 62
-#define HIF_ENAMETOOLONG 63
-#define HIF_EHOSTDOWN 64
-#define HIF_EHOSTUNREACH 65
-#define HIF_ENOTEMPTY 66
-#define HIF_EPROCLIM 67
-#define HIF_EUSERS 68
-#define HIF_EDQUOT 69
-#define HIF_EVDBAD 70
-#define HIF_EHIFNOTAVAIL 1001
-#define HIF_EHIFUNDEF 1002
-
-/*
-** Open service mode parameters
-*/
-
-#define HIF_RDONLY 0x0000
-#define HIF_WRONLY 0x0001
-#define HIF_RDWR 0x0002
-#define HIF_APPEND 0x0008
-#define HIF_NDELAY 0x0010
-#define HIF_CREAT 0x0200
-#define HIF_TRUNC 0x0400
-#define HIF_EXCL 0x0800
-#define HIF_FORM 0x4000
-
-/*
-** iostat definitions
-*/
-
-#define ISATTY 0x0001
-#define RDREADY 0x0002
-
-
-/*
-** Fix differences between BSD UNIX and MS-DOS in <fcntl.h>
-*/
-
-#if MSDOS
-
-#define O_NDELAY 0x0000
-
-#else
-
-#define O_BINARY 0x0000
-#define O_TEXT 0x0000
-
-#endif
-
-
-#endif /* _HIF_H_INCLUDED_ */
+++ /dev/null
-/* @(#)lcb29k.h 5.18 93/07/30 16:39:53, Srini, AMD. */
-/******************************************************************************
- * Copyright 1992 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Systems Engineering
- * Mail Stop 573
- * 5204 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- * 29k-support@AMD.COM
- *****************************************************************************
- * Engineer: Srini Subramanian.
- ****************************************************************************
- ** This file defines values used in accessing the LCB29K (Low
- ** Cost Board 29K) or "squirt" board from YARC.
- ****************************************************************************
- */
-
-/* Control Port Register (PC_port_base+0) */
-#define LCB29K_RST 0x80 /* 0=Reset, 1=Run */
-#define LCB29K_CLRINPC 0x40 /* Clear PC Interrupt (write only) */
-#define LCB29K_INTEN 0x20 /* Enable interrupts */
-#define LCB29K_WEN 0x10 /* Window Enable */
-#define LCB29K_INT29 0x08 /* Interrupt 29000 (write only) */
-#define LCB29K_INTPC 0x08 /* Interrupt PC (write only) */
-#define LCB29K_FLAG 0x04 /* Flag */
-#define LCB29K_COPDIN 0x02 /* EEPROM Data in */
-#define LCB29K_COPSK 0x01 /* EEPROM Clock in */
-
-
-/* Address Register (PC_port_base+2) */
-#define LCB29K_I_MEM 0x00 /* Set window to Instruction Memory */
-#define LCB29K_D_MEM 0x80 /* Set window to Data Memory */
-
-/*
-** Shared memory definitions
-*/
-
-/*
-** The "anchors" defined below represent addresses in the Am29000
-** data memory space. At these addresses are pointers to shared
-** memory buffers.
-*/
-
-#define LCB29K_RECV_BUF_PTR 0x80000400 /* Host receive buffer pointer */
-
-#define LCB29K_SEND_BUF 0x80000404 /* Host send buffer */
-
+++ /dev/null
-/* @(#)macros.h 5.19 93/07/30 16:39:54, Srini, AMD */
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- * This header file defines various macros used by the host module of
- * MiniMON29K.
- *****************************************************************************
- */
-
-#ifndef _MACROS_H_INCLUDED_
-#define _MACROS_H_INCLUDED_
-
-/*
-** Macros
-*/
-
-#define MIN(x,y) ((x)<(y) ? (x) : (y))
-#define MAX(x,y) ((x)<(y) ? (y) : (x))
-
-/* Does the memory space contain registers? */
-#define ISREG(x) (((x) == LOCAL_REG) ||\
- ((x) == ABSOLUTE_REG) ||\
- ((x) == GLOBAL_REG) ||\
- ((x) == SPECIAL_REG) ||\
- ((x) == A_SPCL_REG) ||\
- ((x) == TLB_REG) ||\
- ((x) == PC_SPACE) ||\
- ((x) == COPROC_REG))
-
-#define ISMEM(x) (((x) == I_MEM) ||\
- ((x) == D_MEM) ||\
- ((x) == I_ROM) ||\
- ((x) == D_ROM) ||\
- ((x) == PC_RELATIVE) ||\
- ((x) == GENERIC_SPACE) ||\
- ((x) == I_O))
-
-#define ISGENERAL(x) (((x) == LOCAL_REG) ||\
- ((x) == ABSOLUTE_REG) ||\
- ((x) == GLOBAL_REG))
-
-#define ISSPECIAL(x) (((x) == SPECIAL_REG) ||\
- ((x) == A_SPCL_REG))
-
-#define ISTLB(x) (((x) == TLB_REG))
-
-/*
-** These macros are used to align addresses to 64, 32
-** 16 and 8 bit boundaries (rounding upward). The
-** ALIGN8() macro is usually not necessary, but included
-** for completeness.
-*/
-
-#define ALIGN64(x) (((x) + 0x07) & 0xfffffff8);
-#define ALIGN32(x) (((x) + 0x03) & 0xfffffffc);
-#define ALIGN16(x) (((x) + 0x01) & 0xfffffffe);
-#define ALIGN8(x) (((x) + 0x00) & 0xffffffff);
-
-/*
-** This macro is used to get the processor from the PRL.
-** It is assumed that the PRL is an eight bit quantity.
-*/
-
-#define PROCESSOR(prl) (prl & 0xf1)
-
-#endif /* _MACROS_H_INCLUDED_ */
+++ /dev/null
-/* @(#)main.h 5.19 93/07/30 16:39:56, Srini, AMD */
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- * This header file declares the structures defined in main.c
- *****************************************************************************
- */
-
-#ifndef _MAIN_H_INCLUDED_
-#define _MAIN_H_INCLUDED_
-
-#include "types.h"
-
-#define TRUE 1
-#define FALSE 0
-
-#define MEM_STACK_SIZE 0x6000
-#define REG_STACK_SIZE 0x2000
-
-#define MAXFILENAMELEN 256
-
-/* Define BIG and LITTLE endian */
-#define BIG 0
-#define LITTLE 1
-
-#define MAX_SESSIONS 10
-
-
-/*
-** Structure for host configuration
-*/
-
-
-struct host_config_t {
- INT32 comm_interface;
- INT32 host_endian;
- INT32 target_endian;
- INT32 PC_port_base;
- INT32 PC_mem_seg;
- char *comm_port;
- char *baud_rate;
- char *version;
- char *date;
- };
-typedef struct host_config_t HOST_CONFIG;
-extern HOST_CONFIG host_config;
-
-struct io_config_t {
- INT32 hif;
- INT32 io_control;
- INT32 cmd_ready;
- INT32 clear_to_send;
- INT32 target_running;
- INT32 cmd_file_io;
- INT32 log_mode;
- INT32 echo_mode;
- FILE *cmd_file;
- char cmd_filename[MAXFILENAMELEN];
- FILE *log_file;
- char log_filename[MAXFILENAMELEN];
- FILE *echo_file;
- char echo_filename[MAXFILENAMELEN];
- BYTE io_toggle_char;
- };
-typedef struct io_config_t IO_CONFIG;
-extern IO_CONFIG io_config;
-
-struct init_info_t {
- ADDR32 text_start;
- ADDR32 text_end;
- ADDR32 data_start;
- ADDR32 data_end;
- ADDR32 entry_point;
- UINT32 mem_stack_size;
- UINT32 reg_stack_size;
- char *argstring;
-};
-typedef struct init_info_t INIT_INFO;
-extern INIT_INFO init_info;
-
-
-struct versions_etc_t {
- INT32 version;
- INT32 os_version; /* os version is returned here */
- char tip_version[12];/*tip_version must not exceed 12 chars*/
- char tip_date[12]; /*tip_date must not exceed 12 chars*/
- INT32 max_msg_size;
- INT32 max_bkpts;
-};
-typedef struct versions_etc_t VERSIONS_ETC;
-extern VERSIONS_ETC versions_etc;
-
-struct target_config_t {
- ADDR32 I_mem_start;
- INT32 I_mem_size;
- ADDR32 D_mem_start;
- INT32 D_mem_size;
- ADDR32 ROM_start;
- INT32 ROM_size;
- UINT32 processor_id;
- UINT32 coprocessor;
- INT32 reserved;
-};
-typedef struct target_config_t TARGET_CONFIG;
-extern TARGET_CONFIG target_config;
-
-struct target_status_t {
- INT32 status;
- INT32 msgs_sent;
- INT32 msgs_received;
- INT32 errors;
- INT32 bkpts_hit;
- INT32 bkpts_free;
- INT32 traps;
- INT32 fills;
- INT32 spills;
- INT32 cycles;
- INT32 reserved;
-};
-typedef struct target_status_t TARGET_STATUS;
-extern TARGET_STATUS target_status;
-
-/*
-** Structure a 29K instruction and memory address
-*/
-
-struct instr_t {
- BYTE op;
- BYTE c;
- BYTE a;
- BYTE b;
- };
-
-struct addr_29k_t {
- INT32 memory_space;
- ADDR32 address;
- };
-
-/* The Monitor's stdin, stdout, stderr, at all times */
-extern int MON_STDIN;
-extern int MON_STDOUT;
-extern int MON_STDERR;
-
-/* Variables declared in main.c */
-extern int QuietMode;
-extern char *ProgramName;
-extern int Session_ids[];
-extern int NumberOfConnections;
-
-/*
-** Who controls the keyboard?
-*/
-
-#define TERM_29K (INT32) 0
-#define TERM_USER (INT32) 1
-
-/*
-** Processor PRLs
-*/
-
-#define PROC_AM29000 0x00
-#define PROC_AM29005 0x10
-#define PROC_AM29050 0x20
-#define PROC_AM29035 0x30
-#define PROC_AM29030 0x40
-#define PROC_AM29200 0x50
-#define PROC_AM29205 0x58
-#define PROC_AM29240 0x60
-
-#define MESSAGES_ON 0
-#define MESSAGES_OFF 1
-
-/* Extern decalarations for global functions defined in main.c */
-
-GLOBAL void fatal_error PARAMS((INT32));
-GLOBAL void warning PARAMS((INT32));
-
-#endif /* _MAIN_H_INCLUDED _ */
+++ /dev/null
-/* @(#)memspcs.h 5.18 93/07/30 16:39:58, Srini, AMD */
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- ** This header file describes the memory spaces in the
- ** AM29000 family of processors.
- *****************************************************************************
- */
-
-#ifndef _MEMSPCS_H_INCLUDED_
-#define _MEMSPCS_H_INCLUDED_
-
-#define LOCAL_REG 0 /* Local processor register */
-#define GLOBAL_REG 1 /* Global processor register */
-#define SPECIAL_REG 2 /* Special processor register */
-#define TLB_REG 3 /* Translation Lookaside Buffer */
-#define COPROC_REG 4 /* Coprocessor register */
-#define I_MEM 5 /* Instruction Memory */
-#define D_MEM 6 /* Data Memory */
-#define I_ROM 7 /* Instruction ROM */
-#define D_ROM 8 /* Data ROM */
-#define I_O 9 /* Input/Output */
-#define I_CACHE 10 /* Instruction Cache */
-#define D_CACHE 11 /* Data Cache */
-#define PC_SPACE 12 /* 29K PC0, PC1 space */
-#define A_SPCL_REG 13 /* Applications view of cps/ops */
-#define ABSOLUTE_REG 14 /* Absolute register number */
-#define PC_RELATIVE 15 /* PC relative offsets */
-
-#define VERSION_SPACE -1 /* to get target version numbers */
-#define GENERIC_SPACE 0xfe
-#endif /* _MEMSPCS_H_INCLUDED_ */
+++ /dev/null
-/* @(#)messages.h 5.19 93/08/10 17:49:09, Srini, AMD */
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- ** This header file describes the messages which are passed
- ** between the target and the host. This file basically defines
- ** a variant record of type msg_t.
- **
- ** Note that the messages use the types defined in the "types.h"
- ** header file.
- *****************************************************************************
- */
-
-#ifndef _MESSAGES_H_INCLUDED_
-#define _MESSAGES_H_INCLUDED_
-
-#include "types.h"
-#include "mtip.h"
-
-/*
-** Host to target definitions
-*/
-
-#define RESET 0
-#define CONFIG_REQ 1
-#define STATUS_REQ 2
-#define READ_REQ 3
-#define WRITE_REQ 4
-#define BKPT_SET 5
-#define BKPT_RM 6
-#define BKPT_STAT 7
-#define COPY 8
-#define FILL 9
-#define INIT 10
-#define GO 11
-#define STEP 12
-#define BREAK 13
-
-#define HIF_CALL_RTN 64
-#define CHANNEL0 65
-#define CHANNEL1_ACK 66
-#define CHANNEL2_ACK 67
-#define STDIN_NEEDED_ACK 68
-#define STDIN_MODE_ACK 69
-
-
-/*
-** Target to host definitions
-*/
-
-#define RESET_ACK 32
-#define CONFIG 33
-#define STATUS 34
-#define READ_ACK 35
-#define WRITE_ACK 36
-#define BKPT_SET_ACK 37
-#define BKPT_RM_ACK 38
-#define BKPT_STAT_ACK 39
-#define COPY_ACK 40
-#define FILL_ACK 41
-#define INIT_ACK 42
-#define HALT 43
-
-#define ERROR 63
-
-#define HIF_CALL 96
-#define CHANNEL0_ACK 97
-#define CHANNEL1 98
-#define CHANNEL2 99
-#define STDIN_NEEDED_REQ 100
-#define STDIN_MODE_REQ 101
-
-/*
-** Endian conversion definitions
-*/
-
-#define INCOMING_MSG 0
-#define OUTGOING_MSG 1
-
-
-#ifdef MSDOS
-#define PARAMS(x) x
-#else
-#define PARAMS(x) ()
-#endif
-
-/* A "generic" message */
-struct generic_msg_t {
- INT32 code; /* generic */
- INT32 length;
- BYTE byte;
- };
-
-
-/* A "generic" message (with an INT32 array) */
-struct generic_int32_msg_t {
- INT32 code; /* generic */
- INT32 length;
- INT32 int32;
- };
-
-
-/*
-** Host to target messages and routines that build them
-*/
-
-struct reset_msg_t {
- INT32 code; /* 0 */
- INT32 length;
- };
-
-struct config_req_msg_t {
- INT32 code; /* 1 */
- INT32 length;
- };
-
-struct status_req_msg_t {
- INT32 code; /* 2 */
- INT32 length;
- };
-
-struct read_req_msg_t {
- INT32 code; /* 3 */
- INT32 length;
- INT32 memory_space;
- ADDR32 address;
- INT32 count;
- INT32 size;
- };
-
-struct write_req_msg_t {
- INT32 code; /* 4 */
- INT32 length;
- INT32 memory_space;
- ADDR32 address;
- INT32 count;
- INT32 size;
- BYTE data;
- };
-
-struct write_r_msg_t {
- INT32 code; /* 4 */
- INT32 length;
- INT32 memory_space;
- ADDR32 address;
- INT32 byte_count;
- INT32 data;
- };
-
-
-struct bkpt_set_msg_t {
- INT32 code; /* 5 */
- INT32 length;
- INT32 memory_space;
- ADDR32 bkpt_addr;
- INT32 pass_count;
- INT32 bkpt_type;
- };
-
-struct bkpt_rm_msg_t {
- INT32 code; /* 6 */
- INT32 length;
- INT32 memory_space;
- ADDR32 bkpt_addr;
- };
-
-struct bkpt_stat_msg_t {
- INT32 code; /* 7 */
- INT32 length;
- INT32 memory_space;
- ADDR32 bkpt_addr;
- };
-
-struct copy_msg_t {
- INT32 code; /* 8 */
- INT32 length;
- INT32 source_space;
- ADDR32 source_addr;
- INT32 dest_space;
- ADDR32 dest_addr;
- INT32 count;
- INT32 size;
- };
-
-struct fill_msg_t {
- INT32 code; /* 9 */
- INT32 length;
- INT32 memory_space;
- ADDR32 start_addr;
- INT32 fill_count;
- INT32 byte_count;
- BYTE fill_data;
- };
-
-struct init_msg_t {
- INT32 code; /* 10 */
- INT32 length;
- ADDR32 text_start;
- ADDR32 text_end;
- ADDR32 data_start;
- ADDR32 data_end;
- ADDR32 entry_point;
- INT32 mem_stack_size;
- INT32 reg_stack_size;
- ADDR32 arg_start;
- INT32 os_control;
- ADDR32 highmem;
- };
-
-struct go_msg_t {
- INT32 code; /* 11 */
- INT32 length;
- };
-
-struct step_msg_t {
- INT32 code; /* 12 */
- INT32 length;
- INT32 count;
- };
-
-struct break_msg_t {
- INT32 code; /* 13 */
- INT32 length;
- };
-
-struct hif_call_rtn_msg_t {
- INT32 code; /* 64 */
- INT32 length;
- INT32 service_number;
- INT32 gr121;
- INT32 gr96;
- INT32 gr97;
- };
-
-struct channel0_msg_t {
- INT32 code; /* 65 */
- INT32 length;
- BYTE data;
- };
-
-struct channel1_ack_msg_t {
- INT32 code; /* 66 */
- INT32 length;
- INT32 gr96;
- };
-
-struct channel2_ack_msg_t {
- INT32 code; /* 67 */
- INT32 length;
- INT32 gr96;
- };
-
-struct stdin_needed_ack_msg_t {
- INT32 code; /* 68 */
- INT32 length;
- BYTE data;
- };
-
-struct stdin_mode_ack_msg_t {
- INT32 code; /* 69 */
- INT32 length;
- INT32 mode;
- };
-
-/*
-** Target to host messages
-*/
-
-
-struct reset_ack_msg_t {
- INT32 code; /* 32 */
- INT32 length;
- };
-
-
-struct config_msg_t {
- INT32 code; /* 33 */
- INT32 length;
- INT32 processor_id;
- INT32 version;
- ADDR32 I_mem_start;
- INT32 I_mem_size;
- ADDR32 D_mem_start;
- INT32 D_mem_size;
- ADDR32 ROM_start;
- INT32 ROM_size;
- INT32 max_msg_size;
- INT32 max_bkpts;
- INT32 coprocessor;
- INT32 os_version;
- };
-
-
-struct status_msg_t {
- INT32 code; /* 34 */
- INT32 length;
- INT32 msgs_sent;
- INT32 msgs_received;
- INT32 errors;
- INT32 bkpts_hit;
- INT32 bkpts_free;
- INT32 traps;
- INT32 fills;
- INT32 spills;
- INT32 cycles;
- INT32 reserved;
- };
-
-
-struct read_ack_msg_t {
- INT32 code; /* 35 */
- INT32 length;
- INT32 memory_space;
- ADDR32 address;
- INT32 byte_count;
- BYTE data;
- };
-
-struct read_r_ack_msg_t {
- INT32 code; /* 35 */
- INT32 length;
- INT32 memory_space;
- ADDR32 address;
- INT32 byte_count;
- INT32 data;
- };
-
-
-struct write_ack_msg_t {
- INT32 code; /* 36 */
- INT32 length;
- INT32 memory_space;
- ADDR32 address;
- INT32 byte_count;
- };
-
-
-struct bkpt_set_ack_msg_t {
- INT32 code; /* 37 */
- INT32 length;
- INT32 memory_space;
- ADDR32 address;
- INT32 pass_count;
- INT32 bkpt_type;
- };
-
-
-struct bkpt_rm_ack_msg_t {
- INT32 code; /* 38 */
- INT32 length;
- INT32 memory_space;
- ADDR32 address;
- };
-
-
-struct bkpt_stat_ack_msg_t {
- INT32 code; /* 39 */
- INT32 length;
- INT32 memory_space;
- ADDR32 address;
- INT32 pass_count;
- INT32 bkpt_type;
- };
-
-
-struct copy_ack_msg_t {
- INT32 code; /* 40 */
- INT32 length;
- INT32 source_space;
- ADDR32 source_addr;
- INT32 dest_space;
- ADDR32 dest_addr;
- INT32 byte_count;
- };
-
-
-struct fill_ack_msg_t {
- INT32 code; /* 41 */
- INT32 length;
- INT32 memory_space;
- ADDR32 start_addr;
- INT32 fill_count;
- INT32 byte_count;
- };
-
-
-struct init_ack_msg_t {
- INT32 code; /* 42 */
- INT32 length;
- };
-
-
-struct halt_msg_t {
- INT32 code; /* 43 */
- INT32 length;
- INT32 memory_space;
- ADDR32 pc0;
- ADDR32 pc1;
- INT32 trap_number;
- };
-
-
-struct error_msg_t {
- INT32 code; /* 63 */
- INT32 length;
- INT32 error_code;
- INT32 memory_space;
- ADDR32 address;
- };
-
-
-struct hif_call_msg_t {
- INT32 code; /* 96 */
- INT32 length;
- INT32 service_number;
- INT32 lr2;
- INT32 lr3;
- INT32 lr4;
- };
-
-
-struct channel0_ack_msg_t {
- INT32 code; /* 97 */
- INT32 length;
- };
-
-
-struct channel1_msg_t {
- INT32 code; /* 98 */
- INT32 length;
- BYTE data;
- };
-
-struct channel2_msg_t {
- INT32 code; /* 99 */
- INT32 length;
- BYTE data;
- };
-
-struct stdin_needed_msg_t {
- INT32 code; /* 100 */
- INT32 length;
- INT32 nbytes;
- };
-
-
-struct stdin_mode_msg_t {
- INT32 code; /* 101 */
- INT32 length;
- INT32 mode;
- };
-
-
-/*
-** Union all of the message types together
-*/
-
-union msg_t {
- struct generic_msg_t generic_msg;
- struct generic_int32_msg_t generic_int32_msg;
-
- struct reset_msg_t reset_msg;
- struct config_req_msg_t config_req_msg;
- struct status_req_msg_t status_req_msg;
- struct read_req_msg_t read_req_msg;
- struct write_req_msg_t write_req_msg;
- struct write_r_msg_t write_r_msg;
- struct bkpt_set_msg_t bkpt_set_msg;
- struct bkpt_rm_msg_t bkpt_rm_msg;
- struct bkpt_stat_msg_t bkpt_stat_msg;
- struct copy_msg_t copy_msg;
- struct fill_msg_t fill_msg;
- struct init_msg_t init_msg;
- struct go_msg_t go_msg;
- struct step_msg_t step_msg;
- struct break_msg_t break_msg;
-
- struct hif_call_rtn_msg_t hif_call_rtn_msg;
- struct channel0_msg_t channel0_msg;
- struct channel1_ack_msg_t channel1_ack_msg;
- struct channel2_ack_msg_t channel2_ack_msg;
- struct stdin_needed_ack_msg_t stdin_needed_ack_msg;
- struct stdin_mode_ack_msg_t stdin_mode_ack_msg;
-
- struct reset_ack_msg_t reset_ack_msg;
- struct config_msg_t config_msg;
- struct status_msg_t status_msg;
- struct read_ack_msg_t read_ack_msg;
- struct read_r_ack_msg_t read_r_ack_msg;
- struct write_ack_msg_t write_ack_msg;
- struct bkpt_set_ack_msg_t bkpt_set_ack_msg;
- struct bkpt_rm_ack_msg_t bkpt_rm_ack_msg;
- struct bkpt_stat_ack_msg_t bkpt_stat_ack_msg;
- struct copy_ack_msg_t copy_ack_msg;
- struct fill_ack_msg_t fill_ack_msg;
- struct init_ack_msg_t init_ack_msg;
- struct halt_msg_t halt_msg;
-
- struct error_msg_t error_msg;
-
- struct hif_call_msg_t hif_call_msg;
- struct channel0_ack_msg_t channel0_ack_msg;
- struct channel1_msg_t channel1_msg;
- struct channel2_msg_t channel2_msg;
- struct stdin_needed_msg_t stdin_needed_msg;
- struct stdin_mode_msg_t stdin_mode_msg;
- };
-
-/*
-** This macro is used to get the size of a message data
-** structure. The divide then multiply by the sizeof(INT32)
-** gets rid of alignment problems which would cause sizeof()
-** to return an incorect result.
-*/
-
-#define MSG_LENGTH(x) (((sizeof(x) / sizeof(INT32)) *\
- sizeof(INT32)) - (2 * sizeof(INT32)))
-
-/* Functions to initialize, send, and receive messages */
-
-INT32 msg_length PARAMS((INT32 code));
-
-INT32 Mini_msg_init PARAMS((char *targname));
-
-int Mini_alloc_msgbuf PARAMS((int size));
-
-void Mini_msg_exit PARAMS((void));
-
-INT32 Mini_msg_send PARAMS((void));
-
-INT32 Mini_msg_recv PARAMS((INT32 RecvMode));
-
-INT32 Mini_init_comm PARAMS((void));
-
-INT32 Mini_reset_comm PARAMS((void));
-
-INT32 Mini_exit_comm PARAMS((void));
-
-void Mini_go_target PARAMS((void));
-
-INT32 Mini_write_memory PARAMS((INT32 m_space,
- ADDR32 address,
- INT32 byte_count,
- BYTE *buffer));
-
-INT32 Mini_read_memory PARAMS((INT32 m_space,
- ADDR32 address,
- INT32 byte_count,
- BYTE *buffer));
-
-/* Function to build specific Minimon messages in "buffer" */
-
-void Mini_build_reset_msg PARAMS((void));
-
-void Mini_build_config_req_msg PARAMS((void));
-
-void Mini_build_status_req_msg PARAMS((void));
-
-void Mini_build_read_req_msg PARAMS((INT32 memory_space,
- ADDR32 address,
- INT32 count,
- INT32 size));
-
-void Mini_build_write_req_msg PARAMS((INT32 memory_space,
- ADDR32 address,
- INT32 count,
- INT32 size,
- BYTE *data));
-
-void Mini_build_bkpt_set_msg PARAMS((INT32 memory_space,
- ADDR32 bkpt_addr,
- INT32 pass_count,
- INT32 bkpt_type));
-
-void Mini_build_bkpt_rm_msg PARAMS((INT32 memory_space,
- ADDR32 bkpt_addr));
-
-void Mini_build_bkpt_stat_msg PARAMS((INT32 memory_space,
- ADDR32 bkpt_addr));
-
-void Mini_build_copy_msg PARAMS((INT32 source_space,
- ADDR32 source_addr,
- INT32 dest_space,
- ADDR32 dest_addr,
- INT32 count,
- INT32 size));
-
-void Mini_build_fill_msg PARAMS((INT32 memory_space,
- ADDR32 start_addr,
- INT32 fill_count,
- INT32 byte_count,
- BYTE *fill_data));
-
-void Mini_build_init_msg PARAMS((ADDR32 text_start,
- ADDR32 text_end,
- ADDR32 data_start,
- ADDR32 data_end,
- ADDR32 entry_point,
- INT32 m_stack,
- INT32 r_stack,
- ADDR32 highmem,
- ADDR32 arg_start,
- INT32 os_control));
-
-void Mini_build_go_msg PARAMS((void));
-
-void Mini_build_step_msg PARAMS((INT32 count));
-
-void Mini_build_break_msg PARAMS((void));
-
-void Mini_build_hif_rtn_msg PARAMS((INT32 serv_num,
- INT32 gr121,
- INT32 gr96,
- INT32 gr97));
-
-void Mini_build_channel0_msg PARAMS((BYTE *data, INT32 count));
-
-void Mini_build_channel1_ack_msg PARAMS((INT32 gr96));
-
-void Mini_build_channel2_ack_msg PARAMS((INT32 gr96));
-
-void Mini_build_stdin_needed_ack_msg PARAMS((UINT32 count,BYTE *data));
-
-void Mini_build_stdin_mode_ack_msg PARAMS((INT32 mode));
-
-/* Functions to unpack/decipher the target to host messages */
-
-void Mini_unpack_reset_ack_msg PARAMS((void));
-
-void Mini_unpack_config_msg PARAMS((TIP_TARGET_CONFIG *target_config));
-
-void Mini_unpack_status_msg PARAMS((TIP_TARGET_STATUS *target_status));
-
-void Mini_unpack_read_ack_msg PARAMS((INT32 *mspace,
- ADDR32 *address,
- INT32 *byte_count,
- BYTE *buffer));
-
-void Mini_unpack_write_ack_msg PARAMS((INT32 *mspace,
- ADDR32 *address,
- INT32 *byte_count));
-
-void Mini_unpack_bkpt_set_ack_msg PARAMS((INT32 *mspace,
- ADDR32 *address,
- INT32 *pass_count,
- INT32 *bkpt_type));
-
-void Mini_unpack_bkpt_rm_ack_msg PARAMS((INT32 *memory_space,
- ADDR32 *address));
-
-void Mini_unpack_bkpt_stat_ack_msg PARAMS((INT32 *mspace,
- ADDR32 *address,
- INT32 *pass_count,
- INT32 *bkpt_type));
-
-void Mini_unpack_copy_ack_msg PARAMS((INT32 *srcspace,
- ADDR32 *srcaddr,
- INT32 *dstspace,
- ADDR32 *dstaddr,
- INT32 *byte_count));
-
-void Mini_unpack_fill_ack_msg PARAMS((INT32 *mspace,
- ADDR32 *startaddr,
- INT32 *fillcount,
- INT32 *bytecount));
-
-void Mini_unpack_init_ack_msg PARAMS((void));
-
-void Mini_unpack_halt_msg PARAMS((INT32 *mspace,
- ADDR32 *pc0,
- ADDR32 *pc1,
- INT32 *trap_number));
-
-void Mini_unpack_error_msg PARAMS((INT32 *errcode,
- INT32 *mspace,
- ADDR32 *address));
-
-void Mini_unpack_ch0_ack_msg PARAMS((void));
-
-void Mini_unpack_channel1_msg PARAMS((BYTE *data,
- INT32 *len));
-
-void Mini_unpack_channel2_msg PARAMS((BYTE *data,
- INT32 *len));
-
-void Mini_unpack_hif_msg PARAMS((INT32 *gr121,
- INT32 *lr2,
- INT32 *lr3,
- INT32 *lr4));
-
-void Mini_unpack_stdin_needed_msg PARAMS((INT32 *nbytes));
-
-void Mini_unpack_stdin_mode_msg PARAMS((INT32 *mode));
-
-void CopyMsgFromTarg PARAMS(( union msg_t *dest));
-void CopyMsgToTarg PARAMS(( union msg_t *source));
-
-#define BUFFER_SIZE 2048
-
-#define BLOCK 1
-#define NONBLOCK 0
-
-#define MSGRETRY (INT32) -8
-
-#endif /* _MESSAGES_H_INCLUDED_ */
+++ /dev/null
-/* @(#)miniint.h 5.18 93/07/30 16:40:02, Srini, AMD */
-/******************************************************************************
- * Copyright 1992 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Systems Engineering
- * Mail Stop 573
- * 5204 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- * 29k-support@AMD.COM
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- * This header file defines the interface routines between the DFE and UDI.
- *****************************************************************************
- */
-#ifndef _MINIINT_H_INCLUDED_
-#define _MINIINT_H_INCLUDED_
-
-/* This file contains the declarations of functions that form
- * Minimon frontend's interface to its back-end.
- * Back-end could be a message system or a procedural interface
- */
-
-/* There is one function for each of the message sent from the
-* host to the target.
-*/
-
-#include "types.h"
-
-#define MONErrorMsgSize 80
-
-#define BKPT_29050 0
-#define BKPT_29050_BTE_0 0
-#define BKPT_29050_BTE_1 1
-#define BKPT_29000 -1
-
-#define MONMaxMemRanges 3 /* Inst, data, Rom */
-#define MONMaxChips 2 /* main cpu & coprocessor */
-#define MONMaxProcessMemRanges 2
-#define MONMaxStacks 2
-
-/* For breakpoint status */
-#define MONBreakNoMore 0x1
-#define MONBreakInvalid 0x2
-
-/* These are defined in main.h */
-/* typedef struct target_config_t TARGET_CONFIG; */
-/* typedef struct target_status_t TARGET_STATUS; */
-
-/* This is the function to initialize the Target Interphase Process/
- * System.
- * Input: Pointer to the target's name (as given at the "-t" command
- * line flag of Minimon).
- * Output: It returns:
- * SUCCESS: if everything went okay.
- * FAILURE: not okay.
- */
-
-INT32 Mini_TIP_init PARAMS((char *conn_str, int *sid));
-
-INT32 Mini_TIP_SetCurrSession PARAMS((int sid));
-
-INT32 Mini_TIP_SetPID PARAMS((int pid));
-
-INT32 Mini_TIP_DestroyProc PARAMS((void));
-
-INT32 Mini_TIP_Capabilities PARAMS((void));
-
-INT32 Mini_TIP_CreateProc PARAMS((void));
-
-INT32 Mini_TIP_disc PARAMS((void));
-
-INT32 Mini_TIP_exit PARAMS((void));
-
-INT32 Mini_reset_processor PARAMS((void));
-
-INT32 Mini_config_req PARAMS((TARGET_CONFIG *target_conf, VERSIONS_ETC *vers));
-
-INT32 Mini_status_req PARAMS((TARGET_STATUS *target_stat));
-
-INT32 Mini_read_req PARAMS((INT32 memory_space,
- ADDR32 address,
- INT32 byte_count,
- INT16 size,
- INT32 *count_done,
- BYTE *buffer,
- BOOLEAN host_endian));
-
-INT32 Mini_write_req PARAMS((INT32 memory_space,
- ADDR32 address,
- INT32 byte_count,
- INT16 size,
- INT32 *count_done,
- BYTE *buffer,
- BOOLEAN host_endian));
-
-INT32 Mini_bkpt_set PARAMS((INT32 memory_space,
- ADDR32 bkpt_addr,
- INT32 pass_count,
- INT32 bkpt_type,
- int *break_id));
-
-INT32 Mini_bkpt_rm PARAMS((int break_id));
-
-INT32 Mini_bkpt_stat PARAMS((int break_id,
- ADDR32 *bkpt_addr,
- INT32 *memory_space,
- INT32 *pass_count,
- INT32 *bkpt_type ,
- INT32 *current_cnt));
-
-INT32 Mini_copy PARAMS((INT32 source_space,
- ADDR32 source_addr,
- INT32 dest_space,
- ADDR32 dest_addr,
- INT32 byte_count,
- INT16 size,
- INT32 count_done));
-
-INT32 Mini_fill PARAMS((INT32 memory_space,
- ADDR32 start_addr,
- INT32 fill_count,
- INT32 byte_count,
- BYTE *pattern));
-
-INT32 Mini_init PARAMS((ADDR32 text_start,
- ADDR32 text_end,
- ADDR32 data_start,
- ADDR32 data_end,
- ADDR32 entry_point,
- INT32 m_stack,
- INT32 r_stack,
- char *arg_string));
-
-INT32 Mini_go PARAMS((void));
-
-INT32 Mini_step PARAMS((INT32 count));
-
-INT32 Mini_break PARAMS((void));
-
-INT32 Mini_get_target_stats PARAMS((INT32 maxtime, INT32 *target_status));
-
-INT32 Mini_get_stdout PARAMS((char *buffer,
- INT32 bufsize,
- INT32 *count_done));
-
-INT32 Mini_get_stderr PARAMS((char *buffer,
- INT32 bufsize,
- INT32 *count_done));
-
-INT32 Mini_stdin_mode_x PARAMS((INT32 *mode));
-
-INT32 Mini_put_stdin PARAMS((char *buffer,
- INT32 bufsize,
- INT32 *count_done));
-
-INT32 Mini_put_trans PARAMS((char *buffer));
-
-#endif /* _MINIINT_H_INCLUDED_ */
+++ /dev/null
-/* @(#)monio.h 5.18 93/07/30 16:40:04, Srini, AMD */
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- * This header file declares the I/O functions of the monitor.
- *****************************************************************************
- */
-#ifndef _IO_H_INCLUDED_
-#define _IO_H_INCLUDED_
-
-
-#define BUFFER_SIZE 256
-
-/*
-** Definitions for unprintable ASCII
-*/
-
-#define BELL '\007' /* 0x07 */
-#define RET '\015' /* 0x0d */
-#define LF '\012' /* 0x0a */
-#define CTRL_C '\003' /* 0x03 */
-#define BS '\010' /* 0x08 */
-#define ESC '\033' /* 0x1b */
-#define DEL '\177' /* 0x7f */
-
-#endif /* _IO_H_INCLUDED_ */
+++ /dev/null
-/* @(#)monitor.h 5.19 93/08/23 15:31:18, Srini, AMD */
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- * This header file declares the data structures and functions used by the
- * monitor.c module of DFE.
- *****************************************************************************
- */
-
-/* Data structures that don't get used unless the monitor is
- * invoked.
- */
-
-#ifndef _MONITOR_H_INCLUDED_
-#define _MONITOR_H_INCLUDED_
-
-#include "types.h"
-
-/* Monitor command limitations */
-
-#define MAX_TOKENS 25
-#define BUFFER_SIZE 256
-#define MAXFILENAMELEN 256
-
-/* Define target status: these correspond to UDI defined defined */
-#define TRAPPED 0
-#define NOTEXECUTING 1
-#define RUNNING 2
-#define STOPPED 3
-#define WARNED 4
-#define STEPPED 5
-#define WAITING 6
-#define HALTED 7
-#define STDOUT_READY 8
-#define STDERR_READY 9
-#define STDIN_NEEDED 10
-#define STDINMODEX 11
-#define BREAK 12
-#define EXITED 13
-
-/*
-** Dump and set routine definitions
-*/
-
-#define WORD_FORMAT 0
-#define HALF_FORMAT 1
-#define BYTE_FORMAT 2
-#define FLOAT_FORMAT 3
-#define DOUBLE_FORMAT 4
-
-/*
- * Keyboard polling modes.
- */
-#define BLOCK 1
-#define NONBLOCK 0
-
-/*
-** Structure for breakpoint array
-*/
-
-struct bkpt_t {
- int break_id;
- INT32 memory_space;
- ADDR32 address;
- INT32 pass_count;
- INT32 curr_count;
- INT32 bkpt_type;
- struct bkpt_t *next;
- };
-
-extern struct bkpt_t *bkpt_table;
-extern INT32 udi_waittime;
-
-/* Monitor command functions */
-
-INT32 asm_cmd PARAMS((char **, int));
-INT32 bkpt_cmd PARAMS((char **, int));
-INT32 config_cmd PARAMS((char **, int));
-INT32 cmdfile_cmd PARAMS((char **, int));
-INT32 dasm_cmd PARAMS((char **, int));
-INT32 dump_cmd PARAMS((char **, int));
-INT32 echomode_on PARAMS((char **, int));
-INT32 echomode_off PARAMS((char **, int));
-INT32 echofile_cmd PARAMS((char **, int));
-INT32 fill_cmd PARAMS((char **, int));
-INT32 go_cmd PARAMS((char **, int));
-INT32 help_cmd PARAMS((char **, int));
-INT32 io_toggle_cmd PARAMS((char **, int));
-INT32 kill_cmd PARAMS((char **, int));
-INT32 move_cmd PARAMS((char **, int));
-INT32 reset_cmd PARAMS((char **, int));
-INT32 set_cmd PARAMS((char **, int));
-INT32 trace_cmd PARAMS((char **, int));
-INT32 channel0_cmd PARAMS((char **, int));
-INT32 Mini_poll_channel0 PARAMS((void));
-INT32 version_cmd PARAMS((char **, int));
-INT32 x_cmd PARAMS((char **, int));
-INT32 xp_cmd PARAMS((char **, int));
-INT32 xc_cmd PARAMS((char **, int));
-INT32 i_cmd PARAMS((char **, int));
-INT32 ix_cmd PARAMS((char **, int));
-INT32 il_cmd PARAMS((char **, int));
-INT32 yank_cmd PARAMS((char **, int));
-INT32 quit_cmd PARAMS((char **, int));
-INT32 quietmode_on PARAMS((char **, int));
-INT32 quietmode_off PARAMS((char **, int));
-INT32 dummy_cmd PARAMS((char **, int));
-INT32 connect_cmd PARAMS((char **, int));
-INT32 disconnect_cmd PARAMS((char **, int));
-INT32 create_proc_cmd PARAMS((char **, int));
-INT32 exit_conn_cmd PARAMS((char **, int));
-INT32 destroy_proc_cmd PARAMS((char **, int));
-INT32 set_pid_cmd PARAMS((char **, int));
-INT32 capab_cmd PARAMS((char **, int));
-INT32 set_sessionid_cmd PARAMS((char **, int));
-INT32 init_proc_cmd PARAMS((char **, int));
-INT32 escape_cmd PARAMS((char **, int));
-INT32 tip_cmd PARAMS((char **, int));
-INT32 logon_cmd PARAMS((char **, int));
-INT32 logoff_cmd PARAMS((char **, int));
-INT32 set_logfile PARAMS((char **, int));
-
-#endif /* _MONITOR_H_INCLUDED_ */
+++ /dev/null
-/* @(#)mtip.h 5.19 93/09/08 14:15:22, Srini, AMD */
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- * This is the header file of mtip.c module.
- *****************************************************************************
- */
-#ifndef _MTIP_H_INCLUDED_
-#define _MTIP_H_INCLUDED_
-
-#include "types.h"
-
-#define ILLOP29K "00000000"
-
-#define DEFAULT_BAUD_RATE "9600"
-
-#define LOAD_BUFFER_SIZE 1024
-#define FROM_BEGINNING 0
-
-#ifdef MSDOS
-#define DEFAULT_COMM_PORT "com1:"
-#define DEFAULT_PAR_PORT "lpt1:"
-#else
-#define DEFAULT_COMM_PORT "/dev/ttya"
-#define DEFAULT_PAR_PORT ""
-#endif
-
-
-#define TRUE 1
-#define FALSE 0
-
-#define MAXFILENAMELEN 256
-
-/* Define BIG and LITTLE endian */
-#define BIG 0
-#define LITTLE 1
-
-#ifdef MSDOS
-#define FILE_OPEN_FLAG "rb"
-#else
-#define FILE_OPEN_FLAG "r"
-#endif
-
-#define BKPT_29050 0
-#define BKPT_29050_BTE_0 0
-#define BKPT_29050_BTE_1 1
-#define BKPT_29000 -1
-
-#define MONMaxMemRanges 3 /* Inst, data, Rom */
-#define MONMaxChips 2 /* main cpu & coprocessor */
-#define MONMaxProcessMemRanges 2
-#define MONMaxStacks 2
-
-#define MONDefaultMemStackSize 0x6000
-#define MONDefaultRegStackSize 0x2000
-
-struct tip_target_config_t {
- INT32 processor_id;
- INT32 version;
- ADDR32 I_mem_start;
- INT32 I_mem_size;
- ADDR32 D_mem_start;
- INT32 D_mem_size;
- ADDR32 ROM_start;
- INT32 ROM_size;
- INT32 max_msg_size;
- INT32 max_bkpts;
- INT32 coprocessor;
- int P29KEndian;
- int TipEndian;
- INT32 os_version;
-};
-typedef struct tip_target_config_t TIP_TARGET_CONFIG;
-extern TIP_TARGET_CONFIG tip_target_config;
-
-struct tip_target_status_t {
- INT32 status;
- INT32 msgs_sent;
- INT32 msgs_received;
- INT32 errors;
- INT32 bkpts_hit;
- INT32 bkpts_free;
- INT32 traps;
- INT32 fills;
- INT32 spills;
- INT32 cycles;
- INT32 reserved;
-};
-typedef struct tip_target_status_t TIP_TARGET_STATUS;
-extern TIP_TARGET_STATUS tip_target_status;
-
-struct tip_config_t {
- INT32 PC_port_base;
- INT32 PC_mem_seg;
- char baud_rate[10];
- char comm_port[15];
- char par_port[15];
-};
-typedef struct tip_config_t TIP_CONFIG;
-extern TIP_CONFIG tip_config;
-
-typedef unsigned int BreakIdType;
-struct tip_break_table {
- BreakIdType id;
- INT32 space;
- ADDR32 offset;
- INT32 count;
- INT32 type;
- ADDR32 BreakInst; /* actual instruction */
- struct tip_break_table *next;
-};
-
-extern char *Msg_Logfile;
-
-void tip_convert32 PARAMS((BYTE *));
-void tip_convert16 PARAMS((BYTE *));
-
-#ifdef MSDOS
-#define SIGINT_POLL kbhit();
-#else
-#define SIGINT_POLL
-#endif
-#endif /* _MTIP_H_INCLUDED_ */
+++ /dev/null
-/* @(#)opcodes.h 5.19 93/08/10 17:49:11, Srini,AMD */
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- **
- ** This file gives the definitions of opcodes in the Am29000
- ** processor.
- **
- ** This file defines the opcodes used in the Am29000 processor.
- ** The opcodes here are defined as the first eight-bit field in
- ** the (32-bit) instruction. Note that many instructions are
- ** defined with a "mode bit" in the least significant bit of the
- ** opcode field. In this definition, instructions with
- ** different mode bits are treated as different instructions.
- ** This allows consistent processing of eight bit opcodes.
- **
- ** For instance, AND with the mode bit set to zero (M=0) defines
- ** the third eight bit field in the instruction word as being
- ** the content of a register. When M=1 the content of the third
- ** field is taken to be an immediate value, zero-extended to 32
- ** bits.
- **
- ** The #define statements below will treat AND as two different
- ** instructions called AND0 and AND1. As you might suspect,
- ** AND0 is describes the opcode AND when M=0 and AND1 describes
- ** the opcode AND where M=1.
- **
- ** Note1: Wherever the name of an opcode as listed in the User's
- ** Manual confilcts with either a reserved keyword, or a
- ** previously defined opcode, "_op" is appended to the
- ** name.
- **
- ** Note2: These opcodes are sorted in numerical order.
- **
- ** Note3: Opcodes are broken up into groups of 16 (16#n0# to
- ** 16#nF#).
- **
- ** Note4: When no opcode is defined, a variable of the name
- ** illegal_nn is declared in that space. The value of
- ** "nn" is the number of the opcode in hexadecimal.
- **
- *****************************************************************************
- */
-
-#ifndef _OPCODES_H_INCLUDED_
-#define _OPCODES_H_INCLUDED_
-
-#define ILLEGAL_00 0x00
-#define CONSTN 0x01
-#define CONSTH 0x02
-#define CONST 0x03
-#define MTSRIM 0x04
-#define CONSTHZ 0x05
-#define LOADL0 0x06
-#define LOADL1 0x07
-#define CLZ0 0x08
-#define CLZ1 0x09
-#define EXBYTE0 0x0A
-#define EXBYTE1 0x0B
-#define INBYTE0 0x0C
-#define INBYTE1 0x0D
-#define STOREL0 0x0E
-#define STOREL1 0x0F
-
-#define ADDS0 0x10
-#define ADDS1 0x11
-#define ADDU0 0x12
-#define ADDU1 0x13
-#define ADD0 0x14
-#define ADD1 0x15
-#define LOAD0 0x16
-#define LOAD1 0x17
-#define ADDCS0 0x18
-#define ADDCS1 0x19
-#define ADDCU0 0x1A
-#define ADDCU1 0x1B
-#define ADDC0 0x1C
-#define ADDC1 0x1D
-#define STORE0 0x1E
-#define STORE1 0x1F
-
-#define SUBS0 0x20
-#define SUBS1 0x21
-#define SUBU0 0x22
-#define SUBU1 0x23
-#define SUB0 0x24
-#define SUB1 0x25
-#define LOADSET0 0x26
-#define LOADSET1 0x27
-#define SUBCS0 0x28
-#define SUBCS1 0x29
-#define SUBCU0 0x2A
-#define SUBCU1 0x2B
-#define SUBC0 0x2C
-#define SUBC1 0x2D
-#define CPBYTE0 0x2E
-#define CPBYTE1 0x2F
-
-#define SUBRS0 0x30
-#define SUBRS1 0x31
-#define SUBRU0 0x32
-#define SUBRU1 0x33
-#define SUBR0 0x34
-#define SUBR1 0x35
-#define LOADM0 0x36
-#define LOADM1 0x37
-#define SUBRCS0 0x38
-#define SUBRCS1 0x39
-#define SUBRCU0 0x3A
-#define SUBRCU1 0x3B
-#define SUBRC0 0x3C
-#define SUBRC1 0x3D
-#define STOREM0 0x3E
-#define STOREM1 0x3F
-
-#define CPLT0 0x40
-#define CPLT1 0x41
-#define CPLTU0 0x42
-#define CPLTU1 0x43
-#define CPLE0 0x44
-#define CPLE1 0x45
-#define CPLEU0 0x46
-#define CPLEU1 0x47
-#define CPGT0 0x48
-#define CPGT1 0x49
-#define CPGTU0 0x4A
-#define CPGTU1 0x4B
-#define CPGE0 0x4C
-#define CPGE1 0x4D
-#define CPGEU0 0x4E
-#define CPGEU1 0x4F
-
-#define ASLT0 0x50
-#define ASLT1 0x51
-#define ASLTU0 0x52
-#define ASLTU1 0x53
-#define ASLE0 0x54
-#define ASLE1 0x55
-#define ASLEU0 0x56
-#define ASLEU1 0x57
-#define ASGT0 0x58
-#define ASGT1 0x59
-#define ASGTU0 0x5A
-#define ASGTU1 0x5B
-#define ASGE0 0x5C
-#define ASGE1 0x5D
-#define ASGEU0 0x5E
-#define ASGEU1 0x5F
-
-#define CPEQ0 0x60
-#define CPEQ1 0x61
-#define CPNEQ0 0x62
-#define CPNEQ1 0x63
-#define MUL0 0x64
-#define MUL1 0x65
-#define MULL0 0x66
-#define MULL1 0x67
-#define DIV0_OP0 0x68
-#define DIV0_OP1 0x69
-#define DIV_OP0 0x6A
-#define DIV_OP1 0x6B
-#define DIVL0 0x6C
-#define DIVL1 0x6D
-#define DIVREM0 0x6E
-#define DIVREM1 0x6F
-
-#define ASEQ0 0x70
-#define ASEQ1 0x71
-#define ASNEQ0 0x72
-#define ASNEQ1 0x73
-#define MULU0 0x74
-#define MULU1 0x75
-#define ILLEGAL_76 0x76
-#define ILLEGAL_77 0x77
-#define INHW0 0x78
-#define INHW1 0x79
-#define EXTRACT0 0x7A
-#define EXTRACT1 0x7B
-#define EXHW0 0x7C
-#define EXHW1 0x7D
-#define EXHWS 0x7E
-#define ILLEGAL_7F 0x7F
-
-#define SLL0 0x80
-#define SLL1 0x81
-#define SRL0 0x82
-#define SRL1 0x83
-#define ILLEGAL_84 0x84
-#define ILLEGAL_85 0x85
-#define SRA0 0x86
-#define SRA1 0x87
-#define IRET 0x88
-#define HALT_OP 0x89
-#define ILLEGAL_8A 0x8A
-#define ILLEGAL_8B 0x8B
-#define IRETINV 0x8C
-#define ILLEGAL_8D 0x8D
-#define ILLEGAL_8E 0x8E
-#define ILLEGAL_8F 0x8F
-
-#define AND_OP0 0x90
-#define AND_OP1 0x91
-#define OR_OP0 0x92
-#define OR_OP1 0x93
-#define XOR_OP0 0x94
-#define XOR_OP1 0x95
-#define XNOR0 0x96
-#define XNOR1 0x97
-#define NOR0 0x98
-#define NOR1 0x99
-#define NAND0 0x9A
-#define NAND1 0x9B
-#define ANDN0 0x9C
-#define ANDN1 0x9D
-#define SETIP 0x9E
-#define INV 0x9F
-
-#define JMP0 0xA0
-#define JMP1 0xA1
-#define ILLEGAL_A2 0xA2
-#define ILLEGAL_A3 0xA3
-#define JMPF0 0xA4
-#define JMPF1 0xA5
-#define ILLEGAL_A6 0xA6
-#define ILLEGAL_A7 0xA7
-#define CALL0 0xA8
-#define CALL1 0xA9
-#define ORN_OP0 0xAA
-#define ORN_OP1 0xAB
-#define JMPT0 0xAC
-#define JMPT1 0xAD
-#define ILLEGAL_AE 0xAE
-#define ILLEGAL_AF 0xAF
-
-#define ILLEGAL_B0 0xB0
-#define ILLEGAL_B1 0xB1
-#define ILLEGAL_B2 0xB2
-#define ILLEGAL_B3 0xB3
-#define JMPFDEC0 0xB4
-#define JMPFDEC1 0xB5
-#define MFTLB 0xB6
-#define ILLEGAL_B7 0xB7
-#define ILLEGAL_B8 0xB8
-#define ILLEGAL_B9 0xB9
-#define ILLEGAL_BA 0xBA
-#define ILLEGAL_BB 0xBB
-#define ILLEGAL_BC 0xBC
-#define ILLEGAL_BD 0xBD
-#define MTTLB 0xBE
-#define ILLEGAL_BF 0xBF
-
-#define JMPI 0xC0
-#define ILLEGAL_C1 0xC1
-#define ILLEGAL_C2 0xC2
-#define ILLEGAL_C3 0xC3
-#define JMPFI 0xC4
-#define ILLEGAL_C5 0xC5
-#define MFSR 0xC6
-#define ILLEGAL_C7 0xC7
-#define CALLI 0xC8
-#define ILLEGAL_C9 0xC9
-#define ILLEGAL_CA 0xCA
-#define ILLEGAL_CB 0xCB
-#define JMPTI 0xCC
-#define ILLEGAL_CD 0xCD
-#define MTSR 0xCE
-#define ILLEGAL_CF 0xCF
-
-#define ILLEGAL_D0 0xD0
-#define ILLEGAL_D1 0xD1
-#define ILLEGAL_D2 0xD2
-#define ILLEGAL_D3 0xD3
-#define ILLEGAL_D4 0xD4
-#define ILLEGAL_D5 0xD5
-#define ILLEGAL_D6 0xD6
-#define EMULATE 0xD7
-#define ILLEGAL_D8 0xD8
-#define ILLEGAL_D9 0xD9
-#define ILLEGAL_DA 0xDA
-#define ILLEGAL_DB 0xDB
-#define ILLEGAL_DC 0xDC
-#define ILLEGAL_DD 0xDD
-#define MULTM 0xDE
-#define MULTMU 0xDF
-
-#define MULTIPLY 0xE0
-#define DIVIDE 0xE1
-#define MULTIPLU 0xE2
-#define DIVIDU 0xE3
-#define CONVERT 0xE4
-#define SQRT 0xE5
-#define CLASS 0xE6
-#define ILLEGAL_E7 0xE7
-#define ILLEGAL_E8 0xE8
-#define ILLEGAL_E9 0xE9
-#define FEQ 0xEA
-#define DEQ 0xEB
-#define FGT 0xEC
-#define DGT 0xED
-#define FGE 0xEE
-#define DGE 0xEF
-
-#define FADD 0xF0
-#define DADD 0xF1
-#define FSUB 0xF2
-#define DSUB 0xF3
-#define FMUL 0xF4
-#define DMUL 0xF5
-#define FDIV 0xF6
-#define DDIV 0xF7
-#define ILLEGAL_F8 0xF8
-#define FDMUL 0xF9
-#define ILLEGAL_FA 0xFA
-#define ILLEGAL_FB 0xFB
-#define ILLEGAL_FC 0xFC
-#define ILLEGAL_FD 0xFD
-#define ILLEGAL_FE 0xFE
-#define ILLEGAL_FF 0xFF
-
-/* External declarations of variable defined in opcodes.c */
-
-extern char *opcode_name[];
-extern char *reg[];
-extern char *spreg[];
-
-#endif /* _OPCODES_H_INCLUDED_ */
+++ /dev/null
-/* @(#)pceb.h 5.18 93/07/30 16:40:12, Srini, AMD */
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
-** This file defines values used in accessing the PCEB board.
- *****************************************************************************
- */
-
-
-/*
-** PCEB register addresses
-*/
-
-#define PCEB_PC229K_OFFSET 32
-#define PCEB_PC29K2PC_OFFSET 34
-#define PCEB_PCCNF_OFFSET 36
-
-
-/*
-** PC229K register bit definitions.
-*/
-
-#define PCEB_P_REQ 0x80 /* Request bit from PC to 29k */
-#define PCEB_S_ENA 0x40 /* Enable interrupts to PC */
-#define PCEB_LB_END 0x20 /* Set for Big Endian access to 29k */
-#define PCEB_S_RESET 0x10 /* Reset the 29k processor */
-#define PCEB_S_WARN 0x08 /* Assert WARN to the 29k */
-#define PCEB_WINENA 0x04 /* Enable PC memory window */
-#define PCEB_S_CTL1 0x02 /* Processor CTRL1 input */
-#define PCEB_S_CTL0 0x01 /* Processor CTRL0 input */
-
-#define PCEB_S_HALT PCEB_S_CTL1
-#define PCEB_S_NORMAL (PCEB_S_CTL1 | PCEB_S_CTL0)
-
-
-/*
-** 29K2PC register bit definitions.
-*/
-
-#define PCEB_S_REQ 0x80 /* Request bit from 29k to PC */
-#define PCEB_P_ENA 0x40 /* Enable interrupts to 29k */
-#define PCEB_S_STAT2 0x04 /* STAT2 signal from 29k processor */
-#define PCEB_S_STAT1 0x02 /* STAT1 signal from 29k processor */
-#define PCEB_S_STAT0 0x01 /* STAT0 signal from 29k processor */
-
-/*
-** Shared memory definitions
-*/
-
-/*
-** The "anchors" defined below represent addresses in the Am29000
-** data memory space. At these addresses are pointers to shared
-** memory buffers.
-*/
-
-
-#define PCEB_RECV_BUF_PTR 0x0400 /* Host receive buffer pointer */
-
-#define PCEB_SEND_BUF 0x0404 /* Host send buffer */
-
-
+++ /dev/null
-/* @(#)serial.h 5.18 93/07/30 16:40:14, Srini, AMD */
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- * This file contains the declarations of the various target dependent
- * functions used by the Message System of Minimon's TIP to communicate
- * with the target.
- *****************************************************************************
- */
-
-#include "messages.h"
-
-int init_comm_serial PARAMS(());
-int msg_send_serial PARAMS((union msg_t *));
-int msg_recv_serial PARAMS((union msg_t *));
-int reset_comm_serial PARAMS(());
-int read_memory_serial PARAMS(());
-int write_memory_serial PARAMS(());
-int fill_memory_serial PARAMS(());
-void go_serial PARAMS(());
-
-int init_comm_pceb PARAMS(());
-int msg_send_pceb PARAMS((union msg_t *));
-int msg_recv_pceb PARAMS((union msg_t *));
-int reset_comm_pceb PARAMS(());
-int read_memory_pceb PARAMS(());
-int write_memory_pceb PARAMS(());
-int fill_memory_pceb PARAMS(());
-void go_pceb PARAMS(());
-
-int init_comm_eb29k PARAMS(());
-int msg_send_eb29k PARAMS((union msg_t *));
-int msg_recv_eb29k PARAMS((union msg_t *));
-int reset_comm_eb29k PARAMS(());
-int read_memory_eb29k PARAMS(());
-int write_memory_eb29k PARAMS(());
-int fill_memory_eb29k PARAMS(());
-void go_eb29k PARAMS(());
-
-int init_comm_lcb29k PARAMS(());
-int msg_send_lcb29k PARAMS((union msg_t *));
-int msg_recv_lcb29k PARAMS((union msg_t *));
-int reset_comm_lcb29k PARAMS(());
-int read_memory_lcb29k PARAMS(());
-int write_memory_lcb29k PARAMS(());
-int fill_memory_lcb29k PARAMS(());
-void go_lcb29k PARAMS(());
-
-int init_comm_iss PARAMS(());
-int reset_comm_iss PARAMS(());
-int msg_send_iss PARAMS((union msg_t *));
-int msg_recv_iss PARAMS((union msg_t *));
-int read_memory_iss PARAMS(());
-int write_memory_iss PARAMS(());
-int fill_memory_iss PARAMS(());
-void go_iss PARAMS((int));
-
-int init_comm_custom PARAMS(());
-int msg_send_custom PARAMS((union msg_t *));
-int msg_recv_custom PARAMS((union msg_t *));
-int reset_comm_custom PARAMS(());
-int read_memory_custom PARAMS(());
-int write_memory_custom PARAMS(());
-int fill_memory_custom PARAMS(());
-void go_custom PARAMS(());
-
-int init_comm_eb030 PARAMS(());
-int msg_send_eb030 PARAMS((union msg_t *));
-int msg_recv_eb030 PARAMS((union msg_t *));
-int reset_comm_eb030 PARAMS(());
-int read_memory_eb030 PARAMS(());
-int write_memory_eb030 PARAMS(());
-int fill_memory_eb030 PARAMS(());
-void go_eb030 PARAMS(());
-
+++ /dev/null
-/* @(#)tdfunc.h 5.18 93/07/30 16:40:16, Srini, AMD */
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- * This file contains the declarations of the various target dependent
- * functions used by the Message System of Minimon's TIP to communicate
- * with the target.
- *****************************************************************************
- */
-
-#ifndef _TDFUNC_H_INCLUDED_
-#define _TDFUNC_H_INCLUDED_
-
-#include "messages.h"
-
-INT32 init_comm_pceb PARAMS((INT32, INT32));
-INT32 msg_send_pceb PARAMS((union msg_t *, INT32));
-INT32 msg_recv_pceb PARAMS((union msg_t *, INT32, INT32));
-INT32 reset_comm_pceb PARAMS((INT32, INT32));
-INT32 exit_comm_pceb PARAMS((INT32, INT32));
-INT32 write_memory_pceb PARAMS((INT32, ADDR32, BYTE *, INT32, INT32, INT32));
-INT32 read_memory_pceb PARAMS((INT32, ADDR32, BYTE *, INT32, INT32, INT32));
-INT32 fill_memory_pceb PARAMS((void));
-void go_pceb PARAMS((INT32, INT32));
-
-INT32 init_comm_serial PARAMS((INT32, INT32));
-INT32 msg_send_serial PARAMS((union msg_t *, INT32));
-#ifdef MSDOS
-INT32 msg_send_parport PARAMS((union msg_t *, INT32));
-#endif
-INT32 msg_recv_serial PARAMS((union msg_t *, INT32, INT32));
-#ifndef MSDOS
-INT32 reset_comm_pcserver PARAMS((INT32, INT32));
-#endif
-INT32 reset_comm_serial PARAMS((INT32, INT32));
-INT32 exit_comm_serial PARAMS((INT32, INT32));
-INT32 write_memory_serial PARAMS((INT32, ADDR32, BYTE *, INT32, INT32, INT32));
-INT32 read_memory_serial PARAMS((INT32, ADDR32, BYTE *, INT32, INT32, INT32));
-INT32 fill_memory_serial PARAMS((void));
-void go_serial PARAMS((INT32, INT32));
-
-INT32 init_comm_eb030 PARAMS((INT32, INT32));
-INT32 msg_send_eb030 PARAMS((union msg_t *, INT32));
-INT32 msg_recv_eb030 PARAMS((union msg_t *, INT32, INT32));
-INT32 reset_comm_eb030 PARAMS((INT32, INT32));
-INT32 exit_comm_eb030 PARAMS((INT32, INT32));
-INT32 write_memory_eb030 PARAMS((INT32, ADDR32, BYTE *, INT32, INT32, INT32));
-INT32 read_memory_eb030 PARAMS((INT32, ADDR32, BYTE *, INT32, INT32, INT32));
-INT32 fill_memory_eb030 PARAMS((void));
-void go_eb030 PARAMS((INT32, INT32));
-
-INT32 init_comm_eb29k PARAMS((INT32, INT32));
-INT32 msg_send_eb29k PARAMS((union msg_t *, INT32));
-INT32 msg_recv_eb29k PARAMS((union msg_t *, INT32, INT32));
-INT32 reset_comm_eb29k PARAMS((INT32, INT32));
-INT32 exit_comm_eb29k PARAMS((INT32, INT32));
-INT32 write_memory_eb29k PARAMS((INT32, ADDR32, BYTE *, INT32, INT32, INT32));
-INT32 read_memory_eb29k PARAMS((INT32, ADDR32, BYTE *, INT32, INT32, INT32));
-INT32 fill_memory_eb29k PARAMS((void));
-void go_eb29k PARAMS((INT32, INT32));
-
-INT32 init_comm_lcb29k PARAMS((INT32, INT32));
-INT32 msg_send_lcb29k PARAMS((union msg_t *, INT32));
-INT32 msg_recv_lcb29k PARAMS((union msg_t *, INT32, INT32));
-INT32 reset_comm_lcb29k PARAMS((INT32, INT32));
-INT32 exit_comm_lcb29k PARAMS((INT32, INT32));
-INT32 write_memory_lcb29k PARAMS((INT32, ADDR32, BYTE *, INT32, INT32, INT32));
-INT32 read_memory_lcb29k PARAMS((INT32, ADDR32, BYTE *, INT32, INT32, INT32));
-INT32 fill_memory_lcb29k PARAMS((void));
-void go_lcb29k PARAMS((INT32, INT32));
-
-
-INT32 send_bfr_serial PARAMS((BYTE *bfr_ptr, INT32 length, INT32 port_base, INT32 *comm_err));
-
-INT32 recv_bfr_serial PARAMS((BYTE *bfr_ptr, INT32 length, INT32 block, INT32 port_base, INT32 *comm_err));
-
-#endif /* TDFUNC_H_INCLUDED_ */
+++ /dev/null
-/* @(#)tiperr.h 1.26 93/07/30 16:40:20, Srini, AMD */
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- *****************************************************************************
- */
-
-#define TIPNOTIMPLM -1
-#define TIPPARSECN -2
-#define TIPMSGINIT -3
-#define TIPCORELOAD -4
-#define TIPGOTARGET -5
-#define TIPGETERROR -6
-#define TIPSENDCFG -7
-#define TIPRECVCFG -8
-#define TIPSENDRST -9
-#define TIPRECVHLT -10
-#define TIPINITARGS -11
-#define TIPSENDINIT -12
-#define TIPRECVINIT -13
-#define TIPSENDRD -14
-#define TIPRECVRD -15
-#define TIPSENDWRT -16
-#define TIPRECVWRT -17
-#define TIPSENDCPY -18
-#define TIPRECVCPY -19
-#define TIPSENDGO -20
-#define TIPRECVGO -21
-#define TIPSENDSTP -22
-#define TIPRECVSTP -23
-#define TIPSENDBRK -24
-#define TIPRECVBRK -25
-#define TIPSENDSTBP -26
-#define TIPRECVSTBP -27
-#define TIPSENDQYBP -28
-#define TIPRECVQYBP -29
-#define TIPSENDRMBP -30
-#define TIPRECVRMBP -31
-#define TIPHIFFAIL -32
-#define TIPTIMEOUT -33
-#define TIPUNXPMSG -34
-#define TIPINVSPACE -35
-#define TIPINVBID -36
-#define TIPNOCORE -37
-#define TIPNOSEND -38
-#define TIPNORECV -39
-#define TIPMSG2BIG -40
-
-/* put new errors before here & increment TIPLASTERR */
-#define TIPLASTERR -40
-
-extern char *tip_err[];
+++ /dev/null
-/* @(#)types.h 5.19 93/08/10 17:49:13, Srini, AMD */
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- ** This header file describes the basic data types used by the
- ** monitor. These are of particular interest to the message
- ** passing portion of the code.
- **
- ** When porting to a machine / compiler whose data types differ
- ** in size from the descriptions below, a change to this file
- ** should permit successful compilation and execution.
- **
- *****************************************************************************
- */
-
-#ifndef _TYPES_H_INCLUDED_
-#define _TYPES_H_INCLUDED_
-
-typedef long int INT32; /* 32 bit integer */
-
-typedef unsigned long int UINT32; /* 32 bit integer (unsigned) */
-
-typedef unsigned long int ADDR32; /* 32 bit address */
-
-typedef unsigned long int INST32; /* 32 bit instruction */
-
-typedef long int BOOLEAN; /* Boolean value (32 bit) */
-
-typedef unsigned char BYTE; /* byte (8 bit) */
-
-typedef short int INT16; /* 16 bit integer */
-
-typedef unsigned short int UINT16; /* 16 bit integer (unsigned) */
-
-#ifdef MSDOS
-#define PARAMS(x) x
-#else
-#define PARAMS(x) ()
-#endif
-
-#define GLOBAL
-#define LOCAL static
-
-#define SUCCESS (INT32) 0
-#define FAILURE (INT32) -1
-#define ABORT_FAILURE (INT32) -2
-#define TIPFAILURE (INT32) -1
-
-#endif /* _TYPES_H_INCLUDED_ */
-
+++ /dev/null
-/* @(#)udiext.h 2.18 93/07/30 16:40:24, Srini, AMD */
-/******************************************************************************
- * Copyright 1992 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Systems Engineering
- * Mail Stop 573
- * 5204 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- * 29k-support@AMD.COM
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- *****************************************************************************
- */
-
-/* This file contains definitions for UDI extensions used by MInimon
- * DFE and TIP
- */
-
-#define MONBreakFlagHardware 0x1000
-#define MONBreakTranslationEnabled 0x2000
+++ /dev/null
-/* @(#)versions.h 5.36 93/11/03 08:33:43, Srini, AMD */
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- *****************************************************************************
- */
-
-#ifndef _VERSIONS_H_INCLUDED_
-#define _VERSIONS_H_INCLUDED_
-
-/* This is the version and date information for the host (DFE) code
- It is included in dfe/main.c */
-/* This is the version and date information for the host (TIP) code
- It is included in tip/udi2mtip.c */
-
-#define MONDFERev 3
-#define MONDFESubRev 3
-#define MONDFESubSubRev 2
-#define MONDFEUDIVers 0x120
-#define HOST_VERSION "3.3-2"
-#define HOST_DATE "03-Nov-93"
-
-#define MONTIPRev 3
-#define MONTIPSubRev 3
-#define MONTIPSubSubRev 2
-#define MONTIPUDIVers 0x120
-#define TIPVERSION "3.3-2"
-#define TIPDATE "03-Nov-93"
-
-#define LastChange "hif rtn"
-
-#endif /* _VERSIONS_H_INCLUDED_ */
+++ /dev/null
-#
-# Makefile for utils/amd-udi/mondfe
-# Copyright (C) 1993 Free Software Foundation
-#
-# This file is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-# $Id$
-#
-# Written by Jeffrey Wheat (cassidy@cygnus.com)
-#
-
-#### Start of system configuration section. ####
-
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-CC = @CC@
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-DEFS = @DEFS@
-LIBS = @LIBS@
-RANLIB = @RANLIB@
-
-AR = ar
-AR_FLAGS = cq
-
-CFLAGS = -g
-
-LD = ld
-LDFLAGS = -g
-
-MV = mv
-RM = rm
-
-prefix = /usr/local
-exec_prefix = $(prefix)
-
-bindir = $(exec_prefix)/bin
-libdir = $(exec_prefix)/lib
-
-mandir = $(prefix)/man
-man1dir = $(mandir)/man1
-man2dir = $(mandir)/man2
-man3dir = $(mandir)/man3
-man4dir = $(mandir)/man4
-man5dir = $(mandir)/man5
-man6dir = $(mandir)/man6
-man7dir = $(mandir)/man7
-man8dir = $(mandir)/man8
-
-SHELL = /bin/sh
-
-INSTALL = install -c
-INSTALL_DATA = $(INSTALL)
-INSTALL_PROGRAM = $(INSTALL)
-
-#### End of system configuration section. ####
-
-OBJS = main.o monitor.o error.o help.o commands.o asm.o \
- opcodes.o regs.o bkpt.o dasm.o fill.o move.o \
- set.o xcmd.o yank.o dump.o getdata.o io.o icmd.o mini2udi.o
-
-LIBDFE = ../udi/libdfe.a
-
-INCLUDE = -I$(srcdir)/../udi -I$(srcdir)/../include
-
-.c.o:
- $(CC) $(INCLUDE) $(DEFS) $(CFLAGS) -c $<
-
-all: mondfe
-
-mondfe: $(LIBUDIDFE) $(OBJS)
- $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBDFE) $(LIBIBERTY)
-
-install: all
-
-mostlyclean clean:
- $(RM) -f *.o mondfe
-
-distclean maintainer-clean realclean: clean
- $(RM) -f Makefile config.status
-
-.PHONY: check installcheck info install-info clean-info dvi
-
-check installcheck:
-
-info install-info clean-info dvi:
-
-# with the gnu make, this is done automatically.
-
-Makefile: Makefile.in
- $(SHELL) ./config.status
-
-config.status: configure
- $(srcdir)/configure --no-create
-
-configure: configure.in
- autoconf
-
-# Prevent GNU make v3 from overflowing arg limit on SysV.
-.NOEXPORT:
+++ /dev/null
-static char _[] = " @(#)asm.c 5.23 93/10/26 10:17:03, Srini, AMD";
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- * This module supports the assemble command to assemble 29K instructions
- * in memory.
- *****************************************************************************
- */
-
-
-#include <stdio.h>
-#include "opcodes.h"
-#include "memspcs.h"
-#include "main.h"
-#include "monitor.h"
-#include "macros.h"
-#include "miniint.h"
-#include "error.h"
-
-#ifdef MSDOS
-#include <string.h>
-#define strcasecmp stricmp
-#else
-#include <string.h>
-#endif
-
-
-/*
-** There are approximately 23 different instruction formats for the
-** Am29000. Instructions are assembled using one of these formats.
-**
-** Note: Opcodes in the "switch" statement are sorted in numerical
-** order.
-**
-*/
-
-
-int get_addr_29k_m PARAMS((char *, struct addr_29k_t *, INT32));
-int addr_29k_ok PARAMS((struct addr_29k_t *));
-void convert32 PARAMS((BYTE *));
-int set_data PARAMS((BYTE *, BYTE *, int));
-
-int asm_instr PARAMS((struct instr_t *, char **, int));
-
-int asm_arith_logic PARAMS((struct instr_t *, struct addr_29k_t *, int));
-int asm_load_store PARAMS((struct instr_t *, struct addr_29k_t *, int));
-int asm_vector PARAMS((struct instr_t *, struct addr_29k_t *, int));
-int asm_no_parms PARAMS((struct instr_t *, struct addr_29k_t *, int));
-int asm_one_parms PARAMS((struct instr_t *, struct addr_29k_t *, int));
-int asm_float PARAMS((struct instr_t *, struct addr_29k_t *, int));
-int asm_call_jmp PARAMS((struct instr_t *, struct addr_29k_t *, int));
-int asm_calli_jmpi PARAMS((struct instr_t *, struct addr_29k_t *, int));
-int asm_class PARAMS((struct instr_t *, struct addr_29k_t *, int));
-int asm_clz PARAMS((struct instr_t *, struct addr_29k_t *, int));
-int asm_const PARAMS((struct instr_t *, struct addr_29k_t *, int));
-int asm_consth PARAMS((struct instr_t *, struct addr_29k_t *, int));
-int asm_convert PARAMS((struct instr_t *, struct addr_29k_t *, int));
-int asm_div0 PARAMS((struct instr_t *, struct addr_29k_t *, int));
-int asm_exhws PARAMS((struct instr_t *, struct addr_29k_t *, int));
-int asm_jmp PARAMS((struct instr_t *, struct addr_29k_t *, int));
-int asm_jmpi PARAMS((struct instr_t *, struct addr_29k_t *, int));
-int asm_mfsr PARAMS((struct instr_t *, struct addr_29k_t *, int));
-int asm_mtsr PARAMS((struct instr_t *, struct addr_29k_t *, int));
-int asm_mtsrim PARAMS((struct instr_t *, struct addr_29k_t *, int));
-int asm_mftlb PARAMS((struct instr_t *, struct addr_29k_t *, int));
-int asm_mttlb PARAMS((struct instr_t *, struct addr_29k_t *, int));
-int asm_sqrt PARAMS((struct instr_t *, struct addr_29k_t *, int));
-int asm_emulate PARAMS((struct instr_t *, struct addr_29k_t *, int));
-
-extern void Mini_poll_kbd PARAMS((char *cmd_buffer, int size, int mode));
-extern int Mini_cmdfile_input PARAMS((char *cmd_buffer, int size));
-extern int tokenize_cmd PARAMS((char *, char **));
-extern void lcase_tokens PARAMS((char **, int));
-extern INT32 do_assemble PARAMS(( struct addr_29k_t addr_29k,
- char *token[],
- int token_count));
-#ifndef XRAY
-
-extern char cmd_buffer[];
-
-#define MAX_ASM_TOKENS 15
-static char *asm_token[MAX_ASM_TOKENS];
-static int asm_token_count;
-
-/*
-** This function is used to assemble an instruction. The command
-** takes as parameters an array of strings (*token[]) and a
-** count (token_count) which gives the number of tokens in the
-** array. These tokens should have the following values:
-**
-** token[0] - 'a' (the assemble command)
-** token[1] - <address> (the address to assemble instruction at)
-** token[2] - <opcode> (the 29K opcode nmemonic)
-** token[3] to token[n] - parameters to the assembly instruction.
-**
-*/
-
-INT32
-asm_cmd(token, token_count)
- char *token[];
- int token_count;
- {
- INT32 result;
- struct addr_29k_t addr_29k;
- int asm_done;
-
- /*
- ** Parse parameters
- */
-
- if ((token_count < 2) || (token_count > 9)) {
- return (EMSYNTAX);
- } else if (token_count == 2) {
- /* Get address of assembly */
- result = get_addr_29k_m(token[1], &addr_29k, I_MEM);
- if (result != 0)
- return (result);
- result = addr_29k_ok(&addr_29k);
- if (result != 0)
- return (result);
- asm_done = 0;
- fprintf(stderr, "0x%08lx:\t", addr_29k.address);
- do {
- if (io_config.cmd_file_io == TRUE) {
- if (Mini_cmdfile_input(cmd_buffer, BUFFER_SIZE) == SUCCESS) {
- fprintf(stderr, "%s", cmd_buffer);
- } else {
- Mini_poll_kbd(cmd_buffer, BUFFER_SIZE, BLOCK); /* block */
- }
- } else {
- Mini_poll_kbd(cmd_buffer, BUFFER_SIZE, BLOCK); /* block */
- }
- if (io_config.log_file) /* make a log file */
-#ifdef MSDOS
- fprintf(io_config.log_file, "%s\n", cmd_buffer);
-#else
- fprintf(io_config.log_file, "%s", cmd_buffer);
-#endif
- if (io_config.echo_mode == (INT32) TRUE)
-#ifdef MSDOS
- fprintf(io_config.echo_file, "%s\n", cmd_buffer);
-#else
- fprintf(io_config.echo_file, "%s", cmd_buffer);
-#endif
- asm_token_count = tokenize_cmd(cmd_buffer, asm_token);
- lcase_tokens(asm_token, asm_token_count);
- if (strcmp(token[0], ".") == 0)
- asm_done = 1;
- else {
- result= do_assemble(addr_29k, &asm_token[0], asm_token_count);
- if (result != SUCCESS)
- warning (result);
- else
- addr_29k.address = addr_29k.address + 4;
- fprintf(stderr, "0x%08lx:\t", addr_29k.address);
- }
- } while (asm_done != 1);
- } else {
- /* Get address of assembly */
- result = get_addr_29k_m(token[1], &addr_29k, I_MEM);
- if (result != 0)
- return (result);
- result = addr_29k_ok(&addr_29k);
- if (result != 0)
- return (result);
- return (do_assemble(addr_29k, &token[2], (token_count-2)));
- }
- return (SUCCESS);
-}
-
-
-INT32
-do_assemble(addr_29k, token, token_count)
-struct addr_29k_t addr_29k;
-char *token[];
-int token_count;
-{
- INT32 result;
- struct instr_t instr;
-
- INT32 retval;
- BYTE *write_data;
- INT32 bytes_ret;
- INT32 hostendian; /* for UDI conformant */
-
- /* Initialize instr */
- instr.op = 0;
- instr.c = 0;
- instr.a = 0;
- instr.b = 0;
-
- /* Assemble instruction */
- result = asm_instr(&instr, &(token[0]), token_count);
-
- if (result != 0)
- return (EMSYNTAX);
-
- /* Will the data overflow the message buffer? done in TIP */
- write_data = (BYTE *) &instr;
-
- hostendian = FALSE;
- if ((retval = Mini_write_req (addr_29k.memory_space,
- addr_29k.address,
- 1, /* count */
- (INT16) sizeof(INST32), /* size */
- &bytes_ret,
- write_data,
- hostendian)) != SUCCESS) {
- return(FAILURE);
- };
- return (SUCCESS);
-}
-#endif
-
-/*
-** This function is used to assemble a single Am29000 instruction.
-** The token[] array contains the lower-case tokens for a single
-** assembler instruction. The token_count contains the number of
-** tokens in the array. This number should be at least 1 (as in the
-** cases of instructions like IRET) and at most 5 (for instructions
-** like LOAD).
-*/
-
-#ifdef XRAY
- extern struct t_inst_table {
- char *inst_mnem;
- unsigned char oprn_fmt;
-} inst_table[];
-#endif
-
-int
-asm_instr(instr, token, token_count)
- struct instr_t *instr;
- char *token[];
- int token_count;
- {
- int i;
- int result;
- struct addr_29k_t parm[10];
- char temp_opcode[20];
- char *temp_ptr;
- int opcode_found;
- static char *str_0x40="0x40";
- static char *str_gr1="gr1";
-
-
- /* Is token_count valid, and is the first token a string? */
- if ((token_count < 1) ||
- (token_count > 7) ||
- (strcmp(token[0], "") == 0))
- return (EMSYNTAX);
-
- /* Get opcode */
-
- /*
- ** Note: Since the opcode_name[] string used in the disassembler
- ** uses padded strings, we cannot do a strcmp(). We canot do a
- ** strncmp() of the length of token[0] either, since "and" will
- ** match up (for instance) with "andn". So we copy the string,
- ** null terminate at the first pad character (space), and then
- ** compare. This is inefficient, but necessary.
- */
-
- i=0;
- opcode_found = FALSE;
- while ((i<256) && (opcode_found != TRUE)) {
-#ifdef XRAY
- result = strcasecmp(token[0], inst_table[i].inst_mnem);
-#else
- temp_ptr = strcpy(temp_opcode, opcode_name[i]);
-
- if (strcmp(temp_ptr, "") != 0)
- temp_ptr = strtok(temp_opcode, " ");
- result = strcmp(token[0], temp_ptr);
-#endif
-
- if (result == 0) {
- opcode_found = TRUE;
- instr->op = (BYTE) i;
- }
- i = i + 1;
- } /* end while */
-
- /* Check for a NOP */
- if ((opcode_found == FALSE) &&
- (strcasecmp(token[0], "nop") == 0)) {
- opcode_found = TRUE;
- instr->op = ASEQ0;
- /* Fake up tokens to give "aseq 0x40,gr1,gr1" */
- token_count = 4;
- token[1] = str_0x40;
- token[2] = str_gr1;
- token[3] = str_gr1;
- }
-
- if (opcode_found == FALSE)
- return (EMSYNTAX);
-
- if ((strcasecmp(token[0], "iretinv") == 0) ||
- (strcasecmp(token[0], "inv") == 0) ) {
- /* iretinv and inv instructions */
- for (i=1; i<token_count; i=i+1) {
- result = get_addr_29k_m(token[i], &(parm[i-1]), GENERIC_SPACE);
- if (result != 0)
- return (result);
- }
- } else {
- /* Make the other tokens into addr_29k */
- for (i=1; i<token_count; i=i+1) {
- result = get_addr_29k_m(token[i], &(parm[i-1]), I_MEM);
- if (result != 0)
- return (result);
- /* Check if register values are legal */
- if (ISREG(parm[i-1].memory_space)) {
- result = addr_29k_ok(&(parm[i-1]));
- if (result != 0)
- return (EMBADREG);
- }
- /* Set bit 7 if a LOCAL_REG */
- if (parm[i-1].memory_space == LOCAL_REG)
- parm[i-1].address = (parm[i-1].address | 0x80);
- }
- }
-
-
- switch (instr->op) {
-
- /* Opcodes 0x00 to 0x0F */
- case ILLEGAL_00: result = EMSYNTAX;
- break;
- case CONSTN: result = asm_const(instr, parm, 2);
- break;
- case CONSTH: result = asm_consth(instr, parm, 2);
- break;
- case CONST: result = asm_const(instr, parm, 2);
- break;
- case MTSRIM: result = asm_mtsrim(instr, parm, 2);
- break;
- case CONSTHZ: result = asm_const(instr, parm, 2);
- break;
- case LOADL0: result = asm_load_store(instr, parm, 4);
- break;
- case LOADL1: result = asm_load_store(instr, parm, 4);
- break;
- case CLZ0: result = asm_clz(instr, parm, 2);
- break;
- case CLZ1: result = asm_clz(instr, parm, 2);
- break;
- case EXBYTE0: result = asm_arith_logic(instr, parm, 3);
- break;
- case EXBYTE1: result = asm_arith_logic(instr, parm, 3);
- break;
- case INBYTE0: result = asm_arith_logic(instr, parm, 3);
- break;
- case INBYTE1: result = asm_arith_logic(instr, parm, 3);
- break;
- case STOREL0: result = asm_load_store(instr, parm, 4);
- break;
- case STOREL1: result = asm_load_store(instr, parm, 4);
- break;
-
- /* Opcodes 0x10 to 0x1F */
- case ADDS0: result = asm_arith_logic(instr, parm, 3);
- break;
- case ADDS1: result = asm_arith_logic(instr, parm, 3);
- break;
- case ADDU0: result = asm_arith_logic(instr, parm, 3);
- break;
- case ADDU1: result = asm_arith_logic(instr, parm, 3);
- break;
- case ADD0: result = asm_arith_logic(instr, parm, 3);
- break;
- case ADD1: result = asm_arith_logic(instr, parm, 3);
- break;
- case LOAD0: result = asm_load_store(instr, parm, 4);
- break;
- case LOAD1: result = asm_load_store(instr, parm, 4);
- break;
- case ADDCS0: result = asm_arith_logic(instr, parm, 3);
- break;
- case ADDCS1: result = asm_arith_logic(instr, parm, 3);
- break;
- case ADDCU0: result = asm_arith_logic(instr, parm, 3);
- break;
- case ADDCU1: result = asm_arith_logic(instr, parm, 3);
- break;
- case ADDC0: result = asm_arith_logic(instr, parm, 3);
- break;
- case ADDC1: result = asm_arith_logic(instr, parm, 3);
- break;
- case STORE0: result = asm_load_store(instr, parm, 4);
- break;
- case STORE1: result = asm_load_store(instr, parm, 4);
- break;
-
- /* Opcodes 0x20 to 0x2F */
- case SUBS0: result = asm_arith_logic(instr, parm, 3);
- break;
- case SUBS1: result = asm_arith_logic(instr, parm, 3);
- break;
- case SUBU0: result = asm_arith_logic(instr, parm, 3);
- break;
- case SUBU1: result = asm_arith_logic(instr, parm, 3);
- break;
- case SUB0: result = asm_arith_logic(instr, parm, 3);
- break;
- case SUB1: result = asm_arith_logic(instr, parm, 3);
- break;
- case LOADSET0: result = asm_load_store(instr, parm, 4);
- break;
- case LOADSET1: result = asm_load_store(instr, parm, 4);
- break;
- case SUBCS0: result = asm_arith_logic(instr, parm, 3);
- break;
- case SUBCS1: result = asm_arith_logic(instr, parm, 3);
- break;
- case SUBCU0: result = asm_arith_logic(instr, parm, 3);
- break;
- case SUBCU1: result = asm_arith_logic(instr, parm, 3);
- break;
- case SUBC0: result = asm_arith_logic(instr, parm, 3);
- break;
- case SUBC1: result = asm_arith_logic(instr, parm, 3);
- break;
- case CPBYTE0: result = asm_arith_logic(instr, parm, 3);
- break;
- case CPBYTE1: result = asm_arith_logic(instr, parm, 3);
- break;
-
-
- /* Opcodes 0x30 to 0x3F */
- case SUBRS0: result = asm_arith_logic(instr, parm, 3);
- break;
- case SUBRS1: result = asm_arith_logic(instr, parm, 3);
- break;
- case SUBRU0: result = asm_arith_logic(instr, parm, 3);
- break;
- case SUBRU1: result = asm_arith_logic(instr, parm, 3);
- break;
- case SUBR0: result = asm_arith_logic(instr, parm, 3);
- break;
- case SUBR1: result = asm_arith_logic(instr, parm, 3);
- break;
- case LOADM0: result = asm_load_store(instr, parm, 4);
- break;
- case LOADM1: result = asm_load_store(instr, parm, 4);
- break;
- case SUBRCS0: result = asm_arith_logic(instr, parm, 3);
- break;
- case SUBRCS1: result = asm_arith_logic(instr, parm, 3);
- break;
- case SUBRCU0: result = asm_arith_logic(instr, parm, 3);
- break;
- case SUBRCU1: result = asm_arith_logic(instr, parm, 3);
- break;
- case SUBRC0: result = asm_arith_logic(instr, parm, 3);
- break;
- case SUBRC1: result = asm_arith_logic(instr, parm, 3);
- break;
- case STOREM0: result = asm_load_store(instr, parm, 4);
- break;
- case STOREM1: result = asm_load_store(instr, parm, 4);
- break;
-
- /* Opcodes 0x40 to 0x4F */
- case CPLT0: result = asm_arith_logic(instr, parm, 3);
- break;
- case CPLT1: result = asm_arith_logic(instr, parm, 3);
- break;
- case CPLTU0: result = asm_arith_logic(instr, parm, 3);
- break;
- case CPLTU1: result = asm_arith_logic(instr, parm, 3);
- break;
- case CPLE0: result = asm_arith_logic(instr, parm, 3);
- break;
- case CPLE1: result = asm_arith_logic(instr, parm, 3);
- break;
- case CPLEU0: result = asm_arith_logic(instr, parm, 3);
- break;
- case CPLEU1: result = asm_arith_logic(instr, parm, 3);
- break;
- case CPGT0: result = asm_arith_logic(instr, parm, 3);
- break;
- case CPGT1: result = asm_arith_logic(instr, parm, 3);
- break;
- case CPGTU0: result = asm_arith_logic(instr, parm, 3);
- break;
- case CPGTU1: result = asm_arith_logic(instr, parm, 3);
- break;
- case CPGE0: result = asm_arith_logic(instr, parm, 3);
- break;
- case CPGE1: result = asm_arith_logic(instr, parm, 3);
- break;
- case CPGEU0: result = asm_arith_logic(instr, parm, 3);
- break;
- case CPGEU1: result = asm_arith_logic(instr, parm, 3);
- break;
-
- /* Opcodes 0x50 to 0x5F */
- case ASLT0: result = asm_vector(instr, parm, 3);
- break;
- case ASLT1: result = asm_vector(instr, parm, 3);
- break;
- case ASLTU0: result = asm_vector(instr, parm, 3);
- break;
- case ASLTU1: result = asm_vector(instr, parm, 3);
- break;
- case ASLE0: result = asm_vector(instr, parm, 3);
- break;
- case ASLE1: result = asm_vector(instr, parm, 3);
- break;
- case ASLEU0: result = asm_vector(instr, parm, 3);
- break;
- case ASLEU1: result = asm_vector(instr, parm, 3);
- break;
- case ASGT0: result = asm_vector(instr, parm, 3);
- break;
- case ASGT1: result = asm_vector(instr, parm, 3);
- break;
- case ASGTU0: result = asm_vector(instr, parm, 3);
- break;
- case ASGTU1: result = asm_vector(instr, parm, 3);
- break;
- case ASGE0: result = asm_vector(instr, parm, 3);
- break;
- case ASGE1: result = asm_vector(instr, parm, 3);
- break;
- case ASGEU0: result = asm_vector(instr, parm, 3);
- break;
- case ASGEU1: result = asm_vector(instr, parm, 3);
- break;
-
- /* Opcodes 0x60 to 0x6F */
- case CPEQ0: result = asm_arith_logic(instr, parm, 3);
- break;
- case CPEQ1: result = asm_arith_logic(instr, parm, 3);
- break;
- case CPNEQ0: result = asm_arith_logic(instr, parm, 3);
- break;
- case CPNEQ1: result = asm_arith_logic(instr, parm, 3);
- break;
- case MUL0: result = asm_arith_logic(instr, parm, 3);
- break;
- case MUL1: result = asm_arith_logic(instr, parm, 3);
- break;
- case MULL0: result = asm_arith_logic(instr, parm, 3);
- break;
- case MULL1: result = asm_arith_logic(instr, parm, 3);
- break;
- case DIV0_OP0: result = asm_div0(instr, parm, 2);
- break;
- case DIV0_OP1: result = asm_div0(instr, parm, 2);
- break;
- case DIV_OP0: result = asm_arith_logic(instr, parm, 3);
- break;
- case DIV_OP1: result = asm_arith_logic(instr, parm, 3);
- break;
- case DIVL0: result = asm_arith_logic(instr, parm, 3);
- break;
- case DIVL1: result = asm_arith_logic(instr, parm, 3);
- break;
- case DIVREM0: result = asm_arith_logic(instr, parm, 3);
- break;
- case DIVREM1: result = asm_arith_logic(instr, parm, 3);
- break;
-
- /* Opcodes 0x70 to 0x7F */
- case ASEQ0: result = asm_vector(instr, parm, 3);
- break;
- case ASEQ1: result = asm_vector(instr, parm, 3);
- break;
- case ASNEQ0: result = asm_vector(instr, parm, 3);
- break;
- case ASNEQ1: result = asm_vector(instr, parm, 3);
- break;
- case MULU0: result = asm_arith_logic(instr, parm, 3);
- break;
- case MULU1: result = asm_arith_logic(instr, parm, 3);
- break;
- case ILLEGAL_76: result = EMSYNTAX;
- break;
- case ILLEGAL_77: result = EMSYNTAX;
- break;
- case INHW0: result = asm_arith_logic(instr, parm, 3);
- break;
- case INHW1: result = asm_arith_logic(instr, parm, 3);
- break;
- case EXTRACT0: result = asm_arith_logic(instr, parm, 3);
- break;
- case EXTRACT1: result = asm_arith_logic(instr, parm, 3);
- break;
- case EXHW0: result = asm_arith_logic(instr, parm, 3);
- break;
- case EXHW1: result = asm_arith_logic(instr, parm, 3);
- break;
- case EXHWS: result = asm_exhws(instr, parm, 2);
- break;
- case ILLEGAL_7F: result = EMSYNTAX;
- break;
-
- /* Opcodes 0x80 to 0x8F */
- case SLL0: result = asm_arith_logic(instr, parm, 3);
- break;
- case SLL1: result = asm_arith_logic(instr, parm, 3);
- break;
- case SRL0: result = asm_arith_logic(instr, parm, 3);
- break;
- case SRL1: result = asm_arith_logic(instr, parm, 3);
- break;
- case ILLEGAL_84: result = EMSYNTAX;
- break;
- case ILLEGAL_85: result = EMSYNTAX;
- break;
- case SRA0: result = asm_arith_logic(instr, parm, 3);
- break;
- case SRA1: result = asm_arith_logic(instr, parm, 3);
- break;
- case IRET:
- result = asm_no_parms(instr, parm, 0);
- break;
- case HALT_OP: result = asm_no_parms(instr, parm, 0);
- break;
- case ILLEGAL_8A: result = EMSYNTAX;
- break;
- case ILLEGAL_8B: result = EMSYNTAX;
- break;
- case IRETINV:
- if (token_count > 1)
- result = asm_one_parms(instr, parm, 1);
- else
- result = asm_no_parms(instr, parm, 0);
- break;
- case ILLEGAL_8D: result = EMSYNTAX;
- break;
- case ILLEGAL_8E: result = EMSYNTAX;
- break;
- case ILLEGAL_8F: result = EMSYNTAX;
- break;
-
- /* Opcodes 0x90 to 0x9F */
- case AND_OP0: result = asm_arith_logic(instr, parm, 3);
- break;
- case AND_OP1: result = asm_arith_logic(instr, parm, 3);
- break;
- case OR_OP0: result = asm_arith_logic(instr, parm, 3);
- break;
- case OR_OP1: result = asm_arith_logic(instr, parm, 3);
- break;
- case XOR_OP0: result = asm_arith_logic(instr, parm, 3);
- break;
- case XOR_OP1: result = asm_arith_logic(instr, parm, 3);
- break;
- case XNOR0: result = asm_arith_logic(instr, parm, 3);
- break;
- case XNOR1: result = asm_arith_logic(instr, parm, 3);
- break;
- case NOR0: result = asm_arith_logic(instr, parm, 3);
- break;
- case NOR1: result = asm_arith_logic(instr, parm, 3);
- break;
- case NAND0: result = asm_arith_logic(instr, parm, 3);
- break;
- case NAND1: result = asm_arith_logic(instr, parm, 3);
- break;
- case ANDN0: result = asm_arith_logic(instr, parm, 3);
- break;
- case ANDN1: result = asm_arith_logic(instr, parm, 3);
- break;
- case SETIP: result = asm_float(instr, parm, 3);
- break;
- case INV:
- if (token_count > 1)
- result = asm_one_parms(instr, parm, 1);
- else
- result = asm_no_parms(instr, parm, 0);
- break;
-
- /* Opcodes 0xA0 to 0xAF */
- case JMP0: result = asm_jmp(instr, parm, 1);
- break;
- case JMP1: result = asm_jmp(instr, parm, 1);
- break;
- case ILLEGAL_A2: result = EMSYNTAX;
- break;
- case ILLEGAL_A3: result = EMSYNTAX;
- break;
- case JMPF0: result = asm_call_jmp(instr, parm, 2);
- break;
- case JMPF1: result = asm_call_jmp(instr, parm, 2);
- break;
- case ILLEGAL_A6: result = EMSYNTAX;
- break;
- case ILLEGAL_A7: result = EMSYNTAX;
- break;
- case CALL0: result = asm_call_jmp(instr, parm, 2);
- break;
- case CALL1: result = asm_call_jmp(instr, parm, 2);
- break;
- case ORN_OP0: result = EMSYNTAX;
- break;
- case ORN_OP1: result = EMSYNTAX;
- break;
- case JMPT0: result = asm_call_jmp(instr, parm, 2);
- break;
- case JMPT1: result = asm_call_jmp(instr, parm, 2);
- break;
- case ILLEGAL_AE: result = EMSYNTAX;
- break;
- case ILLEGAL_AF: result = EMSYNTAX;
- break;
-
- /* Opcodes 0xB0 to 0xBF */
- case ILLEGAL_B0: result = EMSYNTAX;
- break;
- case ILLEGAL_B1: result = EMSYNTAX;
- break;
- case ILLEGAL_B2: result = EMSYNTAX;
- break;
- case ILLEGAL_B3: result = EMSYNTAX;
- break;
- case JMPFDEC0: result = asm_call_jmp(instr, parm, 2);
- break;
- case JMPFDEC1: result = asm_call_jmp(instr, parm, 2);
- break;
- case MFTLB: result = asm_mftlb(instr, parm, 2);
- break;
- case ILLEGAL_B7: result = EMSYNTAX;
- break;
- case ILLEGAL_B8: result = EMSYNTAX;
- break;
- case ILLEGAL_B9: result = EMSYNTAX;
- break;
- case ILLEGAL_BA: result = EMSYNTAX;
- break;
- case ILLEGAL_BB: result = EMSYNTAX;
- break;
- case ILLEGAL_BC: result = EMSYNTAX;
- break;
- case ILLEGAL_BD: result = EMSYNTAX;
- break;
- case MTTLB: result = asm_mttlb(instr, parm, 2);
- break;
- case ILLEGAL_BF: result = EMSYNTAX;
- break;
-
- /* Opcodes 0xC0 to 0xCF */
- case JMPI: result = asm_jmpi(instr, parm, 1);
- break;
- case ILLEGAL_C1: result = EMSYNTAX;
- break;
- case ILLEGAL_C2: result = EMSYNTAX;
- break;
- case ILLEGAL_C3: result = EMSYNTAX;
- break;
- case JMPFI: result = asm_calli_jmpi(instr, parm, 2);
- break;
- case ILLEGAL_C5: result = EMSYNTAX;
- break;
- case MFSR: result = asm_mfsr(instr, parm, 2);
- break;
- case ILLEGAL_C7: result = EMSYNTAX;
- break;
- case CALLI: result = asm_calli_jmpi(instr, parm, 2);
- break;
- case ILLEGAL_C9: result = EMSYNTAX;
- break;
- case ILLEGAL_CA: result = EMSYNTAX;
- break;
- case ILLEGAL_CB: result = EMSYNTAX;
- break;
- case JMPTI: result = asm_calli_jmpi(instr, parm, 2);
- break;
- case ILLEGAL_CD: result = EMSYNTAX;
- break;
- case MTSR: result = asm_mtsr(instr, parm, 2);
- break;
- case ILLEGAL_CF: result = EMSYNTAX;
- break;
-
- /* Opcodes 0xD0 to 0xDF */
- case ILLEGAL_D0: result = EMSYNTAX;
- break;
- case ILLEGAL_D1: result = EMSYNTAX;
- break;
- case ILLEGAL_D2: result = EMSYNTAX;
- break;
- case ILLEGAL_D3: result = EMSYNTAX;
- break;
- case ILLEGAL_D4: result = EMSYNTAX;
- break;
- case ILLEGAL_D5: result = EMSYNTAX;
- break;
- case ILLEGAL_D6: result = EMSYNTAX;
- break;
- case EMULATE: result = asm_emulate(instr, parm, 3);
- break;
- case ILLEGAL_D8: result = EMSYNTAX;
- break;
- case ILLEGAL_D9: result = EMSYNTAX;
- break;
- case ILLEGAL_DA: result = EMSYNTAX;
- break;
- case ILLEGAL_DB: result = EMSYNTAX;
- break;
- case ILLEGAL_DC: result = EMSYNTAX;
- break;
- case ILLEGAL_DD: result = EMSYNTAX;
- break;
- case MULTM: result = asm_float(instr, parm, 3);
- break;
- case MULTMU: result = asm_float(instr, parm, 3);
- break;
-
- /* Opcodes 0xE0 to 0xEF */
- case MULTIPLY: result = asm_float(instr, parm, 3);
- break;
- case DIVIDE: result = asm_float(instr, parm, 3);
- break;
- case MULTIPLU: result = asm_float(instr, parm, 3);
- break;
- case DIVIDU: result = asm_float(instr, parm, 3);
- break;
- case CONVERT: result = asm_convert(instr, parm, 6);
- break;
- case SQRT: result = asm_sqrt(instr, parm, 3);
- break;
- case CLASS: result = asm_class(instr, parm, 3);
- break;
- case ILLEGAL_E7: result = EMSYNTAX;
- break;
- case ILLEGAL_E8: result = EMSYNTAX;
- break;
- case ILLEGAL_E9: result = EMSYNTAX;
- break;
- case FEQ: result = asm_float(instr, parm, 3);
- break;
- case DEQ: result = asm_float(instr, parm, 3);
- break;
- case FGT: result = asm_float(instr, parm, 3);
- break;
- case DGT: result = asm_float(instr, parm, 3);
- break;
- case FGE: result = asm_float(instr, parm, 3);
- break;
- case DGE: result = asm_float(instr, parm, 3);
- break;
-
- /* Opcodes 0xF0 to 0xFF */
- case FADD: result = asm_float(instr, parm, 3);
- break;
- case DADD: result = asm_float(instr, parm, 3);
- break;
- case FSUB: result = asm_float(instr, parm, 3);
- break;
- case DSUB: result = asm_float(instr, parm, 3);
- break;
- case FMUL: result = asm_float(instr, parm, 3);
- break;
- case DMUL: result = asm_float(instr, parm, 3);
- break;
- case FDIV: result = asm_float(instr, parm, 3);
- break;
- case DDIV: result = asm_float(instr, parm, 3);
- break;
- case ILLEGAL_F8: result = EMSYNTAX;
- break;
- case FDMUL: result = asm_float(instr, parm, 3);
- break;
- case ILLEGAL_FA: result = EMSYNTAX;
- break;
- case ILLEGAL_FB: result = EMSYNTAX;
- break;
- case ILLEGAL_FC: result = EMSYNTAX;
- break;
- case ILLEGAL_FD: result = EMSYNTAX;
- break;
- case ILLEGAL_FE: result = EMSYNTAX;
- break;
- case ILLEGAL_FF: result = EMSYNTAX;
- break;
- } /* end switch */
-
- return (result);
-
- } /* End asm_instr() */
-
-
-
-
-/*
-** The following functions are used to convert instruction
-** parameters as an arrays of addr_29k_t memory space / address
-** pairs into a 32 bit Am29000 binary instruction.
-** All of the Am29000 instruction formats are supported below.
-*/
-
-
-/*
-** Formats: <nmemonic>, RC, RA, (RB or I)
-** Examples: ADD, OR, SLL, all arithmetic and
-** logic instructions
-**
-*/
-
-int
-asm_arith_logic(instr, parm, parm_count)
- struct instr_t *instr;
- struct addr_29k_t *parm;
- int parm_count;
- {
- if (parm_count != 3)
- return (EMSYNTAX);
-
- if (ISGENERAL(parm[0].memory_space) &&
- ISGENERAL(parm[1].memory_space) &&
- ISGENERAL(parm[2].memory_space)) {
- /* Make sure M flag is cleared */
- instr->op = (BYTE) (instr->op & 0xfe);
- instr->c = (BYTE) (parm[0].address & 0xff);
- instr->a = (BYTE) (parm[1].address & 0xff);
- instr->b = (BYTE) (parm[2].address & 0xff);
- }
- else
- if (ISGENERAL(parm[0].memory_space) &&
- ISGENERAL(parm[1].memory_space) &&
- ISMEM(parm[2].memory_space)) {
- /* Make sure M flag is set */
- instr->op = (BYTE) (instr->op | 0x01);
- instr->c = (BYTE) (parm[0].address & 0xff);
- instr->a = (BYTE) (parm[1].address & 0xff);
- instr->b = (BYTE) (parm[2].address & 0xff);
- }
- else
- return(EMSYNTAX);
-
- return (0);
- } /* end asm_arith_logic() */
-
-
-
-/*
-** Formats: <nmemonic>, VN, RA, (RB or I)
-** Examples: ASSEQ, ASLE, ASLT, all trap assertion
-** instructions
-**
-*/
-
-int
-asm_vector(instr, parm, parm_count)
- struct instr_t *instr;
- struct addr_29k_t *parm;
- int parm_count;
- {
- if (parm_count != 3)
- return (EMSYNTAX);
-
- if (ISMEM(parm[0].memory_space) &&
- ISGENERAL(parm[1].memory_space) &&
- ISGENERAL(parm[2].memory_space)) {
- /* Make sure M flag is cleared */
- instr->op = (BYTE) (instr->op & 0xfe);
- instr->c = (BYTE) (parm[0].address & 0xff);
- instr->a = (BYTE) (parm[1].address & 0xff);
- instr->b = (BYTE) (parm[2].address & 0xff);
- }
- else
- if (ISMEM(parm[0].memory_space) &&
- ISGENERAL(parm[1].memory_space) &&
- ISMEM(parm[2].memory_space)) {
- /* Make sure M flag is set */
- instr->op = (BYTE) (instr->op | 0x01);
- instr->c = (BYTE) (parm[0].address & 0xff);
- instr->a = (BYTE) (parm[1].address & 0xff);
- instr->b = (BYTE) (parm[2].address & 0xff);
- }
- else
- return(EMSYNTAX);
-
- return (0);
- } /* end asm_vector() */
-
-
-
-/*
-** Formats: <nmemonic>, CE, CNTL, RA, (RB or I)
-** Examples: LOAD, LOADM, STORE, all load and store
-** instructions
-**
-*/
-
-int
-asm_load_store(instr, parm, parm_count)
- struct instr_t *instr;
- struct addr_29k_t *parm;
- int parm_count;
- {
- int ce;
- int cntl;
-
- if (parm_count != 4)
- return (EMSYNTAX);
-
- if (ISMEM(parm[0].memory_space) &&
- ISMEM(parm[1].memory_space) &&
- ISGENERAL(parm[2].memory_space) &&
- ISGENERAL(parm[3].memory_space)) {
- /* Make sure M flag is cleared */
- instr->op = (BYTE) (instr->op & 0xfe);
- if (parm[0].address > 1)
- return (EMSYNTAX);
- if (parm[1].address > 0x7f)
- return (EMSYNTAX);
- ce = (int) ((parm[0].address << 7) & 0x80);
- cntl = (int) (parm[1].address & 0x7f);
- instr->c = (BYTE) (ce | cntl);
- instr->a = (BYTE) (parm[2].address & 0xff);
- instr->b = (BYTE) (parm[3].address & 0xff);
- }
- else
- if (ISMEM(parm[0].memory_space) &&
- ISMEM(parm[1].memory_space) &&
- ISGENERAL(parm[2].memory_space) &&
- ISMEM(parm[3].memory_space)) {
- /* Make sure M flag is set */
- instr->op = (BYTE) (instr->op | 0x01);
- if (parm[0].address > 1)
- return (EMSYNTAX);
- if (parm[1].address > 0x7f)
- return (EMSYNTAX);
- if (parm[3].address > 0xff)
- return (EMSYNTAX);
- ce = (int) ((parm[0].address << 7) & 0x80);
- cntl = (int) (parm[1].address & 0x7f);
- instr->c = (BYTE) (ce | cntl);
- instr->a = (BYTE) (parm[2].address & 0xff);
- instr->b = (BYTE) (parm[3].address & 0xff);
- }
- else
- return(EMSYNTAX);
-
- return (0);
- } /* end asm_load_store() */
-
-
-
-/*
-** Formats: <nmemonic>
-** Examples: HALT, INV, IRET
-*/
-/*ARGSUSED*/
-
-int
-asm_no_parms(instr, parm, parm_count)
- struct instr_t *instr;
- struct addr_29k_t *parm;
- int parm_count;
- {
- if (parm_count != 0)
- return (EMSYNTAX);
-
- /* Put zeros in the "reserved" fields */
- instr->c = 0;
- instr->a = 0;
- instr->b = 0;
-
- return (0);
- } /* end asm_no_parms() */
-
-
-int
-asm_one_parms(instr, parm, parm_count)
- struct instr_t *instr;
- struct addr_29k_t *parm;
- int parm_count;
- {
- if (parm_count != 1)
- return (EMSYNTAX);
-
- instr->c = (BYTE) (parm[0].address & 0x3);
-
- /* Put zeros in the "reserved" fields */
- instr->a = 0;
- instr->b = 0;
-
- return (0);
- } /* end asm_one_parms */
-
-
-/*
-** Formats: <nmemonic>, RC, RA, RB
-** Examples: DADD, FADD, all floating point
-** instructions
-**
-*/
-
-int
-asm_float(instr, parm, parm_count)
- struct instr_t *instr;
- struct addr_29k_t *parm;
- int parm_count;
- {
- if (parm_count != 3)
- return (EMSYNTAX);
-
- if (ISGENERAL(parm[0].memory_space) &&
- ISGENERAL(parm[1].memory_space) &&
- ISGENERAL(parm[2].memory_space)) {
- instr->c = (BYTE) (parm[0].address & 0xff);
- instr->a = (BYTE) (parm[1].address & 0xff);
- instr->b = (BYTE) (parm[2].address & 0xff);
- }
- else
- return(EMSYNTAX);
-
- return (0);
- } /* end asm_float() */
-
-
-
-/*
-** Formats: <nmemonic> RA, <target>
-** Examples: CALL, JMPF, JMPFDEC, JMPT
-**
-** Note: This function is used only with the CALL,
-** JMPF, JMPFDEC and JMPT operations.
-*/
-
-int
-asm_call_jmp(instr, parm, parm_count)
- struct instr_t *instr;
- struct addr_29k_t *parm;
- int parm_count;
- {
- if (parm_count != 2)
- return (EMSYNTAX);
-
- if (ISGENERAL(parm[0].memory_space) &&
- ISMEM(parm[1].memory_space)) {
- /* Make sure M flag is set */
- if (parm[1].memory_space != PC_RELATIVE)
- instr->op = (BYTE) (instr->op | 0x01);
- else
- instr->op = (BYTE) instr->op ;
- instr->c = (BYTE) ((parm[1].address >> 10) & 0xff);
- instr->a = (BYTE) (parm[0].address & 0xff);
- instr->b = (BYTE) ((parm[1].address >> 2) & 0xff);
- }
- else
- return(EMSYNTAX);
-
- return (0);
- } /* end asm_call_jmp() */
-
-
-
-
-/*
-** Formats: <nmemonic> RA, RB
-** Examples: CALLI, JMPFI, JMPTI
-**
-** Note: This function is used only with the CALLI,
-** JMPFI and JMPTI (but not JMPI) operations.
-*/
-
-int
-asm_calli_jmpi(instr, parm, parm_count)
- struct instr_t *instr;
- struct addr_29k_t *parm;
- int parm_count;
- {
- if (parm_count != 2)
- return (EMSYNTAX);
-
- if (ISGENERAL(parm[0].memory_space) &&
- ISREG(parm[1].memory_space)) {
- instr->c = 0;
- instr->a = (BYTE) (parm[0].address & 0xff);
- instr->b = (BYTE) (parm[1].address & 0xff);
- }
- else
- return(EMSYNTAX);
-
- return (0);
- } /* end asm_calli_jmpi() */
-
-
-
-/*
-** Formats: <nmemonic> RC, RB, FS
-** Examples: CLASS
-**
-** Note: This function is used only with the CLASS
-** operation.
-*/
-
-int
-asm_class(instr, parm, parm_count)
- struct instr_t *instr;
- struct addr_29k_t *parm;
- int parm_count;
- {
- if (parm_count != 3)
- return (EMSYNTAX);
-
- if (ISGENERAL(parm[0].memory_space) &&
- ISGENERAL(parm[1].memory_space) &&
- ISMEM(parm[2].memory_space)) {
- if (parm[2].address > 0x03)
- return (EMSYNTAX);
- instr->c = (BYTE) (parm[0].address & 0xff);
- instr->a = (BYTE) (parm[1].address & 0xff);
- instr->b = (BYTE) (parm[2].address & 0x03);
- }
- else
- return(EMSYNTAX);
-
- return (0);
- } /* end asm_class() */
-
-
-/*
-** Formats: <nmemonic> RC, (RB or I)
-** Examples: CLZ
-**
-** Note: This function is used only with the CLZ
-** operation.
-*/
-
-int
-asm_clz(instr, parm, parm_count)
- struct instr_t *instr;
- struct addr_29k_t *parm;
- int parm_count;
- {
- if (parm_count != 2)
- return (EMSYNTAX);
-
- if (ISGENERAL(parm[0].memory_space) &&
- ISGENERAL(parm[1].memory_space)) {
- /* Make sure M flag is cleared */
- instr->op = (BYTE) (instr->op & 0xfe);
- instr->c = (BYTE) (parm[0].address & 0xff);
- instr->a = 0;
- instr->b = (BYTE) (parm[1].address & 0xff);
- }
- else
- if (ISGENERAL(parm[0].memory_space) &&
- ISMEM(parm[1].memory_space)) {
- /* Check param1 */
- if ((parm[1].address) > 0xff)
- return(EMSYNTAX);
- /* Make sure M flag is set */
- instr->op = (BYTE) (instr->op | 0x01);
- instr->c = (BYTE) (parm[0].address & 0xff);
- instr->a = 0;
- instr->b = (BYTE) (parm[1].address & 0xff);
- }
- else
- return(EMSYNTAX);
-
- return (0);
- } /* end asm_clz() */
-
-
-
-/*
-** Formats: <nmemonic> RA, <const16>
-** Examples: CONST, CONSTN
-**
-*/
-
-int
-asm_const(instr, parm, parm_count)
- struct instr_t *instr;
- struct addr_29k_t *parm;
- int parm_count;
- {
- if (parm_count != 2)
- return (EMSYNTAX);
-
- if (ISGENERAL(parm[0].memory_space) &&
- ISMEM(parm[1].memory_space)) {
- instr->c = (BYTE) ((parm[1].address >> 8) & 0xff);
- instr->a = (BYTE) (parm[0].address & 0xff);
- instr->b = (BYTE) (parm[1].address & 0xff);
- }
- else
- return(EMSYNTAX);
-
- return (0);
- } /* end asm_const() */
-
-
-
-/*
-** Formats: <nmemonic> RA, <const16>
-** Examples: CONSTH
-**
-*/
-
-int
-asm_consth(instr, parm, parm_count)
- struct instr_t *instr;
- struct addr_29k_t *parm;
- int parm_count;
- {
- if (parm_count != 2)
- return (EMSYNTAX);
-
- if (ISGENERAL(parm[0].memory_space) &&
- ISMEM(parm[1].memory_space)) {
- instr->c = (BYTE) ((parm[1].address >> 24) & 0xff);
- instr->a = (BYTE) (parm[0].address & 0xff);
- instr->b = (BYTE) ((parm[1].address >> 16) & 0xff);
- }
- else
- return(EMSYNTAX);
-
- return (0);
- } /* end asm_consth() */
-
-
-
-/*
-** Formats: <nmemonic> RC, RA, UI, RND, FD, FS
-** Examples: CONVERT
-**
-** Note: This function is used only with the CONVERT
-** operation.
-**
-** Note: Some assembler examples show this operation with
-** only five parameters. It should have six.
-*/
-
-int
-asm_convert(instr, parm, parm_count)
- struct instr_t *instr;
- struct addr_29k_t *parm;
- int parm_count;
- {
- BYTE ui;
- BYTE rnd;
- BYTE fd;
- BYTE fs;
-
- if (parm_count != 6)
- return (EMSYNTAX);
-
- if (ISGENERAL(parm[0].memory_space) &&
- ISGENERAL(parm[1].memory_space) &&
- ISMEM(parm[2].memory_space) &&
- ISMEM(parm[3].memory_space) &&
- ISMEM(parm[4].memory_space) &&
- ISMEM(parm[5].memory_space)) {
- if (parm[2].address > 1)
- return (EMSYNTAX);
- if (parm[3].address > 0x07)
- return (EMSYNTAX);
- if (parm[4].address > 0x03)
- return (EMSYNTAX);
- if (parm[5].address > 0x03)
- return (EMSYNTAX);
- ui = (BYTE) ((parm[2].address << 7) & 0x80);
- rnd = (BYTE) ((parm[3].address << 4) & 0x70);
- fd = (BYTE) ((parm[4].address << 2) & 0x0c);
- fs = (BYTE) (parm[5].address & 0x03);
- instr->c = (BYTE) (parm[0].address & 0xff);
- instr->a = (BYTE) (parm[1].address & 0xff);
- instr->b = (ui | rnd | fd | fs);
- }
- else
- return(EMSYNTAX);
-
- return (0);
- } /* end asm_convert() */
-
-
-
-/*
-** Formats: <nmemonic> RC, RA
-** Examples: DIV0
-**
-** Note: This function is used only with the DIV0
-** operation.
-*/
-
-int
-asm_div0(instr, parm, parm_count)
- struct instr_t *instr;
- struct addr_29k_t *parm;
- int parm_count;
- {
- if (parm_count != 2)
- return (EMSYNTAX);
-
- if (ISGENERAL(parm[0].memory_space) &&
- ISGENERAL(parm[1].memory_space)) {
- /* Make sure M flag is cleared */
- instr->op = (BYTE) (instr->op & 0xfe);
- instr->c = (BYTE) (parm[0].address & 0xff);
- instr->a = 0;
- instr->b = (BYTE) (parm[1].address & 0xff);
- }
- else
- if (ISGENERAL(parm[0].memory_space) &&
- ISMEM(parm[1].memory_space)) {
- /* Check immediate value */
- if (parm[1].address > 0xff)
- return (EMSYNTAX);
- /* Make sure M flag is set */
- instr->op = (BYTE) (instr->op | 0x01);
- instr->c = (BYTE) (parm[0].address & 0xff);
- instr->a = 0;
- instr->b = (BYTE) (parm[1].address & 0xff);
- }
- else
- return(EMSYNTAX);
-
- return (0);
- } /* end asm_div0() */
-
-
-/*
-** Formats: <nmemonic> RC, RA
-** Examples: EXHWS
-**
-** Note: This function is used only with the EXHWS
-** operation.
-*/
-
-int
-asm_exhws(instr, parm, parm_count)
- struct instr_t *instr;
- struct addr_29k_t *parm;
- int parm_count;
- {
- if (parm_count != 2)
- return (EMSYNTAX);
-
- if (ISGENERAL(parm[0].memory_space) &&
- ISGENERAL(parm[1].memory_space)){
- instr->c = (BYTE) (parm[0].address & 0xff);
- instr->a = (BYTE) (parm[1].address & 0xff);
- instr->b = 0;
- }
- else
- return(EMSYNTAX);
-
- return (0);
- } /* end asm_exhws() */
-
-
-
-
-/*
-** Formats: <nmemonic> <target>
-** Examples: JMP
-**
-** Note: This function is used only with the JMP
-** operation.
-**
-** Note: This function will only do absolute jumps.
-*/
-
-int
-asm_jmp(instr, parm, parm_count)
- struct instr_t *instr;
- struct addr_29k_t *parm;
- int parm_count;
- {
- if (parm_count != 1)
- return (EMSYNTAX);
-
- if (ISMEM(parm[0].memory_space)) {
- /* Make sure M flag is set */
- if (parm[0].memory_space != PC_RELATIVE)
- instr->op = (BYTE) (instr->op | 0x01);
- else
- instr->op = (BYTE) instr->op ;
- instr->c = (BYTE) ((parm[0].address >> 10) & 0xff);
- instr->a = 0;
- instr->b = (BYTE) ((parm[0].address >> 2) & 0xff);
- }
- else
- return(EMSYNTAX);
-
- return (0);
- } /* end asm_jmp() */
-
-
-
-/*
-** Formats: <nmemonic> RB
-** Examples: JMPI
-**
-** Note: This function is used only with the JMPI
-** operation.
-*/
-
-int
-asm_jmpi(instr, parm, parm_count)
- struct instr_t *instr;
- struct addr_29k_t *parm;
- int parm_count;
- {
- if (parm_count != 1)
- return (EMSYNTAX);
-
- if (ISGENERAL(parm[0].memory_space)) {
- instr->c = 0;
- instr->a = 0;
- instr->b = (BYTE) (parm[0].address & 0xff);
- }
- else
- return(EMSYNTAX);
-
- return (0);
- } /* end asm_jmpi() */
-
-
-
-/*
-** Formats: <nmemonic> RC, SA
-** Examples: MFSR
-**
-** Note: This function is used only with the MFSR
-** operation.
-*/
-
-int
-asm_mfsr(instr, parm, parm_count)
- struct instr_t *instr;
- struct addr_29k_t *parm;
- int parm_count;
- {
- if (parm_count != 2)
- return (EMSYNTAX);
-
- if (ISGENERAL(parm[0].memory_space) &&
- ISSPECIAL(parm[1].memory_space)) {
- instr->c = (BYTE) (parm[0].address & 0xff);
- instr->a = (BYTE) (parm[1].address & 0xff);
- instr->b = 0;
- }
- else
- return(EMSYNTAX);
-
- return (0);
- } /* end asm_mfsr() */
-
-
-
-/*
-** Formats: <nmemonic> SA, RB
-** Examples: MTSR
-**
-** Note: This function is used only with the MTSR
-** operation.
-*/
-
-int
-asm_mtsr(instr, parm, parm_count)
- struct instr_t *instr;
- struct addr_29k_t *parm;
- int parm_count;
- {
- if (parm_count != 2)
- return (EMSYNTAX);
-
- if (ISSPECIAL(parm[0].memory_space) &&
- ISGENERAL(parm[1].memory_space)) {
- instr->c = 0;
- instr->a = (BYTE) (parm[0].address & 0xff);
- instr->b = (BYTE) (parm[1].address & 0xff);
- }
- else
- return(EMSYNTAX);
-
- return (0);
- } /* end asm_mtsr() */
-
-
-
-
-/*
-** Formats: <nmemonic> SA, <const16>
-** Examples: MTSRIM
-**
-** Note: This function is used only with the MTSRIM
-** operation.
-*/
-
-int
-asm_mtsrim(instr, parm, parm_count)
- struct instr_t *instr;
- struct addr_29k_t *parm;
- int parm_count;
- {
- if (parm_count != 2)
- return (EMSYNTAX);
-
- if (ISSPECIAL(parm[0].memory_space) &&
- ISMEM(parm[1].memory_space)) {
- instr->c = (BYTE) ((parm[1].address >> 8) & 0xff);
- instr->a = (BYTE) (parm[0].address & 0xff);
- instr->b = (BYTE) (parm[1].address & 0xff);
- }
- else
- return(EMSYNTAX);
-
- return (0);
- } /* end asm_mtsrim() */
-
-
-
-
-/*
-** Formats: <nmemonic> RC, RA
-** Examples: MFTLB
-**
-** Note: This function is used only with the MFTLB
-** operation.
-*/
-
-int
-asm_mftlb(instr, parm, parm_count)
- struct instr_t *instr;
- struct addr_29k_t *parm;
- int parm_count;
- {
- if (parm_count != 2)
- return (EMSYNTAX);
-
- if (ISGENERAL(parm[0].memory_space) &&
- ISGENERAL(parm[1].memory_space)) {
- instr->c = (BYTE) (parm[0].address & 0xff);
- instr->a = (BYTE) (parm[1].address & 0xff);
- instr->b = 0;
- }
- else
- return(EMSYNTAX);
-
- return (0);
- } /* end asm_mftlb() */
-
-
-/*
-** Formats: <nmemonic> RA, RB
-** Examples: MTTLB
-**
-** Note: This function is used only with the MTTLB
-** operation.
-*/
-
-int
-asm_mttlb(instr, parm, parm_count)
- struct instr_t *instr;
- struct addr_29k_t *parm;
- int parm_count;
- {
- if (parm_count != 2)
- return (EMSYNTAX);
-
- if (ISGENERAL(parm[0].memory_space) &&
- ISGENERAL(parm[1].memory_space)) {
- instr->c = 0;
- instr->a = (BYTE) (parm[0].address & 0xff);
- instr->b = (BYTE) (parm[1].address & 0xff);
- }
- else
- return(EMSYNTAX);
-
- return (0);
- } /* end asm_mttlb() */
-
-
-
-
-/*
-** Formats: <nmemonic> RC, RA, FS
-** Examples: SQRT
-**
-** Note: This function is used only with the SQRT
-** operation.
-*/
-
-int
-asm_sqrt(instr, parm, parm_count)
- struct instr_t *instr;
- struct addr_29k_t *parm;
- int parm_count;
- {
- if (parm_count != 3)
- return (EMSYNTAX);
-
- if (ISGENERAL(parm[0].memory_space) &&
- ISGENERAL(parm[1].memory_space) &&
- ISMEM(parm[2].memory_space)) {
- instr->c = (BYTE) (parm[0].address & 0xff);
- instr->a = (BYTE) (parm[1].address & 0xff);
- instr->b = (BYTE) (parm[2].address & 0x03);
- }
- else
- return(EMSYNTAX);
-
- return (0);
- } /* end asm_sqrt() */
-
-
-
-/*
-** Formats: <nmemonic>, VN, RA, RB
-** Examples: EMULATE
-**
-** Note: This function is used only with the EMULATE
-** operation.
-**
-*/
-
-int
-asm_emulate(instr, parm, parm_count)
- struct instr_t *instr;
- struct addr_29k_t *parm;
- int parm_count;
- {
- if (parm_count != 3)
- return (EMSYNTAX);
-
- if (ISMEM(parm[0].memory_space) &&
- ISGENERAL(parm[1].memory_space) &&
- ISGENERAL(parm[2].memory_space)) {
- instr->c = (BYTE) (parm[0].address & 0xff);
- instr->a = (BYTE) (parm[1].address & 0xff);
- instr->b = (BYTE) (parm[2].address & 0xff);
- }
- else
- return(EMSYNTAX);
-
- return (0);
- } /* end asm_emulate() */
-
-
-
-
-
+++ /dev/null
-static char _[] = " @(#)bkpt.c 5.20 93/07/30 16:38:20, Srini, AMD ";
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- ** This module contains the functions used to provide breakpointing
- ** capability.
- *****************************************************************************
- */
-
-#include <stdio.h>
-#include <ctype.h>
-#include "memspcs.h"
-#include "main.h"
-#include "monitor.h"
-#include "miniint.h"
-#include "error.h"
-
-#ifdef MSDOS
-#include <stdlib.h>
-#include <string.h>
-
-#else
-#include <strings.h>
-
-#endif
-
-/*
-** Definitions
-*/
-
-int get_addr_29k_m PARAMS((char *, struct addr_29k_t *, INT32));
-int addr_29k_ok PARAMS((struct addr_29k_t *));
-int get_word PARAMS((char *, INT32 *));
-int get_word_decimal PARAMS((char *, INT32 *));
-
-INT32 clear_table PARAMS((void));
-INT32 clear_bkpt PARAMS((struct addr_29k_t));
-INT32 show_table PARAMS((void));
-INT32 set_bkpt PARAMS((struct addr_29k_t,
- INT32,
- INT32));
-
-INT32 match_entry PARAMS((ADDR32 offset,
- INT32 space,
- int *id));
-INT32 remove_from_table PARAMS((int id));
-
-INT32 add_to_table PARAMS((ADDR32 offset,
- INT32 space,
- INT32 passcnt,
- INT32 bktype,
- int id));
-
-extern struct bkpt_t *bkpt_table;
-
-/*
-** The function below is used in manipulating breakpoints.
-** This function is called in the main command loop parser
-** of the monitor. The parameters passed to this function
-** are:
-**
-** token - This is an array of pointers to strings. Each string
-** referenced by this array is a "token" of the user's
-** input, translated to lower case.
-**
-** token_count - This is the number of tokens in "token".
-**
-*/
-
-
-INT32
-bkpt_cmd(token, token_count)
- char *token[];
- int token_count;
- {
- INT32 result;
- struct addr_29k_t addr_29k;
- INT32 pass_count;
- INT32 bkpt_type;
-
- /*
- ** Clear breakpoint(s)
- */
- if (strcmp(token[0], "bc") == 0) {
- if (token_count == 1) {
- result = clear_table();
- return (result);
- }
- else
-
- /* Clear a specific breakpoints */
- if (token_count == 2) {
- result = get_addr_29k_m(token[1], &addr_29k, I_MEM);
- if (result != 0)
- return (result);
- result = addr_29k_ok(&addr_29k);
- if (result != 0)
- return (result);
- if (addr_29k.memory_space == (INT32) GENERIC_SPACE)
- addr_29k.memory_space = (INT32) I_MEM;
- result = clear_bkpt(addr_29k);
- return (result);
- }
- else /* token_count != 1 or 2 */
- return (EMSYNTAX);
- }
- else
-
- /*
- ** Set breakpoint(s)
- */
-
- if ((strcmp(token[0], "b") == 0) ||
- (strcmp(token[0], "b050p") == 0) ||
- (strcmp(token[0], "b050v") == 0) ||
- (strcmp(token[0], "b050") == 0)) { /* b050 defaults to b050p */
-
- if (strcmp(token[0], "b") == 0)
- bkpt_type = BKPT_29000;
- else
- if (strcmp(token[0], "b050p") == 0)
- bkpt_type = BKPT_29050_BTE_0; /* translation disabled */
- else
- if (strcmp(token[0], "b050v") == 0)
- bkpt_type = BKPT_29050_BTE_1;
- else
- if (strcmp(token[0], "b050") == 0)
- bkpt_type = BKPT_29050_BTE_0; /* translation disabled */
- else
- return (EMSYNTAX);
-
- if (token_count == 1) {
- result = show_table();
- return (result);
- }
- else
-
- /* Set breakpoint with pass count of 1 */
- if (token_count == 2) {
- result = get_addr_29k_m(token[1], &addr_29k, I_MEM);
- if (result != 0)
- return (result);
- result = addr_29k_ok(&addr_29k);
- if (result != 0)
- return (result);
- /* The TIP checks the memory space for acceptance */
- if (addr_29k.memory_space == (INT32) GENERIC_SPACE)
- addr_29k.memory_space = (INT32) I_MEM;
- result = set_bkpt(addr_29k, (INT32) 1, bkpt_type);
- return (result);
- }
- else
-
- /* Set breakpoint with pass count */
- if (token_count == 3) {
- result = get_addr_29k_m(token[1], &addr_29k, I_MEM);
- if (result != 0)
- return (result);
- result = addr_29k_ok(&addr_29k);
- if (result != 0)
- return (result);
- result = get_word_decimal(token[2], &pass_count);
- if (result != 0)
- return (EMSYNTAX);
- if (addr_29k.memory_space == (INT32) GENERIC_SPACE)
- addr_29k.memory_space = (INT32) I_MEM;
- result = set_bkpt(addr_29k, pass_count, bkpt_type);
- return (result);
- }
- else /* too many parms for set breakpoint */
- return (EMSYNTAX);
- }
- else /* not a proper 'b" command */
- return (EMSYNTAX);
-
- } /* end bkpt_cmd() */
-
-
-
-/*
-** Functions used by bkpt_cmd()
-*/
-
-
-/*
-** This function is used to remove a breakpoint from the
-** target and from the host breakpoint table.
-*/
-
-INT32
-clear_bkpt(addr_29k)
- struct addr_29k_t addr_29k;
-{
- int breakid;
- INT32 retval;
-
- (void) match_entry (addr_29k.address,
- addr_29k.memory_space,
- &breakid);
-
- /* Did we find the breakpoint? */
- if (breakid <= (int) 0) {
- warning (EMBKPTRM);
- return (FAILURE);
- };
-
- /* if a valid breakpoint entry is found */
- if ((retval = Mini_bkpt_rm (breakid)) != SUCCESS) {
- return(FAILURE);
- } else if (retval == SUCCESS) {
- /* remove breakpoint from table */
- if (remove_from_table(breakid) != SUCCESS) {
- /* this shouldn't occur */
- return(FAILURE);
- };
- return(SUCCESS);
- };
-
-} /* end clear_bkpt() */
-
-
-
-/*
-** This function is used to set a breakpoint on the
-** target and in the host breakpoint table.
-*/
-
-INT32
-set_bkpt(addr_29k, pass_count, bkpt_type)
- struct addr_29k_t addr_29k;
- INT32 pass_count;
- INT32 bkpt_type;
- {
- INT32 retval;
- int breakid;
-
- /* is there one already at the same place */
- (void) match_entry(addr_29k.address,
- addr_29k.memory_space,
- &breakid);
-
- if (breakid > (int) 0) {
- warning (EMBKPTUSED);
- return (FAILURE);
- };
-
- /* else set the breakpoint */
- breakid = (int) 0;
- if ((retval = Mini_bkpt_set (addr_29k.memory_space,
- addr_29k.address,
- pass_count,
- bkpt_type,
- &breakid)) != SUCCESS) {
- return(FAILURE);
- } else {
- /* Add breakpoint to table */
- if (breakid > (int) 0) { /* double checking */
- return (add_to_table(addr_29k.address,
- addr_29k.memory_space,
- pass_count,
- bkpt_type,
- breakid));
- };
- return(FAILURE);
- };
-} /* end set_bkpt() */
-
-
-
-INT32
-add_to_table(offset, space, passcnt, bktype, id )
-ADDR32 offset;
-INT32 space;
-INT32 passcnt;
-INT32 bktype;
-int id;
-{
- struct bkpt_t *temp, *temp2;
-
- if ((temp = (struct bkpt_t *) malloc (sizeof(struct bkpt_t))) == NULL) {
- return(EMALLOC);
- } else {
- temp->break_id = id;
- temp->memory_space = space;
- temp->address = offset;
- temp->pass_count = passcnt;
- temp->curr_count = passcnt;
- temp->bkpt_type = bktype;
- temp->next = NULL;
- };
-
- if (bkpt_table == NULL) { /* first element */
- bkpt_table = temp;
- } else { /* add at end */
- temp2 = bkpt_table;
- while (temp2->next != NULL)
- temp2 = temp2->next;
- temp2->next = temp; /* add */
- }
- return(SUCCESS);
-}
-
-INT32
-match_entry(offset, space, id)
-ADDR32 offset;
-INT32 space;
-int *id;
-{
- struct bkpt_t *temp;
-
- if (bkpt_table == NULL) { /* empty, so no match */
- *id = (int) 0;
- return(SUCCESS);
- } else {
- temp = bkpt_table;
- if ((temp->address == offset) &&
- (temp->memory_space == space)) { /* match */
- *id = temp->break_id;
- return(SUCCESS);
- } else {
- while (temp->next != NULL) {
- if ((temp->next->address == offset) &&
- (temp->next->memory_space == space)) {
- *id = temp->next->break_id;
- return(SUCCESS);
- } else {
- temp = temp->next;
- };
- }
- *id = (int) 0;
- return(SUCCESS);
- };
- };
-}
-
-INT32
-remove_from_table(id)
-int id;
-{
- struct bkpt_t *temp;
-
- if (bkpt_table == NULL) { /* empty table */
- return(FAILURE);
- } else {
- temp = bkpt_table;
- if (bkpt_table->break_id == id) { /* remove first element */
- bkpt_table = bkpt_table->next;
- return(SUCCESS);
- } else {
- while (temp->next != NULL) {
- if (temp->next->break_id == id) {
- temp->next = temp->next->next;
- return(SUCCESS);
- } else {
- temp = temp->next;
- };
- }
- return(FAILURE);
- };
- }
-}
-
-INT32
-clear_table()
-{
- struct bkpt_t *tmp;
- INT32 retval;
-
-
- if (bkpt_table == NULL) { /* no entries */
- fprintf(stderr, "no breakpoints in use.\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "no breakpoints in use.\n");
- } else {
- while (bkpt_table) {
- if ((retval = Mini_bkpt_rm (bkpt_table->break_id)) != SUCCESS) {
- return(FAILURE);
- } else if (retval == SUCCESS) {
- /* remove breakpoint from table */
- tmp = bkpt_table;
- bkpt_table = bkpt_table->next;
- (void) free ((char *) tmp);
- };
- };
- }
- return(SUCCESS);
-}
-
-INT32
-show_table()
-{
- struct bkpt_t *temp;
- INT32 retval;
- ADDR32 temp_addr;
- INT32 temp_space;
- INT32 curr_count;
- INT32 temp_passcnt, temp_bktype;
- int i;
-
- if (bkpt_table == NULL) { /* no entries */
- } else {
- do {
- temp = bkpt_table;
- bkpt_table = bkpt_table->next;
- (void) free ((char *) temp);
- } while (bkpt_table != NULL);
- };
-
- for (i = 1;1;i++) {
- retval = Mini_bkpt_stat( i,
- &temp_addr,
- &temp_space,
- &temp_passcnt,
- &temp_bktype,
- &curr_count);
- if ((retval == (INT32) MONBreakInvalid) ||
- (retval == (INT32) FAILURE)) {
- continue;
- } else if (retval == (INT32) MONBreakNoMore) {
- return (SUCCESS);
- } else {
- /* add entry in the table */
- if ((retval = add_to_table ((ADDR32) temp_addr,
- (INT32) temp_space,
- (INT32) temp_passcnt,
- (INT32) temp_bktype,
- i)) != SUCCESS)
- return (retval);
- /* Mark Am29050 breakpoints with a '*' */
- if (temp_bktype == BKPT_29050)
- fprintf(stderr, "*");
- else
- fprintf(stderr, " ");
- fprintf(stderr, "(%#05d: %#08lx[%#02d])\n", i,
- temp_addr,
- temp_passcnt);
- if (io_config.echo_mode == (INT32) TRUE) {
- if (temp_bktype == BKPT_29050)
- fprintf(io_config.echo_file, "*");
- else
- fprintf(io_config.echo_file, " ");
- fprintf(io_config.echo_file, "(%#05d: %#08lx[%#02d])\n", i,
- temp_addr,
- temp_passcnt);
- }
- };
- }
- return(SUCCESS);
-}
-
+++ /dev/null
-static char _[] = " @(#)commands.c 5.23 93/08/23 15:30:30, Srini, AMD ";
-/******************************************************************************
- * Copyright 1992 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- ** This file contains the functions associated with
- ** commands used by the main program. In general,
- ** the commands in this file are fairly simple and
- ** were not given a source file of their own.
- *****************************************************************************
- */
-
-#include <stdio.h>
-#include <ctype.h>
-#include "memspcs.h"
-#include "main.h"
-#include "monitor.h"
-#include "macros.h"
-#include "help.h"
-#include "miniint.h"
-#include "error.h"
-
-#ifdef MSDOS
-#include <stdlib.h>
-#include <string.h>
-#else
-#include <strings.h>
-#endif
-
-
-extern int get_addr_29k PARAMS((char *, struct addr_29k_t *));
-extern int addr_29k_ok PARAMS((struct addr_29k_t *));
-
-extern int get_word PARAMS((char *, INT32 *));
-
-/*
-** Global variables
-*/
-
-static char *processor_name[] = {
- /* 0 */ "Am29000",
- /* 1 */ "Am29005",
- /* 2 */ "Am29050",
- /* 3 */ "Am29035",
- /* 4 */ "Am29030",
- /* 5 */ "Am29200",
- /* 6 */ "Am29240",
- /* 7 */ "Cougar",
- /* 8 */ "TBA",
- /* 9 */ "TBA"
- };
-#define NO_PROCESSOR 9
-
-static char *coprocessor_name[] = {
- /* 0 */ "None",
- /* 1 */ "Am29027 (revision A)",
- };
-
-static char *io_control_name[] = {
- /* 0 */ "Console controlled by target.",
- /* 1 */ "Console controlled by host."
- };
-
-
-
-/*
-** This command is used to print out the configuration
-** of the system. This includes both host and target
-** configurations.
-**
-** This command also re-allocates the message buffers
-** and the breakpoint array. This permits this command
-** to be used to re-configure the host for a new target
-** without restarting the monitor. This is useful in cases
-** where the target is reset or changed.
-*/
-
-INT32
-config_cmd(token, token_count)
- char *token[];
- int token_count;
- {
- int processor;
- int coprocessor;
- char revision;
- char prtbuf[256];
-
- INT32 retval;
-
-
- /* Get target CONFIG */
- if ((retval = Mini_config_req(&target_config, &versions_etc)) != SUCCESS) {
- return(retval);
- };
- /* If returned SUCCESSfully do the rest */
-
-
-
- /* Print out configuration information
- ** Note: a -1 is no coprocessor present, 0 is an
- ** Am29027 (revision A), etc ... To get
- ** the array index for the coprocessor_name,
- ** add one to the target_config.coprocessor.
- */
-
-/* ----------------------------------------------------------------- */
- sprintf(&prtbuf[0], "\n");
- sprintf(&prtbuf[strlen(prtbuf)], " MiniMON29K R 3.0 Debugger Front End.\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "%s", &prtbuf[0]);
- fprintf (stderr, "%s", &prtbuf[0]);
-
-/* ----------------------------------------------------------------- */
- sprintf(&prtbuf[0], " Copyright 1993 Advanced Micro Devices, Inc.\n");
- sprintf(&prtbuf[strlen(prtbuf)], " Version %s (%s)\n",
- host_config.version,
- host_config.date);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "%s", &prtbuf[0]);
- fprintf (stderr, "%s", &prtbuf[0]);
-
-/* ----------------------------------------------------------------- */
- sprintf(&prtbuf[0], "\n");
- if (target_config.processor_id == (UINT32) -1)
- sprintf(&prtbuf[strlen(prtbuf)], "\tProcessor type: %s \n", processor_name[NO_PROCESSOR]);
-
- else {
-
- if ((target_config.processor_id & 0x58) == 0x58) {
- revision = (char) ('A' + (target_config.processor_id & 0x07));
- sprintf(&prtbuf[strlen(prtbuf)], "\tProcessor type: %s (revision %c)\n", "Am29205", (char) revision);
-
- } else {
-
- processor = (int) (target_config.processor_id >> 4);
- revision = (char) ('A' + (target_config.processor_id & 0x0f));
- sprintf(&prtbuf[strlen(prtbuf)], "\tProcessor type: %s (revision %c)\n", processor_name[processor], revision);
-
- }
-
- }
-
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "%s", &prtbuf[0]);
- fprintf (stderr, "%s", &prtbuf[0]);
-/* ----------------------------------------------------------------- */
- coprocessor = (int) target_config.coprocessor + 1;
- sprintf(&prtbuf[0], "\tCoprocessor: %s\n",
- coprocessor_name[coprocessor]);
-/* ----------------------------------------------------------------- */
- if ((target_config.ROM_start == (ADDR32) -1) &&
- (target_config.ROM_size == (INT32) -1)) {
- sprintf(&prtbuf[strlen(prtbuf)], "\tROM range: Unavailable\n");
- } else {
- sprintf(&prtbuf[strlen(prtbuf)], "\tROM range: 0x%lx to 0x%lx (%luK)\n",
- target_config.ROM_start,
- (target_config.ROM_start + (ADDR32) target_config.ROM_size - 1),
- (unsigned long) target_config.ROM_size/1024);
- }
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "%s", &prtbuf[0]);
- fprintf (stderr, "%s", &prtbuf[0]);
-/* ----------------------------------------------------------------- */
- if ((target_config.I_mem_start == (ADDR32) -1) &&
- (target_config.I_mem_size == (INT32) -1)) {
- sprintf(&prtbuf[0], "\tInstruction memory range: Unavailable\n");
- } else {
- sprintf(&prtbuf[0], "\tInstruction memory range: 0x%lx to 0x%lx (%luK)\n",
- target_config.I_mem_start,
- (target_config.I_mem_start + (ADDR32) target_config.I_mem_size - 1),
- (unsigned long) target_config.I_mem_size/1024);
- }
-/* ----------------------------------------------------------------- */
- if ((target_config.D_mem_start == (ADDR32) -1) &&
- (target_config.D_mem_size == (INT32) -1)) {
- sprintf(&prtbuf[strlen(prtbuf)], "\tData memory range: Unavailable\n");
- } else {
- sprintf(&prtbuf[strlen(prtbuf)], "\tData memory range: 0x%lx to 0x%lx (%luK)\n",
- target_config.D_mem_start,
- (target_config.D_mem_start + (ADDR32) target_config.D_mem_size - 1),
- (unsigned long) target_config.D_mem_size/1024);
- }
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "%s", &prtbuf[0]);
- fprintf (stderr, "%s", &prtbuf[0]);
-/* ----------------------------------------------------------------- */
- sprintf(&prtbuf[0], "\n");
- sprintf(&prtbuf[strlen(prtbuf)], "\t (Enter 'h' or '?' for help)\n");
- sprintf(&prtbuf[strlen(prtbuf)], "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "%s", &prtbuf[0]);
- fprintf (stderr, "%s", &prtbuf[0]);
-/* ----------------------------------------------------------------- */
-
- return (SUCCESS);
-
- } /* end config_cmd() */
-
-
-
-
-/*
-** This command is used to print out help information.
-*/
-
-INT32
-help_cmd(token, token_count)
- char *token[];
- int token_count;
- {
- int i;
- char **help_ptr;
-
- if (((strcmp(token[0], "h") != 0) &&
- (strcmp(token[0], "?") != 0)) ||
- (token_count > 2))
- return (EMSYNTAX);
-
- if (token_count == 1) {
- help_ptr = help_main;
- }
- else
- /* Print command-specific help line */
- if (token_count == 2)
- switch (*token[1]) {
- case 'a': help_ptr = help_a;
- break;
- case 'b': help_ptr = help_b;
- break;
- case 'c':
- if (strcmp(token[1], "caps") == 0)
- help_ptr = help_caps;
- else if (strcmp(token[1], "cp") == 0)
- help_ptr = help_cp;
- else if (strcmp(token[1], "con") == 0)
- help_ptr = help_con;
- else if (strcmp(token[1], "ch0") == 0)
- help_ptr = help_ch0;
- else
- help_ptr = help_c;
- break;
- case 'd': help_ptr = help_d;
- if (strcmp(token[1], "disc") == 0)
- help_ptr = help_disc;
- else if (strcmp(token[1], "dp") == 0)
- help_ptr = help_dp;
- break;
- case 'e': help_ptr = help_e;
- if (strcmp(token[1], "ex") == 0)
- help_ptr = help_ex;
- else if (strcmp(token[1], "esc") == 0)
- help_ptr = help_esc;
- else if (strcmp(token[1], "eon") == 0)
- help_ptr = help_eon;
- else if (strcmp(token[1], "eoff") == 0)
- help_ptr = help_eon;
- break;
- case 'f': help_ptr = help_f;
- break;
- case 'g': help_ptr = help_g;
- break;
- case 'h': help_ptr = help_h;
- break;
- case 'i': help_ptr = help_i;
- if (strcmp (token[1],"init") == 0)
- help_ptr = help_init;
- break;
- case 'k': help_ptr = help_k;
- break;
- case 'l': help_ptr = help_l;
- if (strcmp (token[1], "logon") == 0)
- help_ptr = help_logon;
- else if (strcmp (token[1], "logoff") == 0)
- help_ptr = help_logon;
- break;
- case 'm': help_ptr = help_m;
- break;
- case 'p': help_ptr = help_pid;
- break;
- case 'q': help_ptr = help_q;
- if (strcmp(token[1], "qon") == 0)
- help_ptr = help_qoff;
- else if (strcmp(token[1], "qoff") == 0)
- help_ptr = help_qoff;
- break;
- case 'r': help_ptr = help_r;
- break;
- case 's': help_ptr = help_s;
- if (strcmp(token[1], "sid") == 0)
- help_ptr = help_sid;
- break;
- case 't': help_ptr = help_t;
- if (strcmp(token[1], "tip") == 0)
- help_ptr = help_tip;
- break;
- case 'x': help_ptr = help_x;
- break;
- case 'y': help_ptr = help_y;
- break;
- case 'z': help_ptr = help_zc;
- if (strcmp(token[1], "ze") == 0)
- help_ptr = help_ze;
- else if (strcmp(token[1], "zl") == 0)
- help_ptr = help_zl;
- break;
- default: help_ptr = help_main;
- break;
- } /* end switch */
- else
- /* Too many parameters */
- return (EMSYNTAX);
-
-
- i=0;
- while (*help_ptr[i] != '\0') {
- fprintf(stderr, "\n%s", help_ptr[i]);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "\n%s", help_ptr[i]);
- i=i+1;
- } /* end while */
- fprintf(stderr, "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n");
-
- return (SUCCESS);
- } /* end help_cmd() */
-
-
-
-/*
-** This command toggles control of the keyboard between
-** TERM_USER and TERM_29K.
-**
-** IMPORTANT NOTE
-** This command is no longer used. It was an attempt to
-** toggle control between the host and the target when the
-** target is displaying output and accepting input.
-** The UDI methodology allows this control to be handled by the
-** UDIWait procedures. Hence, this io_toggle_cmd is not used.
-** It is left here only as an historical anomoly
-**
-** The i command is now used for ix, ia, il the 2903x cashe
-** which is contained in the monitor.c code.
-** END OF IMPORTANT NOTE
-*/
-
-INT32
-io_toggle_cmd(token, token_count)
- char *token[];
- int token_count;
- {
-
- if ((strcmp(token[0], "io_toggle") != 0) ||
- (token_count != 1))
- return (EMSYNTAX);
-
- if (io_config.io_control == TERM_29K)
- io_config.io_control = TERM_USER;
- else
- if (io_config.io_control == TERM_USER)
- io_config.io_control = TERM_29K;
- else
- return(EMFAIL);
-
- fprintf(stderr, "%s\n", io_control_name[io_config.io_control]);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "%s\n", io_control_name[io_config.io_control]);
-
- return(0);
-
- } /* end io_toggle_cmd() */
-
-
-
-
-/*
-** This command send a BREAK message to the target. This
-** should halt execution of user code. A HALT message should
-** be returned by the target. This function deos not, however,
-** wait for the HALT message.
-*/
-
-INT32
-kill_cmd(token, token_count)
- char *token[];
- int token_count;
- {
- int result;
- INT32 retval;
-
- result = -1;
- if ((strcmp(token[0], "k") != 0) ||
- (token_count != 1))
- return (EMSYNTAX);
-
- if ((retval = Mini_break()) != SUCCESS) {
- return(FAILURE);
- };
- return(SUCCESS);
-
- } /* end kill_cmd() */
-
-
-
-/*
-** This command send a RESET message to the target. This
-** should restart the target code. A HALT message should
-** be returned by the target. This function deos not, however,
-** wait for the HALT message.
-*/
-
-INT32
-reset_cmd(token, token_count)
- char *token[];
- int token_count;
- {
- int result;
- INT32 retval;
-
- result = -1;
- if ((strcmp(token[0], "r") != 0) ||
- (token_count != 1))
- return (EMSYNTAX);
-
- if ((retval = Mini_reset_processor()) != SUCCESS) {
- return(FAILURE);
- } else
- return(SUCCESS);
-
- } /* end reset_cmd() */
-
-
-
-
-
-
-
-/*
-** This command is used to display the versions of the various
-** MINIMON 29K modules. First the version of the host code and
-** its date is printed from the global data structure "host_config".
-** Next the montip version field and date is printed from
-** the VERSION_SPACE UDIRead call. This is an ascii zero terminated
-** field of ** less than 11 characters.
-** Next the "version" field in the "target_config" data structure is
-** printed. This "version field is encoded as follows:
-**
-** Bits 0 - 7: Target debug core version
-** Bits 8 - 15: Configuration version
-** Bits 16 - 23: Message system version
-** Bits 24 - 31: Communication driver version
-**
-** Each eight bit field is further broken up into two four bit
-** fields. The first four bits is the "release" number, the
-** second is the "version" number. This is typically printed
-** as <version>.<release>. i.e. version=2, release=6 is
-** printed as "2.6".
-**
-*/
-
-/*
-** The os version number is coded into the eighth word of the
-**configuration message. It is in the lower 8 bits.
-** Bits 0 - 7: OS version
-**
-*/
-
-INT32
-version_cmd(token, token_count)
- char *token[];
- int token_count;
- {
- int comm_version;
- int message_version;
- int config_version;
- int debug_core_version;
- char tip_version[12];
- char tip_date[12];
- int os_version; /* eighth word of config message */
- INT32 junk;
- char prtbuf[256];
- INT32 retval;
-
- if ((strcmp(token[0], "ver") != 0) ||
- (token_count != 1))
- return (EMSYNTAX);
-
-/* byte count is 40 because 4 bytes for target version
- 4 bytes for os version
- 12 bytes for tip version
- 12 bytes for tip date
- 4 for msgbuf size
- 4 for max bkpts */
- if ((retval = Mini_read_req ((INT32) VERSION_SPACE,
- (ADDR32) 0,
- (INT32) 1,
- (INT16) 40,
- (INT32 *) &junk,
- (BYTE *) &(versions_etc.version),
- TRUE)) != SUCCESS)
- return (FAILURE);
-
- comm_version = (int) ((versions_etc.version >> 24) & 0x00ff);
- message_version = (int) ((versions_etc.version >> 16) & 0x00ff);
- config_version = (int) ((versions_etc.version >> 8) & 0x00ff);
- debug_core_version = (int) ((versions_etc.version) & 0x00ff);
- strcpy(tip_version,versions_etc.tip_version);
- strcpy(tip_date,versions_etc.tip_date);
- os_version = (int) ((versions_etc.os_version ) & 0x00ff);
-
-
- sprintf(&prtbuf[0], "\n");
- sprintf(&prtbuf[strlen(prtbuf)], "\n");
- sprintf(&prtbuf[strlen(prtbuf)], " MiniMON29K R3.0\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "%s", &prtbuf[0]);
- fprintf (stderr, "%s", &prtbuf[0]);
- sprintf(&prtbuf[0], " Copyright 1993 Advanced Micro Devices, Inc.\n");
- sprintf(&prtbuf[strlen(prtbuf)], "\n");
-
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "%s", &prtbuf[0]);
- fprintf (stderr, "%s", &prtbuf[0]);
- sprintf(&prtbuf[0], "\t Host code:\n");
- sprintf(&prtbuf[strlen(prtbuf)], "\t\t Version %s\n",
- host_config.version);
- sprintf(&prtbuf[strlen(prtbuf)], "\t\t Date: %s\n",
- host_config.date);
- sprintf(&prtbuf[strlen(prtbuf)], "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "%s", &prtbuf[0]);
- fprintf (stderr, "%s", &prtbuf[0]);
-
- sprintf(&prtbuf[0], "\t Tip code:\n");
- sprintf(&prtbuf[strlen(prtbuf)], "\t\t Version %s\n",
- tip_version);
- sprintf(&prtbuf[strlen(prtbuf)], "\t\t Date: %s\n",
- tip_date);
- sprintf(&prtbuf[strlen(prtbuf)], "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "%s", &prtbuf[0]);
- fprintf (stderr, "%s", &prtbuf[0]);
-
- sprintf(&prtbuf[0], "\t Target code:\n");
- sprintf(&prtbuf[strlen(prtbuf)], "\t\t Debug core version: %d.%d\n",
- ((debug_core_version >> 4) & 0x0f),
- (debug_core_version & 0x0f));
- sprintf(&prtbuf[strlen(prtbuf)], "\t\t Configuration version: %d.%d\n",
- ((config_version >> 4) & 0x0f),
- (config_version & 0x0f));
- sprintf(&prtbuf[strlen(prtbuf)], "\t\t Message system version: %d.%d\n",
- ((message_version >> 4) & 0x0f),
- (message_version & 0x0f));
- sprintf(&prtbuf[strlen(prtbuf)], "\t\t Communication driver version: %d.%d\n",
- ((comm_version >> 4) & 0x0f),
- (comm_version & 0x0f));
-
- sprintf(&prtbuf[strlen(prtbuf)], "\t\t OS system version: %d.%d\n",
- ((os_version >> 4) & 0x0f),
- (os_version & 0x0f));
-
-
- sprintf(&prtbuf[strlen(prtbuf)], "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "%s", &prtbuf[0]);
- fprintf (stderr, "%s", &prtbuf[0]);
-
- fprintf(stderr, "Maximum message buffer size on target: 0x%lx\n",versions_etc.max_msg_size);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "Maximum message buffer size on target: 0x%lx\n",versions_etc.max_msg_size);
- fprintf(stderr, "Maximum number of breakpoints on target: %ld\n", versions_etc.max_bkpts);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "Maximum message buffer size on target: 0x%lx\n",versions_etc.max_msg_size);
- return (SUCCESS);
-
- } /* end version_cmd() */
-
-
-
+++ /dev/null
-static char _[] = " @(#)dasm.c 5.22 93/08/11 11:43:53, Srini, AMD";
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- **
- ** This code is used to disasseble Am29000 instructions. Each
- ** instruction is treated as four sequential bytes representing
- ** the instruction in big endian format. This should permit the
- ** code to run on both big and little endian machines, provided
- ** that the buffer containing the instructions is in big endian
- ** format.
- **
- *****************************************************************************
- */
-
-#include <stdio.h>
-#include <string.h>
-#ifdef MSDOS
-#include <stdlib.h>
-#endif
-#include "opcodes.h"
-#include "memspcs.h"
-#include "main.h"
-#include "monitor.h"
-#include "miniint.h"
-#include "error.h"
-
-
-/*
-** There are approximately 23 different instruction formats for the
-** Am29000. Instructions are disassembled using one of these formats.
-** It should be noted that more compact code for doing diassembly
-** could have been produced. It was decided that this approach was
-** the easiest to understand and modify and that the structure would
-** lend itself to the possibility of automatic code generation in
-** future disassemblers (a disassembler-compiler?).
-**
-** Also note that these functions will correctly disassemble
-** instructions in a buffer in big endian format. Since the data is
-** read in from the target as a stream of bytes, no conversion should
-** be necessary. This disassembly code should work on either big or
-** little endian hosts.
-**
-** Note: Opcodes in the "switch" statement are sorted in numerical
-** order.
-**
-** Note2: CLASS, CONVERT, SQRT may require a different format.
-**
-*/
-
-
-int get_addr_29k_m PARAMS((char *, struct addr_29k_t *, INT32));
-int addr_29k_ok PARAMS((struct addr_29k_t *));
-void convert32 PARAMS((BYTE *));
-INT32 match_entry PARAMS((ADDR32 offset,
- INT32 space,
- int *id,
- struct bkpt_t **table));
-
-void dasm_instr PARAMS((ADDR32, struct instr_t *));
-
-void dasm_undefined PARAMS((struct instr_t *, ADDR32));
-void dasm_ra_const16n PARAMS((struct instr_t *, ADDR32));
-void dasm_ra_const16h PARAMS((struct instr_t *, ADDR32));
-void dasm_ra_const16 PARAMS((struct instr_t *, ADDR32));
-void dasm_spid_const16 PARAMS((struct instr_t *, ADDR32));
-void dasm_ce_cntl_ra_rb PARAMS((struct instr_t *, ADDR32));
-void dasm_ce_cntl_ra_const8 PARAMS((struct instr_t *, ADDR32));
-void dasm_rc_rb PARAMS((struct instr_t *, ADDR32));
-void dasm_rc_const8 PARAMS((struct instr_t *, ADDR32));
-void dasm_rc_ra_rb PARAMS((struct instr_t *, ADDR32));
-void dasm_rc_ra_const8 PARAMS((struct instr_t *, ADDR32));
-void dasm_vn_ra_rb PARAMS((struct instr_t *, ADDR32));
-void dasm_vn_ra_const8 PARAMS((struct instr_t *, ADDR32));
-void dasm_rc_ra PARAMS((struct instr_t *, ADDR32));
-void dasm_none PARAMS((struct instr_t *, ADDR32));
-void dasm_one PARAMS((struct instr_t *, ADDR32));
-void dasm_atarget PARAMS((struct instr_t *, ADDR32));
-void dasm_rtarget PARAMS((struct instr_t *, ADDR32));
-void dasm_ra_rtarget PARAMS((struct instr_t *, ADDR32));
-void dasm_ra_atarget PARAMS((struct instr_t *, ADDR32));
-void dasm_ra_rb PARAMS((struct instr_t *, ADDR32));
-void dasm_rb PARAMS((struct instr_t *, ADDR32));
-void dasm_rc_spid PARAMS((struct instr_t *, ADDR32));
-void dasm_spid_rb PARAMS((struct instr_t *, ADDR32));
-void dasm_dc_ra_rb PARAMS((struct instr_t *, ADDR32));
-void dasm_convert PARAMS((struct instr_t *, ADDR32));
-
-
-
-INT32
-dasm_cmd(token, token_count)
- char *token[];
- int token_count;
- {
- static INT32 memory_space=I_MEM;
- static ADDR32 address=0;
- INT32 byte_count=(16*sizeof(INST32));
- int i;
- int result;
- INT32 bytes_returned;
- int bkpt_index;
- struct instr_t instr;
- struct addr_29k_t addr_29k;
- struct addr_29k_t addr_29k_start;
- struct addr_29k_t addr_29k_end;
-
- INT32 retval;
- INT32 hostendian;
- BYTE *read_buffer;
-
-
- /* Is it an 'l' (disassemble) command? */
- if (strcmp(token[0], "l") != 0)
- return (EMSYNTAX);
-
- /*
- ** Parse parameters
- */
-
- if (token_count == 1) {
- address = (address & 0xfffffffc) + byte_count;
- }
- else
- if (token_count == 2) {
- result = get_addr_29k_m(token[1], &addr_29k_start, I_MEM);
- if (result != 0)
- return (EMSYNTAX);
- result = addr_29k_ok(&addr_29k_start);
- if (result != 0)
- return (result);
- address = (addr_29k_start.address & 0xfffffffc);
- memory_space = addr_29k_start.memory_space;
- }
- else
- if (token_count == 3) {
- result = get_addr_29k_m(token[1], &addr_29k_start, I_MEM);
- if (result != 0)
- return (EMSYNTAX);
- result = addr_29k_ok(&addr_29k_start);
- if (result != 0)
- return (result);
- result = get_addr_29k_m(token[2], &addr_29k_end, I_MEM);
- if (result != 0)
- return (EMSYNTAX);
- result = addr_29k_ok(&addr_29k_end);
- if (result != 0)
- return (result);
- if (addr_29k_start.memory_space != addr_29k_end.memory_space)
- return (EMBADADDR);
- if (addr_29k_start.address > addr_29k_end.address)
- return (EMBADADDR);
- address = (addr_29k_start.address & 0xfffffffc);
- memory_space = addr_29k_start.memory_space;
- byte_count = (addr_29k_end.address & 0xfffffffc) -
- (addr_29k_start.address & 0xfffffffc) +
- sizeof(INT32);
- }
- else
- /* Too many args */
- return (EMSYNTAX);
-
- /* Will the data overflow the message buffer? Done in TIP */
-
- if ((read_buffer = (BYTE *) malloc((unsigned int) byte_count)) == NULL) {
- warning(EMALLOC);
- return(FAILURE);
- };
-
- hostendian = FALSE;
- if ((retval = Mini_read_req(memory_space,
- address,
- (byte_count/4),
- (INT16) 4, /* I_MEM/I_ROM always size 4 */
- &bytes_returned,
- read_buffer,
- hostendian)) != SUCCESS) {
- return(FAILURE);
- } else if (retval == SUCCESS) {
- for (i=0; i<(int)(bytes_returned*4); i=i+sizeof(INST32)) {
-
- addr_29k.memory_space = memory_space;
- addr_29k.address = address + (ADDR32) i;
-
- if (host_config.target_endian == LITTLE) {
- instr.op = read_buffer[i+3];
- instr.c = read_buffer[i+2];
- instr.a = read_buffer[i+1];
- instr.b = read_buffer[i];
- } else { /* BIG endian assumed */
- instr.op = read_buffer[i];
- instr.c = read_buffer[i+1];
- instr.a = read_buffer[i+2];
- instr.b = read_buffer[i+3];
- }
-
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "%08lx ", addr_29k.address);
- fprintf(stderr, "%08lx ", addr_29k.address);
-
- /* Is there an breakpoint at this location? */
- match_entry(addr_29k.address, addr_29k.memory_space, &bkpt_index, &bkpt_table);
- if (io_config.echo_mode == (INT32) TRUE)
- if (bkpt_index <= (int) 0)
- fprintf(io_config.echo_file, "%02x%02x%02x%02x ", instr.op, instr.c,
- instr.a, instr.b);
- else
- fprintf(io_config.echo_file, "%02x%02x%02x%02x *", instr.op, instr.c,
- instr.a, instr.b);
-
- if (bkpt_index <= (int) 0)
- fprintf(stderr, "%02x%02x%02x%02x ", instr.op, instr.c,
- instr.a, instr.b);
- else
- fprintf(stderr, "%02x%02x%02x%02x *", instr.op, instr.c,
- instr.a, instr.b);
-
- dasm_instr((address + (ADDR32) i),
- &instr);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n");
- fprintf(stderr, "\n");
- } /* end for loop */
- };
-
- (void) free ((char *) read_buffer);
- return (0);
- }
-
-
-
-/*
-** This function is used to disassemble a singe Am29000 instruction.
-** A pointer to the next free space in the buffer is returned.
-*/
-
-
-void
-dasm_instr(addr, instr)
- ADDR32 addr;
- struct instr_t *instr;
- {
-
- switch (instr->op) {
-
- /* Opcodes 0x00 to 0x0F */
- case ILLEGAL_00: dasm_undefined(instr, addr);
- break;
- case CONSTN: dasm_ra_const16n(instr, addr);
- break;
- case CONSTH: dasm_ra_const16h(instr, addr);
- break;
- case CONST: dasm_ra_const16(instr, addr);
- break;
- case MTSRIM: dasm_spid_const16(instr, addr);
- break;
- case CONSTHZ: dasm_ra_const16(instr, addr);
- break;
- case LOADL0: dasm_ce_cntl_ra_rb(instr, addr);
- break;
- case LOADL1: dasm_ce_cntl_ra_const8(instr, addr);
- break;
- case CLZ0: dasm_rc_rb(instr, addr);
- break;
- case CLZ1: dasm_rc_const8(instr, addr);
- break;
- case EXBYTE0: dasm_rc_ra_rb(instr, addr);
- break;
- case EXBYTE1: dasm_rc_ra_const8(instr, addr);
- break;
- case INBYTE0: dasm_rc_ra_rb(instr, addr);
- break;
- case INBYTE1: dasm_rc_ra_const8(instr, addr);
- break;
- case STOREL0: dasm_ce_cntl_ra_rb(instr, addr);
- break;
- case STOREL1: dasm_ce_cntl_ra_const8(instr, addr);
- break;
-
- /* Opcodes 0x10 to 0x1F */
- case ADDS0: dasm_rc_ra_rb(instr, addr);
- break;
- case ADDS1: dasm_rc_ra_const8(instr, addr);
- break;
- case ADDU0: dasm_rc_ra_rb(instr, addr);
- break;
- case ADDU1: dasm_rc_ra_const8(instr, addr);
- break;
- case ADD0: dasm_rc_ra_rb(instr, addr);
- break;
- case ADD1: dasm_rc_ra_const8(instr, addr);
- break;
- case LOAD0: dasm_ce_cntl_ra_rb(instr, addr);
- break;
- case LOAD1: dasm_ce_cntl_ra_const8(instr, addr);
- break;
- case ADDCS0: dasm_rc_ra_rb(instr, addr);
- break;
- case ADDCS1: dasm_rc_ra_const8(instr, addr);
- break;
- case ADDCU0: dasm_rc_ra_rb(instr, addr);
- break;
- case ADDCU1: dasm_rc_ra_const8(instr, addr);
- break;
- case ADDC0: dasm_rc_ra_rb(instr, addr);
- break;
- case ADDC1: dasm_rc_ra_const8(instr, addr);
- break;
- case STORE0: dasm_ce_cntl_ra_rb(instr, addr);
- break;
- case STORE1: dasm_ce_cntl_ra_const8(instr, addr);
- break;
-
- /* Opcodes 0x20 to 0x2F */
- case SUBS0: dasm_rc_ra_rb(instr, addr);
- break;
- case SUBS1: dasm_rc_ra_const8(instr, addr);
- break;
- case SUBU0: dasm_rc_ra_rb(instr, addr);
- break;
- case SUBU1: dasm_rc_ra_const8(instr, addr);
- break;
- case SUB0: dasm_rc_ra_rb(instr, addr);
- break;
- case SUB1: dasm_rc_ra_const8(instr, addr);
- break;
- case LOADSET0: dasm_ce_cntl_ra_rb(instr, addr);
- break;
- case LOADSET1: dasm_ce_cntl_ra_const8(instr, addr);
- break;
- case SUBCS0: dasm_rc_ra_rb(instr, addr);
- break;
- case SUBCS1: dasm_rc_ra_const8(instr, addr);
- break;
- case SUBCU0: dasm_rc_ra_rb(instr, addr);
- break;
- case SUBCU1: dasm_rc_ra_const8(instr, addr);
- break;
- case SUBC0: dasm_rc_ra_rb(instr, addr);
- break;
- case SUBC1: dasm_rc_ra_const8(instr, addr);
- break;
- case CPBYTE0: dasm_rc_ra_rb(instr, addr);
- break;
- case CPBYTE1: dasm_rc_ra_const8(instr, addr);
- break;
-
-
- /* Opcodes 0x30 to 0x3F */
- case SUBRS0: dasm_rc_ra_rb(instr, addr);
- break;
- case SUBRS1: dasm_rc_ra_const8(instr, addr);
- break;
- case SUBRU0: dasm_rc_ra_rb(instr, addr);
- break;
- case SUBRU1: dasm_rc_ra_const8(instr, addr);
- break;
- case SUBR0: dasm_rc_ra_rb(instr, addr);
- break;
- case SUBR1: dasm_rc_ra_const8(instr, addr);
- break;
- case LOADM0: dasm_ce_cntl_ra_rb(instr, addr);
- break;
- case LOADM1: dasm_ce_cntl_ra_const8(instr, addr);
- break;
- case SUBRCS0: dasm_rc_ra_rb(instr, addr);
- break;
- case SUBRCS1: dasm_rc_ra_const8(instr, addr);
- break;
- case SUBRCU0: dasm_rc_ra_rb(instr, addr);
- break;
- case SUBRCU1: dasm_rc_ra_const8(instr, addr);
- break;
- case SUBRC0: dasm_rc_ra_rb(instr, addr);
- break;
- case SUBRC1: dasm_rc_ra_const8(instr, addr);
- break;
- case STOREM0: dasm_ce_cntl_ra_rb(instr, addr);
- break;
- case STOREM1: dasm_ce_cntl_ra_const8(instr, addr);
- break;
-
- /* Opcodes 0x40 to 0x4F */
- case CPLT0: dasm_rc_ra_rb(instr, addr);
- break;
- case CPLT1: dasm_rc_ra_const8(instr, addr);
- break;
- case CPLTU0: dasm_rc_ra_rb(instr, addr);
- break;
- case CPLTU1: dasm_rc_ra_const8(instr, addr);
- break;
- case CPLE0: dasm_rc_ra_rb(instr, addr);
- break;
- case CPLE1: dasm_rc_ra_const8(instr, addr);
- break;
- case CPLEU0: dasm_rc_ra_rb(instr, addr);
- break;
- case CPLEU1: dasm_rc_ra_const8(instr, addr);
- break;
- case CPGT0: dasm_rc_ra_rb(instr, addr);
- break;
- case CPGT1: dasm_rc_ra_const8(instr, addr);
- break;
- case CPGTU0: dasm_rc_ra_rb(instr, addr);
- break;
- case CPGTU1: dasm_rc_ra_const8(instr, addr);
- break;
- case CPGE0: dasm_rc_ra_rb(instr, addr);
- break;
- case CPGE1: dasm_rc_ra_const8(instr, addr);
- break;
- case CPGEU0: dasm_rc_ra_rb(instr, addr);
- break;
- case CPGEU1: dasm_rc_ra_const8(instr, addr);
- break;
-
- /* Opcodes 0x50 to 0x5F */
- case ASLT0: dasm_vn_ra_rb(instr, addr);
- break;
- case ASLT1: dasm_vn_ra_const8(instr, addr);
- break;
- case ASLTU0: dasm_vn_ra_rb(instr, addr);
- break;
- case ASLTU1: dasm_vn_ra_const8(instr, addr);
- break;
- case ASLE0: dasm_vn_ra_rb(instr, addr);
- break;
- case ASLE1: dasm_vn_ra_const8(instr, addr);
- break;
- case ASLEU0: dasm_vn_ra_rb(instr, addr);
- break;
- case ASLEU1: dasm_vn_ra_const8(instr, addr);
- break;
- case ASGT0: dasm_vn_ra_rb(instr, addr);
- break;
- case ASGT1: dasm_vn_ra_const8(instr, addr);
- break;
- case ASGTU0: dasm_vn_ra_rb(instr, addr);
- break;
- case ASGTU1: dasm_vn_ra_const8(instr, addr);
- break;
- case ASGE0: dasm_vn_ra_rb(instr, addr);
- break;
- case ASGE1: dasm_vn_ra_const8(instr, addr);
- break;
- case ASGEU0: dasm_vn_ra_rb(instr, addr);
- break;
- case ASGEU1: dasm_vn_ra_const8(instr, addr);
- break;
-
- /* Opcodes 0x60 to 0x6F */
- case CPEQ0: dasm_rc_ra_rb(instr, addr);
- break;
- case CPEQ1: dasm_rc_ra_const8(instr, addr);
- break;
- case CPNEQ0: dasm_rc_ra_rb(instr, addr);
- break;
- case CPNEQ1: dasm_rc_ra_const8(instr, addr);
- break;
- case MUL0: dasm_rc_ra_rb(instr, addr);
- break;
- case MUL1: dasm_rc_ra_const8(instr, addr);
- break;
- case MULL0: dasm_rc_ra_rb(instr, addr);
- break;
- case MULL1: dasm_rc_ra_const8(instr, addr);
- break;
- case DIV0_OP0: dasm_rc_rb(instr, addr);
- break;
- case DIV0_OP1: dasm_rc_const8(instr, addr);
- break;
- case DIV_OP0: dasm_rc_ra_rb(instr, addr);
- break;
- case DIV_OP1: dasm_rc_ra_const8(instr, addr);
- break;
- case DIVL0: dasm_rc_ra_rb(instr, addr);
- break;
- case DIVL1: dasm_rc_ra_const8(instr, addr);
- break;
- case DIVREM0: dasm_rc_ra_rb(instr, addr);
- break;
- case DIVREM1: dasm_rc_ra_const8(instr, addr);
- break;
-
- /* Opcodes 0x70 to 0x7F */
- case ASEQ0: dasm_vn_ra_rb(instr, addr);
- break;
- case ASEQ1: dasm_vn_ra_const8(instr, addr);
- break;
- case ASNEQ0: dasm_vn_ra_rb(instr, addr);
- break;
- case ASNEQ1: dasm_vn_ra_const8(instr, addr);
- break;
- case MULU0: dasm_rc_ra_rb(instr, addr);
- break;
- case MULU1: dasm_rc_ra_const8(instr, addr);
- break;
- case ILLEGAL_76: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_77: dasm_undefined(instr, addr);
- break;
- case INHW0: dasm_rc_ra_rb(instr, addr);
- break;
- case INHW1: dasm_rc_ra_const8(instr, addr);
- break;
- case EXTRACT0: dasm_rc_ra_rb(instr, addr);
- break;
- case EXTRACT1: dasm_rc_ra_const8(instr, addr);
- break;
- case EXHW0: dasm_rc_ra_rb(instr, addr);
- break;
- case EXHW1: dasm_rc_ra_const8(instr, addr);
- break;
- case EXHWS: dasm_rc_ra(instr, addr);
- break;
- case ILLEGAL_7F: dasm_undefined(instr, addr);
- break;
-
- /* Opcodes 0x80 to 0x8F */
- case SLL0: dasm_rc_ra_rb(instr, addr);
- break;
- case SLL1: dasm_rc_ra_const8(instr, addr);
- break;
- case SRL0: dasm_rc_ra_rb(instr, addr);
- break;
- case SRL1: dasm_rc_ra_const8(instr, addr);
- break;
- case ILLEGAL_84: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_85: dasm_undefined(instr, addr);
- break;
- case SRA0: dasm_rc_ra_rb(instr, addr);
- break;
- case SRA1: dasm_rc_ra_const8(instr, addr);
- break;
- case IRET: dasm_none(instr, addr);
- break;
- case HALT_OP: dasm_none(instr, addr);
- break;
- case ILLEGAL_8A: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_8B: dasm_undefined(instr, addr);
- break;
- case IRETINV:
- if ((target_config.processor_id & 0x60) == 0x60)
- dasm_one(instr, addr);
- else
- dasm_none(instr, addr);
- break;
- case ILLEGAL_8D: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_8E: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_8F: dasm_undefined(instr, addr);
- break;
-
- /* Opcodes 0x90 to 0x9F */
- case AND_OP0: dasm_rc_ra_rb(instr, addr);
- break;
- case AND_OP1: dasm_rc_ra_const8(instr, addr);
- break;
- case OR_OP0: dasm_rc_ra_rb(instr, addr);
- break;
- case OR_OP1: dasm_rc_ra_const8(instr, addr);
- break;
- case XOR_OP0: dasm_rc_ra_rb(instr, addr);
- break;
- case XOR_OP1: dasm_rc_ra_const8(instr, addr);
- break;
- case XNOR0: dasm_rc_ra_rb(instr, addr);
- break;
- case XNOR1: dasm_rc_ra_const8(instr, addr);
- break;
- case NOR0: dasm_rc_ra_rb(instr, addr);
- break;
- case NOR1: dasm_rc_ra_const8(instr, addr);
- break;
- case NAND0: dasm_rc_ra_rb(instr, addr);
- break;
- case NAND1: dasm_rc_ra_const8(instr, addr);
- break;
- case ANDN0: dasm_rc_ra_rb(instr, addr);
- break;
- case ANDN1: dasm_rc_ra_const8(instr, addr);
- break;
- case SETIP: dasm_rc_ra_rb(instr, addr);
- break;
- case INV:
- if ((target_config.processor_id & 0x60) == 0x60)
- dasm_one(instr, addr);
- else
- dasm_none(instr, addr);
- break;
-
- /* Opcodes 0xA0 to 0xAF */
- case JMP0: dasm_rtarget(instr, addr);
- break;
- case JMP1: dasm_atarget(instr, addr);
- break;
- case ILLEGAL_A2: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_A3: dasm_undefined(instr, addr);
- break;
- case JMPF0: dasm_ra_rtarget(instr, addr);
- break;
- case JMPF1: dasm_ra_atarget(instr, addr);
- break;
- case ILLEGAL_A6: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_A7: dasm_undefined(instr, addr);
- break;
- case CALL0: dasm_ra_rtarget(instr, addr);
- break;
- case CALL1: dasm_ra_atarget(instr, addr);
- break;
- case ORN_OP0: dasm_undefined(instr, addr);
- break;
- case ORN_OP1: dasm_undefined(instr, addr);
- break;
- case JMPT0: dasm_ra_rtarget(instr, addr);
- break;
- case JMPT1: dasm_ra_atarget(instr, addr);
- break;
- case ILLEGAL_AE: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_AF: dasm_undefined(instr, addr);
- break;
-
- /* Opcodes 0xB0 to 0xBF */
- case ILLEGAL_B0: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_B1: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_B2: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_B3: dasm_undefined(instr, addr);
- break;
- case JMPFDEC0: dasm_ra_rtarget(instr, addr);
- break;
- case JMPFDEC1: dasm_ra_atarget(instr, addr);
- break;
- case MFTLB: dasm_rc_ra(instr, addr);
- break;
- case ILLEGAL_B7: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_B8: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_B9: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_BA: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_BB: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_BC: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_BD: dasm_undefined(instr, addr);
- break;
- case MTTLB: dasm_ra_rb(instr, addr);
- break;
- case ILLEGAL_BF: dasm_undefined(instr, addr);
- break;
-
- /* Opcodes 0xC0 to 0xCF */
- case JMPI: dasm_rb(instr, addr);
- break;
- case ILLEGAL_C1: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_C2: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_C3: dasm_undefined(instr, addr);
- break;
- case JMPFI: dasm_ra_rb(instr, addr);
- break;
- case ILLEGAL_C5: dasm_undefined(instr, addr);
- break;
- case MFSR: dasm_rc_spid(instr, addr);
- break;
- case ILLEGAL_C7: dasm_undefined(instr, addr);
- break;
- case CALLI: dasm_ra_rb(instr, addr);
- break;
- case ILLEGAL_C9: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_CA: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_CB: dasm_undefined(instr, addr);
- break;
- case JMPTI: dasm_ra_rb(instr, addr);
- break;
- case ILLEGAL_CD: dasm_undefined(instr, addr);
- break;
- case MTSR: dasm_spid_rb(instr, addr);
- break;
- case ILLEGAL_CF: dasm_undefined(instr, addr);
- break;
-
- /* Opcodes 0xD0 to 0xDF */
- case ILLEGAL_D0: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_D1: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_D2: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_D3: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_D4: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_D5: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_D6: dasm_undefined(instr, addr);
- break;
- case EMULATE: dasm_vn_ra_rb(instr, addr);
- break;
- case ILLEGAL_D8: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_D9: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_DA: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_DB: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_DC: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_DD: dasm_undefined(instr, addr);
- break;
- case MULTM: dasm_rc_ra_rb(instr, addr);
- break;
- case MULTMU: dasm_rc_ra_rb(instr, addr);
- break;
-
- /* Opcodes 0xE0 to 0xEF */
- case MULTIPLY: dasm_rc_ra_rb(instr, addr);
- break;
- case DIVIDE: dasm_rc_ra_rb(instr, addr);
- break;
- case MULTIPLU: dasm_rc_ra_rb(instr, addr);
- break;
- case DIVIDU: dasm_rc_ra_rb(instr, addr);
- break;
- case CONVERT: dasm_convert(instr, addr);
- break;
- case SQRT: dasm_rc_ra_const8(instr, addr);
- break;
- case CLASS: dasm_dc_ra_rb(instr, addr);
- break;
- case ILLEGAL_E7: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_E8: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_E9: dasm_undefined(instr, addr);
- break;
- case FEQ: dasm_rc_ra_rb(instr, addr);
- break;
- case DEQ: dasm_rc_ra_rb(instr, addr);
- break;
- case FGT: dasm_rc_ra_rb(instr, addr);
- break;
- case DGT: dasm_rc_ra_rb(instr, addr);
- break;
- case FGE: dasm_rc_ra_rb(instr, addr);
- break;
- case DGE: dasm_rc_ra_rb(instr, addr);
- break;
-
- /* Opcodes 0xF0 to 0xFF */
- case FADD: dasm_rc_ra_rb(instr, addr);
- break;
- case DADD: dasm_rc_ra_rb(instr, addr);
- break;
- case FSUB: dasm_rc_ra_rb(instr, addr);
- break;
- case DSUB: dasm_rc_ra_rb(instr, addr);
- break;
- case FMUL: dasm_rc_ra_rb(instr, addr);
- break;
- case DMUL: dasm_rc_ra_rb(instr, addr);
- break;
- case FDIV: dasm_rc_ra_rb(instr, addr);
- break;
- case DDIV: dasm_rc_ra_rb(instr, addr);
- break;
- case ILLEGAL_F8: dasm_undefined(instr, addr);
- break;
- case FDMUL: dasm_rc_ra_rb(instr, addr);
- break;
- case ILLEGAL_FA: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_FB: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_FC: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_FD: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_FE: dasm_undefined(instr, addr);
- break;
- case ILLEGAL_FF: dasm_undefined(instr, addr);
- break;
- } /* end switch */
-
- } /* End dasm_instr() */
-
-
-
-
-/*
-** The following functions are used to format an instruction
-** into human-readable form. All of the Am29000 instruction
-** formats are supported below.
-*/
-
-
-/*
-** Format: 0xnnnnnnnn
-*/
-/*ARGSUSED*/
-
-void
-dasm_undefined(instr, pc)
- struct instr_t *instr;
- ADDR32 pc;
- {
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, ".word 0x%02x%02x%02x%02x", instr->op,
- instr->c, instr->a, instr->b);
- (void) fprintf(stderr, ".word 0x%02x%02x%02x%02x", instr->op,
- instr->c, instr->a, instr->b);
- }
-
-
-
-/*
-** Format: <Mnemonic> ra, const16
-**
-** (See CONSTN)
-*/
-/*ARGSUSED*/
-
-void
-dasm_ra_const16n(instr, pc)
- struct instr_t *instr;
- ADDR32 pc;
- {
- INT32 const16;
- const16 = (INT32) ((instr->b | (instr->c << 8)) | 0xffff0000);
- if (io_config.echo_mode == (INT32) TRUE)
- (void) fprintf(io_config.echo_file, "%s %s,0x%lx", opcode_name[instr->op],
- reg[instr->a], const16);
- (void) fprintf(stderr, "%s %s,0x%lx", opcode_name[instr->op],
- reg[instr->a], const16);
- }
-
-
-
-/*
-** Format: <Mnemonic> ra, const16
-**
-** (See CONSTH)
-*/
-/*ARGSUSED*/
-
-void
-dasm_ra_const16h(instr, pc)
- struct instr_t *instr;
- ADDR32 pc;
- {
- INT32 const32;
- INT32 i_15_8;
- INT32 i_7_0;
-
- i_15_8 = (INT32) instr->c;
- i_7_0 = (INT32) instr->b;
- const32 = ((i_15_8 << 24) | (i_7_0 << 16));
- if (io_config.echo_mode == (INT32) TRUE)
- (void) fprintf(io_config.echo_file, "%s %s,0x%lx", opcode_name[instr->op],
- reg[instr->a], const32);
- (void) fprintf(stderr, "%s %s,0x%lx", opcode_name[instr->op],
- reg[instr->a], const32);
- }
-
-
-
-/*
-** Format: <Mnemonic> ra, const16
-**
-** (See CONST)
-*/
-/*ARGSUSED*/
-
-void
-dasm_ra_const16(instr, pc)
- struct instr_t *instr;
- ADDR32 pc;
- {
- INT32 const16;
- const16 = (INT32) (instr->b | (instr->c << 8));
- if (io_config.echo_mode == (INT32) TRUE)
- (void) fprintf(io_config.echo_file, "%s %s,0x%x", opcode_name[instr->op],
- reg[instr->a], const16);
- (void) fprintf(stderr, "%s %s,0x%x", opcode_name[instr->op],
- reg[instr->a], const16);
- }
-
-
-
-/*
-** Format: <Mnemonic> spid, const16
-**
-** (See MTSRIM)
-*/
-/*ARGSUSED*/
-
-void
-dasm_spid_const16(instr, pc)
- struct instr_t *instr;
- ADDR32 pc;
- {
- INT32 const16;
- INT32 i_15_8;
- INT32 i_7_0;
-
- i_15_8 = (INT32) instr->c;
- i_7_0 = (INT32) instr->b;
-
- const16 = ((i_15_8 << 8) | i_7_0);
- if (io_config.echo_mode == (INT32) TRUE)
- (void) fprintf(io_config.echo_file, "%s %s,0x%x", opcode_name[instr->op],
- spreg[instr->a], const16);
- (void) fprintf(stderr, "%s %s,0x%x", opcode_name[instr->op],
- spreg[instr->a], const16);
- }
-
-
-
-
-/*
-** Format: <Mnemonic> ce, cntl, ra, rb
-**
-** (See LOADM, LOADSET, STORE, STOREL, etc...)
-*/
-/*ARGSUSED*/
-
-void
-dasm_ce_cntl_ra_rb(instr, pc)
- struct instr_t *instr;
- ADDR32 pc;
- {
- int ce;
- int cntl;
-
- ce = (int) ((instr->c >> 7) & 0x01);
- cntl = (int) (instr->c & 0x7f);
- if (io_config.echo_mode == (INT32) TRUE)
- (void) fprintf(io_config.echo_file, "%s %x,0x%x,%s,%s",
- opcode_name[instr->op], ce, cntl,
- reg[instr->a], reg[instr->b]);
- (void) fprintf(stderr, "%s %x,0x%x,%s,%s",
- opcode_name[instr->op], ce, cntl,
- reg[instr->a], reg[instr->b]);
- }
-
-
-
-/*
-** Format: <Mnemonic> ce, cntl, ra, const8
-**
-** (See LOADM, LOADSET, STORE, STOREL, etc...)
-*/
-/*ARGSUSED*/
-
-void
-dasm_ce_cntl_ra_const8(instr, pc)
- struct instr_t *instr;
- ADDR32 pc;
- {
- int ce;
- int cntl;
-
- ce = (int) ((instr->c >> 7) & 0x01);
- cntl = (int) (instr->c & 0x7f);
- if (io_config.echo_mode == (INT32) TRUE)
- (void) fprintf(io_config.echo_file, "%s %x,0x%x,%s,0x%x",
- opcode_name[instr->op], ce, cntl,
- reg[instr->a], instr->b);
- (void) fprintf(stderr, "%s %x,0x%x,%s,0x%x",
- opcode_name[instr->op], ce, cntl,
- reg[instr->a], instr->b);
- }
-
-
-
-/*
-** Format: <Mnemonic> rc, rb
-**
-** (See CLZ, DIV0)
-*/
-/*ARGSUSED*/
-
-void
-dasm_rc_rb(instr, pc)
- struct instr_t *instr;
- ADDR32 pc;
- {
- if (io_config.echo_mode == (INT32) TRUE)
- (void) fprintf(io_config.echo_file, "%s %s,%s", opcode_name[instr->op],
- reg[instr->c], reg[instr->b]);
- (void) fprintf(stderr, "%s %s,%s", opcode_name[instr->op],
- reg[instr->c], reg[instr->b]);
- }
-
-
-
-/*
-** Format: <Mnemonic> rc, const8
-**
-** (See CLZ, DIV0)
-*/
-/*ARGSUSED*/
-
-void
-dasm_rc_const8(instr, pc)
- struct instr_t *instr;
- ADDR32 pc;
- {
- if (io_config.echo_mode == (INT32) TRUE)
- (void) fprintf(io_config.echo_file, "%s %s,0x%x", opcode_name[instr->op],
- reg[instr->c], instr->b);
- (void) fprintf(stderr, "%s %s,0x%x", opcode_name[instr->op],
- reg[instr->c], instr->b);
- }
-
-
-
-/*
-** Format: <Mnemonic> rc, ra, rb
-**
-** (See ADD, AND, etc...)
-*/
-/*ARGSUSED*/
-
-void
-dasm_rc_ra_rb(instr, pc)
- struct instr_t *instr;
- ADDR32 pc;
- {
- if (io_config.echo_mode == (INT32) TRUE)
- (void) fprintf(io_config.echo_file, "%s %s,%s,%s", opcode_name[instr->op],
- reg[instr->c], reg[instr->a], reg[instr->b]);
- (void) fprintf(stderr, "%s %s,%s,%s", opcode_name[instr->op],
- reg[instr->c], reg[instr->a], reg[instr->b]);
- }
-
-
-
-/*
-** Format: <Mnemonic> rc, ra, const8
-**
-** (See ADD, AND, etc...)
-*/
-/*ARGSUSED*/
-
-void
-dasm_rc_ra_const8(instr, pc)
- struct instr_t *instr;
- ADDR32 pc;
- {
- if (io_config.echo_mode == (INT32) TRUE)
- (void) fprintf(io_config.echo_file, "%s %s,%s,0x%x", opcode_name[instr->op],
- reg[instr->c], reg[instr->a], instr->b);
- (void) fprintf(stderr, "%s %s,%s,0x%x", opcode_name[instr->op],
- reg[instr->c], reg[instr->a], instr->b);
- }
-
-
-
-/*
-** Format: <Mnemonic> vn, ra, rb
-**
-** (See ASEQ, ASGE, etc...)
-**
-** Note: This function also prints out a "nop" if the
-** instruction is an ASEQ and RA == RB.
-**
-*/
-/*ARGSUSED*/
-
-void
-dasm_vn_ra_rb(instr, pc)
- struct instr_t *instr;
- ADDR32 pc;
- {
- if ((instr->op == ASEQ0) &&
- (instr->a == instr->b)) {
- if (io_config.echo_mode == (INT32) TRUE)
- (void) fprintf(io_config.echo_file, "nop");
- (void) fprintf(stderr, "nop");
- } else {
- if (io_config.echo_mode == (INT32) TRUE)
- (void) fprintf(io_config.echo_file, "%s 0x%x,%s,%s", opcode_name[instr->op],
- instr->c, reg[instr->a], reg[instr->b]);
- (void) fprintf(stderr, "%s 0x%x,%s,%s", opcode_name[instr->op],
- instr->c, reg[instr->a], reg[instr->b]);
- }
- }
-
-
-/*
-** Format: <Mnemonic> vn, ra, const8
-**
-** (See ASEQ, ASGE, etc...)
-*/
-/*ARGSUSED*/
-
-void
-dasm_vn_ra_const8(instr, pc)
- struct instr_t *instr;
- ADDR32 pc;
- {
- if (io_config.echo_mode == (INT32) TRUE)
- (void) fprintf(io_config.echo_file, "%s 0x%x,%s,0x%x", opcode_name[instr->op],
- instr->c, reg[instr->a], instr->b);
- (void) fprintf(stderr, "%s 0x%x,%s,0x%x", opcode_name[instr->op],
- instr->c, reg[instr->a], instr->b);
- }
-
-
-
-/*
-** Format: <Mnemonic> rc, ra
-**
-** (See MFTBL)
-*/
-/*ARGSUSED*/
-
-void
-dasm_rc_ra(instr, pc)
- struct instr_t *instr;
- ADDR32 pc;
- {
- if (io_config.echo_mode == (INT32) TRUE)
- (void) fprintf(io_config.echo_file, "%s %s,%s", opcode_name[instr->op],
- reg[instr->c], reg[instr->a]);
- (void) fprintf(stderr, "%s %s,%s", opcode_name[instr->op],
- reg[instr->c], reg[instr->a]);
- }
-
-
-
-/*
-** Format: <Mnemonic>
-**
-** (See HALT, IRET)
-*/
-/*ARGSUSED*/
-
-void
-dasm_none(instr, pc)
- struct instr_t *instr;
- ADDR32 pc;
- {
- (void) fprintf(stderr, "%s", opcode_name[instr->op]);
- if (io_config.echo_mode == (INT32) TRUE)
- (void) fprintf(io_config.echo_file, "%s", opcode_name[instr->op]);
- }
-
-void
-dasm_one(instr, pc)
- struct instr_t *instr;
- ADDR32 pc;
- {
- (void) fprintf(stderr, "%s 0x%x", opcode_name[instr->op],(int) (instr->c & 0x3));
- if (io_config.echo_mode == (INT32) TRUE)
- (void) fprintf(io_config.echo_file, "%s 0x%x", opcode_name[instr->op], (int) (instr->c & 0x3));
- }
-
-
-/*
-** Format: <Mnemonic> target
-**
-** (See JMP, etc...)
-*/
-/*ARGSUSED*/
-
-void
-dasm_atarget(instr, pc)
- struct instr_t *instr;
- ADDR32 pc;
- {
- INT32 const16;
- INT32 i_17_10;
- INT32 i_9_2;
-
- i_17_10 = ((INT32) instr->c) << 10;
- i_9_2 = ((INT32) instr->b) << 2;
- const16 = (i_17_10 | i_9_2);
- (void) fprintf(stderr, "%s 0x%lx", opcode_name[instr->op],
- const16);
- if (io_config.echo_mode == (INT32) TRUE)
- (void) fprintf(io_config.echo_file, "%s 0x%lx", opcode_name[instr->op],
- const16);
- }
-
-
-
-/*
-** Format: <Mnemonic> target+pc
-**
-** (See JMP, etc...)
-*/
-
-void
-dasm_rtarget(instr, pc)
- struct instr_t *instr;
- ADDR32 pc;
- {
- INT32 const16;
- INT32 i_17_10;
- INT32 i_9_2;
-
- i_17_10 = ((INT32) instr->c) << 10;
- i_9_2 = ((INT32) instr->b) << 2;
- const16 = (i_17_10 | i_9_2);
- if ((const16 & 0x00020000) != 0) /* Sign extend (bit 17) */
- const16 = (const16 | 0xfffc0000);
- (void) fprintf(stderr, "%s 0x%lx", opcode_name[instr->op],
- (const16+pc));
- if (io_config.echo_mode == (INT32) TRUE)
- (void) fprintf(io_config.echo_file, "%s 0x%lx", opcode_name[instr->op],
- (const16+pc));
- }
-
-
-
-/*
-** Format: <Mnemonic> ra, target
-**
-** (See CALL, JMPFDEC, JMPT, etc...)
-*/
-/*ARGSUSED*/
-
-void
-dasm_ra_atarget(instr, pc)
- struct instr_t *instr;
- ADDR32 pc;
- {
- INT32 const16;
- INT32 i_17_10;
- INT32 i_9_2;
-
- i_17_10 = ((INT32) instr->c) << 10;
- i_9_2 = ((INT32) instr->b) << 2;
- const16 = (i_17_10 | i_9_2);
- (void) fprintf(stderr, "%s %s,0x%lx", opcode_name[instr->op],
- reg[instr->a], const16);
- if (io_config.echo_mode == (INT32) TRUE)
- (void) fprintf(io_config.echo_file, "%s %s,0x%lx", opcode_name[instr->op],
- reg[instr->a], const16);
- }
-
-
-
-/*
-** Format: <Mnemonic> ra, target
-**
-** (See CALL, JMPFDEC, JMPT, etc...)
-*/
-
-void
-dasm_ra_rtarget(instr, pc)
- struct instr_t *instr;
- ADDR32 pc;
- {
- INT32 const16;
- INT32 i_17_10;
- INT32 i_9_2;
-
- i_17_10 = ((INT32) instr->c) << 10;
- i_9_2 = ((INT32) instr->b) << 2;
- const16 = (i_17_10 | i_9_2);
- if ((const16 & 0x00020000) != 0) /* Sign extend (bit 17) */
- const16 = (const16 | 0xfffc0000);
- (void) fprintf(stderr, "%s %s,0x%lx", opcode_name[instr->op],
- reg[instr->a], (const16+pc));
- if (io_config.echo_mode == (INT32) TRUE)
- (void) fprintf(io_config.echo_file, "%s %s,0x%lx", opcode_name[instr->op],
- reg[instr->a], (const16+pc));
- }
-
-
-
-/*
-** Format: <Mnemonic> ra, rb
-**
-** (See CALLI, JMPFI)
-*/
-/*ARGSUSED*/
-
-void
-dasm_ra_rb(instr, pc)
- struct instr_t *instr;
- ADDR32 pc;
- {
- (void) fprintf(stderr, "%s %s,%s", opcode_name[instr->op],
- reg[instr->a], reg[instr->b]);
- if (io_config.echo_mode == (INT32) TRUE)
- (void) fprintf(io_config.echo_file, "%s %s,%s", opcode_name[instr->op],
- reg[instr->a], reg[instr->b]);
- }
-
-
-
-/*
-** Format: <Mnemonic> rb
-**
-** (See JMPI)
-*/
-/*ARGSUSED*/
-
-void
-dasm_rb(instr, pc)
- struct instr_t *instr;
- ADDR32 pc;
- {
- (void) fprintf(stderr, "%s %s", opcode_name[instr->op],
- reg[instr->b]);
- if (io_config.echo_mode == (INT32) TRUE)
- (void) fprintf(io_config.echo_file, "%s %s", opcode_name[instr->op],
- reg[instr->b]);
- }
-
-
-
-/*
-** Format: <Mnemonic> rc, spid
-**
-** (See MFSR)
-*/
-/*ARGSUSED*/
-
-void
-dasm_rc_spid(instr, pc)
- struct instr_t *instr;
- ADDR32 pc;
- {
- (void) fprintf(stderr, "%s %s,%s", opcode_name[instr->op],
- reg[instr->c], spreg[instr->a]);
- if (io_config.echo_mode == (INT32) TRUE)
- (void) fprintf(io_config.echo_file, "%s %s,%s", opcode_name[instr->op],
- reg[instr->c], spreg[instr->a]);
- }
-
-
-
-/*
-** Format: <Mnemonic> spid, rb
-**
-** (See MTSR)
-*/
-/*ARGSUSED*/
-
-void
-dasm_spid_rb(instr, pc)
- struct instr_t *instr;
- ADDR32 pc;
- {
- if (io_config.echo_mode == (INT32) TRUE)
- (void) fprintf(io_config.echo_file, "%s %s,%s", opcode_name[instr->op],
- spreg[instr->a], reg[instr->b]);
- (void) fprintf(stderr, "%s %s,%s", opcode_name[instr->op],
- spreg[instr->a], reg[instr->b]);
- }
-
-
-
-/*
-** Format: <Mnemonic> dc, ra, rb
-**
-** (See CLASS)
-*/
-/*ARGSUSED*/
-
-void
-dasm_dc_ra_rb(instr, pc)
- struct instr_t *instr;
- ADDR32 pc;
- {
- (void) fprintf(stderr, "%s %s,%s", opcode_name[instr->op],
- reg[instr->c], reg[instr->a]);
- if (io_config.echo_mode == (INT32) TRUE)
- (void) fprintf(io_config.echo_file, "%s %s,%s", opcode_name[instr->op],
- reg[instr->c], reg[instr->a]);
- }
-
-
-
-/*
-** Format: <Mnemonic> rc, ra, UI, RND, FD, FS
-**
-** (See CONVERT)
-*/
-/*ARGSUSED*/
-
-void
-dasm_convert(instr, pc)
- struct instr_t *instr;
- ADDR32 pc;
- {
- int ui;
- int rnd;
- int fd;
- int fs;
-
- ui = (int) ((instr->b >> 7) & 0x01);
- rnd = (int) ((instr->b >> 4) & 0x07);
- fd = (int) ((instr->b >> 2) & 0x03);
- fs = (int) (instr->b & 0x03);
- if (io_config.echo_mode == (INT32) TRUE)
- (void) fprintf(io_config.echo_file, "%s %s,%s,%x,%x,%x,%x",
- opcode_name[instr->op],
- reg[instr->c], reg[instr->a],
- ui, rnd, fd, fs);
- (void) fprintf(stderr, "%s %s,%s,%x,%x,%x,%x",
- opcode_name[instr->op],
- reg[instr->c], reg[instr->a],
- ui, rnd, fd, fs);
- }
-
-
-
+++ /dev/null
-static char _[] = " @(#)dump.c 5.20 93/07/30 16:38:27, Srini, AMD ";
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- **
- ** This code provides dump routines to output data in
- ** hex / ASCII formats.
- **
- *****************************************************************************
- */
-
-#include <stdio.h>
-#include <ctype.h>
-#include <memory.h>
-#include "main.h"
-#include "macros.h"
-#include "monitor.h"
-#include "miniint.h"
-#include "memspcs.h"
-#include "error.h"
-
-
-#ifdef MSDOS
-#include <stdlib.h>
-#include <string.h>
-#else
-#include <string.h>
-#endif
-
-int get_addr_29k PARAMS((char *, struct addr_29k_t *));
-int addr_29k_ok PARAMS((struct addr_29k_t *));
-int print_addr_29k PARAMS((INT32, ADDR32));
-
-int dump_mem_word PARAMS((INT32 mspace, ADDR32 addr, INT32 bytes, BYTE *buf));
-int dump_reg_word PARAMS((INT32 mspace, ADDR32 addr, INT32 bytes, BYTE *buf));
-int dump_mem_half PARAMS((INT32 mspace, ADDR32 addr, INT32 bytes, BYTE *buf));
-int dump_reg_half PARAMS((INT32 mspace, ADDR32 addr, INT32 bytes, BYTE *buf));
-int dump_mem_byte PARAMS((INT32 mspace, ADDR32 addr, INT32 bytes, BYTE *buf));
-int dump_reg_byte PARAMS((INT32 mspace, ADDR32 addr, INT32 bytes, BYTE *buf));
-int dump_mem_float PARAMS((INT32 mspace, ADDR32 addr, INT32 bytes, BYTE *buf));
-int dump_reg_float PARAMS((INT32 mspace, ADDR32 addr, INT32 bytes, BYTE *buf));
-int dump_mem_double PARAMS((INT32 mspace, ADDR32 addr, INT32 bytes, BYTE *buf));
-int dump_reg_double PARAMS((INT32 mspace, ADDR32 addr, INT32 bytes, BYTE *buf));
-
-int get_data PARAMS((BYTE *, BYTE *, int));
-int dump_ASCII PARAMS((char *, int, BYTE *, int));
-
-
-/*
-** The function below is used in dumping data. This function is
-** called in the main command loop parser of the monitor. The
-** parameters passed to this function are:
-**
-** token - This is an array of pointers to strings. Each string
-** referenced by this array is a "token" of the user's
-** input, translated to lower case.
-**
-** token_count - This is the number of tokens in "token".
-**
-** This function reduces the tokens to three parameters:
-** memory_space, address and byte_count. The address parameter is
-** aligned as follows:
-**
-** - All register accesses are byte aligned. The address,
-** however, accesses 32 bit words. The valued in these
-** registers are displayed in formats determined by the
-** first token.
-**
-** - Memory addresses are aligned and displayed according
-** to the dump format as specified in the first token.
-**
-**
-*/
-
-
-INT32
-dump_cmd(token, token_count)
- char *token[];
- int token_count;
- {
- static INT32 memory_space=D_MEM;
- static ADDR32 address=0;
- INT32 byte_count=64;
- int result;
- struct addr_29k_t addr_29k_start;
- struct addr_29k_t addr_29k_end;
- int dump_format;
- int object_size;
- ADDR32 align_mask;
-
- INT32 retval;
- INT32 hostendian;
- INT32 bytes_returned;
- BYTE *read_buffer;
-
- /*
- ** What is the dump format?
- */
-
- if ((strcmp(token[0], "d") == 0) ||
- (strcmp(token[0], "dw") == 0)) {
- dump_format = WORD_FORMAT;
- object_size = sizeof(INT32);
- align_mask = 0xfffffffc;
- }
- else
- if (strcmp(token[0], "dh") == 0) {
- dump_format = HALF_FORMAT;
- object_size = sizeof(INT16);
- align_mask = 0xfffffffe;
- }
- else
- if (strcmp(token[0], "db") == 0) {
- dump_format = BYTE_FORMAT;
- object_size = sizeof(BYTE);
- align_mask = 0xffffffff;
- }
- else
- if (strcmp(token[0], "df") == 0) {
- dump_format = FLOAT_FORMAT;
- object_size = sizeof(float);
- align_mask = 0xfffffffc;
- }
- else
- if (strcmp(token[0], "dd") == 0) {
- dump_format = DOUBLE_FORMAT;
- object_size = sizeof(double);
- align_mask = 0xfffffff8;
- }
- else
- return(EMSYNTAX);
-
- /*
- ** Get start address and byte count
- */
-
- if (token_count == 1) {
- if (ISREG(memory_space))
- address = address + (byte_count/4);
- else
- if (ISMEM(memory_space))
- address = address + byte_count;
- else
- return(EMBADADDR);
- /* Check the start address */
- addr_29k_start.address = address;
- addr_29k_start.memory_space = memory_space;
- result = addr_29k_ok(&addr_29k_start);
- if (result != 0)
- return (result);
- }
- else
- if (token_count == 2) {
- result = get_addr_29k(token[1], &addr_29k_start);
- if (result != 0)
- return (EMSYNTAX);
- /* Check the start address */
- result = addr_29k_ok(&addr_29k_start);
- if (result != 0)
- return (result);
-
- memory_space = addr_29k_start.memory_space;
- /* Make sure we have an even multiple of object_size */
- if (ISREG(memory_space)) {
- address = addr_29k_start.address;
- byte_count = (byte_count + (object_size - 1)) & 0xfffffffc;
- }
- else
- if (ISMEM(memory_space)) {
- address = addr_29k_start.address & align_mask;
- byte_count = (byte_count + (object_size - 1)) & align_mask;
- }
- else
- return(EMBADADDR);
- }
- else
- if (token_count == 3) {
- result = get_addr_29k(token[1], &addr_29k_start);
- if (result != 0)
- return (EMSYNTAX);
- /* Only check the start address */
- result = addr_29k_ok(&addr_29k_start);
- if (result != 0)
- return (result);
- result = get_addr_29k(token[2], &addr_29k_end);
- if (result != 0)
- return (EMSYNTAX);
-
- if (addr_29k_start.memory_space != addr_29k_end.memory_space)
- return (EMBADADDR);
- if (addr_29k_start.address > addr_29k_end.address)
- return (EMBADADDR);
-
- memory_space = addr_29k_start.memory_space;
- if (ISREG(memory_space)) {
- address = addr_29k_start.address;
- byte_count = (addr_29k_end.address -
- addr_29k_start.address + 1) * 4;
- }
- else
- if (ISMEM(memory_space)) {
- address = addr_29k_start.address & align_mask;
- byte_count = ((addr_29k_end.address & align_mask) -
- (addr_29k_start.address & align_mask) +
- object_size);
- }
- else
- return(EMBADADDR);
-
- }
- else
- /* Too many args */
- return (EMSYNTAX);
-
-
- /*
- ** Get data
- */
-
- /* Will the data overflow the message buffer? Done by TIP ??*/
- if ((read_buffer = (BYTE *) malloc((unsigned int) byte_count)) == NULL) {
- warning(EMALLOC);
- return(FAILURE);
- };
-
- hostendian = FALSE;
- if ((retval = Mini_read_req(memory_space,
- address,
- byte_count / object_size,
- (INT16) object_size,
- &bytes_returned,
- read_buffer,
- hostendian)) != SUCCESS) {
- return(FAILURE);
- };
-
- bytes_returned = bytes_returned * object_size;
-
- /* Continue if SUCCESSful */
-
- /*
- ** Call data format routines
- */
-
- if ISMEM(memory_space) {
- if (dump_format == WORD_FORMAT)
- result = dump_mem_word(memory_space,
- address,
- bytes_returned,
- read_buffer);
- else
- if (dump_format == HALF_FORMAT)
- result = dump_mem_half(memory_space,
- address,
- bytes_returned,
- read_buffer);
- else
- if (dump_format == BYTE_FORMAT)
- result = dump_mem_byte(memory_space,
- address,
- bytes_returned,
- read_buffer);
- else
- if (dump_format == FLOAT_FORMAT)
- result = dump_mem_float(memory_space,
- address,
- bytes_returned,
- read_buffer);
- else
- if (dump_format == DOUBLE_FORMAT)
- result = dump_mem_double(memory_space,
- address,
- bytes_returned,
- read_buffer);
- }
- else
- if ISREG(memory_space) {
- if (dump_format == WORD_FORMAT)
- result = dump_reg_word(memory_space,
- address,
- bytes_returned,
- read_buffer);
- else
- if (dump_format == HALF_FORMAT)
- result = dump_reg_half(memory_space,
- address,
- bytes_returned,
- read_buffer);
- else
- if (dump_format == BYTE_FORMAT)
- result = dump_reg_byte(memory_space,
- address,
- bytes_returned,
- read_buffer);
- else
- if (dump_format == FLOAT_FORMAT)
- result = dump_reg_float(memory_space,
- address,
- bytes_returned,
- read_buffer);
- else
- if (dump_format == DOUBLE_FORMAT)
- result = dump_reg_double(memory_space,
- address,
- bytes_returned,
- read_buffer);
- }
- else
- return(EMBADADDR);
-
- (void) free ((char *) read_buffer);
- return (result);
-
- } /* end dump_cmd() */
-
-
-
-/*
-** Functions used by dump_cmd()
-*/
-
-
-/*
-** This function is used to dump 32 bit words of data.
-** the address is printed, followed by the data, grouped
-** into 8 character long strings, each representing one
-** 32 bit word. Space for four 32-bit words is reserved
-** on each line. Following the hex data, an ASCII
-** representation of the data is printed.
-*/
-
-int
-dump_mem_word(memory_space, read_address, bytes_returned, read_buffer)
- INT32 memory_space;
- ADDR32 read_address;
- INT32 bytes_returned;
- BYTE *read_buffer;
- {
- int result;
- ADDR32 address;
- ADDR32 start_address;
- ADDR32 end_address;
- ADDR32 last_print_address;
- ADDR32 address_mask;
- INT32 byte_count;
- INT32 data_word;
- struct addr_29k_t addr_29k;
- int ASCII_index;
- char ASCII_buffer[20];
-
- byte_count = 0;
- ASCII_index = 0;
- ASCII_buffer[0] = '\0';
-
- address_mask = 0xfffffff0;
- start_address = read_address;
- end_address = read_address + bytes_returned;
- last_print_address = (end_address + 0xf) & address_mask;
- address = start_address & address_mask;
-
- /*
- ** Loop while data available
- */
-
- while (address <= last_print_address) {
-
- /* Exit if address not valid */
- addr_29k.memory_space = memory_space;
- addr_29k.address = address;
- result = addr_29k_ok(&addr_29k);
- if (result != 0) {
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n\n");
- fprintf(stderr, "\n\n");
- return (0);
- }
-
- /* Print out ASCII data */
- if ((address & address_mask) == address) {
- fprintf(stderr, " %s\n", ASCII_buffer);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, " %s\n", ASCII_buffer);
- ASCII_index = 0;
- }
-
- /* Print address in margin */
- if (((address & address_mask) == address) &&
- (address != last_print_address)) {
- result = print_addr_29k(memory_space, address);
- if (result != 0)
- return (EMBADADDR);
- }
-
- /* Do leading and trailing spaces (if necessary) */
- if ((address < start_address) ||
- (address >= end_address)) {
- fprintf(stderr, " ");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, " ");
- result = dump_ASCII(ASCII_buffer, ASCII_index,
- (BYTE *) NULL, sizeof(INT32));
- ASCII_index = ASCII_index + sizeof(INT32);
- address = address + sizeof(INT32);
- }
-
- /* Print out hex data */
- if ((address >= start_address) &&
- (address < end_address)) {
-
- result = get_data((BYTE *)&data_word,
- &read_buffer[byte_count],
- sizeof(INT32));
- if (result != 0)
- return (EMBADADDR);
-
- fprintf(stderr, "%08lx ", data_word);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "%08lx ", data_word);
-
- /* Build ASCII srting */
- result = dump_ASCII(ASCII_buffer,
- ASCII_index,
- &read_buffer[byte_count],
- sizeof(INT32));
- ASCII_index = ASCII_index + sizeof(INT32);
-
- address = address + sizeof(INT32);
-
- byte_count = byte_count + sizeof(INT32);
-
- } /* end if */
-
- } /* end while */
-
- fprintf(stderr, "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n");
-
- return (0);
-
- } /* end dump_mem_word() */
-
-
-int
-dump_reg_word(memory_space, read_address, bytes_returned, read_buffer)
- INT32 memory_space;
- ADDR32 read_address;
- INT32 bytes_returned;
- BYTE *read_buffer;
- {
- int result;
- ADDR32 address;
- ADDR32 start_address;
- ADDR32 end_address;
- ADDR32 last_print_address;
- ADDR32 address_mask;
- INT32 byte_count;
- INT32 data_word;
- struct addr_29k_t addr_29k;
- int ASCII_index;
- char ASCII_buffer[20];
-
- byte_count = 0;
- ASCII_index = 0;
- ASCII_buffer[0] = '\0';
-
- address_mask = 0xfffffffc;
- start_address = read_address;
- end_address = read_address + (bytes_returned / 4);
- last_print_address = (end_address + 0x3) & address_mask;
- address = start_address & address_mask;
-
- /*
- ** Loop while data available
- */
-
- while (address <= last_print_address) {
-
- /* Exit if address not valid */
- addr_29k.memory_space = memory_space;
- addr_29k.address = address;
- result = addr_29k_ok(&addr_29k);
- if (result != 0) {
- fprintf(stderr, "\n\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n\n");
- return (0);
- }
-
- /* Print out ASCII data */
- if ((address & address_mask) == address) {
- fprintf(stderr, " %s\n", ASCII_buffer);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, " %s\n", ASCII_buffer);
- ASCII_index = 0;
- }
-
- /* Print address in margin */
- if (((address & address_mask) == address) &&
- (address != last_print_address)) {
- result = print_addr_29k(memory_space, address);
- if (result != 0)
- return (EMBADADDR);
- }
-
- /* Do leading and trailing spaces (if necessary) */
- if ((address < start_address) ||
- (address >= end_address)) {
- fprintf(stderr, " ");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, " ");
- result = dump_ASCII(ASCII_buffer, ASCII_index,
- (BYTE *) NULL, sizeof(INT32));
- ASCII_index = ASCII_index + sizeof(INT32);
- address = address + 1;
- }
-
- /* Print out hex data */
- if ((address >= start_address) &&
- (address < end_address)) {
-
- result = get_data((BYTE *)&data_word,
- &read_buffer[byte_count],
- sizeof(INT32));
- if (result != 0)
- return (EMBADADDR);
-
- fprintf(stderr, "%08lx ", data_word);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "%08lx ", data_word);
-
- /* Build ASCII srting */
- result = dump_ASCII(ASCII_buffer,
- ASCII_index,
- &read_buffer[byte_count],
- sizeof(INT32));
- ASCII_index = ASCII_index + sizeof(INT32);
-
- address = address + 1;
-
- byte_count = byte_count + sizeof(INT32);
-
- } /* end if */
-
- } /* end while */
-
- fprintf(stderr, "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n");
-
- return (0);
-
- } /* end dump_reg_word() */
-
-
-
-/*
-** This function is used to dump memory as half words.
-*/
-
-int
-dump_mem_half(memory_space, read_address, bytes_returned, read_buffer)
- INT32 memory_space;
- ADDR32 read_address;
- INT32 bytes_returned;
- BYTE *read_buffer;
- {
- int result;
- ADDR32 address;
- ADDR32 start_address;
- ADDR32 end_address;
- ADDR32 last_print_address;
- ADDR32 address_mask;
- INT32 byte_count;
- INT16 data_half;
- INT32 data_word;
- struct addr_29k_t addr_29k;
- int ASCII_index;
- char ASCII_buffer[20];
-
- byte_count = 0;
- ASCII_index = 0;
- ASCII_buffer[0] = '\0';
-
- address_mask = 0xfffffff0;
- start_address = read_address;
- end_address = read_address + bytes_returned;
- last_print_address = (end_address + 0xf) & address_mask;
- address = start_address & address_mask;
-
- /*
- ** Loop while data available
- */
-
- while (address <= last_print_address) {
-
- /* Exit if address not valid */
- addr_29k.memory_space = memory_space;
- addr_29k.address = address;
- result = addr_29k_ok(&addr_29k);
- if (result != 0) {
- fprintf(stderr, "\n\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n\n");
- return (0);
- }
-
- /* Print out ASCII data */
- if ((address & address_mask) == address) {
- fprintf(stderr, " %s\n", ASCII_buffer);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, " %s\n", ASCII_buffer);
- ASCII_index = 0;
- }
-
- /* Print address in margin */
- if (((address & address_mask) == address) &&
- (address != last_print_address)) {
- result = print_addr_29k(memory_space, address);
- if (result != 0)
- return (EMBADADDR);
- }
-
- /* Do leading and trailing spaces (if necessary) */
- if ((address < start_address) ||
- (address >= end_address)) {
- fprintf(stderr, " ");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, " ");
- result = dump_ASCII(ASCII_buffer, ASCII_index,
- (BYTE *) NULL, sizeof(INT16));
- ASCII_index = ASCII_index + sizeof(INT16);
- address = address + sizeof(INT16);
- }
-
- /* Print out hex data */
- if ((address >= start_address) &&
- (address < end_address)) {
-
- result = get_data((BYTE *)&data_half,
- &read_buffer[byte_count],
- sizeof(INT16));
- if (result != 0)
- return (EMBADADDR);
-
- /* We have to cast to INT32 to print out a hex halfword */
- /* (the Sun libraries sign extend to 32 bits) */
- data_word = (INT32) data_half;
- data_word = (data_word & 0x0000ffff);
- fprintf(stderr, "%04x ", data_word);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "%04x ", data_word);
-
- /* Build ASCII srting */
- result = dump_ASCII(ASCII_buffer,
- ASCII_index,
- &read_buffer[byte_count],
- sizeof(INT16));
- ASCII_index = ASCII_index + sizeof(INT16);
-
- address = address + sizeof(INT16);
-
- byte_count = byte_count + sizeof(INT16);
-
- } /* end if */
-
- } /* end while */
-
- fprintf(stderr, "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n");
-
- return (0);
- } /* end dump_mem_half() */
-
-
-
-/*
-** This function is used to dump registers as half words.
-*/
-
-int
-dump_reg_half(memory_space, read_address, bytes_returned, read_buffer)
- INT32 memory_space;
- ADDR32 read_address;
- INT32 bytes_returned;
- BYTE *read_buffer;
- {
- int result;
- ADDR32 address;
- ADDR32 start_address;
- ADDR32 end_address;
- ADDR32 last_print_address;
- ADDR32 address_mask;
- INT32 byte_count;
- INT32 data_word;
- struct addr_29k_t addr_29k;
- int ASCII_index;
- char ASCII_buffer[20];
-
- byte_count = 0;
- ASCII_index = 0;
- ASCII_buffer[0] = '\0';
-
- address_mask = 0xfffffffc;
- start_address = read_address;
- end_address = read_address + (bytes_returned / 4);
- last_print_address = (end_address + 0x3) & address_mask;
- address = start_address & address_mask;
-
- /*
- ** Loop while data available
- */
-
- while (address <= last_print_address) {
-
- /* Exit if address not valid */
- addr_29k.memory_space = memory_space;
- addr_29k.address = address;
- result = addr_29k_ok(&addr_29k);
- if (result != 0) {
- fprintf(stderr, "\n\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n\n");
- return (0);
- }
-
- /* Print out ASCII data */
- if ((address & address_mask) == address) {
- fprintf(stderr, " %s\n", ASCII_buffer);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, " %s\n", ASCII_buffer);
- ASCII_index = 0;
- }
-
- /* Print address in margin */
- if (((address & address_mask) == address) &&
- (address != last_print_address)) {
- result = print_addr_29k(memory_space, address);
- if (result != 0)
- return (EMBADADDR);
- }
-
- /* Do leading and trailing spaces (if necessary) */
- if ((address < start_address) ||
- (address >= end_address)) {
- fprintf(stderr, " ");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, " ");
- result = dump_ASCII(ASCII_buffer, ASCII_index,
- (BYTE *) NULL, sizeof(INT16));
- ASCII_index = ASCII_index + sizeof(INT16);
-
- address = address + 1;
- }
-
- /* Print out hex data */
- if ((address >= start_address) &&
- (address < end_address)) {
-
- result = get_data((BYTE *)&data_word,
- &read_buffer[byte_count],
- sizeof(INT32));
- if (result != 0)
- return (EMBADADDR);
-
- fprintf(stderr, "%04lx %04lx ",
- ((data_word >> 16) & 0xffff),
- (data_word & 0xffff));
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "%04lx %04lx ",
- ((data_word >> 16) & 0xffff),
- (data_word & 0xffff));
-
- /* Build ASCII srting */
- result = dump_ASCII(ASCII_buffer,
- ASCII_index,
- &read_buffer[byte_count],
- sizeof(INT32));
- ASCII_index = ASCII_index + sizeof(INT32);
-
- address = address + 1;
-
- byte_count = byte_count + sizeof(INT32);
-
- } /* end if */
-
- } /* end while */
-
- fprintf(stderr, "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n");
-
- return (0);
- } /* end dump_reg_half() */
-
-
-
-/*
-** This function is used to dump memory as bytes.
-*/
-
-int
-dump_mem_byte(memory_space, read_address, bytes_returned, read_buffer)
- INT32 memory_space;
- ADDR32 read_address;
- INT32 bytes_returned;
- BYTE *read_buffer;
- {
- int result;
- ADDR32 address;
- ADDR32 start_address;
- ADDR32 end_address;
- ADDR32 last_print_address;
- ADDR32 address_mask;
- INT32 byte_count;
- BYTE data_byte;
- struct addr_29k_t addr_29k;
- int ASCII_index;
- char ASCII_buffer[20];
-
- byte_count = 0;
- ASCII_index = 0;
- ASCII_buffer[0] = '\0';
-
- address_mask = 0xfffffff0;
- start_address = read_address;
- end_address = read_address + bytes_returned;
- last_print_address = (end_address + 0xf) & address_mask;
- address = start_address & address_mask;
-
- /*
- ** Loop while data available
- */
-
- while (address <= last_print_address) {
-
- /* Exit if address not valid */
- addr_29k.memory_space = memory_space;
- addr_29k.address = address;
- result = addr_29k_ok(&addr_29k);
- if (result != 0) {
- fprintf(stderr, "\n\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n\n");
- return (0);
- }
-
- /* Print out ASCII data */
- if ((address & address_mask) == address) {
- fprintf(stderr, " %s\n", ASCII_buffer);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, " %s\n", ASCII_buffer);
- ASCII_index = 0;
- }
-
- /* Print address in margin */
- if (((address & address_mask) == address) &&
- (address != last_print_address)) {
- result = print_addr_29k(memory_space, address);
- if (result != 0)
- return (EMBADADDR);
- }
-
- /* Do leading and trailing spaces (if necessary) */
- if ((address < start_address) ||
- (address >= end_address)) {
- fprintf(stderr, " ");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, " ");
- result = dump_ASCII(ASCII_buffer, ASCII_index,
- (BYTE *) NULL, sizeof(BYTE));
- ASCII_index = ASCII_index + sizeof(BYTE);
- address = address + sizeof(BYTE);
- }
-
- /* Print out hex data */
- if ((address >= start_address) &&
- (address < end_address)) {
-
- result = get_data((BYTE *)&data_byte,
- &read_buffer[byte_count],
- sizeof(BYTE));
- if (result != 0)
- return (EMBADADDR);
-
- fprintf(stderr, "%02x ", data_byte);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "%02x ", data_byte);
-
- /* Build ASCII srting */
- result = dump_ASCII(ASCII_buffer,
- ASCII_index,
- &read_buffer[byte_count],
- sizeof(BYTE));
- ASCII_index = ASCII_index + sizeof(BYTE);
-
- address = address + sizeof(BYTE);
-
- byte_count = byte_count + sizeof(BYTE);
-
- } /* end if */
-
- } /* end while */
-
- fprintf(stderr, "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n");
-
- return (0);
- } /* end dump_mem_byte() */
-
-
-
-/*
-** This function is used to dump registers as bytes.
-*/
-
-int
-dump_reg_byte(memory_space, read_address, bytes_returned, read_buffer)
- INT32 memory_space;
- ADDR32 read_address;
- INT32 bytes_returned;
- BYTE *read_buffer;
- {
- int result;
- ADDR32 address;
- ADDR32 start_address;
- ADDR32 end_address;
- ADDR32 last_print_address;
- ADDR32 address_mask;
- INT32 byte_count;
- INT32 data_word;
- struct addr_29k_t addr_29k;
- int ASCII_index;
- char ASCII_buffer[20];
-
- byte_count = 0;
- ASCII_index = 0;
- ASCII_buffer[0] = '\0';
-
- address_mask = 0xfffffffc;
- start_address = read_address;
- end_address = read_address + (bytes_returned / 4);
- last_print_address = (end_address + 0x3) & address_mask;
- address = start_address & address_mask;
-
- /*
- ** Loop while data available
- */
-
- while (address <= last_print_address) {
-
- /* Exit if address not valid */
- addr_29k.memory_space = memory_space;
- addr_29k.address = address;
- result = addr_29k_ok(&addr_29k);
- if (result != 0) {
- fprintf(stderr, "\n\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n\n");
- return (0);
- }
-
- /* Print out ASCII data */
- if ((address & address_mask) == address) {
- fprintf(stderr, " %s\n", ASCII_buffer);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, " %s\n", ASCII_buffer);
- ASCII_index = 0;
- }
-
- /* Print address in margin */
- if (((address & address_mask) == address) &&
- (address != last_print_address)) {
- result = print_addr_29k(memory_space, address);
- if (result != 0)
- return (EMBADADDR);
- }
-
- /* Do leading and trailing spaces (if necessary) */
- if ((address < start_address) ||
- (address >= end_address)) {
- fprintf(stderr, " ");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, " ");
- result = dump_ASCII(ASCII_buffer, ASCII_index,
- (BYTE *) NULL, sizeof(INT32));
- ASCII_index = ASCII_index + sizeof(INT32);
-
- address = address + 1;
- }
-
- /* Print out hex data */
- if ((address >= start_address) &&
- (address < end_address)) {
-
- result = get_data((BYTE *)&data_word,
- &read_buffer[byte_count],
- sizeof(INT32));
- if (result != 0)
- return (EMBADADDR);
-
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "%02lx %02lx %02lx %02lx ",
- ((data_word >> 24) & 0xff),
- ((data_word >> 16) & 0xff),
- ((data_word >> 8) & 0xff),
- (data_word & 0xff));
- fprintf(stderr, "%02lx %02lx %02lx %02lx ",
- ((data_word >> 24) & 0xff),
- ((data_word >> 16) & 0xff),
- ((data_word >> 8) & 0xff),
- (data_word & 0xff));
-
- /* Build ASCII srting */
- result = dump_ASCII(ASCII_buffer,
- ASCII_index,
- &read_buffer[byte_count],
- sizeof(INT32));
- ASCII_index = ASCII_index + sizeof(INT32);
-
- address = address + 1;
-
- byte_count = byte_count + sizeof(INT32);
-
- } /* end if */
-
- } /* end while */
-
- fprintf(stderr, "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n");
-
- return (0);
- } /* end dump_reg_byte() */
-
-
-
-/*
-** This function is used to dump memory as floats.
-*/
-
-int
-dump_mem_float(memory_space, read_address, bytes_returned, read_buffer)
- INT32 memory_space;
- ADDR32 read_address;
- INT32 bytes_returned;
- BYTE *read_buffer;
- {
- int result;
- ADDR32 address;
- ADDR32 start_address;
- ADDR32 end_address;
- ADDR32 last_print_address;
- ADDR32 address_mask;
- INT32 byte_count;
- float data_float;
- struct addr_29k_t addr_29k;
-
- byte_count = 0;
-
- address_mask = 0xfffffff0;
- start_address = read_address;
- end_address = read_address + bytes_returned;
- last_print_address = (end_address + 0xf) & address_mask;
- address = start_address & address_mask;
-
- /*
- ** Loop while data available
- */
-
- while (address <= last_print_address) {
-
- /* Exit if address not valid */
- addr_29k.memory_space = memory_space;
- addr_29k.address = address;
- result = addr_29k_ok(&addr_29k);
- if (result != 0) {
- fprintf(stderr, "\n\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n\n");
- return (0);
- }
-
- /* Print address in margin */
- if (((address & address_mask) == address) &&
- (address != last_print_address)) {
- fprintf(stderr, "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n");
- result = print_addr_29k(memory_space, address);
- if (result != 0)
- return (EMBADADDR);
- }
-
- /* Do leading and trailing spaces (if necessary) */
- if ((address < start_address) ||
- (address >= end_address)) {
- fprintf(stderr, " ");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, " ");
- address = address + sizeof(float);
- }
-
- /* Print out hex data */
- if ((address >= start_address) &&
- (address < end_address)) {
-
- result = get_data((BYTE *)&data_float,
- &read_buffer[byte_count],
- sizeof(float));
- if (result != 0)
- return (EMBADADDR);
-
- fprintf(stderr, "%+1.6e ", (double) data_float);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "%+1.6e ", (double) data_float);
-
- address = address + sizeof(float);
-
- byte_count = byte_count + sizeof(float);
-
- } /* end if */
-
- } /* end while */
-
- fprintf(stderr, "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n");
-
- return (0);
- } /* end dump_mem_float() */
-
-
-
-
-/*
-** This function is used to dump registers as floats.
-*/
-
-int
-dump_reg_float(memory_space, read_address, bytes_returned, read_buffer)
- INT32 memory_space;
- ADDR32 read_address;
- INT32 bytes_returned;
- BYTE *read_buffer;
- {
- int result;
- ADDR32 address;
- ADDR32 start_address;
- ADDR32 end_address;
- ADDR32 last_print_address;
- ADDR32 address_mask;
- INT32 byte_count;
- float data_float;
- struct addr_29k_t addr_29k;
-
- byte_count = 0;
-
- address_mask = 0xfffffffc;
- start_address = read_address;
- end_address = read_address + (bytes_returned / 4);
- last_print_address = (end_address + 0x3) & address_mask;
- address = start_address & address_mask;
-
- /*
- ** Loop while data available
- */
-
- while (address <= last_print_address) {
-
- /* Exit if address not valid */
- addr_29k.memory_space = memory_space;
- addr_29k.address = address;
- result = addr_29k_ok(&addr_29k);
- if (result != 0) {
- fprintf(stderr, "\n\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n\n");
- return (0);
- }
-
- /* Print address in margin */
- if (((address & address_mask) == address) &&
- (address != last_print_address)) {
- fprintf(stderr, "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n");
- result = print_addr_29k(memory_space, address);
- if (result != 0)
- return (EMBADADDR);
- }
-
- /* Do leading and trailing spaces (if necessary) */
- if ((address < start_address) ||
- (address >= end_address)) {
- fprintf(stderr, " ");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, " ");
- address = address + 1;
- }
-
- /* Print out hex data */
- if ((address >= start_address) &&
- (address < end_address)) {
-
- result = get_data((BYTE *)&data_float,
- &read_buffer[byte_count],
- sizeof(float));
- if (result != 0)
- return (EMBADADDR);
-
- fprintf(stderr, "%+1.6e ", (double) data_float);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "%+1.6e ", (double) data_float);
-
- address = address + 1;
-
- byte_count = byte_count + sizeof(float);
-
- } /* end if */
-
- } /* end while */
-
- fprintf(stderr, "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n");
-
- return (0);
- } /* end dump_reg_float() */
-
-
-
-
-/*
-** This function is used to dump memory as doubles.
-*/
-
-int
-dump_mem_double(memory_space, read_address, bytes_returned, read_buffer)
- INT32 memory_space;
- ADDR32 read_address;
- INT32 bytes_returned;
- BYTE *read_buffer;
- {
- int result;
- ADDR32 address;
- ADDR32 start_address;
- ADDR32 end_address;
- ADDR32 last_print_address;
- ADDR32 address_mask;
- INT32 byte_count;
- double data_double;
- struct addr_29k_t addr_29k;
-
- byte_count = 0;
-
- address_mask = 0xfffffff0;
- start_address = read_address;
- end_address = read_address + bytes_returned;
- last_print_address = (end_address + 0xf) & address_mask;
- address = start_address & address_mask;
-
- /*
- ** Loop while data available
- */
-
- while (address <= last_print_address) {
-
- /* Exit if address not valid */
- addr_29k.memory_space = memory_space;
- addr_29k.address = address;
- result = addr_29k_ok(&addr_29k);
- if (result != 0) {
- fprintf(stderr, "\n\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n\n");
- return (0);
- }
-
- /* Print address in margin */
- if (((address & address_mask) == address) &&
- (address != last_print_address)) {
- fprintf(stderr, "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n");
- result = print_addr_29k(memory_space, address);
- if (result != 0)
- return (EMBADADDR);
- }
-
- /* Do leading and trailing spaces (if necessary) */
- if ((address < start_address) ||
- (address >= end_address)) {
- fprintf(stderr, " ");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, " ");
- address = address + sizeof(double);
- }
-
- /* Print out hex data */
- if ((address >= start_address) &&
- (address < end_address)) {
-
- result = get_data((BYTE *)&data_double,
- &read_buffer[byte_count],
- sizeof(double));
- if (result != 0)
- return (EMBADADDR);
-
- fprintf(stderr, "%+1.15e ", data_double);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "%+1.15e ", data_double);
-
- address = address + sizeof(double);
-
- byte_count = byte_count + sizeof(double);
-
- } /* end if */
-
- } /* end while */
-
- fprintf(stderr, "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n");
-
- return (0);
- } /* end dump_mem_double() */
-
-
-
-
-/*
-** This function is used to dump registers as doubles.
-*/
-
-int
-dump_reg_double(memory_space, read_address, bytes_returned, read_buffer)
- INT32 memory_space;
- ADDR32 read_address;
- INT32 bytes_returned;
- BYTE *read_buffer;
- {
- int result;
- ADDR32 address;
- ADDR32 start_address;
- ADDR32 end_address;
- ADDR32 last_print_address;
- ADDR32 address_mask;
- INT32 byte_count;
- double data_double;
- struct addr_29k_t addr_29k;
-
- byte_count = 0;
-
- address_mask = 0xfffffffc;
- start_address = read_address;
- end_address = read_address + (bytes_returned / 4);
- last_print_address = (end_address + 0x3) & address_mask;
- address = start_address & address_mask;
-
- /*
- ** Loop while data available
- */
-
- while (address <= last_print_address) {
-
- /* Exit if address not valid */
- addr_29k.memory_space = memory_space;
- addr_29k.address = address;
- result = addr_29k_ok(&addr_29k);
- if (result != 0) {
- fprintf(stderr, "\n\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n\n");
- return (0);
- }
-
- /* Print address in margin */
- if (((address & address_mask) == address) &&
- (address != last_print_address)) {
- fprintf(stderr, "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n");
- result = print_addr_29k(memory_space, address);
- if (result != 0)
- return (EMBADADDR);
- }
-
- /* Do leading and trailing spaces (if necessary) */
- if ((address < start_address) ||
- (address >= end_address)) {
- fprintf(stderr, " ");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, " ");
- address = address + 2;
- }
-
- /* Print out hex data */
- if ((address >= start_address) &&
- (address < end_address)) {
-
- result = get_data((BYTE *)&data_double,
- &read_buffer[byte_count],
- sizeof(double));
- if (result != 0)
- return (EMBADADDR);
-
- fprintf(stderr, "%+1.15e ", data_double);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "%+1.15e ", data_double);
-
- address = address + (sizeof(double) / sizeof(INT32));
-
- byte_count = byte_count + sizeof(double);
-
- } /* end if */
-
- } /* end while */
-
- fprintf(stderr, "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n");
-
- return (0);
- } /* end dump_reg_double() */
-
-/*
-** This function fills in a buffer with a character
-** representation of the dumped data.
-*/
-
-int
-dump_ASCII(buffer, index, data, size)
- char *buffer;
- int index;
- BYTE *data;
- int size;
- {
- INT32 i;
-
- /* Do ASCII dump */
- for (i=0; i<size; i=i+1)
- if (data == NULL)
- buffer[index+i] = ' ';
- else
- if (isprint(data[i]))
- buffer[index+i] = data[i];
- else
- buffer[index+i] = '.';
-
- buffer[index+i] = '\0'; /* Null terminate */
-
- return (0);
-
- } /* end dump_ASCII() */
-
+++ /dev/null
-static char _[] = "@(#)error.c 5.20 93/07/30 16:38:29, Srini, AMD.";
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- ** This file defines the error and warning messages in the
- ** monitor. The error codes which correspond to the messages
- ** are defined in the error.h header file.
- *****************************************************************************
- */
-
-
-char *error_msg[] = {
-
-/* 0 */ "Dummy error message (0).",
-
-/* 1 (EMUSAGE) */
-" Valid command-line options are:\n\
- [-D] - to invoke in interactive debug mode\n\
- -TIP <tip_id_from_udi_config_file> - MUST specify the TIP to use\n\
- [-e <echo_ filename_for_script>] - to capture session in a file\n\
- [-w] - specifies how long to wait, -1 means WaitForever, default 10000\n\
- [-q] - to suppress download messages\n\
- [-le] - to specify little endian target (default is BIG)\n\
- [-c <input_cmd_filename>] - to specify command file for input\n\
- [-ms <mem_stack_size_in_hex> ] - memory stack size to be used for appln\n\
- [-rs <reg_stack_size_in_hex> ] - register stack size to be used for appln\n\
- [-log <log_filename>] - file to log debug session\n\
- [[<pgm>] [<pgm_args>]] - program and its optional arg list\n",
-/* 2 */ "EMFAIL: Unrecoverable error.",
-/* 3 */ "EMBADADDR: Illegal address.",
-/* 4 */ "EMBADREG: Illegal register.",
-/* 5 */ "EMSYNTAX: Illegal command syntax.",
-/* 6 */ "EMACCESS: Could not access memory.",
-/* 7 */ "EMALLOC: Could not allocate memory.",
-/* 8 */ "EMTARGET: Unknown target type.",
-/* 9 */ "EMHINIT: Could not initialize host.",
-/* 10 */ "EMCOMM: Could not open communication channel.",
-
-/* 11 */ "EMBADMSG: Unknown message type.",
-/* 12 */ "EMMSG2BIG: Message too large for buffer.",
-
-/* 13 */ "EMRESET: Could not RESET target.",
-/* 14 */ "EMCONFIG: Could not get target CONFIG.",
-/* 15 */ "EMSTATUS: Could not get target STATUS.",
-/* 16 */ "EMREAD: Could not READ target memory.",
-/* 17 */ "EMWRITE: Could not WRITE target memory.",
-/* 18 */ "EMBKPTSET: Could not set breakpoint.",
-/* 19 */ "EMBKPTRM: Could not remove breakpoint.",
-/* 20 */ "EMBKPTSTAT: Could not get breakpoint status.",
-/* 21 */ "EMBKPTNONE: All breakpoints in use.",
-/* 22 */ "EMBKPTUSED: Breakpoint already in use",
-/* 23 */ "EMCOPY: Could not COPY target memory.",
-/* 24 */ "EMFILL: Could not FILL target memory.",
-/* 25 */ "EMINIT: Could not initialize target memory.",
-/* 26 */ "EMGO: Could not start execution.",
-/* 27 */ "EMSTEP: Could not single step.",
-/* 28 */ "EMBREAK: Could not BREAK execution.",
-/* 29 */ "EMHIF: Could not perform HIF service.",
-/* 30 */ "EMCHANNEL0: Could not read CHANNEL0.",
-/* 31 */ "EMCHANNEL1: Could not write CHANNEL1.",
-/* 32 */ "EMOPEN: Could not open COFF file.",
-/* 33 */ "EMHDR: Could not read COFF header.",
-/* 34 */ "EMMAGIC: Bad COFF file magic number.",
-/* 35 */ "EMAOUT: Could not read COFF a.out header.",
-/* 36 */ "EMSCNHDR: Could not read COFF section header.",
-/* 37 */ "EMSCN: Could not read COFF section.",
-/* 38 */ "EMCLOSE: Could not close COFF file.",
-/* 39 */ "EMLOGOPEN: Could not open log file.",
-/* 40 */ "EMLOGREAD: Could not read log file.",
-/* 41 */ "EMLOGWRITE: Could not write log file.",
-/* 42 */ "EMLOGCLOSE: Could not close log file.",
-/* 43 */ "EMCMDOPEN: Could not open command file.",
-/* 44 */ "EMCMDREAD: Could not read comand file.",
-/* 45 */ "EMCMDWRITE: Could not write command file.",
-/* 46 */ "EMCMDCLOSE: Could not close command file.",
-/* 47 */ "EMTIMEOUT: Host timed out waiting for a message.",
-/* 48 */ "EMCOMMTYPE: A '-t' flag must be specified.",
-/* 49 */ "EMCOMMERR: Communication error.",
-/* 50 */ "EMBAUD: Invalid baud rate specified.",
-/* 51 */ "EMTIPINIT: TIP initialization failed. Exiting TIP.",
-/* 52 */ "EMIOSETF: Host I/O setup failure.",
-/* 53 */ "EMIORESETF: Host I/O reset failure.",
-/* 54 */ "EMLOADF: Loading COFF file failure.",
-/* 55 */ "EMNOFILE: No program to run.",
-/* 56 */ "EMECHOPEN: Could not open echo file.",
-/* 57 */ "EMCTRLC: Ctrl-C interrupt. Exiting.",
-/* 58 */ "EMNOSUCHCMD: Unrecognized command.",
-/* 59 */ "EMNOPROCESS: Failed creating process zero.",
-/* 60 */ "EMNOTCOMP: DFE and TIP versions not compatible.",
-/* 61 */ "EMFATAL: No session in progress.",
-/* 62 */ "EMNOINITP: (-n) No process initialized for downloaded program.",
-/* 63 */ "EMDOSERR: DOS error. Cannot escape to DOS.",
-/* 64 */ "EMSYSERR: System error. Cannot escape to host OS.",
-/* 65 */ "EMINCECHOFILE: Invalid echo file. Cannot enable echo.",
-/* 66 */ "EMCMDFILENEST: Nesting of command files not allowed."
-};
-
-
+++ /dev/null
-static char _[] = "@(#)fill.c 5.20 93/07/30 16:38:31, Srini, AMD.";
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- **
- ** This code provides "fill" routines to fill memory and
- ** registers. Data may be set as words (32 bit), half-words (16
- ** bit), bytes (8 bit), float (32 bit floating point) or double
- ** (64 bit floating point).
- **
- ** Since registers are 32 bits long, the fill byte and fill half
- ** commands will only be permitted for memory accesses.
- *****************************************************************************
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <memory.h>
-#include "main.h"
-#include "memspcs.h"
-#include "miniint.h"
-#include "macros.h"
-#include "error.h"
-
-
-#ifdef MSDOS
-#include <stdlib.h>
-#else
-#include <malloc.h>
-#endif
-
-int get_addr_29k PARAMS((char *, struct addr_29k_t *));
-int addr_29k_ok PARAMS((struct addr_29k_t *));
-
-int get_word PARAMS((char *, INT32 *));
-int get_half PARAMS((char *, INT16 *));
-int get_byte PARAMS((char *, BYTE *));
-int get_float PARAMS((char *, float *));
-int get_double PARAMS((char *, double *));
-
-int set_data PARAMS((BYTE *, BYTE *, int));
-
-
-/*
-** The function below is used in filling data. This function is
-** called in the main command loop parser of the monitor. The
-** parameters passed to this function are:
-**
-** token - This is an array of pointers to strings. Each string
-** referenced by this array is a "token" of the user's
-** input, translated to lower case.
-**
-** token_count - This is the number of items in the token array.
-**
-** This function reduces the tokens to four parameters:
-** the start address of the fill, the end address ofthe fill and
-** and the data to be filled in this range. This data
-** is one of the "temp_" variables.
-**
-*/
-
-#define MAX_FILL_LEN 128
-
-INT32
-fill_cmd(token, token_count)
- char *token[];
- int token_count;
- {
- int result;
- INT32 object_size;
- INT32 align_mask;
- INT32 fill_count;
- struct addr_29k_t addr_29k_start;
- struct addr_29k_t addr_29k_end;
- INT32 temp_word;
- INT16 temp_half;
- BYTE temp_byte;
- float temp_float;
- double temp_double;
-
- INT32 retval;
- BYTE fill_data[MAX_FILL_LEN];
-
-
- if (token_count < 4) {
- return (EMSYNTAX);
- }
-
- /*
- ** What is the data format?
- */
-
- if ((strcmp(token[0], "f") == 0) ||
- (strcmp(token[0], "fw") == 0)) {
- object_size = sizeof(INT32);
- align_mask = 0xfffffffc;
- result = get_word(token[3], &temp_word);
- if (result != 0)
- return (EMSYNTAX);
- result = set_data( fill_data, (BYTE *)&temp_word, sizeof(INT32));
- if (result != 0)
- return (EMSYNTAX);
- }
- else
- if (strcmp(token[0], "fh") == 0) {
- object_size = sizeof(INT16);
- align_mask = 0xfffffffe;
- result = get_half(token[3], &temp_half);
- if (result != 0)
- return (EMSYNTAX);
- result = set_data( fill_data, (BYTE *)&temp_half, sizeof(INT16));
- if (result != 0)
- return (EMSYNTAX);
- }
- else
- if (strcmp(token[0], "fb") == 0) {
- object_size = sizeof(BYTE);
- align_mask = 0xffffffff;
- result = get_byte(token[3], &temp_byte);
- if (result != 0)
- return (EMSYNTAX);
- result = set_data(fill_data, (BYTE *)&temp_byte, sizeof(BYTE));
- if (result != 0)
- return (EMSYNTAX);
- }
- else
- if (strcmp(token[0], "ff") == 0) {
- object_size = sizeof(float);
- align_mask = 0xfffffffc;
- result = get_float(token[3], &temp_float);
- if (result != 0)
- return (EMSYNTAX);
- result = set_data(fill_data, (BYTE *)&temp_float, sizeof(float));
- if (result != 0)
- return (EMSYNTAX);
- }
- else
- if (strcmp(token[0], "fd") == 0) {
- object_size = sizeof(double);
- align_mask = 0xfffffffc;
- result = get_double(token[3], &temp_double);
- if (result != 0)
- return (EMSYNTAX);
- result = set_data(fill_data, (BYTE *)&temp_double, sizeof(double));
- if (result != 0)
- return (EMSYNTAX);
- }
- else
- if (strcmp(token[0], "fs") == 0) { /* fill_data a string */
- object_size = (INT32) strlen ((char *) token[3]);
- if ((int) object_size >= (int) MAX_FILL_LEN)
- return (EMSYNTAX);
- align_mask = 0xfffffffc;
- (void) memset ((char *) fill_data, (int) '\0', sizeof(fill_data));
- (void) strcpy ((char *)&fill_data[0], (char *) token[3]);
- }
- else
- return(EMSYNTAX);
-
- /*
- ** Get addresses
- */
-
- result = get_addr_29k(token[1], &addr_29k_start);
- if (result != 0)
- return (EMSYNTAX);
- result = addr_29k_ok(&addr_29k_start);
- if (result != 0)
- return (result);
-
- result = get_addr_29k(token[2], &addr_29k_end);
- if (result != 0)
- return (EMSYNTAX);
- result = addr_29k_ok(&addr_29k_end);
- if (result != 0)
- return (result);
-
- /* Memory spaces must be the same */
- if (addr_29k_start.memory_space != addr_29k_end.memory_space)
- return (EMSYNTAX);
-
- /* No need to align registers */
- if (ISREG(addr_29k_start.memory_space))
- align_mask = 0xffffffff;
-
- /* Align addresses */
- addr_29k_start.address = (addr_29k_start.address & align_mask);
- addr_29k_end.address = (addr_29k_end.address & align_mask);
-
- /* End address must be larger than start address */
- if (addr_29k_start.address > addr_29k_end.address)
- return (EMSYNTAX);
-
- if (ISREG(addr_29k_end.memory_space)) {
- fill_count = ((addr_29k_end.address -
- addr_29k_start.address + 1) * 4) /
- object_size;
- }
- else
- if (ISMEM(addr_29k_end.memory_space)) {
- fill_count = (addr_29k_end.address -
- addr_29k_start.address +
- object_size) / object_size;
- }
- else
- return (EMSYNTAX);
-
- /*
- ** We don't set bytes or half words in registers
- */
-
- if (ISREG(addr_29k_start.memory_space) &&
- (object_size < sizeof(INT32)))
- return (EMSYNTAX);
-
- if ((retval = Mini_fill (addr_29k_start.memory_space,
- addr_29k_start.address,
- fill_count,
- object_size,
- fill_data)) <= TIPFAILURE) {
- return(FAILURE);
- } else if (retval == SUCCESS) {
- return(SUCCESS);
- } else {
- warning(retval);
- return(FAILURE);
- };
-
- } /* end set_cmd() */
-
-
-
+++ /dev/null
-static char _[] = "@(#)getdata.c 5.21 93/07/30 16:38:33, Srini, AMD.";
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- **
- ** This file contains functions used to parse strings into
- ** various data structures.
- **
- *****************************************************************************
- */
-
-#include <stdio.h>
-#include <ctype.h>
-#include "memspcs.h"
-#include "main.h"
-#include "opcodes.h"
-#include "macros.h"
-#include "error.h"
-
-#ifdef MSDOS
-#include <string.h>
-#else
-#include <string.h>
-#endif
-
-/* Function declarations */
-int get_data PARAMS(( BYTE *out_data, BYTE *in_data, int size));
-int set_data PARAMS((BYTE *out_data, BYTE *in_data, int size));
-int get_word_decimal PARAMS((char *buffer, INT32 *data_word));
-int get_double PARAMS((char *buffer, double *data_double));
-int get_float PARAMS((char *buffer, float *data_float));
-int get_byte PARAMS((char *buffer, BYTE *data_byte));
-int get_half PARAMS((char *buffer, INT16 *data_half));
-int get_word PARAMS((char *buffer, INT32 *data_word));
-int get_alias_29k PARAMS((char *reg_str, struct addr_29k_t *addr_29k));
-int get_register_29k PARAMS((char *reg_str,struct addr_29k_t *addr_29k));
-int get_memory_29k PARAMS((char *memory_str, struct addr_29k_t *addr_29k, INT32 default_space));
-int print_addr_29k PARAMS((INT32 memory_space, ADDR32 address));
-int addr_29k_ok PARAMS((struct addr_29k_t *addr_29k));
-int get_addr_29k PARAMS((char *addr_str, struct addr_29k_t *addr_29k));
-int get_addr_29k_m PARAMS((char *addr_str, struct addr_29k_t *addr_29k, INT32 default_space));
-void convert16 PARAMS(( BYTE *byte));
-void convert32 PARAMS(( BYTE *byte));
-
-
-/*
-** This function is used to parse a string into the
-** memory space / address pair used by the Am29000.
-** the memory spaces supported are in the "memspcs.h"
-** file.
-**
-** The strings parsed are:
-**
-** lr0 to gr127 (Local registers)
-** gr0 to gr127 (Global registers)
-** sr0 to sr127 (Special registers)
-** tr0 to tr127 (TLB registers)
-** xr0 to xr32 (Coprocessor registers)
-** and
-** <hex_addr>{i|r|d}
-**
-** If successful, the Am29000 memory space / address pair
-** pointed to by addr_29k is filled in and zero is returned.
-** If unsuccessful, a -1 is returned and the values in
-** addr_29k are undefined.
-**
-** Note: This function expects an unpadded, lower case
-** ASCII string.
-*/
-
-
-int
-get_addr_29k(addr_str, addr_29k)
- char *addr_str;
- struct addr_29k_t *addr_29k;
- {
- /* defaults memory addresses to D_MEM */
- return(get_addr_29k_m(addr_str, addr_29k, D_MEM));
- }
-
-
-int
-get_addr_29k_m(addr_str, addr_29k, default_space)
- char *addr_str;
- struct addr_29k_t *addr_29k;
- INT32 default_space; /* for default if no space given in string */
- {
- int result;
-
- result = get_memory_29k(addr_str, addr_29k, default_space);
-
- if (result != 0)
- result = get_register_29k(addr_str, addr_29k);
-
- if (result != 0)
- result = get_alias_29k(addr_str, addr_29k);
-
- return (result);
- } /* end get_addr_29k() */
-
-
-/*
-** This function is used to verify that an Am29000
-** memory space / address pair contains a valid address.
-** The memory spaces supported are those defined in the
-** "memspcs.h" header file.
-**
-** The global structure "target_config" is also used to
-** do range checking.
-**
-** If successful, a 0 is returned, otherwise -1 is
-** returned.
-*/
-
-
-int
-addr_29k_ok(addr_29k)
- struct addr_29k_t *addr_29k;
- {
- int return_code;
- ADDR32 start_addr;
- ADDR32 end_addr;
-
- return_code = 0;
-
- if (addr_29k->memory_space == LOCAL_REG) {
- if (addr_29k->address > 127)
- return_code = EMBADREG;
- }
- else
- if (addr_29k->memory_space == ABSOLUTE_REG) {
- if ((addr_29k->address >= 0) && (addr_29k->address <= 255))
- return (0);
- else
- return (EMBADREG);
- }
- else
- if (addr_29k->memory_space == GLOBAL_REG) {
- if (PROCESSOR(target_config.processor_id) == PROC_AM29050) {
- if ( ((addr_29k->address > 3) &&
- (addr_29k->address < 64)) ||
-
- (addr_29k->address > 127))
- return_code = EMBADREG;
- } else {
- if ( ((addr_29k->address > 1) &&
- (addr_29k->address < 64)) ||
-
- (addr_29k->address > 127))
- return_code = EMBADREG;
- }
- } else /* Note: Am29xxx procesors have different SPECIAL_REGs */
- if ((addr_29k->memory_space == SPECIAL_REG) ||
- (addr_29k->memory_space == A_SPCL_REG)) {
-
- if ((PROCESSOR(target_config.processor_id) == PROC_AM29030) ||
- (PROCESSOR(target_config.processor_id) == PROC_AM29240) ||
- (PROCESSOR(target_config.processor_id) == PROC_AM29035)) {
-
- if (((addr_29k->address > 14) &&
- (addr_29k->address < 29)) ||
-
- ((addr_29k->address > 30) &&
- (addr_29k->address < 128)) ||
-
- ((addr_29k->address > 135) &&
- (addr_29k->address < 160)) ||
-
- ((addr_29k->address > 162) &&
- (addr_29k->address < 164)) ||
-
- (addr_29k->address > 164))
- return_code = EMBADREG;
- }
- else
- if (PROCESSOR(target_config.processor_id) == PROC_AM29050) {
-
- if (((addr_29k->address > 26) &&
- (addr_29k->address < 128)) ||
-
- ((addr_29k->address > 135) &&
- (addr_29k->address < 160)) ||
-
- (addr_29k->address > 164))
- return_code = EMBADREG;
- }
- else /* default */
- if (((addr_29k->address > 14) &&
- (addr_29k->address < 128)) ||
-
- ((addr_29k->address > 135) &&
- (addr_29k->address < 160)) ||
-
- ((addr_29k->address > 162) &&
- (addr_29k->address < 164)) ||
-
- (addr_29k->address > 164))
- return_code = EMBADREG;
- } /* end if (SPECIAL_REG) */
- else
- if (addr_29k->memory_space == TLB_REG) {
- if (addr_29k->address > 127)
- return_code = EMBADREG;
- }
- else
- if (addr_29k->memory_space == COPROC_REG) {
- if (target_config.coprocessor != 0)
- return_code = EMBADREG;
- if (addr_29k->address > 32)
- return_code = EMBADREG;
- }
- else
- if (addr_29k->memory_space == PC_SPACE) {
- return (0);
- }
- else
- if (addr_29k->memory_space == GENERIC_SPACE) {
- return (0);
- }
- else
- if (addr_29k->memory_space == I_MEM) {
- start_addr = target_config.I_mem_start;
- end_addr = start_addr + (ADDR32) target_config.I_mem_size;
- if ((addr_29k->address < start_addr) ||
- (addr_29k->address > end_addr))
- return_code = EMBADADDR;
- }
- else
- if (addr_29k->memory_space == D_MEM) {
- start_addr = target_config.D_mem_start;
- end_addr = start_addr + (ADDR32) target_config.D_mem_size;
- if ((addr_29k->address < start_addr) ||
- (addr_29k->address > end_addr))
- return_code = EMBADADDR;
- }
- else
- if (addr_29k->memory_space == I_ROM) {
- start_addr = target_config.ROM_start;
- end_addr = start_addr + (ADDR32) target_config.ROM_size;
- if ((addr_29k->address < start_addr) ||
- (addr_29k->address > end_addr))
- return_code = EMBADADDR;
- }
- else
- if (addr_29k->memory_space == D_ROM) {
- return_code = EMBADADDR; /* We don't use this memory space */
- }
- else
- if (addr_29k->memory_space == I_O) {
- return (0); /* No checking on I/O space */
- }
- else
- return_code = EMBADADDR; /* Unknown memory space */
-
- return (return_code);
-
- } /* end addr_29k_ok() */
-
-
-
-
-
-/*
-** This function is used to print out an address. The
-** parameters are a memory_space and an address. This
-** function returns a 0 if the command was successful and
-** a -1 on failure.
-**
-** The strings printed are:
-**
-** lr0 to gr127 (Local registers)
-** gr0 to gr127 (Global registers)
-** sr0 to sr127 (Special registers)
-** tr0 to tr127 (TLB registers)
-** xr0 to xr32 (Coprocessor registers)
-** <hex_addr> (Data memory)
-** <hex_addr>i (instruction memory)
-** and
-** <hex_addr>r (ROM memory)
-**
-*/
-
-
-int
-print_addr_29k(memory_space, address)
- INT32 memory_space;
- ADDR32 address;
- {
- char buf[80];
-
- if (memory_space == LOCAL_REG)
- sprintf(&buf[0], "lr%03ld ", address);
- else
- if (memory_space == ABSOLUTE_REG)
- sprintf(&buf[0], "ar%03ld ", address);
- else
- if (memory_space == GLOBAL_REG)
- sprintf(&buf[0], "gr%03ld ", address);
- else
- if ((memory_space == SPECIAL_REG) || (memory_space == A_SPCL_REG))
- sprintf(&buf[0], "sr%03ld ", address);
- else
- if (memory_space == PC_SPACE)
- sprintf(&buf[0], "pc%03ld ", address);
- else
- if (memory_space == TLB_REG)
- sprintf(&buf[0], "tr%03ld ", address);
- else
- if (memory_space == COPROC_REG)
- sprintf(&buf[0], "xr%03ld ", address);
- else
- if (memory_space == I_MEM)
- sprintf(&buf[0], "%08lxi ", address);
- else
- if (memory_space == D_MEM)
- sprintf(&buf[0], "%08lx ", address);
- else
- if (memory_space == GENERIC_SPACE)
- sprintf(&buf[0], "%08lx ", address);
- else
- if (memory_space == I_ROM)
- sprintf(&buf[0], "%08lxr ", address);
- else
- if (memory_space == D_ROM)
- sprintf(&buf[0], "%08ldr ", address);
- else
- if (memory_space == I_O)
- sprintf(&buf[0], "%08lx(i/o)", address);
- else
- return (-1);
-
- fprintf (stderr, "%s", &buf[0]);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "%s", &buf[0]);
- return (0);
- } /* end print_addr_29k() */
-
-
-
-/*
-** This function is used to convert a string denoting a
-** 29k address into an addr_29k_t memory space / address pair.
-** This function recognizes the registers described in
-** get_addr_29k() above.
-*/
-
-int
-get_memory_29k(memory_str, addr_29k, default_space)
- char *memory_str;
- struct addr_29k_t *addr_29k;
- INT32 default_space;
- {
- int i;
- int fields;
- int string_length;
- ADDR32 addr;
- char i_r;
- char error;
-
- addr_29k->memory_space = -1;
- addr_29k->address = -1;
-
- addr = 0;
- i_r = '\0';
- error = '\0';
-
- /* Get rid of leading "0x" */
- if ((strlen(memory_str) > 2) &&
- (strncmp(memory_str, "0x", 2) == 0))
- memory_str = &(memory_str[2]);
-
- string_length = strlen(memory_str);
-
- if ((string_length > 10) || (string_length < 1))
- return (EMBADADDR);
-
- if (memory_str[0] == '.') {/* relative offset */
- fields = sscanf(&memory_str[1], "%lx%c%c", &addr, &i_r, &error);
- addr_29k->memory_space = PC_RELATIVE;
- addr_29k->address = addr;
- return (0);
- }
-
- for (i=1; i<(string_length-1); i=i+1)
- if (isxdigit(memory_str[i]) == 0)
- return (EMBADADDR);
-
- if ((isxdigit(memory_str[(string_length-1)]) == 0) &&
- (memory_str[(string_length-1)] != 'i') &&
- (memory_str[(string_length-1)] != 'm') &&
- (memory_str[(string_length-1)] != 'u') &&
- (memory_str[(string_length-1)] != 'p') &&
- (memory_str[(string_length-1)] != 'r'))
- return (EMBADADDR);
-
- fields = sscanf(memory_str, "%lx%c%c", &addr, &i_r, &error);
-
- addr_29k->address = addr;
-
- if (fields == 1) {
- addr_29k->memory_space = default_space;
- }
- else
- if (fields == 2) {
- if ((i_r == '\0') || (i_r == 'm'))
- addr_29k->memory_space = D_MEM;
- else
- if (i_r == 'r')
- addr_29k->memory_space = I_ROM;
- else
- if (i_r == 'i')
- addr_29k->memory_space = I_MEM;
- else
- if (i_r == 'p')
- if ((target_config.processor_id & 0xf1) >= 0x50)
- addr_29k->memory_space = GENERIC_SPACE;
- else
- addr_29k->memory_space = I_O;
- else
- if (i_r == 'u')
- addr_29k->memory_space = GENERIC_SPACE;
- else
- return (EMBADADDR);
- }
- else
- return (EMBADADDR);
-
- return (0);
- } /* end get_memory_29k() */
-
-
-
-/*
-** This function is used to convert a string denoting an
-** 29k register into an addr_29k_t memory space / address pair.
-*/
-
-int
-get_register_29k(reg_str, addr_29k)
- char *reg_str;
- struct addr_29k_t *addr_29k;
- {
- int fields;
- ADDR32 reg_number;
- char error;
-
- addr_29k->memory_space = -1;
- addr_29k->address = -1;
-
- reg_number = 0;
- error = '\0';
-
- if (strlen(reg_str) > 8)
- return (EMBADREG);
-
- if (strncmp(reg_str, "lr", 2) == 0)
- addr_29k->memory_space = LOCAL_REG;
- else
- if (strncmp(reg_str, "ar", 2) == 0)
- addr_29k->memory_space = ABSOLUTE_REG;
- else
- if (strncmp(reg_str, "gr", 2) == 0)
- addr_29k->memory_space = GLOBAL_REG;
- else
- if (strncmp(reg_str, "sr", 2) == 0)
- addr_29k->memory_space = A_SPCL_REG;
- else
- if (strncmp(reg_str, "tr", 2) == 0)
- addr_29k->memory_space = TLB_REG;
- else
- if (strncmp(reg_str, "xr", 2) == 0)
- addr_29k->memory_space = COPROC_REG;
-
- /* Get register number */
- if (addr_29k->memory_space != -1) {
- fields = sscanf(&(reg_str[2]), "%ld%c", ®_number, &error);
- if ((fields == 1) &&
- (error == '\0'))
- addr_29k->address = reg_number;
- else
- addr_29k->memory_space = -1;
- }
-
- if (addr_29k->memory_space == -1)
- return (EMBADREG);
- else
- return (0);
- } /* end get_register_29k() */
-
-
-
-
-/*
-** This function is used to get the special register aliases
-** ("cps", "vab", "ops", etc ...) in addition to the registers
-** described in get_addr_29k() above.
-*/
-
-int
-get_alias_29k(reg_str, addr_29k)
- char *reg_str;
- struct addr_29k_t *addr_29k;
- {
- int i;
- int result;
- int found;
-
- addr_29k->memory_space = -1;
- addr_29k->address = -1;
-
- if (strlen(reg_str) > 8)
- return (EMBADREG);
-
- /* Check for logical PC */
- if ((strcmp("pc", reg_str) == 0) ||
- (strcmp("PC", reg_str) == 0)) {
- addr_29k->memory_space = PC_SPACE;
- addr_29k->address = (ADDR32) 0;
- return (0);
- }
- /* Search for a special register alias */
- i=0;
- found = FALSE;
- while ((i<256) && (found != TRUE)) {
- result = strcmp(spreg[i], reg_str);
- if (result == 0) {
- found = TRUE;
- addr_29k->memory_space = A_SPCL_REG;
- addr_29k->address = (ADDR32) i;
- }
- i = i + 1;
- } /* end while */
-
- if (found == TRUE)
- return (0);
- else
- return (EMBADREG);
-
- } /* end get_alias_29k() */
-
-
-
-
-
-/*
-** This function is used to read in a 32 bit hex word.
-** This word is input as an ASCII string and converted
-** into an INT32 data_word. If the conversion is successful,
-** a zero is returned, otherwise a -1 is returned.
-*/
-
-int
-get_word(buffer, data_word)
- char *buffer;
- INT32 *data_word;
- {
- int fields;
- char error;
-
- /* No more than eight (hex) characters */
- if (strlen(buffer) > 8)
- return (EMSYNTAX);
-
- fields = sscanf(buffer, "%lx%c", data_word, &error);
-
- if (fields != 1)
- return (EMSYNTAX);
-
- return (0);
-
- } /* end get_word() */
-
-
-
-int
-get_half(buffer, data_half)
- char *buffer;
- INT16 *data_half;
- {
- int fields;
- char error;
- INT16 temp_int;
-
- /* No more than four (hex) characters */
- if (strlen(buffer) > 4)
- return (EMSYNTAX);
-
- fields = sscanf(buffer, "%hx%c", &temp_int, &error);
-
- if (fields != 1)
- return (EMSYNTAX);
-
- *data_half = (INT16) temp_int;
-
- return (0);
-
- } /* end get_half() */
-
-
-int
-get_byte(buffer, data_byte)
- char *buffer;
- BYTE *data_byte;
- {
- int fields;
- char error;
- int temp_int;
-
- /* No more than two (hex) characters */
- if (strlen(buffer) > 2)
- return (EMSYNTAX);
-
- fields = sscanf(buffer, "%x%c", &temp_int, &error);
-
- if (fields != 1)
- return (EMSYNTAX);
-
- *data_byte = (BYTE) temp_int;
-
- return (0);
-
- } /* end get_byte() */
-
-
-int
-get_float(buffer, data_float)
- char *buffer;
- float *data_float;
- {
- int fields;
- char error;
-
- fields = sscanf(buffer, "%f%c", data_float, &error);
-
- if (fields != 1)
- return (EMSYNTAX);
-
- return (0);
-
- } /* end get_float() */
-
-
-int
-get_double(buffer, data_double)
- char *buffer;
- double *data_double;
- {
- int fields;
- char error;
-
- fields = sscanf(buffer, "%lf%c", data_double, &error);
-
- if (fields != 1)
- return (EMSYNTAX);
-
- return (0);
-
-
- } /* end get_double() */
-
-
-
-
-/*
-** This function is used to read in a 32 bit decimal word.
-** This word is input as an ASCII string and converted
-** into an INT32 data_word. If the conversion is successful,
-** a zero is returned, otherwise a -1 is returned.
-** This function is very similar to get_word().
-*/
-
-int
-get_word_decimal(buffer, data_word)
- char *buffer;
- INT32 *data_word;
- {
- int fields;
- char error;
-
- /* No more than eight (hex) characters */
- if (strlen(buffer) > 8)
- return (EMSYNTAX);
-
- fields = sscanf(buffer, "%ld%c", data_word, &error);
-
- if (fields != 1)
- return (EMSYNTAX);
-
- return (0);
-
- } /* end get_word_decimal() */
-
-
-/*
-** This function is used to copy data from into and out
-** of the message buffers. If necessary, endian
-** conversion is performed.
-*/
-
-int
-set_data(out_data, in_data, size)
- BYTE *out_data;
- BYTE *in_data;
- int size;
- {
- int i;
-
- if (host_config.host_endian == host_config.target_endian)
- for (i=0; i<size; i=i+1)
- out_data[i] = in_data[i];
- else
- for (i=0; i<size; i=i+1)
- out_data[i] = in_data[((size-1)-i)];
-
- return (0);
- } /* end set_data() */
-
-
-
-
-/*
-** This function is used to get data.
-** If necessary, endian conversion is performed.
-*/
-
-int
-get_data(out_data, in_data, size)
- BYTE *out_data;
- BYTE *in_data;
- int size;
- {
- int i;
-
- if (host_config.host_endian == host_config.target_endian)
- for (i=0; i<size; i=i+1)
- out_data[i] = in_data[i];
- else
- for (i=0; i<size; i=i+1)
- out_data[i] = in_data[((size-1)-i)];
-
- return (0);
- } /* end get_data() */
-
-
-
-/*
-** This function is used to swap the bytes in a 32 bit
-** word. This will convert "little endian" (IBM-PC / Intel)
-** words to "big endian" (Sun / Motorola) words.
-*/
-
-void
-convert32(byte)
- BYTE *byte;
- {
- BYTE temp;
-
- temp = byte[0]; /* Swap bytes 0 and 3 */
- byte[0] = byte[3];
- byte[3] = temp;
- temp = byte[1]; /* Swap bytes 1 and 2 */
- byte[1] = byte[2];
- byte[2] = temp;
- } /* end convert32() */
-
-
-/*
-** This function is used to swap the bytes in a 16 bit
-** word. This will convert "little endian" (IBM-PC / Intel)
-** half words to "big endian" (Sun / Motorola) half words.
-*/
-
-void
-convert16(byte)
- BYTE *byte;
- {
- BYTE temp;
-
- temp = byte[0]; /* Swap bytes 0 and 1 */
- byte[0] = byte[1];
- byte[1] = temp;
-
- } /* end convert16() */
+++ /dev/null
-static char _[] = "@(#)help.c 5.22 93/08/23 15:30:33, Srini, AMD.";
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- ** This file contains the help screens for the monitor.
- *****************************************************************************
- */
-
-/*
-** Main help
-*/
-
-char *help_main[] = {
-
-"Use 'h <letter>' for individual command help",
-" ",
-" --------------------- MONDFE Monitor Commands -----------------------------",
-" a - Assemble Instruction | b,b050,bc - Set/Clear/Display Breakpoint",
-" c - Print Configuration | caps - DFE and TIP Capabilities",
-" cp - Create UDI Process | con - Connect to a UDI Debug Session",
-" ch0 - 29K Terminal Control | d,dw,dh,db,df,dd - Dump Memory/Registers",
-" dp - Destroy UDI Process | disc - Temporarily Disconnect UDI Session",
-" ex - Exit UDI Session | esc - Escape to Host Operating System",
-" eon - Turn Echo Mode ON | eoff - Turn Echo Mode OFF",
-" g - Start/Resume Execution | f,fw,fh,ff,fd,fs - Fill Memory/Registers",
-" h - Help Command | init - Initialize Current UDI Process",
-" ix,il - Display Am2903X Cache | k - Kill Running Program on 29K Target",
-" logon - Turn ON log mode | logoff - Turn OFF log mode",
-" l - List/Disassemble Memory | m - Move Data to Memory/Registers",
-" pid - Set UDI Process ID | q - Quit mondfe",
-" qon - Turn Quiet Mode ON | qoff - Turn Quiet Mode OFF",
-" sid - Set UDI Session ID | r - Reset (software reset) 29K Target",
-" t - Trace/Single Step Execution | s,sw,sh,sb,sf,sd - Set Memory/Registers",
-" ver - Montip Version Command | tip - Montip Transparent Mode Command",
-" y - Yank/Download COFF File | xp - Display Protected Special Registers",
-" ze - Echo File For Echo Mode | zc - Execute commands from command file",
-" zl - Use log file for log mode | | - Comment character (in Command File)",
-" ----------------------------------------------------------------------------",
-""
-};
-
-
-/*
-** Assemble
-*/
-
-char *help_a[] = {
-
-"A <address> <instruction>",
-" ",
-"Assemble instructions into memory.",
-" ",
-"The address, is the memory address for the instruction.",
-" ",
-"The instruction will be assembled and placed in memory at the",
-"specified address.",
-" ",
-"Memory addresses:",
-" ",
-"<hex>m - data memory <hex>i - instruction memory",
-"<hex>r - rom memory <hex>u - unspecified (no addr check)",
-""
-};
-
-
-/*
-** Breakpoint
-*/
-
-char *help_b[] = {
-
-"Breakpoint display, set and clear.",
-" ",
-"B - displays valid breakpoints",
-"B <address> [<passcount>] - to set software breakpoint",
-"B050[P,V] <address> [<passcount>] - to set Am29050 hardware breakpoint",
-" When B050P is used, breakpoint is hit only if translation is disabled.",
-" When B050V is used, breakpoint is hit only if translation is enables.",
-"A breakpoint is set at the specified address. An optional",
-"<pass count> sets the pass count. The B050 command sets",
-"a breakpoint using an Am29050 breakpoint register. ",
-"BC <address> - to clear the breakpoint set at <address>",
-"BC - clears all breakpoints.",
-" ",
-"<address> format:",
-" ",
-"<hex>m - data memory <hex>i - instruction memory",
-"<hex>r - rom memory <hex>u - unspecified (no addr check)",
-" B Command usage: B, B050, B050V, B050P",
-""
-};
-
-
-/*
-** Configuration help
-*/
-
-char *help_c[] = {
-
-"C - Prints target system configuration.",
-" ",
-"This command is used to read and display the target configuration.",
-"A banner is printed displaying information about the target.",
-" ",
-" Other C commands: CAPS, CP, CON, CH0",
-""
-};
-
-char *help_caps[] = {
-" CAPS - Prints UDI capabilities of DFE and TIP",
-" This prints the DFE version number, TIP version number, and UDI revision.",
-""
-};
-
-char *help_cp[] = {
-"CP - Create a UDI Process.",
-" This sends a request to the TIP to create a new process.",
-""
-};
-
-char *help_con[] = {
-"CON <session_id>- Requests connection to UDI TIP running <session_id>.",
-" This connects to the debug session specified by <session_id>.",
-""
-};
-
-char *help_ch0[] = {
-" CH0 - Transfers control of the terminal to the 29K target.",
-" This is used to transfer control to the 29K target program.",
-" The input characters typed are sent to the TIP without interpreting",
-" for a mondfe command. Control is transferred to mondfe when a Ctrl-U",
-" is typed.",
-""
-};
-/*
-** Dump
-*/
-
-char *help_d[] = {
-
-"D[W|H|B|F|D] [<from_address> [<to_address>]]",
-" ",
-"Display memory or register contents.",
-" ",
-"DW or D - display as words. DF - display in floating point.",
-"DH - display as half-words. DD - display in double precision",
-"DB - display as bytes. floating point.",
-" ",
-"<from_address> defaults to address last displayed. The ",
-"<to_address> is the address of the last data to display. The default",
-"is about eight lines of data.",
-" ",
-"Valid register names:",
-"gr0-gr1, gr64-gr127 - global register names",
-"sr0-sr14, sr128-sr135, sr160-sr162,sr164 - special register names",
-"lr0-lr127 - local register names ",
-"tr0-tr127 - TLB register names ",
-"<address> format:",
-" ",
-"<hex>m - data memory <hex>i - instruction memory",
-"<hex>r - rom memory <hex>u - unspecified (no addr check)",
-" D Command usage: D, DW, DH, DB, DF, DD",
-" Other D Commands: DP, DISC",
-""
-};
-
-
-char *help_dp[] = {
-" DP - Destroy process.",
-" This requests the TIP to destroy a UDI process. ",
-""
-};
-
-char *help_disc[] = {
-" DISC - Disconnect from the debug session.",
-" This disconnects the DFE from the current debug session. The TIP is",
-" not destroyed and left running for later reconnections.",
-""
-};
-/*
- * Escape command
- */
-
-char *help_e[] = {
-"ESC",
-" ",
-"Temporarily exit to host operating system.",
-"Use EXIT command to resume debug session.",
-"Other E commands: EON, EOFF",
-""
-};
-
-char *help_ex[] = {
-" EX - Exit current debug session.",
-" This command can be used to exit from a debug session when done. Mondfe",
-" looks for another session in progress and connects to that session. If",
-" there are no more debug sessions in progress, this command causes Mondfe",
-" to quit, i.e. it has the same effect as the Quit command",
-""
-};
-
-char *help_esc[] = {
-"ESC",
-" ",
-"Temporarily exit to host operating system.",
-"Use EXIT command to resume debug session.",
-"Other E commands: EON, EOFF",
-""
-};
-
-char *help_eon[] = {
-" EON and EOFF can be used to turn echo mode ON and OFF during the",
-" interactive debug session. Echo mode is specified by using the -e ",
-" mondfe command line option and an file name. During echo mode, everything",
-" displayed on the screen are captured in the file specified.",
-""
-};
-
-/*
-** Fill
-*/
-
-char *help_f[] = {
-
-"F[W|H|B|F|D] <start address>, <end address>, <value>",
-" ",
-"Fill memory or register contents.",
-" ",
-"FW or F - fill as 32-bit integers | FF - fill as floating point value.",
-"FH - fill as 16-bit integers | FD - fill as double precision",
-"FB - fill as 8-bit integers | floating point value.",
-"FS - fill with the string/pattern given.",
-" ",
-"Valid register names:",
-"gr0-gr1, gr64-gr127 - global register names",
-"sr0-sr14, sr128-sr135, sr160-sr162,sr164 - special register names",
-"lr0-lr127 - local register names ",
-"tr0-tr127 - TLB register names ",
-" ",
-"<address> format:",
-" ",
-"<hex>m - data memory <hex>i - instruction memory",
-"<hex>r - rom memory <hex>u - unspecified (no addr check)",
-" F command usage: F, FW, FH, FB, FD, FS",
-""
-};
-
-
-/*
-** Go
-*/
-
-char *help_g[] = {
-
-"G - Start program execution",
-" ",
-"This resumes program execution at the next instruction.",
-" The program runs either until completion or until it hits a breakpoint",
-" It is used to run the downloaded program and to resume after hitting",
-" a breakpoint. The trace command can be used to execute a specified",
-" number of instructions.",
-""
-};
-
-
-/*
-** I (ix, ia, il)
-*/
-
-char *help_i[] = {
-"IX, IL - Display/Disassemble Am2903X cache registers",
-" ",
-"Display/Disassemble 2903x cache registers by bit field name.",
-" I Commands: IX, IL ",
-" Other I commands: INIT",
-""
-};
-
-char *help_init[] = {
-" INIT - Initialize the current process.",
-" This is used to initialize the downloaded program to restart execution",
-" or to reset the target. It resets the target when the current process",
-" ID is set to -1. It does not clear BSS of the downloaded program for ",
-" restart.",
-""
-};
-
-/*
-** Help
-*/
-
-char *help_h[] = {
-
-"H <cmd>",
-" ",
-"Get help for a monitor command",
-" ",
-"This gets help for a particular monitor command. If <cmd>.",
-"is not a valid monitor command the main help screen is listed.",
-" Type <command_name> for help on a particular command.",
-""
-};
-
-
-/*
-** Kill
-*/
-
-char *help_k[] = {
-
-"K - Kill command.",
-" When a K command is issued, the running program on the 29K target",
-" is stopped.",
-""
-};
-
-
-/*
-** List (disassemble)
-*/
-
-char *help_l[] = {
-
-"L [<first_address> [<last_address>]]",
-" ",
-"Disassemble instructions from memory.",
-" ",
-"The <first_address,> if specified, is the memory address for the first",
-"instruction. If no <first_address> is specified, disassembly will begin",
-"from the address in the buffer.",
-" ",
-"The <last_address,> if specified, is the last address to be disassembled.",
-"If no <last_address> is specified, the number of lines of data in the",
-"previous disassemble command will be displayed.",
-" ",
-"<address> format:",
-" ",
-"<hex>m - data memory <hex>i - instruction memory",
-"<hex>r - rom memory <hex>u - unspecified (no addr check)",
-" Other L commands: logon, logoff",
-""
-};
-
-char *help_logon[] = {
-" LOGON and LOGOFF commands can be used to turn ON or OFF the log mode",
-" from the mondfe command prompt. WHen log mode is on, every command entered",
-" by the user is logged into the log file specified at invocation or using",
-" the ZL command. When log mode is off, the commands are not logged.",
-""
-};
-
-/*
-** Move
-*/
-
-char *help_m[] = {
-
-"M <source start> <source end> <destination start>",
-" ",
-"Move within memory or registers. Destination will contain exact",
-"copy of original source regardless of overlap. (The source",
-"will be partially altered in the case of overlap.)",
-" ",
-"Valid register names:",
-"gr0-gr1, gr64-gr127 - global register names",
-"sr0-sr14, sr128-sr135, sr160-sr162,sr164 - special register names",
-"lr0-lr127 - local register names ",
-"tr0-tr127 - TLB register names ",
-" ",
-"<address> format :",
-" ",
-"<hex>m - data memory <hex>i - instruction memory",
-"<hex>r - rom memory <hex>u - unspecified (no addr check)",
-""
-};
-
-char *help_pid[] = {
-" PID <pid_number> - sets the current UDI process to the <pid_number>",
-" specified.",
-" A <pid_number> of -1 is used to represent the bare machine. This is",
-" is used to access physical addresses, and to reset the target.",
-" Use CP command to create process. Use DP command to destroy process.",
-" Use INIT command to initialize process.",
-""
-};
-
-/*
-** Quit
-*/
-
-char *help_q[] = {
-
-"Q",
-" ",
-"Quit - exit from the monitor.",
-""
-};
-
-char *help_qoff[] = {
-" QON and QOFF can be used to turn ON/OFF quiet mode of Mondfe. The -q",
-" command line option of mondfe can be used to invoke mondfe in quiet",
-" mode. In quiet mode, the debug messages are suppressed. These messages",
-" can be turned on anytime during the debug session using the QON command",
-" and turned off using the QOFF command.",
-""
-};
-
-
-/*
-** Reset
-*/
-
-char *help_r[] = {
-
-"R - Reset the target.",
-" This command resets (performs a software reset) of the target. This is",
-" equivalent to setting the UDI process ID to -1, and initializing the",
-" process using INIT.",
-""
-};
-
-
-/*
-** Set
-*/
-
-char *help_s[] = {
-
-"S[W|H|B|F|D] <address> <data>",
-" ",
-"Set memory or register contents.",
-" ",
-"SW or S - set as words. SF - set in floating point.",
-"SH - set as half-words. SD - set in double precision",
-"SB - set as bytes. floating point.",
-" ",
-"<address> indicates location to be set. <Data> is the value",
-"to be set. The data is entered in hexadecimal.",
-" ",
-"Valid register names:",
-"gr0-gr1, gr64-gr127 - global register names",
-"sr0-sr14, sr128-sr135, sr160-sr162,sr164 - special register names",
-"lr0-lr127 - local register names ",
-"tr0-tr127 - TLB register names ",
-" ",
-"<address> format:",
-" ",
-"<hex>m - data memory <hex>i - instruction memory",
-"<hex>r - rom memory <hex>u - unspecified (no addr check)",
-" S command usage: S, SW, SH, SB, SF, SD",
-" Other S command: SID",
-""
-};
-
-char *help_sid[] = {
-" SID <sid_number> - sets the UDI session ID to <sid_number>.",
-" This command can be used to set the current debug session when there",
-" is multiple debug sessions going on.",
-""
-};
-
-/*
-** Trace
-*/
-
-char *help_t[] = {
-
-"T <count> - Trace or Step <count> instructions.",
-"Trace allows stepping through code. The optional <count>",
-"allows multiple steps to be taken. The count is in hex.",
-" The default value of <count> is 1. This may not step into",
-" trap handlers based on the target/TIP capabilities.",
-" Other T commands: TIP",
-""
-};
-
-char *help_tip[] = {
-" TIP <montip_command> - sends <montip_command> string to montip for execution",
-" The TIP command can be used to inform Montip to change some of its",
-" parameters. The TIP command uses the UDI Transparent mode to pass",
-" the command string. The following TIP commands are now supported:",
-" tip lpt=0",
-" - requests Montip is stop using the parallel port for communicating",
-" to the 29K target - valid for 29K microcontroller targets.",
-" tip lpt=1",
-" - requests Montip to use the parallel port for communicating",
-" to the 29K target - valid for 29K microcontroller targets.",
-" The TIP command can be used before issuing a Y(ank) command to download",
-" a program (COFF) file using the PC parallel port. The parallel port",
-" download capability is only applicable for a PC host. The parallel port",
-" to use MUST be specified as a Montip command line option in the UDI ",
-" configuration file - udiconfs.txt on PC, udi_soc on Unix hosts - using",
-" the -par Montip command line option.",
-" As the parallel port communication is only unidirectional, the serial",
-" communications port - com1, or com2 - must also be specified on Montip",
-" command line in the UDI configuration file.",
-" This command is valid ONLY with MiniMON29K Montip.",
-""
-};
-
-/*
-** X
-*/
-
-char *help_x[] = {
-"XP - Display protected special purpose registers.",
-" ",
-"Display protected special purpose registers by bit field name.",
-""
-};
-
-
-/*
-** Yank
-*/
-
-char *help_y[] = {
-
-"Y [-t|d|l|b] [-noi|-i] [-ms <mstk_x>] [-rs <rstk_x] [fname] [arglist]",
-" ",
-"This is the Yank command to download program (COFF) file to the 29K target.",
-" ",
-"where <fname> is name of a COFF file.",
-" ",
-"<arglist> is the list of command line arguments for the program.",
-" ",
-"-t|d|l|b| gives sections for loading. t->text, d->data, l->lit, b->bss.",
-" ",
-"-noi -> no process created, -i -> download for execute (default).",
-" ",
-"-ms <memstk_hex> -> memory stack size, -rs <regstk_hex> -> reg stack size.",
-" ",
-"Ex: y -db hello.pcb arg1 arg2, loads only the DATA and LIT sections.",
-" ",
-"Simply typing Y will use args from the previous Y issued.",
-" ",
-" See the TIP command for downloading using parallel port",
-""
-};
-
-
-char *help_zc[] = {
-" ZC <cmdfile_name> - execute commands from the <cmdfile_name> command file",
-" The ZC command can be used to execute a series of Mondfe commands",
-" out of a command file. The <cmdfile_name> is the name of the file",
-" containing the command input. This command can be executed at the",
-" mondfe> prompt. When all the commands from the file are executed, the",
-" mondfe> prompt appears again.",
-" Nesting of command files is not allowed.",
-" ",
-" Other Z commands: ZE, ZL",
-""
-};
-
-char *help_ze[] = {
-" ZE <echofile_name> - turns ECHO mode ON and specifies the echo file",
-" When echo mode is on, everything that is displayed on the screen is ",
-" also written into a file, the echo file. The <echofile_name> string ",
-" specifies the file name of the echo file to use.",
-""
-};
-
-char *help_zl[] = {
-" ZL <logfile_name> - turns LOG mode ON and specifies the log file to use",
-" When log mode is on, every mondfe command entered by the user is logged",
-" in the log file. The log file thus created can be directly used an an",
-" input command file for subsequent debug session to repeat the same sequence",
-" of commands. Log mode can be turned on or off using logon or logoff command",
-""
-};
+++ /dev/null
-static char _[] = "@(#)icmd.c 5.20 93/07/30 16:38:37, Srini, AMD.";
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- ** This code implements a subset of the MON29K-like "i"
- ** commands. Access the 2903x cashe, ix, ia, il
- *****************************************************************************
- */
-
-
-#include <stdio.h>
-#include <ctype.h>
-#include <memory.h>
-#include "main.h"
-#include "macros.h"
-#include "miniint.h"
-#include "memspcs.h"
-#include "error.h"
-
-
-#ifdef MSDOS
-#include <stdlib.h>
-#include <string.h>
-#else
-#include <string.h>
-#endif
-
-INT32 i_cmd PARAMS((char **, int));
-INT32 ix_cmd PARAMS((char **, int));
-INT32 il_cmd PARAMS((char **, int));
-
-int get_addr_29k PARAMS((char *, struct addr_29k_t *));
-int addr_29k_ok PARAMS((struct addr_29k_t *));
-int print_addr_29k PARAMS((INT32, ADDR32));
-int get_word PARAMS((char *buffer, INT32 *data_word));
-void convert32 PARAMS(( BYTE *byte));
-
-void dasm_instr PARAMS((ADDR32, struct instr_t *));
-
-/* Variable definitions */
-struct xp_cmd_t {
- INT32 vtb;
- INT32 ops;
- INT32 cps;
- INT32 cfg;
- INT32 cha;
- INT32 chd;
- INT32 chc;
- INT32 rbp;
- INT32 tmc;
- INT32 tmr;
- INT32 pc0;
- INT32 pc1;
- INT32 pc2;
- INT32 mmuc;
- INT32 lru;
-};
-#define XP_CMD_SZ 15 * sizeof (INT32)
-/* #define XP_CMD_SZ sizeof(struct xp_cmd_t) */
-
-
-INT32
-i_cmd(token, token_count)
- char *token[];
- int token_count;
- {
- INT32 result;
-
- if (strcmp(token[0], "ix") == 0)
- result = ix_cmd(token, token_count);
- else
- if (strcmp(token[0], "il") == 0)
- result = il_cmd(token, token_count);
- else
- result = EMSYNTAX;
-
- return (result);
- } /* end xcmd() */
-
-
-
-/*
-** The function below is used to implement the MON29K-like
-** "i" commands. the function below, i_cmd() is called
-** in the main command loop parser of the monitor. The
-** parameters passed to this function are:
-**
-** token - This is an array of pointers to strings. Each string
-** referenced by this array is a "token" of the user's
-** input, translated to lower case.
-**
-** token_count - This is the number of tokens in "token".
-**
-** This function then calls the specific "i" commands,
-** such as "ix", "il" or "ia".
-*/
-
-/*
-** il
-** This command will dissasseble the contents of the cache
-** This command is used to examine the contents of the cache
-** in the Am29030. First set 0 is printed, starting with the
-** This command will dissasseble the contents of the cache
-** tag, followed by a disassembly of four instructions in
-** the set. Set 1 for the line follows similarly.
-**
-** The data comes in from the READ_ACK message in the following
-** order:
-**
-** tag (data[0-3] (set 0)
-** instr1 (data[4-7]
-** instr1 (data[8-11]
-** instr1 (data[12-15]
-** instr1 (data[16-19]
-**
-** tag (data[20-23] (set 1)
-** instr1 (data[24-27]
-** instr1 (data[28-31]
-** instr1 (data[32-35]
-** instr1 (data[36-39]
-*/
-
-INT32
-il_cmd(token, token_count)
- char *token[];
- int token_count;
- {
- static INT32 memory_space=I_CACHE;
- static ADDR32 cache_line=0;
- static INT32 byte_count=(10*sizeof(INST32));
- static INT32 count=1;
- ADDR32 address;
- INT32 i;
- int j;
- int set;
- int index;
- int result;
- struct instr_t instr;
- INT32 cache_line_start;
- INT32 cache_line_end;
-
- INT32 retval;
- INT32 bytes_ret;
- INT32 host_endian;
- BYTE read_buffer[10*sizeof(INST32)];
- char prtbuf[256];
-
-
- /* Is it an 'il' command? */
- if (strcmp(token[0], "il") != 0)
- return (EMSYNTAX);
-
- /*
- ** Parse parameters
- */
-
- if (token_count == 1) {
- cache_line = cache_line + count;
- }
- else
- if (token_count == 2) {
- result = get_word(token[1], &cache_line_start);
- if (result != 0)
- return (EMSYNTAX);
- if ((cache_line_start < 0) ||
- (cache_line_start >255))
- return (EMBADADDR);
- cache_line = cache_line_start;
- }
- else
- if (token_count == 3) {
- /* Get first cache line to be dumped */
- result = get_word(token[1], &cache_line_start);
- if (result != 0)
- return (EMSYNTAX);
- if ((cache_line_start < 0) ||
- (cache_line_start > 255))
- return (EMBADADDR);
- /* Get last cache line to be dumped */
- result = get_word(token[2], &cache_line_end);
- if (result != 0)
- return (EMSYNTAX);
- if ((cache_line_end < 0) ||
- (cache_line_end > 255))
- return (EMBADADDR);
- if (cache_line_start > cache_line_end)
- return (EMBADADDR);
- cache_line = cache_line_start;
- count = (cache_line_end - cache_line_start) + 1;
- }
- else
- /* Too many args */
- return (EMSYNTAX);
-
- i = 0;
- while (i < count) {
-
- host_endian = FALSE;
- if ((retval = Mini_read_req(memory_space,
- (cache_line + i),
- byte_count/4,
- (INT16) 4, /* size */
- &bytes_ret,
- read_buffer,
- host_endian)) != SUCCESS) {
- return(FAILURE);
- };
- /* The following is executed if SUCCESSful */
-
- for (set=0; set<2; set++) {
-
- /* Print out formatted address tag and status information */
- index = (set * 20);
- sprintf(&prtbuf[0], "\n");
- sprintf(&prtbuf[strlen(prtbuf)], "Cache line 0x%lx, set %d.\n", (int) (cache_line+i), set);
- sprintf(&prtbuf[strlen(prtbuf)], "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "%s", &prtbuf[0]);
- fprintf (stderr, "%s", &prtbuf[0]);
- sprintf(&prtbuf[0], "IATAG V P US\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "%s", &prtbuf[0]);
- fprintf (stderr, "%s", &prtbuf[0]);
- sprintf(&prtbuf[0], "%02x%02x%1x %1x %1x %1x\n",
- read_buffer[index],
- read_buffer[index + 1],
- ((read_buffer[index + 2] >> 4) & 0x0f),
- ((read_buffer[index + 3] >> 2) & 0x01),
- ((read_buffer[index + 3] >> 1) & 0x01),
- (read_buffer[index + 3] & 0x01));
- sprintf(&prtbuf[strlen(prtbuf)], "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "%s", &prtbuf[0]);
- fprintf (stderr, "%s", &prtbuf[0]);
-
- /* Address = IATAG + line_number + <16 byte adddress> */
- address = ((read_buffer[index] << 24) |
- (read_buffer[index + 1] << 16) |
- (read_buffer[index + 2] << 8) |
- ((cache_line+i) << 4));
-
- /* Disassemble four words */
- for (j=0; j<4; j=j+1) {
- index = (set * 20) + ((j+1) * sizeof(INT32));
- instr.op = read_buffer[index];
- instr.c = read_buffer[index + 1];
- instr.a = read_buffer[index + 2];
- instr.b = read_buffer[index + 3];
-
- /* Print address of instruction (in hex) */
- address = (address & 0xfffffff0); /* Clear low four bits */
- address = (address | (j << 2));
- fprintf(stderr, "%08lx ", address);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "%08lx ", address);
-
- /* Print instruction (in hex) */
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "%02x%02x%02x%02x ", instr.op, instr.c,
- instr.a, instr.b);
- fprintf(stderr, "%02x%02x%02x%02x ", instr.op, instr.c,
- instr.a, instr.b);
-
- /* Disassemble instruction */
- dasm_instr(address, &instr);
- fprintf(stderr, "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n");
-
- } /* end for(j) */
-
- fprintf(stderr, "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n");
-
- } /* end for(set) */
-
- i = i + 1;
-
- } /* end while loop */
-
- return (0);
-
- } /* end il_cmd() */
-
-
-
-/*
-** ix
-** This command will dump the contents of the cache in hex
-** This command is used to examine the contents of the cache
-** in the Am29030.
-** First set 0 is printed, starting with the
-** tag, followed by a disassembly of four instructions in
-** the set. Set 1 for the line follows similarly.
-**
-** The data comes in from the READ_ACK message in the following
-** order:
-**
-** tag (data[0-3] (set 0)
-** instr1 (data[4-7]
-** instr1 (data[8-11]
-** instr1 (data[12-15]
-** instr1 (data[16-19]
-**
-** tag (data[20-23] (set 1)
-** instr1 (data[24-27]
-** instr1 (data[28-31]
-** instr1 (data[32-35]
-** instr1 (data[36-39]
-*/
-
-INT32
-ix_cmd(token, token_count)
- char *token[];
- int token_count;
- {
- static INT32 memory_space=I_CACHE;
- static ADDR32 cache_line=0;
- static INT32 byte_count=(10*sizeof(INST32));
- static INT32 count=1;
- ADDR32 address;
- INT32 i;
- int j;
- int set;
- int index;
- int result;
- struct instr_t instr;
- INT32 cache_line_start;
- INT32 cache_line_end;
-
- INT32 retval;
- INT32 bytes_ret;
- INT32 host_endian;
- BYTE read_buffer[10*sizeof(INST32)];
- char prtbuf[256];
-
-
- /* Is it an 'ix' command? */
- if (strcmp(token[0], "ix") != 0)
- return (EMSYNTAX);
-
- /*
- ** Parse parameters
- */
- if (token_count == 1) {
- cache_line = cache_line + count;
- }
- else
- if (token_count == 2) {
- result = get_word(token[1], &cache_line_start);
- if (result != 0)
- return (EMSYNTAX);
- if ((cache_line_start < 0) ||
- (cache_line_start >255))
- return (EMBADADDR);
- cache_line = cache_line_start;
- }
- else
- if (token_count == 3) {
- /* Get first cache line to be dumped */
- result = get_word(token[1], &cache_line_start);
- if (result != 0)
- return (EMSYNTAX);
- if ((cache_line_start < 0) ||
- (cache_line_start > 255))
- return (EMBADADDR);
- /* Get last cache line to be dumped */
- result = get_word(token[2], &cache_line_end);
- if (result != 0)
- return (EMSYNTAX);
- if ((cache_line_end < 0) ||
- (cache_line_end > 255))
- return (EMBADADDR);
- if (cache_line_start > cache_line_end)
- return (EMBADADDR);
- cache_line = cache_line_start;
- count = (cache_line_end - cache_line_start) + 1;
- }
- else
- /* Too many args */
- return (EMSYNTAX);
-
- i = 0;
- while (i < count) {
-
- host_endian = FALSE;
- if ((retval = Mini_read_req(memory_space,
- (cache_line + i),
- byte_count/4,
- (INT16) 4, /* size */
- &bytes_ret,
- read_buffer,
- host_endian)) != SUCCESS) {
- return(FAILURE);
- };
- /* The following is executed if SUCCESSful */
-
- for (set=0; set<2; set++) {
-
- /* Print out formatted address tag and status information */
- index = (set * 20);
- sprintf(&prtbuf[0], "\n");
- sprintf(&prtbuf[strlen(prtbuf)], "Cache line 0x%lx, set %d.\n", (int) (cache_line+i), set);
- sprintf(&prtbuf[strlen(prtbuf)], "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "%s", &prtbuf[0]);
- fprintf (stderr, "%s", &prtbuf[0]);
- sprintf(&prtbuf[0], "IATAG V P US\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "%s", &prtbuf[0]);
- fprintf (stderr, "%s", &prtbuf[0]);
- sprintf(&prtbuf[0], "%02x%02x%1x %1x %1x %1x\n",
- read_buffer[index],
- read_buffer[index + 1],
- ((read_buffer[index + 2] >> 4) & 0x0f),
- ((read_buffer[index + 3] >> 2) & 0x01),
- ((read_buffer[index + 3] >> 1) & 0x01),
- (read_buffer[index + 3] & 0x01));
- sprintf(&prtbuf[strlen(prtbuf)], "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "%s", &prtbuf[0]);
- fprintf (stderr, "%s", &prtbuf[0]);
-
- /* Address = IATAG + line_number + <16 byte adddress> */
- address = ((read_buffer[index] << 24) |
- (read_buffer[index + 1] << 16) |
- (read_buffer[index + 2] << 8) |
- ((cache_line+i) << 4));
-
- /* Disassemble four words */
- for (j=0; j<4; j=j+1) {
- index = (set * 20) + ((j+1) * sizeof(INT32));
- instr.op = read_buffer[index];
- instr.c = read_buffer[index + 1];
- instr.a = read_buffer[index + 2];
- instr.b = read_buffer[index + 3];
-
- /* Print address of instruction (in hex) */
- address = (address & 0xfffffff0); /* Clear low four bits */
- address = (address | (j << 2));
- fprintf(stderr, "%08lx ", address);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "%08lx ", address);
-
- /* Print instruction (in hex) */
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "%02x%02x%02x%02x ", instr.op, instr.c,
- instr.a, instr.b);
- fprintf(stderr, "%02x%02x%02x%02x ", instr.op, instr.c,
- instr.a, instr.b);
-
- /* Disassemble instruction */
- dasm_instr(address, &instr);
- fprintf(stderr, "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n");
-
- } /* end for(j) */
-
- fprintf(stderr, "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n");
-
- } /* end for(set) */
-
- i = i + 1;
-
- } /* end while loop */
-
- return (0);
-
- } /* end ix_cmd() */
-
-
+++ /dev/null
-static char _[] = "@(#)io.c 5.22 93/10/26 14:50:43, Srini, AMD.";
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- * This file contains the I/O related routines.
- *****************************************************************************
- */
-
-#include <stdio.h>
-#include <string.h>
-#ifdef MSDOS
-#include <conio.h>
-#else
-#include <sys/ioctl.h>
-#endif
-#include "main.h"
-#include "miniint.h"
-#include "error.h"
-#include "monio.h"
-
-/* Function declarations */
-
-INT32 Mini_io_setup PARAMS((void));
-INT32 Mini_io_reset PARAMS((void));
-int getkey PARAMS((void));
-INT32 Mini_poll_kbd PARAMS((char *cmd_buffer, int size, int mode));
-int cmd_io PARAMS ((char *cmd_buffer, char c));
-int channel0_io PARAMS ((char c));
-
-INT32
-Mini_io_setup()
-{
- setbuf(stdout, 0); /* stdout unbuffered */
- return(SUCCESS);
-}
-
-INT32
-Mini_io_reset()
-{
-/* Nothing special for now */
- return(SUCCESS);
-}
-
-/*
-** This function is used to perform all host I/O. It
-** calls the functions cmd_io() or hif_io() as appropriate
-** Note that there are eight pobible I/O "modes". These
-** are all possible combination of:
-**
-** - Host / Target I/O
-** - HIF / non-HIF I/O
-** - Command file / keyboard I/O
-**
-*/
-
-INT32
-Mini_poll_kbd(cmd_buffer, size, blockmode)
-char *cmd_buffer;
-int size;
-int blockmode;
-{
-#ifdef MSDOS
- char ch;
- static int indx=0;
-
- io_config.cmd_ready = FALSE;
- if (blockmode) { /* BLOCK until a command is typed (line buffered) */
- while (gets(cmd_buffer) == NULL); /* no characters in stdin */
- io_config.cmd_ready = TRUE;
- } else { /* NONBLOCk return immediately if there is no command pending */
- if (kbhit()) {
- ch = (unsigned char) getche();
- *(cmd_buffer+indx) = ch;
- indx=indx+1;
- if (ch == (unsigned char) 13) { /* \r, insert \n */
- putchar(10); /* line feed */
- *(cmd_buffer+indx) = '\0';
- io_config.cmd_ready = TRUE;
- indx=0;
- } else if (ch == (unsigned char) 8) { /* backspace */
- indx=indx-1;
- } else if (ch == (unsigned char) 127) { /* delete */
- indx=indx-1;
- }
- };
- }
- return(SUCCESS);
-
-#else
- int c;
- int result;
- char *temp_ptr;
- int tries;
- int i;
-
- result = 0;
- io_config.cmd_ready = FALSE;
-
- if (blockmode) { /* block mode read */
- i = 0;
-#ifdef __hpux
- ioctl(fileno(stdin), FIOSNBIO, &i); /* set blocking read */
-#else
- ioctl(fileno(stdin), FIONBIO, &i); /* set blocking read */
-#endif
- } else { /* nonblocking read */
- /* for now only read from stdin */
- i = 1;
-#ifdef __hpux
- ioctl(fileno(stdin), FIOSNBIO, &i); /* set non blocking read */
-#else
- ioctl(fileno(stdin), FIONBIO, &i); /* set non blocking read */
-#endif
- }
-
- /* Now read from stdin. */
- result = read( 0, cmd_buffer, BUFSIZ );
-
- if (result < 0)
- {
- } else {
- cmd_buffer[result] = '\0';
- io_config.cmd_ready = TRUE;
- }
-
- if (blockmode) {
- } else {
- i = 0;
-#ifdef __hpux
- ioctl(fileno(stdin), FIOSNBIO, &i); /* clear non-blocking read */
-#else
- ioctl(fileno(stdin), FIONBIO, &i); /* clear non-blocking read */
-#endif
- }
-
- return(SUCCESS);
-#endif
-}
-
+++ /dev/null
-static char _[] = "@(#)main.c 5.27 93/10/27 15:11:04, Srini, AMD";
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- * This is the main module of MONDFE.
- *****************************************************************************
- */
-
-#include <stdio.h>
-#include <signal.h>
-#ifdef MSDOS
-#include <stdlib.h>
-#include <string.h>
-#else
-#include <strings.h>
-#endif
-#include "coff.h"
-#include "main.h"
-#include "monitor.h"
-#include "memspcs.h"
-#include "miniint.h"
-#include "error.h"
-#include "versions.h"
-
-#ifdef MSDOS
-#define strcasecmp stricmp
-#endif
-
-/* Externals */
-extern void Def_CtrlC_Hdlr PARAMS((int));
-extern void Mini_parse_args PARAMS((int argc, char **argv));
-extern INT32 Mini_initialize PARAMS((HOST_CONFIG *host, IO_CONFIG *io,
- INIT_INFO *init));
-extern INT32 Mini_io_setup PARAMS((void));
-extern INT32 Mini_io_reset PARAMS((void));
-extern INT32 Mini_load_file PARAMS((char *fname, INT32 mspace,
- int argc, char *args,
- INT32 symbols, INT32 sections, int msg));
-extern void Mini_monitor PARAMS((void));
-extern INT32 Mini_go_forever PARAMS((void));
-
-/* Globals */
-
-GLOBAL char *host_version = HOST_VERSION;
-GLOBAL char *host_date = HOST_DATE;
-
-GLOBAL TARGET_CONFIG target_config;
-GLOBAL VERSIONS_ETC versions_etc;
-GLOBAL TARGET_STATUS target_status;
-GLOBAL HOST_CONFIG host_config;
-GLOBAL IO_CONFIG io_config;
-
-/* The filenos of the monitor's stdin, stdout, adn stderr */
-int MON_STDIN;
-int MON_STDOUT;
-int MON_STDERR;
-
-int Session_ids[MAX_SESSIONS];
-int NumberOfConnections=0;
-/* The following variables are to be set/initialized in Mini_parse_args()
- */
-GLOBAL BOOLEAN monitor_enable = FALSE;
-GLOBAL int QuietMode = 0;
-GLOBAL BOOLEAN ROM_flag = FALSE;
-
-GLOBAL char *ROM_file = NULL;
-GLOBAL char **ROM_argv;
-GLOBAL int ROM_sym, ROM_sects;
-GLOBAL int ROM_argc;
-
-GLOBAL char CoffFileName[1024];
-static char Ex_argstring[1024];
-GLOBAL int Ex_sym, Ex_sects, Ex_space;
-GLOBAL int Ex_argc;
-static int Ex_loaded=0;
-
-GLOBAL char *ProgramName=NULL;
-
-GLOBAL char *connect_string;
-
-GLOBAL INT32 udi_waittime;
-
-/* Main routine */
-
-main(argc, argv)
- int argc;
- char *argv[];
- {
-
- char *temp;
- int i;
- UINT32 ProcessorState;
- int GrossState;
- INT32 retval;
-
- ProgramName=argv[0];
- if (strpbrk( ProgramName, "/\\" ))
- {
- temp = ProgramName + strlen( ProgramName );
- while (!strchr( "/\\", *--temp ))
- ;
- ProgramName = temp+1;
- }
-
- if (argc < 2 ) {
- fprintf(stderr, "MiniMON29K Release 3.0\n");
- fprintf(stderr, "MONDFE Debugger Front End (UDI 1.2) Version %s Date %s\n", HOST_VERSION, HOST_DATE);
- fatal_error(EMUSAGE);
- }
-
- /* Initialize stdin, stdout, sdterr to defaults */
- MON_STDIN = fileno(stdin);
- MON_STDOUT = fileno(stdout);
- MON_STDERR = fileno(stderr);
- NumberOfConnections = 0;
- (void) strcpy (CoffFileName,"");
-
- udi_waittime = (INT32) 10; /* default poll every ? secs */
- /*
- ** Initialize host configuration structure (global), set defaults
- */
- if (Mini_initialize (&host_config, &io_config, &init_info) != SUCCESS)
- fatal_error(EMHINIT);
-
- /* Parse args */
- (void) Mini_parse_args(argc, argv);
-
- if (io_config.echo_mode == (INT32) TRUE) {
- for (i=0; i < argc; i++)
- fprintf(io_config.echo_file, "%s ", argv[i]);
- fprintf(io_config.echo_file, "\n");
- fflush (io_config.echo_file);
- };
-
- if ((monitor_enable == FALSE) & !Ex_loaded)
- fatal_error (EMNOFILE);
-
- /*
- ** Initialize host I/O.
- */
-
- if (Mini_io_setup() != SUCCESS)
- fatal_error(EMIOSETF);
-
- /*
- * Initialize TIP. Load ROM file, if necessary.
- ** Open communication channel
- */
- if (signal (SIGINT, Def_CtrlC_Hdlr) == SIG_ERR) {
- fprintf(stderr, "Couldn't install default Ctrl-C handler.\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "Couldn't install default Ctrl-C handler.\n");
- }
- /* connect_string is made by the Mini_parse_args routine */
- retval = Mini_TIP_init(connect_string, &Session_ids[NumberOfConnections]);
- if (retval > (INT32) 0) {
- fatal_error(EMTIPINIT);
- } else if (retval == (INT32) SUCCESS) {
- NumberOfConnections=NumberOfConnections+1;
- } else {
- Mini_TIP_exit();
- fatal_error(EMTIPINIT);
- }
- if (Mini_get_target_stats((INT32) -1, &ProcessorState) != SUCCESS) {/* reconnect?*/
- Mini_TIP_exit();
- fatal_error(EMFATAL);
- };
- GrossState = (int) (ProcessorState & 0xFF);
- if (GrossState == NOTEXECUTING)
- if (Mini_TIP_CreateProc() != SUCCESS) {
- Mini_TIP_exit();
- fatal_error(EMNOPROCESS);
- }
-
- /* Get capabilities */
- if (Mini_TIP_Capabilities() != SUCCESS) {
- Mini_TIP_DestroyProc();
- Mini_TIP_exit();
- fatal_error(EMNOTCOMP);
- }
-
- /* Get the target memory configuration, and processor type */
- versions_etc.version = 0; /* initialize in case not returned */
- if (Mini_config_req(&target_config, &versions_etc) != SUCCESS) {
- warning(EMCONFIG);
- }
-
- if (strcmp(CoffFileName,"") != 0) {
- if (Mini_load_file(&CoffFileName[0],
- Ex_space,
- Ex_argc,
- Ex_argstring,
- Ex_sym,
- Ex_sects,
- QuietMode) != SUCCESS) {
- Ex_loaded = 0;
- warning(EMLOADF);
- } else {
- Ex_loaded = 1;
- };
- }
-
- if (monitor_enable == FALSE) {
- if (Ex_loaded)
- Mini_go_forever();
- else { /* nothing to do, so quit */
- Mini_TIP_DestroyProc();
- Mini_TIP_exit();
- warning (EMNOFILE);
- }
- } else {
- Mini_monitor();
- };
-
- fflush(stderr);
- fflush(stdout);
-
- /* Perform host-specific clean-up */
- if (Mini_io_reset() != SUCCESS)
- warning(EMIORESETF);
-
- if (!QuietMode) {
- fprintf(stderr, "\nGoodbye.\n");
- if (io_config.echo_mode == (INT32) TRUE) {
- fprintf(io_config.echo_file, "\nGoodbye.\n");
- (void) fclose (io_config.echo_file);
- }
- }
- return(0);
-
- } /* end Main */
-
-
-
-/*
-** Functions
-*/
-
-/*
-** This function prints out a fatal error message
-** from error_msg[].
-** Finally, the program exits with error_number.
-*/
-#ifndef MINIMON
-extern UINT32 UDIGetDFEIPCId PARAMS((void));
-#endif
-
-void
-fatal_error(error_number)
- INT32 error_number;
- {
- UINT32 IPCId;
-
- if (error_number == (INT32) EMUSAGE) {
-#ifndef MINIMON
- IPCId = (UINT32) UDIGetDFEIPCId();
- fprintf(stderr, "MONDFE UDI IPC Implementation Id %d.%d.%d\n",
- (int) ((IPCId & 0xf00) >> 8),
- (int) ((IPCId & 0xf0) >> 4),
- (int) (IPCId & 0xf));
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "MONDFE UDI IPC Implementation Id %d.%d.%d\n",
- (int) ((IPCId & 0xf00) >> 8),
- (int) ((IPCId & 0xf0) >> 4),
- (int) (IPCId & 0xf));
-#else
- fprintf(stderr, "Procedurally linked MiniMON29K 3.0 Delta\n");
-#endif
- fprintf(stderr, "Usage: %s %s\nGoodbye.\n",
- ProgramName, error_msg[(int)error_number]);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "Usage: %s %s\nGoodbye.\n",
- ProgramName, error_msg[(int)error_number]);
- } else {
- fprintf(stderr, "DFEERROR: %d : %s\nFatal error. Exiting.\n",
- (int)error_number, error_msg[(int)error_number]);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "DFEERROR: %d : %s\nFatal error. Exiting.\n",
- (int)error_number, error_msg[(int)error_number]);
- }
-
- NumberOfConnections=0;
- if (io_config.echo_mode == (INT32) TRUE)
- (void) fclose(io_config.echo_file);
-
- exit((int) error_number);
- }
-
-
-/*
-** This function prints out a warning message from
-** the error_msg[] string array.
-*/
-
-void
-warning(error_number)
- INT32 error_number;
- {
- fprintf(stderr, "DFEWARNING: %d : %s\n", (int) error_number, error_msg[(int)error_number]);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "DFEWARNING: %d : %s\n", error_number, error_msg[(int)error_number]);
- }
-
-
-/* Parse the command line arguments */
-void
-Mini_parse_args(argc, argv)
-int argc;
-char **argv;
-{
- int i, j;
- int len;
-
- len = 0;
- for (i = 1; i < argc; i++) { /* ISS */
- len = len + (int) strlen(argv[i]);
- };
- if (len == (int) 0) {
- connect_string = NULL;
- } else {
- if ((connect_string = (char *) malloc (len + argc)) == NULL) {
- fatal_error(EMALLOC);
- };
- for (i = 1; i < argc; i++) { /* ISS */
- if (strcasecmp(argv[i], "-TIP") == 0) {
- i++;
- if (i >= argc)
- fatal_error(EMUSAGE);
- connect_string = argv[i];
- } else if (strcmp(argv[i], "-log") == 0) {
- i++;
- if (i >= argc)
- fatal_error(EMUSAGE);
- (void) strcpy((char *)(&(io_config.log_filename[0])),argv[i]);
- io_config.log_mode = (INT32) TRUE;
- } else if (strcmp (argv[i], "-w") == 0) { /* Wait time param */
- i++;
- if (i >= argc)
- fatal_error(EMUSAGE);
- if (sscanf(argv[i], "%ld", &udi_waittime) != 1)
- fatal_error(EMUSAGE);
- } else if (strcmp (argv[i], "-ms") == 0) { /* mem stack size */
- i++;
- if (i >= argc)
- fatal_error(EMUSAGE);
- if (sscanf(argv[i], "%lx", &init_info.mem_stack_size) != 1)
- fatal_error(EMUSAGE);
- } else if (strcmp (argv[i], "-rs") == 0) { /* reg stack size */
- i++;
- if (i >= argc)
- fatal_error(EMUSAGE);
- if (sscanf(argv[i], "%lx", &init_info.reg_stack_size) != 1)
- fatal_error(EMUSAGE);
- } else if (strcmp(argv[i], "-d") == 0) {
- monitor_enable = TRUE;
- } else if (strcasecmp(argv[i], "-D") == 0) {
- monitor_enable = TRUE;
- } else if (strcmp(argv[i], "-le") == 0) {
- host_config.target_endian = LITTLE;
- } else if (strcmp(argv[i], "-q") == 0) {
- QuietMode = 1;
- } else if (strcmp(argv[i], "-c") == 0) {
- i++;
- if (i >= argc)
- fatal_error(EMUSAGE);
- (void) strcpy((char *)(&(io_config.cmd_filename[0])),argv[i]);
- io_config.cmd_file_io = TRUE;
- } else if (strcmp(argv[i], "-e") == 0) {
- i++;
- if (i >= argc)
- fatal_error(EMUSAGE);
- (void) strcpy((char *)(&(io_config.echo_filename[0])),argv[i]);
- io_config.echo_mode = (INT32) TRUE;
- if ((io_config.echo_file = fopen (io_config.echo_filename, "w")) == NULL) {
- warning (EMECHOPEN);
- io_config.echo_mode = (INT32) FALSE;
- }
- } else {
- (void) strcpy (&CoffFileName[0], argv[i]);
- Ex_argc = argc - i;
- (void) strcpy(Ex_argstring, argv[i]);
- for (j=1; j < Ex_argc; j++) {
- (void) strcat(Ex_argstring, " ");
- (void) strcat (Ex_argstring, argv[i+j]);
- }
- Ex_sym = 0;
- Ex_sects = (STYP_ABS|STYP_TEXT|STYP_LIT|STYP_DATA|STYP_BSS);
- Ex_space = (INT32) I_MEM;
- Ex_loaded = 1; /* given */
- break;
- }
- }; /* end for */
- }; /* end if-else */
-}
-
-/* Function to initialize host_config and io_config data structures
- * to their default values *
- */
-
-INT32
-Mini_initialize(host, io, init)
-HOST_CONFIG *host;
-IO_CONFIG *io;
-INIT_INFO *init;
-{
- /* Initialize host configuration information */
-
-#ifdef MSDOS
- host->host_endian = LITTLE;
-#else
- host->host_endian = BIG;
-#endif
-
- host->target_endian = BIG; /* default */
- host->version = host_version;
- host->date = host_date;
-
- /* Initialize I/O configuration information */
-
- io->hif = TRUE;
- io->io_control = TERM_USER;
- io->cmd_ready = FALSE;
- io->clear_to_send = TRUE;
- io->target_running = FALSE;
- io->cmd_file = NULL;
- io->cmd_filename[0] = '\0';
- io->cmd_file_io = FALSE;
- io->log_mode = FALSE;
- io->log_file = NULL;
- io->log_filename[0] = '\0';
- io->echo_mode = FALSE;
- io->echo_file = NULL;
- io->echo_filename[0] = '\0';
- io->io_toggle_char = (BYTE) 21; /* CTRL-U */
-
- init->mem_stack_size = (UINT32) -1;
- init->reg_stack_size = (UINT32) -1;
- return(SUCCESS);
-}
-
-void
-Def_CtrlC_Hdlr(num)
-int num;
-{
- Mini_io_reset();
- if (!QuietMode) {
- fprintf(stderr, "\nInterrupted.\n");
- if (io_config.echo_mode == (INT32) TRUE) {
- fprintf(io_config.echo_file, "\nInterrupted.\n");
- (void) fclose (io_config.echo_file);
- }
- }
- Mini_TIP_SetCurrSession(0);
- Mini_TIP_exit();
- exit(1);
-}
-
+++ /dev/null
-static char _[] = "@(#)mini2udi.c 5.23 93/08/18 13:48:08, Srini, AMD. ";
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- * Definitions of the functions that define Minimon's Interface
- * to the UDI
- * interface The minimon functions are declared in miniint.h The UDI
- * functions are declared in udi/udiproc.h
- *****************************************************************************
- */
-
-
-#include <stdio.h>
-#ifdef MSDOS
-#include <io.h>
-#endif
-#include <string.h>
-#include "main.h"
-#include "memspcs.h"
-#include "macros.h"
-#include "miniint.h"
-#include "udiproc.h"
-#include "udiids.h"
-#include "udiext.h"
-#include "versions.h"
-
-
-/* Define BreakIdType here to avoid having to change at many places
- * every time it changes.
- */
-typedef unsigned int BreakIdType;
-
-/* ABOUT UDI calls:
- * There are three types of return values:
- * < 0: means a TIP failure.
- * = 0: means success.
- * > 0: means a "local" failure.
- */
-
-
-
-static UDISessionId SessionID;
-static char MONErrorMsg[MONErrorMsgSize];
-static int GoForever=0;
-
-static char *udi_errmsg[] = {
-/*
-#define UDINoError 0
-*/ "UDIERR: No Error",
-/*
-#define UDIErrorNoSuchConfiguration 1
-*/ "UDIERR: No Such Configuration in Config File.",
-/*
-#define UDIErrorCantHappen 2
-*/ "UDIERR: Cannot Happen With Current Environment Setup.",
-/*
-#define UDIErrorCantConnect 3
-*/ "UDIERR: Cannot Connect to TIP Specified.",
-/*
-#define UDIErrorNoSuchConnection 4
-*/ "UDIERR: No Such Connection Found.",
-/*
-#define UDIErrorNoConnection 5
-*/ "UDIERR: No Connection Occurred.",
-/*
-#define UDIErrorCantOpenConfigFile 6
-*/ "UDIERR: Cannot Open UDI Config File.",
-/*
-#define UDIErrorCantStartTIP 7
-*/ "UDIERR: Cannot Start TIP In Current Environment Setup.",
-/*
-#define UDIErrorConnectionUnavailable 8
-*/ "UDIERR: Requested Connection Unavailable.",
-/*
-#define UDIErrorTryAnotherTIP 9
-*/ "UDIERR: Try Another TIP For Connection.",
-/*
-#define UDIErrorExecutableNotTIP 10
-*/ "UDIERR: TIP Specified in Config File Not An Executable.",
-/*
-#define UDIErrorInvalidTIPOption 11
-*/ "UDIERR: Connection Failed Due To Invalid TIP Options in Config File.",
-/*
-#define UDIErrorCantDisconnect 12
-*/ "UDIERR: Cannot Disconnect TIP",
-/*
-#define UDIErrorUnknownError 13
-*/ "UDIERR: Unknown Error Number Specified.",
-/*
-#define UDIErrorCantCreateProcess 14
-*/ "UDIERR: TIP Cannot Create a New Process.",
-/*
-#define UDIErrorNoSuchProcess 15
-*/ "UDIERR: No Such Process in the Current TIP.",
-/*
-#define UDIErrorUnknownResourceSpace 16
-*/ "UDIERR: Unknown Resource Space Encountered By TIP.",
-/*
-#define UDIErrorInvalidResource 17
-*/ "UDIERR: Invalid Resource Specified To TIP.",
-/*
-#define UDIErrorUnsupportedStepType 18
-*/ "UDIERR: Unsupported Step Type For This TIP Specified.",
-/*
-#define UDIErrorCantSetBreakpoint 19
-*/ "UDIERR: Could Not Set The Breakpoint.",
-/*
-#define UDIErrorTooManyBreakpoints 20
-*/ "UDIERR: Too Many Breakpoints Already In Use.",
-/*
-#define UDIErrorInvalidBreakId 21
-*/ "UDIERR: Breakpoint Does Not Exist For This BreakId.",
-/*
-#define UDIErrorNoMoreBreakIds 22
-*/ "UDIERR: No More Breakpoints. BreakId Too High.",
-/*
-#define UDIErrorUnsupportedService 23
-*/ "UDIERR: TIP Does Not Support The Requested Service.",
-/*
-#define UDIErrorTryAgain 24
-*/ "UDIERR: Error Occurred. Trying Again.",
-/*
-#define UDIErrorIPCLimitation 25
-*/ "UDIERR: IPC Limitation Exceeded.",
-/*
-#define UDIErrorIncomplete 26
-*/ "UDIERR: Service Incomplete.More Data Available.",
-/*
-#define UDIErrorAborted 27
-*/ "UDIERR: Aborted Requested Service.",
-/*
-#define UDIErrorTransDone 28
-*/ "UDIERR: Transaction Completed.",
-/*
-#define UDIErrorCantAccept 29
-*/ "UDIERR: Cannot Accept.",
-/*
-#define UDIErrorTransInputNeeded 30
-*/ "UDIERR: Transaction Input Needed.",
-/*
-#define UDIErrorTransModeX 31
-*/ "UDIERR: Transaction ModeX",
-/*
-#define UDIErrorInvalidSize 32
-*/ "UDIERR: Invalid Object Size Specified.",
-/*
-#define UDIErrorBadConfigFileEntry 33
-*/ "UDIERR: Bad Entry In UDI Config File Found.",
-/*
-#define UDIErrorIPCInternal 34
-*/ "UDIERR: Internal Error Occurred In IPC Layer."
-};
-
-static UDIPId CurrentPID=(UDIPId) UDIProcessProcessor;
-static void PrintErrorMessage PARAMS((UDIError num));
-static void udi_warning PARAMS((int num));
-static CPUSpace xlate_mspace_mon2udi PARAMS((INT32 mspace));
-static INT32 xlate_mspace_udi2mon PARAMS((CPUSpace mspace));
-static UDIError FillString PARAMS(( UDIResource from,
- UDIHostMemPtr pattern,
- UDISizeT pattern_count,
- UDICount fill_count));
-static UDIError FillWords PARAMS(( UDIResource from,
- UDIHostMemPtr pattern,
- UDISizeT pattern_count,
- UDICount fill_count));
-
-
-INT32
-/*********************************************Mini_TIP_init */
-Mini_TIP_init(connect_string, mon_session_id)
- char *connect_string;
- int *mon_session_id;
-{
- UDIError UDIretval;
- UDISessionId session;
-
- /* First connect the target */
- if ((UDIretval = UDIConnect(connect_string,
- &session)) <= TIPFAILURE) {
- SessionID = session;
- *mon_session_id = (int) session;
- PrintErrorMessage (UDIretval);
- return ((INT32) UDIretval);
- } else if (UDIretval == SUCCESS) {
- SessionID = session;
- *mon_session_id = (int) session;
- return (SUCCESS);
- } else {
- SessionID = session;
- *mon_session_id = (int) session;
- udi_warning(UDIretval);
- return((INT32) UDIretval);
- };
-}
-
-INT32
-Mini_TIP_Capabilities()
-{
- UDIError UDIretval;
- UDIUInt32 TIPId; /* Out */
- UDIUInt32 TargetId; /* Out */
- UDIUInt32 DFEId; /* In */
- UDIUInt32 DFE; /* In */
- UDIUInt32 TIP; /* Out */
- UDIUInt32 DFEIPCId; /* Out */
- UDIUInt32 TIPIPCId; /* Out */
- char TIPString[80]; /* Out */
-
- (void) strcpy (TIPString,"");
- DFEId = (UDIUInt32) UDIID (UDIProductCode_Mondfe, MONDFERev, MONDFESubRev, MONDFESubSubRev);
- DFE = (UDIUInt32) MONDFEUDIVers;
- if ((UDIretval = UDICapabilities ( &TIPId,
- &TargetId,
- DFEId,
- DFE,
- &TIP,
- &DFEIPCId,
- &TIPIPCId,
- &TIPString[0])) <= TIPFAILURE) {
- PrintErrorMessage (UDIretval);
- return (FAILURE);
- } else if (UDIretval == SUCCESS) {
- if (!QuietMode) {
- if (io_config.echo_mode == (INT32) TRUE) {
- fprintf(io_config.echo_file, "MiniMON29K Release 3.0\n");
- fprintf(io_config.echo_file, ">AMD MONDFE Version: %d.%d.%d",
- (int) ((DFEId & 0x00000F00) >> 8),
- (int) ((DFEId & 0x000000F0) >> 4),
- (int) ((DFEId & 0x0000000F) >> 0));
- fprintf(io_config.echo_file, "\tIPC Version: %d.%d.%d UDI Rev. %d.%d.%d <\n",
- (int) ((DFEIPCId & 0x00000F00) >> 8),
- (int) ((DFEIPCId & 0x000000F0) >> 4),
- (int) ((DFEIPCId & 0x0000000F) >> 0),
- (int) ((DFE & 0x00000F00) >> 8),
- (int) ((DFE & 0x000000F0) >> 4),
- (int) ((DFE & 0x0000000F) >> 0));
- fprintf(io_config.echo_file, "%s\n", TIPString);
- fprintf(io_config.echo_file, ">TIP Version: %d.%d.%d",
- (int) ((TIPId & 0x00000F00) >> 8),
- (int) ((TIPId & 0x000000F0) >> 4),
- (int) ((TIPId & 0x0000000F) >> 0));
- fprintf(io_config.echo_file, "\tIPC Version: %d.%d.%d UDI Rev. %d.%d.%d<\n",
- (int) ((TIPIPCId & 0x00000F00) >> 8),
- (int) ((TIPIPCId & 0x000000F0) >> 4),
- (int) ((TIPIPCId & 0x0000000F) >> 0),
- (int) ((TIP & 0x00000F00) >> 8),
- (int) ((TIP & 0x000000F0) >> 4),
- (int) ((TIP & 0x0000000F) >> 0));
- }
- fprintf(stderr, "MiniMON29K Release 3.0\n");
- fprintf(stderr, ">AMD MONDFE Version: %d.%d.%d",
- (int) ((DFEId & 0x00000F00) >> 8),
- (int) ((DFEId & 0x000000F0) >> 4),
- (int) ((DFEId & 0x0000000F) >> 0));
- fprintf(stderr, "\tIPC Version: %d.%d.%d UDI Rev. %d.%d.%d <\n",
- (int) ((DFEIPCId & 0x00000F00) >> 8),
- (int) ((DFEIPCId & 0x000000F0) >> 4),
- (int) ((DFEIPCId & 0x0000000F) >> 0),
- (int) ((DFE & 0x00000F00) >> 8),
- (int) ((DFE & 0x000000F0) >> 4),
- (int) ((DFE & 0x0000000F) >> 0));
- fprintf(stderr, "%s\n", TIPString);
- fprintf(stderr, ">TIP Version: %d.%d.%d",
- (int) ((TIPId & 0x00000F00) >> 8),
- (int) ((TIPId & 0x000000F0) >> 4),
- (int) ((TIPId & 0x0000000F) >> 0));
- fprintf(stderr, "\tIPC Version: %d.%d.%d UDI Rev. %d.%d.%d<\n",
- (int) ((TIPIPCId & 0x00000F00) >> 8),
- (int) ((TIPIPCId & 0x000000F0) >> 4),
- (int) ((TIPIPCId & 0x0000000F) >> 0),
- (int) ((TIP & 0x00000F00) >> 8),
- (int) ((TIP & 0x000000F0) >> 4),
- (int) ((TIP & 0x0000000F) >> 0));
- }
- if ( (int) ((TIPId & 0x00000F00) >> 8) <
- (int) ((DFEId & 0x00000F00) >> 8) ) {
- fprintf(stderr, "!!!!! WARNING: MONTIP's major version number is older than that of MONDFE's !!!!!\n");
- fprintf(stderr, "!!!!! Please verify the versions and call AMD 29K Technical Support for assistance. !!!!!\n");
- }
- if ((TIP == (UDIUInt32) 0) || ((TIP & 0xFFF) > (DFE & 0xFFF))) {
- fprintf(stderr, "UDI WARNING: UDI Versions NOT Compatible.\n");
- }
- if (TIP == (UDIUInt32) 0)
- return (FAILURE);
- return (SUCCESS);
- } else {
- udi_warning(UDIretval);
- return(FAILURE);
- }
-}
-
-INT32
-Mini_TIP_CreateProc()
-{
- UDIError UDIretval;
- UDIPId pid;
-
- if ((UDIretval = UDICreateProcess(&pid)) <= TIPFAILURE) {
- PrintErrorMessage (UDIretval);
- return (FAILURE);
- } else if (UDIretval == SUCCESS) {
- CurrentPID = pid;
- return (SUCCESS);
- } else {
- udi_warning(UDIretval);
- return(FAILURE);
- }
-}
-
-INT32
-Mini_TIP_disc()
-{
- UDIError UDIretval;
-
- if ((UDIretval = UDIDisconnect(SessionID,
- UDIContinueSession)) <= TIPFAILURE) {
- PrintErrorMessage (UDIretval);
- return (FAILURE);
- } else if (UDIretval == SUCCESS) {
- return(SUCCESS);
- } else {
- udi_warning(UDIretval);
- return(FAILURE);
- };
-}
-
-INT32
-Mini_TIP_SetCurrSession(sid)
-int sid;
-{
- UDIError UDIretval;
-
- if ((UDIretval = UDISetCurrentConnection((UDISessionId) sid)) <= TIPFAILURE) {
- PrintErrorMessage (UDIretval);
- return (FAILURE);
- } else if (UDIretval == SUCCESS) {
- SessionID = (UDISessionId) sid;
- return (SUCCESS);
- } else {
- udi_warning(UDIretval);
- return(FAILURE);
- }
-}
-
-INT32
-Mini_TIP_SetPID(pid)
-int pid;
-{
- UDIError UDIretval;
-
- if ((UDIretval = UDISetCurrentProcess((UDIPId) pid)) <= TIPFAILURE) {
- PrintErrorMessage (UDIretval);
- return (FAILURE);
- } else if (UDIretval == SUCCESS) {
- return (SUCCESS);
- } else {
- udi_warning(UDIretval);
- return(FAILURE);
- }
-}
-
-INT32
-Mini_TIP_DestroyProc()
-{
- UDIError UDIretval;
-
- if ((UDIretval = UDIDestroyProcess(CurrentPID)) <= TIPFAILURE) {
- PrintErrorMessage (UDIretval);
- return (FAILURE);
- } else if (UDIretval == SUCCESS) {
- return (SUCCESS);
- } else {
- udi_warning(UDIretval);
- return(FAILURE);
- }
-}
-
-INT32
-Mini_TIP_exit()
-{
- UDIError UDIretval;
-
- if ((UDIretval = UDIDisconnect(SessionID,
- UDITerminateSession)) <= TIPFAILURE) {
- PrintErrorMessage (UDIretval);
- return (FAILURE);
- } else if (UDIretval == SUCCESS) {
- return(SUCCESS);
- } else {
- udi_warning(UDIretval);
- return(FAILURE);
- };
-}
-/* Breakpoint routines */
-
-/* Remove breakpoint */
-INT32
-/*******************************************Mini_bkpt_rm */
-Mini_bkpt_rm(break_id)
-int break_id;
-{
- UDIError UDIretval;
-
- if ((UDIretval = UDIClearBreakpoint ((BreakIdType) break_id)) <= TIPFAILURE) {
- PrintErrorMessage (UDIretval);
- return (FAILURE);
- } else if (UDIretval == SUCCESS) {
- return(SUCCESS);
- } else {
- udi_warning(UDIretval);
- return(FAILURE);
- };
-}
-
-/* Set Breakpoints */
-
-INT32
-/**********************************************Mini_bkpt_set */
-Mini_bkpt_set(m_space, address, pass_count, type, break_id)
- INT32 m_space;
- ADDR32 address;
- INT32 pass_count;
- INT32 type;
- int *break_id;
-{
- UDIResource addr;
- UDIError UDIretval;
-
-
- addr.Space = xlate_mspace_mon2udi(m_space);
- addr.Offset = address;
-
- if (type == BKPT_29000)
- type = (UDIBreakType) UDIBreakFlagExecute;
- else if (type == BKPT_29050)
- type = (UDIBreakType) (MONBreakFlagHardware | UDIBreakFlagExecute);
- else if (type == BKPT_29050_BTE_0)
- type = (UDIBreakType) (MONBreakFlagHardware | UDIBreakFlagExecute);
- else if (type == BKPT_29050_BTE_1)
- type = (UDIBreakType) (MONBreakTranslationEnabled | MONBreakFlagHardware | UDIBreakFlagExecute);
-
- if ((UDIretval = UDISetBreakpoint(addr,
- (UDIInt32) pass_count,
- (UDIBreakType) type,
- (BreakIdType *) break_id)) <= TIPFAILURE) {
- PrintErrorMessage (UDIretval);
- return (FAILURE);
- } else if (UDIretval == SUCCESS) {
- return(SUCCESS);
- } else {
- udi_warning(UDIretval);
- return(FAILURE);
- }
-}
-
-/* Query (get status) Breakpoints */
-
-INT32
-/**********************************************Mini_bkpt_stat */
-Mini_bkpt_stat(break_id, address, m_space, pass_count,
- bkpt_type, current_cnt)
- int break_id;
- INT32 *m_space;
- ADDR32 *address;
- INT32 *pass_count;
- INT32 *bkpt_type;
- INT32 *current_cnt;
-{
- UDIError UDIretval;
- UDIResource addr;
-
- if ((UDIretval = UDIQueryBreakpoint ((BreakIdType) break_id,
- &addr,
- (UDIInt32 *)pass_count,
- (UDIBreakType *) bkpt_type,
- (UDIInt32 *) current_cnt)) <= TIPFAILURE) {
- PrintErrorMessage (UDIretval);
- return (FAILURE);
- } else if (UDIretval == SUCCESS) {
- *address = addr.Offset;
- *m_space = xlate_mspace_udi2mon(addr.Space);
- if (*bkpt_type & MONBreakFlagHardware)
- *bkpt_type = BKPT_29050;
- return(SUCCESS);
- } else {
- if (UDIretval == UDIErrorNoMoreBreakIds)
- return ((INT32) MONBreakNoMore);
- else if (UDIretval == UDIErrorInvalidBreakId)
- return ((INT32) MONBreakInvalid);
- else {
- udi_warning(UDIretval);
- return(FAILURE);
- }
- };
-}
-
-/* Kill Target */
-
-INT32
-/**********************************************Mini_break */
-Mini_break()
-{
-
- UDIStop();
- return (SUCCESS);
-}
-
-/* Obtain Target configuration and resynchronize with target */
-
-UDIInt32
-/**********************************************Mini_config_req */
-Mini_config_req(target_config, versions)
- TARGET_CONFIG *target_config;
- VERSIONS_ETC *versions;
-{
- UDIError UDIretval;
- UDIMemoryRange DFEMemRange[MONMaxMemRanges];
- UDIUInt32 ChipVersions[MONMaxChips];
- UDIInt NumRanges, NumChips;
- UDIInt i;
-
- NumRanges = (UDIInt) MONMaxMemRanges;
- NumChips = (UDIInt) MONMaxChips;
-
- if ((UDIretval = UDIGetTargetConfig(
- (UDIMemoryRange *) &DFEMemRange[0],
- (UDIInt *) &NumRanges, /* 3 -> I, D, R */
- (UDIUInt32 *) &ChipVersions[0],
- (UDIInt *) &NumChips)) <= TIPFAILURE) {
- PrintErrorMessage (UDIretval);
- return(FAILURE);
- } else if ((UDIretval == SUCCESS) || (UDIretval == UDIErrorIncomplete)) {
- if (UDIretval == UDIErrorIncomplete) {
- fprintf(stderr, "Ignoring: ");
- if (io_config.echo_mode == (INT32) TRUE) {
- fprintf(io_config.echo_file, "Ignoring: ");
- fflush (io_config.echo_file);
- }
- udi_warning(UDIretval);
- };
- i = (UDIInt) 0;
- while ((i < (UDIInt) MONMaxMemRanges) && (i < NumRanges)) {
- switch ((int) DFEMemRange[i].Space) {
- case UDI29KDRAMSpace:
- target_config->D_mem_start = (ADDR32) DFEMemRange[i].Offset;
- target_config->D_mem_size = (INT32) DFEMemRange[i].Size;
- break;
- case UDI29KIROMSpace:
- target_config->ROM_start = (ADDR32) DFEMemRange[i].Offset;
- target_config->ROM_size = (INT32) DFEMemRange[i].Size;
- break;
- case UDI29KIRAMSpace:
- target_config->I_mem_start = (ADDR32) DFEMemRange[i].Offset;
- target_config->I_mem_size = (INT32) DFEMemRange[i].Size;
- break;
- default: /* don't care, so ignore it */
- break;
- };
- i = i + (UDIInt) 1;
- } /* end while */
- i = (UDIInt) 0;
- while ((i < (UDIInt) MONMaxChips) && (i < NumChips)) {
- switch (i) {
- case 0: /* cpu */
- target_config->processor_id = (UINT32) ChipVersions[i];
- break;
- case 1: /* coprocessor */
- target_config->coprocessor = (UINT32) ChipVersions[i];
- if (target_config->coprocessor == (UINT32) UDI29KChipNotPresent)
- target_config->coprocessor = (UINT32) -1; /* MONDFE's */
- break;
- default: /* ignore */
- break;
- };
- i = i + (UDIInt) 1;
- } /* end while */
- return(SUCCESS);
- } else {
- udi_warning(UDIretval);
- return(FAILURE);
- }
-}
-
-
-/* Copy memory and registers */
-
-
-INT32
-/**********************************************Mini_copy */
-Mini_copy(src_space, src_addr, dst_space, dst_addr, byte_count, size, dir)
- INT32 src_space,
- dst_space;
- ADDR32 src_addr,
- dst_addr;
- INT32 byte_count;
- INT16 size;
- INT32 dir;
-{
- UDIError UDIretval;
- UDIResource from, to;
- UDICount count_done;
-
- from.Space = xlate_mspace_mon2udi(src_space);
- from.Offset = src_addr;
- to.Space = xlate_mspace_mon2udi(dst_space);
- to.Offset = dst_addr;
-
- if ((UDIretval = UDICopy (from,
- to,
- (UDICount) byte_count,
- (UDISizeT) size,
- &count_done,
- (UDIBool) dir)) <= TIPFAILURE) {
- PrintErrorMessage (UDIretval);
- return (FAILURE);
- } else if (UDIretval == SUCCESS) {
- return(SUCCESS);
- } else {
- udi_warning(UDIretval);
- return(FAILURE);
- }
-}
-
-/* Fill memory and registers */
-
-
-/* fill_count if greater than 4 should be a multiple of 4 */
-INT32
-/**********************************************Mini_fill */
-Mini_fill(m_space, start, fill_count, pattern_count, pattern)
- INT32 m_space;
- ADDR32 start;
- INT32 fill_count,
- pattern_count;
- BYTE *pattern;
-{
- UDIBool host_endian;
- UDIResource from;
- UDICount count_done;
- UDIError UDIretval;
-
- host_endian = FALSE;
-
- from.Offset = start;
- from.Space = xlate_mspace_mon2udi (m_space);
-
- if (fill_count == (INT32) 1) { /* takes only one write */
- if ((UDIretval = UDIWrite((UDIHostMemPtr) pattern,
- from,
- (UDICount) fill_count,
- (UDISizeT) pattern_count, /* a byte at a time */
- (UDICount *) &count_done,
- host_endian)) <= TIPFAILURE) {
- PrintErrorMessage (UDIretval);
- return (FAILURE);
- } else if (UDIretval == SUCCESS) {
- return(SUCCESS);
- } else {
- udi_warning(UDIretval);
- return(FAILURE);
- };
- } else {
- /* Handle arbitrary length strings to Data memory separately */
- if ((pattern_count > (INT32) 4) &&
- ((int) (pattern_count % 4) != (int) 0)){
- if (from.Space != UDI29KDRAMSpace)
- return (FAILURE);
- return((INT32) FillString(from, (UDIHostMemPtr) pattern,
- (UDISizeT) pattern_count, (UDICount) fill_count));
- } else {
- return((INT32) FillWords(from, (UDIHostMemPtr) pattern,
- (UDISizeT) pattern_count, (UDICount) fill_count));
- }
- };
-}
-
-/* Initiate a wait and get target status */
-
-INT32
-/**********************************************Mini_get_target_stats */
-Mini_get_target_stats(maxtime, target_status)
-INT32 maxtime;
-INT32 *target_status;
-{
- UDIPId pid;
- UDIError UDIretval;
- UDIInt32 udiwait_code;
-
- if (maxtime == (INT32) -1) {
- udiwait_code = (UDIInt32) UDIWaitForever;
- } else {
- udiwait_code = (UDIInt32) maxtime;
- };
- if ((UDIretval = UDIWait ((UDIInt32) udiwait_code,
- &pid,
- (UDIUInt32 *) target_status)) <= TIPFAILURE) {
- PrintErrorMessage (UDIretval);
- return (SUCCESS); /* considered non-fatal */
- } else if (UDIretval == SUCCESS) {
- CurrentPID = (UDIPId) pid; /* useful when reconnecting */
- return(SUCCESS);
- } else {
- udi_warning(UDIretval);
- return(FAILURE);
- };
-}
-
-
-INT32
-/**********************************************Mini_go */
-Mini_go()
-{
- UDIError UDIretval;
-
- if ((UDIretval = UDIExecute()) <= TIPFAILURE) {
- PrintErrorMessage (UDIretval);
- return (FAILURE);
- } else if (UDIretval == SUCCESS) {
- return(SUCCESS);
- } else {
- udi_warning(UDIretval);
- return(FAILURE);
- };
-}
-
-INT32
-/**********************************************Mini_init */
-Mini_init(txt_start, txt_end, dat_start, dat_end,
- entry_point, m_stack, r_stack,
- arg_string)
- ADDR32 txt_start,
- txt_end,
- dat_start,
- dat_end;
- ADDR32 entry_point;
- INT32 m_stack,
- r_stack;
- char *arg_string;
-{
- UDIMemoryRange ProcessMemory[MONMaxProcessMemRanges];
- UDIInt NumRanges;
- UDIResource Entry;
- CPUSizeT StackSizes[MONMaxStacks];
- UDIInt NumStacks;
- UDIError UDIretval;
-
- NumRanges = (UDIInt) MONMaxProcessMemRanges;
- NumStacks = (UDIInt) MONMaxStacks;
- ProcessMemory[0].Space = (CPUSpace) UDI29KIRAMSpace;
- ProcessMemory[0].Offset = (CPUOffset) txt_start;
- ProcessMemory[0].Size = (CPUSizeT) (txt_end - txt_start);
- ProcessMemory[1].Space = (CPUSpace) UDI29KDRAMSpace;
- ProcessMemory[1].Offset = (CPUOffset) dat_start;
- ProcessMemory[1].Size = (CPUSizeT) (dat_end - dat_start);
- Entry.Offset = entry_point;
- Entry.Space = xlate_mspace_mon2udi((INT32) I_MEM);
- StackSizes[0] = (CPUSizeT) r_stack;
- StackSizes[1] = (CPUSizeT) m_stack;
-
- if ((UDIretval = UDIInitializeProcess (&ProcessMemory[0],
- (UDIInt) NumRanges,
- Entry,
- &StackSizes[0],
- (UDIInt) NumStacks,
- arg_string)) <= TIPFAILURE) {
- PrintErrorMessage (UDIretval);
- return (FAILURE);
- } else if (UDIretval == SUCCESS) {
- return(SUCCESS);
- } else {
- udi_warning(UDIretval);
- return(FAILURE);
- };
-}
-
-
-/* Read memory or registers from target */
-INT32
-/**********************************************Mini_read_req */
-Mini_read_req(m_space, address, byte_count, size, count_done,
- buffer, host_endian)
- INT32 m_space;
- ADDR32 address;
- INT32 byte_count;
- INT16 size;
- INT32 host_endian;
- INT32 *count_done;
- BYTE *buffer;
-{
- UDIError UDIretval;
- UDIResource from;
-
- from.Space = xlate_mspace_mon2udi(m_space);
- from.Offset = address;
-
- if ((UDIretval = UDIRead (from,
- (UDIHostMemPtr) buffer,
- (UDICount) byte_count,
- (UDISizeT) size,
- (UDICount *) count_done,
- (UDIBool) host_endian)) <= TIPFAILURE) {
- PrintErrorMessage (UDIretval);
- return(FAILURE);
- } else if (UDIretval == SUCCESS) {
- return(SUCCESS);
- } else {
- udi_warning(UDIretval);
- return(FAILURE);
- }
-}
-
-/*
- * Reset target processor
- */
-INT32
-/**********************************************Mini_reset_processor */
-Mini_reset_processor()
-{
- UDIMemoryRange ProcessMemory[MONMaxProcessMemRanges];
- UDIInt NumRanges;
- UDIResource Entry;
- CPUSizeT StackSizes[MONMaxStacks];
- UDIInt NumStacks;
- UDIError UDIretval;
- UDIPId CurrentPID;
- UDIUInt32 StopReason;
-
-
- NumRanges = (UDIInt) MONMaxProcessMemRanges;
- NumStacks = (UDIInt) MONMaxStacks;
- ProcessMemory[0].Space = (CPUSpace) UDI29KIRAMSpace;
- ProcessMemory[0].Offset = (CPUOffset) 0;
- ProcessMemory[0].Size = (CPUSizeT) 0;
- ProcessMemory[0].Space = (CPUSpace) UDI29KIRAMSpace;
- ProcessMemory[0].Offset = (CPUOffset) 0;
- ProcessMemory[0].Size = (CPUSizeT) 0;
- Entry.Offset = 0;
- Entry.Space = xlate_mspace_mon2udi((INT32) I_MEM);
- StackSizes[0] = (CPUSizeT) 0;
- StackSizes[1] = (CPUSizeT) 0;
-
- if ((UDIretval = UDIWait((UDIInt32) 0, &CurrentPID, &StopReason))
- <= TIPFAILURE) {
- PrintErrorMessage (UDIretval);
- return(FAILURE);
- } else if (UDIretval != SUCCESS) {
- udi_warning(UDIretval);
- return(FAILURE);
- };
- /* set PID to ProcProcessor */
- if (( UDIretval = UDISetCurrentProcess((UDIPId) UDIProcessProcessor))
- <= TIPFAILURE) {
- PrintErrorMessage (UDIretval);
- return(FAILURE);
- } else if (UDIretval != SUCCESS) {
- udi_warning(UDIretval);
- return(FAILURE);
- };
- /* Successful */
- /* call InitializeProcess. Paramters ignored. */
- if ((UDIretval = UDIInitializeProcess (&ProcessMemory[0],
- (UDIInt) NumRanges,
- Entry,
- &StackSizes[0],
- (UDIInt) NumStacks,
- (char *) 0)) <= TIPFAILURE) {
- PrintErrorMessage (UDIretval);
- return(FAILURE);
- } else if (UDIretval != SUCCESS) {
- udi_warning(UDIretval);
- return(FAILURE);
- };
- /* Successful */
- if (( UDIretval = UDISetCurrentProcess((UDIPId) CurrentPID))
- <= TIPFAILURE) {
- PrintErrorMessage (UDIretval);
- return(FAILURE);
- } else if (UDIretval != SUCCESS) {
- udi_warning(UDIretval);
- return(FAILURE);
- };
- return (SUCCESS);
-}
-
-/* Write memory or registers to target */
-INT32
-/**********************************************Mini_write_req */
-Mini_write_req(m_space, address, byte_count, size, count_done,
- buffer, host_endian)
- INT32 m_space;
- ADDR32 address;
- INT32 byte_count;
- INT16 size;
- INT32 *count_done;
- BYTE *buffer;
- INT32 host_endian;
-{
- UDIError UDIretval;
- UDIResource to;
-
- to.Space = xlate_mspace_mon2udi(m_space);
- to.Offset = address;
-
- if ((UDIretval = UDIWrite((UDIHostMemPtr) buffer,
- to,
- (UDICount) byte_count,
- (UDISizeT) size,
- (UDICount *) count_done,
- (UDIBool) host_endian)) <= TIPFAILURE) {
- PrintErrorMessage (UDIretval);
- return(FAILURE);
- } else if (UDIretval == SUCCESS) {
- return(SUCCESS);
- } else {
- udi_warning(UDIretval);
- return(FAILURE);
- }
-}
-
-INT32
-Mini_stdin_mode_x(mode)
-INT32 *mode;
-{
- UDIError UDIretval;
-
- if ((UDIretval = UDIStdinMode ((UDIMode *) mode)) <= TIPFAILURE) {
- PrintErrorMessage (UDIretval);
- return (FAILURE);
- } else if (UDIretval == SUCCESS) {
- return(SUCCESS);
- } else {
- udi_warning(UDIretval);
- return(FAILURE);
- };
-}
-
-INT32
-/**********************************************Mini_put_stdin */
-Mini_put_stdin(buffer, bufsize, count)
- char *buffer;
- INT32 bufsize;
- INT32 *count;
-{
- UDIError UDIretval;
-
- if ((UDIretval = UDIPutStdin ((UDIHostMemPtr) buffer,
- (UDISizeT) bufsize,
- (UDISizeT *) count)) <= TIPFAILURE) {
- PrintErrorMessage (UDIretval);
- return (FAILURE);
- } else if (UDIretval == SUCCESS) {
- return(SUCCESS);
- } else {
- udi_warning(UDIretval);
- return(FAILURE);
- };
-}
-
-/* Put characters to stdout */
-
-
-INT32
-/**********************************************Mini_get_stdout */
-Mini_get_stdout(buffer, bufsize, count_done)
- char *buffer;
- INT32 *count_done;
- INT32 bufsize;
-{
- UDIError UDIretval;
-
- if ((UDIretval = UDIGetStdout ((UDIHostMemPtr) buffer,
- (UDISizeT) bufsize,
- (UDISizeT *) count_done)) <= TIPFAILURE) {
- PrintErrorMessage (UDIretval);
- return (FAILURE);
- } else if (UDIretval == SUCCESS) {
- return(SUCCESS);
- } else {
- udi_warning(UDIretval);
- return(FAILURE);
- }
-}
-
-INT32
-/**********************************************Mini_get_stderr */
-Mini_get_stderr(buffer, bufsize, count_done)
- char *buffer;
- INT32 *count_done;
- INT32 bufsize;
-{
- UDIError UDIretval;
- if ((UDIretval = UDIGetStderr ((UDIHostMemPtr) buffer,
- (UDISizeT) bufsize,
- (UDISizeT *) count_done)) <= TIPFAILURE) {
- PrintErrorMessage (UDIretval);
- return (FAILURE);
- } else if (UDIretval == SUCCESS) {
- return(SUCCESS);
- } else {
- udi_warning(UDIretval);
- return(FAILURE);
- }
-}
-
-/* Step instructions */
-
-
-INT32
-/**********************************************Mini_step */
-Mini_step(count)
-INT32 count;
-{
- UDIError UDIretval;
- UDIRange dummy_range;
- UDIStepType step_type;
-
- dummy_range.Low = 0;
- dummy_range.High = 0xffffffff;
-
- step_type = UDIStepNatural;
-
- if ((UDIretval = UDIStep((UDIUInt32) count,
- step_type,
- dummy_range)) <= TIPFAILURE) {
- PrintErrorMessage (UDIretval);
- return (FAILURE);
- } else if (UDIretval == SUCCESS) {
- return(SUCCESS);
- } else {
- udi_warning(UDIretval);
- return(FAILURE);
- };
-}
-
-INT32
-/***************************************************** Mini_put_trans */
-Mini_put_trans(buffer)
-char *buffer;
-{
- UDIError UDIretval;
- UDISizeT count;
- UDISizeT *count_done;
-
- count = (UDISizeT) (strlen (buffer) + 1);
- if ((UDIretval = UDIPutTrans((UDIHostMemPtr) buffer,
- (UDISizeT) count,
- (UDISizeT *) count_done)) <= TIPFAILURE) {
- PrintErrorMessage (UDIretval);
- return (FAILURE);
- } else if (UDIretval == SUCCESS) {
- return(SUCCESS);
- } else {
- udi_warning(UDIretval);
- return(FAILURE);
- };
-
-}
-
-
-static CPUSpace
-xlate_mspace_mon2udi(m_space)
-INT32 m_space;
-{
- switch(m_space) {
- case LOCAL_REG:
- return((CPUSpace) UDI29KLocalRegs);
- case ABSOLUTE_REG:
- return((CPUSpace) UDI29KGlobalRegs);
- case GLOBAL_REG:
- return((CPUSpace) UDI29KGlobalRegs);
- case SPECIAL_REG:
- return((CPUSpace) UDI29KSpecialRegs);
- case TLB_REG:
- return((CPUSpace) UDI29KTLBRegs);
- case COPROC_REG:
- return((CPUSpace) UDI29KAm29027Regs);
- case I_MEM:
- return((CPUSpace) UDI29KIRAMSpace);
- case D_MEM:
- return((CPUSpace) UDI29KDRAMSpace);
- case I_ROM:
- return((CPUSpace) UDI29KIROMSpace);
- case D_ROM:
- return((CPUSpace) UDI29KDRAMSpace);
- case I_O:
- return((CPUSpace) UDI29KIOSpace);
- case I_CACHE:
- return((CPUSpace) UDI29KICacheSpace);
- case D_CACHE:
- return((CPUSpace) UDI29KDCacheSpace);
- case PC_SPACE:
- return((CPUSpace) UDI29KPC);
- case A_SPCL_REG:
- return((CPUSpace) UDI29KSpecialRegs);
- case GENERIC_SPACE:
- return ((CPUSpace) UDI29KDRAMSpace);
- case VERSION_SPACE:
- return ((CPUSpace) VERSION_SPACE);
- default:
- return((CPUSpace) FAILURE);
- };
-}
-
-static INT32
-xlate_mspace_udi2mon(mspace)
-CPUSpace mspace;
-{
- switch(mspace) {
- case UDI29KDRAMSpace:
- return((INT32) D_MEM);
- case UDI29KIOSpace:
- return((INT32) I_O);
- case UDI29KCPSpace0:
- return((INT32) FAILURE);
- case UDI29KCPSpace1:
- return((INT32) FAILURE);
- case UDI29KIROMSpace:
- return((INT32) I_ROM);
- case UDI29KIRAMSpace:
- return((INT32) I_MEM);
- case UDI29KLocalRegs:
- return((INT32) LOCAL_REG);
- case UDI29KGlobalRegs:
- return((INT32) GLOBAL_REG);
- case UDI29KRealRegs:
- return((INT32) GLOBAL_REG);
- case UDI29KSpecialRegs:
- return((INT32) SPECIAL_REG);
- case UDI29KTLBRegs:
- return((INT32) TLB_REG);
- case UDI29KACCRegs:
- return((INT32) FAILURE);
- case UDI29KICacheSpace:
- return((INT32) I_CACHE);
- case UDI29KAm29027Regs:
- return((INT32) COPROC_REG);
- case UDI29KPC:
- return((INT32) PC_SPACE);
- case UDI29KDCacheSpace:
- return((INT32) D_CACHE);
- default:
- return(FAILURE);
- };
-}
-
-static
-void udi_warning(num)
-int num;
-{
- fprintf(stderr, "UDIERROR: %d : %s\n", num, udi_errmsg[num]);
- fflush(stderr);
- if (io_config.echo_mode == (INT32) TRUE) {
- fprintf(io_config.echo_file, "UDIERROR: %d :%s\n", num, udi_errmsg[num]);
- fflush (io_config.echo_file);
- }
-}
-
-static void
-PrintErrorMessage(UDIretval)
-UDIError UDIretval;
-{
- UDISizeT ErrorMsgCnt;
-
- fprintf(stderr, "TIPERROR: %d :", UDIretval);
- fflush(stderr);
- if (io_config.echo_mode == (INT32) TRUE) {
- fprintf(io_config.echo_file, "TIPERROR: %d :", UDIretval);
- fflush(io_config.echo_file);
- }
-
- ErrorMsgCnt = (UDISizeT) 0;
- do {
- if (UDIGetErrorMsg(UDIretval,
- (UDISizeT) MONErrorMsgSize,
- MONErrorMsg, &ErrorMsgCnt) != UDINoError) {
- fprintf(stderr, "TIPERROR: Could not get TIP error message.\n");
- fflush(stderr);
- return;
- }
- write (fileno(stderr), &MONErrorMsg[0], (int) ErrorMsgCnt);
- if (io_config.echo_mode == (INT32) TRUE)
- write (fileno(io_config.echo_file), &MONErrorMsg[0], (int) ErrorMsgCnt);
- } while (ErrorMsgCnt == (UDISizeT) MONErrorMsgSize);
- fprintf(stderr, "\n");
- if (io_config.echo_mode == (INT32) TRUE) {
- fprintf(io_config.echo_file, "\n");
- fflush(io_config.echo_file);
- }
- return;
-}
-
-static UDIError
-FillWords(from, pattern, pattern_count, fill_count)
-UDIResource from;
-UDIHostMemPtr pattern;
-UDISizeT pattern_count;
-UDICount fill_count;
-{
- UDICount count_done;
- UDIBool host_endian, direction;
- UDIError UDIretval;
- UDIResource to;
-
- INT32 isregspace = ISREG(xlate_mspace_udi2mon(from.Space));
-
- host_endian = FALSE;
-
- if ((UDIretval = UDIWrite((UDIHostMemPtr) pattern,
- from,
- (UDICount) 1,
- (UDISizeT) pattern_count,
- (UDICount *) &count_done,
- host_endian)) <= TIPFAILURE) {
- PrintErrorMessage (UDIretval);
- return (FAILURE);
- } else if (UDIretval == SUCCESS) { /* do copy */
- fill_count = fill_count - 1; /* one less */
- if (fill_count > (INT32) 0) { /* do copy */
- if (isregspace)
- to.Offset = from.Offset + (pattern_count/4);
- else
- to.Offset = from.Offset + pattern_count;
- to.Space = from.Space; /* already translated */
- direction = TRUE; /* front to back */
- if (pattern_count > (INT32) 4) { /* is a multiple of 4 also */
- fill_count = (INT32) (fill_count * (pattern_count/4));
- pattern_count = (INT32) 4;
- };
- if ((UDIretval = UDICopy (from,
- to,
- fill_count,
- (UDISizeT) pattern_count,
- (UDICount *) &count_done,
- direction)) <= TIPFAILURE) {
- PrintErrorMessage (UDIretval);
- return (FAILURE);
- } else if (UDIretval == SUCCESS) {
- return(SUCCESS);
- } else {
- udi_warning(UDIretval);
- return(FAILURE);
- }
- };
- /* return if no more to copy */
- return(SUCCESS);
- } else {
- udi_warning(UDIretval);
- return(FAILURE);
- };
-}
-
-static UDIError
-FillString(from, pattern, pattern_count, fill_count)
-UDIResource from;
-UDIHostMemPtr pattern;
-UDISizeT pattern_count;
-UDICount fill_count;
-{
- UDICount count_done;
- UDIBool host_endian, direction;
- UDIError UDIretval;
- UDIResource to;
-
- host_endian = FALSE;
-
- if ((UDIretval = UDIWrite((UDIHostMemPtr) pattern,
- from,
- (UDICount) pattern_count,
- (UDISizeT) 1,
- (UDICount *) &count_done,
- host_endian)) <= TIPFAILURE) {
- PrintErrorMessage (UDIretval);
- return (FAILURE);
- } else if (UDIretval == SUCCESS) { /* do copy */
- fill_count = fill_count - 1; /* one less */
- if (fill_count > (INT32) 0) { /* do copy */
- to.Offset = from.Offset + pattern_count;
- to.Space = from.Space;
- direction = TRUE; /* front to back */
- if ((UDIretval = UDICopy (from,
- to,
- (UDICount) (fill_count*pattern_count),
- (UDISizeT) 1,
- (UDICount *) &count_done,
- direction)) <= TIPFAILURE) {
- PrintErrorMessage (UDIretval);
- return (FAILURE);
- } else if (UDIretval == SUCCESS) {
- return(SUCCESS);
- } else {
- udi_warning(UDIretval);
- return(FAILURE);
- }
- };
- /* return if no more to copy */
- return(SUCCESS);
- } else {
- udi_warning(UDIretval);
- return(FAILURE);
- };
-}
+++ /dev/null
-static char _[] = "@(#)monitor.c 5.28 93/11/02 11:46:54, Srini, AMD.";
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- * This module implements the monitor command interpreter.
- *****************************************************************************
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <signal.h>
-#ifdef MSDOS
-#include <stdlib.h>
-#include <conio.h>
-#include <io.h>
-#else
-#include <fcntl.h>
-#include <termio.h>
-/* #include <sys/ioctl.h> */
-#endif
-#include "monitor.h"
-#include "main.h"
-#include "memspcs.h"
-#include "error.h"
-#include "miniint.h"
-
-/* Function declarations */
-extern void Mini_Ctrl_C_Handler PARAMS((int));
-extern void Mini_loop PARAMS((void));
-extern INT32 Mini_go_forever PARAMS((void));
-extern void Mini_poll_kbd PARAMS((char *cmd_buffer, int size, int mode));
-extern int Mini_cmdfile_input PARAMS((char *cmd_buffer, int size));
-extern int tokenize_cmd PARAMS((char *, char **));
-extern void lcase_tokens PARAMS((char **, int));
-extern int get_word PARAMS((char *, INT32 *));
-extern void PrintTrapMsg PARAMS((int trapnum));
-extern void display_msg PARAMS((void));
-extern void display_termuser PARAMS((void));
-extern void display_term29k PARAMS((void));
-extern INT32 get_pc_addrs PARAMS((ADDR32 *pc1, ADDR32 *cps));
-extern INT32 get_pc1_inst PARAMS((ADDR32 cps, ADDR32 pc1, BYTE *inst));
-extern void dasm_instr PARAMS((ADDR32, struct instr_t *));
-extern void convert32 PARAMS((BYTE *));
-extern INT32 Mini_send_init_info PARAMS((INIT_INFO *init));
-
-static int FindCmdIndx PARAMS((char *string));
-
-/* Globals */
-GLOBAL struct bkpt_t *bkpt_table;
-
-GLOBAL char cmd_buffer[BUFFER_SIZE];
-GLOBAL char tip_cmd_buffer[256];
-GLOBAL int GoCmdFlag=0;
-
-#define TOGGLE_CHAR (io_config.io_toggle_char)
-
-/* Following three vars to be used in stdin/stdout/stderr funcs */
-#define IO_BUFSIZE 1024
-static char io_buffer[IO_BUFSIZE];
-static INT32 io_bufsize;
-static INT32 io_count_done;
-
-static INT32 ProcessorState;
-static int GrossState;
-static INT32 exit_loop;
-static int CtrlCHit=0;
-static int BlockMode;
-/* These modes are defined in montip, udi2mtip.c file */
-#define TIP_COOKED 0x0
-#define TIP_RAW 0x1
-#define TIP_CBREAK 0x2
-#define TIP_ECHO 0x4
-#define TIP_ASYNC 0x8
-#define TIP_NBLOCK 0x10
-static INT32 TipStdinMode = TIP_COOKED; /* initial */
-#ifndef MSDOS
-struct termio OldTermbuf, NewTermbuf; /* STDIN, Channel0 */
-#endif /* MSDOS */
-
-/* Monitor command table */
-struct MonitorCommands_t {
- char *CmdString; /* Maximum length */
- INT32 (*CmdFn) PARAMS((char **, int));
-};
-
-static struct MonitorCommands_t MonitorCommands[] = {
-"a", asm_cmd,
-"attach", set_sessionid_cmd,
-"b", bkpt_cmd,
-"bc", bkpt_cmd,
-"b050", bkpt_cmd,
-"b050v", bkpt_cmd,
-"b050p", bkpt_cmd,
-"c", config_cmd,
-"caps", capab_cmd,
-"cp", create_proc_cmd,
-"con", connect_cmd,
-"ch0", channel0_cmd,
-"d", dump_cmd,
-"ex", exit_conn_cmd,
-"dw", dump_cmd,
-"dh", dump_cmd,
-"db", dump_cmd,
-"df", dump_cmd,
-"dd", dump_cmd,
-"dp", destroy_proc_cmd,
-"disc", disconnect_cmd,
-"detach", disconnect_cmd,
-"esc", escape_cmd,
-"eon", echomode_on,
-"eoff", echomode_off,
-"f", fill_cmd,
-"fw", fill_cmd,
-"fh", fill_cmd,
-"fb", fill_cmd,
-"ff", fill_cmd,
-"fd", fill_cmd,
-"fs", fill_cmd,
-"g", go_cmd,
-"h", help_cmd,
-"ix", ix_cmd,
-"il", il_cmd,
-"init", init_proc_cmd,
-"k", kill_cmd,
-"l", dasm_cmd,
-"logon", logon_cmd,
-"logoff", logoff_cmd,
-"m", move_cmd,
-"pid", set_pid_cmd,
-"q", quit_cmd,
-"qoff", quietmode_off,
-"qon", quietmode_on,
-"r", reset_cmd,
-"s", set_cmd,
-"sw", set_cmd,
-"sh", set_cmd,
-"sb", set_cmd,
-"sf", set_cmd,
-"sd", set_cmd,
-"sid", set_sessionid_cmd,
-"t", trace_cmd,
-"target", connect_cmd,
-"tip", tip_cmd,
-"ver", version_cmd,
-"xp", xp_cmd,
-"xc", xc_cmd,
-"y", yank_cmd,
-"zc", cmdfile_cmd,
-"ze", echofile_cmd,
-"zl", set_logfile,
-"?", help_cmd,
-"|", dummy_cmd,
-"", dummy_cmd,
-NULL
-};
-
-/* Trap Messages */
-static char *TrapMsg[] = {
-"Illegal Opcode",
-"Unaligned Access",
-"Out of Range",
-"Coprocessor Not Present",
-"Coprocessor Exception",
-"Protection Violation",
-"Instruction Access Exception",
-"Data Access Exception",
-"User-Mode Instruction TLB Miss",
-"User-Mode Data TLB Miss",
-"Supervisor-Mode Instruction TLB Miss",
-"Supervisor-Mode Data TLB Miss",
-"Instruction TLB Protection Violation",
-"Data TLB Protection Violation",
-"Timer",
-"Trace",
-"INTR0",
-"INTR1",
-"INTR2",
-"INTR3",
-"TRAP0",
-"TRAP1",
-"Floating-Point Exception"
-};
-
-void
-Mini_monitor()
-{
-
- /* Initialize breakpoint table */
-
- bkpt_table = NULL;
- GrossState = NOTEXECUTING;
-
- /*
- * Start with the user being the terminal controller.
- */
- io_config.io_control = TERM_USER;
- io_config.target_running = FALSE;
-
-#ifndef MSDOS
- ioctl (fileno(stdin), TCGETA, &OldTermbuf); /* Initial settings */
-#endif
-
- /*
- * Define Ctrl-U as the io_toggle_char as default.
- */
- io_config.io_toggle_char = (BYTE) 21;
-
- /*
- ** Open cmd file (if necessary)
- */
-
- if (io_config.cmd_file_io == TRUE) { /* TRUE if -c option given */
- io_config.cmd_file = fopen(io_config.cmd_filename, "r");
- if (io_config.cmd_file == NULL) {
- warning (EMCMDOPEN);
- io_config.cmd_file_io = FALSE;
- } else {
- /* MON_STDIN is command file */
- MON_STDIN = fileno(io_config.cmd_file); /* set MON_STDIN */
- };
- }
-
- /*
- ** Open log file, if no command file given.
- */
-
- if (io_config.log_mode == (INT32) TRUE) { /* -log option given */
- if (io_config.log_filename) {
- io_config.log_file = fopen(io_config.log_filename, "w");
- if (io_config.log_file == NULL) {
- io_config.log_mode = (INT32) FALSE;
- warning(EMLOGOPEN);
- }
- } else {
- io_config.log_mode = (INT32) FALSE;
- warning(EMLOGOPEN);
- }
- }
-
- /* Install ctrl-C handler */
-
- if (signal (SIGINT, Mini_Ctrl_C_Handler) == SIG_ERR) {
- fprintf(stderr, "Ctrl-C handler not installed.\n"); /* warning */
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "Ctrl-C handler not installed.\n"); /* warning */
- }
- /* Get into monitor loop */
-
- Mini_loop();
-
-}
-
-void
-Mini_loop()
-{
- INT32 retval;
- int token_count;
- char *token[MAX_TOKENS];
- int Indx;
-
- exit_loop = FALSE;
- CtrlCHit = 0;
- /*
- ** Enter command interpreter loop
- */
-
- fprintf(stderr, "%s>", ProgramName);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "%s>", ProgramName);
-
- BlockMode = BLOCK; /* wait for a user command */
- do {
-
- if (CtrlCHit) {
- CtrlCHit = 0;
- /* Print a prompt */
- fprintf(stderr, "\n%s>", ProgramName);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n%s>", ProgramName);
- }
- /*
- ** If the target was set to run, get its current status.
- */
- if (Mini_get_target_stats((INT32) udi_waittime, &ProcessorState) != SUCCESS) {
- Mini_TIP_DestroyProc();
- Mini_TIP_exit();
- fatal_error(EMFATAL);
- };
- GrossState = (int) (ProcessorState & 0xFF);
- switch (GrossState) {
- case NOTEXECUTING: /* do nothing */
- io_config.io_control=TERM_USER;
- io_config.target_running = FALSE;
- BlockMode = BLOCK; /* wait for a user command */
- break;
- case EXITED: /* do nothing */
- if (GoCmdFlag) {
- GoCmdFlag = 0;
-#ifndef MSDOS
- ioctl (fileno(stdin), TCSETA, &OldTermbuf); /*reset settings */
-#endif
- if (!QuietMode) {
- fprintf (stderr, "Process exited with 0x%lx\n",
- (ProcessorState >> 8));
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "Process exited with 0x%lx\n",
- (ProcessorState >> 8));
- }
- fprintf (stderr, "%s>", ProgramName);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "%s> ", ProgramName);
- }
- io_config.io_control=TERM_USER;
- io_config.target_running = FALSE;
- BlockMode = BLOCK; /* wait for a user command */
- break;
- case RUNNING: /* any request from target? */
- io_config.target_running = TRUE;
- BlockMode = NONBLOCK; /* return immediately */
- break;
- case STOPPED:
- io_config.io_control=TERM_USER;
- io_config.target_running = TRUE;
- if (GoCmdFlag) {
- GoCmdFlag = 0;
-#ifndef MSDOS
- ioctl (fileno(stdin), TCSETA, &OldTermbuf); /*reset settings */
-#endif
- fprintf(stderr, "Execution stopped at ");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "Execution stopped at ");
- display_msg();
- }
- BlockMode = BLOCK; /* wait for next user command */
- break;
- case BREAK:
- io_config.io_control=TERM_USER;
- io_config.target_running = FALSE;
- if (GoCmdFlag) {
- GoCmdFlag = 0;
-#ifndef MSDOS
- ioctl (fileno(stdin), TCSETA, &OldTermbuf); /*reset settings */
-#endif
- fprintf(stderr, "Breakpoint hit at ");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "Breakpoint hit at ");
- display_msg();
- }
- BlockMode = BLOCK; /* wait for next user command */
- break;
- case STEPPED:
- io_config.io_control=TERM_USER;
- io_config.target_running = FALSE;
- if (GoCmdFlag) {
- GoCmdFlag = 0;
-#ifndef MSDOS
- ioctl (fileno(stdin), TCSETA, &OldTermbuf); /*reset settings */
-#endif
- fprintf(stderr, "Stepping... Execution stopped at ");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "Stepping...Execution stopped at ");
- display_msg();
- }
- BlockMode = BLOCK; /* wait for next user command */
- break;
- case WAITING:
- io_config.io_control=TERM_USER;
- io_config.target_running = FALSE;
- break;
- case HALTED:
- io_config.io_control=TERM_USER;
- io_config.target_running = FALSE;
- if (GoCmdFlag) {
- GoCmdFlag = 0;
-#ifndef MSDOS
- ioctl (fileno(stdin), TCSETA, &OldTermbuf); /*reset settings */
-#endif
- fprintf(stderr, "Execution halted at ");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "Execution halted at ");
- display_msg();
- }
- BlockMode = BLOCK; /* wait for next user command */
- break;
- case WARNED:
- io_config.io_control=TERM_USER;
- io_config.target_running = FALSE;
- break;
- case TRAPPED:
- io_config.io_control=TERM_USER;
- io_config.target_running = FALSE;
- if (GoCmdFlag) {
- GoCmdFlag = 0;
-#ifndef MSDOS
- ioctl (fileno(stdin), TCSETA, &OldTermbuf); /*reset settings */
-#endif
- PrintTrapMsg((int) (ProcessorState >> 8));
- display_msg();
- }
- BlockMode = BLOCK; /* wait for next user command */
- break;
- case STDOUT_READY:
- io_bufsize = 0;
- io_count_done = (INT32) 0;
- do {
- Mini_get_stdout(io_buffer, IO_BUFSIZE, &io_count_done);
- write(MON_STDOUT, &io_buffer[0], (int) io_count_done);
- if (io_config.echo_mode == (INT32) TRUE) {
- fflush (io_config.echo_file);
- write (fileno(io_config.echo_file), &io_buffer[0], (int) io_count_done);
- }
- } while (io_count_done == (INT32) IO_BUFSIZE);
- break;
- case STDERR_READY:
- io_bufsize = 0;
- io_count_done = (INT32) 0;
- do {
- Mini_get_stderr(io_buffer, IO_BUFSIZE, &io_count_done);
- write(MON_STDERR, &io_buffer[0], (int) io_count_done);
- if (io_config.echo_mode == (INT32) TRUE) {
- fflush (io_config.echo_file);
- write (fileno(io_config.echo_file), &io_buffer[0], (int) io_count_done);
- }
- } while (io_count_done == (INT32) IO_BUFSIZE);
- break;
- case STDIN_NEEDED:
- /* Line buffered reads only */
- if (io_config.cmd_file_io == TRUE) { /* read from command file */
- if (Mini_cmdfile_input(io_buffer, IO_BUFSIZE) == SUCCESS) {
- io_bufsize = strlen(io_buffer);
- fprintf(stderr, "%s", io_buffer); /* echo */
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "%s", io_buffer); /* echo */
- } else { /* read from terminal */
- io_bufsize = read( fileno(stdin), io_buffer, IO_BUFSIZE );
- }
- } else {
- io_bufsize = read( fileno(stdin), io_buffer, IO_BUFSIZE );
- };
- if (io_bufsize < 0)
- {
- fprintf(stderr, "fatal error reading from stdin\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "fatal error reading from stdin\n");
- }
- if (io_config.echo_mode == (INT32) TRUE) {
- write (fileno(io_config.echo_file), &io_buffer[0], (int) io_bufsize);
- fflush (io_config.echo_file);
- }
- Mini_put_stdin(io_buffer, io_bufsize, &io_count_done);
- break;
- case STDINMODEX:
- /* call TIP to get StdinMode */
- Mini_stdin_mode_x((INT32 *)&TipStdinMode);
- if (TipStdinMode & TIP_NBLOCK)
- io_config.io_control = TERM_29K;
- else if (TipStdinMode & TIP_ASYNC)
- io_config.io_control = TERM_29K;
- else if (TipStdinMode == TIP_COOKED)
- io_config.io_control = TERM_USER;
- else {
- fprintf(stderr, "DFEWARNING: TIP Requested Stdin Mode Not Supported.\n");
- fprintf(stderr, "DFEWARNING: Using default mode.\n");
- TipStdinMode = TIP_COOKED;
- io_config.io_control = TERM_USER;
- }
-
- if (io_config.io_control == TERM_29K)
- display_term29k();
- break;
-
- default:
- break;
- }; /* end switch */
-
-
- /*
- ** Check for keyboard input from command file first, then keyboard.
- */
- if (io_config.io_control == TERM_USER) {
- if (io_config.target_running == FALSE) {
- if (io_config.cmd_ready == FALSE) { /* Get a new user command */
- if (io_config.cmd_file_io == TRUE) { /* try command file first*/
- if (Mini_cmdfile_input(cmd_buffer, BUFFER_SIZE) == SUCCESS) {
- fprintf(stderr, "%s", cmd_buffer);
- io_config.cmd_ready = TRUE;
- } else {
- Mini_poll_kbd(cmd_buffer, BUFFER_SIZE, BlockMode);
- }
- } else { /* keyboard */
- /* Mini_poll_kbd function sets io_config.cmd_ready */
- Mini_poll_kbd(cmd_buffer, BUFFER_SIZE, BlockMode);
- }
- }
- } else {
- Mini_poll_kbd(cmd_buffer, BUFFER_SIZE, BlockMode);
- }
- } else if (io_config.io_control == TERM_29K) {
- if ((GrossState == RUNNING) || GoCmdFlag)
- Mini_poll_channel0(); /* non-blocking */
- } else {
- fprintf(stderr, "fatal error: Don't know who is controlling the terminal!\n");
- return;
- }
-
-
- if (io_config.cmd_ready == TRUE) { /* if there is a command in buffer */
-#ifdef MSDOS
- if (io_config.log_mode == (INT32) TRUE) /* make a log file */
- fprintf(io_config.log_file, "%s\n", cmd_buffer);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "%s\n", cmd_buffer);
-#else
- if (io_config.log_mode == (INT32) TRUE) /* make a log file */
- fprintf(io_config.log_file, "%s", cmd_buffer);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "%s", cmd_buffer);
-#endif
- /*
- ** Parse command
- */
-
- token_count = tokenize_cmd(cmd_buffer, token);
- /* Convert first character (command) to lcase */
- if (isupper(*token[0]))
- (*token[0]) = (char) tolower(*token[0]);
-
- /* If anything but a y or z command, convert to lower case */
- if ( ((*token[0]) != 'y') &&
- ((*token[0]) != 'z') )
- lcase_tokens(token, token_count);
-
- if ((Indx = FindCmdIndx(token[0])) != (int) FAILURE)
- io_config.cmd_ready = TRUE;
- else {
- warning(EMNOSUCHCMD);
- /* Print a prompt */
- fprintf(stderr, "\n%s>", ProgramName);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n%s>", ProgramName);
- io_config.cmd_ready = FALSE; /* nothing to execute */
- }
- }
-
- /*
- ** Execute command
- */
-
- if (io_config.cmd_ready == TRUE) {
- retval = MonitorCommands[Indx].CmdFn(token, token_count);
- io_config.cmd_ready = FALSE;
- if (retval == FAILURE) {
- fprintf(stderr, "Command failed\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "Command failed\n");
- } else if (retval != SUCCESS) {
- warning(retval);
- };
- /* Print a prompt */
- if (io_config.io_control == TERM_USER) {
- fprintf(stderr, "%s>", ProgramName);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "%s>", ProgramName);
- } else {
- display_term29k();
- }
- } /* if cmd ready */
-
- } while (exit_loop != TRUE); /* end of do-while */
-
- /* Close log file */
- if (io_config.log_mode == (INT32) TRUE)
- (void) fclose(io_config.log_file);
-
- if (bkpt_table != NULL)
- (void) free((char *) bkpt_table);
-}
-
-/*
-** This function takes in a string and produces a lower case,
-** " argv - argc" style array. Then number of elements in the
-** array is returned.
-*/
-
-int
-tokenize_cmd(cmd, token)
- char *cmd;
- char *token[];
- {
- int token_count;
-
- /* Break input into tokens */
- token_count = 0;
- token[0] = cmd;
-
- if (cmd[0] != '\0') {
- token[token_count] = strtok(cmd, " \t,;\n\r");
-
- if (token[token_count] != NULL) {
- do {
- token_count = token_count + 1;
- token[token_count] = strtok((char *) NULL, " \t,;\n\r");
- } while ((token[token_count] != NULL) &&
- (token_count < MAX_TOKENS));
- }
- else {
- token[0] = cmd;
- *token[0] = '\0';
- }
- }
-
- return (token_count);
-
- } /* end tokenize_cmd() */
-
-
-
-/*
-** This function is used to convert a list of tokens
-** to all lower case letters.
-*/
-
-void
-lcase_tokens(token, token_count)
- char *token[MAX_TOKENS];
- int token_count;
- {
- int i;
- char *temp_str;
-
- for (i=0; i<token_count; i=i+1) {
- temp_str = token[i];
- while (*temp_str != '\0') {
- if (isupper(*temp_str))
- *temp_str = (char) tolower(*temp_str);
- temp_str++;
- }
- } /* end for() */
- } /* end lcase_string() */
-
-
-INT32
-Mini_go_forever()
-{
- static int complete=0;
-
- /* Terminal control initialization. */
- io_config.io_control = TERM_USER; /* 3.1-7 */
- io_config.target_running = TRUE;
-
-#ifndef MSDOS
- ioctl (fileno(stdin), TCGETA, &OldTermbuf); /* Initial settings */
-#endif
-
- /* Install ctrl-C handler */
-
- if (signal (SIGINT, Mini_Ctrl_C_Handler) == SIG_ERR) {
- fprintf(stderr, "Ctrl-C handler not installed.\n"); /* warning */
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "Ctrl-C handler not installed.\n"); /* warning */
- }
- /*
- ** Open cmd file (if necessary)
- */
-
- if (io_config.cmd_file_io == TRUE) { /* TRUE if -c option given */
- io_config.cmd_file = fopen(io_config.cmd_filename, "r");
- if (io_config.cmd_file == NULL) {
- warning (EMCMDOPEN);
- io_config.cmd_file_io = FALSE;
- } else {
- /* MON_STDIN is command file */
- MON_STDIN = fileno(io_config.cmd_file); /* set MON_STDIN */
- };
- }
-
- Mini_go(); /* set target running */
-
- do {
-
- /*
- ** If the target was set to run, get its current status.
- */
- if (Mini_get_target_stats((INT32) udi_waittime, &ProcessorState) != SUCCESS) {
- Mini_TIP_DestroyProc();
- Mini_TIP_exit();
- fatal_error(EMFATAL);
- }
- GrossState = (int) (ProcessorState & 0xFF);
- switch (GrossState) {
- case NOTEXECUTING: /* do nothing */
- io_config.io_control = TERM_USER;
- io_config.target_running = FALSE;
- break;
- case EXITED: /* do nothing */
- if (!QuietMode) {
- fprintf (stderr, "Process exited with 0x%lx\n",
- (ProcessorState >> 8));
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "Process exited with 0x%lx\n",
- (ProcessorState >> 8));
- }
- io_config.io_control = TERM_USER;
- io_config.target_running = FALSE;
- complete=1;
- break;
- case RUNNING: /* any request from target? */
- break;
- case STOPPED:
- complete=1;
- io_config.io_control = TERM_USER;
- io_config.target_running = FALSE;
- fprintf(stderr, "Execution stopped at ");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "Execution stopped at ");
- display_msg();
- break;
- case BREAK:
- complete=1;
- io_config.io_control = TERM_USER;
- io_config.target_running = FALSE;
- fprintf(stderr, "Breakpoint hit at ");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "Breakpoint hit at ");
- display_msg();
- break;
- case STEPPED:
- complete=1;
- io_config.io_control = TERM_USER;
- io_config.target_running = FALSE;
- fprintf(stderr, "Stepping...Execution stopped at ");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "Stepping...Execution stopped at ");
- display_msg();
- break;
- case WAITING:
- complete=1;
- io_config.io_control = TERM_USER;
- io_config.target_running = FALSE;
- break;
- case HALTED:
- complete=1;
- io_config.io_control = TERM_USER;
- io_config.target_running = FALSE;
- fprintf(stderr, "Execution halted at ");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "Execution halted at ");
- display_msg();
- break;
- case WARNED:
- complete=1;
- io_config.io_control = TERM_USER;
- io_config.target_running = FALSE;
- break;
- case TRAPPED:
- complete=1;
- io_config.io_control = TERM_USER;
- io_config.target_running = FALSE;
- PrintTrapMsg((int) (ProcessorState >> 8));
- display_msg();
- break;
- case STDOUT_READY:
- io_bufsize = 0;
- io_count_done = (INT32) 0;
- do {
- Mini_get_stdout(io_buffer, IO_BUFSIZE, &io_count_done);
- write(MON_STDOUT, &io_buffer[0], (int) io_count_done);
- if (io_config.echo_mode == (INT32) TRUE) {
- fflush (io_config.echo_file);
- write (fileno(io_config.echo_file), &io_buffer[0], (int) io_count_done);
- }
- } while (io_count_done == (INT32) IO_BUFSIZE);
- break;
- case STDERR_READY:
- io_bufsize = 0;
- io_count_done = (INT32) 0;
- do {
- Mini_get_stderr(io_buffer, IO_BUFSIZE, &io_count_done);
- write(MON_STDERR, &io_buffer[0], (int) io_count_done);
- if (io_config.echo_mode == (INT32) TRUE) {
- fflush (io_config.echo_file);
- write (fileno(io_config.echo_file), &io_buffer[0], (int) io_count_done);
- }
- } while (io_count_done == (INT32) IO_BUFSIZE);
- break;
- case STDIN_NEEDED:
- /* Line buffered reads only */
- if (io_config.cmd_file_io == TRUE) { /* read from command file */
- if (Mini_cmdfile_input(io_buffer, IO_BUFSIZE) == SUCCESS) {
- io_bufsize = strlen(io_buffer);
- fprintf(stderr, "%s", io_buffer); /* echo */
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "%s", io_buffer); /* echo */
- } else { /* read from terminal */
- io_bufsize = read( fileno(stdin), io_buffer, IO_BUFSIZE );
- }
- } else {
- io_bufsize = read( fileno(stdin), io_buffer, IO_BUFSIZE );
- };
- if (io_bufsize < 0)
- {
- fprintf(stderr, "fatal error reading from stdin\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "fatal error reading from stdin\n");
- }
- if (io_config.echo_mode == (INT32) TRUE) {
- fflush (io_config.echo_file);
- write (fileno(io_config.echo_file), &io_buffer[0], (int) io_bufsize);
- }
- Mini_put_stdin(io_buffer, io_bufsize, &io_count_done);
- break;
- case STDINMODEX:
- /* call TIP to get StdinMode */
- Mini_stdin_mode_x((INT32 *)&TipStdinMode);
- if (TipStdinMode & TIP_NBLOCK)
- io_config.io_control = TERM_29K;
- else if (TipStdinMode & TIP_ASYNC)
- io_config.io_control = TERM_29K;
- else if (TipStdinMode == TIP_COOKED)
- io_config.io_control = TERM_USER;
- else {
- fprintf(stderr, "DFEWARNING: TIP Requested Stdin Mode Not Supported.\n");
- fprintf(stderr, "DFEWARNING: Using default mode.\n");
- TipStdinMode = TIP_COOKED;
- io_config.io_control = TERM_USER;
- }
- if (io_config.io_control == TERM_29K)
- display_term29k();
- break;
-
- default:
- complete=1;
- io_config.io_control = TERM_USER;
- io_config.target_running = FALSE;
- break;
- }; /* end switch */
-#ifdef MSDOS
- if (!complete)
- kbhit(); /* Poll for Ctrl-C */
-#endif
- if (CtrlCHit) {
- CtrlCHit = 0;
- complete = 1;
- }
-
- if (io_config.io_control == TERM_29K)
- if (GrossState == RUNNING)
- Mini_poll_channel0(); /* non-blocking */
- else
- TipStdinMode = TIP_COOKED;
-
- } while (!complete);
-#ifndef MSDOS
- ioctl (fileno(stdin), TCSETA, &OldTermbuf); /*reset settings */
-#endif
-
- fflush(stdout);
- fflush(stderr);
-
- Mini_TIP_DestroyProc();
- Mini_TIP_exit();
-
- NumberOfConnections=0;
- return (SUCCESS);
-}
-
-
-INT32
-get_pc_addrs(pc1, cps)
-ADDR32 *pc1;
-ADDR32 *cps;
-{
- ADDR32 pc_1;
- ADDR32 cps_b;
- INT32 hostendian;
- INT32 bytes_ret;
- INT32 retval;
-
- hostendian = FALSE;
- if ((retval = Mini_read_req (PC_SPACE,
- (ADDR32) 0, /* doesn't matter */
- (INT32) 1,
- (INT16) 4, /* size */
- &bytes_ret,
- (BYTE *) &pc_1,
- hostendian)) != SUCCESS) {
- return(FAILURE);
- };
-
- *pc1 = (ADDR32) pc_1;
- if (host_config.host_endian != host_config.target_endian) {
- convert32((BYTE *)pc1);
- }
-
- /* get cps */
- hostendian = FALSE;
- if ((retval = Mini_read_req (SPECIAL_REG,
- (ADDR32) 2,
- (INT32) 1,
- (INT16) 4, /* size */
- &bytes_ret,
- (BYTE *) &cps_b,
- hostendian)) != SUCCESS) {
- return(FAILURE);
- };
- *cps = (ADDR32) cps_b;
- if (host_config.host_endian != host_config.target_endian) {
- convert32((BYTE *)cps);
- }
-
- return (SUCCESS);
-}
-
-INT32
-get_pc1_inst(cps, pc1, inst)
-ADDR32 cps;
-ADDR32 pc1;
-BYTE *inst;
-{
- INT32 bytes_ret;
- INT32 hostendian;
- INT32 retval;
- INT32 memory_space;
-
- hostendian = FALSE;
-
- if (cps & 0x100L) /* RE bit */
- memory_space = I_ROM;
- else
- memory_space = I_MEM;
-
- if ((retval = Mini_read_req(memory_space,
- pc1,
- (INT32) 1,
- (INT16) sizeof(INST32), /* size */
- &bytes_ret,
- (BYTE *) inst,
- hostendian)) != SUCCESS) {
- return(FAILURE);
- };
- return (SUCCESS);
-}
-
-void
-display_msg()
-{
- ADDR32 c_pc1;
- ADDR32 c_cps;
-
- union instruction_t {
- BYTE buf[sizeof(struct instr_t)];
- struct instr_t instr;
- };
- union instruction_t instruction;
- struct instr_t temp;
-
- (void) get_pc_addrs(&c_pc1, &c_cps);
- (void) get_pc1_inst(c_cps, c_pc1, instruction.buf);
- fprintf(stderr, " %08lx\n", c_pc1);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, " %08lx\n", c_pc1);
- if (host_config.target_endian == LITTLE) {
- temp.op = instruction.instr.b;
- temp.c = instruction.instr.a;
- temp.a = instruction.instr.c;
- temp.b = instruction.instr.op;
- } else { /* default BIG endian */
- temp.op = instruction.instr.op;
- temp.c = instruction.instr.c;
- temp.a = instruction.instr.a;
- temp.b = instruction.instr.b;
- }
- fprintf(stderr, "%08lx\t %02x%02x%02x%02x\t", c_pc1,
- temp.op,
- temp.c,
- temp.a,
- temp.b);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "%08lx\t %02x%02x%02x%02x\t", c_pc1,
- temp.op,
- temp.c,
- temp.a,
- temp.b);
- (void) dasm_instr(c_pc1, &(temp));
- if (io_config.io_control == TERM_USER) {
- fprintf(stderr, "\n%s>", ProgramName);
- fflush(stderr);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n%s>", ProgramName);
- }
-}
-
-int
-Mini_cmdfile_input(cmd_buffer, size)
-char *cmd_buffer;
-int size;
-{
- if (fgets(cmd_buffer, size, io_config.cmd_file) == NULL) {
- io_config.cmd_file_io = FALSE;
- (void) fclose(io_config.cmd_file);
- MON_STDIN = fileno (stdin); /* reset to terminal after EOF */
- return (FAILURE);
- } else {
- return (SUCCESS);
- }
-}
-
-void
-Mini_Ctrl_C_Handler(num)
-int num;
-{
- CtrlCHit = 1; /* used for run-only mode, no debugging */
- if (io_config.io_control == TERM_29K) {
-#ifndef MSDOS
- ioctl (fileno(stdin), TCSETA, &OldTermbuf); /*reset settings */
-#endif
- }
- if (io_config.target_running == TRUE)
- Mini_break();
- io_config.cmd_ready == FALSE;
-#ifdef MSDOS
- if (signal (SIGINT, Mini_Ctrl_C_Handler) == SIG_ERR) {
- fprintf(stderr, "Ctrl-C handler not installed.\n"); /* warning */
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "Ctrl-C handler not installed.\n"); /* warning */
- }
-#endif
- return;
-}
-
-static int
-FindCmdIndx(CmdString)
-char *CmdString;
-{
- int i;
-
- i = 0;
- while (MonitorCommands[i].CmdString) {
- if (strcmp(CmdString, MonitorCommands[i].CmdString))
- i++;
- else
- return (i);
- };
- return (-1);
-}
-
-INT32
-escape_cmd(token, tokencnt)
-char **token;
-int tokencnt;
-{
- int retval;
-#ifdef MSDOS
- if ((retval = system ((char *) getenv("COMSPEC"))) != 0)
- return ((INT32) EMDOSERR);
- return ((INT32) SUCCESS);
-#else
- if ((retval = system ((char *) getenv("SHELL"))) != 0)
- return ((INT32) EMSYSERR);
- return ((INT32) SUCCESS);
-#endif
-}
-
-INT32
-dummy_cmd(token, tokencnt)
-char **token;
-int tokencnt;
-{
- return ((INT32) 0);
-}
-
-INT32
-quit_cmd(token, tokencnt)
-char **token;
-int tokencnt;
-{
- int i;
-
- for (i =0; i < NumberOfConnections; i++) {
- Mini_TIP_SetCurrSession(Session_ids[i]);
- Mini_TIP_DestroyProc();
- Mini_TIP_exit();
- };
- fflush(stdout);
- fflush(stderr);
- exit_loop = TRUE;
- NumberOfConnections=0;
- return ((INT32) 0);
-}
-
-INT32
-connect_cmd(token, tokencnt)
-char **token;
-int tokencnt;
-{
- INT32 retval;
-
- if (tokencnt < 2)
- return (EMSYNTAX);
-
- if ((retval = Mini_TIP_init(token[1], &Session_ids[NumberOfConnections]))
- == SUCCESS) {
- NumberOfConnections=NumberOfConnections+1;
- };
-
- return ((INT32) retval);
-}
-
-INT32
-disconnect_cmd(token, tokencnt)
-char **token;
-int tokencnt;
-{
- INT32 retval;
- int i;
-
- if ((retval = Mini_TIP_disc()) != SUCCESS)
- return ((INT32) retval);
- else { /* find some other session */
- NumberOfConnections=NumberOfConnections - 1;
- for (i = 0; i < NumberOfConnections; i++) {
- if ((retval = Mini_TIP_SetCurrSession(Session_ids[i])) == SUCCESS)
- return (retval);
- }
- if (i >= NumberOfConnections) { /* exit DFE */
- exit_loop = TRUE;
- }
- }
-
- return ((INT32) retval);
-}
-
-INT32
-create_proc_cmd(token, tokencnt)
-char **token;
-int tokencnt;
-{
- INT32 retval;
-
- retval = Mini_TIP_CreateProc();
-
- return ((INT32) retval);
-}
-
-INT32
-capab_cmd(token, tokencnt)
-char **token;
-int tokencnt;
-{
- INT32 retval;
-
- retval = Mini_TIP_Capabilities();
-
- return ((INT32) retval);
-}
-
-INT32
-exit_conn_cmd(token, tokencnt)
-char **token;
-int tokencnt;
-{
- INT32 retval;
- int i;
-
- if ((retval = Mini_TIP_exit()) != SUCCESS) {;
- return (retval);
- } else { /* find some other session */
- NumberOfConnections=NumberOfConnections - 1;
- for (i = 0; i < NumberOfConnections; i++) {
- if ((retval = Mini_TIP_SetCurrSession(Session_ids[i])) == SUCCESS)
- return (retval);
- }
- if (i >= NumberOfConnections) { /* exit DFE */
- exit_loop = TRUE;
- }
- }
-
-
- return ((INT32) retval);
-}
-
-INT32
-init_proc_cmd(token, tokencnt)
-char **token;
-int tokencnt;
-{
- INT32 retval;
-
- retval = Mini_send_init_info(&init_info);
-
- return ((INT32) retval);
-}
-
-INT32
-destroy_proc_cmd(token, tokencnt)
-char **token;
-int tokencnt;
-{
- INT32 retval;
-
- retval = Mini_TIP_DestroyProc();
-
- return ((INT32) retval);
-}
-
-INT32
-set_sessionid_cmd(token, tokencnt)
-char **token;
-int tokencnt;
-{
- INT32 retval;
- int sid;
-
- if (tokencnt < 2)
- return (EMSYNTAX);
-
- if (sscanf(token[1],"%d",&sid) != 1)
- return (EMSYNTAX);
-
- retval = Mini_TIP_SetCurrSession(sid);
-
- return ((INT32) retval);
-}
-
-INT32
-set_pid_cmd(token, tokencnt)
-char **token;
-int tokencnt;
-{
- INT32 retval;
- int pid;
-
- if (tokencnt < 2)
- return (EMSYNTAX);
-
- if (sscanf(token[1],"%d",&pid) != 1)
- return (EMSYNTAX);
-
- retval = Mini_TIP_SetPID(pid);
-
- return ((INT32) retval);
-}
-
-
-INT32
-go_cmd(token, token_count)
- char *token[];
- int token_count;
- {
-
- INT32 retval;
-
- if ((retval = Mini_go()) != SUCCESS) {
- return(FAILURE);
- } else {
- GoCmdFlag = 1;
- BlockMode = NONBLOCK;
- if (TipStdinMode & TIP_NBLOCK)
- io_config.io_control = TERM_29K;
- else if (TipStdinMode & TIP_ASYNC)
- io_config.io_control = TERM_29K;
- else if (TipStdinMode == TIP_COOKED)
- io_config.io_control = TERM_USER;
- else {
- TipStdinMode = TIP_COOKED;
- io_config.io_control = TERM_USER;
- }
- io_config.target_running = TRUE;
- return(SUCCESS);
- };
-
-} /* end go_cmd() */
-
-/*
-** This command is used to "trace" or step through code.
-** A "t" command with no parameters defaults to a single.
-** step. A "t" command with an integer value following
-** steps for as many instructions as is specified by
-** that integer.
-*/
-
-INT32
-trace_cmd(token, token_count)
- char *token[];
- int token_count;
- {
- int result;
- INT32 count;
- INT32 retval;
-
- if (token_count == 1) {
- count = 1;
- }
- else
- if (token_count >= 2) {
- result = get_word(token[1], &count);
- if (result != 0)
- return (EMSYNTAX);
- }
-
- if ((retval = Mini_step(count)) != SUCCESS) {
- return(FAILURE);
- } else {
- GoCmdFlag = 1;
- BlockMode = NONBLOCK;
- if (TipStdinMode & TIP_NBLOCK)
- io_config.io_control = TERM_29K;
- else if (TipStdinMode & TIP_ASYNC)
- io_config.io_control = TERM_29K;
- else if (TipStdinMode == TIP_COOKED)
- io_config.io_control = TERM_USER;
- else {
- TipStdinMode = TIP_COOKED;
- io_config.io_control = TERM_USER;
- }
- io_config.target_running = TRUE;
- return(SUCCESS);
- }
-
- } /* end trace_cmd() */
-
-/*
- * The "ch0" command is used to send characters (input) to the application
- * program asynchronously. This command deinstalls the control-C handler,
- * sets up input to raw mode, polls the keyboard, sends the bytes to the
- * TIP. The command is exited when Ctrl-U is typed.
- */
-
-INT32
-channel0_cmd(token, token_count)
- char *token[];
- int token_count;
-{
- io_config.io_control = TERM_29K;
-#ifndef MSDOS
- ioctl (fileno(stdin), TCGETA, &NewTermbuf); /* New settings */
- NewTermbuf.c_lflag &= ~(ICANON);
- NewTermbuf.c_cc[4] = 0; /* MIN */
- NewTermbuf.c_cc[5] = 0; /* TIME */
- ioctl (fileno(stdin), TCSETA, &NewTermbuf); /* Set new settings */
-#endif
- return (0);
-}
-
-/*
- * Only for stdin, not for command file input
- */
-INT32
-Mini_poll_channel0()
-{
- BYTE ch;
-
- /* read from terminal */
-#ifdef MSDOS
- /* CBREAK mode */
- if (kbhit()) {
- ch = (unsigned char) getche();
- if (io_config.echo_mode == (INT32) TRUE) {
- putc (ch, io_config.echo_file);
- fflush (io_config.echo_file);
- }
- if (ch == (BYTE) TOGGLE_CHAR) { /* Ctrl-U typed, give control back to User */
- io_config.io_control = TERM_USER;
- display_termuser();
- return (0);
- } else {
- if (ch == (unsigned char) 13) { /* \r, insert \n */
- putchar(10); /* line feed */
- if (io_config.echo_mode == (INT32) TRUE) {
- putc (ch, io_config.echo_file);
- fflush (io_config.echo_file);
- }
- }
-#ifdef MSDOS
- if (ch == (unsigned char) 10) { /* \n, ignore \n */
- return (0);
- }
-#endif
- Mini_put_stdin((char *)&ch, 1, &io_count_done);
- return (0);
- }
- }
- return(0);
-#else /* Unix */
- /*
- * Set STDIN to CBREAK mode. For each character read() send it
- * to TIP using Mini_put_stdin(). This is done only if the
- * terminal is controlled by the 29K Target System, i.e. when
- * io_config.io_control == TERM_29K. Otherwise, this function should
- * not be called as it would affect the command-line processing.
- */
- /* while ((io_bufsize = read (fileno(stdin), &ch, 1)) == 1) { */
- if ((io_bufsize = read (fileno(stdin), &ch, 1)) == 1) {
- if (io_config.echo_mode == (INT32) TRUE) {
- putc (ch, io_config.echo_file);
- fflush (io_config.echo_file);
- }
- if (ch == (BYTE) TOGGLE_CHAR) { /* process ctrl-U */
- ioctl (fileno(stdin), TCSETA, &OldTermbuf); /* reset old settings */
- io_config.io_control = TERM_USER;
- display_termuser();
- return (0);
- } else { /* send it to TIP */
- Mini_put_stdin((char *)&ch, 1, &io_count_done);
- }
- }
- return (0);
-#endif
-} /* end Mini_poll_channel0() */
-
-void
-PrintTrapMsg(num)
-int num;
-{
- if ((num >= 0) && (num <= 22)) {
- fprintf(stderr, "%s Trap occurred at ", TrapMsg[num]);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "%s Trap occurred at ", TrapMsg[num]);
- } else {
- fprintf(stderr, "Trap %d occurred at ");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "Trap %d occurred at ");
- }
-}
-
-void
-display_term29k()
-{
- fprintf(stderr,"\nTerminal controlled 29K target...Type Ctrl-U <ret> for mondfe prompt\n");
- fflush (stderr);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(stderr,"\nTerminal controlled 29K target...Type Ctrl-U <ret> for mondfe prompt\n");
-#ifndef MSDOS
- ioctl (fileno(stdin), TCGETA, &NewTermbuf); /* New settings */
- NewTermbuf.c_lflag &= ~(ICANON);
- NewTermbuf.c_cc[4] = 0; /* MIN */
- NewTermbuf.c_cc[5] = 0; /* TIME */
- ioctl (fileno(stdin), TCSETA, &NewTermbuf); /* Set new settings */
-#endif
-}
-
-void
-display_termuser()
-{
-#ifndef MSDOS
- ioctl (fileno(stdin), TCSETA, &OldTermbuf); /*reset settings */
-#endif
- /* Print a prompt */
- fprintf(stderr, "\n%s>", ProgramName);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n%s>", ProgramName);
-}
-
-INT32
-quietmode_off(token, token_count)
- char *token[];
- int token_count;
-{
- QuietMode = 0;
- return (0);
-}
-
-INT32
-quietmode_on(token, token_count)
- char *token[];
- int token_count;
-{
- QuietMode = 1;
- return (0);
-}
-
-INT32
-logoff_cmd(token, token_count)
- char *token[];
- int token_count;
-{
- if (io_config.log_mode == (INT32) TRUE) {
- io_config.log_mode = (INT32) FALSE;
- (void) fclose(io_config.log_file);
- }
- return (0);
-}
-
-INT32
-logon_cmd(token, token_count)
- char *token[];
- int token_count;
-{
- if (io_config.log_mode == (INT32) FALSE) {
- if (strcmp(io_config.log_filename, "\0") != 0) {/* valid file */
- io_config.log_mode = (INT32) TRUE;
- if ((io_config.log_file = fopen(io_config.log_filename, "a")) == NULL)
- {
- io_config.log_mode = (INT32) FALSE;
- warning(EMLOGOPEN);
- };
- } else {
- warning(EMLOGOPEN);
- }
- }
- return (0);
-}
-
-INT32
-set_logfile(token, token_count)
- char *token[];
- int token_count;
-{
- if (token_count < 2) /* insufficient number of args */
- return (EMSYNTAX);
-
- (void) strcpy ((char *)(&(io_config.log_filename[0])),token[1]);
-
- if (io_config.log_mode == (INT32) TRUE) { /* replace log file used */
- if ((io_config.log_file =
- fopen (io_config.log_filename, "w")) == NULL) {
- warning (EMLOGOPEN);
- io_config.log_mode = (INT32) FALSE;
- }
- } else {
- io_config.log_mode = (INT32) TRUE;
- if ((io_config.log_file =
- fopen (io_config.log_filename, "w")) == NULL) {
- warning (EMLOGOPEN);
- io_config.log_mode = (INT32) FALSE;
- }
- }
- return (0);
-
-}
-
-INT32
-echomode_on(token, token_count)
- char *token[];
- int token_count;
-{
- if (io_config.echo_mode == (INT32) FALSE) {
- if (strcmp(io_config.echo_filename, "\0") != 0) { /* if valid file in effect */
- io_config.echo_mode = (INT32) TRUE;
- if ((io_config.echo_file = fopen (io_config.echo_filename, "a")) == NULL)
- {
- warning (EMECHOPEN);
- io_config.echo_mode = (INT32) FALSE;
- }
- } else
- warning(EMINVECHOFILE);
- }
- return (0);
-}
-
-INT32
-echomode_off(token, token_count)
- char *token[];
- int token_count;
-{
- if (io_config.echo_mode == (INT32) TRUE) {
- io_config.echo_mode = (INT32) FALSE;
- (void) fclose(io_config.echo_file);
- }
- return (0);
-}
-
-INT32
-echofile_cmd(token, token_count)
- char *token[];
- int token_count;
-{
- if (token_count < 2) /* insufficient number of args */
- return (EMSYNTAX);
-
- (void) strcpy ((char *)(&(io_config.echo_filename[0])),token[1]);
-
- if (io_config.echo_mode == (INT32) TRUE) { /* replace echo file used */
- if ((io_config.echo_file =
- fopen (io_config.echo_filename, "w")) == NULL) {
- warning (EMECHOPEN);
- io_config.echo_mode = (INT32) FALSE;
- }
- } else {
- io_config.echo_mode = (INT32) TRUE;
- if ((io_config.echo_file =
- fopen (io_config.echo_filename, "w")) == NULL) {
- warning (EMECHOPEN);
- io_config.echo_mode = (INT32) FALSE;
- }
- }
- return (0);
-}
-
-INT32
-cmdfile_cmd(token, token_count)
- char *token[];
- int token_count;
-{
- if (token_count < 2)
- return (EMSYNTAX);
-
- (void) strcpy((char *)(&(io_config.cmd_filename[0])),token[1]);
-
- if (io_config.cmd_file_io == (INT32) TRUE) {
- warning (EMCMDFILENEST); /* command file nesting not allowed */
- } else {
- io_config.cmd_file_io = (INT32) TRUE;
- if ((io_config.cmd_file = fopen (io_config.cmd_filename,"r")) == NULL) {
- warning (EMCMDOPEN);
- io_config.cmd_file_io = (INT32) FALSE;
- } else {
- /* MON_STDIN is command file */
- MON_STDIN = fileno(io_config.cmd_file); /* set MON_STDIN */
- }
- }
-
- return (0);
-}
-
-INT32
-tip_cmd(token, token_count)
- char *token[];
- int token_count;
-{
- if (token_count < 2)
- return (EMSYNTAX);
-
- sprintf(tip_cmd_buffer, "%s %s\0", token[0], token[1]);
-
- Mini_put_trans(tip_cmd_buffer);
-
- return (0);
-}
+++ /dev/null
-static char _[] = "@(#)move.c 5.20 93/07/30 16:38:55, Srini, AMD.";
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- ** This code provides "move" routines to copy blocks of memory.
- ** Data may be moved as words (32 bit), half-words (16 bit),
- ** bytes (8 bit), float (32 bit floating point) or double
- ** (64 bit floating point).
- **
- ** Registers moves are not permitted.
- *****************************************************************************
- */
-
-#include <stdio.h>
-#include <ctype.h>
-#include <memory.h>
-#include "main.h"
-#include "memspcs.h"
-#include "miniint.h"
-#include "macros.h"
-#include "error.h"
-
-
-#ifdef MSDOS
-#include <stdlib.h>
-#include <string.h>
-#else
-#include <string.h>
-
-#endif
-
-
-int get_addr_29k PARAMS((char *, struct addr_29k_t *));
-int addr_29k_ok PARAMS((struct addr_29k_t *));
-
-int get_word PARAMS((char *, INT32 *));
-
-int set_data PARAMS((BYTE *, BYTE *, int));
-
-/*
-** The function below is used in moving data. This function is
-** called in the main command loop parser of the monitor. The
-** parameters passed to this function are:
-**
-** token - This is an array of pointers to strings. Each string
-** referenced by this array is a "token" of the user's
-** input, translated to lower case.
-**
-** token_count - This is the number of items in the token array.
-**
-** This function reduces the tokens to three parameters:
-** the start address and the end address of the move and the
-** target address of the move.
-**
-*/
-
-
-INT32
-move_cmd(token, token_count)
- char *token[];
- int token_count;
- {
- int result;
- INT32 byte_count;
- struct addr_29k_t addr_29k_start;
- struct addr_29k_t addr_29k_end;
- struct addr_29k_t addr_29k_dest;
- struct addr_29k_t temp_addr_29k;
-
- INT32 retval;
- INT32 direction;
-
- if ((strcmp(token[0], "m") != 0) ||
- (token_count != 4))
- return (EMSYNTAX);
-
- /*
- ** Get addresses
- */
-
- result = get_addr_29k(token[1], &addr_29k_start);
- if (result != 0)
- return (result);
- result = addr_29k_ok(&addr_29k_start);
- if (result != 0)
- return (result);
-
- result = get_addr_29k(token[2], &addr_29k_end);
- if (result != 0)
- return (result);
- result = addr_29k_ok(&addr_29k_end);
- if (result != 0)
- return (result);
-
- result = get_addr_29k(token[3], &addr_29k_dest);
- if (result != 0)
- return (result);
- result = addr_29k_ok(&addr_29k_dest);
- if (result != 0)
- return (result);
-
- /* End address must be not be less than start address */
- if (addr_29k_start.address > addr_29k_end.address)
- return (EMSYNTAX);
-
- byte_count = (addr_29k_end.address - addr_29k_start.address) + 1;
-
- /* Dest range must be in valid memory */
- temp_addr_29k.memory_space = addr_29k_dest.memory_space;
- /* For memory to register, divide byte count by 4 */
- if ((ISMEM(addr_29k_start.memory_space)) &&
- (ISREG(addr_29k_dest.memory_space)))
- temp_addr_29k.address = addr_29k_dest.address + (byte_count / 4);
- else
- /* For register to memory, multiply byte count by 4 */
- if ((ISREG(addr_29k_start.memory_space)) &&
- (ISMEM(addr_29k_dest.memory_space)))
- temp_addr_29k.address = addr_29k_dest.address + (byte_count * 4);
- else
- temp_addr_29k.address = addr_29k_dest.address + byte_count;
- result = addr_29k_ok(&temp_addr_29k);
- if (result != 0)
- return (EMCOPY);
-
- /* Registers are four bytes */
- if (ISREG(addr_29k_start.memory_space))
- byte_count = (byte_count * 4);
-
- /* Do copy */
-
- direction = TRUE; /* SRINI front to back or back to front */
- if ((retval = Mini_copy (addr_29k_start.memory_space,
- addr_29k_start.address,
- addr_29k_dest.memory_space,
- addr_29k_dest.address,
- byte_count,
- (INT16) 1, /* size */
- direction)) != SUCCESS) {
- return(FAILURE);
- } else
- return(SUCCESS);
-
- } /* end move_cmd() */
-
-
-
+++ /dev/null
-static char _[] = "@(#)opcodes.c 5.21 93/08/10 17:46:46,Srini, AMD.";
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- ** This file contains a data structure which gives the ASCII
- ** string associated with each Am29000 opcode. These strings
- ** are all in lower case. The string associated with illegal
- ** opcodes are null (""). Opcodes are sorted in numerical
- ** order.
- **
- *****************************************************************************
- */
-char *opcode_name[] =
- {
-
- /* Opcodes 0x00 to 0x0F */
- "", "constn ", "consth ", "const ",
- "mtsrim ", "consthz ", "loadl ", "loadl ",
- "clz ", "clz ", "exbyte ", "exbyte ",
- "inbyte ", "inbyte ", "storel ", "storel ",
-
- /* Opcodes 0x10 to 0x1F */
- "adds ", "adds ", "addu ", "addu ",
- "add ", "add ", "load ", "load ",
- "addcs ", "addcs ", "addcu ", "addcu ",
- "addc ", "addc ", "store ", "store ",
-
- /* Opcodes 0x20 to 0x2F */
- "subs ", "subs ", "subu ", "subu ",
- "sub ", "sub ", "loadset ", "loadset ",
- "subcs ", "subcs ", "subcu ", "subcu ",
- "subc ", "subc ", "cpbyte ", "cpbyte ",
-
- /* Opcodes 0x30 to 0x3F */
- "subrs ", "subrs ", "subru ", "subru ",
- "subr ", "subr ", "loadm ", "loadm ",
- "subrcs ", "subrcs ", "subrcu ", "subrcu ",
- "subrc ", "subrc ", "storem ", "storem ",
-
- /* Opcodes 0x40 to 0x4F */
- "cplt ", "cplt ", "cpltu ", "cpltu ",
- "cple ", "cple ", "cpleu ", "cpleu ",
- "cpgt ", "cpgt ", "cpgtu ", "cpgtu ",
- "cpge ", "cpge ", "cpgeu ", "cpgeu ",
-
- /* Opcodes 0x50 to 0x5F */
- "aslt ", "aslt ", "asltu ", "asltu ",
- "asle ", "asle ", "asleu ", "asleu ",
- "asgt ", "asgt ", "asgtu ", "asgtu ",
- "asge ", "asge ", "asgeu ", "asgeu ",
-
- /* Opcodes 0x60 to 0x6F */
- "cpeq ", "cpeq ", "cpneq ", "cpneq ",
- "mul ", "mul ", "mull ", "mull ",
- "div0 ", "div0 ", "div ", "div ",
- "divl ", "divl ", "divrem ", "divrem ",
-
- /* Opcodes 0x70 to 0x7F */
- "aseq ", "aseq ", "asneq ", "asneq ",
- "mulu ", "mulu ", "", "",
- "inhw ", "inhw ", "extract ", "extract ",
- "exhw ", "exhw ", "exhws ", "",
-
- /* Opcodes 0x80 to 0x8F */
- "sll ", "sll ", "srl ", "srl ",
- "", "", "sra ", "sra ",
- "iret ", "halt ", "", "",
- "iretinv ", "", "", "",
-
- /* Opcodes 0x90 to 0x9F */
- "and ", "and ", "or ", "or ",
- "xor ", "xor ", "xnor ", "xnor ",
- "nor ", "nor ", "nand ", "nand ",
- "andn ", "andn ", "setip ", "inv ",
-
- /* Opcodes 0xA0 to 0xAF */
- "jmp ", "jmp ", "", "",
- "jmpf ", "jmpf ", "", "",
- "call ", "call ", "orn ", "orn ",
- "jmpt ", "jmpt ", "", "",
-
- /* Opcodes 0xB0 to 0xBF */
- "", "", "", "",
- "jmpfdec ", "jmpfdec ", "mftlb ", "",
- "", "", "", "",
- "", "", "mttlb ", "",
-
- /* Opcodes 0xC0 to 0xCF */
- "jmpi ", "", "", "",
- "jmpfi ", "", "mfsr ", "",
- "calli ", "", "", "",
- "jmpti ", "", "mtsr ", "",
-
- /* Opcodes 0xD0 to 0xDF */
- "", "", "", "",
- "", "", "", "emulate ",
- "", "", "", "",
- "", "", "multm ", "multmu ",
-
- /* Opcodes 0xE0 to 0xEF */
- "multiply", "divide ", "multiplu", "dividu ",
- "convert ", "sqrt ", "class ", "",
- "", "", "feq ", "deq ",
- "fgt ", "dgt ", "fge ", "dge ",
-
- /* Opcodes 0xF0 to 0xFF */
- "fadd ", "dadd ", "fsub ", "dsub ",
- "fmul ", "dmul ", "fdiv ", "ddiv ",
- "", "fdmul ", "", "",
- "", "", "", ""
- };
-
-
+++ /dev/null
-static char _[] = "@(#)regs.c 5.20 93/07/30 16:38:58, Srini, AMD.";
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- ** This file contains arrays of ASCII strings which represent
- ** the register names for the the Am29000 processor.
- *****************************************************************************
- */
-
-char *reg[] = {
- "gr0", "gr1", "gr2", "gr3",
- "gr4", "gr5", "gr6", "gr7",
- "gr8", "gr9", "gr10", "gr11",
- "gr12", "gr13", "gr14", "gr15",
- "gr16", "gr17", "gr18", "gr19",
- "gr20", "gr21", "gr22", "gr23",
- "gr24", "gr25", "gr26", "gr27",
- "gr28", "gr29", "gr30", "gr31",
- "gr32", "gr33", "gr34", "gr35",
- "gr36", "gr37", "gr38", "gr39",
- "gr40", "gr41", "gr42", "gr43",
- "gr44", "gr45", "gr46", "gr47",
- "gr48", "gr49", "gr50", "gr51",
- "gr52", "gr53", "gr54", "gr55",
- "gr56", "gr57", "gr58", "gr59",
- "gr60", "gr61", "gr62", "gr63",
- "gr64", "gr65", "gr66", "gr67",
- "gr68", "gr69", "gr70", "gr71",
- "gr72", "gr73", "gr74", "gr75",
- "gr76", "gr77", "gr78", "gr79",
- "gr80", "gr81", "gr82", "gr83",
- "gr84", "gr85", "gr86", "gr87",
- "gr88", "gr89", "gr90", "gr91",
- "gr92", "gr93", "gr94", "gr95",
- "gr96", "gr97", "gr98", "gr99",
- "gr100", "gr101", "gr102", "gr103",
- "gr104", "gr105", "gr106", "gr107",
- "gr108", "gr109", "gr110", "gr111",
- "gr112", "gr113", "gr114", "gr115",
- "gr116", "gr117", "gr118", "gr119",
- "gr120", "gr121", "gr122", "gr123",
- "gr124", "gr125", "gr126", "gr127",
- "lr0", "lr1", "lr2", "lr3",
- "lr4", "lr5", "lr6", "lr7",
- "lr8", "lr9", "lr10", "lr11",
- "lr12", "lr13", "lr14", "lr15",
- "lr16", "lr17", "lr18", "lr19",
- "lr20", "lr21", "lr22", "lr23",
- "lr24", "lr25", "lr26", "lr27",
- "lr28", "lr29", "lr30", "lr31",
- "lr32", "lr33", "lr34", "lr35",
- "lr36", "lr37", "lr38", "lr39",
- "lr40", "lr41", "lr42", "lr43",
- "lr44", "lr45", "lr46", "lr47",
- "lr48", "lr49", "lr50", "lr51",
- "lr52", "lr53", "lr54", "lr55",
- "lr56", "lr57", "lr58", "lr59",
- "lr60", "lr61", "lr62", "lr63",
- "lr64", "lr65", "lr66", "lr67",
- "lr68", "lr69", "lr70", "lr71",
- "lr72", "lr73", "lr74", "lr75",
- "lr76", "lr77", "lr78", "lr79",
- "lr80", "lr81", "lr82", "lr83",
- "lr84", "lr85", "lr86", "lr87",
- "lr88", "lr89", "lr90", "lr91",
- "lr92", "lr93", "lr94", "lr95",
- "lr96", "lr97", "lr98", "lr99",
- "lr100", "lr101", "lr102", "lr103",
- "lr104", "lr105", "lr106", "lr107",
- "lr108", "lr109", "lr110", "lr111",
- "lr112", "lr113", "lr114", "lr115",
- "lr116", "lr117", "lr118", "lr119",
- "lr120", "lr121", "lr122", "lr123",
- "lr124", "lr125", "lr126", "lr127"
- };
-
-char *spreg[] = {
- "vab", "ops", "cps", "cfg",
- "cha", "chd", "chc", "rbp",
- "tmc", "tmr", "pc0", "pc1",
- "pc2", "mmu", "lru", "rsn",
- "rma0", "rmc0", "rma1", "rmc1",
- "spc0", "spc1", "spc2", "iba0",
- "ibc0", "iba1", "ibc1", "sr27",
- "sr28", "cir", "cdr", "sr31",
- "sr32", "sr33", "sr34", "sr35",
- "sr36", "sr37", "sr38", "sr39",
- "sr40", "sr41", "sr42", "sr43",
- "sr44", "sr45", "sr46", "sr47",
- "sr48", "sr49", "sr50", "sr51",
- "sr52", "sr53", "sr54", "sr55",
- "sr56", "sr57", "sr58", "sr59",
- "sr60", "sr61", "sr62", "sr63",
- "sr64", "sr65", "sr66", "sr67",
- "sr68", "sr69", "sr70", "sr71",
- "sr72", "sr73", "sr74", "sr75",
- "sr76", "sr77", "sr78", "sr79",
- "sr80", "sr81", "sr82", "sr83",
- "sr84", "sr85", "sr86", "sr87",
- "sr88", "sr89", "sr90", "sr91",
- "sr92", "sr93", "sr94", "sr95",
- "sr96", "sr97", "sr98", "sr99",
- "sr100", "sr101", "sr102", "sr103",
- "sr104", "sr105", "sr106", "sr107",
- "sr108", "sr109", "sr110", "sr111",
- "sr112", "sr113", "sr114", "sr115",
- "sr116", "sr117", "sr118", "sr119",
- "sr120", "sr121", "sr122", "sr123",
- "sr124", "sr125", "sr126", "sr127",
- "ipc", "ipa", "ipb", "q",
- "alu", "bp", "fc", "cr",
- "sr136", "sr137", "sr138", "sr139",
- "sr140", "sr141", "sr142", "sr143",
- "sr144", "sr145", "sr146", "sr147",
- "sr148", "sr149", "sr150", "sr151",
- "sr152", "sr153", "sr154", "sr155",
- "sr156", "sr157", "sr158", "sr159",
- "fpe", "inte", "fps", "sr163",
- "exop", "sr165", "sr166", "sr167",
- "sr168", "sr169", "sr170", "sr171",
- "sr172", "sr173", "sr174", "sr175",
- "sr176", "sr177", "sr178", "sr179",
- "sr180", "sr181", "sr182", "sr183",
- "sr184", "sr185", "sr186", "sr187",
- "sr188", "sr189", "sr190", "sr191",
- "sr192", "sr193", "sr194", "sr195",
- "sr196", "sr197", "sr198", "sr199",
- "sr200", "sr201", "sr202", "sr203",
- "sr204", "sr205", "sr206", "sr207",
- "sr208", "sr209", "sr210", "sr211",
- "sr212", "sr213", "sr214", "sr215",
- "sr216", "sr217", "sr218", "sr219",
- "sr220", "sr221", "sr222", "sr223",
- "sr224", "sr225", "sr226", "sr227",
- "sr228", "sr229", "sr230", "sr231",
- "sr232", "sr233", "sr234", "sr235",
- "sr236", "sr237", "sr238", "sr239",
- "sr240", "sr241", "sr242", "sr243",
- "sr244", "sr245", "sr246", "sr247",
- "sr248", "sr249", "sr250", "sr251",
- "sr252", "sr253", "sr254", "sr255"
- };
-
+++ /dev/null
-static char _[] = "@(#)set.c 5.20 93/07/30 16:39:00, Srini, AMD.";
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- ** This code provides "set" routines to set memory and
- ** registers. Data may be set as words (32 bit), half-words
- ** (16 bit), bytes (8 bit), float (32 bit floating point) or
- ** double (64 bit floating point).
- **
- ** Since registers are 32 bits long, the set byte and set half
- ** commands will only be permitted for memory accesses.
- *****************************************************************************
- */
-
-
-#include <stdio.h>
-#include <ctype.h>
-#include <memory.h>
-#include "main.h"
-#include "monitor.h"
-#include "miniint.h"
-#include "memspcs.h"
-#include "macros.h"
-#include "error.h"
-
-
-#ifdef MSDOS
-#include <stdlib.h>
-#include <string.h>
-#else
-#include <string.h>
-
-#endif
-
-int get_addr_29k PARAMS((char *, struct addr_29k_t *));
-int addr_29k_ok PARAMS((struct addr_29k_t *));
-
-int get_word PARAMS((char *, INT32 *));
-int get_half PARAMS((char *, INT16 *));
-int get_byte PARAMS((char *, BYTE *));
-int get_float PARAMS((char *, float *));
-int get_double PARAMS((char *, double *));
-
-int set_data PARAMS((BYTE *, BYTE *, int));
-
-/*
-** The function below is used in setting data. This function is
-** called in the main command loop parser of the monitor. The
-** parameters passed to this function are:
-**
-** token - This is an array of pointers to strings. Each string
-** referenced by this array is a "token" of the user's
-** input, translated to lower case.
-**
-** token_count - This is the number of items in the token array.
-**
-** This function reduces the tokens to three parameters:
-** memory_space, address and the data to be set. This data
-** is one of the "temp_" variables.
-**
-*/
-
-
-INT32
-set_cmd(token, token_count)
- char *token[];
- int token_count;
- {
- INT16 size;
- int result;
- struct addr_29k_t addr_29k;
- int set_format;
- INT32 temp_word;
- INT16 temp_half;
- BYTE temp_byte;
- float temp_float;
- double temp_double;
-
- INT32 retval;
- BYTE write_buffer[16]; /* */
- INT32 bytes_ret;
- INT32 hostendian; /* UDI conformant */
- INT32 count;
-
-
- if (token_count != 3) {
- return (EMSYNTAX);
- }
-
- /*
- ** What is the data format?
- */
-
- count = (INT32) 1;
- if ((strcmp(token[0], "s") == 0) ||
- (strcmp(token[0], "sw") == 0)) {
- set_format = WORD_FORMAT;
- size = (INT16) sizeof(INT32);
- result = get_word(token[2], &temp_word);
- if (result != 0)
- return (EMSYNTAX);
- result = set_data(write_buffer, (BYTE *)&temp_word, sizeof(INT32));
- if (result != 0)
- return (EMSYNTAX);
- }
- else
- if (strcmp(token[0], "sh") == 0) {
- set_format = HALF_FORMAT;
- size = (INT16) sizeof(INT16);
- result = get_half(token[2], &temp_half);
- if (result != 0)
- return (EMSYNTAX);
- result = set_data(write_buffer, (BYTE *)&temp_half, sizeof(INT16));
- if (result != 0)
- return (EMSYNTAX);
- }
- else
- if (strcmp(token[0], "sb") == 0) {
- set_format = BYTE_FORMAT;
- size = (INT16) sizeof(BYTE);
- result = get_byte(token[2], &temp_byte);
- if (result != 0)
- return (EMSYNTAX);
- result = set_data(write_buffer, (BYTE *)&temp_byte, sizeof(BYTE));
- if (result != 0)
- return (EMSYNTAX);
- }
- else
- if (strcmp(token[0], "sf") == 0) {
- set_format = FLOAT_FORMAT;
- size = (INT16) sizeof(float);
- result = get_float(token[2], &temp_float);
- if (result != 0)
- return (EMSYNTAX);
- result = set_data(write_buffer, (BYTE *)&temp_float, sizeof(float));
- if (result != 0)
- return (EMSYNTAX);
- }
- else
- if (strcmp(token[0], "sd") == 0) {
- set_format = DOUBLE_FORMAT;
- size = (INT16) sizeof(double);
- result = get_double(token[2], &temp_double);
- if (result != 0)
- return (EMSYNTAX);
- result = set_data(write_buffer, (BYTE *)&temp_double, sizeof(double));
- if (result != 0)
- return (EMSYNTAX);
- }
- else
- return(EMSYNTAX);
-
- /*
- ** Get address
- */
-
- result = get_addr_29k(token[1], &addr_29k);
- if (result != 0)
- return (EMSYNTAX);
- result = addr_29k_ok(&addr_29k);
- if (result != 0)
- return (result);
-
- /*
- ** We don't set bytes or half words in registers
- */
-
- if (((ISREG(addr_29k.memory_space)) &&
- (set_format == BYTE_FORMAT)) ||
-
- ((ISREG(addr_29k.memory_space)) &&
- (set_format == HALF_FORMAT)))
- return (EMSYNTAX);
-
- /* Will the data overflow the message buffer? Done in TIP */
-
- hostendian = FALSE;
- if ((retval = Mini_write_req (addr_29k.memory_space,
- addr_29k.address,
- count,
- (INT16) size,
- &bytes_ret,
- write_buffer,
- hostendian)) != SUCCESS) {
- return(FAILURE);
- } else
- return(SUCCESS);
-
- } /* end set_cmd() */
-
-
+++ /dev/null
-static char _[] = "@(#)xcmd.c 5.20 93/07/30 16:39:02, Srini, AMD";
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- ** This code implements a subset of the MON29K-like "x"
- ** commands.
- *****************************************************************************
- */
-
-
-#include <stdio.h>
-#include <ctype.h>
-#include <memory.h>
-#include "main.h"
-#include "macros.h"
-#include "miniint.h"
-#include "memspcs.h"
-#include "error.h"
-
-
-#ifdef MSDOS
-#include <stdlib.h>
-#include <string.h>
-#else
-#include <string.h>
-#endif
-
-INT32 xp_cmd PARAMS((char **, int));
-INT32 xc_cmd PARAMS((char **, int));
-
-int get_addr_29k PARAMS((char *, struct addr_29k_t *));
-int addr_29k_ok PARAMS((struct addr_29k_t *));
-int print_addr_29k PARAMS((INT32, ADDR32));
-int get_word PARAMS((char *buffer, INT32 *data_word));
-void convert32 PARAMS(( BYTE *byte));
-
-void dasm_instr PARAMS((ADDR32, struct instr_t *));
-
-/* Variable definitions */
-struct xp_cmd_t {
- INT32 vtb;
- INT32 ops;
- INT32 cps;
- INT32 cfg;
- INT32 cha;
- INT32 chd;
- INT32 chc;
- INT32 rbp;
- INT32 tmc;
- INT32 tmr;
- INT32 pc0;
- INT32 pc1;
- INT32 pc2;
- INT32 mmuc;
- INT32 lru;
-};
-#define XP_CMD_SZ 15 * sizeof (INT32)
-/* #define XP_CMD_SZ sizeof(struct xp_cmd_t) */
-
-/*
-** The function below is used to implement the MON29K-like
-** "x" commands. the function below, x_cmd() is called
-** in the main command loop parser of the monitor. The
-** parameters passed to this function are:
-**
-** token - This is an array of pointers to strings. Each string
-** referenced by this array is a "token" of the user's
-** input, translated to lower case.
-**
-** token_count - This is the number of tokens in "token".
-**
-** This function then calls the specific "x" commands,
-** such as "xp" or "xc".
-*/
-
-
-INT32
-x_cmd(token, token_count)
- char *token[];
- int token_count;
- {
- INT32 result;
-
- if (strcmp(token[0], "xp") == 0)
- result = xp_cmd(token, token_count);
- else
- if (strcmp(token[0], "xc") == 0)
- result = xc_cmd(token, token_count);
- else
- result = EMSYNTAX;
-
- return (result);
- } /* end xcmd() */
-
-
-/*
-** This command is used to print out formatted information
-** about protected special registers. The format is borrowed
-** from MON29K, and produces a full screen of data, giving
-** bit fields of the various registers.
-*/
-
-INT32
-xp_cmd(token, token_count)
- char *token[];
- int token_count;
- {
- INT32 byte_count;
- int prl;
- INT32 vtb;
- INT32 ops;
- INT32 cps;
- INT32 cfg;
- INT32 cha;
- INT32 chd;
- INT32 chc;
- INT32 rbp;
- INT32 tmc;
- INT32 tmr;
- INT32 pc0;
- INT32 pc1;
- INT32 pc2;
- INT32 mmuc;
- INT32 lru;
-
- INT32 retval;
- INT32 bytes_ret;
- INT32 hostendian;
- union {
- struct xp_cmd_t xp_cmd;
- char read_buffer[XP_CMD_SZ];
- } xp_cmd_val;
- char prtbuf[256];
-
- if ((strcmp(token[0], "xp") != 0) ||
- (token_count != 1))
- return (EMSYNTAX);
-
- /*
- ** Get data
- */
-
- byte_count = XP_CMD_SZ;
-
- /* Will the data overflow the message buffer? Done in TIP */
-
- hostendian = FALSE;
- if ((retval = Mini_read_req (SPECIAL_REG,
- (ADDR32) 0,
- byte_count/4,
- (INT16) 4, /* size */
- &bytes_ret,
- xp_cmd_val.read_buffer,
- hostendian)) != SUCCESS) {
- return(FAILURE);
- };
- /* The following is executed if SUCCESSful */
- vtb = xp_cmd_val.xp_cmd.vtb;
- ops = xp_cmd_val.xp_cmd.ops;
- cps = xp_cmd_val.xp_cmd.cps;
- cfg = xp_cmd_val.xp_cmd.cfg;
- cha = xp_cmd_val.xp_cmd.cha;
- chd = xp_cmd_val.xp_cmd.chd;
- chc = xp_cmd_val.xp_cmd.chc;
- rbp = xp_cmd_val.xp_cmd.rbp;
- tmc = xp_cmd_val.xp_cmd.tmc;
- tmr = xp_cmd_val.xp_cmd.tmr;
- pc0 = xp_cmd_val.xp_cmd.pc0;
- pc1 = xp_cmd_val.xp_cmd.pc1;
- pc2 = xp_cmd_val.xp_cmd.pc2;
- mmuc = xp_cmd_val.xp_cmd.mmuc;
- lru = xp_cmd_val.xp_cmd.lru;
-
- if (host_config.host_endian != host_config.target_endian) {
- convert32((BYTE *)&vtb);
- convert32((BYTE *)&ops);
- convert32((BYTE *)&cps);
- convert32((BYTE *)&cfg);
- convert32((BYTE *)&cha);
- convert32((BYTE *)&chd);
- convert32((BYTE *)&chc);
- convert32((BYTE *)&rbp);
- convert32((BYTE *)&tmc);
- convert32((BYTE *)&tmr);
- convert32((BYTE *)&pc0);
- convert32((BYTE *)&pc1);
- convert32((BYTE *)&pc2);
- convert32((BYTE *)&mmuc);
- convert32((BYTE *)&lru);
- }
-
-
- /* Print CPS */
- sprintf(&prtbuf[0], "\n");
- sprintf(&prtbuf[strlen(prtbuf)], " TD MM CA IP TE TP TU FZ LK RE WM PD PI SM IM DI DA\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "%s", &prtbuf[0]);
- fprintf (stderr, "%s", &prtbuf[0]);
- sprintf(&prtbuf[0], "CPS:");
- sprintf(&prtbuf[strlen(prtbuf)], " %3x", ((cps >> 17) & 0x01)); /* td */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((cps >> 16) & 0x01)); /* mm */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((cps >> 15) & 0x01)); /* ca */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((cps >> 14) & 0x01)); /* ip */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((cps >> 13) & 0x01)); /* te */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((cps >> 12) & 0x01)); /* tp */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((cps >> 11) & 0x01)); /* tu */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((cps >> 10) & 0x01)); /* fz */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((cps >> 9) & 0x01)); /* lk */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((cps >> 8) & 0x01)); /* re */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((cps >> 7) & 0x01)); /* wm */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((cps >> 6) & 0x01)); /* pd */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((cps >> 5) & 0x01)); /* pi */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((cps >> 4) & 0x01)); /* sm */
-
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((cps >> 2) & 0x03)); /* im */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((cps >> 1) & 0x01)); /* di */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((cps >> 0) & 0x01)); /* da */
- sprintf(&prtbuf[strlen(prtbuf)], "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "%s", &prtbuf[0]);
- fprintf (stderr, "%s", &prtbuf[0]);
-
- /* Print OPS */
- sprintf(&prtbuf[0], "OPS:");
- sprintf(&prtbuf[strlen(prtbuf)], " %3x", ((ops >> 17) & 0x01)); /* td */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((ops >> 16) & 0x01)); /* mm */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((ops >> 15) & 0x01)); /* ca */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((ops >> 14) & 0x01)); /* ip */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((ops >> 13) & 0x01)); /* te */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((ops >> 12) & 0x01)); /* tp */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((ops >> 11) & 0x01)); /* tu */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((ops >> 10) & 0x01)); /* fz */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((ops >> 9) & 0x01)); /* lk */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((ops >> 8) & 0x01)); /* re */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((ops >> 7) & 0x01)); /* wm */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((ops >> 6) & 0x01)); /* pd */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((ops >> 5) & 0x01)); /* pi */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((ops >> 4) & 0x01)); /* sm */
-
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((ops >> 2) & 0x03)); /* im */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((ops >> 1) & 0x01)); /* di */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((ops >> 0) & 0x01)); /* da */
- sprintf(&prtbuf[strlen(prtbuf)], "\n");
- sprintf(&prtbuf[strlen(prtbuf)], "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "%s", &prtbuf[0]);
- fprintf (stderr, "%s", &prtbuf[0]);
-
- /* Get Processor Revision Number */
- prl = (int) ((cfg >> 24) & 0xff);
-
- /* Print VAB / CFG */
- if (PROCESSOR(prl) == PROC_AM29030) {
- sprintf(&prtbuf[0], " VAB CFG: PRL PMB IL ID VF BO\n");
- sprintf(&prtbuf[strlen(prtbuf)], "%08lx ", vtb);
- sprintf(&prtbuf[strlen(prtbuf)], "%02lx", ((cfg >> 24) & 0xff)); /* prl */
- sprintf(&prtbuf[strlen(prtbuf)], "%4x", ((cfg >> 16) & 0x03)); /* pmb */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((cfg >> 9) & 0x03)); /* il */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((cfg >> 8) & 0x01)); /* id */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((cfg >> 4) & 0x01)); /* vf */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((cfg >> 2) & 0x01)); /* bo */
- sprintf(&prtbuf[strlen(prtbuf)], "\n");
- sprintf(&prtbuf[strlen(prtbuf)], "\n");
- }
- else { /* Am29000 or Am29050 */
- sprintf(&prtbuf[0], " VAB CFG: PRL DW VF RV BO CP CD\n");
- sprintf(&prtbuf[strlen(prtbuf)], "%08lx ", vtb);
- sprintf(&prtbuf[strlen(prtbuf)], "%02lx", ((cfg >> 24) & 0xff)); /* prl */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((cfg >> 5) & 0x01)); /* dw */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((cfg >> 4) & 0x01)); /* vf */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((cfg >> 3) & 0x01)); /* rv */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((cfg >> 2) & 0x01)); /* bo */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((cfg >> 1) & 0x01)); /* cp */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((cfg >> 0) & 0x01)); /* cd */
- sprintf(&prtbuf[strlen(prtbuf)], "\n");
- sprintf(&prtbuf[strlen(prtbuf)], "\n");
- }
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "%s", &prtbuf[0]);
- fprintf (stderr, "%s", &prtbuf[0]);
-
- /* Print CHA / CHD / CHC */
- sprintf(&prtbuf[0], " CHA CHD CHC: CE CNTL CR LS ML ST LA TF TR NN CV\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "%s", &prtbuf[0]);
- fprintf (stderr, "%s", &prtbuf[0]);
- sprintf(&prtbuf[0], "%08lx ", cha); /* cha */
- sprintf(&prtbuf[strlen(prtbuf)], "%08lx ", chd); /* chd */
- sprintf(&prtbuf[strlen(prtbuf)], "%2x", ((chc >> 31) & 0x01)); /* ce */
- sprintf(&prtbuf[strlen(prtbuf)], "%5x", ((chc >> 24) & 0xff)); /* cntl */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((chc >> 16) & 0xff)); /* cr */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((chc >> 15) & 0x01)); /* ls */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((chc >> 14) & 0x01)); /* ml */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((chc >> 13) & 0x01)); /* st */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((chc >> 12) & 0x01)); /* la */
-
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((chc >> 10) & 0x01)); /* tf */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((chc >> 2) & 0xff)); /* tr */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((chc >> 1) & 0x01)); /* nn */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((chc >> 0) & 0x01)); /* cv */
- sprintf(&prtbuf[strlen(prtbuf)], "\n");
- sprintf(&prtbuf[strlen(prtbuf)], "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "%s", &prtbuf[0]);
- fprintf (stderr, "%s", &prtbuf[0]);
-
- /* Print RBP */
- sprintf(&prtbuf[0], "RBP: BF BE BD BC BB BA B9 B8 B7 B6 B5 B4 B3 B2 B1 B0\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "%s", &prtbuf[0]);
- fprintf (stderr, "%s", &prtbuf[0]);
- sprintf(&prtbuf[0], " %3x", ((rbp >> 15) & 0x01));
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((rbp >> 14) & 0x01));
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((rbp >> 13) & 0x01));
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((rbp >> 12) & 0x01));
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((rbp >> 11) & 0x01));
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((rbp >> 10) & 0x01));
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((rbp >> 9) & 0x01));
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((rbp >> 8) & 0x01));
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((rbp >> 7) & 0x01));
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((rbp >> 6) & 0x01));
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((rbp >> 5) & 0x01));
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((rbp >> 4) & 0x01));
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((rbp >> 3) & 0x01));
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((rbp >> 2) & 0x01));
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((rbp >> 1) & 0x01));
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((rbp >> 0) & 0x01));
- sprintf(&prtbuf[strlen(prtbuf)], "\n");
- sprintf(&prtbuf[strlen(prtbuf)], "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "%s", &prtbuf[0]);
- fprintf (stderr, "%s", &prtbuf[0]);
-
- /* Print TMC / TMR / PC0 / PC1 / PC2 */
- sprintf(&prtbuf[0], " TCV TR: OV IN IE TRV PC0 PC1 PC2\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "%s", &prtbuf[0]);
- fprintf (stderr, "%s", &prtbuf[0]);
- sprintf(&prtbuf[0], "%06lx", (tmc & 0x00ffffff)); /* tcv */
- sprintf(&prtbuf[strlen(prtbuf)], "%5x", ((tmr >> 26) & 0x01)); /* ov */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((tmr >> 25) & 0x01)); /* in */
- sprintf(&prtbuf[strlen(prtbuf)], "%3x", ((tmr >> 24) & 0x01)); /* ie */
- sprintf(&prtbuf[strlen(prtbuf)], " %06lx", (tmr & 0x00ffffff)); /* trv */
- sprintf(&prtbuf[strlen(prtbuf)], " %08lx", pc0); /* pc0 */
- sprintf(&prtbuf[strlen(prtbuf)], " %08lx", pc1); /* pc1 */
- sprintf(&prtbuf[strlen(prtbuf)], " %08lx", pc2); /* pc2 */
- sprintf(&prtbuf[strlen(prtbuf)], "\n");
- sprintf(&prtbuf[strlen(prtbuf)], "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "%s", &prtbuf[0]);
- fprintf (stderr, "%s", &prtbuf[0]);
-
- /* Print MMUC / LRU */
- sprintf(&prtbuf[0], "MMU: PS PID LRU\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "%s", &prtbuf[0]);
- fprintf (stderr, "%s", &prtbuf[0]);
- sprintf(&prtbuf[0], " %02x", ((mmuc >> 8) & 0x03)); /* ps */
- sprintf(&prtbuf[strlen(prtbuf)], " %02x", (mmuc & 0xff)); /* pid */
- sprintf(&prtbuf[strlen(prtbuf)], " %02x", (lru & 0xff)); /* lru */
- sprintf(&prtbuf[strlen(prtbuf)], "\n");
- sprintf(&prtbuf[strlen(prtbuf)], "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "%s", &prtbuf[0]);
- fprintf (stderr, "%s", &prtbuf[0]);
-
- return (0);
-
- } /* end xp_cmd() */
-
-
-
-/*
-** This command is used to examine the contents of the cache
-** in the Am29030. First set 0 is printed, starting with the
-** tag, followed by a disassembly of four instructions in
-** the set. Set 1 for the line follows similarly.
-**
-** The data comes in from the READ_ACK message in the following
-** order:
-**
-** tag (data[0-3] (set 0)
-** instr1 (data[4-7]
-** instr1 (data[8-11]
-** instr1 (data[12-15]
-** instr1 (data[16-19]
-**
-** tag (data[20-23] (set 1)
-** instr1 (data[24-27]
-** instr1 (data[28-31]
-** instr1 (data[32-35]
-** instr1 (data[36-39]
-*/
-
-INT32
-xc_cmd(token, token_count)
- char *token[];
- int token_count;
- {
- static INT32 memory_space=I_CACHE;
- static ADDR32 cache_line=0;
- static INT32 byte_count=(10*sizeof(INST32));
- static INT32 count=1;
- ADDR32 address;
- INT32 i;
- int j;
- int set;
- int index;
- int result;
- struct instr_t instr;
- INT32 cache_line_start;
- INT32 cache_line_end;
-
- INT32 retval;
- INT32 bytes_ret;
- INT32 host_endian;
- BYTE read_buffer[10*sizeof(INST32)];
- char prtbuf[256];
-
-
- /* Is it an 'xc' command? */
- if (strcmp(token[0], "xc") != 0)
- return (EMSYNTAX);
-
- /*
- ** Parse parameters
- */
-
- if (token_count == 1) {
- cache_line = cache_line + count;
- }
- else
- if (token_count == 2) {
- result = get_word(token[1], &cache_line_start);
- if (result != 0)
- return (EMSYNTAX);
- if ((cache_line_start < 0) ||
- (cache_line_start >255))
- return (EMBADADDR);
- cache_line = cache_line_start;
- }
- else
- if (token_count == 3) {
- /* Get first cache line to be dumped */
- result = get_word(token[1], &cache_line_start);
- if (result != 0)
- return (EMSYNTAX);
- if ((cache_line_start < 0) ||
- (cache_line_start > 255))
- return (EMBADADDR);
- /* Get last cache line to be dumped */
- result = get_word(token[2], &cache_line_end);
- if (result != 0)
- return (EMSYNTAX);
- if ((cache_line_end < 0) ||
- (cache_line_end > 255))
- return (EMBADADDR);
- if (cache_line_start > cache_line_end)
- return (EMBADADDR);
- cache_line = cache_line_start;
- count = (cache_line_end - cache_line_start) + 1;
- }
- else
- /* Too many args */
- return (EMSYNTAX);
-
- i = 0;
- while (i < count) {
-
- host_endian = FALSE;
- if ((retval = Mini_read_req(memory_space,
- (cache_line + i),
- byte_count/4,
- (INT16) 4, /* size */
- &bytes_ret,
- read_buffer,
- host_endian)) != SUCCESS) {
- return(FAILURE);
- };
- /* The following is executed if SUCCESSful */
-
- for (set=0; set<2; set++) {
-
- /* Print out formatted address tag and status information */
- index = (set * 20);
- sprintf(&prtbuf[0], "\n");
- sprintf(&prtbuf[strlen(prtbuf)], "Cache line 0x%lx, set %d.\n", (int) (cache_line+i), set);
- sprintf(&prtbuf[strlen(prtbuf)], "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "%s", &prtbuf[0]);
- fprintf (stderr, "%s", &prtbuf[0]);
- sprintf(&prtbuf[0], "IATAG V P US\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "%s", &prtbuf[0]);
- fprintf (stderr, "%s", &prtbuf[0]);
- sprintf(&prtbuf[0], "%02x%02x%1x %1x %1x %1x\n",
- read_buffer[index],
- read_buffer[index + 1],
- ((read_buffer[index + 2] >> 4) & 0x0f),
- ((read_buffer[index + 3] >> 2) & 0x01),
- ((read_buffer[index + 3] >> 1) & 0x01),
- (read_buffer[index + 3] & 0x01));
- sprintf(&prtbuf[strlen(prtbuf)], "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf (io_config.echo_file, "%s", &prtbuf[0]);
- fprintf (stderr, "%s", &prtbuf[0]);
-
- /* Address = IATAG + line_number + <16 byte adddress> */
- address = ((read_buffer[index] << 24) |
- (read_buffer[index + 1] << 16) |
- (read_buffer[index + 2] << 8) |
- ((cache_line+i) << 4));
-
- /* Disassemble four words */
- for (j=0; j<4; j=j+1) {
- index = (set * 20) + ((j+1) * sizeof(INT32));
- instr.op = read_buffer[index];
- instr.c = read_buffer[index + 1];
- instr.a = read_buffer[index + 2];
- instr.b = read_buffer[index + 3];
-
- /* Print address of instruction (in hex) */
- address = (address & 0xfffffff0); /* Clear low four bits */
- address = (address | (j << 2));
- fprintf(stderr, "%08lx ", address);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "%08lx ", address);
-
- /* Print instruction (in hex) */
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "%02x%02x%02x%02x ", instr.op, instr.c,
- instr.a, instr.b);
- fprintf(stderr, "%02x%02x%02x%02x ", instr.op, instr.c,
- instr.a, instr.b);
-
- /* Disassemble instruction */
- dasm_instr(address, &instr);
- fprintf(stderr, "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n");
-
- } /* end for(j) */
-
- fprintf(stderr, "\n");
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "\n");
-
- } /* end for(set) */
-
- i = i + 1;
-
- } /* end while loop */
-
- return (0);
-
- } /* end xc_cmd() */
-
-
+++ /dev/null
-static char _[] = "@(#)yank.c 5.20 93/07/30 16:39:05, Srini, AMD. ";
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- ** This module is used to "yank" or load a COFF file
- ** Into target memory.
- *****************************************************************************
- */
-
-
-#include <stdio.h>
-#include <memory.h>
-#include <ctype.h>
-#include "coff.h"
-#include "memspcs.h"
-#include "main.h"
-#include "miniint.h"
-#include "macros.h"
-#include "error.h"
-
-#ifdef MSDOS
-#include <string.h>
-#include <stdlib.h>
-#else
-#include <string.h>
-#endif
-
-/* Definitions */
-
-#define FILE_BUFFER_SIZE 1024
-
-#ifdef MSDOS
-#define FILE_OPEN_FLAG "rb"
-#else
-#define FILE_OPEN_FLAG "r"
-#endif
-
-#define FROM_BEGINNING 0
-
-/* Function declarations */
-INT32 Mini_load_coff PARAMS((char *fname,
- INT32 space,
- INT32 sym,
- INT32 sects,
- int msg));
-INT32 Mini_init_info_ptr PARAMS((INIT_INFO *init));
-INT32 Mini_send_init_info PARAMS((INIT_INFO *init));
-INT32 Mini_load_file PARAMS((char *fname,
- INT32 mspace,
- int fargc,
- char *fargs,
- INT32 sym,
- INT32 sects,
- int msg));
-void convert32 PARAMS((BYTE *));
-void convert16 PARAMS((BYTE *));
-int SetSections PARAMS((char *));
-void print_ld_msg PARAMS((INT32, int, ADDR32, INT32));
-void print_ign_msg PARAMS((int, ADDR32, INT32));
-void print_end_msg PARAMS((INT32, int, ADDR32, INT32));
-
-/* GLobal */
-
-GLOBAL INIT_INFO init_info;
-
-static BYTE buffer[FILE_BUFFER_SIZE];
-extern char CoffFileName[];
-static INT32 Symbols=0; /* No symbols support yet */
-static INT32 Sections=STYP_ABS | STYP_TEXT | STYP_DATA | STYP_LIT | STYP_BSS;
-static INT32 MSpace=I_MEM;
-static int FileArgc;
-static char ArgString[1024];
-static FILE *coff_in;
-static int InitializeProgram=1;
-
-
-/*
-** This is the function called by the main program to load
-** a COFF file. It also modifies the global data structure
-** init. The data structure is then sent via an INIT message
-** to the target. In addition, the "argv" parameter string
-** is sent to the target with WRITE messages.
-**
-*/
-
-INT32
-yank_cmd(token, token_count)
- char *token[];
- int token_count;
- {
- int i;
- int j;
- int SectionsGiven=0;
- int IPFlag=0;
-
- for (j=1; j < token_count; j++) { /* parse command */
- switch (token[j][0]) {
- case '-':
- if (token[j][1] == '\0')
- return (EMSYNTAX);
- if (strcmp(token[j],"-ms")==0) {/*mem stack opt */
- if (++j >= token_count)
- return (EMSYNTAX);
- if (sscanf(token[j],"%lx",&(init_info.mem_stack_size)) != 1)
- return (EMSYNTAX);
- } else if (strcmp(token[j],"-rs")==0) {/*r stack*/
- if (++j >= token_count)
- return (EMSYNTAX);
- if (sscanf(token[j],"%lx",&(init_info.reg_stack_size)) != 1)
- return (EMSYNTAX);
- } else if (strcmp(token[j],"-noi")==0) {/*no init */
- InitializeProgram = 0;
- IPFlag = 1;
- } else if (strcmp(token[j],"-i")==0) {/*init*/
- InitializeProgram = 1;
- IPFlag = 1;
- } else {
- if (SetSections(token[j]) == (int) -1)
- return (EMSYNTAX);
- else
- SectionsGiven=1;
- }
- break;
- default: /* filename etc. */
- if (!SectionsGiven) {
- Sections = STYP_ABS|STYP_TEXT|STYP_DATA|STYP_LIT|STYP_BSS;
- SectionsGiven=0;
- }
- if (!IPFlag) {
- InitializeProgram = 1;
- IPFlag=0;
- }
- (void) strcpy (&CoffFileName[0], token[j]);
- FileArgc = token_count - j;
- (void) strcpy(ArgString, token[j]);
- for (i = 1; i < FileArgc; i++) {
- strcat(ArgString, " ");
- strcat(ArgString, token[j+i]);
- };
- j = token_count; /* break out of for loop */
- break;
- };
- }
- if (strcmp(CoffFileName,"") == 0) /* No COFF file given */
- return (EMSYNTAX);
-
- if (Mini_load_file(&CoffFileName[0], MSpace,
- FileArgc, ArgString,
- Symbols, Sections,
- QuietMode) != SUCCESS) {
- return(FAILURE);
- } else
- return(SUCCESS);
-};
-
-
-INT32
-Mini_load_file(filename, mspace, fileargc, fileargs, sym, sects, quietmode)
-char *filename;
-INT32 mspace;
-int fileargc;
-char *fileargs;
-INT32 sym;
-INT32 sects;
-int quietmode;
-{
-
- if (Mini_init_info_ptr(&init_info) != SUCCESS)
- return(FAILURE);
-
- if (Mini_load_coff(filename, mspace, sym, sects, quietmode) != SUCCESS)
- return(FAILURE);
-
- init_info.argstring = fileargs; /* complete argv string */
-
- if (InitializeProgram) {
- if (Mini_send_init_info(&init_info) != SUCCESS)
- return(FAILURE);
- } else {
- warning(EMNOINITP);
- }
-
- return(SUCCESS);
-};
-
-INT32
-Mini_init_info_ptr(init_ptr)
-INIT_INFO *init_ptr;
-{
-
- /* Re-initialize INIT message */
- init_ptr->text_start = 0xffffffff;
- init_ptr->text_end = 0;
- init_ptr->data_start = 0xffffffff;
- init_ptr->data_end = 0;
- init_ptr->entry_point = 0;
- if (init_ptr->mem_stack_size == (UINT32) -1)
- init_ptr->mem_stack_size = MEM_STACK_SIZE;
- if (init_ptr->reg_stack_size == (UINT32) -1)
- init_ptr->reg_stack_size = REG_STACK_SIZE;
- init_ptr->argstring = (char *) 0;
- return(SUCCESS);
-};
-
-
-INT32
-Mini_send_init_info(info_ptr)
-INIT_INFO *info_ptr;
-{
- INT32 retval;
-
- /* Align INIT values to word boundaries */
- info_ptr->text_start = ALIGN32(info_ptr->text_start);
- info_ptr->text_end = ALIGN32(info_ptr->text_end);
- info_ptr->data_start = ALIGN32(info_ptr->data_start);
- info_ptr->data_end = ALIGN32(info_ptr->data_end);
- info_ptr->mem_stack_size = ALIGN32(info_ptr->mem_stack_size);
- info_ptr->reg_stack_size = ALIGN32(info_ptr->reg_stack_size);
-
- /* Send INIT message */
-
- if ((retval = Mini_init (info_ptr->text_start,
- info_ptr->text_end,
- info_ptr->data_start,
- info_ptr->data_end,
- info_ptr->entry_point,
- info_ptr->mem_stack_size,
- info_ptr->reg_stack_size,
- info_ptr->argstring)) != SUCCESS) {
- warning(EMINIT);
- return(FAILURE);
- };
- return (SUCCESS);
-
-} /* Mini_send_init_info */
-
-
-
-/*
-** This function is used to load a COFF file. Depending on
-** the global variable "target_interface", data will be loaded
-** by either EB29K shared memory, PCEB shared memory, EB030
-** shared memory or serially.
-**
-** In addition, the global data structure "init" is updated.
-** This data structure maintains the entry point and various
-** other target initialization parameters.
-*/
-
-INT32
-Mini_load_coff(filename, mspace, sym, Section, quietmode)
- char *filename;
- int quietmode;
- INT32 sym;
- INT32 Section;
- INT32 mspace;
- {
- unsigned short COFF_sections;
- INT32 flags;
- INT32 memory_space;
- INT32 address;
- INT32 byte_count;
- INT32 temp_byte_count;
- INT32 bytes_ret;
-
- struct filehdr COFF_header;
- struct aouthdr COFF_aout_header;
- struct scnhdr COFF_section_header;
-
- if (!quietmode) {
- fprintf(stderr, "loading %s\n", filename);
- if (io_config.echo_mode == (INT32) TRUE)
- fprintf(io_config.echo_file, "loading %s\n", filename);
- }
-
- /* Open the COFF input file (if we can) */
- if ((coff_in = fopen(filename, FILE_OPEN_FLAG)) == NULL) {
- warning (EMOPEN); return(FAILURE);
- };
-
- /* Read in COFF header information */
- if (fread((char *)&COFF_header, sizeof(struct filehdr), 1, coff_in) != 1) {
- fclose(coff_in); warning(EMHDR); return (FAILURE);
- };
-
-
- /* Is it an Am29000 COFF File? */
- if ((COFF_header.f_magic != 0x17a) && (COFF_header.f_magic != 0x7a01) &&
- (COFF_header.f_magic != 0x17b) && (COFF_header.f_magic != 0x7b01)) {
- fclose(coff_in); warning (EMMAGIC); return (FAILURE);
- }
-
- /* Get number of COFF sections */
- if ((COFF_header.f_magic != 0x17a) && (COFF_header.f_magic != 0x017b))
- convert16((BYTE *) &COFF_header.f_nscns);
- COFF_sections = (unsigned short) COFF_header.f_nscns;
-
- /* Read in COFF a.out header information (if we can) */
- if (COFF_header.f_opthdr > 0) {
- if (fread((char *)&COFF_aout_header, sizeof(struct aouthdr),
- 1, coff_in) != 1) {
- fclose(coff_in); warning (EMAOUT); return (FAILURE);
- };
- /* Set entry point in INIT message */
- init_info.entry_point = COFF_aout_header.entry;
- if ((COFF_header.f_magic != 0x17a) && (COFF_header.f_magic != 0x017b)) {
- convert16((BYTE *) &COFF_header.f_opthdr);
- convert32((BYTE *) &init_info.entry_point);
- }
- }
-
-
- /*
- ** Process COFF section headers
- */
-
- /* Process all sections */
- while ((int) COFF_sections--) {
-
- fseek (coff_in, (long) (FILHSZ+(int)COFF_header.f_opthdr+
- SCNHSZ*(COFF_header.f_nscns-COFF_sections-1)),
- FROM_BEGINNING);
-
- if (fread(&COFF_section_header, 1, SCNHSZ, coff_in) != SCNHSZ) {
- fclose(coff_in); warning (EMSCNHDR); return (FAILURE);
- }
-
- if ((COFF_header.f_magic != 0x17a) && (COFF_header.f_magic != 0x017b)) {
- convert32((BYTE *) &(COFF_section_header.s_paddr));
- convert32((BYTE *) &(COFF_section_header.s_scnptr));
- convert32((BYTE *) &(COFF_section_header.s_size));
- convert32((BYTE *) &(COFF_section_header.s_flags));
- }
-
- address = COFF_section_header.s_paddr;
- byte_count = COFF_section_header.s_size;
- flags = COFF_section_header.s_flags;
-
- /* Print downloading messages (if necessary) */
- if ((flags == (INT32) STYP_TEXT) || (flags == (INT32) (STYP_TEXT | STYP_ABS))) {
- memory_space = I_MEM;
- init_info.text_start = MIN((ADDR32) address,
- (ADDR32) init_info.text_start);
- init_info.text_end = MAX((ADDR32) (address + byte_count),
- (ADDR32) init_info.text_end);
- } else if ((flags == (INT32) STYP_DATA) || (flags == (INT32) (STYP_DATA | STYP_ABS)) ||
- (flags == (INT32) STYP_LIT) || (flags == (INT32) (STYP_LIT | STYP_ABS)) ||
- (flags == (INT32) STYP_BSS) || (flags == (INT32) (STYP_BSS | STYP_ABS))) {
- memory_space = D_MEM;
- init_info.data_start = MIN((ADDR32) address,
- (ADDR32) init_info.data_start);
- init_info.data_end = MAX((ADDR32) (address + byte_count),
- (ADDR32) init_info.data_end);
- } else {
- print_ign_msg(quietmode, address, byte_count);
- flags = (INT32) 0;
- }
-
- if ((flags == (INT32) STYP_BSS) || (flags == (INT32) (STYP_BSS | STYP_ABS))) {
- /* Clear BSS section */
- if (flags & Section) {
- print_ld_msg(flags,quietmode,address,byte_count);
- if (Mini_fill ((INT32) D_MEM,
- (ADDR32) address,
- (INT32) (byte_count+3)/4,
- 4 /* fill zeroes */,
- "\0\0\0") != SUCCESS) {
- (void) fclose(coff_in); warning(EMFILL); return(FAILURE);
- };
- print_end_msg(flags,quietmode,address,byte_count);
- }
- } else if (flags & Section) { /* not a BSS or COmment */
- if (flags == (INT32) (flags & Section)) {
- fseek (coff_in, COFF_section_header.s_scnptr, FROM_BEGINNING);
- while (byte_count > 0) {
- temp_byte_count = MIN((INT32) byte_count, (INT32) sizeof(buffer));
- if (fread((char *) buffer, (int) temp_byte_count, 1, coff_in) != 1) {
- fclose(coff_in); warning (EMSCN); return (FAILURE);
- };
- print_ld_msg(flags, quietmode,address, temp_byte_count);
- /* Write to 29K memory*/
- if (Mini_write_req ((INT32) memory_space,
- (ADDR32) address,
- (INT32) (temp_byte_count+3)/4,
- (INT16) 4, /* size */
- &bytes_ret,
- (BYTE *) buffer,
- (INT32) FALSE) != SUCCESS) {
- warning(EMWRITE);
- return(FAILURE);
- }
- address = address + temp_byte_count;
- byte_count = byte_count - temp_byte_count;
- };
- print_end_msg(flags, quietmode, COFF_section_header.s_paddr,
- COFF_section_header.s_size);
- };
- }
- } /* end while */
-
- (void) fclose(coff_in);
- return (SUCCESS);
-
- } /* end Mini_loadcoff() */
-
-
-int
-SetSections(string)
-char *string;
-{
- int i;
-
- if (string[0] != '-')
- return (-1); /* not section options */
-
- Sections = STYP_ABS;
- for (i=1; string[i] != '\0'; i++) {
- switch (string[i]) {
- case 't':
- case 'T':
- Sections = Sections | STYP_TEXT;
- break;
- case 'd':
- case 'D':
- Sections = Sections | STYP_DATA;
- break;
- case 'b':
- case 'B':
- Sections = Sections | STYP_BSS;
- break;
- case 'l':
- case 'L':
- Sections = Sections | STYP_LIT;
- break;
- default:
- return (EMSYNTAX);
- }
- }
- return (0);
-}
-
-void
-print_ld_msg(flags, mode, address, byte_count)
-INT32 flags;
-int mode;
-ADDR32 address;
-INT32 byte_count;
-{
- if (!mode) {
- if (flags & (INT32) STYP_BSS)
- fprintf(stderr, "Clearing ");
- else
- fprintf(stderr, "Loading ");
-
- if ((flags == (INT32) STYP_TEXT) || (flags == (INT32) (STYP_TEXT|STYP_ABS)))
- fprintf(stderr, "TEXT ");
- else if (flags & (INT32) STYP_DATA)
- fprintf(stderr, "DATA ");
- else if (flags & (INT32) STYP_LIT)
- fprintf(stderr, "LIT ");
- else if (flags & (INT32) STYP_BSS)
- fprintf(stderr, "BSS ");
- fprintf(stderr, "section from 0x%08lx to 0x%08lx\r",
- address, (ADDR32) (address+byte_count));
- }
-}
-
-void
-print_ign_msg(mode, address, byte_count)
-int mode;
-ADDR32 address;
-INT32 byte_count;
-{
- if (!mode)
- fprintf(stderr, "Ignoring COMMENT section (%ld bytes) ...\n", byte_count);
-}
-
-void
-print_end_msg(flags, mode,address,size)
-INT32 flags;
-int mode;
-ADDR32 address;
-INT32 size;
-{
- if (!mode) {
- if (flags & (INT32) STYP_BSS)
- fprintf(stderr, "Cleared ");
- else
- fprintf(stderr, "Loaded ");
- if (io_config.echo_mode == (INT32) TRUE) {
- if (flags & (INT32) STYP_BSS)
- fprintf(io_config.echo_file, "Cleared ");
- else
- fprintf(io_config.echo_file, "Loaded ");
- }
-
- if ((flags == (INT32) STYP_TEXT) ||
- (flags == (INT32) (STYP_TEXT|STYP_ABS)))
- fprintf(stderr, "TEXT ");
- else if (flags & (INT32) STYP_DATA)
- fprintf(stderr, "DATA ");
- else if (flags & (INT32) STYP_LIT)
- fprintf(stderr, "LIT ");
- else if (flags & (INT32) STYP_BSS)
- fprintf(stderr, "BSS ");
-
- fprintf(stderr, "section from 0x%08lx to 0x%08lx\n",
- address, (ADDR32) (address+size));
- if (io_config.echo_mode == (INT32) TRUE) {
- if ((flags == (INT32) STYP_TEXT) ||
- (flags == (INT32) (STYP_TEXT|STYP_ABS)))
- fprintf(io_config.echo_file, "TEXT ");
- else if (flags & (INT32) STYP_DATA)
- fprintf(io_config.echo_file, "DATA ");
- else if (flags & (INT32) STYP_LIT)
- fprintf(io_config.echo_file, "LIT ");
- else if (flags & (INT32) STYP_BSS)
- fprintf(io_config.echo_file, "BSS ");
-
- fprintf(io_config.echo_file, "section from 0x%08lx to 0x%08lx\n",
- address, (ADDR32) (address+size));
- }
- }
-}
+++ /dev/null
-#
-# Makefile for utils/amd-udi/montip
-# Copyright (C) 1993 Free Software Foundation
-#
-# This file is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-# $Id$
-#
-# Written by Jeffrey Wheat (cassidy@cygnus.com)
-#
-
-#### Start of system configuration section. ####
-
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-CC = @CC@
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-DEFS = @DEFS@
-LIBS = @LIBS@
-RANLIB = @RANLIB@
-
-AR = ar
-AR_FLAGS = cq
-
-CFLAGS = -g
-
-LD = ld
-LDFLAGS = -g
-
-MV = mv
-RM = rm
-
-prefix = /usr/local
-exec_prefix = $(prefix)
-
-bindir = $(exec_prefix)/bin
-libdir = $(exec_prefix)/lib
-
-mandir = $(prefix)/man
-man1dir = $(mandir)/man1
-man2dir = $(mandir)/man2
-man3dir = $(mandir)/man3
-man4dir = $(mandir)/man4
-man5dir = $(mandir)/man5
-man6dir = $(mandir)/man6
-man7dir = $(mandir)/man7
-man8dir = $(mandir)/man8
-
-SHELL = /bin/sh
-
-INSTALL = install -c
-INSTALL_DATA = $(INSTALL)
-INSTALL_PROGRAM = $(INSTALL)
-
-#### End of system configuration section. ####
-
-OBJS = udi2mtip.o messages.o endian.o hif.o checksum.o tdfunc.o
-
-LIBTIP = ../udi/libtip.a
-
-INCLUDE = -I$(srcdir)/../udi -I$(srcdir)/../include
-
-.c.o:
- $(CC) $(INCLUDE) $(DEFS) $(CFLAGS) -c $<
-
-all: montip
-
-montip: $(LIBTIP) $(OBJS)
- $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBTIP) $(LIBIBERTY)
-
-install: all
-
-mostlyclean clean:
- $(RM) -f *.o montip
-
-distclean maintainer-clean realclean: clean
- $(RM) -f Makefile config.status
-
-.PHONY: check installcheck info install-info clean-info dvi
-
-check installcheck:
-
-info install-info clean-info dvi:
-
-# with the gnu make, this is done automatically.
-
-Makefile: Makefile.in
- $(SHELL) ./config.status
-
-config.status: configure
- $(srcdir)/configure --no-create
-
-configure: configure.in
- autoconf
-
-# Prevent GNU make v3 from overflowing arg limit on SysV.
-.NOEXPORT:
+++ /dev/null
-static char _[] = "@(#)checksum.c 5.25 93/10/27 15:11:54, Srini, AMD.";
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- **
- ** This file contains code for intercepting failed messages
- ** due to serial transmission errors. The code logically
- ** resides between the messages system and the character
- ** based serial driver. Messages with invalid checksums, or
- ** other communication errors are retried.
- *****************************************************************************
- */
-
-#include <stdio.h>
-#include <string.h>
-#include "types.h"
-#include "memspcs.h"
-#include "messages.h"
-#include "mtip.h"
-#include "tdfunc.h"
-
-#ifdef MSDOS
-#include <conio.h>
-#endif
-
-#define ACK_HDR_CODE -1
-#define CHECKSUM_PASS 0
-#define CHECKSUM_FAIL -1
-
-extern int MessageRetries;
-extern unsigned int TimeOut;
-extern unsigned int BlockCount;
-#ifdef __hpux
-static volatile int bcount;
-#else
-static int bcount;
-#endif
-
-extern int use_parport;
-
-#ifdef MSDOS
-INT32 par_write PARAMS ((char *, INT32));
-#endif
-
-void endian_cvt PARAMS((union msg_t *, int));
-void send_nack PARAMS((INT32 port_base));
-
-extern FILE *MsgFile; /* for logging error retries */
-
-struct ack_msg_t {
- INT32 code;
- INT32 passfail;
-};
-union ack_msg_buf_t {
- struct ack_msg_t ack_msg;
- unsigned char buf[(2*sizeof(INT32))];
-};
-
-
-INT32
-msg_send_serial(msg_ptr, port_base)
- union msg_t *msg_ptr;
- INT32 port_base;
- {
- INT32 result, i, ack, comm_err;
- UINT32 checksum;
- int retries;
- unsigned int timeout;
- INT32 Rx_ack[2];
-
- INT32 header_size = (2 * sizeof(INT32));
-
- BYTE *bfr_ptr = (BYTE *) msg_ptr;
-
- /* Save length before doing endian conversion */
- INT32 length = msg_ptr->generic_msg.length;
- INT32 total_length;
-
- /*
- * MiniMON29K release 2.1 has new Communications Interface module
- * which does not expect the checksum to be aligned on a word
- * boundary. It expects the checksum to immediately follow the
- * end of the message body.
- * The old handler aligned the checksum on the next word boundar after
- * the message body, but did _not_ update the message length field.
- * That caused problems when one end of the Communications gets
- * changed.
- */
- if (((tip_target_config.version >> 24) & 0xf) > 5) { /* new comm handler */
- } else { /* old comm handler */
- /* round length up to even word */
- if ((length & 3) != 0) { /* round up to word boundary */
- length = length + 3;
- length = length & 0xfffffffc;
- };
- }
-
- total_length = header_size + length;
-
- /* Endian conversion */
- if (tip_target_config.TipEndian != tip_target_config.P29KEndian)
- endian_cvt(msg_ptr, OUTGOING_MSG);
-
- /* calc checksum for msg */
- checksum = 0;
- for (i=0; i < total_length; i++)
- checksum = checksum + bfr_ptr[i];
-
- /* Append checksum to the end of the message. Do not update the
- * "length" field of the message header.
- */
- bfr_ptr[total_length] = (BYTE) ((checksum >> 24) & 0xff);
- bfr_ptr[total_length+1] = (BYTE) ((checksum >> 16) & 0xff);
- bfr_ptr[total_length+2] = (BYTE) ((checksum >> 8) & 0xff);
- bfr_ptr[total_length+3] = (BYTE) ((checksum >> 0) & 0xff);
- /* send msg */
- retries = 0;
- do {
- retries = retries + 1;
- comm_err = (INT32) 0;
-
- /* send msg */
- result = send_bfr_serial(bfr_ptr, total_length+4, /* 4 for checksum*/
- port_base, &comm_err);
- if (comm_err != (INT32) 0) {
- (void) reset_comm_serial ((INT32) -1, (INT32) -1);
- return ((INT32) MSGRETRY);
- }
- if (result != (INT32) 0)
- return((INT32) FAILURE);
-
- /* get ack */
- timeout = 0;
- result = (INT32) -1;
- comm_err = (INT32) 0;
- while ((timeout < TimeOut) && (result == (INT32) -1)
- && (comm_err == (INT32) 0)) {
- /* Poll for user interrupt */
- SIGINT_POLL
- timeout=timeout+1;
- result = recv_bfr_serial((BYTE *) Rx_ack, (2 * sizeof(INT32)),
- BLOCK, port_base, &comm_err);
-#ifndef MSDOS
- /* printf("ack wait timeout=0x%lx\n", timeout); */
- if (result == (INT32) -1)
- for (bcount = 0; bcount < BlockCount; bcount++);
-#endif
- }
-
- if (comm_err != (INT32) 0) {
- reset_comm_serial((INT32) -1, (INT32) -1);
- return ((INT32) MSGRETRY);
- }
- /* Poll for user interrupt */
- SIGINT_POLL
- /* check if timed out */
- if (timeout >= TimeOut) {
- if (MsgFile) {
- fprintf(MsgFile,"Timed out before ACK received. Reset comm. retries=%d timeout=%ld\n",retries, timeout);
- fflush(MsgFile);
- }
- (void) reset_comm_serial((INT32) 0, (INT32) 0);
- continue;
- }
-
- ack = (INT32) Rx_ack[1];
-
- /* endian convert Ack */
- if (tip_target_config.TipEndian != tip_target_config.P29KEndian)
- tip_convert32((BYTE *) &ack);
-
- if (Rx_ack[0] == (INT32) 0xFFFFFFFF && ack != CHECKSUM_FAIL) {
- return(0); /* successful send */
- }
- else {
- (void) reset_comm_serial((INT32) 0, (INT32) 0);
- if (MsgFile) { /* log the error */
- fprintf(MsgFile,
- "\n** Checksum: Nack Received, Resending.\n");
- fflush(MsgFile);
- };
- }
-
- } while ( retries < MessageRetries);
- return ((INT32) FAILURE);
-}
-
-INT32
-msg_recv_serial(msg_ptr, port_base, Mode)
- union msg_t *msg_ptr;
- INT32 port_base;
- INT32 Mode; /* Block or NonBlock */
- {
- union ack_msg_buf_t AckMsg;
- UINT32 checksum_calc, checksum_recv;
- INT32 i, result;
- INT32 comm_err;
- INT32 ack_hdr;
- BYTE *bfr_ptr;
- INT32 header_size;
- INT32 length, total_length;
-
-again:
- /* Poll for user interrupt */
- SIGINT_POLL
-
- comm_err = (INT32) 0;
- ack_hdr = (INT32) ACK_HDR_CODE;
- bfr_ptr = (BYTE *) msg_ptr;
- header_size = (2 * sizeof(INT32));
-
- /* recv header - if available */
- if (Mode == NONBLOCK) {
-#ifndef MSDOS
- for (bcount = 0; bcount < BlockCount; bcount++);
-#endif
- result = recv_bfr_serial(bfr_ptr, header_size, Mode,
- port_base, &comm_err);
- /* printf("nbread: result = 0x%lx Mode=0x%lx\n", result, Mode); */
- } else {
- /* printf("bread: header_size = %d Mode=0x%lx\n", header_size, Mode); */
- result = recv_bfr_serial(bfr_ptr, header_size, Mode,
- port_base, &comm_err);
- if (result == (INT32) -1) {
-#ifndef MSDOS
- for (bcount = 0; bcount < BlockCount; bcount++);
-#endif
- goto again;
- }
- }
- if (comm_err != (INT32) 0) {
- (void) reset_comm_serial ((INT32) -1, (INT32) -1);
- send_nack(port_base);
- goto again;
- }
- if (result != (INT32) 0)
- return((INT32) FAILURE);
-
- /* Poll for user interrupt */
- SIGINT_POLL
- /*
- * Before computing the length here, we should make sure that we have
- * received a valid (defined) MiniMON29K message by checking the
- * Message Code field. Otherwise, a lousy stream of bytes could send this
- * to a toss waiting for an unknown number of bytes.
- * But we hope none of those things would happen here!
- */
- result = msg_ptr->generic_msg.code;
- if (tip_target_config.TipEndian != tip_target_config.P29KEndian)
- tip_convert32((BYTE *) &result);
- if ((result < (INT32) 0) || (result > 101)) {
- (void) reset_comm_serial ((INT32) -1, (INT32) -1);
- send_nack(port_base);
- goto again; /* retry */
- }
- /* Message header received. Save message length. */
- length = msg_ptr->generic_msg.length;
- if (tip_target_config.TipEndian != tip_target_config.P29KEndian)
- tip_convert32((BYTE *) &length);
-
- /*
- * MiniMON29K release 2.1 has new Communications Interface module
- * which does not expect the checksum to be aligned on a word
- * boundary. It expects the checksum to immediately follow the
- * end of the message body.
- * The old handler aligned the checksum on the next word boundar after
- * the message body, but did _not_ update the message length field.
- * That caused problems when one end of the Communications gets
- * changed.
- */
- if (((tip_target_config.version >> 24) & 0xf) > 5) { /* new comm handler */
- } else { /* old comm handler */
- /* round length up to even word */
- if ((length & 3) != 0) {
- length = length + 3;
- length = length & 0xfffffffc;
- }
- }
-
- /* committed now - recv rest of msg and checksum */
- comm_err = (INT32) 0;
- result = (INT32) 0;
- if (length >= 0) {
- result = recv_bfr_serial(bfr_ptr + header_size, length+4,/* +4 */
- BLOCK, port_base, &comm_err);
- }
-
- if (comm_err != (INT32) 0) {
- (void) reset_comm_serial ((INT32) -1, (INT32) -1);
- send_nack(port_base);
- goto again; /* retry */
- }
- if (result != (INT32) 0) {
- (void) reset_comm_serial ((INT32) -1, (INT32) -1);
- send_nack(port_base);
- goto again; /* retry */
- }
-
-
- /* Do endian conversion */
- if (tip_target_config.TipEndian != tip_target_config.P29KEndian)
- endian_cvt(msg_ptr, INCOMING_MSG);
-
- /* calc checksum for msg */
- checksum_calc = 0;
- total_length = header_size + length;
- for (i=0; i < total_length; i++)
- checksum_calc = checksum_calc + ((UINT32) bfr_ptr[i]);
-
- checksum_recv = (UINT32) 0;
- checksum_recv = (UINT32) (checksum_recv | ((UINT32) bfr_ptr[total_length] << 24));
- checksum_recv = (UINT32) (checksum_recv | ((UINT32) bfr_ptr[total_length+1] << 16));
- checksum_recv = (UINT32) (checksum_recv | ((UINT32) bfr_ptr[total_length+2] << 8));
- checksum_recv = (UINT32) (checksum_recv | ((UINT32) bfr_ptr[total_length+3] << 0));
-
- /* Poll for user interrupt */
- SIGINT_POLL
- /* Compare Checksums */
- if (checksum_calc != checksum_recv) {
- (void) reset_comm_serial ((INT32) -1, (INT32) -1);
- send_nack(port_base);
- goto again; /* retry */
- }
-
- /* send checksum hdr & ack */
- AckMsg.ack_msg.code = (INT32) ACK_HDR_CODE;
- AckMsg.ack_msg.passfail = CHECKSUM_PASS;
- result = (INT32) 0;
- comm_err = (INT32) 0;
-#ifdef MSDOS
- if (use_parport) {
- result = par_write ((char *) AckMsg.buf, 8);
- } else {
- result = send_bfr_serial((BYTE *) AckMsg.buf, 2 * sizeof(INT32),
- port_base, &comm_err);
- if (comm_err != (INT32) 0) {
- (void) reset_comm_serial ((INT32) -1, (INT32) -1);
- send_nack(port_base);
- goto again; /* retry */
- }
- if (result != (INT32) 0) {
- if (MsgFile) {
- fprintf(MsgFile, "Couldn't send checksum to acknowledge.\n");
- fflush (MsgFile);
- }
- (void) reset_comm_serial((INT32) -1, (INT32) -1);
- send_nack(port_base);
- goto again; /* retry */
- }
- }
-#else
- result = send_bfr_serial((BYTE *) AckMsg.buf, 2 * sizeof(INT32),
- port_base, &comm_err);
- if (comm_err != (INT32) 0) {
- (void) reset_comm_serial ((INT32) -1, (INT32) -1);
- send_nack(port_base);
- goto again; /* retry */
- }
- if (result != (INT32) 0) {
- if (MsgFile) {
- fprintf(MsgFile, "Couldn't send checksum to acknowledge.\n");
- fflush (MsgFile);
- }
- (void) reset_comm_serial((INT32) -1, (INT32) -1);
- send_nack(port_base);
- goto again; /* retry */
- }
-#endif
-
- return(msg_ptr->generic_msg.code); /* passed */
-}
-
-void
-SendACK(port_base)
- INT32 port_base;
- {
- union ack_msg_buf_t AckMsg;
- INT32 result, comm_err;
- INT32 ack_hdr = (INT32) ACK_HDR_CODE;
- INT32 ack = CHECKSUM_FAIL;
-
- AckMsg.ack_msg.code = (INT32) ACK_HDR_CODE;
- AckMsg.ack_msg.passfail = CHECKSUM_PASS;
- result = (INT32) 0;
- comm_err = (INT32) 0;
-#ifdef MSDOS
- if (use_parport) {
- result = par_write((char *) AckMsg.buf, 8);
- return;
- } else {
- result = send_bfr_serial((BYTE *) AckMsg.buf, 2*sizeof(INT32),
- port_base, &comm_err);
- if ((result != (INT32) 0) || (comm_err != (INT32) 0)) {
- if (MsgFile) {
- fprintf(MsgFile, "Couldn't send ACK to remote.\n");
- fflush (MsgFile);
- }
- return ;
- }
- }
-#else
- result = send_bfr_serial((BYTE *) AckMsg.buf, 2*sizeof(INT32),
- port_base, &comm_err);
- if ((result != (INT32) 0) || (comm_err != (INT32) 0)) {
- if (MsgFile) {
- fprintf(MsgFile, "Couldn't send ACK to remote.\n");
- fflush (MsgFile);
- }
- return ;
- }
-#endif
-}
-
-void
-send_nack(port_base)
- INT32 port_base;
- {
- union ack_msg_buf_t NAckMsg;
- INT32 result, comm_err;
- INT32 ack_hdr = (INT32) ACK_HDR_CODE;
- INT32 ack = CHECKSUM_FAIL;
-
- /* eat up any incoming characters */
- result = reset_comm_serial(port_base, port_base); /* reset buffer */
-
- if (MsgFile) { /* log the error */
- fprintf(MsgFile,
- "\n** Checksum: Receive failed, sending Nack.\n");
- fflush(MsgFile);
- };
-
- /* Poll for user interrupt */
- SIGINT_POLL
- NAckMsg.ack_msg.code = (INT32) ACK_HDR_CODE;
- NAckMsg.ack_msg.passfail = CHECKSUM_FAIL;
- result = (INT32) 0;
- comm_err = (INT32) 0;
-#ifdef MSDOS
- if (use_parport) {
- result = par_write((char *) NAckMsg.buf, 8);
- return;
- } else {
- result = send_bfr_serial((BYTE *) NAckMsg.buf, 2*sizeof(INT32),
- port_base, &comm_err);
- if ((result != (INT32) 0) || (comm_err != (INT32) 0)) {
- if (MsgFile) {
- fprintf(MsgFile, "Couldn't send NACK to remote.\n");
- fflush (MsgFile);
- }
- return ;
- }
- }
-#else
- result = send_bfr_serial((BYTE *) NAckMsg.buf, 2*sizeof(INT32),
- port_base, &comm_err);
- if ((result != (INT32) 0) || (comm_err != (INT32) 0)) {
- if (MsgFile) {
- fprintf(MsgFile, "Couldn't send NACK to remote.\n");
- fflush (MsgFile);
- }
- return ;
- }
-#endif
-}
+++ /dev/null
-static char _[] = "@(#)eb030.c 5.20 93/10/26 09:57:05, Srini, AMD.";
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- ** This file defines functions which initialize and access the
- ** the EB030 "Lynx" board. This file is based heavily on the
- ** eb29k.c file.
- *****************************************************************************
- */
-
-#include <memory.h>
-#include <string.h>
-#include "eb030.h"
-#include "types.h"
-#include "memspcs.h"
-#include "macros.h"
-#include "mtip.h"
-#include "tdfunc.h"
-
-
-#include <conio.h>
-#include <dos.h>
-void endian_cvt PARAMS((union msg_t *, int));
-void tip_convert32 PARAMS((BYTE *));
-
-/*
-** Global variables
-*/
-
-
-
-/*
-** This function is used to initialize the communication
-** channel. This consists of setting the window location
-** of the EB030 to the value defined by the values in
-** the file eb030.h.
-*/
-
-INT32
-init_comm_eb030(PC_port_base, PC_mem_seg)
-INT32 PC_port_base;
-INT32 PC_mem_seg;
- {
- int result;
-
- /*** check for existence of the board ***/
-
- /* Set up memory window location */
- result = outp((unsigned int) PC_port_base,
- ((int) ((PC_mem_seg >> 10) & 0x1f)));
-
- /* Set up window base to zero */
- outp ((unsigned int) (PC_port_base+1), (unsigned int) 0);
- outp ((unsigned int) (PC_port_base+2), (unsigned int) 0);
-
- return(SUCCESS);
- } /* end init_comm_eb030() */
-
-
-/*
-** This function is used to send a message to the EB030.
-** If the message is successfully sent, a zero is
-** returned. If the message was not sendable, a -1
-** is returned.
-**
-** Also note that this function does endian conversion on the
-** returned message. This is necessary because the Am29000
-** target will be sending big-endian messages and the PC will
-** be expecting little-endian.
-*/
-
-INT32
-msg_send_eb030(msg_ptr, PC_port_base)
- union msg_t *msg_ptr;
-INT32 PC_port_base;
- {
- INT32 result;
- INT32 message_size;
-
-#if 0
-INT32 semaphore;
- /* Set semaphore (EB030_RECV_BUF_PTR) to zero */
- semaphore = 0;
- result = Mini_write_memory((INT32) D_MEM,
- (ADDR32) EB030_RECV_BUF_PTR,
- (INT32) sizeof (INT32),
- (BYTE *) &semaphore);
-#endif
-
- /* Get size of whole message */
- message_size = (msg_ptr->generic_msg).length + (2 * sizeof(INT32));
-
- /* Is the size of the message valid? */
-
- /* Do endian conversion */
- if (tip_target_config.TipEndian != tip_target_config.P29KEndian)
- endian_cvt(msg_ptr, OUTGOING_MSG);
-
- /* Send message */
- result = Mini_write_memory((INT32) D_MEM,
- (ADDR32) EB030_SEND_BUF,
- (INT32) message_size,
- (BYTE *) msg_ptr);
-
- if (result != (INT32) 0)
- return(FAILURE);
-
- /* Interrupt target (write to EB030 mailbox) */
- result = outp((unsigned int) (PC_port_base+3),
- (int) 0x00);
-
- return(SUCCESS);
-
- } /* end msg_send_eb030() */
-
-
-
-
-/*
-** This function is used to receive a message to the EB030.
-** If the message is waiting in the buffer, a zero is
-** returned and the buffer pointed to by msg_ptr is filled
-** in. If no message was available, a -1 is returned.
-**
-** Note that this function does endian conversion on the
-** returned message. This is necessary because the Am29000
-** target will be sending big-endian messages and the PC will
-** be expecting little-endian.
-*/
-
-INT32
-msg_recv_eb030(msg_ptr, PC_port_base, Mode)
- union msg_t *msg_ptr;
-INT32 PC_port_base;
-INT32 Mode;
- {
- INT32 result;
- ADDR32 recv_buf_addr;
- INT32 parms_length;
- INT32 header_size;
- INT32 semaphore;
- int retval;
-
- /* Poll EB030 mailbox */
- /* (If mailbox contains 0xff, a message is waiting) */
- retval = inp((unsigned int) (PC_port_base+3));
-
- /* If no message waiting, return -1 */
- if (retval != 0xff)
- return (-1);
-
- /* Get receive buffer address */
- result = Mini_read_memory ((INT32) D_MEM,
- (ADDR32) EB030_RECV_BUF_PTR,
- (INT32) sizeof (ADDR32),
- (BYTE *) &recv_buf_addr);
-
- if (result != (INT32) 0)
- return(FAILURE);
-
- /* Change endian of recv_buf_addr (if necessary) */
- if (tip_target_config.TipEndian != tip_target_config.P29KEndian)
- tip_convert32((BYTE *) &recv_buf_addr);
-
- if (recv_buf_addr == (ADDR32) 0) {
- return (FAILURE);
- } else {
- /* Get message header */
- header_size = (INT32) (2 * sizeof(INT32));
- result = Mini_read_memory ((INT32) D_MEM,
- (ADDR32) recv_buf_addr,
- (INT32) header_size,
- (BYTE *) msg_ptr);
-
- if (result != 0)
- return(FAILURE);
-
- /* Get rest of message */
- parms_length = (msg_ptr->generic_msg).length;
-
- if (tip_target_config.TipEndian != tip_target_config.P29KEndian)
- tip_convert32((BYTE *) &parms_length);
-
- /* Is the size of the message valid? */
-
- result = Mini_read_memory ((INT32) D_MEM,
- (ADDR32) (recv_buf_addr + header_size),
- (INT32) parms_length,
- (BYTE *) &(msg_ptr->generic_msg.byte));
- if (result != 0)
- return(FAILURE);
-
- /* Do endian conversion (if necessary) */
- if (tip_target_config.TipEndian != tip_target_config.P29KEndian)
- endian_cvt(msg_ptr, INCOMING_MSG);
-
- /* Write 0xff to EB030 mailbox */
- /* (This tells EB030 that message has been received) */
- retval = outp((unsigned int) (PC_port_base+3), (int) 0xff);
-
- /* Set semaphore (EB030_RECV_BUF_PTR) to zero */
- semaphore = 0;
- result = Mini_write_memory((INT32) D_MEM,
- (ADDR32) EB030_RECV_BUF_PTR,
- (INT32) sizeof (INT32),
- (BYTE *) &semaphore);
-
- if (result != 0)
- return(FAILURE);
-
- return((INT32) msg_ptr->generic_msg.code);
- }
-} /* end msg_recv_eb030() */
-
-
-
-
-/*
-** This function is used to reset the communication
-** channel. This is used when resyncing the host and
-** target and when exiting the monitor.
-*/
-
-INT32
-exit_comm_eb030(PC_port_base, PC_mem_seg)
-INT32 PC_port_base;
-INT32 PC_mem_seg;
- {
- return(0);
- }
-
-INT32
-reset_comm_eb030(PC_port_base, PC_mem_seg)
-INT32 PC_port_base;
-INT32 PC_mem_seg;
- {
-
- /* Set up memory window location */
- outp((unsigned int) PC_port_base,
- ((int) ((PC_mem_seg >> 10) & 0x1f)));
-
- /* Set up window base to zero */
- outp ((unsigned int) (PC_port_base+1), (unsigned int) 0);
- outp ((unsigned int) (PC_port_base+2), (unsigned int) 0);
-
- return(0);
-
- } /* end reset_comm_eb030() */
-
-
-
-/*
-** This function is used to "kick" the EB030. This
-** amounts to yanking the *RESET line low. Code
-** will begin execution at ROM address 0.
-*/
-
-void
-go_eb030(PC_port_base, PC_mem_seg)
-INT32 PC_port_base;
-INT32 PC_mem_seg;
- {
- int result;
-
- /* Toggle the RESET bit in Control Port Register 0 */
- result = outp((unsigned int) PC_port_base,
- ((int) ((PC_mem_seg >> 10) & 0x1f)));
- result = outp((unsigned int) PC_port_base,
- ((int) (((PC_mem_seg >> 10) & 0x1f) |
- EB030_RESET)));
-
- } /* end go_eb030() */
-
-
-
-/*
-** This function is used to write a string of bytes to
-** the Am29000 memory on the EB030 board.
-**
-*/
-
-INT32
-write_memory_eb030(memory_space, address, data, byte_count, PC_port_base, PC_mem_seg)
- INT32 memory_space;
- ADDR32 address;
- BYTE *data;
- INT32 byte_count;
- INT32 PC_port_base;
- INT32 PC_mem_seg;
- {
- INT32 bytes_in_window;
- INT32 copy_count;
-
- while (byte_count > 0) {
-
- /* Write out low order EB030_addr bits */
- outp((unsigned int) (PC_port_base+1), (int) ((address >> 14) & 0xff));
- /* Write out high order EB030_addr bits I-/D-Mem are same */
- outp((unsigned int) (PC_port_base+2), (int) ((address >> 22) & 0x7f));
-
- bytes_in_window = 0x4000 - (address & 0x3fff);
- copy_count = MIN(byte_count, bytes_in_window);
-
- (void) memmove ((void *) ((PC_mem_seg << 16) + (address & 0x3fff)),
- (void *) data,
- (size_t) copy_count);
-#if 0
- (void) movedata((unsigned int) FP_SEG(data),
- (unsigned int) FP_OFF(data),
- (unsigned int) PC_mem_seg,
- (unsigned int) (address & 0x3fff),
- (int) copy_count);
-#endif
-
- data = data + copy_count;
- address = address + copy_count;
- byte_count = byte_count - copy_count;
-
- } /* end while loop */
-
- return(SUCCESS);
-
- } /* End write_memory_eb030() */
-
-
-
-
-/*
-** This function is used to read a string of bytes from
-** the Am29000 memory on the EB030 board. A zero is
-** returned if the data is read successfully, otherwise
-** a -1 is returned.
-**
-*/
-
-INT32
-read_memory_eb030(memory_space, address, data, byte_count, PC_port_base, PC_mem_seg)
- INT32 memory_space;
- ADDR32 address;
- BYTE *data;
- INT32 byte_count;
- INT32 PC_port_base;
- INT32 PC_mem_seg;
- {
- INT32 bytes_in_window;
- INT32 copy_count;
-
- while (byte_count > 0) {
-
- /* Write out low order EB030_addr bits */
- outp((unsigned int) (PC_port_base+1), (int) ((address >> 14) & 0xff));
- /* Write out high order EB030_addr bits I/D are same */
- outp((unsigned int) (PC_port_base+2), (int) ((address >> 22) & 0x7f));
-
- bytes_in_window = 0x4000 - (address & 0x3fff);
- copy_count = MIN(byte_count, bytes_in_window);
-
-#if 0
- (void) memmove ((void *) data,
- (void *) ((PC_mem_seg << 16) + (address & 0x3fff)),
- (size_t) copy_count);
-#endif
- (void) movedata((unsigned int) PC_mem_seg,
- (unsigned int) (address & 0x3fff),
- (unsigned int) FP_SEG(data),
- (unsigned int) FP_OFF(data),
- (int) copy_count);
-
- data = data + copy_count;
- address = address + copy_count;
- byte_count = byte_count - copy_count;
-
- } /* end while loop */
-
- return(SUCCESS);
-
- } /* End read_memory_eb030() */
-
-INT32
-fill_memory_eb030()
-{
- return(SUCCESS);
-}
+++ /dev/null
-static char _[] = "@(#)eb29k.c 5.20 93/10/26 09:57:07, Srini, AMD.";
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- * This module implements the communications interface between MONTIP and
- * AMD's EB29K PC plug-in card.
- *****************************************************************************
- */
-
-#include <memory.h>
-#include <string.h>
-#include "eb29k.h"
-#include "types.h"
-#include "memspcs.h"
-#include "macros.h"
-#include "mtip.h"
-#include "tdfunc.h"
-
-#include <conio.h>
-#include <dos.h>
-
-void endian_cvt PARAMS((union msg_t *, int));
-void tip_convert32 PARAMS ((BYTE *));
-
-/*
-** This function is used to initialize the communication
-** channel. This consists of setting the window location
-** of the EB29K to the value defined by the values in
-** the file eb29k.h.
-*/
-
-INT32
-init_comm_eb29k(port_base, mem_seg)
-INT32 port_base;
-INT32 mem_seg;
- {
- int result;
-
- /*** check for existence of the board ***/
-
- /* Set up memory window location */
- result = outp((unsigned int) port_base,
- ((int) ((mem_seg >> 10) & 0x1f)));
- /* Set base address to zero */
- outp ((unsigned int) (port_base+1), (unsigned int) 0);
- outp ((unsigned int) (port_base+2), (unsigned int) 0);
-
- return(0);
- } /* end init_comm_eb29k() */
-
-
-/*
-** This function is used to send a message to the EB29K.
-** If the message is successfully sent, a zero is
-** returned. If the message was not sendable, a -1
-** is returned.
-**
-** Also note that this function does endian conversion on the
-** returned message. This is necessary because the Am29000
-** target will be sending big-endian messages and the PC will
-** be expecting little-endian.
-*/
-
-INT32
-msg_send_eb29k(msg_ptr, port_base)
- union msg_t *msg_ptr;
- INT32 port_base;
- {
- INT32 result;
- INT32 message_size;
-
-#if 0
- INT32 semaphore;
- /* Set semaphore (EB29K_RECV_BUF_PTR) to zero */
- semaphore = 0;
- result = Mini_write_memory ((INT32) D_MEM,
- (ADDR32) EB29K_RECV_BUF_PTR,
- (INT32) sizeof(INT32),
- (BYTE *) &semaphore);
-#endif
-
- /* Get size of whole message */
- message_size = (msg_ptr->generic_msg).length + (2 * sizeof(INT32));
-
- /* Do endian conversion */
- if (tip_target_config.TipEndian != tip_target_config.P29KEndian)
- endian_cvt(msg_ptr, OUTGOING_MSG);
-
- /* Send message */
- result = Mini_write_memory ((INT32) D_MEM,
- (ADDR32) EB29K_SEND_BUF,
- (INT32) message_size,
- (BYTE *) msg_ptr);
-
- if (result != 0)
- return(-1);
-
- /* Interrupt target (write to EB29K mailbox) */
- result = outp((unsigned int) (port_base+3),
- (int) 0x00);
-
- return(0);
-
- } /* end msg_send_eb29k() */
-
-
-/*
-** This function is used to receive a message to the EB29K.
-** If the message is waiting in the buffer, a zero is
-** returned and the buffer pointed to by msg_ptr is filled
-** in. If no message was available, a -1 is returned.
-**
-** Note that this function does endian conversion on the
-** returned message. This is necessary because the Am29000
-** target will be sending big-endian messages and the PC will
-** be expecting little-endian.
-*/
-
-INT32
-msg_recv_eb29k(msg_ptr, port_base, Mode)
- union msg_t *msg_ptr;
- INT32 port_base;
- INT32 Mode;
- {
- INT32 result;
- ADDR32 recv_buf_addr;
- INT32 parms_length;
- INT32 header_size;
- INT32 semaphore;
- int retval;
-
-
- /* Poll EB29K mailbox */
- /* (If mailbox contains 0xff, a message is waiting) */
- retval = inp((unsigned int) (port_base+3));
-
- /* If no message waiting, return -1 */
- if (retval != 0xff)
- return (-1);
-
- /* Get receive buffer address */
- result = Mini_read_memory ((INT32) D_MEM,
- (ADDR32) EB29K_RECV_BUF_PTR,
- (INT32) sizeof(ADDR32),
- (BYTE *) &recv_buf_addr);
-
- if (result != 0) return(-1);
-
- /* Change endian of recv_buf_addr (if necessary) */
- if (tip_target_config.TipEndian != tip_target_config.P29KEndian)
- tip_convert32((BYTE *) &recv_buf_addr);
-
- if (recv_buf_addr == 0) return(-1);
-
- /* Get message header */
- header_size = (INT32) (2 * sizeof(INT32));
- result = Mini_read_memory ((INT32) D_MEM,
- (ADDR32) recv_buf_addr,
- (INT32) header_size,
- (BYTE *) msg_ptr);
-
- if (result != 0) return(-1);
-
- /* Get rest of message */
- parms_length = (msg_ptr->generic_msg).length;
- if (tip_target_config.TipEndian != tip_target_config.P29KEndian)
- tip_convert32((BYTE *) &parms_length);
- result = Mini_read_memory ((INT32) D_MEM,
- (ADDR32) (recv_buf_addr + header_size),
- (INT32) parms_length,
- (BYTE *) &(msg_ptr->generic_msg.byte));
-
- if (result != 0) return(-1);
-
- /* Do endian conversion */
- if (tip_target_config.TipEndian != tip_target_config.P29KEndian)
- endian_cvt(msg_ptr, INCOMING_MSG);
-
- /* Write 0xff to EB29K mailbox */
- /* (This tells EB29K that message has been received) */
- retval = outp((unsigned int) (port_base+3), (int) 0xff);
-
- /* Set semaphore (EB29K_RECV_BUF_PTR) to zero */
- semaphore = 0;
- result = Mini_write_memory ((INT32) D_MEM,
- (ADDR32) EB29K_RECV_BUF_PTR,
- (INT32) sizeof(INT32),
- (BYTE *) &semaphore);
-
- if (result != 0) return(-1);
-
- return(msg_ptr->generic_msg.code);
- } /* end msg_recv_eb29k() */
-
-/*
-** This function is used to reset the communication
-** channel. This is used when resyncing the host and
-** target and when exiting the monitor.
-*/
-
-INT32
-exit_comm_eb29k(PC_port_base, PC_mem_seg)
-INT32 PC_port_base;
-INT32 PC_mem_seg;
- {
- return (0);
- }
-
-INT32
-reset_comm_eb29k(PC_port_base, PC_mem_seg)
-INT32 PC_port_base;
-INT32 PC_mem_seg;
- {
-
- /* Set up memory window location */
- outp((unsigned int) PC_port_base,
- ((int) ((PC_mem_seg >> 10) & 0x1f)));
- /* Set base address to zero */
- outp ((unsigned int) (PC_port_base+1), (unsigned int) 0);
- outp ((unsigned int) (PC_port_base+2), (unsigned int) 0);
- return(0);
- } /* end reset_comm_eb29k() */
-
-
-INT32
-fill_memory_eb29k()
- {
- return(0);
- }
-
-
-
-/*
-** This function is used to "kick" the EB29K. This
-** amounts to yanking the *RESET line low. Code
-** will begin execution at ROM address 0.
-*/
-
-void
-go_eb29k(port_base, mem_seg)
-INT32 port_base;
-INT32 mem_seg;
- {
- int result;
-
- /* Toggle the RESET bit in Control Port Register 0 */
- result = outp((unsigned int) port_base,
- ((int) ((mem_seg >> 10) & 0x1f)));
- result = outp((unsigned int) port_base,
- ((int) (((mem_seg >> 10) & 0x1f) |
- EB29K_RESET)));
-
- } /* end go_eb29k() */
-
-
-
-/*
-** This function is used to write a string of bytes to
-** the Am29000 memory on the EB29K board.
-**
-*/
-
-INT32
-write_memory_eb29k(memory_space, address, data, byte_count, port_base, mem_seg)
- INT32 memory_space;
- ADDR32 address;
- BYTE *data;
- INT32 byte_count;
- INT32 port_base;
- INT32 mem_seg;
- {
- INT32 bytes_in_window;
- INT32 copy_count;
- unsigned char MSbit;
-
- if (address & 0x80000000)
- MSbit = 0x80;
- else
- MSbit = 0x00;
-
- while (byte_count > 0) {
-
- /* Write out low order EB29K_addr bits */
- outp((unsigned int) (port_base+1), (int) ((address >> 14) & 0xff));
- /* Write out high order EB29K_addr bits */
- outp((unsigned int) (port_base+2), (int) (((address >> 22) & 0x7f) | MSbit));
-
- bytes_in_window = 0x4000 - (address & 0x3fff);
- copy_count = MIN(byte_count, bytes_in_window);
-
- (void) memmove ((void *) ((mem_seg << 16) + (address & 0x3fff)),
- (void *) data,
- (size_t) copy_count);
-#if 0
- (void) movedata((unsigned int) FP_SEG(data),
- (unsigned int) FP_OFF(data),
- (unsigned int) mem_seg,
- (unsigned int) (address & 0x3fff),
- (int) copy_count);
-#endif
-
- data = data + copy_count;
- address = address + copy_count;
- byte_count = byte_count - copy_count;
-
- } /* end while loop */
-
- return(0);
-
- } /* End write_memory_eb29k() */
-
-
-/*
-** This function is used to read a string of bytes from
-** the Am29000 memory on the EB29K board. A zero is
-** returned if the data is read successfully, otherwise
-** a -1 is returned.
-**
-*/
-
-INT32
-read_memory_eb29k(memory_space, address, data, byte_count, port_base, mem_seg)
- INT32 memory_space;
- ADDR32 address;
- BYTE *data;
- INT32 byte_count;
- INT32 port_base;
- INT32 mem_seg;
- {
- INT32 bytes_in_window;
- INT32 copy_count;
- unsigned char MSbit;
-
- if (address & 0x80000000)
- MSbit = 0x80;
- else
- MSbit = 0x00;
-
- while (byte_count > 0) {
-
- /* Write out low order EB29K_addr bits */
- outp((unsigned int) (port_base+1), (int) ((address >> 14) & 0xff));
- /* Write out high order EB29K_addr bits */
- outp((unsigned int) (port_base+2), (int) (((address >> 22) & 0x7f) | MSbit));
-
- bytes_in_window = 0x4000 - (address & 0x3fff);
- copy_count = MIN(byte_count, bytes_in_window);
-
-#if 0
- (void) memmove ((void *) data,
- (void *) ((mem_seg << 16) + (address & 0x3fff)),
- (size_t) copy_count);
-#endif
- (void) movedata((unsigned int) mem_seg,
- (unsigned int) (address & 0x3fff),
- (unsigned int) FP_SEG(data),
- (unsigned int) FP_OFF(data),
- (int) copy_count);
-
- data = data + copy_count;
- address = address + copy_count;
- byte_count = byte_count - copy_count;
-
- } /* end while loop */
-
- return(0);
-
- } /* End read_memory_eb29k() */
-
+++ /dev/null
-static char _[] = "@(#)endian.c 5.18 93/07/30 16:40:17, Srini, AMD.";
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- **
- ** This module implements the endian conversion routines used by MONTIP.
- **
- *****************************************************************************
- */
-
-#include <stdio.h>
-#include <ctype.h>
-#include "messages.h"
-
-#ifdef MSDOS
-#include <string.h>
-#else
-#include <string.h>
-#endif /* MSDOS */
-
-/* Functions */
-void tip_convert32 PARAMS((BYTE *));
-void tip_convert16 PARAMS((BYTE *));
-
-/*
-** This function is used to convert the endian of messages.
-** Both host to target and target to host messages can be
-** converted using this function.
-**
-** Note that all monitor messages have a header consisting of
-** a 32 bit message number and a 32 bit size. Following this
-** may be one or more 32 bit parameters. And folowing these
-** parameters may be an array of bytes.
-**
-** This function converts the endian of the header and any
-** parameters. It is not necessary to convert the array of
-** bytes.
-**
-** Note that the use of 32 bit parameters makes this conversion
-** routine fairly simple.
-*/
-
-void
-endian_cvt(msg_buf, direction)
- union msg_t *msg_buf;
- int direction;
- {
- INT32 i;
- BYTE *byte;
- INT32 code;
- INT32 length;
-
-
- /*
- ** If incoming message, convert endian, then get message
- ** type and message length. If outgoing message, get
- ** message type and message length, then convert endian.
- */
-
- if ((direction != OUTGOING_MSG) &&
- (direction != INCOMING_MSG))
- return;
-
- if (direction == OUTGOING_MSG) {
- code = (msg_buf->generic_msg).code;
- length = (msg_buf->generic_msg).length;
- }
-
- /* Change endian of "code" field */
- tip_convert32((BYTE *) &(msg_buf->generic_msg).code);
-
- /* Change endian of "length" field */
- tip_convert32((BYTE *) &(msg_buf->generic_msg).length);
-
- if (direction == INCOMING_MSG) {
- code = (msg_buf->generic_msg).code;
- length = (msg_buf->generic_msg).length;
- }
-
- /*
- ** Some messages, notably WRITE_REQ, FILL, READ
- ** and TRACE have data following the message
- ** parameters. Since we don't want to swap bytes
- ** in the data array, we need to get the number of
- ** of bytes taken up by the parameters. This is
- ** still better than having to find ALL of the
- ** message lengths statically.
- */
-
- if (code == WRITE_REQ)
- length = msg_length(WRITE_REQ);
- else
- if (code == FILL)
- length = MSG_LENGTH(struct fill_msg_t);
- else
- if (code == READ_ACK)
- length = MSG_LENGTH(struct read_ack_msg_t);
- else
- if (code == CHANNEL1)
- length = MSG_LENGTH(struct channel1_msg_t);
- else
- if (code == CHANNEL2)
- length = MSG_LENGTH(struct channel2_msg_t);
- else
- if (code == CHANNEL0)
- length = MSG_LENGTH(struct channel0_msg_t);
- else
- if (code == STDIN_NEEDED_ACK)
- length = MSG_LENGTH(struct stdin_needed_ack_msg_t);
-
- /* Convert message parameters */
-
- byte = (BYTE *) &(msg_buf->generic_msg).byte;
- for (i=0; i<(length/sizeof(INT32)); i=i+1) {
- tip_convert32(byte);
- byte = byte + sizeof(INT32);
- }
-
- } /* end endian_cvt */
-
-
-/*
-** This function is used to swap the bytes in a 32 bit
-** word. This will convert "little endian" (IBM-PC / Intel)
-** words to "big endian" (Sun / Motorola) words.
-*/
-
-
-void
-tip_convert32(byte)
- BYTE *byte;
- {
- BYTE temp;
-
- temp = byte[0]; /* Swap bytes 0 and 3 */
- byte[0] = byte[3];
- byte[3] = temp;
- temp = byte[1]; /* Swap bytes 1 and 2 */
- byte[1] = byte[2];
- byte[2] = temp;
- } /* end tip_convert32() */
-
-
-/*
-** This function is used to swap the bytes in a 16 bit
-** word. This will convert "little endian" (IBM-PC / Intel)
-** half words to "big endian" (Sun / Motorola) half words.
-*/
-
-void
-tip_convert16(byte)
- BYTE *byte;
- {
- BYTE temp;
-
- temp = byte[0]; /* Swap bytes 0 and 1 */
- byte[0] = byte[1];
- byte[1] = temp;
-
- } /* end tip_convert16() */
+++ /dev/null
-static char _[] = "@(#)hif.c 5.19 93/10/26 11:33:19, Srini, AMD.";
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineers: Srini Subramanian.
- *****************************************************************************
- * This module implements the part of the HIF kernel implemented using the
- * host computer's operating system. This is invoked when a HIF_CALL message
- * is received by MONTIP. This module uses the Debugger/Monitor on the 29K
- * target for certain HIF services.
- * The results are sent back to the 29K Target using a HIF_CALL_RTN message.
- * If the Debugger is invoked, a GO message is sent first to switch the
- * context from the Debugger to the HIF kernel, and then the HIF_CALL_RTN
- * message is sent.
- *****************************************************************************
- */
-
-#include <stdio.h>
-#include <fcntl.h>
-#include <time.h>
-#include <errno.h>
-#include <memory.h>
-#include "types.h"
-#include "udiproc.h"
-
-#include "hif.h"
-
-#ifdef HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
-#ifdef HAVE_STRING_H
-# include <string.h>
-#else
-# include <strings.h>
-#endif
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#ifdef MSDOS
-#include <io.h>
-#include <sys\types.h>
-#include <sys\timeb.h>
-#else
-#include <sys/types.h>
-#include <sys/file.h>
-#include <sys/timeb.h>
-#endif
-
-#include "mtip.h" /* access to version numbers, etc. */
-#include "messages.h"
-
-INT32 UDI_write_string PARAMS((INT32, ADDR32, INT32, char *));
-INT32 UDI_read_string PARAMS((INT32, ADDR32, INT32, char *));
-
-INT32 hif_exit PARAMS((UINT32 lr2));
-INT32 hif_open PARAMS((UINT32 lr2, UINT32 lr3, UINT32 lr4, UINT32 *gr96));
-INT32 hif_close PARAMS((UINT32 lr2, UINT32 *gr96));
-INT32 hif_read PARAMS((UINT32 lr2, UINT32 lr3, UINT32 lr4, UINT32 *gr96));
-INT32 hif_write PARAMS((UINT32 lr2, UINT32 lr3, UINT32 lr4, UINT32 *gr96));
-INT32 hif_lseek PARAMS((UINT32 lr2, UINT32 lr3, UINT32 lr4, UINT32 *gr96));
-INT32 hif_remove PARAMS((UINT32 lr2, UINT32 *gr96));
-INT32 hif_rename PARAMS((UINT32 lr2, UINT32 lr3, UINT32 *gr96));
-INT32 hif_ioctl PARAMS((UINT32 lr2, UINT32 lr3));
-INT32 hif_iowait PARAMS((UINT32 lr2, UINT32 lr3));
-INT32 hif_iostat PARAMS((UINT32 lr2, UINT32 *gr96));
-INT32 hif_tmpnam PARAMS((UINT32 lr2, UINT32 *gr96));
-INT32 hif_time PARAMS((UINT32 *gr96));
-INT32 hif_getenv PARAMS((UINT32 lr2, UINT32 lr3, UINT32 *gr96));
-INT32 hif_gettz PARAMS((UINT32 *gr96, UINT32 *gr97));
-
-
-#ifdef MSDOS
-/* Stub out functions not available in MS-DOS */
-int ioctl(int x, int y);
-int ioctl(x, y) int x; int y; {return(0);}
-void kbd_raw() {return;}
-void kbd_restore() {return;}
-#endif
-
-/*
-** Globals
-*/
-
-#define TMP_BUF_SIZE 1024
-
-static char tmp_buffer[TMP_BUF_SIZE];
-
-static int com_error;
-
-
-/*
-** This function is the HIF service handler on the host. It receives
-** the HIF system call message as its only parameter. When
-** complete, GR96, GR97 and GR121 should be set to appropriate
-** values.
-**
-*/
-
-INT32
-service_HIF(service_number, lr2, lr3, lr4, gr96, gr97, gr121)
-UINT32 service_number;
-UINT32 lr2, lr3, lr4;
-UINT32 *gr96, *gr97, *gr121;
- {
- INT32 result;
-
- com_error = 0; /* reset */
- *gr121 = (UINT32) 0x80000000; /* success unless... */
-
- switch ((int) service_number) {
- case HIF_exit: result = hif_exit(lr2);
- break;
- case HIF_open: result = hif_open(lr2, lr3, lr4, gr96);
- break;
- case HIF_close: result = hif_close(lr2, gr96);
- break;
- case HIF_read: result = hif_read(lr2, lr3, lr4, gr96);
- break;
- case HIF_write: result = hif_write(lr2, lr3, lr4, gr96);
- break;
- case HIF_remove: result = hif_remove(lr2, gr96);
- break;
- case HIF_lseek: result = hif_lseek(lr2, lr3, lr4, gr96);
- break;
- case HIF_rename: result = hif_rename(lr2, lr3, gr96);
- break;
- case HIF_ioctl: result = hif_ioctl(lr2, lr3);
- break;
- case HIF_iowait: result = hif_iowait(lr2, lr3);
- break;
- case HIF_iostat: result = hif_iostat(lr2, gr96);
- break;
- case HIF_tmpnam: result = hif_tmpnam(lr2, gr96);
- break;
- case HIF_time: result = hif_time(gr96);
- break;
- case HIF_getenv: result = hif_getenv(lr2, lr3, gr96);
- break;
- case HIF_gettz: result = hif_gettz(gr96, gr97);
- break;
- default: *gr121 = (UINT32) HIF_EHIFUNDEF;
- return (SUCCESS);
- }
-
- /* Set gr121 if HIF error received */
- if (result != (INT32) 0)
- *gr121 = (UINT32) result;
-
- if (com_error)
- return ((INT32) -1); /* FAILURE */
- return(SUCCESS);
-
- } /* end service_HIF() */
-
-
-
-
-/*
-** HIF Services
-*/
-
-
-/*
-** Service 1 - exit
-**
-** Type Regs Contents Description
-** ---- ---- -------- -----------
-** Calling: gr121 1 (0x01) Service number
-** lr2 exitcode User-supplied exit code
-**
-** Returns: gr96 undefined Service does not return
-** gr121 undefined Service does not return
-**
-*/
-
-/* ARGSUSED */
-INT32
-hif_exit(lr2)
-UINT32 lr2;
- {
- return (0);
- } /* end hif_exit() */
-
-
-/*
-** Service 17 - open
-**
-** Type Regs Contents Description
-** ---- ---- -------- -----------
-** Calling: gr121 17 (0x11) Service number
-** lr2 pathname Pointer to a filename
-** lr3 mode See HIF Specification
-** lr4 pflag See HIF Specification
-**
-** Returns: gr96 fileno Success >= 0 (file descriptor)
-** Failure <0
-** gr121 0x80000000 Logical TRUE, service successful
-** errcode error number, service not
-** successful
-**
-*/
-
-INT32
-hif_open(lr2, lr3, lr4, gr96)
-UINT32 lr2, lr3, lr4;
-UINT32 *gr96;
- {
- INT32 result;
- int hif_mode;
- int host_mode;
- int hif_pflag;
- int fd;
- ADDR32 pathptr;
-
-
- pathptr = (ADDR32) lr2;
- hif_pflag = (int) lr4;
- hif_mode = (int) lr3;
-
- /*
- ** Note: The pflag is the same in BSD and MS-DOS.
- ** Unfortunately, the O_* flags for HIF, UNIX and MS-DOS
- ** are not the same. So we have to do the folowing:
- */
-
- host_mode = 0;
- if ((hif_mode & HIF_RDONLY) != 0)
- host_mode = host_mode | O_RDONLY;
- if ((hif_mode & HIF_WRONLY) != 0)
- host_mode = host_mode | O_WRONLY;
- if ((hif_mode & HIF_RDWR) != 0)
- host_mode = host_mode | O_RDWR;
- if ((hif_mode & HIF_APPEND) != 0)
- host_mode = host_mode | O_APPEND;
- if ((hif_mode & HIF_NDELAY) != 0)
- host_mode = host_mode | O_NDELAY;
- if ((hif_mode & HIF_CREAT) != 0)
- host_mode = host_mode | O_CREAT;
- if ((hif_mode & HIF_TRUNC) != 0)
- host_mode = host_mode | O_TRUNC;
- if ((hif_mode & HIF_EXCL) != 0)
- host_mode = host_mode | O_EXCL;
- if ((hif_mode & HIF_FORM) != 0)
- host_mode = host_mode | O_TEXT;
- else
- host_mode = host_mode | O_BINARY;
-
-
- result = UDI_read_string((INT32) UDI29KDRAMSpace,
- pathptr,
- (INT32) MAX_FILENAME,
- tmp_buffer);
-
- if (result != (INT32) 0) {
- *gr96 = (UINT32) -1;
- return((INT32) result);
- }
-
- fd = open(tmp_buffer, host_mode, hif_pflag);
-
- *gr96 = (UINT32) fd;
-
- if (fd < 0) /* open failed on host */
- return((INT32) errno);
-
- return (0);
- } /* end hif_open() */
-
-
-
-/*
-** Service 18 - close
-**
-** Type Regs Contents Description
-** ---- ---- -------- -----------
-** Calling: gr121 18 (0x12) Service number
-** lr2 fileno File descriptor
-**
-** Returns: gr96 retval Success = 0
-** Failure < 0
-** gr121 0x80000000 Logical TRUE, service successful
-** errcode error number, service not
-** successful
-*/
-
-INT32
-hif_close(lr2, gr96)
-UINT32 lr2;
-UINT32 *gr96;
- {
- int file_no;
- int retval;
-
- file_no = (int) lr2;
-
-
- /* Don't close stdin, stdout or stderr */
- if (file_no == 0 ||
- file_no == 1 ||
- file_no == 2)
- retval = 0; /* Pretend we closed it */
- else
- retval = close(file_no);
-
- *gr96 = (UINT32) retval;
-
- if (retval < 0)
- return((INT32) errno);
-
- return (0);
- } /* end hif_close() */
-
-
-
-
-/*
-** Service 19 - read
-**
-** Type Regs Contents Description
-** ---- ---- -------- -----------
-** Calling: gr121 19 (0x13) Service number
-** lr2 fileno File descriptor
-** lr3 buffptr A pointer to buffer area
-** lr4 nbytes Number of bytes to be read
-**
-** Returns: gr96 count * See HIF spec
-** gr121 0x80000000 Logical TRUE, service successful
-** errcode error number, service not
-** successful
-*/
-
-INT32
-hif_read(lr2, lr3, lr4, gr96)
-UINT32 lr2, lr3, lr4;
-UINT32 *gr96;
- {
- int bytes_read;
- int file_no;
- ADDR32 buffptr;
- UINT32 nbytes;
- UINT32 copy_count;
- UINT32 total_bytes;
- INT32 result;
-
- file_no = (int) lr2;
- buffptr = (ADDR32) lr3;
- nbytes = (UINT32) lr4;
- total_bytes = (UINT32) 0;
-
-
- while (nbytes > 0) {
-
- copy_count = (nbytes < (UINT32) TMP_BUF_SIZE) ? nbytes : (UINT32) TMP_BUF_SIZE;
-
- bytes_read = (int) read(file_no,
- (char *) tmp_buffer,
- (int) copy_count);
-
- if (bytes_read == (int) -1) {
- *gr96 = total_bytes;
- return((INT32) errno);
- }
-
- /* Write data to target buffer */
- result = UDI_write_string((INT32) UDI29KDRAMSpace,
- buffptr,
- (INT32) bytes_read,
- tmp_buffer);
-
- if (result != (INT32) 0) {
- *gr96 = total_bytes;
- return((INT32) result);
- }
-
- total_bytes = total_bytes + (UINT32) bytes_read;
- buffptr = buffptr + (UINT32) bytes_read;
-
- /* If bytes_read is the same a copy_count, keep reading */
- if ((UINT32) bytes_read == copy_count)
- nbytes = nbytes - (UINT32) bytes_read;
- else
- nbytes = 0;
-
- } /* end while loop */
-
- *gr96 = total_bytes;
- return (0);
-
- } /* end hif_read() */
-
-
-
-/*
-** Service 20 - write
-**
-** Type Regs Contents Description
-** ---- ---- -------- -----------
-** Calling: gr121 20 (0x14) Service number
-** lr2 fileno File descriptor
-** lr3 buffptr A pointer to buffer area
-** lr4 nbytes Number of bytes to be read
-**
-** Returns: gr96 count * See HIF spec
-** gr121 0x80000000 Logical TRUE, service successful
-** errcode error number, service not
-** successful
-*/
-
-INT32
-hif_write(lr2, lr3, lr4, gr96)
-UINT32 lr2, lr3, lr4;
-UINT32 *gr96;
- {
- int file_no;
- ADDR32 buffptr;
- UINT32 nbytes;
- UINT32 copy_count;
- UINT32 total_bytes;
- int bytes_written;
- INT32 result;
-
- file_no = (int) lr2;
- buffptr = (ADDR32) lr3;
- nbytes = (UINT32) lr4;
- total_bytes = (UINT32) 0;
-
-
- /* If we are writing channel 0, which is stdin
- this is an error */
-
- while (nbytes > (UINT32) 0) {
-
- copy_count = (nbytes < (UINT32) TMP_BUF_SIZE) ? nbytes : (UINT32) TMP_BUF_SIZE;
-
- result = UDI_read_string((UINT32) UDI29KDRAMSpace,
- buffptr,
- copy_count,
- tmp_buffer);
-
- if (result != (INT32) 0) {
- *gr96 = total_bytes;
- return(result);
- }
-
- /* Write copy_count bytes to file_no */
- bytes_written = write(file_no, tmp_buffer, (int) copy_count);
-
- if (bytes_written < 0) {
- *gr96 = total_bytes;
- return(errno);
- }
-
- total_bytes = total_bytes + bytes_written;
- buffptr = buffptr + bytes_written;
- nbytes = nbytes - bytes_written;
-
- } /* end while loop */
-
-
- *gr96 = total_bytes;
-
- return (0);
- } /* end hif_write() */
-
-
-
-/*
-** Service 21 - lseek
-**
-** Type Regs Contents Description
-** ---- ---- -------- -----------
-** Calling: gr121 21 (0x15) Service number
-** lr2 file_no File descriptor
-** lr3 offset Number of bytes offset from orig
-** lr4 orig A code number indication the point
-** within the file from which the
-** offset is measured
-**
-** Returns: gr96 where * See HIF spec
-** gr121 0x80000000 Logical TRUE, service successful
-** errcode error number, service not
-** successful
-**
-** Notes: The defined constants for orig are different in MS-DOS
-** and UNIX, but there is a 1-1 correspondence as follows:
-**
-** Code UNIX MS-DOS Meaning
-** ---- ---- ------ -------
-** 0 L_SET SEEK_SET Beginning of file
-** 1 L_INCR SEEK_CUR Current file position
-** 2 L_XTNX SEEK_END End of file
-**
-*/
-
-INT32
-hif_lseek(lr2, lr3, lr4, gr96)
-UINT32 lr2, lr3, lr4;
-UINT32 *gr96;
- {
- int file_no;
- off_t offset;
- int orig;
- long new_offset;
-
- file_no = (int) lr2;
- offset = (off_t) lr3;
-#ifdef HAVE_UNISTD_H
- if (lr4 == (UINT32) 0)
- orig = SEEK_SET;
- else if (lr4 == (UINT32) 1)
- orig = SEEK_CUR;
- else if (lr4 == (UINT32) 2)
- orig = SEEK_END;
-#else
- if (lr4 == (UINT32) 0)
- orig = L_SET;
- else if (lr4 == (UINT32) 1)
- orig = L_INCR;
- else if (lr4 == (UINT32) 2)
- orig = L_XTND;
-#endif
-
- new_offset = lseek(file_no, offset, orig);
-
- *gr96 = (UINT32) new_offset;
-
- if (new_offset == (UINT32) -1) /* failed */
- return(errno);
-
- return (0);
- } /* end hif_lseek() */
-
-
-
-
-/*
-** Service 22 - remove
-**
-** Type Regs Contents Description
-** ---- ---- -------- -----------
-** Calling: gr121 22 (0x16) Service number
-** lr2 pathname A pointer to string that contains
-** the pathname of the file
-**
-** Returns: gr96 retval Success = 0
-** Failure < 0
-** gr121 0x80000000 Logical TRUE, service successful
-** errcode error number, service not
-** successful
-*/
-
-INT32
-hif_remove(lr2, gr96)
-UINT32 lr2;
-UINT32 *gr96;
- {
- int retval;
- INT32 result;
-
-
- result = UDI_read_string((INT32) UDI29KDRAMSpace,
- (ADDR32) lr2,
- (INT32) MAX_FILENAME,
- tmp_buffer);
-
- if (result != (INT32) 0) {
- *gr96 = (UINT32) -1;
- return(result);
- }
-
- retval = unlink(tmp_buffer);
-
- if (retval != 0) {
- *gr96 = (UINT32) -1;
- return(errno);
- }
-
- *gr96 = (UINT32) 0;
- return (0);
-
- } /* end hif_remove() */
-
-
-
-/*
-** Service 23 - rename
-**
-** Type Regs Contents Description
-** ---- ---- -------- -----------
-** Calling: gr121 23 (0x17) Service number
-** lr2 oldfile A pointer to string containing
-** the old pathname of the file
-** lr3 newfile A pointer to string containing
-** the new pathname of the file
-**
-** Returns: gr96 retval Success = 0
-** Failure < 0
-** gr121 0x80000000 Logical TRUE, service successful
-** errcode error number, service not
-** successful
-*/
-
-INT32
-hif_rename(lr2, lr3, gr96)
-UINT32 lr2, lr3;
-UINT32 *gr96;
- {
- char oldname[MAX_FILENAME];
- int retval;
- INT32 result;
-
-
- /* Get old filename */
- result = UDI_read_string((INT32) UDI29KDRAMSpace,
- (ADDR32) lr2,
- (INT32) MAX_FILENAME,
- oldname);
-
- if (result != (INT32) 0) {
- *gr96 = (UINT32) -1;
- return(result);
- }
-
- /* Get new filename */
- result = UDI_read_string((INT32) UDI29KDRAMSpace,
- (ADDR32) lr3,
- (INT32) MAX_FILENAME,
- tmp_buffer);
-
- if (result != (INT32) 0) {
- *gr96 = (UINT32) -1;
- return(result);
- }
-
- retval = rename(oldname, tmp_buffer);
-
- *gr96 = (UINT32) retval;
-
- if (retval < 0) {
- return(errno);
- }
-
-
- return (0);
-
- } /* end hif_rename() */
-
-
-
-/*
-** Service 24 - ioctl
-**
-** Type Regs Contents Description
-** ---- ---- -------- -----------
-** Calling: gr121 24 (0x18) Service number
-** lr2 fileno File descriptor number to be tested
-** lr3 mode Operating mode
-**
-** Returns: gr96 retval Success = 0
-** Failure < 0
-** gr121 0x80000000 Logical TRUE, service successful
-** errcode error number, service not
-** successful
-**
-** Note: There is no equivalent to ioctl() in MS-DOS. It is
-** stubbed to return a zero.
-*/
-
-INT32
-hif_ioctl(lr2, lr3)
-UINT32 lr2, lr3;
- {
- int des;
- int request;
- int result;
-
-
- des = (int) lr2;
- request = (int) lr3;
-
- result = ioctl(des, request);
-
- if (result == -1)
- return(errno);
-
- return (0);
-
- } /* end hif_ioctl() */
-
-
-
-/*
-** Service 25 - iowait
-**
-** Type Regs Contents Description
-** ---- ---- -------- -----------
-** Calling: gr121 25 (0x19) Service number
-** lr2 fileno File descriptor number to be tested
-** lr3 mode 1 = non-blocking completion test
-** 2 = wait until read operation complete
-**
-** Returns: gr96 count * see HIF spec
-** gr121 0x80000000 Logical TRUE, service successful
-** errcode error number, service not
-** successful
-**
-** Note: As with ioctl(), there is no equivalent to iowait() in
-** MS-DOS. It is stubbed to return a zero.
-*/
-
-/* ARGSUSED */
-INT32
-hif_iowait(lr2, lr3)
-UINT32 lr2, lr3;
- {
- return (HIF_EHIFNOTAVAIL);
- } /* end hif_iowait() */
-
-
-
-/*
-** Service 26 - iostat
-**
-** Type Regs Contents Description
-** ---- ---- -------- -----------
-** Calling: gr121 26 (0x20) Service number
-** lr2 fileno File descriptor number to be tested
-**
-** Returns: gr96 iostat input status
-** 0x0001 = RDREADY
-** 0x0002 = ISATTY
-** gr121 0x80000000 Logical TRUE, service successful
-** errcode error number, service not
-** successful
-**
-** Note: Currently RDREADY is always returned as set. This is
-** ok for MS-DOS, but may cause problems in BSD UNIX.
-**
-*/
-
-/* ARGSUSED */
-INT32
-hif_iostat(lr2, gr96)
-UINT32 lr2;
-UINT32 *gr96;
- {
- UDIError result;
- UINT32 file_no;
-
-
- *gr96 = (UINT32) RDREADY;
-
- file_no = lr2;
-
- result = (UDIError) isatty((int) file_no);
-
- if (result == (UDIError) 0)
- *gr96 = (UINT32) (*gr96 | ISATTY);
-
- return (0);
-
- } /* end hif_iostat() */
-
-
-/*
-** Service 33 - tmpnam
-**
-** Type Regs Contents Description
-** ---- ---- -------- -----------
-** Calling: gr121 33 (0x21) Service number
-** lr2 addrptr Pointer into which filename is
-** to be stored
-**
-** Returns: gr96 filename Success: pointer to temporary
-** filename string. This will be
-** the same as lr2 on entry unless
-** an error occurred
-** Failure: = 0 (NULL pointer)
-** gr121 0x80000000 Logical TRUE, service successful
-** errcode error number, service not
-** successful
-**
-** Warnings: This function does not check environment variables
-** such as TMP when creating a temporary filename.
-**
-** Also, an input parameter of NULL is not accepted. This
-** would require allocation of a temporary buffer on the
-** target for storage of the temporary file name. The
-** target must necessarily specify a buffer address for the
-** temporary filename.
-**
-*/
-
-INT32
-hif_tmpnam(lr2, gr96)
-UINT32 lr2;
-UINT32 *gr96;
- {
- ADDR32 addrptr;
- char *filename;
- INT32 result;
-
-
- /*
- ** If addrptr is zero, there is supposed to be a temporary
- ** buffer allocated on the target. Since we can't allocate
- ** memory on the target we have to return an error. This
- ** should be fixed.
- */
-
- addrptr = lr2;
-
- if (addrptr == (UINT32) 0) {
- *gr96 = (UINT32) 0;
- return(HIF_EACCESS);
- }
-
- filename = tmpnam(tmp_buffer);
-
- if (filename == NULL) {
- *gr96 = (UINT32) 0;
- return(HIF_EACCESS);
- }
-
- result = UDI_write_string((INT32) UDI29KDRAMSpace,
- addrptr,
- (INT32) (strlen(filename) + 1),
- filename);
- if (result != (INT32) 0) {
- *gr96 = (UINT32) 0;
- return(result);
- }
-
- *gr96 = (UINT32) addrptr;
-
- return (0);
-
- } /* end hif_tmpnam() */
-
-
-
-/*
-** Service 49 - time
-**
-** Type Regs Contents Description
-** ---- ---- -------- -----------
-** Calling: gr121 49 (0x31) Service number
-**
-** Returns: gr96 secs Success != 0 (time in seconds)
-** Failure = 0
-** gr121 0x80000000 Logical TRUE, service successful
-** errcode error number, service not
-** successful
-*/
-
-/* ARGSUSED */
-INT32
-hif_time(gr96)
-UINT32 *gr96;
- {
- time_t secs;
-
-
- secs = time((time_t *) 0);
-
- *gr96 = (UINT32) secs;
-
- return (0);
-
- } /* end hif_time() */
-
-
-
-/*
-** Service 65 - getenv
-**
-** Type Regs Contents Description
-** ---- ---- -------- -----------
-** Calling: gr121 65 (0x41) Service number
-** lr2 name A pointer to symbol name
-** lr3 destination - given by OS.
-**
-** Returns: gr96 addrptr Success: pointer to symbol name string
-** Failure = 0 (NULL pointer)
-** gr121 0x80000000 Logical TRUE, service successful
-** errcode error number, service not
-** successful
-**
-** Note: Since this service requires writing to a buffer on the
-** target, an extra parameter has been passed in lr3.
-** This parameter points to a buffer which can be used
-** by getenv.
-*/
-
-INT32
-hif_getenv(lr2, lr3, gr96)
-UINT32 lr2;
-UINT32 lr3;
-UINT32 *gr96;
- {
- char *varval;
- INT32 result;
-
- result = UDI_read_string((INT32) UDI29KDRAMSpace,
- (ADDR32) lr2,
- (INT32) MAX_ENV,
- tmp_buffer);
-
- if (result != (INT32) 0) {
- *gr96 = (UINT32) 0;
- return(result);
- }
-
- varval = (char *) getenv(tmp_buffer);
-
- if (varval == NULL)
- result = UDI_write_string((INT32) UDI29KDRAMSpace,
- (ADDR32) lr3,
- (INT32) 4,
- "\0\0\0\0");
- else
- result = UDI_write_string((INT32) UDI29KDRAMSpace,
- (ADDR32) lr3,
- (INT32) (strlen(varval) + 1),
- varval);
-
- if (result != (INT32) 0) {
- *gr96 = (UINT32) 0;
- return(result);
- }
-
- *gr96 = lr3;
-
- return (0);
-
- } /* end hif_getenv() */
-
-
-
-
-/*
-** Service 66 - gettz
-**
-** Type Regs Contents Description
-** ---- ---- -------- -----------
-** Calling: gr121 66 (0x42) Service number
-**
-** Returns: gr96 zonecode Success >= 0 (minutes west of GMT)
-** Failure < 0 (or information
-** unavailable)
-** gr97 dstcode Success = 1 (Daylight Savings Time
-** in effect)
-** = 0 (Daylight Savings Time
-** not in effect)
-** gr121 0x80000000 Logical TRUE, service successful
-** errcode error number, service not
-** successful
-**
-*/
-
-/* ARGSUSED */
-INT32
-hif_gettz(gr96, gr97)
-UINT32 *gr96;
-UINT32 *gr97;
- {
- struct timeb timeptr;
-
-
- (void) ftime(&timeptr);
-
- *gr96 = (UINT32) timeptr.timezone;
- *gr97 = (UINT32) timeptr.dstflag;
-
- return (0);
-
- } /* end hif_gettz() */
-
-
-
-/*
-** This function is used to read data from the target.
-** This function returns zero if successful, and an
-** error code otherwise.
-**
-** Note that this function permits reading any
-** arbitrary sized buffer on the target into a
-** buffer on the host.
-*/
-
-INT32
-UDI_read_string(memory_space, address, byte_count, data)
- INT32 memory_space;
- ADDR32 address;
- INT32 byte_count;
- char *data;
- {
- UDIResource from;
- UDICount count_done;
- UDIError UDIretval;
-
- from.Offset = address;
- from.Space = (CPUSpace) memory_space;
-
- if ((UDIretval = UDIRead (from,
- (UDIHostMemPtr) data,
- (UDICount) byte_count,
- (size_t) 1,
- &count_done,
- (UDIBool) 0)) != UDINoError) {
- com_error = 1;
- return (UDIretval);
- };
- if ((tip_target_config.os_version & 0xf) > 4) { /* new HIF kernel */
- /*
- * Examine UDIretval and send a GO to switch the Debugger context
- * back to HIF kernel.
- */
- Mini_build_go_msg();
- if (Mini_msg_send() != SUCCESS) {
- com_error = 1;
- return (-1); /* FAILURE */
- }
- } else { /* old HIF kernel */
- }
- return(0); /* SUCCESS */
- } /* end read_string() */
-
-
-/*
-** This function is used to write a buffer of data to
-** the target. This function returns zero if successful,
-** and an error code otherwise.
-**
-** Note that this function permits writing any
-** arbitrary sized buffer on the target from a
-** buffer on the host.
-*/
-
-INT32
-UDI_write_string(memory_space, address, byte_count, data)
- INT32 memory_space;
- ADDR32 address;
- INT32 byte_count;
- char *data;
- {
- UDIResource to;
- UDICount count_done;
- UDIError UDIretval;
-
- to.Offset = address;
- to.Space = (CPUSpace) memory_space;
-
- if ((UDIretval = UDIWrite ((UDIHostMemPtr) data,
- to,
- (UDICount) byte_count,
- (size_t) 1,
- &count_done,
- (UDIBool) 0)) != UDINoError) {
- com_error = 1;
- return (UDIretval);
- }
- if ((tip_target_config.os_version & 0xf) > 4) { /* new HIF kernel */
- /*
- * Examine UDIretval and send a GO to switch the Debugger context
- * back to HIF kernel.
- */
- Mini_build_go_msg();
- if (Mini_msg_send() != SUCCESS) {
- com_error = 1;
- return (-1); /* FAILURE */
- }
- } else { /* old HIF kernel */
- }
- return(0); /* SUCCESS */
- } /* end UDI_write_string() */
-
+++ /dev/null
-static char _[]="@(#)lcb29k.c 5.22 93/10/26 09:57:08, Srini, AMD.";
-/******************************************************************************
- * Copyright 1992 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Systems Engineering
- * Mail Stop 573
- * 5204 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- * 29k-support@AMD.COM
- ****************************************************************************
- * Engineer: Srini Subramanian.
- ****************************************************************************
- ** This file defines functions which initialize and access the
- ** LCB29K (Low Cost Board 29K) or "squirt" board from YARC.
- **
- ****************************************************************************
- */
-
-#include <stdio.h>
-#include <memory.h>
-#include "types.h"
-#include "lcb29k.h"
-#include "memspcs.h"
-#include "mtip.h"
-#include "tdfunc.h"
-#include "macros.h"
-
-#include <conio.h>
-#include <dos.h>
-
-void endian_cvt PARAMS((union msg_t *, int));
-void tip_convert32 PARAMS ((BYTE *));
-
-
-/*
-** This function is used to initialize the communication
-** channel. This consists of setting the window location
-** of the LCB29K to the value defined by the values in
-** the file lcb29k.h.
-*/
-
-INT32
-init_comm_lcb29k(PC_port_base, PC_mem_seg)
-INT32 PC_port_base;
-INT32 PC_mem_seg;
- {
- int result;
- int control_reg;
-
- /*** check for existence of the board ***/
-
- /* Initialize Control Port Register 0 */
- /* (But don't set LCB29K_RST) */
- control_reg = (LCB29K_CLRINPC | LCB29K_INTEN | LCB29K_WEN);
- result = outp((unsigned int) PC_port_base,
- control_reg);
-
- return(0);
- } /* end init_comm_lcb29k() */
-
-
-/*
-** This function is used to send a message to the LCB29K.
-** If the message is successfully sent, a zero is
-** returned. If the message was not sendable, a -1
-** is returned.
-**
-** Also note that this function does endian conversion on the
-** returned message. This is necessary because the Am29000
-** target will be sending big-endian messages and the PC will
-** be expecting little-endian.
-*/
-
-INT32
-msg_send_lcb29k(msg_ptr, PC_port_base)
- union msg_t *msg_ptr;
- INT32 PC_port_base;
- {
- int result;
- int control_reg;
- INT32 message_size;
-
-
-#if 0
- INT32 semaphore;
- /* Set semaphore (LCB29K_RECV_BUF_PTR) to zero */
- semaphore = 0;
- result = (int) Mini_write_memory((INT32) D_MEM,
- (ADDR32) LCB29K_RECV_BUF_PTR,
- (INT32) sizeof(INT32),
- (BYTE *) &semaphore);
-
- if (result != 0)
- return(-1);
-#endif
- /* Get size of whole message */
- message_size = (msg_ptr->generic_msg).length + (2 * sizeof(INT32));
-
- /* Do endian conversion */
- if (tip_target_config.TipEndian != tip_target_config.P29KEndian)
- endian_cvt(msg_ptr, OUTGOING_MSG);
-
- /* Send message */
- result = (int) Mini_write_memory((INT32) D_MEM,
- (ADDR32) LCB29K_SEND_BUF,
- (INT32) message_size,
- (BYTE *) msg_ptr);
-
- if (result != 0)
- return(-1);
-
- /* Interrupt target (write to "LCB29K" mailbox) */
- /* Note: This sequence of bytes written to the
- ** port of the low cost board should cause
- ** the target to be interrupted. This
- ** sequence was given to AMD by YARC systems.
- */
-
-/*
- control_reg = (LCB29K_RST);
- result = outp((unsigned int) (PC_port_base),
- control_reg);
-
- control_reg = (LCB29K_RST | LCB29K_WEN);
- result = outp((unsigned int) (PC_port_base),
- control_reg);
-*/
-
- control_reg = (LCB29K_RST | LCB29K_INTEN | LCB29K_WEN);
- result = outp((unsigned int) (PC_port_base),
- control_reg);
-
- control_reg = (LCB29K_RST | LCB29K_INTEN | LCB29K_WEN |
- LCB29K_INT29);
- result = outp((unsigned int) (PC_port_base),
- control_reg);
-/*
- control_reg = (LCB29K_RST | LCB29K_INTEN | LCB29K_WEN |
- LCB29K_INT29);
- result = outp((unsigned int) (PC_port_base),
- control_reg);
-*/
- return(0);
-
- } /* end msg_send_lcb29k() */
-
-
-
-
-/*
-** This function is used to receive a message to the LCB29K.
-** If the message is waiting in the buffer, a zero is
-** returned and the buffer pointed to by msg_ptr is filled
-** in. If no message was available, a -1 is returned.
-**
-** Note that this function does endian conversion on the
-** returned message. This is necessary because the Am29000
-** target will be sending big-endian messages and the PC will
-** be expecting little-endian.
-*/
-
-INT32
-msg_recv_lcb29k(msg_ptr, PC_port_base, Mode)
- union msg_t *msg_ptr;
- INT32 PC_port_base;
- INT32 Mode;
- {
- int result;
- ADDR32 recv_buf_addr;
- INT32 parms_length;
- INT32 header_size;
- INT32 semaphore;
- int control_reg;
-
- /* Poll LCB29K control register */
- control_reg = inp((unsigned int) PC_port_base);
-
- /* If LCB29K_INTPC flag set, message ready */
- if ((control_reg & LCB29K_INTPC) != 0) {
- /* Clear LCB29K_INTPC (and don't interrupt 29K) */
- control_reg = ((control_reg & ~(LCB29K_INT29)) | LCB29K_CLRINPC);
-
- result = outp((unsigned int) (PC_port_base),
- control_reg);
-
- control_reg = (control_reg & ~(LCB29K_CLRINPC));
-
- result = outp((unsigned int) (PC_port_base),
- control_reg);
- }
-
- /* Get receive buffer address */
- result = (int) Mini_read_memory((INT32) D_MEM,
- (ADDR32) LCB29K_RECV_BUF_PTR,
- (INT32) sizeof(ADDR32),
- (BYTE *) &recv_buf_addr);
-
- if (result != 0)
- return(-1);
-
- /* Change endian of recv_buf_addr (if necessary) */
- if (tip_target_config.TipEndian != tip_target_config.P29KEndian)
- tip_convert32((BYTE *) &recv_buf_addr);
-
- /* If no message waiting, return -1 (This shouldn't happen) */
- if (recv_buf_addr == (ADDR32) 0)
- return (-1);
-
- /* Get message header */
- header_size = (INT32) (2 * sizeof(INT32));
- result = (int) Mini_read_memory((INT32) D_MEM,
- (ADDR32) recv_buf_addr,
- (INT32) header_size,
- (BYTE *) msg_ptr);
-
- if (result != 0)
- return(-1);
-
- /* Get rest of message */
- parms_length = (msg_ptr->generic_msg).length;
-
- if (tip_target_config.TipEndian != tip_target_config.P29KEndian)
- tip_convert32((BYTE *) &parms_length);
-
-
- result = (int) Mini_read_memory((INT32) D_MEM,
- (ADDR32) (recv_buf_addr + header_size),
- (INT32) parms_length,
- (BYTE *) &(msg_ptr->generic_msg.byte));
- if (result != 0)
- return(-1);
-
- /* Do endian conversion (if necessary) */
- if (tip_target_config.TipEndian != tip_target_config.P29KEndian)
- endian_cvt(msg_ptr, INCOMING_MSG);
-
- /* Write Clear LCB29K_INPC */
- control_reg = (LCB29K_RST | LCB29K_CLRINPC | LCB29K_INTEN |
- LCB29K_WEN);
- result = outp((unsigned int) (PC_port_base),
- control_reg);
-
- /* Set semaphore (LCB29K_RECV_BUF_PTR) to zero */
- semaphore = 0;
- result = (int) Mini_write_memory((INT32) D_MEM,
- (ADDR32) LCB29K_RECV_BUF_PTR,
- (INT32) sizeof(INT32),
- (BYTE *) &semaphore);
-
- if (result != 0)
- return(-1);
-
-
- return(msg_ptr->generic_msg.code);
- } /* end msg_recv_lcb29k() */
-
-
-
-
-/*
-** This function is used to reset the communication
-** channel. This is used when resyncing the host and
-** target and when exiting the monitor.
-*/
-
-INT32
-exit_comm_lcb29k(PC_port_base, PC_mem_seg)
-INT32 PC_port_base;
-INT32 PC_mem_seg;
- {
- return (0);
- }
-
-INT32
-reset_comm_lcb29k(PC_port_base, PC_mem_seg)
-INT32 PC_port_base;
-INT32 PC_mem_seg;
- {
- int result;
- int control_reg;
-
- /*** check for existence of the board ***/
-
- /* Initialize Control Port Register 0 */
- /* (But don't set LCB29K_RST) */
- control_reg = (LCB29K_CLRINPC | LCB29K_INTEN | LCB29K_WEN);
- result = outp((unsigned int) PC_port_base,
- control_reg);
-
- return(0);
- } /* end reset_comm_lcb29k() */
-
-
-
-/*
-** This function is used to "kick" the LCB29K. This
-** amounts to yanking the *RESET line low. Code
-** will begin execution at ROM address 0.
-*/
-
-void
-go_lcb29k(PC_port_base, PC_mem_seg)
-INT32 PC_port_base;
-INT32 PC_mem_seg;
- {
- int result;
- int control_reg;
-
- /* Clear the RST bit in Control Port Register 0 */
- control_reg = (LCB29K_CLRINPC | LCB29K_INTEN | LCB29K_WEN);
- result = outp((unsigned int) PC_port_base,
- control_reg);
-
- /* Set the RST bit in Control Port Register 0 */
- control_reg = (LCB29K_RST | LCB29K_INTEN | LCB29K_WEN);
- result = outp((unsigned int) PC_port_base,
- control_reg);
-
- } /* end go_lcb29k() */
-
-
-
-
-/*
-** This function is used to write a string of bytes to
-** the Am29000 memory on the LCB29K board.
-**
-*/
-
-INT32
-write_memory_lcb29k(memory_space, address, data, byte_count, PC_port_base, PC_mem_seg)
- INT32 memory_space;
- ADDR32 address;
- BYTE *data;
- INT32 byte_count;
- INT32 PC_port_base;
- INT32 PC_mem_seg;
- {
- INT32 bytes_in_window;
- INT32 copy_count;
- int result;
-
- while (byte_count > 0) {
-
- /* Write out low order address bits */
- result = outp((unsigned int) (PC_port_base+1),
- (int) ((address >> 14) & 0xff));
-
- /* Write out high order address bits */
- if (memory_space == I_MEM)
- result = outp((unsigned int) (PC_port_base+2),
- (int) (((address >> 22) & 0x7f) | LCB29K_I_MEM));
- else
- if (memory_space == D_MEM)
- result = outp((unsigned int) (PC_port_base+2),
- (int) (((address >> 22) & 0x7f) | LCB29K_D_MEM));
- else /* Must be either Instruction or Data memory */
- return (-1);
-
- bytes_in_window = 0x4000 - (address & 0x3fff);
- copy_count = MIN(byte_count, bytes_in_window);
-
- (void) movedata((unsigned int) FP_SEG(data),
- (unsigned int) FP_OFF(data),
- (unsigned int) PC_mem_seg,
- (unsigned int) (address & 0x3fff),
- (int) copy_count);
-
- data = data + copy_count;
- address = address + copy_count;
- byte_count = byte_count - copy_count;
-
- } /* end while loop */
-
- return(0);
-
- } /* End write_memory_lcb29k() */
-
-
-
-
-/*
-** This function is used to read a string of bytes from
-** the Am29000 memory on the LCB29K board. A zero is
-** returned if the data is read successfully, otherwise
-** a -1 is returned.
-*/
-
-INT32
-read_memory_lcb29k(memory_space, address, data, byte_count, PC_port_base, PC_mem_seg)
- INT32 memory_space;
- ADDR32 address;
- BYTE *data;
- INT32 byte_count;
- INT32 PC_port_base;
- INT32 PC_mem_seg;
- {
- INT32 bytes_in_window;
- INT32 copy_count;
- int result;
-
- while (byte_count > 0) {
-
- /* Write out low order address bits */
- result = outp((unsigned int) (PC_port_base+1),
- (int) ((address >> 14) & 0xff));
-
- /* Write out high order address bits */
- if (memory_space == I_MEM)
- result = outp((unsigned int) (PC_port_base+2),
- (int) (((address >> 22) & 0x7f) | LCB29K_I_MEM));
- else
- if (memory_space == D_MEM)
- result = outp((unsigned int) (PC_port_base+2),
- (int) (((address >> 22) & 0x7f) | LCB29K_D_MEM));
- else /* Must be either Instruction or Data memory */
- return (-1);
-
- bytes_in_window = 0x4000 - (address & 0x3fff);
- copy_count = MIN(byte_count, bytes_in_window);
-
- (void) movedata((unsigned int) PC_mem_seg,
- (unsigned int) (address & 0x3fff),
- (unsigned int) FP_SEG(data),
- (unsigned int) FP_OFF(data),
- (int) copy_count);
-
- data = data + copy_count;
- address = address + copy_count;
- byte_count = byte_count - copy_count;
-
- } /* end while loop */
-
- return(0);
-
- } /* End read_memory_lcb29k() */
-
-INT32
-fill_memory_lcb29k()
-{
- return (0);
-}
-
+++ /dev/null
-static char _[] = "@(#)messages.c 5.20 93/08/02 13:23:58, Srini, AMD.";
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- * This module contains the functions to build and unpack MiniMON29K messages.
- * It also defines the functions to send and receive messages from the
- * 29K target. An array defining the appropriate functions to use for
- * different targets is initialized.
- *****************************************************************************
- */
-
-/*
- * Definitions of functions that
- * -initialize the Message System
- * -send messages to the target
- * -receive messages from the target
- */
-
-#include <stdio.h>
-#include <ctype.h>
-#ifdef MSDOS
-#include <stdlib.h>
-#endif
-#include <string.h>
-#include "messages.h"
-#include "memspcs.h"
-#include "tdfunc.h"
-#include "mtip.h"
-
-extern FILE *MsgFile;
-static int DebugCoreVersion;
-
-static INT32 target_index = 0; /* Default EB29K */
-
-int lpt_initialize=0; /* global */
-int use_parport=0; /* global */
-
-static union msg_t *send_msg_buffer;
-static union msg_t *recv_msg_buffer;
-
-struct target_dep_funcs {
- char target_name[15];
- INT32 (*msg_send)PARAMS((union msg_t *, INT32));
- INT32 (*msg_recv)PARAMS((union msg_t *, INT32, INT32));
- INT32 (*init_comm)PARAMS((INT32, INT32));
- INT32 (*reset_comm)PARAMS((INT32, INT32));
- INT32 (*exit_comm)PARAMS((INT32, INT32));
- INT32 (*read_memory)PARAMS((INT32, ADDR32, BYTE *, INT32, INT32, INT32));
- INT32 (*write_memory)PARAMS((INT32, ADDR32, BYTE *, INT32, INT32, INT32));
- INT32 (*fill_memory)PARAMS((void));
- INT32 PC_port_base;
- INT32 PC_mem_seg;
- void (*go)PARAMS((INT32, INT32));
-} TDF[] = {
-"pceb", msg_send_pceb, msg_recv_pceb, init_comm_pceb,
-reset_comm_pceb, exit_comm_pceb, read_memory_pceb, write_memory_pceb,
-fill_memory_pceb, (INT32) 0x240, (INT32) 0xd000, go_pceb,
-
-#ifndef MSDOS
-"pcserver", msg_send_serial, msg_recv_serial, init_comm_serial,
-reset_comm_pcserver, exit_comm_serial, read_memory_serial, write_memory_serial,
-fill_memory_serial, (INT32) -1 , (INT32) -1, go_serial,
-#endif
-
-#ifdef MSDOS
-"paral_1", msg_send_parport, msg_recv_serial, init_comm_serial,
-reset_comm_serial, exit_comm_serial, read_memory_serial, write_memory_serial,
-fill_memory_serial, (INT32) -1 , (INT32) -1, go_serial,
-#endif
-
-"serial", msg_send_serial, msg_recv_serial, init_comm_serial,
-reset_comm_serial, exit_comm_serial, read_memory_serial, write_memory_serial,
-fill_memory_serial, (INT32) -1 , (INT32) -1, go_serial,
-
-"eb29030", msg_send_eb030, msg_recv_eb030, init_comm_eb030,
-reset_comm_eb030, exit_comm_eb030, read_memory_eb030, write_memory_eb030,
-fill_memory_eb030, (INT32) 0x208, (INT32) 0xd000, go_eb030,
-
-"eb030", msg_send_eb030, msg_recv_eb030, init_comm_eb030,
-reset_comm_eb030, exit_comm_eb030, read_memory_eb030, write_memory_eb030,
-fill_memory_eb030, (INT32) 0x208, (INT32) 0xd000, go_eb030,
-
-"eb29k", msg_send_eb29k, msg_recv_eb29k, init_comm_eb29k,
-reset_comm_eb29k, exit_comm_eb29k, read_memory_eb29k, write_memory_eb29k,
-fill_memory_eb29k, (INT32) 0x208, (INT32) 0xd000, go_eb29k,
-
-"yarcrev8", msg_send_eb29k, msg_recv_eb29k, init_comm_eb29k,
-reset_comm_eb29k, exit_comm_eb29k, read_memory_eb29k, write_memory_eb29k,
-fill_memory_eb29k, (INT32) 0x208, (INT32) 0xd000, go_eb29k,
-
-"lcb29k", msg_send_lcb29k, msg_recv_lcb29k, init_comm_lcb29k,
-reset_comm_lcb29k, exit_comm_lcb29k, read_memory_lcb29k, write_memory_lcb29k,
-fill_memory_lcb29k, (INT32) 0x208, (INT32) 0xd000, go_lcb29k,
-
-"\0"
-};
-
-void print_msg PARAMS((union msg_t *msgptr, FILE *file));
-static INT32 match_name PARAMS((char *targ_name));
-
-
-#ifdef MSDOS
-void set_lpt PARAMS((void));
-void unset_lpt PARAMS((void));
-
-void set_lpt ()
-{
- TDF[target_index].msg_send = msg_send_parport;
- use_parport = 1;
-}
-
-void unset_lpt()
-{
- TDF[target_index].msg_send = msg_send_serial;
- use_parport = 0;
-}
-
-#endif
-/*
-** Miscellaneous
-*/
-
-INT32 msg_length(code)
-INT32 code;
-{ /* for temporary compatibility between new and old r/w/copy msgs */
-INT32 rv;
- if (code == WRITE_REQ)
- rv = MSG_LENGTH(struct write_req_msg_t);
- else
- if (code == READ_REQ)
- rv = MSG_LENGTH(struct read_req_msg_t);
- else
- if (code == COPY)
- rv = MSG_LENGTH(struct copy_msg_t);
- else return(-1);
-
- /* if msg version < 0x10 use old format */
- /* assumes config info this has been set up */
- if (((tip_target_config.version >> 16) & 0xff) < 0x10)
- rv = rv - 4;
- return(rv);
-}
-
-/*
-** Target Dependent functions
-*/
-
-INT32
-Mini_msg_init(target_name)
-char *target_name;
-{
- INT32 temp;
-
- /* Allocate buffers */
- if ((send_msg_buffer = (union msg_t *) malloc (BUFFER_SIZE)) == NULL)
- return(FAILURE);
- if ((recv_msg_buffer = (union msg_t *) malloc (BUFFER_SIZE)) == NULL)
- return(FAILURE);
-
- /* Identify target */
- if (strcmp (target_name, "paral_1") == 0) {
- lpt_initialize = 1;
- use_parport = 1;
- }
-
- if ((temp = match_name(target_name)) == FAILURE)
- return(FAILURE); /* Unrecognized target */
- else
- target_index = temp;
-
- if (tip_config.PC_port_base == (INT32) -1) /* no -port opt given */
- tip_config.PC_port_base = TDF[target_index].PC_port_base;
-
- if (tip_config.PC_mem_seg == (INT32) -1) /* no -seg opt given */
- tip_config.PC_mem_seg = TDF[target_index].PC_mem_seg;
-
- /* Initialize communication with target */
- return(Mini_init_comm());
-
-}
-
-int
-Mini_alloc_msgbuf(size)
-int size;
-{
- if (size > (int) BUFFER_SIZE) {
- (void) free(send_msg_buffer);
- (void) free(recv_msg_buffer);
-
- /* Re-Allocate buffers */
- if ((send_msg_buffer = (union msg_t *) malloc (size)) == NULL)
- return(FAILURE);
- if ((recv_msg_buffer = (union msg_t *) malloc (size)) == NULL)
- return(FAILURE);
- }
- return (SUCCESS);
-}
-
-void
-Mini_msg_exit()
-{
- if (send_msg_buffer)
- (void) free ((char *) send_msg_buffer);
- if (recv_msg_buffer)
- (void) free ((char *) recv_msg_buffer);
-
- (void) Mini_reset_comm();
- (void) Mini_exit_comm();
-}
-
-INT32
-Mini_msg_send()
-{
- INT32 retval;
-
- if (Msg_Logfile) {/* log the message */
- fprintf(MsgFile, "\nSending:");
- print_msg(send_msg_buffer, MsgFile);
- fflush(MsgFile);
- };
- retval = (*TDF[target_index].msg_send)(send_msg_buffer,
- tip_config.PC_port_base);
- /* retry once more */
- if (retval == MSGRETRY)
- retval = (*TDF[target_index].msg_send)(send_msg_buffer,
- tip_config.PC_port_base);
-
- return (retval);
-}
-
-INT32
-Mini_msg_recv(RecvMode)
-INT32 RecvMode; /* BLOCK or NONBLOCK */
-{
- INT32 retval;
-
- retval = (INT32) (*TDF[target_index].msg_recv)(recv_msg_buffer,
- tip_config.PC_port_base, RecvMode);
- if (RecvMode == BLOCK) /* we are expecting a response */
- {
- if (retval == MSGRETRY) {
- Mini_msg_send();
- retval = (INT32) (*TDF[target_index].msg_recv)(recv_msg_buffer,
- tip_config.PC_port_base, RecvMode);
- }
- if (Msg_Logfile && (retval != (INT32) -1)) { /* log the message */
- fprintf(MsgFile, "\nReceived:");
- print_msg(recv_msg_buffer, MsgFile);
- fflush (MsgFile);
- };
- if (retval == MSGRETRY)
- return (FAILURE);
- else
- return (retval);
- }
- else /* non-block mode */
- {
- if (retval == MSGRETRY) {
- retval = (INT32) (*TDF[target_index].msg_recv)(recv_msg_buffer,
- tip_config.PC_port_base, RecvMode);
- if (retval == MSGRETRY)
- return (FAILURE);
- else
- return (retval);
- } else {
- if (Msg_Logfile && (retval != (INT32) -1)) { /* log the message */
- fprintf(MsgFile, "\nReceived:");
- print_msg(recv_msg_buffer, MsgFile);
- fflush (MsgFile);
- };
- return (retval);
- }
- }
-}
-
-INT32
-Mini_init_comm()
-{
- return((*TDF[target_index].init_comm)(tip_config.PC_port_base,
- tip_config.PC_mem_seg));
-}
-
-INT32
-Mini_reset_comm()
-{
- return((*TDF[target_index].reset_comm)(tip_config.PC_port_base,
- tip_config.PC_mem_seg));
-}
-
-INT32
-Mini_exit_comm()
-{
- return((*TDF[target_index].exit_comm)(tip_config.PC_port_base,
- tip_config.PC_mem_seg));
-}
-
-
-void
-Mini_go_target()
-{
- (*TDF[target_index].go)(tip_config.PC_port_base,
- tip_config.PC_mem_seg);
-}
-
-INT32
-Mini_write_memory(m_space, address, byte_count, buffer)
-INT32 m_space;
-ADDR32 address;
-INT32 byte_count;
-BYTE *buffer;
-{
- return((*TDF[target_index].write_memory)(m_space,
- address,
- buffer,
- byte_count,
- tip_config.PC_port_base,
- tip_config.PC_mem_seg));
-}
-
-INT32
-Mini_read_memory(m_space, address, byte_count, buffer)
-INT32 m_space;
-ADDR32 address;
-INT32 byte_count;
-BYTE *buffer;
-{
- return((*TDF[target_index].read_memory)(m_space,
- address,
- buffer,
- byte_count,
- tip_config.PC_port_base,
- tip_config.PC_mem_seg));
-}
-
-INT32
-Mini_fill_memory()
-{
- return((*TDF[target_index].fill_memory)());
-}
-
-/*
-** Functions to build msgs
-*/
-
-void
-Mini_build_reset_msg()
-{
- send_msg_buffer->reset_msg.code = RESET;
- send_msg_buffer->reset_msg.length = (INT32) 0;/* Length always is zero */
-}
-
-void
-Mini_build_config_req_msg()
-{
- send_msg_buffer->config_req_msg.code = CONFIG_REQ;
- send_msg_buffer->config_req_msg.length = (INT32) 0; /* Always zero */
-}
-
-void
-Mini_build_status_req_msg()
-{
-send_msg_buffer->status_req_msg.code = STATUS_REQ;
-send_msg_buffer->status_req_msg.length = (INT32) 0; /* Always zero */
-}
-
-void
-Mini_build_read_req_msg(m_space, address, count, size)
-INT32 m_space;
-ADDR32 address;
-INT32 count;
-INT32 size;
-{
-send_msg_buffer->read_req_msg.code = READ_REQ;
-send_msg_buffer->read_req_msg.length = msg_length(READ_REQ);
-send_msg_buffer->read_req_msg.memory_space = m_space;
-if ((DebugCoreVersion >= (int) 0x13) && (m_space == (INT32) SPECIAL_REG))
- send_msg_buffer->read_req_msg.memory_space = (INT32) A_SPCL_REG;
-send_msg_buffer->read_req_msg.address = address;
-/* if msg version >= 0x10 use new format, else old */
-if (((tip_target_config.version >> 16) & 0xff) >= 0x10) { /* new version */
- send_msg_buffer->read_req_msg.count = count;
- send_msg_buffer->read_req_msg.size = size;
- } else { /* old version */
- send_msg_buffer->read_req_msg.count = count * size;
- }
-}
-
-void
-Mini_build_write_req_msg(m_space, address, count, size, data)
-INT32 m_space;
-ADDR32 address;
-INT32 count;
-INT32 size;
-BYTE *data;
-{
- BYTE *s;
- INT32 i;
- INT32 bcnt = count * size;
-
-send_msg_buffer->write_req_msg.code = WRITE_REQ;
-send_msg_buffer->write_req_msg.length = msg_length(WRITE_REQ) + (count * size);
-send_msg_buffer->write_req_msg.memory_space = m_space;
-if ((DebugCoreVersion >= (int) 0x13) && (m_space == (INT32) SPECIAL_REG))
- send_msg_buffer->write_req_msg.memory_space = (INT32) A_SPCL_REG;
-send_msg_buffer->write_req_msg.address = address;
-
-/* if msg version >= 0x10 use new format, else old */
-if (((tip_target_config.version >> 16) & 0xff) >= 0x10) { /* new version */
- send_msg_buffer->write_req_msg.count = count;
- send_msg_buffer->write_req_msg.size = size;
- s = &(send_msg_buffer->write_req_msg.data);
- for (i = 0; i < bcnt; i++)
- *s++ = *data++;
- } else { /* old version */
- send_msg_buffer->write_req_msg.count = bcnt;
- s = (BYTE *) &(send_msg_buffer->write_req_msg.size);
- for (i = 0; i < bcnt; i++)
- *s++ = *data++;
- }
-}
-
-void
-Mini_build_bkpt_set_msg(m_space, address, pass_count, type)
-INT32 m_space, pass_count, type;
-ADDR32 address;
-{
-send_msg_buffer->bkpt_set_msg.code = BKPT_SET;
-send_msg_buffer->bkpt_set_msg.length = MSG_LENGTH (struct bkpt_set_msg_t);
-send_msg_buffer->bkpt_set_msg.memory_space = m_space;
-send_msg_buffer->bkpt_set_msg.bkpt_addr = address;
-send_msg_buffer->bkpt_set_msg.pass_count = pass_count;
-send_msg_buffer->bkpt_set_msg.bkpt_type = type;
-}
-
-void
-Mini_build_bkpt_rm_msg(m_space, address)
-INT32 m_space;
-ADDR32 address;
-{
-send_msg_buffer->bkpt_rm_msg.code = BKPT_RM;
-send_msg_buffer->bkpt_rm_msg.length = MSG_LENGTH (struct bkpt_rm_msg_t);
-send_msg_buffer->bkpt_rm_msg.memory_space = m_space;
-send_msg_buffer->bkpt_rm_msg.bkpt_addr = address;
-}
-
-void
-Mini_build_bkpt_stat_msg(m_space, address)
-INT32 m_space;
-ADDR32 address;
-{
-send_msg_buffer->bkpt_stat_msg.code = BKPT_STAT;
-send_msg_buffer->bkpt_stat_msg.length = MSG_LENGTH (struct bkpt_stat_msg_t);
-send_msg_buffer->bkpt_stat_msg.memory_space = m_space;
-send_msg_buffer->bkpt_stat_msg.bkpt_addr = address;
-}
-
-void
-Mini_build_copy_msg(src_space, src_addr, dst_space, dst_addr, count, size)
-INT32 src_space, dst_space;
-ADDR32 src_addr, dst_addr;
-INT32 count;
-INT32 size;
-{
-send_msg_buffer->copy_msg.code = COPY;
-send_msg_buffer->copy_msg.length = msg_length(COPY);
-send_msg_buffer->copy_msg.source_space = src_space;
-if ((DebugCoreVersion >= (int) 0x13) && (src_space == (INT32) SPECIAL_REG))
- send_msg_buffer->copy_msg.source_space = (INT32) A_SPCL_REG;
-send_msg_buffer->copy_msg.source_addr = src_addr;
-send_msg_buffer->copy_msg.dest_space = dst_space;
-if ((DebugCoreVersion >= (int) 0x13) && (dst_space == (INT32) SPECIAL_REG))
- send_msg_buffer->copy_msg.dest_space = (INT32) A_SPCL_REG;
-send_msg_buffer->copy_msg.dest_addr = dst_addr;
-
-/* if msg version >= 0x10 use new format, else old */
-if (((tip_target_config.version >> 16) & 0xff) >= 0x10) { /* new version */
- send_msg_buffer->copy_msg.count = count;
- send_msg_buffer->copy_msg.size = size;
- } else { /* old version */
- send_msg_buffer->copy_msg.count = count * size;
- }
-}
-
-void
-Mini_build_fill_msg(m_space, start, fill_count, byte_count, pattern)
-INT32 m_space;
-ADDR32 start;
-INT32 fill_count, byte_count;
-BYTE *pattern;
-{
-send_msg_buffer->fill_msg.code = FILL;
-send_msg_buffer->fill_msg.length = MSG_LENGTH (struct fill_msg_t) +
- byte_count;
-send_msg_buffer->fill_msg.memory_space = m_space;
-if ((DebugCoreVersion >= (int) 0x13) && (m_space == (INT32) SPECIAL_REG))
- send_msg_buffer->fill_msg.memory_space = (INT32) A_SPCL_REG;
-send_msg_buffer->fill_msg.start_addr = start;
-send_msg_buffer->fill_msg.fill_count = fill_count;
-send_msg_buffer->fill_msg.byte_count = byte_count;
-(void) strcpy ( &(send_msg_buffer->fill_msg.fill_data),pattern);
-}
-
-void
-Mini_build_init_msg(t_start, t_end, d_start, d_end,
- entry, m_stack, r_stack,
- highmem, arg_start, os_ctrl)
-ADDR32 t_start, t_end, d_start, d_end;
-ADDR32 entry, highmem, arg_start;
-INT32 m_stack, r_stack;
-INT32 os_ctrl;
-{
-send_msg_buffer->init_msg.code = INIT;
-/* subtract 4 to hide highmem value */
-send_msg_buffer->init_msg.length = MSG_LENGTH (struct init_msg_t) - 4;
-send_msg_buffer->init_msg.text_start = t_start;
-send_msg_buffer->init_msg.text_end = t_end;
-send_msg_buffer->init_msg.data_start = d_start;
-send_msg_buffer->init_msg.data_end = d_end;
-send_msg_buffer->init_msg.entry_point = entry;
-send_msg_buffer->init_msg.mem_stack_size = m_stack;
-send_msg_buffer->init_msg.reg_stack_size = r_stack;
-send_msg_buffer->init_msg.arg_start = arg_start;
-send_msg_buffer->init_msg.os_control = os_ctrl;
-send_msg_buffer->init_msg.highmem = highmem;
-}
-
-void
-Mini_build_go_msg()
-{
-send_msg_buffer->go_msg.code = GO;
-send_msg_buffer->go_msg.length = (INT32) 0; /* Always zero */
-}
-
-void
-Mini_build_step_msg(count)
-INT32 count;
-{
-send_msg_buffer->step_msg.code = STEP;
-send_msg_buffer->step_msg.length = sizeof(INT32);
-send_msg_buffer->step_msg.count = count;
-}
-
-void
-Mini_build_break_msg()
-{
-send_msg_buffer->break_msg.code = BREAK;
-send_msg_buffer->break_msg.length = (INT32) 0; /* Always zero */
-}
-
-void
-Mini_build_hif_rtn_msg(snum, gr121, gr96, gr97)
-INT32 snum, gr121, gr96, gr97;
-{
-send_msg_buffer->hif_call_rtn_msg.code = HIF_CALL_RTN;
-send_msg_buffer->hif_call_rtn_msg.length = MSG_LENGTH (struct hif_call_rtn_msg_t);
-send_msg_buffer->hif_call_rtn_msg.service_number = snum;
-send_msg_buffer->hif_call_rtn_msg.gr121 = gr121;
-send_msg_buffer->hif_call_rtn_msg.gr96 = gr96;
-send_msg_buffer->hif_call_rtn_msg.gr97 = gr97;
-}
-
-void
-Mini_build_channel0_msg(input, count)
-INT32 count;
-BYTE *input;
-{
-send_msg_buffer->channel0_msg.code = CHANNEL0;
-send_msg_buffer->channel0_msg.length = count; /* bytes to follow */
-(void ) memcpy (&(send_msg_buffer->channel0_msg.data), input, (int) count);
-}
-
-void
-Mini_build_channel1_ack_msg(gr96)
-INT32 gr96;
-{
-send_msg_buffer->channel1_ack_msg.code = CHANNEL1_ACK;
- /*
- * The HIF kernel from MiniMON29K release 2.1 expects MONTIP
- * to send a HIF_CALL_RTN response for a HIF_CALL message, and
- * a CHANNEL1_ACK response for a CHANNEL1 message, and
- * a CHANNEL2_ACK response for a CHANNEL2 message, and
- * a CHANNEL0 message for a asynchronous input.
- * The HIF kernel version numbers 0x05 and above support these
- * features.
- */
- if ((tip_target_config.os_version & 0xf) > 4) { /* new HIF kernel */
- /*
- * The CHANNEL1_ACK for new HIF kernel includes the gr96 value
- * which is the number of characters succesfully printed out.
- */
- send_msg_buffer->channel1_ack_msg.length = (INT32) 4; /* return gr96 */
- send_msg_buffer->channel1_ack_msg.gr96 = gr96;
- } else { /* old HIF kernel */
- send_msg_buffer->channel1_ack_msg.length = (INT32) 0;
- }
-}
-
-void
-Mini_build_channel2_ack_msg(gr96)
-INT32 gr96;
-{
-send_msg_buffer->channel2_ack_msg.code = CHANNEL2_ACK;
- /*
- * The HIF kernel from MiniMON29K release 2.1 expects MONTIP
- * to send a HIF_CALL_RTN response for a HIF_CALL message, and
- * a CHANNEL1_ACK response for a CHANNEL1 message, and
- * a CHANNEL2_ACK response for a CHANNEL2 message, and
- * a CHANNEL0 message for a asynchronous input.
- * The HIF kernel version numbers 0x05 and above support these
- * features.
- */
- if ((tip_target_config.os_version & 0xf) > 4) { /* new HIF kernel */
- /*
- * The CHANNEL1_ACK for new HIF kernel includes the gr96 value
- * which is the number of characters succesfully printed out.
- */
- send_msg_buffer->channel2_ack_msg.length = (INT32) 4; /* return gr96 */
- send_msg_buffer->channel2_ack_msg.gr96 = gr96;
- } else { /* old HIF kernel */
- /*
- * The old kernels did not support this feature. They invoked the
- * debugger on target to get the information.
- */
- }
-}
-
-void Mini_build_stdin_needed_ack_msg (count, data)
-UINT32 count;
-BYTE *data;
-{
- BYTE *s;
-
-send_msg_buffer->stdin_needed_ack_msg.code = STDIN_NEEDED_ACK;
-send_msg_buffer->stdin_needed_ack_msg.length = (INT32) count;
-s = &(send_msg_buffer->stdin_needed_ack_msg.data);
-for (; count > 0; count--)
- *s++ = *data++;
-}
-
-void Mini_build_stdin_mode_ack_msg (mode)
-INT32 mode;
-{
-send_msg_buffer->stdin_mode_ack_msg.code = STDIN_MODE_ACK;
-send_msg_buffer->stdin_mode_ack_msg.length = MSG_LENGTH(struct stdin_mode_ack_msg_t);
-send_msg_buffer->stdin_mode_ack_msg.mode = mode;
-}
-
-/*
-** Functions to unpack messages.
-*/
-
-void
-Mini_unpack_reset_ack_msg()
-{
- /* No data in this message */
-}
-
-void
-Mini_unpack_config_msg(target_config)
-TIP_TARGET_CONFIG *target_config;
-{
- /* received a CONFIG message */
- target_config->processor_id = recv_msg_buffer->config_msg.processor_id;
- target_config->version = recv_msg_buffer->config_msg.version;
- DebugCoreVersion = (int) (target_config->version & 0xFF);
- target_config->I_mem_start = recv_msg_buffer->config_msg.I_mem_start;
- target_config->I_mem_size = recv_msg_buffer->config_msg.I_mem_size;
- target_config->D_mem_start = recv_msg_buffer->config_msg.D_mem_start;
- target_config->D_mem_size = recv_msg_buffer->config_msg.D_mem_size;
- target_config->ROM_start = recv_msg_buffer->config_msg.ROM_start;
- target_config->ROM_size = recv_msg_buffer->config_msg.ROM_size;
- target_config->max_msg_size = recv_msg_buffer->config_msg.max_msg_size;
- target_config->max_bkpts = recv_msg_buffer->config_msg.max_bkpts;
- target_config->coprocessor = recv_msg_buffer->config_msg.coprocessor;
- target_config->os_version = recv_msg_buffer->config_msg.os_version;
-}
-
-void
-Mini_unpack_status_msg(target_status)
-TIP_TARGET_STATUS *target_status;
-{
- /* received a STATUS mesages */
- target_status->msgs_sent = recv_msg_buffer->status_msg.msgs_sent;
- target_status->msgs_received = recv_msg_buffer->status_msg.msgs_received;
- target_status->errors = recv_msg_buffer->status_msg.errors;
- target_status->bkpts_hit = recv_msg_buffer->status_msg.bkpts_hit;
- target_status->bkpts_free = recv_msg_buffer->status_msg.bkpts_free;
- target_status->traps = recv_msg_buffer->status_msg.traps;
- target_status->fills = recv_msg_buffer->status_msg.fills;
- target_status->spills = recv_msg_buffer->status_msg.spills;
- target_status->cycles = recv_msg_buffer->status_msg.cycles;
-}
-
-void
-Mini_unpack_read_ack_msg(mspace, address, bytecount, buffer)
-INT32 *mspace;
-ADDR32 *address;
-INT32 *bytecount;
-BYTE *buffer;
-{
- INT32 i;
- BYTE *s;
-
- /* READ_ACK received */
- *mspace = recv_msg_buffer->read_ack_msg.memory_space;
- if ((DebugCoreVersion >= (int) 0x13) && (*mspace == (INT32) A_SPCL_REG))
- *mspace = (INT32) SPECIAL_REG;
- *address = recv_msg_buffer->read_ack_msg.address;
- *bytecount = recv_msg_buffer->read_ack_msg.byte_count;
- s = &(recv_msg_buffer->read_ack_msg.data);
- for (i = 0; i < *bytecount; i++)
- *buffer++ = *s++;
-}
-
-void
-Mini_unpack_write_ack_msg(mspace, address, bytecount)
-INT32 *mspace;
-ADDR32 *address;
-INT32 *bytecount;
-{
- *mspace =recv_msg_buffer->write_ack_msg.memory_space;
- if ((DebugCoreVersion >= (int) 0x13) && (*mspace == (INT32) A_SPCL_REG))
- *mspace = (INT32) SPECIAL_REG;
- *address =recv_msg_buffer->write_ack_msg.address;
- *bytecount =recv_msg_buffer->write_ack_msg.byte_count;
-}
-
-void
-Mini_unpack_bkpt_set_ack_msg(mspace, address, passcount, bkpt_type)
-INT32 *mspace;
-ADDR32 *address;
-INT32 *passcount;
-INT32 *bkpt_type;
-{
- *mspace =recv_msg_buffer->bkpt_set_ack_msg.memory_space;
- *address =recv_msg_buffer->bkpt_set_ack_msg.address;
- *passcount =recv_msg_buffer->bkpt_set_ack_msg.pass_count;
- *bkpt_type =recv_msg_buffer->bkpt_set_ack_msg.bkpt_type;
-}
-
-void
-Mini_unpack_bkpt_rm_ack_msg(mspace, address)
-INT32 *mspace;
-ADDR32 *address;
-{
- *mspace = recv_msg_buffer->bkpt_rm_ack_msg.memory_space;
- *address = recv_msg_buffer->bkpt_rm_ack_msg.address;
-}
-
-void
-Mini_unpack_bkpt_stat_ack_msg(mspace, address, pass_count, bkpt_type)
-INT32 *mspace;
-ADDR32 *address;
-INT32 *pass_count;
-INT32 *bkpt_type;
-{
- *mspace = recv_msg_buffer->bkpt_stat_ack_msg.memory_space;
- *address = recv_msg_buffer->bkpt_stat_ack_msg.address;
- *pass_count = recv_msg_buffer->bkpt_stat_ack_msg.pass_count;
- *bkpt_type = recv_msg_buffer->bkpt_stat_ack_msg.bkpt_type;
-}
-
-void
-Mini_unpack_copy_ack_msg(srcspace, srcaddr, dstspace, dstaddr, count)
-INT32 *srcspace, *dstspace;
-ADDR32 *srcaddr, *dstaddr;
-INT32 *count;
-{
- *srcspace = recv_msg_buffer->copy_ack_msg.source_space;
- if ((DebugCoreVersion >= (int) 0x13) && (*srcspace == (INT32) A_SPCL_REG))
- *srcspace = (INT32) SPECIAL_REG;
- *srcaddr = recv_msg_buffer->copy_ack_msg.source_addr;
- *dstspace = recv_msg_buffer->copy_ack_msg.dest_space;
- if ((DebugCoreVersion >= (int) 0x13) && (*dstspace == (INT32) A_SPCL_REG))
- *dstspace = (INT32) SPECIAL_REG;
- *dstaddr = recv_msg_buffer->copy_ack_msg.dest_addr;
- *count = recv_msg_buffer->copy_ack_msg.byte_count;
-}
-
-void
-Mini_unpack_fill_ack_msg(mspace, startaddr, fillcount, pattern_cnt)
-INT32 *mspace;
-ADDR32 *startaddr;
-INT32 *fillcount;
-INT32 *pattern_cnt;
-{
- *mspace = recv_msg_buffer->fill_ack_msg.memory_space;
- if ((DebugCoreVersion >= (int) 0x13) && (*mspace == (INT32) A_SPCL_REG))
- *mspace = (INT32) SPECIAL_REG;
- *startaddr = recv_msg_buffer->fill_ack_msg.start_addr;
- *fillcount = recv_msg_buffer->fill_ack_msg.fill_count;
- *pattern_cnt = recv_msg_buffer->fill_ack_msg.byte_count;
-}
-
-void
-Mini_unpack_init_ack_msg()
-{
- /* No data in this message */
-
-}
-
-void
-Mini_unpack_halt_msg(mspace, pc0, pc1, trap_number)
-INT32 *mspace;
-ADDR32 *pc0;
-ADDR32 *pc1;
-INT32 *trap_number;
-{
- *mspace = recv_msg_buffer->halt_msg.memory_space;
- *pc0 = recv_msg_buffer->halt_msg.pc0;
- *pc1 = recv_msg_buffer->halt_msg.pc1;
- *trap_number = recv_msg_buffer->halt_msg.trap_number;
-}
-
-void
-Mini_unpack_error_msg(errcode, mspace, address)
-INT32 *errcode;
-INT32 *mspace;
-ADDR32 *address;
-{
- *errcode = recv_msg_buffer->error_msg.error_code;
- *mspace = recv_msg_buffer->error_msg.memory_space;
- *address = recv_msg_buffer->error_msg.address;
-}
-
-void
-Mini_unpack_channel0_ack_msg()
-{
- /* No data in this message */
-}
-
-void
-Mini_unpack_channel2_msg(data, len)
-BYTE *data;
-INT32 *len;
-{
- INT32 i;
- BYTE *s;
-
- *len = recv_msg_buffer->channel2_msg.length;
- s = &(recv_msg_buffer->channel2_msg.data);
- for (i = 0; i < *len; i++)
- *data++ = *s++;
-}
-
-void
-Mini_unpack_channel1_msg(data, len)
-BYTE *data;
-INT32 *len;
-{
- INT32 i;
- BYTE *s;
-
- *len = recv_msg_buffer->channel1_msg.length;
- s = &(recv_msg_buffer->channel1_msg.data);
- for (i = 0; i < *len; i++)
- *data++ = *s++;
-}
-
-void
-Mini_unpack_hif_msg (gr121, lr2, lr3, lr4)
-INT32 *gr121;
-INT32 *lr2;
-INT32 *lr3;
-INT32 *lr4;
-{
- *gr121 = recv_msg_buffer->hif_call_msg.service_number;
- *lr2 = recv_msg_buffer->hif_call_msg.lr2;
- *lr3 = recv_msg_buffer->hif_call_msg.lr3;
- *lr4 = recv_msg_buffer->hif_call_msg.lr4;
-}
-
-void Mini_unpack_stdin_needed_msg (nbytes)
-INT32 *nbytes;
-{
- *nbytes = recv_msg_buffer->stdin_needed_msg.nbytes;
-}
-
-void Mini_unpack_stdin_mode_msg (mode)
-INT32 *mode;
-{
- *mode = recv_msg_buffer->stdin_mode_msg.mode;
-}
-
-
-/* miscellaneous */
-
-static
-INT32 match_name(name)
-char *name;
-{
- int i;
-
- i = 0;
- while (TDF[i].target_name) {
- if (strcmp(TDF[i].target_name, name))
- i++;
- else
- return((INT32) i);
- }
- return(FAILURE);
-}
-
-/*
-** This function is used to print out a message which has
-** been received from the target.
-*/
-
-void
-print_msg(msg, MsgFile)
- union msg_t *msg;
- FILE *MsgFile;
- {
- INT32 i, j;
- INT32 length;
- BYTE *s;
- INT32 *hex;
- INT32 code;
-
- hex = &(msg->generic_int32_msg.int32);
- s = &(msg->generic_msg.byte);
- length = msg->generic_msg.length;
-
- fprintf(MsgFile, "\n");
- code = msg->generic_msg.code;
- fprintf(MsgFile, "Code: %ld ", code);
- switch (code) {
- case RESET:
- fprintf(MsgFile,"(RESET)\t");
- break;
- case CONFIG_REQ:
- fprintf(MsgFile,"(CONFIG_REQ)\t");
- break;
- case STATUS_REQ:
- fprintf(MsgFile,"(STATUS_REQ)\t");
- break;
- case READ_REQ:
- fprintf(MsgFile,"(READ_REQ)\t");
- break;
- case WRITE_REQ:
- fprintf(MsgFile,"(WRITE_REQ)\t");
- break;
- case BKPT_SET:
- fprintf(MsgFile,"(BKPT_SET)\t");
- break;
- case BKPT_RM:
- fprintf(MsgFile,"(BKPT_RM)\t");
- break;
- case BKPT_STAT:
- fprintf(MsgFile,"(BKPT_STAT)\t");
- break;
- case COPY:
- fprintf(MsgFile,"(COPY)\t");
- break;
- case FILL:
- fprintf(MsgFile,"(FILL)\t");
- break;
- case INIT:
- fprintf(MsgFile,"(INIT)\t");
- break;
- case GO:
- fprintf(MsgFile,"(GO)\t");
- break;
- case STEP:
- fprintf(MsgFile,"(STEP)\t");
- break;
- case BREAK:
- fprintf(MsgFile,"(BREAK)\t");
- break;
- case HIF_CALL_RTN:
- fprintf(MsgFile,"(HIF_CALL_RTN)\t");
- break;
- case CHANNEL0:
- fprintf(MsgFile,"(CHANNEL0)\t");
- break;
- case CHANNEL1_ACK:
- fprintf(MsgFile,"(CHANNEL1_ACK)\t");
- break;
- case CHANNEL2_ACK:
- fprintf(MsgFile,"(CHANNEL2_ACK)\t");
- break;
- case STDIN_NEEDED_ACK:
- fprintf(MsgFile,"(STDIN_NEEDED_ACK)\t");
- break;
- case STDIN_MODE_ACK:
- fprintf(MsgFile,"(STDIN_MODE_ACK)\t");
- break;
- case RESET_ACK:
- fprintf(MsgFile,"(RESET_ACK)\t");
- break;
- case CONFIG:
- fprintf(MsgFile,"(CONFIG)\t");
- break;
- case STATUS:
- fprintf(MsgFile,"(STATUS)\t");
- break;
- case READ_ACK:
- fprintf(MsgFile,"(READ_ACK)\t");
- break;
- case WRITE_ACK:
- fprintf(MsgFile,"(WRITE_ACK)\t");
- break;
- case BKPT_SET_ACK:
- fprintf(MsgFile,"(BKPT_SET_ACK)\t");
- break;
- case BKPT_RM_ACK:
- fprintf(MsgFile,"(BKPT_RM_ACK)\t");
- break;
- case BKPT_STAT_ACK:
- fprintf(MsgFile,"(BKPT_STAT_ACK)\t");
- break;
- case COPY_ACK:
- fprintf(MsgFile,"(COPY_ACK)\t");
- break;
- case FILL_ACK:
- fprintf(MsgFile,"(FILL_ACK)\t");
- break;
- case INIT_ACK:
- fprintf(MsgFile,"(INIT_ACK)\t");
- break;
- case HALT:
- fprintf(MsgFile,"(HALT)\t");
- break;
- case ERROR:
- fprintf(MsgFile,"(ERROR)\t");
- break;
- case HIF_CALL:
- fprintf(MsgFile,"(HIF_CALL)\t");
- break;
- case CHANNEL0_ACK:
- fprintf(MsgFile,"(CHANNEL0_ACK)\t");
- break;
- case CHANNEL1:
- fprintf(MsgFile,"(CHANNEL1)\t");
- break;
- case CHANNEL2:
- fprintf(MsgFile,"(CHANNEL2)\t");
- break;
- case STDIN_NEEDED_REQ:
- fprintf(MsgFile,"(STDIN_NEEDED_REQ)\t");
- break;
- case STDIN_MODE_REQ:
- fprintf(MsgFile,"(STDIN_MODE_REQ)\t");
- break;
- default:
- fprintf(MsgFile,"(unknown)\t");
- break;
- }
- fprintf(MsgFile, "Length: %ld\n", msg->generic_msg.length);
- if ((code == CHANNEL1) || (code == CHANNEL2))
- return;
- if ((code == WRITE_REQ) || (code == FILL)) length = 20;
- if (code == READ_ACK) length = 16;
- if (code == STDIN_NEEDED_ACK) length = 16;
- for (i=0; i<((length+sizeof(INT32)-1)/sizeof(INT32)); i=i+1) {
- fprintf(MsgFile, "%08lx (", *hex++);
- for (j=0; j<sizeof(INT32); j=j+1)
- if (isprint(*s))
- fprintf(MsgFile, "%d", *s++);
- else
- s++, fprintf(MsgFile, ".");
- fprintf(MsgFile, ")\n");
- }
-
- } /* end print_msg() */
-
-
-
-
-void
-CopyMsgToTarg(source)
-union msg_t *source;
-{
- INT32 msglen;
- INT32 count;
- char *to, *from;
-
- send_msg_buffer->generic_msg.code = source->generic_msg.code;
- send_msg_buffer->generic_msg.length = source->generic_msg.length;
- msglen = source->generic_msg.length;
- to = (char *) &(send_msg_buffer->generic_msg.byte);
- from = (char *) &(source->generic_msg.byte);
- for (count = (INT32) 0; count < msglen; count++)
- *to++ = *from++;
-
-}
-
-void
-CopyMsgFromTarg(dest)
-union msg_t *dest;
-{
- INT32 msglen;
- INT32 count;
- char *to, *from;
-
- dest->generic_msg.code = recv_msg_buffer->generic_msg.code;
- dest->generic_msg.length = recv_msg_buffer->generic_msg.length;
- msglen = recv_msg_buffer->generic_msg.length;
- to = (char *) &(dest->generic_msg.byte);
- from = (char *) &(recv_msg_buffer->generic_msg.byte);
- for (count = (INT32) 0; count < msglen; count++)
- *to++ = *from++;
-
-}
-
-void
-print_recv_bytes()
-{
- printf("Bytes received: \n");
- printf("0x%lx \n", (long) recv_msg_buffer->generic_msg.code);
- printf("0x%lx \n", (long) recv_msg_buffer->generic_msg.length);
-}
-
+++ /dev/null
-static char _[] = "@(#)mtip.c 2.14 92/01/13 18:04:36, AMD.";
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineers: MINIMON DEVELOPMENT TEAM MEMBERS, AMD.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <malloc.h>
-#include "messages.h"
-#include "coff.h"
-#include "memspcs.h"
-#include "mtip.h"
-#include "macros.h"
-
-/* TIP Breakpoint table */
-typedef unsigned int BreakIdType;
-
-static struct break_table {
- BreakIdType id;
- INT32 space;
- ADDR32 offset;
- INT32 count;
- INT32 type;
- ADDR32 BreakInst; /* actual instruction */
- struct break_table *next;
-};
-
-struct break_table *bp_table=NULL;
-
-#define BUFFER_SIZE 1024
-
-static BYTE buffer[BUFFER_SIZE];
-
-int Mini_core_load PARAMS((char *corefile, INT32 space,
- INT32 sects, int syms));
-void add_to_bp_table PARAMS((BreakIdType *id, INT32 space,
- ADDR32 offset, INT32 count, INT32 type, ADDR32 inst));
-int get_from_bp_table PARAMS((BreakIdType id, INT32 *space,
- ADDR32 *offset, INT32 *count,
- INT32 *type, ADDR32 *inst));
-int remove_from_bp_table PARAMS((BreakIdType id));
-int is_breakpt_at PARAMS((INT32 space, ADDR32 offset));
-
-/*
-** Breakpoint code
-*/
-
-void
-add_to_bp_table(id, space, offset, count, type, inst)
-BreakIdType *id;
-INT32 space;
-ADDR32 offset;
-INT32 count;
-INT32 type;
-ADDR32 inst;
-{
- static BreakIdType current_break_id=1;
- struct break_table *temp, *temp2;
-
- if (bp_table == NULL) { /* first element */
- bp_table = (struct break_table *) malloc (sizeof(struct break_table));
- bp_table->id = current_break_id;
- bp_table->offset = offset;
- bp_table->space = space;
- bp_table->count = count;
- bp_table->type = type;
- bp_table->BreakInst = inst;
- bp_table->next = NULL;
- } else {
- temp2 = bp_table;
- temp = (struct break_table *) malloc (sizeof(struct break_table));
- temp->id = current_break_id;
- temp->offset = offset;
- temp->space = space;
- temp->count = count;
- temp->type = type;
- temp->BreakInst = inst;
- temp->next = NULL;
- while (temp2->next != NULL)
- temp2 = temp2->next;
- temp2->next = temp;
- };
- *id = current_break_id;
- current_break_id++;
-}
-
-int
-get_from_bp_table(id, space, offset, count, type, inst)
-BreakIdType id;
-INT32 *space;
-ADDR32 *offset;
-INT32 *count;
-INT32 *type;
-ADDR32 *inst;
-{
- struct break_table *temp;
-
- temp = bp_table;
-
- while (temp != NULL) {
- if (temp->id == id) {
- *offset = temp->offset;
- *space = temp->space;
- *count = temp->count;
- *type = temp->type;
- *inst = temp->BreakInst;
- return(0);
- } else {
- temp = temp->next;
- };
- }
- return(-1);
-}
-
-int
-remove_from_bp_table(id)
-BreakIdType id;
-{
- struct break_table *temp, *temp2;
-
- if (bp_table == NULL)
- return (-1);
- else {
- temp = bp_table;
- if (temp->id == id) { /* head of list */
- bp_table = bp_table->next;
- (void) free (temp);
- return (0); /* success */
- } else {
- while (temp->next != NULL) {
- if (temp->next->id == id) {
- temp2 = temp->next;
- temp->next = temp->next->next;
- (void) free (temp2);
- return (0); /* success */
- } else {
- temp = temp->next;
- }
- };
- }
- };
- return (-1); /* failed */
-}
-
-int
-is_breakpt_at(space, offset)
-INT32 space;
-ADDR32 offset;
-{
- struct break_table *temp;
-
- temp = bp_table;
-
- while (temp != NULL) {
- if ((temp->space == space) && (temp->offset == offset)) {
- return(1); /* TRUE */
- } else {
- temp = temp->next;
- };
- }
- return(0); /* FALSE */
-}
-
-/*
-** Miscellaneous functions.
-*/
-
-int
-Mini_core_load(filename, space, sects, syms)
-char *filename;
-INT32 space;
-INT32 sects;
-int syms;
- {
-
- FILE *coff_in;
- INT32 COFF_sections;
- INT32 i;
- int read_count;
- int section_type;
- int host_endian;
- INT32 flags;
- INT32 memory_space;
- INT32 address;
- INT32 byte_count;
- INT32 write_count;
- INT32 temp_byte_count;
- INT16 temp_magic;
- INT16 temp_sections;
-
- struct filehdr COFF_header;
- struct aouthdr COFF_aout_header;
- struct scnhdr *COFF_section_header;
- struct scnhdr *temp_COFF_section_header;
-
- /* Open the COFF input file (if we can) */
- coff_in = fopen(filename, FILE_OPEN_FLAG);
- if (coff_in == NULL) {
- /* warning (EMOPEN); */
- return(-1);
- }
-
- /*
- ** Process COFF header(s)
- */
-
- /* Read in COFF header information */
- read_count = fread((char *)&COFF_header,
- sizeof(struct filehdr),
- 1, coff_in);
-
- /* Did we get it all? */
- if (read_count != 1) {
- fclose(coff_in);
- /* warning(EMHDR); */
- return (-1);
- }
-
- /* Is it an Am29000 COFF File? */
- temp_magic = COFF_header.f_magic;
- tip_convert16((BYTE *) &temp_magic);
- if (COFF_header.f_magic == SIPFBOMAGIC) {
- host_endian = TRUE;
- }
- else
- if (temp_magic == SIPFBOMAGIC) {
- host_endian = FALSE;
- }
- else
- {
- fclose(coff_in);
- /* warning (EMMAGIC); */
- return (-1);
- }
-
- /* Get number of COFF sections */
- temp_sections = COFF_header.f_nscns;
- if (host_endian == FALSE)
- tip_convert16((BYTE *) &temp_sections);
- COFF_sections = (INT32) temp_sections;
-
- /* Read in COFF a.out header information (if we can) */
- if (COFF_header.f_opthdr > 0) {
- read_count = fread((char *)&COFF_aout_header,
- sizeof(struct aouthdr),
- 1, coff_in);
-
- /* Did we get it all? */
- if (read_count != 1) {
- fclose(coff_in);
- /* warning (EMAOUT); */
- return (-1);
- }
-
- }
-
- /*
- ** Process COFF section headers
- */
-
- /* Allocate space for section headers */
- (char *)COFF_section_header = (char *)
- malloc((unsigned) (COFF_sections * sizeof(struct scnhdr)));
-
- if (COFF_section_header == NULL) {
- fclose(coff_in);
- /* warning (EMALLOC); */
- return (-1);
- }
-
- /* Save the pointer to the malloc'ed data, so
- ** we can free it later. */
- temp_COFF_section_header = COFF_section_header;
-
- read_count = fread((char *)COFF_section_header,
- sizeof(struct scnhdr),
- (int) COFF_sections, coff_in);
-
- /* Did we get it all? */
- if (read_count != (int) COFF_sections) {
- fclose(coff_in);
- /* warning (EMSCNHDR); */
- return (-1);
- }
-
-
- /* Process all sections */
- for (i=0; i<COFF_sections; i=i+1) {
-
- address = COFF_section_header->s_paddr;
- byte_count = COFF_section_header->s_size;
- flags = COFF_section_header->s_flags;
-
- if (host_endian == FALSE) {
- tip_convert32((BYTE *) &address);
- tip_convert32((BYTE *) &byte_count);
- tip_convert32((BYTE *) &flags);
- }
-
- /* Print downloading messages (if necessary) */
- if ((flags == STYP_TEXT) ||
- (flags == (STYP_TEXT | STYP_ABS))) {
- section_type = TEXT_SECTION;
- memory_space = I_MEM;
- }
- else
- if ((flags == STYP_DATA) ||
- (flags == (STYP_DATA | STYP_ABS))) {
- section_type = DATA_SECTION;
- memory_space = D_MEM;
- }
- else
- if ((flags == STYP_LIT) ||
- (flags == (STYP_LIT | STYP_ABS))) {
- section_type = LIT_SECTION;
- memory_space = D_MEM;
- }
- else
- if ((flags == STYP_BSS) ||
- (flags == (STYP_BSS | STYP_ABS))) {
- section_type = BSS_SECTION;
- memory_space = D_MEM;
- }
- else {
- section_type = UNKNOWN_SECTION;
- }
-
- /* Clear BSS sections in 29K data memory */
- if (section_type == BSS_SECTION) {
- (void) memset ((char *) buffer, (int) '\0', sizeof(buffer));
- while (byte_count > 0) {
- write_count = (byte_count < (INT32) sizeof(buffer)) ?
- byte_count : (INT32) sizeof (buffer);
- if(Mini_write_memory ((INT32) memory_space,
- (ADDR32) address,
- (INT32) write_count,
- (BYTE *) buffer) != SUCCESS) {
- (void) fclose(coff_in);
- return(-1);
- }
- address = address + write_count;
- byte_count = byte_count - write_count;
- }
- } else
-
- /* Else send data to the target */
- while (byte_count > 0) {
-
- temp_byte_count = MIN(byte_count, (INT32) sizeof(buffer));
-
- read_count = fread((char *) buffer,
- (int) temp_byte_count,
- 1, coff_in);
-
- /* Did we get it all? */
- if (read_count != 1) {
- fclose(coff_in);
- /* warning (EMSCN); */
- return (-1);
- }
-
- /* Write to 29K memory*/
- if (section_type != UNKNOWN_SECTION) {
- if (Mini_write_memory ((INT32) memory_space,
- (ADDR32) address,
- (INT32) temp_byte_count,
- (BYTE *) buffer) != SUCCESS) {
- /* warning(EMWRITE); */
- (void) fclose(coff_in);
- return(-1);
- };
- }
-
- address = address + temp_byte_count;
-
- byte_count = byte_count - temp_byte_count;
-
- } /* end while */
-
- COFF_section_header++;
-
- } /* end for loop */
-
- (void) free((char *)temp_COFF_section_header);
- (void) fclose(coff_in);
-
- return (0);
-
- } /* end Mini_loadcoff() */
-
+++ /dev/null
-static char _[] = "@(#)parallel.c 1.4 93/09/08 14:14:32, Srini, AMD.";
-/******************************************************************************
- * Copyright 1992 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Systems Engineering
- * Mail Stop 573
- * 5204 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- * 29k-support@AMD.COM
- ****************************************************************************
- * Engineer: Srini Subramanian.
- ****************************************************************************
- */
-#include <bios.h>
-#include <conio.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "types.h"
-#include "memspcs.h"
-#include "messages.h"
-#include "mtip.h"
-#include "tdfunc.h"
-
-void endian_cvt PARAMS((union msg_t *, int));
-
-extern FILE *MsgFile; /* for logging error retries */
-
-unsigned _bios_printer(unsigned service, unsigned printer, unsigned data);
-
-
-INT32 par_write( char *buffer, INT32 length);
-
-static unsigned portID=0;
-
-#define LPT1 0
-#define LPT2 1
-
-#define CHECKSUM_FAIL -1
-
-INT32
-init_parport(portname)
-char *portname;
-{
- unsigned status;
-
- if (strncmp(portname, "lpt1", 4) == 0) {
- status = _bios_printer( _PRINTER_INIT, LPT1, 0);
- portID = LPT1;
- } else if (strncmp(portname, "lpt2", 4) == 0) {
- status = _bios_printer( _PRINTER_INIT, LPT2, 0);
- portID = LPT2;
- }
-#if 0
- if (status != 0x90) {
- printf("parallel port status 0x%.4x\n", status);
- return ((INT32) -1);
- } else {
- return ((INT32) 0);
- }
-#endif
- return ((INT32) 0);
-}
-
-
-INT32
-msg_send_parport(msg_ptr, port_base)
-union msg_t *msg_ptr;
-INT32 port_base;
-{
- INT32 result, i, ack, comm_err;
- UINT32 checksum;
- unsigned int timeout;
- INT32 Rx_ack[2];
-
- INT32 header_size = (2 * sizeof(INT32));
-
- BYTE *bfr_ptr = (BYTE *) msg_ptr;
-
- /* Save length before doing endian conversion */
- INT32 length = msg_ptr->generic_msg.length;
- INT32 total_length;
-
- total_length = header_size + length;
-
- /* Endian conversion */
- if (tip_target_config.TipEndian != tip_target_config.P29KEndian)
- endian_cvt(msg_ptr, OUTGOING_MSG);
-
- /* calc checksum for msg */
- checksum = 0;
- for (i=0; i < total_length; i++)
- checksum = checksum + bfr_ptr[i];
-
- /* Append checksum to the end of the message. Do not update the
- * "length" field of the message header.
- */
- bfr_ptr[total_length] = (BYTE) ((checksum >> 24) & 0xff);
- bfr_ptr[total_length+1] = (BYTE) ((checksum >> 16) & 0xff);
- bfr_ptr[total_length+2] = (BYTE) ((checksum >> 8) & 0xff);
- bfr_ptr[total_length+3] = (BYTE) ((checksum >> 0) & 0xff);
-
- /* send msg */
- comm_err = (INT32) 0;
-
- /* send msg */
- result = par_write((char *)bfr_ptr, total_length+4 /* +4 */);
- if (result != (INT32) 0)
- return((INT32) FAILURE);
-
- /* get ack */
- timeout = 0;
- result = (INT32) -1;
- comm_err = (INT32) 0;
- while ((timeout < 600) && (result == (INT32) -1)
- && (comm_err == (INT32) 0)) {
- /* Poll for user interrupt */
- timeout=timeout+1;
- result = recv_bfr_serial((BYTE *) Rx_ack, (2 * sizeof(INT32)),
- BLOCK, port_base, &comm_err);
- }
-
- if (comm_err != (INT32) 0) {
- reset_comm_serial((INT32) -1, (INT32) -1);
- return ((INT32) MSGRETRY);
- }
- /* check if timed out */
- if (timeout >= 10000) {
- if (MsgFile) {
- fprintf(MsgFile,"Timed out before ACK received. Reset comm. timeout=%ld\n",timeout);
- fflush(MsgFile);
- }
- (void) reset_comm_serial((INT32) 0, (INT32) 0);
- return ((INT32) MSGRETRY);
- }
-
- ack = (INT32) Rx_ack[1];
-
- /* endian convert Ack */
- if (tip_target_config.TipEndian != tip_target_config.P29KEndian)
- tip_convert32((BYTE *) &ack);
-
- if (ack != CHECKSUM_FAIL) {
- return(0); /* successful send */
- }
- else {
- if (MsgFile) { /* log the error */
- fprintf(MsgFile,
- "\n** Checksum: Nack Received, Resending.\n");
- fflush(MsgFile);
- };
- }
-
- return ((INT32) FAILURE);
-
-}
-
-INT32
-par_write(buffer, length)
-char *buffer;
-INT32 length;
-{
-
- unsigned status;
-
- for ( ; length > (INT32) 0; length=length-1)
- {
- status = _bios_printer(_PRINTER_WRITE, portID, (unsigned) *buffer);
- /* printf("status 0x%.4x \n", status); */
- buffer++;
- }
- return ((INT32) 0);
-}
+++ /dev/null
-static char _[] = "@(#)pceb.c 5.18 93/07/30 16:40:31, AMD.";
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- **
- ** This file defines functions which initialize and access the
- ** the PCEB 29K board.
- **
- *****************************************************************************
- */
-
-
-#include <stdio.h>
-#include <memory.h>
-#include "messages.h"
-#include "pceb.h"
-#include "memspcs.h"
-#include "macros.h"
-#include "tdfunc.h"
-#include "mtip.h"
-
-#include <dos.h>
-#include <conio.h>
-void endian_cvt PARAMS((union msg_t *, int));
-void tip_convert32 PARAMS((BYTE *));
-
-
-/*
-** This function is used to initialize the communication
-** channel. This consists of setting the window location
-** of the PCEB to the value defined by the values in
-** the file PCEB.h.
-*/
-
-/*ARGSUSED*/
-INT32
-init_comm_pceb(PC_port_base, PC_mem_seg)
-INT32 PC_port_base;
-INT32 PC_mem_seg;
- {
-
- /*** check for existence of the board ***/
-
- /* Set up PCCNF and reset processor */
- outp((unsigned int) (PC_port_base + PCEB_PCCNF_OFFSET),
- ((int) (PC_mem_seg & 0x7000) >> 10));
- outp((unsigned int) (PC_port_base + PCEB_PC229K_OFFSET),
- (int) (PCEB_LB_END | PCEB_WINENA | PCEB_S_HALT));
-
- return(0);
- }
-
-
-/*
-** This function is used to send a message to the PCEB.
-** If the message is successfully sent, a zero is
-** returned. If the message was not sendable, a -1
-** is returned.
-**
-** Also note that this function does endian conversion on the
-** returned message. This is necessary because the Am29000
-** target will be sending big-endian messages and the PC will
-** be expecting little-endian.
-*/
-
-INT32
-msg_send_pceb(msg_ptr, PC_port_base)
- union msg_t *msg_ptr;
- INT32 PC_port_base;
- {
- INT32 result;
- int pc229k;
- INT32 message_size;
- INT32 semaphore;
- INT32 result3;
-
- /* Set semaphore (PCEB_RECV_BUF_PTR) to zero */
- semaphore = (INT32) 0;
- result3 = Mini_write_memory ((INT32) D_MEM,
- (ADDR32) PCEB_RECV_BUF_PTR,
- (INT32) sizeof(INT32),
- (BYTE *) &semaphore);
- /* Get size of whole message */
- message_size = (msg_ptr->generic_msg).length + (2 * sizeof(INT32));
-
- /* Do endian conversion */
- if (tip_target_config.TipEndian != tip_target_config.P29KEndian)
- endian_cvt(msg_ptr, OUTGOING_MSG);
-
- /* Send message */
- result = Mini_write_memory ((INT32) D_MEM,
- (ADDR32) PCEB_SEND_BUF,
- (INT32) message_size,
- (BYTE *) msg_ptr);
-
- /* Interrupt target (write to pceb mailbox) */
- pc229k = (PCEB_P_REQ | PCEB_WINENA | PCEB_LB_END | PCEB_S_NORMAL);
- outp((unsigned int) (PC_port_base + PCEB_PC229K_OFFSET),
- (int) pc229k);
-
- /* Did everything go ok? */
- if (result != 0)
- return(-1);
- else
- return(0);
-
- } /* end msg_send_pceb() */
-
-
-
-
-/*
-** This function is used to receive a message to the PCEB.
-** If the message is waiting in the buffer, the message Code is
-** returned and the buffer pointed to by msg_ptr is filled
-** in. If no message was available, a -1 is returned.
-**
-** Note that this function does endian conversion on the
-** returned message. This is necessary because the Am29000
-** target will be sending big-endian messages and the PC will
-** be expecting little-endian.
-*/
-
-INT32
-msg_recv_pceb(msg_ptr, PC_port_base, Mode)
- union msg_t *msg_ptr;
- INT32 PC_port_base;
- INT32 Mode;
- {
- INT32 result1;
- INT32 result2;
- INT32 result3;
- ADDR32 recv_buf_addr;
- INT32 parms_length;
- INT32 header_size;
- INT32 semaphore;
-
- /* Get receive buffer address */
- result1 = Mini_read_memory ((INT32) D_MEM,
- (ADDR32) PCEB_RECV_BUF_PTR,
- (INT32) sizeof(ADDR32),
- (BYTE *) &recv_buf_addr);
-
- /* Change endian of recv_buf_addr */
- if (tip_target_config.TipEndian != tip_target_config.P29KEndian)
- tip_convert32((BYTE *) &recv_buf_addr);
-
- /* Return if there is no message */
- if (recv_buf_addr == 0) {
- return(-1);
- } else {
- /* Get message header */
- header_size = (INT32) (2 * sizeof(INT32));
- result1 = Mini_read_memory ((INT32) D_MEM,
- (ADDR32) recv_buf_addr,
- (INT32) header_size,
- (BYTE *) msg_ptr);
-
- /* Get rest of message */
- parms_length = (msg_ptr->generic_msg).length;
- if (tip_target_config.TipEndian != tip_target_config.P29KEndian)
- tip_convert32((BYTE *) &parms_length);
- result2 = Mini_read_memory ((INT32) D_MEM,
- (ADDR32) (recv_buf_addr + header_size),
- (INT32) parms_length,
- (BYTE *) &(msg_ptr->generic_msg.byte));
-
- /* Do endian conversion */
- if (tip_target_config.TipEndian != tip_target_config.P29KEndian)
- endian_cvt(msg_ptr, INCOMING_MSG);
-
- /* Set semaphore (PCEB_RECV_BUF_PTR) to zero */
- semaphore = (INT32) 0;
- result3 = Mini_write_memory ((INT32) D_MEM,
- (ADDR32) PCEB_RECV_BUF_PTR,
- (INT32) sizeof(INT32),
- (BYTE *) &semaphore);
- }
-
- /* Did everything go ok? */
- if ((result1 != (INT32) 0) ||
- (result2 != (INT32) 0) ||
- (result3 != (INT32) 0))
- return(-1);
- else
- return(msg_ptr->generic_msg.code);
-
- } /* end msg_recv_pceb() */
-
-
-
-
-/*
-** This function is used to close the communication
-** channel. This is used when resyncing the host and
-** target and when exiting the monitor.
-*/
-
-INT32
-exit_comm_pceb(PC_port_base, PC_mem_seg)
-INT32 PC_port_base;
-INT32 PC_mem_seg;
- {
- return (0);
- }
-
-INT32
-reset_comm_pceb(PC_port_base, PC_mem_seg)
-INT32 PC_port_base;
-INT32 PC_mem_seg;
- {
-
- return(0);
-
- } /* end reset_comm_pceb() */
-
-
-
-/*
-** This function is used to "kick" the PCEB. This
-** amounts to yanking the *RESET line low. Code
-** will begin execution at ROM address 0.
-*/
-
-void
-go_pceb(PC_port_base, PC_mem_seg)
-INT32 PC_port_base;
-INT32 PC_mem_seg;
- {
- int setup;
-
- /* Reset processor */
- setup = (PCEB_LB_END | PCEB_WINENA);
-
- outp((unsigned int) (PC_port_base + PCEB_PC229K_OFFSET),
- (int) (setup | PCEB_S_RESET | PCEB_S_HALT));
-
- outp((unsigned int) (PC_port_base + PCEB_PC229K_OFFSET),
- (int) (setup | PCEB_S_RESET | PCEB_S_NORMAL));
-
- outp((unsigned int) (PC_port_base + PCEB_PC229K_OFFSET),
- (int ) (setup | PCEB_S_NORMAL));
-
- } /* end go_pceb() */
-
-
-
-
-
-
-/*
-** This function is used to write a string of bytes to
-** the Am29000 memory on the PCEB board.
-**
-** For more information on the PCEB interface, see
-** Chapter 5 of the "PCEB User's Manual".
-**
-** Note: This function aligns all 16 1K byte windows to make
-** a single 16K byte window on a 1K boundary.
-*/
-
-INT32
-write_memory_pceb(memory_space, address, data, byte_count, PC_port_base,
- PC_mem_seg)
- INT32 memory_space;
- ADDR32 address;
- BYTE *data;
- INT32 byte_count;
- INT32 PC_port_base;
- INT32 PC_mem_seg;
- {
- INT32 i;
- ADDR32 temp_address;
- INT32 bytes_in_window;
- INT32 copy_count;
-
- while (byte_count > 0) {
-
- /* Set up a single, contiguous 16K window (on a 1K boundary) */
- temp_address = address;
- for (i=0; i<16; i=i+1) {
- /* Write out low PCEB addr bits */
- outp((unsigned int) (PC_port_base+(INT32) (2*i)),
- (int) ((temp_address >> 10) & 0xff));
-
- /* Write out high PCEB addr bits */
- outp((unsigned int) (PC_port_base+(INT32) (2*i)+(INT32) 1),
- (int) ((temp_address >> 18) & 0x1f));
- temp_address = temp_address + (ADDR32) 0x400;
- } /* end for */
-
- bytes_in_window = (INT32) 0x4000 - (address & 0x3ff);
- copy_count = (byte_count < bytes_in_window) ? byte_count : bytes_in_window;
-
- (void) movedata((unsigned int) FP_SEG(data),
- (unsigned int) FP_OFF(data),
- (unsigned int) PC_mem_seg,
- (unsigned int) (address & 0x3ff),
- (int) copy_count);
-
- data = data + copy_count;
- address = address + copy_count;
- byte_count = byte_count - copy_count;
-
- } /* end while loop */
-
- return(0);
-
- } /* End write_memory_pceb() */
-
-
-
-
-/*
-** This function is used to read a string of bytes from
-** the Am29000 memory on the PCEB board. A zero is
-** returned if the data is read successfully, otherwise
-** a -1 is returned.
-**
-** For more information on the PCEB interface, see
-** Chapter 5 of the "PCEB User's Manual".
-**
-** Note: This function aligns all 16 1K byte windows to make
-** a single 16K byte window on a 1K boundary.
-*/
-
-INT32
-read_memory_pceb(memory_space, address, data, byte_count, PC_port_base,
- PC_mem_seg)
- INT32 memory_space;
- ADDR32 address;
- BYTE *data;
- INT32 byte_count;
- INT32 PC_port_base;
- INT32 PC_mem_seg;
- {
- INT32 i;
- ADDR32 temp_address;
- INT32 bytes_in_window;
- INT32 copy_count;
-
- while (byte_count > 0) {
-
- /* Set up a single, contiguous 16K window (on a 1K boundary) */
- temp_address = address;
- for (i=0; i<16; i=i+1) {
- /* Write out low PCEB addr bits */
- outp((unsigned int) (PC_port_base+(2*i)),
- (int) ((temp_address >> 10) & 0xff));
-
- /* Write out high PCEB addr bits */
- outp((unsigned int) (PC_port_base+(2*i)+(INT32) 1),
- (int) ((temp_address >> 18) & 0x1f));
- temp_address = temp_address + (ADDR32) 0x400;
- } /* end for */
-
- bytes_in_window = (INT32) 0x4000 - (address & 0x3ff);
- copy_count = (byte_count < bytes_in_window) ? byte_count : bytes_in_window;
-
- (void) movedata((unsigned int) PC_mem_seg,
- (unsigned int) (address & 0x3ff),
- (unsigned int) FP_SEG(data),
- (unsigned int) FP_OFF(data),
- (int) copy_count);
-
- data = data + copy_count;
- address = address + copy_count;
- byte_count = byte_count - copy_count;
-
- } /* end while loop */
-
- return(0);
-
- } /* End read_memory_pceb() */
-
-INT32
-fill_memory_pceb()
-{
- return(0);
-}
+++ /dev/null
-static char _[] = "@(#)serial.c 5.21 93/10/26 09:47:06, Srini, AMD.";
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- * This module contains the functions to initialize, read, and write to the
- * serial ports (COM1, COM2,...) on a PC.
- *****************************************************************************
- */
-
-#include <stdio.h>
-#include <conio.h>
-#include <bios.h>
-#include <dos.h>
-#include <string.h>
-#include "types.h"
-#include "memspcs.h"
-#include "messages.h"
-#include "mtip.h"
-#include "tdfunc.h"
-
-/* Serial Port Defs */
- /*
- * Divisors for different baud rates to be used to initialize DLA
- * register.
- */
-#define _DIV_COM_110 1047
-#define _DIV_COM_150 768
-#define _DIV_COM_300 384
-#define _DIV_COM_600 192
-#define _DIV_COM_1200 96
-#define _DIV_COM_2400 48
-#define _DIV_COM_4800 24
-#define _DIV_COM_9600 12
-#define _DIV_COM_19200 6
-#define _DIV_COM_38400 3
-#define _DIV_COM_115200 1
-
-#define LCR_DLAB 0x80
-
-#define DLA_LOW_OFFSET 0x0
-
-
-/*
-** Definitions
-*/
-
-#define BUF_SIZE 2048
-
-/*
-** This data structure is used by the interrupt driven
-** serial I/O.
-*/
-
-struct serial_io_t {
- int error; /* Error code */
- unsigned int port; /* Port number */
- unsigned int port_code; /* Port code (for bios calls) */
- unsigned int int_number; /* Port interrupt number */
- unsigned int int_mask; /* Port interrupt mask */
- unsigned int baud; /* Port baud rate */
- unsigned int old_vector_ds; /* Interrupt vector (old) */
- unsigned int old_vector_dx;
- volatile
- unsigned char *start; /* Start of ring buffer */
- volatile
- unsigned char *end; /* End of ring buffer */
- };
-
-static unsigned char serial_io_buffer[BUF_SIZE];
-
-/* These definitions are from bios.h */
-#define CHAR_SIZE _COM_CHR8
-#define STOP_BITS _COM_STOP1
-#define PARITY _COM_NOPARITY
-
-/*
-** Serial port definitions
-*/
-
-#define INTR_MASK 0x21 /* 8259 Interrupt Mask Port */
-#define INTR_EOI 0x20 /* 8259 EOI Port */
-
-#define COM1 0x3f8 /* COM1 Port Base */
-#define COM1_CODE 0x00 /* COM1 Port Code */
-#define COM1_INT 0x0c /* COM1 Interrupt Number */
-#define COM1_MASK 0x10 /* COM1 Interrupt Mask (IRQ4) */
-
-#define COM2 0x2f8 /* COM2 Port Base */
-#define COM2_CODE 0x01 /* COM2 Port Code */
-#define COM2_INT 0x0b /* COM2 Interrupt Number */
-#define COM2_MASK 0x08 /* COM2 Interrupt Mask (IRQ3) */
-
-#define MSR_OFFSET 0x6 /* Modem Status Register offset */
-#define LSR_OFFSET 0x5 /* Line status Register offset */
-#define MCR_OFFSET 0x4 /* Modem Control Register offset */
-#define LCR_OFFSET 0x3 /* Line Control Register offest */
-#define IID_OFFSET 0x2 /* Interrupt pending register */
-#define IER_OFFSET 0x1 /* Interrupt Enable Register offest */
-
-/* Bits in Line Status Register (LSR) */
-#define AC1 0x80 /* Always clear */
-#define TSRE 0x40 /* Transmitter Shift Register Empty */
-#define THRE 0x20 /* Transmitter Holding Register Empty */
-#define BI 0x10 /* Break Interrupt */
-#define FE 0x08 /* Framing Error */
-#define PE 0x04 /* Parity Error */
-#define OE 0x02 /* Overrun Error */
-#define DR 0x01 /* Data Ready */
-
-/* Bits in Modem Control Register */
-#define CD 0x80
-#define RI 0x40
-#define DSR 0x20
-#define CTS 0x10
-#define OUT2 0x08
-#define RTS 0x02
-#define DTR 0x01
-
-#define MAX_BLOCK 1000
-
-/* function prototypes */
-
-void endian_cvt PARAMS((union msg_t *, int));
-void tip_convert32 PARAMS((BYTE *));
-INT32 init_parport (char *);
-
-void interrupt far serial_int PARAMS((void));
-void (interrupt far *OldVector)();
-int get_byte_serial PARAMS((void));
-
-extern int BlockCount;
-extern int lpt_initialize;
-/* globals */
-
-struct serial_io_t serial_io;
-
-INT32 in_msg_length=0;
-INT32 in_byte_count=0;
-
-/*
-** Serial Port functions
-*/
-
-/*
-** This function is used to initialize the communication
-** channel. First the serial_io data structure is
-** initialized. Then the new interrupt vector is installed.
-** Finally, the port is initialized, with DTR, RTS and OUT2
-** set.
-**
-*/
-
-INT32 write_memory_serial (ignore1, ignore2, ignore3, ignore4, ignore5, ignore6)
- INT32 ignore1;
- ADDR32 ignore2;
- BYTE *ignore3;
- INT32 ignore4;
- INT32 ignore5;
- INT32 ignore6;
-{
- return(-1); }
-
-INT32 read_memory_serial (ignore1, ignore2, ignore3, ignore4, ignore5, ignore6)
- INT32 ignore1;
- ADDR32 ignore2;
- BYTE *ignore3;
- INT32 ignore4;
- INT32 ignore5;
- INT32 ignore6;
-{ return(-1); }
-
-INT32 fill_memory_serial() { return(-1); }
-
-INT32
-init_comm_serial(ignore1, ignore2)
-INT32 ignore1;
-INT32 ignore2;
- {
- unsigned result;
- unsigned config;
- unsigned int comm_status;
-
- /* Initialize serial_io */
- serial_io.error = FALSE;
-
- /* Set up port number */
- if ((strcmp(tip_config.comm_port, "com1") == 0) ||
- (strcmp(tip_config.comm_port, "com1:") == 0)) {
- serial_io.port = COM1;
- serial_io.port_code = COM1_CODE;
- serial_io.int_number = COM1_INT;
- serial_io.int_mask = COM1_MASK;
- }
- else
- if ((strcmp(tip_config.comm_port, "com2") == 0) ||
- (strcmp(tip_config.comm_port, "com2:") == 0)) {
- serial_io.port = COM2;
- serial_io.port_code = COM2_CODE;
- serial_io.int_number = COM2_INT;
- serial_io.int_mask = COM2_MASK;
- }
- else
- return((INT32) -1);
-
- /* Check status */
- comm_status = inp(serial_io.port+LSR_OFFSET);
-#if 0
- /* reset any communication errors */
- outp(serial_io.port+LSR_OFFSET,
- (unsigned int) (comm_status & ~(FE|PE|OE)));
-#endif
-
-
- /* Get baud rate (Note: MS-DOS only goes to 9600) */
- outp (serial_io.port+LCR_OFFSET, LCR_DLAB);
-
- if (strcmp(tip_config.baud_rate, "110") == 0)
- outpw (serial_io.port+DLA_LOW_OFFSET, _DIV_COM_110);
- else
- if (strcmp(tip_config.baud_rate, "150") == 0)
- outpw (serial_io.port+DLA_LOW_OFFSET, _DIV_COM_150);
- else
- if (strcmp(tip_config.baud_rate, "300") == 0)
- outpw (serial_io.port+DLA_LOW_OFFSET, _DIV_COM_300);
- else
- if (strcmp(tip_config.baud_rate, "600") == 0)
- outpw (serial_io.port+DLA_LOW_OFFSET, _DIV_COM_600);
- else
- if (strcmp(tip_config.baud_rate, "1200") == 0)
- outpw (serial_io.port+DLA_LOW_OFFSET, _DIV_COM_1200);
- else
- if (strcmp(tip_config.baud_rate, "2400") == 0)
- outpw (serial_io.port+DLA_LOW_OFFSET, _DIV_COM_2400);
- else
- if (strcmp(tip_config.baud_rate, "4800") == 0)
- outpw (serial_io.port+DLA_LOW_OFFSET, _DIV_COM_4800);
- else
- if (strcmp(tip_config.baud_rate, "9600") == 0)
- outpw (serial_io.port+DLA_LOW_OFFSET, _DIV_COM_9600);
- else
- if (strcmp(tip_config.baud_rate, "19200") == 0)
- outpw (serial_io.port+DLA_LOW_OFFSET, _DIV_COM_19200);
- else
- if (strcmp(tip_config.baud_rate, "38400") == 0)
- outpw (serial_io.port+DLA_LOW_OFFSET, _DIV_COM_38400);
- else
- if (strcmp(tip_config.baud_rate, "115200") == 0)
- outpw (serial_io.port+DLA_LOW_OFFSET, _DIV_COM_115200);
- else
- return((INT32) -1); /* EMBAUD); */
-
- /* Set LCR */
- outp (serial_io.port+LCR_OFFSET,
- (unsigned int) (_COM_CHR8|_COM_STOP1|_COM_NOPARITY));
-
- /* Save old interrupt vector */
- OldVector = _dos_getvect (serial_io.int_number);
-
- /* Initialize ring buffer */
- serial_io.start = serial_io_buffer;
- serial_io.end = serial_io_buffer;
-
- /* Install interrupt vector */
- /* Note: the interrupt handler should be in the same code */
- /* segment as this function. We will use CS for */
- /* the segment offset value. */
-
- _dos_setvect(serial_io.int_number, serial_int); /* new handler */
-
- /* Turn on DTR, RTS and OUT2 */
- result = outp((serial_io.port+MCR_OFFSET), (DTR | RTS | OUT2));
-
- /* Enable interrupt on serial port controller */
- result = outp((serial_io.port+IER_OFFSET), 0x01);
-
- /* Set interrupt mask on 8259 */
- config = inp(INTR_MASK); /* Get current 8259 mask */
- result = outp(INTR_MASK, (config & ~serial_io.int_mask));
-
- /* Set global message indices */
- in_msg_length = 0;
- in_byte_count = 0;
-
- /* initialize parallel port */
- if (lpt_initialize)
- return (init_parport(tip_config.par_port));
-
- return((INT32) 0);
- } /* end init_comm_serial() */
-
-/*
-** This function is used to send bytes over the serial line.
-** If the bytes are successfully sent, a zero is returned.
-** If the bytes are not sent, a -1 is returned.
-*/
-
-INT32
-send_bfr_serial(bfr_ptr, length, port_base, comm_err)
- BYTE *bfr_ptr;
- INT32 length;
- INT32 port_base;
- INT32 *comm_err;
- {
- int retries;
- INT32 byte_count = 0;
- unsigned int comm_status;
- unsigned int result;
-
- /* Send message */
- retries = 0;
- do {
-
- /* check user interrupt */
- SIGINT_POLL
- /* Check if data ready */
- comm_status = inp(serial_io.port+LSR_OFFSET);
-
- /* Check for communication errors */
- if ((comm_status & (FE | PE | OE)) != 0) {
- *comm_err = 1;
- return (-1);
- }
-
- /* If Transmitter Holding Register Empty (THRE) */
- /* send out data */
- if ((comm_status & THRE) != 0) {
- result = outp(serial_io.port, bfr_ptr[byte_count]);
- byte_count = byte_count + 1;
- retries = 0;
- } else {
- retries = retries + 1;
- if (retries >= 20000)
- return (-1); /* EMNOSEND); */
- }
-
- } while (byte_count < length );
-
- return(0);
- } /* end send_bfr_serial() */
-
-/*
-** This function is used to receive bytes over a serial line.
-**
-** If block equals NONBLOCK then the function returns as soon
-** there are no bytes remaining in the UART.
-** If block equals BLOCK then the function waits until all
-** bytes are gotten before returning.
-**
-** If all bytes requested are gotten, 0 is returned, else -1.
-*/
-
-INT32
-recv_bfr_serial(bfr_ptr, length, block, port_base, comm_err)
- BYTE *bfr_ptr;
- INT32 length;
- INT32 block;
- INT32 port_base;
- INT32 *comm_err;
- {
- int comm_status;
- int c;
- int result;
- int bytes_free;
-
- int block_count = 0;
-
- /* Loop as long as characters keep coming */
- for (;;) {
-
- /* Check for communication errors */
- comm_status = inp(serial_io.port+LSR_OFFSET);
- if ((comm_status & (FE | PE | OE)) != 0)
- {
- *comm_err = 1;
- return (-1);
- }
-
- /* Check for buffer overflow */
- if (serial_io.error == TRUE)
- {
- *comm_err = 1;
- return (-1);
- }
-
- /* Do flow control. If the buffer is 9/10 full, */
- /* deassert DTR and RTS. If the buffer becomes */
- /* 1/10 full, reassert DTR and RTS. */
- bytes_free = (int) (serial_io.start - serial_io.end);
- if (bytes_free <= 0)
- bytes_free = BUF_SIZE + bytes_free;
-
- comm_status = inp(serial_io.port+MCR_OFFSET);
- if (bytes_free <= (BUF_SIZE/10))
- result = outp((serial_io.port+MCR_OFFSET),
- (comm_status & ~DTR & ~RTS));
-
- if (bytes_free >= ((9*BUF_SIZE)/10))
- result = outp((serial_io.port+MCR_OFFSET),
- (comm_status | DTR | RTS));
-
- /* Get character */
- c = get_byte_serial();
-
- /* return if no char & not blocking */
- if ((c == -1) && (block == NONBLOCK))
- return (-1);
-
- /* return if no char, blocking, and past block count */
- if ((c == -1) && (block == BLOCK) && (block_count++ > BlockCount))
- return (-1);
-
- /* Save byte in bfr_ptr buffer */
- if (c != -1) {
- bfr_ptr[in_byte_count] = (BYTE) c;
- block_count = 0;
- in_byte_count = in_byte_count + 1;
- }
-
- /* Message received ? */
- if (in_byte_count == length) {
- in_byte_count = 0;
- return(0);
- }
- } /* end for(;;) */
- } /* end recv_bfr_serial() */
-
-
-/*
-** This function is used to reset the communication
-** channel. This is used when resyncing the host and
-** target and when exiting the monitor.
-*/
-
-INT32
-reset_comm_serial(ignore1, ignore2)
-INT32 ignore1;
-INT32 ignore2;
- {
- unsigned int status;
-
-#define CLEAR_STAT (int) 1
-
- do {
- /* Clear LSR */
- inp(serial_io.port+LSR_OFFSET);
- /* Clear RX reg */
- inp (serial_io.port);
- /* Clear MSR */
- inp (serial_io.port+MSR_OFFSET);
- /* interrupt pending ? */
- status = inp(serial_io.port+IID_OFFSET);
- } while (status != CLEAR_STAT);
-
-#if 0
- /* reset any communication errors */
- outp(serial_io.port+LSR_OFFSET,
- (unsigned int) (comm_status & ~(FE|PE|OE)));
-#endif
-
- /* Initialize serial_io */
- serial_io.error = FALSE;
-
- /* Initialize ring buffer */
- serial_io.start = serial_io_buffer;
- serial_io.end = serial_io_buffer;
-
- /* Set global message indices */
- in_msg_length = 0;
- in_byte_count = 0;
-
- return((INT32) 0);
- } /* end reset_comm_serial() */
-
-
-INT32
-exit_comm_serial(ignore1, ignore2)
-INT32 ignore1;
-INT32 ignore2;
- {
- /* Initialize serial_io */
- serial_io.error = FALSE;
-
- /* Initialize ring buffer */
- serial_io.start = serial_io_buffer;
- serial_io.end = serial_io_buffer;
-
- /* Set global message indices */
- in_msg_length = 0;
- in_byte_count = 0;
-
- /* install old handler back */
- _dos_setvect(serial_io.int_number, OldVector);
-
- return((INT32) 0);
- } /* end reset_comm_serial() */
-
-/*
-** This function is usually used to "kick-start" the target.
-** This is nesessary when targets are shared memory boards.
-** With serial communications, this function does nothing.
-*/
-
-void
-go_serial(ignore1, ignore2)
-INT32 ignore1;
-INT32 ignore2;
- {
- return;
- } /* end go_serial() */
-
-
-
-/*
-** This function is used to get a byte from the the
-** serial_io_buffer. The data in this buffer is written
-** by the interrupt handler.
-**
-** If no data is available, a -1 is returned. Otherwise
-** a character is returned.
-*/
-
-int
-get_byte_serial()
- {
- int result=-1;
-
- /* Turn interrupts off while reading buffer */
- _disable();
-
- /* No bytes available */
- if (serial_io.start == serial_io.end)
- result = -1;
- else {
-
- /* Return character */
- result = (int) *serial_io.start;
- serial_io.start++;
- /* Check for wrap around */
- if (serial_io.start >= (serial_io_buffer+BUF_SIZE)) {
- serial_io.start = serial_io_buffer;
- }
-
- }
- /* Turn interrupts back on */
- _enable();
-
- return (result);
- } /* end get_byte_serial() */
-
-
-
-/*
-** This function is the interrupt handler which buffers
-** incoming characters.
-**
-** Note: The "interrupt" keyword is not well documented.
-** It produces a procedure which returns with an
-** "iret" instead of the usual "ret".
-*/
-
-void interrupt serial_int()
- {
- int c;
-
- /* Get character */
- c = inp(serial_io.port);
-
- *serial_io.end = (unsigned char) c;
- serial_io.end++;
- /* Check for wrap around */
- if (serial_io.end >= (serial_io_buffer+BUF_SIZE))
- serial_io.end = serial_io_buffer;
-
- /* Has the buffer overflowed? */
- if (serial_io.start == serial_io.end)
- serial_io.error = TRUE;
-
- /* Send EOI to 8259 */
- (void) outp(INTR_EOI, 0x20);
-
- } /* end serial_int() */
-
-
+++ /dev/null
-static char _[] = "@(#)tdfunc.c 5.25 93/10/28 08:44:32, Srini, AMD.";
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- * This module contains the functions to initialize, read, and write to the
- * serial port on an Unix-based machine.
- *****************************************************************************
- */
-
-/* This file contains the Target Dependent Functions used by Minimon's
- * Message System.
- */
-
-#include <stdio.h>
-
-#include <fcntl.h>
-#include <termio.h>
-
-#ifdef __hpux
-#include <sys/modem.h>
-#endif
-
-#include "messages.h"
-#include "tdfunc.h"
-#include "mtip.h"
-#include "macros.h"
-
-/* Serial connection */
-/*
-** Serial port routines
-*/
-
-/*definitions */
-#define BAUD_RATE B9600
-#define CHAR_SIZE CS8
-#define STOP_BITS 0
-#define PARITY_ENABLE 0
-#define PARITY 0
-
-#define CH0_BUFFER_SIZE 1024
-
-#define BLOCK 1
-#define NOBLOCK 0
-
-/* Global for serial */
-
-static int msg_port;
-static INT32 in_byte_count=0;
-
-extern int BlockCount;
-
-/*
-** This function is used to initialize the communication
-** channel. This consists of basically opening the com
-** port for reading and writing.
-**
-** With Sun UNIX, each time the port is opened, the communication
-** parameters are reset to default values. These default values for
-** the serial port are currently 9600 baud, 7 bits, even parity.
-*/
-
-INT32
-init_comm_serial(ignore1, ignore2)
-INT32 ignore1;
-INT32 ignore2;
- {
- int result;
- unsigned short baud;
- struct termio tbuf;
-#ifdef __hpux
- mflag mbits;
-#else
- int mbits;
-#endif
- int cd; /* carrier detect */
-
- /* Open serial port */
- if ((msg_port = open(tip_config.comm_port, O_NDELAY|O_RDWR)) == -1) {
- return (-1);
- }
-
- /* Get baud rate */
- if (strcmp(tip_config.baud_rate, "300") == 0)
- baud = B300;
- else
- if (strcmp(tip_config.baud_rate, "600") == 0)
- baud = B600;
- else
- if (strcmp(tip_config.baud_rate, "1200") == 0)
- baud = B1200;
- else
- if (strcmp(tip_config.baud_rate, "2400") == 0)
- baud = B2400;
- else
- if (strcmp(tip_config.baud_rate, "4800") == 0)
- baud = B4800;
- else
- if (strcmp(tip_config.baud_rate, "9600") == 0)
- baud = B9600;
- else
- if (strcmp(tip_config.baud_rate, "19200") == 0)
- baud = B19200;
- else
- if (strcmp(tip_config.baud_rate, "38400") == 0)
- baud = B38400;
- else
- return(-1);
-
-
- /* Set up new parameters */
- /* Get termio (for modification) */
- result = ioctl(msg_port, TCGETA, &tbuf);
- if (result == -1)
- return (-1);
-
- /*
- ** Note: On a Sun III, the port comes up at 9600 baud,
- ** 7 bits, even parity, with read enabled. We will change
- ** this to 8 bits, no parity (with RTS/CTS handshaking).
- ** We will also set I/O to "raw" mode.
- */
-
- /* Set up new parameters */
- tbuf.c_iflag = 0;
- tbuf.c_oflag = 0;
- tbuf.c_cflag = (baud | CHAR_SIZE | STOP_BITS | CREAD |
- PARITY_ENABLE | PARITY );
- tbuf.c_lflag = 0;
- tbuf.c_cc[VMIN] = 0; /* Number of characters to satisfy read */
-#ifdef __hpux
- tbuf.c_cc[VTIME] = 100; /* intercharacter timer interval in seconds */
-#else
- tbuf.c_cc[VTIME] = 1; /* intercharacter timer interval in seconds */
-#endif
-
- /* Set termio to new mode */
- result = ioctl(msg_port, TCSETA, &tbuf);
- if (result == -1)
- return (-1);
-
-#ifdef __hpux
- /* modem status */
- (void) ioctl (msg_port, MCGETA, &mbits);
- mbits = (MDSR|MDTR|MRTS);
- (void) ioctl (msg_port, MCSETA, &mbits);
-#else
- /* modem status */
- (void) ioctl (msg_port, TIOCMGET, &mbits);
- mbits = (TIOCM_DTR|TIOCM_RTS);
- (void) ioctl (msg_port, TIOCMSET, &mbits);
-#endif
-
- /* FLush queue */
- if (ioctl(msg_port, TCFLSH, 2) == -1)
- return (-1);
-
- return(0);
- } /* end init_comm_serial() */
-
-
-/*
-** This function is used to send a message over the
-** serial line.
-**
-** If the message is successfully sent, a zero is
-** returned. If the message was not sendable, a -1
-** is returned. This function blocks. That is, it
-** does not return until the message is completely
-** sent, or until an error is encountered.
-**
-*/
-
-INT32
-send_bfr_serial(bfr_ptr, length, port_base, comm_err)
- BYTE *bfr_ptr;
- INT32 length;
- INT32 port_base;
- INT32 *comm_err;
- {
- int result;
-
- /* Send message */
- result = write(msg_port, (char *)bfr_ptr, length);
- if (result != length)
- return (-1);
- else
- return (0);
-
- } /* end msg_send_serial() */
-
-
-/*
-** This function is used to receive a message over a
-** serial line.
-**
-** If the message is waiting in the buffer, a zero is
-** returned and the buffer pointed to by msg_ptr is filled
-** in. If no message was available, a -1 is returned.
-**
-*/
-
-/* Read as many characters as are coming and return the number of character
- * read into the buffer.
- * Buffer : pointer to the receiving buffer.
- * nbytes : number of bytes requested.
- * Mode : Blocking/Non-blocking mode. In blocking mode, this will not
- * return until atleast a character is received. It is used when
- * the TIP is to wait for a response from the target, and there is
- * no need to poll the keyboard.
- * PortBase : not used.
- * CommError : Error during communication.
- */
-INT32
-recv_bfr_serial(Buffer, nbytes, Mode, PortBase, CommError)
- BYTE *Buffer;
- INT32 nbytes;
- INT32 Mode;
- INT32 PortBase;
- INT32 *CommError;
- {
- int result;
- unsigned char ch;
- INT32 count;
- int bcount;
- struct termio OrigTBuf, NewTBuf;
-
- count = 0;
- do {
- if (Mode == BLOCK) {
- bcount = 0;
- while (bcount++ < BlockCount) {
- if ((result = read(msg_port, (char *)&ch, 1)) == 1) { /* success */
- *Buffer++ = (BYTE) ch;
- count = count + 1;
- bcount = 0;
- };
- if (count == nbytes)
- return (0);
- };
- return ((INT32) -1);
- } else { /* non-block */
- if ((result = read(msg_port, (char *)&ch, 1)) == 1) { /* success */
- *Buffer++ = (BYTE) ch;
- count = count + 1;
- } else { /* Timed out */
- return ((INT32) -1);
- }
- }
- } while (count < nbytes);
- return (0);
-
-#ifdef DEBUG
- if (Mode) { /* BLOCK while reading */
- /*
- * Set blocking mode by set MIN=0 and TIME > 0
- * Here we set TIME to block for 60 seconds.
- */
- (void) ioctl (msg_port, TCGETA, &OrigTBuf);
- (void) ioctl (msg_port, TCGETA, &NewTBuf);
- NewTBuf.c_cc[4] = 0; /* set MIN to 0 */
- NewTBuf.c_cc[5] = 1; /* 600 * 0.1 seconds */
- (void) ioctl (msg_port, TCSETA, &NewTBuf);
- count = 0;
- do {
- if (read(msg_port, (char *)&ch, 1) == 1) { /* success */
- *Buffer++ = (BYTE) ch;
- count = count + 1;
- } else { /* Timed out */
- (void) ioctl (msg_port, TCSETA, &OrigTBuf); /* restore termio */
- return ((INT32) -1);
- }
- } while (count < nbytes);
- (void) ioctl (msg_port, TCSETA, &OrigTBuf); /* restore termio */
- return (0);
- } else { /* Non blocking */
- result = (INT32) -1;
- count = 0;
- while ((count < nbytes) && (read(msg_port, (char *)&ch, 1) == 1)) {
- *Buffer++ = (BYTE) ch;
- count = count + 1;
- result = 0;
- }
- if (count == nbytes) /* read enough */
- return (0);
- else /* not enough chars read */
- return ((INT32) -1);
- }
-#endif
-#if 0
- result = read(msg_port, (char *) Buffer, nbytes); /* read as many */
- if (result == nbytes) {
- return (0);
- } else {
- return (-1);
- }
- if (result > 0) {
- in_byte_count = in_byte_count + result;
- block_count = 0;
- if (in_byte_count >= length) {
- /* Message received */
- in_byte_count = 0;
- return(0);
- }
- } else {
-
- /* return if no char & not blocking */
- if (block == NOBLOCK) return (-1);
-
- /* return if no char, blocking, and past block count */
- if ((block == BLOCK) && (block_count++ > BlockCount))
- return (-1);
- }
-#endif
-
- } /* end msg_recv_serial() */
-
-
-#ifndef MSDOS
-/*
-** This function is used to close the communication
-** channel. This is used when resyncing the host and
-** target and when exiting the monitor.
-*/
-
-INT32
-reset_comm_pcserver(ignore1, ignore2)
-INT32 ignore1;
-INT32 ignore2;
- {
- unsigned char ch;
-#ifdef __hpux
- mflag mbits;
-#else
- int mbits;
-#endif
-
- printf("reset:\n");
- /* Reset message buffer counters */
- in_byte_count = 0;
-
-#ifdef __hpux
- mbits = (MDSR|MDTR|MRTS);
- (void) ioctl (msg_port, MCSETA, &mbits);
-#else
- mbits = (TIOCM_DTR|TIOCM_RTS);
- (void) ioctl (msg_port, TIOCMGET, &mbits);
-#endif
-
- /* Clear data from buffer */
- if (ioctl(msg_port, TCFLSH, 2) == -1) {
- return (-1);
- }
-
- return(0);
- } /* end reset_comm_serial() */
-#endif
-
-/*
-** This function is used to close the communication
-** channel. This is used when resyncing the host and
-** target and when exiting the monitor.
-*/
-
-INT32
-reset_comm_serial(ignore1, ignore2)
-INT32 ignore1;
-INT32 ignore2;
- {
-#ifdef __hpux
- mflag mbits;
-#else
- int mbits;
-#endif
-
- /* Reset message buffer counters */
- in_byte_count = 0;
-
-#ifdef __hpux
- (void) ioctl (msg_port, MCGETA, &mbits);
- mbits = (MDSR|MDTR|MRTS);
- (void) ioctl (msg_port, MCSETA, &mbits);
-#else
- (void) ioctl (msg_port, TIOCMGET, &mbits);
- mbits = (TIOCM_DTR|TIOCM_RTS);
- (void) ioctl (msg_port, TIOCMSET, &mbits);
-#endif
-
- /* Clear data from buffer */
- if (ioctl(msg_port, TCFLSH, 2) == -1) {
- return (-1);
- }
-
- return(0);
- } /* end reset_comm_serial() */
-
-
-INT32
-exit_comm_serial(ignore1, ignore2)
-INT32 ignore1;
-INT32 ignore2;
- {
- /* Reset message buffer counters */
- in_byte_count = 0;
-
- (void) close(msg_port);
-
- return(0);
- } /* end reset_comm_serial() */
-/*
-** This function is usually used to "kick-start" the target.
-** This is nesessary when targets are shared memory boards.
-** With serial communications, this function does nothing.
-*/
-
-void
-go_serial(port_base, msg_seg)
-INT32 port_base;
-INT32 msg_seg;
- { return; }
-
-
-INT32
-write_memory_serial (ignore1, ignore2, ignore3, ignore4, ignore5, ignore6)
- INT32 ignore1;
- ADDR32 ignore2;
- BYTE *ignore3;
- INT32 ignore4;
- INT32 ignore5;
- INT32 ignore6;
-{
- return(-1); }
-
-INT32
-read_memory_serial (ignore1, ignore2, ignore3, ignore4, ignore5, ignore6)
- INT32 ignore1;
- ADDR32 ignore2;
- BYTE *ignore3;
- INT32 ignore4;
- INT32 ignore5;
- INT32 ignore6;
-{ return(-1); }
-
-INT32
-fill_memory_serial()
- { return(-1); }
-
-/*
-** Stubs for PC plug-in board routines
-*/
-
-/* EB29K */
-
-INT32 init_comm_eb29k() {return (FAILURE);}
-INT32 msg_send_eb29k() {return (-1);}
-INT32 msg_recv_eb29k() {return (-1);}
-INT32 reset_comm_eb29k() {return (-1);}
-INT32 exit_comm_eb29k() {return (-1);}
-void go_eb29k() {}
-INT32 read_memory_eb29k() {return (-1);}
-INT32 write_memory_eb29k() {return (-1);}
-INT32 fill_memory_eb29k() {return (-1);}
-
-/* LCB29K */
-
-INT32 init_comm_lcb29k() {return (FAILURE);}
-INT32 msg_send_lcb29k() {return (-1);}
-INT32 msg_recv_lcb29k() {return (-1);}
-INT32 reset_comm_lcb29k() {return (-1);}
-INT32 exit_comm_lcb29k() {return (-1);}
-void go_lcb29k() {}
-INT32 read_memory_lcb29k() {return (-1);}
-INT32 write_memory_lcb29k(){return (-1);}
-INT32 fill_memory_lcb29k() {return (-1);}
-
-/* PCEB */
-
-INT32 init_comm_pceb() {return (FAILURE);}
-INT32 msg_send_pceb() {return (-1);}
-INT32 msg_recv_pceb() {return (-1);}
-INT32 reset_comm_pceb() {return (-1);}
-INT32 exit_comm_pceb() {return (-1);}
-void go_pceb() {}
-INT32 read_memory_pceb() {return (-1);}
-INT32 write_memory_pceb() {return (-1);}
-INT32 fill_memory_pceb() {return (-1);}
-
-/* EB030 */
-
-INT32 init_comm_eb030() {return (FAILURE);}
-INT32 msg_send_eb030() {return (-1);}
-INT32 msg_recv_eb030() {return (-1);}
-INT32 reset_comm_eb030() {return (-1);}
-INT32 exit_comm_eb030() {return (-1);}
-void go_eb030() {}
-INT32 read_memory_eb030() {return (-1);}
-INT32 write_memory_eb030() {return (-1);}
-INT32 fill_memory_eb030() {return (-1);}
+++ /dev/null
-/* @(#)tiperr.c 1.26 93/07/30 16:40:38, Srini, AMD */
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineer: Srini Subramanian.
- *****************************************************************************
- * This module defines the different TIP Error messages.
- *****************************************************************************
- */
-char *tip_err[] = {
-/* 0 */ (char *) 0,
-/* TIPNOTIMPLM */ "UDI request not currently implemented by TIP.",
-/* TIPPARSECN */ "Could not parse args for Connect.",
-/* TIPMSGINIT */ "Could not initialize message system.",
-/* TIPCORELOAD */ "Could not load -r rom file.",
-/* TIPGOTARGET */ "Error starting target processor.",
-/* TIPGETERROR */ "Unknown error number.",
-/* TIPSENDCFG */ "Error sending Config message.",
-/* TIPRECVCFG */ "Error receiving Config ack.",
-/* TIPSENDRST */ "Error sending Reset message.",
-/* TIPRECVHLT */ "Error receiving Halt ack.",
-/* TIPINITARGS */ "Could not set up Arg Vector for Init.",
-/* TIPSENDINIT */ "Error sending Init message.",
-/* TIPRECVINIT */ "Error receiving Init ack.",
-/* TIPSENDRD */ "Error sending Read message.",
-/* TIPRECVRD */ "Error receiving Read ack.",
-/* TIPSENDWRT */ "Error sending Write message.",
-/* TIPRECVWRT */ "Error receiving Write ack.",
-/* TIPSENDCPY */ "Error sending Copy message.",
-/* TIPRECVCPY */ "Error receiving Copy ack.",
-/* TIPSENDGO */ "Error sending Go message.",
-/* TIPRECVGO */ "Error receiving Go ack.",
-/* TIPSENDSTP */ "Error sending Step message.",
-/* TIPRECVSTP */ "Error receiving Step ack.",
-/* TIPSENDBRK */ "Error sending Break message.",
-/* TIPRECVBRK */ "Error receiving Break ack.",
-/* TIPSENDSTBP */ "Error sending Set Breakpoint message.",
-/* TIPRECVSTBP */ "Error receiving Set Breakpoint ack.",
-/* TIPSENDQYBP */ "Error sending Query Breakpoint message.",
-/* TIPRECVQYBP */ "Error receiving Query Breakpoint ack.",
-/* TIPSENDRMBP */ "Error sending Remove Breakpoint message.",
-/* TIPRECVRMBP */ "Error receiving Remove Breakpoint ack.",
-/* TIPHIFFAIL */ "Error servicing HIF request.",
-/* TIPTIMEOUT */ "Timed out waiting for target.",
-/* TIPUNXPMSG */ "Unexpected message received.",
-/* TIPINVSPACE */ "Invalid space specified.",
-/* TIPINVBID */ "Incorrect Breakpoint ID specified.",
-/* TIPNOCORE */ "No core file given.",
-/* TIPNOSEND */ "Could not send a message.",
-/* TIPNORECV */ "Could not receive a message.",
-/* TIPMSG2BIG */ "Message size exceeds target message buffer size."
-};
+++ /dev/null
-static char _[] = "@(#)udi2mtip.c 5.31 93/11/03 08:34:07, Srini, AMD.";
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * So that all may benefit from your experience, please report any problems
- * or suggestions about this software to the 29K Technical Support Center at
- * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
- * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * Engineers: Srini Subramanian.
- *****************************************************************************
- * This module implements the UDI procedural interface routines of MONTIP
- * for both the Dos and Unix environments.
- *****************************************************************************
- */
-#include <stdio.h>
-#include <signal.h>
-
-#ifdef MSDOS
-#include <stdlib.h>
-#include <conio.h>
-#else
-#include <malloc.h>
-#endif
-
-#include <string.h>
-#include "coff.h"
-#include "messages.h"
-#include "memspcs.h"
-#include "macros.h"
-#include "udiproc.h"
-#include "udiids.h"
-#include "udiext.h"
-#include "mtip.h"
-#include "hif.h"
-#include "versions.h"
-
-/*
- * MsgCode halt1, halt2, halt3, halt4 are variables defined as INT32 *
- * inside the macro block *
- */
-
-
-#define CLEAR_PENDING_STOP StopFlag=0;
-
-/* Stop signal handler / macro */
-#define STOP_SIG_HDLR {\
- INT32 MsgCode;\
- INT32 halt1, halt2, halt3, halt4;\
- StopFlag=0;\
- Mini_build_break_msg();\
- if (Mini_msg_send() != SUCCESS)\
- return((-1) * MONErrCantSendMsg);\
- SIGINT_POLL \
- MsgCode = Wait_For_Ack();\
- if (MsgCode == ABORT_FAILURE)\
- return ((-1) * MONErrAbortAborted);\
- if (MsgCode == FAILURE)\
- return ((-1) * MONErrNoAck);\
- else if (MsgCode != HALT)\
- return ((-1) * MONErrCantRecvMsg);\
- Mini_unpack_halt_msg(&halt1, &halt2, &halt3, &halt4);\
- };
-
-#define SEND_AND_WAIT_ACK(x) {\
- INT32 MsgCode;\
- if (Mini_msg_send() != SUCCESS)\
- return((-1)*MONErrCantSendMsg);\
- SIGINT_POLL \
- MsgCode = Wait_For_Ack();\
- if (MsgCode == ABORT_FAILURE)\
- return (UDIErrorAborted);\
- else if (MsgCode == FAILURE)\
- return ((-1) * MONErrNoAck);\
- else if (MsgCode == ERROR)\
- ReturnedError = 1; \
- else if (MsgCode != (INT32) (x))\
- return ((-1) * MONErrCantRecvMsg);\
- };
-
-#define MONUDISession 1
-
-static int AllSections=(STYP_ABS|STYP_TEXT|STYP_LIT|STYP_DATA|STYP_BSS);
-static UDIPId CurrentPID = (UDIPId) UDIProcessProcessor;
-static UDIUInt32 PreviousProcessorState;
-static UDIUInt32 ProcessorState;
-static int TipAlive = 0;
-static int NumberOfProcesses=0;
-static int ContinuingSession = 0;
-static char *TargetType;
-static char *SecondTarget;
-static char *CoreFile;
-static int CoreLoaded;
-static BreakIdType LastBreakId = 0;
-static UDIBool SupervisorMode;
-static UDIBool RealMode;
-static UDIBool ProtectedMode;
-static UDIBool VirtualMode;
-static int BreaksInPlace; /* EB29K */
-static int StepCmdGiven = 0;
-static int ReturnedError=0;
-static int StopFlag=0;
-static int Interrupted=0;
-static int RemoteTarget=0;
-static int NoStepReqd=0;
-static int NoChan1Ack=0;
-static int SendACKFirst=0;
-static INT32 MsgAlreadyInBuffer = 0;
-static INT32 MsgAlreadyReceived = 0;
-static int Channel0Busy=0;
-unsigned long TimeOut;
-int MessageRetries;
-int BlockCount;
-int DelayFactor;
-unsigned int MaxMsgBufSize;
-extern int lpt_initialize; /* global */
-extern int use_parport; /* global */
-static UDISizeT ErrCntRemaining=(UDISizeT) 0;
-static FILE *coff_in;
-static char buffer[LOAD_BUFFER_SIZE];
-
-/* used in input/output routines */
-#define TIP_IO_BUFSIZE 1024
-static char channel0_buffer[TIP_IO_BUFSIZE];
-static UDISizeT Channel0_count=0;
-static char channel1_buffer[TIP_IO_BUFSIZE];
-static UDISizeT Channel1_count=0;
-static char channel2_buffer[TIP_IO_BUFSIZE];
-static UDISizeT Channel2_count=0;
-static UDIUInt32 Lr4_count;
-static UDIUInt32 TotalDone=(UDIUInt32) 0;
-static CPUOffset Lr3_addr;
-
-#define TIP_COOKED 0 /* default */
-#define TIP_RAW 1
-#define TIP_CBREAK 2
-#define TIP_ECHO 4
-#define TIP_ASYNC 8
-#define TIP_NBLOCK 0x10
-static UDIUInt32 PgmStdinMode=TIP_COOKED; /* default */
-static UDIUInt32 StdinCharsNeeded=0;
-
-/* Cache register values */
-static UDIUInt32 Glob_Regs[128],
- Loc_Regs[128];
-static int RefreshRegs = 1;
-static int exitstat;
-static char ConnectString[512];
-static char TempArgString[1024];
-
-static struct tip_break_table *bp_table=NULL;
-
-/* Global variables */
-TIP_TARGET_CONFIG tip_target_config;
-TIP_TARGET_STATUS tip_target_status;
-TIP_CONFIG tip_config;
-char *Msg_Logfile;
-FILE *MsgFile;
-
-/* ------------- Minimon TIP Specific Error Codes ------------ */
-#define MONNoError 0
-#define MONErrCantSendMsg 1
-#define MONErrCantRecvMsg 2
-#define MONErrCantLoadROMfile 3
-#define MONErrCantInitMsgSystem 4
-#define MONErrCantBreakInROM 5
-#define MONErrCantResetComm 6
-#define MONErrCantAllocBufs 7
-#define MONErrUnknownBreakType 8
-#define MONErrNoAck 9
-#define MONErrNoSynch 10
-#define MONErrCantOpenCoff 11
-#define MONErrCantWriteToMem 12
-#define MONErrAbortAborted 13
-#define MONErrNullConfigString 14
-#define MONErrNoTargetType 15
-#define MONErrOutofMemory 16
-#define MONErrErrorInit 17
-#define MONErrErrorRead 18
-#define MONErrErrorWrite 19
-#define MONErrErrorCopy 20
-#define MONErrErrorSetBreak 21
-#define MONErrErrorStatBreak 22
-#define MONErrErrorRmBreak 23
-#define MONErrConfigInterrupt 24
-#define MONErrNoConfig 25
-#define MONErrMsgInBuf 26
-#define MONErrUnknownTIPCmd 27
-#define MAX_MONERR 28
-
-static char *monerr_tip[] = {
- /* 0 */ "No Error.",
- /* 1 */ "Could not send message to target.",
- /* 2 */ "Did not receive the correct ACK from target.",
- /* 3 */ "Cant load ROM file.",
- /* 4 */ "Cant initialize the message system.",
- /* 5 */ "Cant set breakpoint in ROM.",
- /* 6 */ "Cant reset communication channel.",
- /* 7 */ "Cant reallocate message buffers.",
- /* 8 */ "Breakpoint type requested is not recognized.",
- /* 9 */ "No ACK from target - timed out.",
- /* 10 */ "Timed out synching. No response from target.",
- /* 11 */ "Cannot open ROM file.",
- /* 12 */ "Cannot write to memory while downloading ROM file.",
- /* 13 */ "Ctrl-C aborted previous Ctrl-C processing.",
- /* 14 */ "Null configuration string specified for connection.",
- /* 15 */ "No Target type specified for connection.",
- /* 16 */ "Out of memory.",
- /* 17 */ "Error on target - trying to initialize process.",
- /* 18 */ "Error on target - trying to read.",
- /* 19 */ "Error on target - trying to write.",
- /* 20 */ "Error on target - trying to do copy.",
- /* 21 */ "Error on target - trying to set breakpoint.",
- /* 22 */ "Error on target - trying to query breakpoint.",
- /* 23 */ "Error on target - trying to remove breakpoint.",
- /* 24 */ "User interrupt signal received - Aborting synch.",
- /* 25 */ "Couldn't get target config after reset. Try again.",
- /* 26 */ "Message received from target waiting in buffer.",
- /* 27 */ "Unknown Montip command, Exiting TIP mode."
-};
-
-#define MAX_MONERR_SIZE 80
-
-/* ---------------- Error Codes -------------------------------- */
-
-/* Function declarations */
-
-extern void IntHandler PARAMS((int num));
-extern void print_recv_bytes PARAMS((void));
-extern void set_lpt PARAMS((void));
-extern void unset_lpt PARAMS((void));
-static FILE *FindFile PARAMS((char *));
-static char *GetTargetType PARAMS((char *, char *));
-static INT32 SendConfigWait PARAMS((void));
-extern void SendACK PARAMS((void));
-static int parse_string PARAMS((char *string));
-static int write_args PARAMS((char *argstr, ADDR32 argstart,
- ADDR32 * datahigh));
-static int write_argv PARAMS((int arg_count, char *arg_ptr[],
- ADDR32 argstart, ADDR32 * hi_data));
-static INT32 SpaceMap_udi2mm PARAMS((CPUSpace space));
-static CPUSpace SpaceMap_mm2udi PARAMS((INT32 space));
-static int Reset_Processor PARAMS((void));
-static INT32 Wait_For_Ack PARAMS((void));
-static void process_target_msg PARAMS((INT32 msgcode));
-static void process_HALT_msg PARAMS((void));
-static INT32 process_chan0_ack PARAMS((void));
-static void process_CHAN1_msg PARAMS((void));
-static void process_CHAN2_msg PARAMS((void));
-static void process_stdin_needed_req PARAMS((void));
-static void set_stdin_mode PARAMS((void));
-static void process_ERR_msg PARAMS((void));
-static void process_HIF_msg PARAMS((void));
-static int PutAllBreakpoints PARAMS((void));
-static int ResetAllBreakpoints PARAMS((void));
-static int Write_Glob_Reg PARAMS((INT32 RegVal, int RegNum));
-
-/*
- * these three functions are called from HIF/IO handlers to do terminal
- * input/output.
- */
-extern void set_stdin_needed PARAMS((ADDR32 offset, UDICount count));
-extern void set_stderr_ready PARAMS((ADDR32 offset, UDICount count));
-extern void set_stdout_ready PARAMS((ADDR32 offset, UDICount count));
-
-
-static INT32 Mini_load_coff PARAMS((char *fname,
- INT32 space,
- INT32 sym,
- INT32 sects,
- int msg));
-static int update_breakpt_at PARAMS((INT32 space, ADDR32 addr, ADDR32 Inst));
-static int is_breakpt_at PARAMS((INT32 space, ADDR32 addr));
-static void add_to_bp_table PARAMS((BreakIdType * id, INT32 space,
- ADDR32 offset, INT32 count, INT32 type, ADDR32 inst));
-static int get_from_bp_table PARAMS((BreakIdType id, INT32 * space,
- ADDR32 * offset, INT32 * count,
- INT32 * type, ADDR32 * inst));
-static int remove_from_bp_table PARAMS((BreakIdType id));
-
-extern INT32 CheckForMsg PARAMS((INT32 time));
-
-extern int service_HIF PARAMS((UINT32 svcnm, UINT32 lr2, UINT32 lr3,
- UINT32 lr4, UINT32 * gr96, UINT32 * gr97, UINT32 * gr121));
-
-/* ================================================================= */
-/* UDI Procedure definitions */
-
-UDIError
-UDIConnect(string, Session)
- char *string;
- UDISessionId *Session;
-{
- INT32 MsgCode;
- int retval;
-
- if (TipAlive) { /* already connected */
- /* If same TargetType requested, return ConnectionUnavailable */
- SecondTarget = NULL;
- if ((SecondTarget = GetTargetType (SecondTarget, string)) == NULL)
- return (UDIErrorInvalidTIPOption);
- if (strcmp (SecondTarget, TargetType) == 0)
- return (UDIErrorConnectionUnavailable);
- else
- return (UDIErrorTryAnotherTIP);
- } else {
- if (ContinuingSession) {
- ContinuingSession=0; /* reset */
- *Session = (UDISessionId) MONUDISession;
- if ((int) (ProcessorState & 0xFF) != UDINotExecuting) {/* none active */
- CurrentPID = (UDIPId) (UDIProcessProcessor+1);
- NumberOfProcesses=1;
- };
- TipAlive = 1;
- return (UDINoError);
- }
- /* Initialize variables */
- /* Take control of Ctrl-C until connect time */
- signal (SIGINT, IntHandler);
- CoreFile = NULL;
- TargetType = NULL;
- Msg_Logfile = NULL;
- CoreLoaded = 0;
- CurrentPID = (UDIPId) UDIProcessProcessor;
- SupervisorMode = 0;
- RealMode = 0;
- ProtectedMode = 1; /* default */
- VirtualMode = 0;
- BreaksInPlace = 0; /* EB29K */
- TimeOut = (unsigned long) 10000;
- MessageRetries = (int) 1000;
-#ifdef MSDOS
- BlockCount = (int) 1000;
-#else
- BlockCount = (int) 40000;
-#endif
- DelayFactor = (int) 0;
- MaxMsgBufSize = (unsigned int) 0;
- Channel0_count = 0;
- Channel1_count = 0;
- Channel2_count = 0;
- Channel0Busy=0;
- *Session = (UDISessionId) MONUDISession;
- TipAlive = 1; /* no more positive error codes */
-
- /* TIP_CONFIG initialization */
- tip_config.PC_port_base = (INT32) - 1; /* default */
- tip_config.PC_mem_seg = (INT32) - 1; /* default */
- (void) strcpy(tip_config.baud_rate, DEFAULT_BAUD_RATE);
- (void) strcpy(tip_config.comm_port, DEFAULT_COMM_PORT);
- (void) strcpy(tip_config.par_port, DEFAULT_PAR_PORT);
- /* Get the CFG register value to find out 29kEndian */
- tip_target_config.P29KEndian = BIG; /* default */
-
- if ((retval = parse_string(string)) != (int) 0)
- return ((UDIError) retval);
- if (TargetType == NULL)
- return ((-1) * MONErrNoTargetType);
-
- /* Open Msg_Logfile if any */
- if (Msg_Logfile) {
- if ((MsgFile = fopen(Msg_Logfile, "w")) == NULL)
- Msg_Logfile = NULL;
- }
- /* Initialize message system */
- if (Mini_msg_init(TargetType) != SUCCESS) {
- *Session = (UDISessionId) MONUDISession;
- TipAlive = 1;
- return ((-1) * MONErrCantInitMsgSystem);
- }
- /* Reset communication channel */
- Mini_reset_comm();
-
- /*
- * Should we have different TIPS: one for shared memory & another for
- * serial connections?
- */
- if (CoreFile) {
- if ((MsgCode = Mini_load_coff(CoreFile, (INT32) D_MEM, (INT32) 1, (INT32) AllSections, 0)) != SUCCESS) {
- *Session = (UDISessionId) MONUDISession;
- TipAlive = 1;
- return ((UDIError) MsgCode);
- }
- CoreLoaded = 1; /* True */
- /* Reset communication channel */
- Mini_reset_comm();
- Mini_go_target(); /* RESET Target Processor */
- }
-
- /* Define TIPs endianess */
-
-#ifdef MSDOS
- tip_target_config.TipEndian = LITTLE;
-#else
- tip_target_config.TipEndian = BIG;
-#endif
-
- if (strcmp(TargetType, "serial") &&
- strcmp(TargetType, "paral_1") &&
- strcmp(TargetType, "pcserver")) { /* non-serial targets */
- RemoteTarget = 0; /* not a remote target */
- } else {
- RemoteTarget = 1; /* remote target */
- SendACKFirst = 1; /* safe to send always */
- }
-
- if (RemoteTarget == 0) { /* shared memory */
- MsgCode = Wait_For_Ack();
- if (MsgCode == ABORT_FAILURE)
- return (UDIErrorAborted);
- else if (MsgCode == FAILURE)
- return((-1) * MONErrNoSynch);
- }
-
- if (SendACKFirst)
- SendACK();
- /* send a config msg to sync with target */
- do {
- MsgCode = SendConfigWait();
- } while (MsgCode == HALT);
- if (MsgCode == ABORT_FAILURE)
- return (UDIErrorAborted);
- else if (MsgCode == FAILURE)
- return ((-1) * MONErrNoSynch);
- else if (MsgCode != CONFIG)
- return ((-1) * MONErrCantRecvMsg);
- Mini_unpack_config_msg(&tip_target_config);
-
- /* Reallocate message buffers to the smallest, if necessary */
- if ((MaxMsgBufSize != (unsigned int) 0) &&
- (MaxMsgBufSize < (unsigned int) tip_target_config.max_msg_size))
- tip_target_config.max_msg_size = (INT32) MaxMsgBufSize;
-
- if (Mini_alloc_msgbuf((int) tip_target_config.max_msg_size) != SUCCESS)
- return ((-1) * MONErrCantAllocBufs);
-
- ProcessorState = (UDIUInt32) UDINotExecuting;
- PreviousProcessorState = (UDIUInt32) UDINotExecuting;
-
- return (UDINoError);
- }
-}
-
-UDIError
-UDIDisconnect(Session, Terminate)
- UDISessionId Session;
- UDIBool Terminate;
-{
- if (Session != (UDISessionId) MONUDISession)
- return (UDIErrorNoSuchConnection);
-
- if (Terminate == (UDIBool) UDITerminateSession) {
- if (CoreFile)
- (void) free((char *) CoreFile);
- if (TargetType)
- (void) free((char *) TargetType);
- Mini_msg_exit(); /* clean up message buffers */
- if (Msg_Logfile)
- (void) fclose(MsgFile);
- ProcessorState = (UDIUInt32) UDINotExecuting;
- PreviousProcessorState = (UDIUInt32) UDINotExecuting;
- } else {
- ContinuingSession=1;
- };
- if ((int) (ProcessorState & 0xFF) == UDINotExecuting) {/* none active */
- CurrentPID = (UDIPId) UDIProcessProcessor;
- NumberOfProcesses=0;
- }
- TipAlive = 0;
- return (UDINoError);
-}
-
-UDIError
-UDISetCurrentConnection(Session)
- UDISessionId Session;
-{
- if (Session != (UDISessionId) MONUDISession)
- return (UDIErrorNoSuchConnection);
-
- return (UDINoError);
-}
-
-UDIError
-UDICapabilities ( TIPId, TargetId, DFEId, DFE, TIP, DFEIPCId, TIPIPCId, TIPString)
- UDIUInt32 *TIPId; /* Out */
- UDIUInt32 *TargetId; /* Out */
- UDIUInt32 DFEId; /* In */
- UDIUInt32 DFE; /* In */
- UDIUInt32 *TIP; /* Out */
- UDIUInt32 *DFEIPCId; /* Out */
- UDIUInt32 *TIPIPCId; /* Out */
- char *TIPString; /* Out */
-{
- *TIPId = (UDIUInt32) UDIID (UDIProductCode_Montip, MONTIPRev, MONTIPSubRev, MONTIPSubSubRev);
- *TargetId = (UDIUInt32) UDIID (UDIProductCode_Montip, MONTIPRev, MONTIPSubRev, MONTIPSubSubRev);
- if ((int) (DFE & 0x00000FFF) > (int) (MONTIPUDIVers)) {
- *TIP = (UDIUInt32) 0;
- } else if ((int) (DFE & 0x00000FFF) == (int) MONTIPUDIVers) {
- *TIP = (UDIUInt32) DFE;
- } else {
- *TIP = (UDIUInt32) MONTIPUDIVers;
- }
- *DFEIPCId = (UDIUInt32) 0;
- *TIPIPCId = (UDIUInt32) 0;
- (void) strcpy (TIPString, "UDI 1.2 Conformant Montip for 29K targets\0");
- return (UDINoError);
-}
-
-UDIError
-UDIGetErrorMsg (ErrorCode, MsgSize, Msg, CountDone)
- UDIError ErrorCode; /* In */
- UDISizeT MsgSize; /* In */
- char *Msg; /* Out */
- UDISizeT *CountDone; /* Out */
-{
- int index;
-
- /* Continue Previous Error Message */
- if (ErrCntRemaining != (UDISizeT) 0) {
- index = (int) (strlen(monerr_tip[-ErrorCode]) + 1 - ErrCntRemaining);
- if (MsgSize < (UDISizeT) ErrCntRemaining) {
- (void) strncpy((char *) Msg, (char *) (monerr_tip[-ErrorCode]+index), MsgSize);
- *CountDone = MsgSize;
- ErrCntRemaining = ErrCntRemaining - MsgSize;
- } else {
- (void) strcpy((char *) Msg, (char *) (monerr_tip[-ErrorCode]+index));
- *CountDone = (UDISizeT) strlen(Msg) + 1;
- ErrCntRemaining = (UDISizeT) 0;
- }
- return (UDINoError);
- };
- /* A New ErrorCode */
- if ((ErrorCode <= 0) && (ErrorCode > (-1) * MAX_MONERR)) {
- if (MsgSize < (UDISizeT) MAX_MONERR_SIZE) {
- (void) strncpy((char *) Msg, monerr_tip[-ErrorCode], MsgSize);
- *CountDone = MsgSize;
- ErrCntRemaining = (UDISizeT) (strlen(monerr_tip[-ErrorCode])+1) - MsgSize;
- } else {
- (void) strcpy((char *) Msg, monerr_tip[-ErrorCode]);
- *CountDone = (UDISizeT) strlen(Msg) + 1;
- ErrCntRemaining = (UDISizeT) 0;
- }
- return (UDINoError);
- } else {
- return (UDIErrorUnknownError);
- };
-}
-
-UDIError
-UDIGetTargetConfig(KnownMemory, NumberOfRanges, ChipVersions, NumberOfChips)
- UDIMemoryRange KnownMemory[]; /* Out */
- UDIInt *NumberOfRanges; /* In/Out */
- UDIUInt32 ChipVersions[]; /* Out */
- UDIInt *NumberOfChips; /* In/Out */
-{
- UDIInt InRanges, InChips;
- int Incomplete;
-
- Incomplete = 0;
-
- InRanges = *NumberOfRanges;
- InChips = *NumberOfChips;
-
- if ((InRanges < (UDIInt) MONMaxMemRanges) || (InChips < (UDIInt) MONMaxChips))
- Incomplete = 1;
-
- *NumberOfRanges = (UDIInt) 0;
- switch ((int) InRanges) {
- default:
- case 3 /* MONMaxMemRanges */:
- if (*NumberOfRanges == (UDIInt) 0)
- *NumberOfRanges = (UDIInt) 3;
- KnownMemory[2].Space = (CPUSpace) UDI29KIRAMSpace;
- KnownMemory[2].Offset = (CPUOffset) tip_target_config.I_mem_start;
- KnownMemory[2].Size = (CPUSizeT) tip_target_config.I_mem_size;
- case 2:
- if (*NumberOfRanges == (UDIInt) 0)
- *NumberOfRanges = (UDIInt) 2;
- KnownMemory[1].Space = (CPUSpace) UDI29KDRAMSpace;
- KnownMemory[1].Offset = (CPUOffset) tip_target_config.D_mem_start;
- KnownMemory[1].Size = (CPUSizeT) tip_target_config.D_mem_size;
- case 1:
- if (*NumberOfRanges == (UDIInt) 0)
- *NumberOfRanges = (UDIInt) 1;
- KnownMemory[0].Space = (CPUSpace) UDI29KIROMSpace;
- KnownMemory[0].Offset = (CPUOffset) tip_target_config.ROM_start;
- KnownMemory[0].Size = (CPUSizeT) tip_target_config.ROM_size;
- break;
- case 0:
- *NumberOfRanges = (UDIInt) 0;
- break;
- }
-
- *NumberOfChips = (UDIInt) 0;
- switch ((int) InChips) {
- default:
- case 2: /* MONMaxChips */
- if (*NumberOfChips == (UDIInt) 0)
- *NumberOfChips = (UDIInt) 2;
- if (tip_target_config.coprocessor == (UINT32) -1)
- ChipVersions[1] = (UDIUInt32) UDI29KChipNotPresent;
- else
- ChipVersions[1] = (UDIUInt32) tip_target_config.coprocessor;
- case 1:
- if (*NumberOfChips == (UDIInt) 0)
- *NumberOfChips = (UDIInt) 1;
- ChipVersions[0] = (UDIUInt32) tip_target_config.processor_id;
- break;
- case 0:
- *NumberOfChips = (UDIInt) 0;
- break;
- }
- if (Incomplete)
- return (UDIErrorIncomplete);
- else
- return (UDINoError);
-}
-
-UDIError
-UDICreateProcess(pid)
- UDIPId *pid;
-{
- if (CurrentPID == (UDIPId) (UDIProcessProcessor + 1))
- return (UDIErrorCantCreateProcess);
- CurrentPID = (UDIPId) (UDIProcessProcessor + 1);
- NumberOfProcesses=1;
- *pid = (UDIPId) CurrentPID;
- return (UDINoError);
-}
-
-UDIError
-UDISetCurrentProcess(pid)
- UDIPId pid;
-{
- if ((pid > (UDIPId) (UDIProcessProcessor + 1)) ||
- (pid < (UDIPId) (UDIProcessProcessor)))
- return (UDIErrorNoSuchProcess);
- if ((NumberOfProcesses == (int) 0) && (pid != (UDIPId) UDIProcessProcessor))
- return (UDIErrorNoSuchProcess);
- CurrentPID = pid;
- return (UDINoError);
-}
-
-UDIError
-UDIDestroyProcess(pid)
- UDIPId pid;
-{
- if ((pid > (UDIPId) (UDIProcessProcessor + 1)) ||
- (pid < (UDIPId) (UDIProcessProcessor)))
- return (UDIErrorNoSuchProcess);
- CurrentPID = (UDIPId) UDIProcessProcessor;
- ProcessorState = (UDIUInt32) UDINotExecuting;
- PreviousProcessorState = (UDIUInt32) UDINotExecuting;
- NumberOfProcesses=0;
- return (UDINoError);
-}
-
-UDIError
-UDIInitializeProcess (ProcessMemory, NumberOfRanges, EntryPoint, StackSizes, NumberOfStacks, ArgString)
- UDIMemoryRange ProcessMemory[]; /* In */
- UDIInt NumberOfRanges; /* In */
- UDIResource EntryPoint; /* In */
- CPUSizeT StackSizes[]; /* In */
- UDIInt NumberOfStacks; /* In */
- char *ArgString; /* In */
-{
- UDIError ErrCode;
- UDIRange text_addr, data_addr;
- CPUSizeT mem_stack_size, reg_stack_size;
-
- ADDR32 arg_start;
- ADDR32 data_high;
- ADDR32 highmem;
- INT32 os_control;
- INT32 MsgCode;
- UDIInt i;
-
-
- exitstat = 0; /* reset */
-
- PgmStdinMode=TIP_COOKED; /* revert to default mode */
-
- CLEAR_PENDING_STOP
-
- if (CurrentPID == (UDIPId) UDIProcessProcessor) {
- if ((MsgCode = Reset_Processor()) != SUCCESS)
- return ((UDIError) MsgCode);
- do {
- MsgCode = SendConfigWait();
- } while (MsgCode == HALT);
- if (MsgCode == ABORT_FAILURE)
- return (UDIErrorAborted);
- else if (MsgCode == FAILURE)
- return ((-1) * MONErrNoSynch);
- else if (MsgCode != CONFIG)
- return ((-1) * MONErrCantRecvMsg);
- Mini_unpack_config_msg(&tip_target_config);
- /* Reallocate message buffers */
- if (Mini_alloc_msgbuf((int) tip_target_config.max_msg_size) != SUCCESS)
- return ((-1) * MONErrCantAllocBufs);
- ProcessorState = (UDIUInt32) UDINotExecuting;
- Channel0_count = 0;
- Channel1_count = 0;
- Channel2_count = 0;
- Channel0Busy = 0;
- PreviousProcessorState = (UDIUInt32) UDINotExecuting;
- return (UDINoError);
- };
-
-
- /* For other processes */
- /* Set Default Values */
- mem_stack_size = (CPUSizeT) MONDefaultMemStackSize;
- reg_stack_size = (CPUSizeT) MONDefaultRegStackSize;
- text_addr.Low = (CPUOffset) tip_target_config.I_mem_start;
- text_addr.High = (CPUOffset) tip_target_config.I_mem_start +
- (CPUOffset) tip_target_config.I_mem_size - 1;
- data_addr.Low = (CPUOffset) tip_target_config.D_mem_start;
- data_addr.High = (CPUOffset) tip_target_config.D_mem_start +
- (CPUOffset) tip_target_config.D_mem_size -
- (CPUOffset) (mem_stack_size + reg_stack_size + 16) - 1;
-
- /* Get Memory Ranges */
- if (NumberOfRanges != (UDIInt) 0) {
- for (;NumberOfRanges--;) {
- switch ((int) ProcessMemory[NumberOfRanges].Space) {
- case UDI29KIRAMSpace:
- text_addr.Low = ProcessMemory[NumberOfRanges].Offset;
- text_addr.High = ProcessMemory[NumberOfRanges].Offset +
- (CPUOffset) ProcessMemory[NumberOfRanges].Size;
- break;
- case UDI29KDRAMSpace:
- data_addr.Low = ProcessMemory[NumberOfRanges].Offset;
- data_addr.High = ProcessMemory[NumberOfRanges].Offset +
- (CPUOffset) ProcessMemory[NumberOfRanges].Size;
- break;
- default: /* don't care */
- break;
- } /* switch */
- } /* for */
- }
- /* Get Stack Sizes */
- for (i = (UDIInt) 0; i < NumberOfStacks; i=i+(UDIInt)1) {
- switch ((int) i) {
- case 0: /* register stack size */
- if (StackSizes[0] != (CPUSizeT) 0)
- reg_stack_size = StackSizes[0];
- break;
- case 1: /* memory stack size */
- if (StackSizes[1] != (CPUSizeT) 0)
- mem_stack_size = StackSizes[1];
- break;
- default: /* don't care */
- break;
- }
- }
-
- if ((CPUOffset) text_addr.High > (CPUOffset) data_addr.High)
- data_addr.High = text_addr.High; /* when no data sections */
- arg_start = (data_addr.High + 7) & ~0x7; /* word boundary */
-
- if ((ErrCode = write_args(ArgString,
- arg_start, &data_high)) != UDINoError)
- return (ErrCode);
-
- data_addr.High = (data_high + 7) & ~0x7; /* double word bdry */
-
- highmem = (ADDR32) 0;
-
- /* User programs run mode */
- if (SupervisorMode)
- os_control = (INT32) 0x10000000; /* set bit 28 only */
- else if (VirtualMode || ProtectedMode)
- os_control = (INT32) 0;
- else
- os_control = (INT32) 0x80000000;
-
- Mini_build_init_msg((ADDR32) text_addr.Low, (ADDR32) text_addr.High,
- (ADDR32) data_addr.Low, (ADDR32) data_addr.High,
- (ADDR32) EntryPoint.Offset,
- (INT32) mem_stack_size, (INT32) reg_stack_size,
- (ADDR32) highmem,
- (ADDR32) arg_start,
- (INT32) os_control);
- SEND_AND_WAIT_ACK(INIT_ACK);
- if (ReturnedError == (int) 1) {
- ReturnedError = 0;
- return ((-1) * MONErrErrorInit);
- }
- Mini_unpack_init_ack_msg();
-
- ProcessorState = (UDIUInt32) UDINotExecuting;
- PreviousProcessorState = (UDIUInt32) UDINotExecuting;
-
- return (UDINoError);
-}
-
-UDIError
-UDIRead(from, to, count, size, count_done, host_endian)
- UDIResource from;
- UDIHostMemPtr to;
- UDICount count;
- UDISizeT size;
- UDICount *count_done;
- UDIBool host_endian;
-{
- INT32 space = SpaceMap_udi2mm(from.Space);
- INT32 done;
- INT32 ttl_count;
- INT32 msg_count;
- INT32 overhead;
-
- ADDR32 ack_addr;
- INT32 ack_space;
- BYTE *output;
- UDIError UDIretval;
-
- UDICount i;
- INT32 *Version;
-
- int Gr1_val;
- int Lrnum;
- int j;
- UDIResource temp_from;
- UDICount temp_done;
- UDIUInt32 start_offset,
- end_offset;
- BYTE *reg_data;
-
-
- CLEAR_PENDING_STOP
-
- if (count <= (UDICount) 0) {
- *count_done = (UDICount) 0;
- return (UDINoError);
- }
-
- if (space == (INT32) VERSION_SPACE) { /* minimon ver cmd */
- Version = (INT32 *) to;
- *Version = (INT32) tip_target_config.version;
- *(Version+1) = (INT32) tip_target_config.os_version;
- /* TIPVERSION must be 11 chars or less */
- strcpy((char *) (Version+2),TIPVERSION);
- /* TIPDATE must be 11 chars or less */
- strcpy((char *) (Version+5),TIPDATE);
- /* max msg size */
- *(Version + 8) = tip_target_config.max_msg_size;
- /* max bkpts */
- *(Version + 9) = tip_target_config.max_bkpts;
- if ((host_endian) && (tip_target_config.TipEndian != tip_target_config.P29KEndian)) {
- output = (BYTE *) to;
- for (i = 0; i < count; i++) {
- if (size == 4)
- tip_convert32(output);
- else if (size == 2)
- tip_convert16(output);
- output = output + size;
- }
- } /* hostendian */
- *count_done = (UDICount) count;
- return (UDINoError);
- };
-
- if (space < (INT32) 0) {
- *count_done = (UDICount) 0;
- return (UDIErrorUnknownResourceSpace);
- }
-
- output = (BYTE *) to;
-
- switch (from.Space) {
- case UDI29KPC:
- from.Offset = 1; /* PC1 */
- break;
- case UDI29KGlobalRegs:
- break;
- case UDI29KRealRegs:
- /* REAL REGS BEGIN */
- /* get global and local reg values from target if target exec'ed */
- if (RefreshRegs) {
- RefreshRegs = 0; /* reset */
- temp_from.Offset = (CPUOffset) 0;
- temp_from.Space = UDI29KGlobalRegs;
- if ((UDIretval = UDIRead(temp_from,
- (UDIHostMemPtr) &Glob_Regs[0],
- (UDICount) 2,
- (UDISizeT) 4,
- (UDICount *) &temp_done,
- (UDIBool) TRUE)) != UDINoError) /* gr0, gr1 */
- return (UDIretval);
- /* UDIRead (); gr64 to gr 127 */
- temp_from.Offset = (CPUOffset) 64;
- temp_from.Space = UDI29KGlobalRegs;
- if ((UDIretval = UDIRead(temp_from,
- (UDIHostMemPtr) &Glob_Regs[64],
- (UDICount) 64,
- (UDISizeT) 4,
- (UDICount *) &temp_done,
- (UDIBool) TRUE)) != UDINoError) /* gr0, gr1 */
- return (UDIretval);
- /* UDIRead (); lr0 to lr127 */
- temp_from.Offset = (CPUOffset) 0;
- temp_from.Space = UDI29KLocalRegs;
- if ((UDIretval = UDIRead(temp_from,
- (UDIHostMemPtr) &Loc_Regs[0],
- (UDICount) 128,
- (UDISizeT) 4,
- (UDICount *) &temp_done,
- (UDIBool) TRUE)) != UDINoError) /* gr0, gr1 */
- return (UDIretval);
- };
-
- start_offset = from.Offset;
- end_offset = start_offset + count;
- output = (BYTE *) to;
- while (start_offset < end_offset) { /* do only if count is non zero */
- if (start_offset <= (UDIUInt32) 127) {
- reg_data = (BYTE *) &Glob_Regs[(int) start_offset];
- for (j = 0; j < 4 /* sizeof (UDIUInt32) */ ; j++)
- *output++ = *reg_data++;
- } else if ((start_offset >= (UDIUInt32) 128) && (start_offset <= (UDIUInt32) 255)) {
- Gr1_val = (int) (Glob_Regs[1] & 0x000001FC) >> 2; /* bits 2 to 8 */
- Lrnum = (int) ((int) start_offset - Gr1_val) % 128;
- reg_data = (BYTE *) & Loc_Regs[(int) Lrnum];
- for (j = 0; j < 4 /* sizeof (UDIUInt32) */ ; j++)
- *output++ = *reg_data++;
- } else
- return (UDIErrorUnknownResourceSpace);
- start_offset = start_offset + (UDIUInt32) 1;
- } /* end while */
- *count_done = (UDICount) count;
- return (UDINoError);
- /* REAL REGS END */
- default:
- break;
- }
-
- output = (BYTE *) to;
- if ( (RemoteTarget == 0) &&
- ((from.Space == UDI29KDRAMSpace) ||
- (from.Space == UDI29KIRAMSpace) ||
- (from.Space == UDI29KIROMSpace))) { /* shared memory board */
- Mini_read_memory(space, from.Offset, count * size, (BYTE *) output);
- } else {
- /* overhead = checksum + header + size rounding + bfr rounding + ? */
- overhead = 32;
- ttl_count = count;
- output = (BYTE *) to;
- while (ttl_count > 0) {
- /* Check for user interrupt */
- if (StopFlag) {
- STOP_SIG_HDLR
- ProcessorState = (UDIUInt32) UDIStopped;
- PreviousProcessorState = (UDIUInt32) UDIStopped;
- return (UDIErrorAborted);
- };
- /* Check possible buffer overflow */
- if ((ttl_count * size) + overhead >
-#ifdef MSDOS
- tip_target_config.max_msg_size) {
- msg_count = (tip_target_config.max_msg_size-overhead) >> (size >> 1);
-#else
- (INT32) 256) { /* SunOS has problems with higher numbers */
- msg_count = (256 - overhead) >> (size >> 1);
-#endif
- ttl_count = ttl_count - msg_count;
- } else {
- msg_count = ttl_count;
- ttl_count = ttl_count - msg_count;
- }
- Mini_build_read_req_msg(space, (ADDR32) from.Offset, msg_count, size);
- SEND_AND_WAIT_ACK(READ_ACK);
- if (ReturnedError == (int) 1) {
- ReturnedError = 0;
- return ((-1) * MONErrErrorRead);
- }
- Mini_unpack_read_ack_msg((INT32 *) &ack_space, (ADDR32 *) &ack_addr,
- (INT32 *) &done, (BYTE *) output);
- output = output + (msg_count * size);
- if (ISMEM(space))
- from.Offset = from.Offset + (CPUOffset) (msg_count * size);
- else
- from.Offset = from.Offset + (CPUOffset) msg_count;
- }
- } /* end while */
-
- if ((host_endian) &&
- (tip_target_config.TipEndian != tip_target_config.P29KEndian)) {
- output = (BYTE *) to;
- for (i = 0; i < count; i++) {
- if (size == 4)
- tip_convert32(output);
- else if (size == 2)
- tip_convert16(output);
- output = output + size;
- }
- } /* hostendian */
-
- *count_done = (UDICount) count;
- return (UDINoError);
-}
-
-UDIError
-UDIWrite(from, to, count, size, count_done, HostEndian)
- UDIHostMemPtr from;
- UDIResource to;
- UDICount count;
- UDISizeT size;
- UDICount *count_done;
- UDIBool HostEndian;
-{
- INT32 space = SpaceMap_udi2mm(to.Space);
- INT32 done;
- INT32 ttl_count;
- INT32 msg_count;
- INT32 overhead;
- ADDR32 ack_addr;
- INT32 ack_space;
- BYTE *input;
- UDIError UDIretval;
- UDIUInt32 tmpbuf[2];
- UDICount i;
-
- /* REAL REGS BEGIN */
- UDIResource temp_to;
- UDICount temp_done;
- CPUOffset start_offset,
- end_offset;
- UDIUInt32 Gr1_val;
-
- /* REAL REGS END */
-
- CLEAR_PENDING_STOP
-
- if (space < (INT32) 0) {
- *count_done = (UDICount) 0;
- return (UDIErrorUnknownResourceSpace);
- }
-
- if (count <= (UDICount) 0) {
- *count_done = (UDICount) 0;
- return (UDINoError);
- }
-
- if (to.Space == UDI29KPC) {
- /* when writing UDI29KPC, set both PC1 and PC0 */
- /* NOTE: this assumes we are not in freeze mode */
- /* this must all be done before doing the endian conversion below */
- to.Offset = 0; /* start at PC0 */
- count = (UDIInt32) 2; /* writing 2 4-byte quantities */
- tmpbuf[1] = *((UDIUInt32 *) from); /* PC1 = PC */
- if (!HostEndian && (tip_target_config.TipEndian != tip_target_config.P29KEndian)) {
- tmpbuf[0] = tmpbuf[1];
- tip_convert32((BYTE *) &tmpbuf[0]);
- tmpbuf[0] = tmpbuf[0] + 4; /* PC0 = PC + 4 */
- tip_convert32((BYTE *) &tmpbuf[0]);
- } else {
- tmpbuf[0] = tmpbuf[1] + 4; /* PC0 = PC + 4 */
- }
- from = (UDIHostMemPtr) tmpbuf; /* set pointer to temporary (8-byte)
- * buffer */
- }
-
- switch (to.Space) {
- case UDI29KLocalRegs:
- RefreshRegs = 1;
- break;
- case UDI29KPC: /* PC causes special regs(PC0,PC1) space */
- break;
- case UDI29KGlobalRegs:
- RefreshRegs = 1;
- break;
- case UDI29KRealRegs:
- RefreshRegs = 1;
- /* REAL REGS BEGIN */
- start_offset = to.Offset;
- end_offset = start_offset + count - 1;
- if ((end_offset <= 127)) { /* all globals asked */
- temp_to.Offset = to.Offset;
- temp_to.Space = UDI29KGlobalRegs;
- if ((UDIretval = UDIWrite(from,
- temp_to,
- count,
- size,
- &temp_done,
- HostEndian)) != UDINoError)
- return (UDIretval);
- } else if (start_offset > 127) { /* all local regs */
- /* read gr1 */
- temp_to.Offset = (CPUOffset) 1;
- temp_to.Space = UDI29KGlobalRegs;
- if ((UDIretval = UDIRead(temp_to,
- (UDIHostMemPtr) &Gr1_val,
- (UDICount) 1,
- (UDISizeT) 4,
- (UDICount *) &temp_done,
- (UDIBool) TRUE)) != UDINoError) /* gr1 */
- return (UDIretval);
- /* recompute start_offset and end_offset */
- Gr1_val = (Gr1_val & 0x01FC) >> 2;
- start_offset = (start_offset - Gr1_val) % 128;
- end_offset = (end_offset - Gr1_val) % 128;
- input = (BYTE *) from;
- if (start_offset > end_offset) { /* wrap around */
- temp_to.Offset = start_offset;
- temp_to.Space = UDI29KLocalRegs;
- if ((UDIretval = UDIWrite(input,
- temp_to,
- (UDICount) (128 - start_offset),
- size,
- &temp_done,
- HostEndian)) != UDINoError)
- return (UDIretval);
- input = input + (int) ((128 - start_offset) * size);
- temp_to.Offset = (CPUOffset) 0; /* from LR0 */
- temp_to.Space = UDI29KLocalRegs;
- if ((UDIretval = UDIWrite(input,
- temp_to,
- (UDICount) (end_offset + 1 ),
- size,
- &temp_done,
- HostEndian)) != UDINoError)
- return (UDIretval);
- } else { /* no wrapping */
- temp_to.Offset = start_offset;
- temp_to.Space = UDI29KLocalRegs;
- if ((UDIretval = UDIWrite(input,
- temp_to,
- count,
- size,
- &temp_done,
- HostEndian)) != UDINoError)
- return (UDIretval);
- }
- } else { /* overlap */
- input = (BYTE *) from;
- /* write globals */
- temp_to.Offset = start_offset;
- temp_to.Space = UDI29KGlobalRegs;
- if ((UDIretval = UDIWrite(input,
- temp_to,
- ((UDICount) 128 - (UDICount) start_offset),
- size,
- &temp_done,
- HostEndian)) != UDINoError)
- return (UDIretval);
- input = input + (int) (size) * ((UDICount) 128 - (UDICount) start_offset);
- /* write locals */
- temp_to.Offset = (CPUOffset) 128;
- temp_to.Space = UDI29KRealRegs;
- if ((UDIretval = UDIWrite(input,
- temp_to,
- (UDICount) (count - 128 + start_offset),
- size,
- &temp_done,
- HostEndian)) != UDINoError)
- return (UDIretval);
- }
- *count_done = (UDICount) count;
- return (UDINoError);
- /* REAL REGS END */
- default:
- break;
- }
-
- if (HostEndian &&
- (tip_target_config.TipEndian != tip_target_config.P29KEndian)) {
- input = (BYTE *) from;
- for (i = 0; i < count; i++) {
- if (size == 4)
- tip_convert32(input);
- else if (size == 2)
- tip_convert16(input);
- input = input + size;
- }
- }; /* endian conversion done */
-
- input = (BYTE *) from;
- if ((RemoteTarget == 0) &&
- ((to.Space == UDI29KDRAMSpace) ||
- (to.Space == UDI29KIRAMSpace) ||
- (to.Space == UDI29KIROMSpace))) {
- Mini_write_memory(space, to.Offset, count * size, (BYTE *) input);
- *count_done = (UDICount) count;
- return (UDINoError);
- } else { /* remote */
- /* overhead = checksum + header + size rounding + bfr rounding + ? */
- overhead = 32;
- ttl_count = count;
- input = (BYTE *) from;
- while (ttl_count > 0) {
- /* Check for user interrupt */
- if (StopFlag) {
- STOP_SIG_HDLR
- ProcessorState = (UDIUInt32) UDIStopped;
- PreviousProcessorState = (UDIUInt32) UDIStopped;
- return (UDIErrorAborted);
- };
- /* Check possible buffer overflow */
- if ((ttl_count * size) + overhead >
- tip_target_config.max_msg_size) {
- msg_count = (tip_target_config.max_msg_size-overhead) >> (size >> 1);
- ttl_count = ttl_count - msg_count;
- } else {
- msg_count = ttl_count;
- ttl_count = ttl_count - msg_count;
- }
- Mini_build_write_req_msg(space, (ADDR32) to.Offset,
- msg_count, size, (BYTE *) input);
- SEND_AND_WAIT_ACK(WRITE_ACK);
- if (ReturnedError == (int) 1) {
- ReturnedError = 0;
- return ((-1) * MONErrErrorWrite);
- }
- Mini_unpack_write_ack_msg((INT32 *) &ack_space,
- (ADDR32 *) &ack_addr,
- (INT32 *) &done);
- input = input + (msg_count * size);
- if (ISMEM(space))
- to.Offset = to.Offset + (CPUOffset) (msg_count * size);
- else
- to.Offset = to.Offset + (CPUOffset) msg_count;
- } /* while */
- } /* end remote */
- *count_done = (to.Space == UDI29KPC) ? (UDICount) 1 : (UDICount) count;
- return (UDINoError);
-}
-
-UDIError
-UDICopy(from, to, count, size, count_done, direction)
- UDIResource from;
- UDIResource to;
- UDICount count;
- UDISizeT size;
- UDICount *count_done;
- UDIBool direction;
-{
- INT32 f_space = SpaceMap_udi2mm(from.Space);
- INT32 t_space = SpaceMap_udi2mm(to.Space);
-
- UDICount counter, maxcount,curcount;
- INT32 fill_count, fill_size;
-
- INT32 done;
- ADDR32 ack_saddr,
- ack_daddr;
-
- CLEAR_PENDING_STOP
-
- if ((t_space < 0) || (f_space < 0)) {
- *count_done = (UDICount) 0;
- return (UDIErrorUnknownResourceSpace);
- }
-
- if (count <= (UDICount) 0) {
- *count_done = (UDICount) 0;
- return (UDINoError);
- }
-
- RefreshRegs = 1;
-
- /* Split the copy to smaller copies based on the message size */
- maxcount = (UDICount) (tip_target_config.max_msg_size / size);
- counter = (UDICount) count;
-
- while (counter > (UDICount) 0) {
- /* Check for user interrupt */
- if (StopFlag) {
- STOP_SIG_HDLR
- ProcessorState = (UDIUInt32) UDIStopped;
- PreviousProcessorState = (UDIUInt32) UDIStopped;
- return (UDIErrorAborted);
- };
- curcount = (maxcount < counter) ? maxcount : counter;
- counter = counter - curcount;
- if ((size > (UDISizeT) 4) && (t_space == (INT32) I_MEM)) {
- /* reduce it to 4, must be a multiple also for I_MEM */
- fill_count = (INT32) (curcount * (size/4));
- fill_size = (INT32) size;
- } else if ((size > (UDISizeT) 4) && (t_space != (INT32) I_MEM)) {
- /* copy as bytes */
- fill_count = (INT32) (curcount * size);
- fill_size = (INT32) 1; /* bytes */
- } else {
- fill_count = (INT32) curcount;
- fill_size = (INT32) size;
- };
- Mini_build_copy_msg(f_space, (ADDR32) from.Offset,
- t_space, (ADDR32) to.Offset,
- fill_count, fill_size);
- SEND_AND_WAIT_ACK(COPY_ACK);
- if (ReturnedError == (int) 1) {
- ReturnedError = 0;
- return ((-1) * MONErrErrorCopy);
- }
- Mini_unpack_copy_ack_msg(&f_space, &ack_saddr,
- &t_space, &ack_daddr, &done);
- from.Offset = from.Offset + (CPUOffset) (curcount * size);
- to.Offset = to.Offset + (CPUOffset) (curcount * size);
- }; /* end while */
-
- *count_done = (UDICount) count;
- return (UDINoError);
-}
-
-UDIError
-UDIExecute()
-{
- INT32 MsgCode;
-
- CLEAR_PENDING_STOP
-
- if (!NoStepReqd) {
- if (!StepCmdGiven) {
- /* Execute one instruction */
- Mini_build_step_msg((INT32) 1);
-
- if (Mini_msg_send() != SUCCESS)
- return ((-1) * MONErrCantSendMsg);
- /* process message received from target */
- MsgCode = Wait_For_Ack();
- if (MsgCode == ABORT_FAILURE)
- return (UDIErrorAborted);
- else if (MsgCode == FAILURE)
- return ((-1) * MONErrNoAck);
-
- process_target_msg(MsgCode);
-
- /* if processor state is stepped, set breakpoints, issue a GO */
- if (ProcessorState != (UDIUInt32) UDIStepped) {
- RefreshRegs = 1;
- return (UDINoError);
- }
- PutAllBreakpoints();
- BreaksInPlace = 1;
- }
- }
-
- Mini_build_go_msg();
-
- if (Mini_msg_send() != SUCCESS)
- return ((-1) * MONErrCantSendMsg);
-
- RefreshRegs = 1;
- ProcessorState = (UDIUInt32) UDIRunning;
- PreviousProcessorState = (UDIUInt32) UDIRunning;
-
- return (UDINoError);
-}
-
-/*
- * Stepping will NOT cause any breakpoints to be installed. It will step the
- * number requested.
- */
-
-UDIError
-UDIStep(steps, steptype, range)
- UDIUInt32 steps;
- UDIStepType steptype;
- UDIRange range;
-{
- CLEAR_PENDING_STOP
-
- if (steps == (UDIUInt32) 0)
- return (UDINoError);
-
- if ((steptype & UDIStepOverCalls) || (steptype & UDIStepOverTraps) ||
- (steptype & UDIStepInRange))
- return (UDIErrorUnsupportedStepType);
-
- StepCmdGiven = 1;
- Mini_build_step_msg(steps);
- if (Mini_msg_send() != SUCCESS)
- return ((-1) * MONErrCantSendMsg);
- RefreshRegs = 1;
- ProcessorState = (UDIUInt32) UDIRunning;
- PreviousProcessorState = (UDIUInt32) UDIRunning;
-
- return (UDINoError);
-}
-
-UDIVoid
-UDIStop()
-{
- int GrossState;
-
- GrossState = (int) (ProcessorState & 0xFF);
- if ((GrossState == UDINotExecuting) || (GrossState == UDIRunning) ||
- (GrossState == UDIStdoutReady) || (GrossState == UDIStderrReady) ||
- (GrossState == UDIStdinNeeded) ) {
- StopFlag = 1; /* This will be reset after its handled */
- }
- /* Else ignored */
- return;
-}
-
-UDIError
-UDIWait(maxtime, pid, stop_reason)
- UDIInt32 maxtime;
- UDIPId *pid;
- UDIUInt32 *stop_reason;
-{
- INT32 MsgCode;
-
- *pid = (UDIPId) CurrentPID;
-
- if (ProcessorState == (UDIUInt32) UDIRunning) {
- while (1) { /* handle messages as long as they are coming */
- if (MsgAlreadyInBuffer==1) {
- MsgCode = MsgAlreadyReceived;
- MsgAlreadyInBuffer=0;
- } else {
- MsgCode = CheckForMsg(maxtime);
- }
-#if 0
- MsgCode = CheckForMsg(maxtime);
-#endif
- if ((MsgCode == FAILURE) || (MsgCode == ABORT_FAILURE)) { /* no news */
- *stop_reason = ProcessorState;
- return (UDINoError);
- } else { /* a message from target has arrived */
- *stop_reason = ProcessorState;
- if (MsgCode == CHANNEL0_ACK) {
- process_chan0_ack();
- return (UDINoError);
- }
- (void) process_target_msg(MsgCode);
- if (ProcessorState != (UDIUInt32) UDIRunning)
- return (UDINoError);
- };
- }
- } else {
- *stop_reason = ProcessorState;
- return (UDINoError);
- }
-}
-
-UDIError
-UDISetBreakpoint(addr, pass_count, bk_type, break_id)
- UDIResource addr;
- UDIInt32 pass_count;
- UDIBreakType bk_type;
- BreakIdType *break_id;
-{
- INT32 space = SpaceMap_udi2mm(addr.Space);
- ADDR32 ack_addr;
- INT32 set_count,
- set_type;
- BreakIdType newid;
- UDIUInt32 BreakInst; /* EB29K */
- UDIError UDIretval; /* EB29K */
-
- CLEAR_PENDING_STOP
-
- if (space < 0)
- return (UDIErrorUnknownResourceSpace);
-
- /*
- * Minimon currently supports only two types of breakpoints * BKPT_29000
- * and BKPT_29050 *
- */
- if (bk_type & MONBreakFlagHardware) {
- if (bk_type & MONBreakTranslationEnabled)
- bk_type = BKPT_29050_BTE_1;
- else
- bk_type = BKPT_29050_BTE_0; /* default */
- } else if ((bk_type & UDIBreakFlagRead) || (bk_type & UDIBreakFlagWrite))
- return ((-1) * MONErrUnknownBreakType);
- else if (bk_type & UDIBreakFlagExecute)
- bk_type = BKPT_29000; /* Minimon uses this */
-
- if (pass_count == (UDIInt32) 0)
- pass_count = (UDIInt32) -1; /* make it temporary */
- Mini_build_bkpt_set_msg(space,
- (ADDR32) addr.Offset,
- (INT32) pass_count,
- (INT32) bk_type);
- SEND_AND_WAIT_ACK (BKPT_SET_ACK);
- if (ReturnedError == (int) 1) {
- ReturnedError = 0;
- return ((-1) * MONErrErrorSetBreak);
- }
- Mini_unpack_bkpt_set_ack_msg((INT32 *) &space,
- (ADDR32 *) &ack_addr,
- (INT32 *) &set_count,
- (INT32 *) &set_type);
-
- BreakInst = (ADDR32) - 1;
-
- if (!strcmp(TargetType, "eb29k")) { /* For EB29K */
- /* UDIRead(); read instruction */
- if ((UDIretval = UDIRead(addr,
- (UDIHostMemPtr) &BreakInst,
- (UDICount) 4,
- (UDISizeT) 1,
- (UDICount *) &ack_addr,
- (UDIBool) FALSE)) != UDINoError) /* 29K endian */
- return (UDIretval);
- };
-
- add_to_bp_table(&newid, space, addr.Offset, set_count, set_type, BreakInst);
- *break_id = (BreakIdType) newid;
- LastBreakId = newid + 1; /* ??? */
- return (UDINoError);
-}
-
-UDIError
-UDIQueryBreakpoint(break_id, addr, pass_count,
- bk_type, current_count)
- BreakIdType break_id;
- UDIResource *addr;
- UDIInt32 *pass_count;
- UDIBreakType *bk_type;
- UDIInt32 *current_count;
-{
- INT32 space;
- ADDR32 offset;
- INT32 pcount;
- INT32 type;
- INT32 ccount;
- ADDR32 Inst;
-
- CLEAR_PENDING_STOP
-
- if (break_id >= LastBreakId)
- return (UDIErrorNoMoreBreakIds);
-
- if (get_from_bp_table(break_id, &space, &offset, &pcount, &type, &Inst) != 0)
- return (UDIErrorInvalidBreakId);
-
- Mini_build_bkpt_stat_msg(space, offset);
- SEND_AND_WAIT_ACK (BKPT_STAT_ACK);
- if (ReturnedError == (int) 1) {
- ReturnedError = 0;
- return ((-1) * MONErrErrorStatBreak);
- }
- Mini_unpack_bkpt_stat_ack_msg((INT32 *) &space,
- (ADDR32 *) &offset,
- (INT32 *) &ccount,
- (INT32 *) &type);
-
- addr->Space = SpaceMap_mm2udi(space);
- addr->Offset = (CPUOffset) offset;
- *pass_count = (UDIInt32) pcount;
-
- if (type == (INT32) BKPT_29000)
- type = UDIBreakFlagExecute;
- else if (type == BKPT_29050_BTE_0)
- type = (MONBreakFlagHardware | UDIBreakFlagExecute);
- else if (type == BKPT_29050_BTE_1)
- type = (MONBreakTranslationEnabled | MONBreakFlagHardware | UDIBreakFlagExecute);
- *bk_type = (UDIBreakType) type;
-
- *current_count = (UDIInt32) ccount;
-
- return (UDINoError);
-}
-
-UDIError
-UDIClearBreakpoint(break_id)
- BreakIdType break_id;
-{
- INT32 space;
- ADDR32 offset;
- INT32 count;
- INT32 type;
- ADDR32 Inst;
- UDIResource addr; /* EB29K */
- UDIError UDIretval; /* EB29K */
-
- CLEAR_PENDING_STOP
-
- /* should bkpt be removed from linked list ?? */
- if (get_from_bp_table(break_id, &space, &offset, &count, &type, &Inst) != 0)
- return (UDIErrorInvalidBreakId);
-
- Mini_build_bkpt_rm_msg(space, offset);
- SEND_AND_WAIT_ACK (BKPT_RM_ACK);
- if (ReturnedError == (int) 1) {
- ReturnedError = 0;
- return ((-1) * MONErrErrorRmBreak);
- }
- Mini_unpack_bkpt_rm_ack_msg(&space, &offset);
-
- if (!strcmp(TargetType, "eb29k")) { /* For EB29K */
- /* Write back the original instruction * UDIWrite(Inst); */
- addr.Offset = offset;
- addr.Space = SpaceMap_mm2udi(space);
- if ((UDIretval = UDIWrite((UDIHostMemPtr) &Inst,
- addr,
- (UDICount) 4,
- (UDISizeT) 1,
- &offset,
- FALSE)) != UDINoError)
- return (UDIretval);
- };
-
- remove_from_bp_table(break_id);
-
- return (UDINoError);
-}
-
-UDIError
-UDIGetStdout(buf, bufsize, count_done)
- UDIHostMemPtr buf;
- UDISizeT bufsize;
- UDISizeT *count_done;
-{
- static int chan1_indx = 0;
- UDISizeT mincount;
- UDISizeT i;
- char *temp;
- UDIUInt32 reg_val;
- UDIError UDIretval;
-
-
- if ((int) (ProcessorState & 0xFF) != (int) UDIStdoutReady) {
- *count_done = (UDISizeT) 0;
- return (UDINoError);
- };
-
- temp = (char *) buf; /* used for copying */
- i = (UDISizeT) chan1_indx;
- if (Channel1_count) {
- mincount = (Channel1_count < (UDISizeT) bufsize) ? Channel1_count :
- (UDISizeT) bufsize;
- for (i = 0; i < mincount; i++) {
- (char) *temp++ = (char) channel1_buffer[chan1_indx];
- chan1_indx = (chan1_indx + 1) % TIP_IO_BUFSIZE; /* circular buffer */
- }
- *count_done = (UDISizeT) mincount;
- Channel1_count = Channel1_count - mincount;
- TotalDone = TotalDone + (UDIUInt32) mincount;
- if (Channel1_count <= (UDISizeT) 0) {
- /*
- * The HIF kernel from MiniMON29K release 2.1 expects MONTIP
- * to send a HIF_CALL_RTN response for a HIF_CALL message, and
- * a CHANNEL1_ACK response for a CHANNEL1 message, and
- * a CHANNEL2_ACK response for a CHANNEL2 message, and
- * a CHANNEL0 message for a asynchronous input.
- * The HIF kernel version numbers 0x05 and above support these
- * features.
- */
- if ((tip_target_config.os_version & 0xf) > 4) { /* new HIF kernel */
- if (!NoChan1Ack) {
- Mini_build_channel1_ack_msg(TotalDone); /* send gr96 value */
- if (Mini_msg_send() != SUCCESS)
- return ((-1) * MONErrCantSendMsg);
- }
- } else { /* old HIF kernel */
- if ((UDIretval = Write_Glob_Reg(TotalDone, (int) 96)) != UDINoError)
- return (UDIretval);
- reg_val = (UDIUInt32) 0x80000000;
- if ((UDIretval = Write_Glob_Reg(reg_val, (int) 121)) != UDINoError)
- return (UDIretval);
- }
- TotalDone = (UDIUInt32) 0;
- Channel1_count = (UDISizeT) 0;
- chan1_indx = 0;
- } else {
- return (UDINoError);
- }
- } else {
- *count_done = (UDISizeT) 0;
- TotalDone = (UDIUInt32) 0;
- Channel1_count = (UDISizeT) 0;
- chan1_indx = 0;
- /*
- * The HIF kernel from MiniMON29K release 2.1 expects MONTIP
- * to send a HIF_CALL_RTN response for a HIF_CALL message, and
- * a CHANNEL1_ACK response for a CHANNEL1 message, and
- * a CHANNEL2_ACK response for a CHANNEL2 message, and
- * a CHANNEL0 message for a asynchronous input.
- * The HIF kernel version numbers 0x05 and above support these
- * features.
- */
- if ((tip_target_config.os_version & 0xf) > 4) { /* new HIF kernel */
- Mini_build_channel1_ack_msg(TotalDone); /* send gr96 value */
- if (Mini_msg_send() != SUCCESS)
- return ((-1) * MONErrCantSendMsg);
- } else { /* old HIF kernel */
- if ((UDIretval = Write_Glob_Reg(TotalDone, (int) 96)) != UDINoError)
- return (UDIretval);
- reg_val = (UDIUInt32) 0x80000000;
- if ((UDIretval = Write_Glob_Reg(reg_val, (int) 121)) != UDINoError)
- return (UDIretval);
- }
- }
- if (StepCmdGiven) {
- ProcessorState = UDIStepped;
- PreviousProcessorState = UDIStepped;
- StepCmdGiven = 0;
- } else {
- if (!BreaksInPlace) {
- PutAllBreakpoints();
- BreaksInPlace = 1;
- }
- /*
- * The HIF kernel from MiniMON29K release 2.1 expects MONTIP
- * to send a HIF_CALL_RTN response for a HIF_CALL message, and
- * a CHANNEL1_ACK response for a CHANNEL1 message, and
- * a CHANNEL2_ACK response for a CHANNEL2 message, and
- * a CHANNEL0 message for a asynchronous input.
- * The HIF kernel version numbers 0x05 and above support these
- * features.
- */
- if ((tip_target_config.os_version & 0xf) > 4) { /* new HIF kernel */
- ProcessorState = (UDIUInt32) UDIRunning;
- PreviousProcessorState = (UDIUInt32) UDIRunning;
- } else { /* old HIF kernel */
- UDIExecute(); /* sends a GO to the Debugger to start application */
- }
- }
- return (UDINoError);
-}
-
-#ifdef MSDOS
-UDIError OldHIFGetStderr( UDIHostMemPtr buf,UDISizeT bufsize,UDISizeT *count_done);
-#else
-UDIError OldHIFGetStderr();
-#endif
-
-UDIError
-UDIGetStderr(buf, bufsize, count_done)
- UDIHostMemPtr buf;
- UDISizeT bufsize;
- UDISizeT *count_done;
-{
- static int chan2_indx = 0;
- UDISizeT mincount;
- UDISizeT i;
- char *temp;
-
- if ((int) (ProcessorState & 0xFF) != (int) UDIStderrReady) {
- *count_done = (UDISizeT) 0;
- return (UDINoError);
- };
- /*
- * The HIF kernel from MiniMON29K release 2.1 expects MONTIP
- * to send a HIF_CALL_RTN response for a HIF_CALL message, and
- * a CHANNEL1_ACK response for a CHANNEL1 message, and
- * a CHANNEL2_ACK response for a CHANNEL2 message, and
- * a CHANNEL0 message for a asynchronous input.
- * The HIF kernel version numbers 0x05 and above support these
- * features.
- */
- if ((tip_target_config.os_version & 0xf) > 4) { /* new HIF kernel */
- /*
- * From MiniMON29K release 2.1 all interactions with
- * stdin, stdout, stderr by the application is handled without
- * invoking the Debugger on the target. Thus, a write to stderr
- * is implemented by a CHANNEL2 message similar to the CHANNEL1
- * message for stdout.
- */
- temp = (char *) buf; /* used for copying */
- i = (UDISizeT) chan2_indx;
- if (Channel2_count) {
- mincount = (Channel2_count < (UDISizeT) bufsize) ? Channel2_count :
- (UDISizeT) bufsize;
- for (i = 0; i < mincount; i++) {
- (char) *temp++ = (char) channel2_buffer[chan2_indx];
- chan2_indx = (chan2_indx + 1) % TIP_IO_BUFSIZE;/* circular buffer */
- }
- *count_done = (UDISizeT) mincount;
- Channel2_count = Channel2_count - mincount;
- TotalDone = TotalDone + (UDIUInt32) mincount;
- if (Channel2_count <= (UDISizeT) 0) {
- Mini_build_channel2_ack_msg(TotalDone); /* send gr96 value */
- if (Mini_msg_send() != SUCCESS)
- return ((-1) * MONErrCantSendMsg);
- TotalDone = (UDIUInt32) 0;
- Channel2_count = (UDISizeT) 0;
- chan2_indx = 0;
- } else {
- return (UDINoError);
- }
- } else {
- *count_done = (UDISizeT) 0;
- TotalDone = (UDIUInt32) 0;
- Channel2_count = (UDISizeT) 0;
- chan2_indx = 0;
- Mini_build_channel2_ack_msg(TotalDone); /* send gr96 value */
- if (Mini_msg_send() != SUCCESS)
- return ((-1) * MONErrCantSendMsg);
- }
- if (StepCmdGiven) {
- ProcessorState = UDIStepped;
- PreviousProcessorState = UDIStepped;
- StepCmdGiven = 0;
- } else {
- if (!BreaksInPlace) {
- PutAllBreakpoints();
- BreaksInPlace = 1;
- }
- ProcessorState = (UDIUInt32) UDIRunning;
- PreviousProcessorState = (UDIUInt32) UDIRunning;
- }
- } else { /* old HIF kernel code */
- return (OldHIFGetStderr(buf, bufsize, count_done));
- } /* old kernel code */
-
- return (UDINoError);
-}
-
-UDIError
-OldHIFGetStderr(buf, bufsize, count_done)
- UDIHostMemPtr buf;
- UDISizeT bufsize;
- UDISizeT *count_done;
-/*
- * For HIF kernel version 0x04 and lower.
- */
-{
- UDIUInt32 count;
- UDIUInt32 done;
- UDIResource from;
- UDIBool host_endian;
- UDISizeT size;
- UDIError UDIretval;
- UDIUInt32 reg_val;
-
- /* Lr4_count gives the bytes to be written */
- /* Lr3_addr gives the address in the target */
- if (Lr4_count > (UDIUInt32) 0) {
- count = (Lr4_count < (UDIUInt32) bufsize) ? Lr4_count : (UDIUInt32) bufsize;
- /* read count bytes from Lr3_addr */
- from.Offset = Lr3_addr;
- from.Space = UDI29KDRAMSpace;
- size = 1;
- host_endian = FALSE;
- if ((UDIretval = UDIRead(from,
- buf,
- count,
- size,
- &done,
- host_endian)) != UDINoError) {
- return (UDIretval);
- }
- *count_done = (UDISizeT) count;
- Lr4_count = Lr4_count - count;
- Lr3_addr = Lr3_addr + count;
- TotalDone = TotalDone + (UDIUInt32) count;
- if (Lr4_count <= (UDISizeT) 0) {
- if ((UDIretval = Write_Glob_Reg(TotalDone, (int) 96)) != UDINoError)
- return (UDIretval);
- reg_val = (UDIUInt32) 0x80000000;
- if ((UDIretval = Write_Glob_Reg(reg_val, (int) 121)) != UDINoError)
- return (UDIretval);
- TotalDone = (UDIUInt32) 0;
- Lr4_count = (UDIUInt32) 0;
- } else {
- return (UDINoError);
- }
- } else {
- *count_done = (UDISizeT) 0;
- TotalDone = (UDIUInt32) 0;
- if ((UDIretval = Write_Glob_Reg(TotalDone, (int) 96)) != UDINoError)
- return (UDIretval);
- reg_val = (UDIUInt32) 0x80000000;
- if ((UDIretval = Write_Glob_Reg(reg_val, (int) 121)) != UDINoError)
- return (UDIretval);
- Lr4_count = (UDIUInt32) 0;
- };
-
- /* Resume execution UDIExecute()? */
- if (StepCmdGiven) {
- ProcessorState = UDIStepped;
- PreviousProcessorState = UDIStepped;
- StepCmdGiven = 0;
- } else {
- if (!BreaksInPlace) {
- PutAllBreakpoints();
- BreaksInPlace = 1;
- }
- UDIExecute();
- }
- return (UDINoError);
-}
-
-#ifdef MSDOS
-UDIError OldHIFPutStdin( UDIHostMemPtr buf,UDISizeT count,UDISizeT *count_done);
-#else
-UDIError OldHIFPutStdin();
-#endif
-
-UDIError
-UDIPutStdin(buf, count, count_done)
- UDIHostMemPtr buf;
- UDISizeT count;
- UDISizeT *count_done;
-{
- char *CharPtr;
- UINT32 MinCnt;
- INT32 Code;
-
- if ((tip_target_config.os_version & 0xf) > 0x6) { /* MiniMON29K 3.0 */
- if ((int) (ProcessorState & 0xFF) != (int) UDIStdinNeeded) {
- /* non-blocking mode asynchronous mode */
- /*
- if asynchronous mode, we sent a channel0 message for
- every character sent by DFE in this call.
- */
- if (PgmStdinMode & TIP_NBLOCK) {
- if ((Code = Mini_msg_recv(NONBLOCK)) != FAILURE) {
- MsgAlreadyReceived=Code;
- MsgAlreadyInBuffer = 1;
- }
- CharPtr = buf;
- if (!Channel0Busy) {
- /* send one character and return to DFE */
- Mini_build_channel0_msg(CharPtr, (INT32) 1);
- /*
- * Just send the message here, and wait for the ack later
- SEND_AND_WAIT_ACK(CHANNEL0_ACK);
- */
- if (Mini_msg_send() != SUCCESS)
- return((-1) * MONErrCantSendMsg);
-#if 0
- Channel0Busy = 1; /* never set */
-#endif
- } else {
- /* save it in channel0_buffer */
- channel0_buffer[Channel0_count] = (char) *CharPtr;
- Channel0_count=Channel0_count+1;
- }
- *count_done = (UDISizeT) 1;
- return (UDINoError);
- } else if (PgmStdinMode & TIP_ASYNC) {
- if ((Code = Mini_msg_recv(NONBLOCK)) != FAILURE) {
- MsgAlreadyReceived=Code;
- MsgAlreadyInBuffer = 1; /* check in UDIWait */
- }
- CharPtr = buf;
- *count_done = (UDISizeT) 0;
- for ( ; count > 0; count--) {
- Mini_build_channel0_msg(CharPtr, (INT32) 1);
- /*
- * Just send the message here, and wait for the ack later
- SEND_AND_WAIT_ACK(CHANNEL0_ACK);
- */
- if (Mini_msg_send() != SUCCESS)
- return((-1)*MONErrCantSendMsg);
- *count_done = (UDISizeT) (*count_done + (UDISizeT) 1);
- CharPtr++;
- }
- return (UDINoError);
- }
- } else { /* synchronous mode */
- /*
- in synchronous mode, we send all the characters received using
- stdin_needed_ack_msg, when the processorstate becomes stdinneeded.
- This is line-buffered mode. So we clear variables
- after we send.
- What do we do when DFE sends more characters than we need now?
- The count_done return value gives number accepted. But who keeps
- the rest.
- Otherwise, what do we do???????
- */
- if (PgmStdinMode & TIP_NBLOCK) {
- /* send one character and return to DFE */
- CharPtr = buf;
- if ((Code = Mini_msg_recv(NONBLOCK)) != FAILURE) {
- MsgAlreadyReceived=Code;
- MsgAlreadyInBuffer = 1;
- }
- *count_done = (UDISizeT) 1;
- Mini_build_channel0_msg(CharPtr, (INT32) 1);
- /*
- * Send the message now and wait for the ack later.
- SEND_AND_WAIT_ACK(CHANNEL0_ACK);
- */
- if (Mini_msg_send() != SUCCESS)
- return ((-1)*MONErrCantSendMsg);
- return (UDINoError);
- };
-
- MinCnt = ((UINT32) StdinCharsNeeded > (UINT32) count) ?
- (UINT32) count : (UINT32) StdinCharsNeeded;
- Mini_build_stdin_needed_ack_msg (MinCnt, buf);
- if (Mini_msg_send() != SUCCESS)
- return ((-1) * MONErrCantSendMsg);
- *count_done = (UDISizeT) MinCnt;
- StdinCharsNeeded = 0; /* reset to zero ?? */
- if (StepCmdGiven) {
- ProcessorState = UDIStepped;
- PreviousProcessorState = UDIStepped;
- StepCmdGiven = 0;
- } else {
- if (!BreaksInPlace) {
- PutAllBreakpoints();
- BreaksInPlace = 1;
- }
- ProcessorState = UDIRunning;
- PreviousProcessorState = UDIRunning;
- }
- return (UDINoError);
- }
- } else if ((tip_target_config.os_version & 0xf) > 4) { /* pre-release */
- /*
- * The HIF kernel from MiniMON29K release 2.1 expects MONTIP
- * to send a HIF_CALL_RTN response for a HIF_CALL message, and
- * a CHANNEL1_ACK response for a CHANNEL1 message, and
- * a CHANNEL2_ACK response for a CHANNEL2 message, and
- * a CHANNEL0 message for a asynchronous input.
- * The HIF kernel version numbers 0x05 and above support these
- * features.
- */
- /* Send CHANNEL0 message depending on StdinMode. */
- CharPtr = buf;
- if (PgmStdinMode == TIP_COOKED) { /* default line buffered */
- /*
- * send a line of input using channel0
- * Check for '\n' sent from DFE.
- */
- if ((int) *CharPtr == (int) 8) {/* backspace */
- Channel0_count=Channel0_count-1;
- } else if ((int) *CharPtr == (int) 127) {/* delete */
- Channel0_count=Channel0_count-1;
-#ifdef MSDOS
- } else if ((int) *CharPtr == (int) 10) {/* \n */
- /* simply return, no change. already padded. */
- *count_done = count;
- return (UDINoError);
- } else if ((int) *CharPtr == (int) 13) {/* end of line */
- channel0_buffer[Channel0_count] = (char) *CharPtr;
- Channel0_count=Channel0_count+1;
- channel0_buffer[Channel0_count] = (char) 10; /* add \n */
- Channel0_count=Channel0_count+1;
- Mini_build_channel0_msg(channel0_buffer, Channel0_count);
- SEND_AND_WAIT_ACK(CHANNEL0_ACK);
- Channel0_count = 0; /* reset */
- *count_done = count;
-#else /* MSDOS */
- } else if ((int) *CharPtr == (int) 13) {/* end of line */
- /* simply return, added on \n */
- *count_done = count;
- return (UDINoError);
- } else if ((int) *CharPtr == (int) 10) {/* \n */
- channel0_buffer[Channel0_count] = (char) 13; /* add \r */
- Channel0_count=Channel0_count+1;
- channel0_buffer[Channel0_count] = (char) *CharPtr;
- Channel0_count=Channel0_count+1;
- Mini_build_channel0_msg(channel0_buffer, Channel0_count);
- SEND_AND_WAIT_ACK(CHANNEL0_ACK);
- Channel0_count = 0; /* reset */
-#endif /* MSDOS */
- } else { /* store it in buffer here */
- channel0_buffer[Channel0_count] = (char) *CharPtr;
- Channel0_count=Channel0_count+1;
- *count_done = count;
- }
- return (UDINoError);
- } else if (PgmStdinMode == TIP_RAW) { /* for other modes of input */
- channel0_buffer[Channel0_count] = (char) *CharPtr;
- Channel0_count=Channel0_count+1;
- Mini_build_channel0_msg(channel0_buffer, Channel0_count);
- SEND_AND_WAIT_ACK(CHANNEL0_ACK);
- Channel0_count = 0; /* reset */
- *count_done = count;
- return (UDINoError);
- } else { /* for other modes of input */
- /* NOT IMPLEMENTED */
- return (UDINoError);
- }
- } else { /* old HIF kernel */
- return(OldHIFPutStdin(buf, count, count_done));
- }
-}
-
-UDIError
-OldHIFPutStdin(buf, count, count_done)
- UDIHostMemPtr buf;
- UDISizeT count;
- UDISizeT *count_done;
-{
- UDIResource to;
- UDIError retval;
- UDIBool hostendian;
- UDICount mincount,
- bytes_ret;
- UDIUInt32 reg_val;
- UDISizeT size;
-
- if ((int) (ProcessorState & 0xFF) != (int) UDIStdinNeeded) {
- *count_done = (UDISizeT) 0;
- return (UDINoError);
- };
- /* Lr4_count has count requested */
- /* Lr3_addr has the destination */
- if (Lr4_count > (UDIUInt32) 0) {
- mincount = ((UDICount) count < (UDICount) Lr4_count) ?
- (UDICount) count :
- (UDICount) Lr4_count;
- to.Space = (CPUSpace) UDI29KDRAMSpace;
- to.Offset = (CPUOffset) Lr3_addr;
- size = (UDISizeT) 1;
- hostendian = FALSE;
- if ((retval = UDIWrite(buf,
- to,
- mincount,
- size,
- &bytes_ret,
- hostendian)) != UDINoError) {
- return ((UDIError) retval);
- };
- Lr4_count = (UDIUInt32) 0;
- *count_done = (UDISizeT) bytes_ret;
- } else {
- Lr4_count = (UDIUInt32) 0;
- *count_done = (UDISizeT) 0;
- };
-
- /*
- * ASSUMPTION: It's always a non-blocking read & this function is called
- * only when app. needs data. So, write the number of bytes read to gr96 on
- * the target.
- */
- /* Write gr96 set above */
- /* gr96 */
- reg_val = (UDIUInt32) * count_done; /* same as mincount */
- if ((retval = Write_Glob_Reg(reg_val, (int) 96)) != UDINoError)
- return (retval);
-
- /* Write Gr121 */
- reg_val = (UDIUInt32) 0x80000000;
- if ((retval = Write_Glob_Reg(reg_val, (int) 121)) != UDINoError)
- return (retval);
-
- if (StopFlag) {
- STOP_SIG_HDLR
- ProcessorState = (UDIUInt32) UDIStopped;
- PreviousProcessorState = (UDIUInt32) UDIStopped;
- return (UDINoError);
- };
- /* Resume execution UDIExecute()? */
- if (StepCmdGiven) {
- ProcessorState = UDIStepped;
- PreviousProcessorState = UDIStepped;
- StepCmdGiven = 0;
- } else {
- if (!BreaksInPlace) {
- PutAllBreakpoints();
- BreaksInPlace = 1;
- }
- UDIExecute();
- }
-
- return (UDINoError);
-}
-
-UDIError
-UDIStdinMode(mode)
- UDIMode *mode;
-{
- *mode = (UDIMode) (PgmStdinMode);
- /* restore ProcessorState from saved value in PreviousState */
- ProcessorState = PreviousProcessorState;
- return (UDINoError);
-}
-
-UDIError
-UDIPutTrans(buf, count, count_done)
- UDIHostMemPtr buf;
- UDISizeT count;
- UDISizeT *count_done;
-{
- char *tip_token;
-
- tip_token = strtok ((char *) buf, " \t,;\n\r");
- if (tip_token == NULL)
- return ((-1) * MONErrUnknownTIPCmd);
-
- if (strcmp (tip_token, "tip") == 0) {
- tip_token = strtok ((char *) 0, " \t,;\n\r");
- if (tip_token == NULL)
- return ((-1) * MONErrUnknownTIPCmd);
- else {
- if (strcmp(tip_token, "lpt=1") == 0) {
-#ifdef MSDOS
- set_lpt();
-#endif
- use_parport = 1;
- } else if (strcmp(tip_token, "lpt=0") == 0) {
-#ifdef MSDOS
- unset_lpt();
-#endif
- use_parport = 0;
- } else
- return ((-1) * MONErrUnknownTIPCmd);
- }
- return (UDINoError);
- } else {
- return ((-1) * MONErrUnknownTIPCmd);
- }
-
-}
-
-UDIError
-UDIGetTrans(buf, bufsize, count)
- UDIHostMemPtr buf;
- UDISizeT bufsize;
- UDISizeT *count;
-{
- CLEAR_PENDING_STOP
- return (UDIErrorUnsupportedService);
-}
-
-UDIError
-UDITransMode(mode)
- UDIMode *mode;
-{
- CLEAR_PENDING_STOP
- return (UDIErrorUnsupportedService);
-}
-
-/* Map Space conversion functions */
-
-static INT32
-SpaceMap_udi2mm(space)
- CPUSpace space;
-{
- switch (space) {
- case UDI29KDRAMSpace:
- return ((INT32) D_MEM);
- case UDI29KIOSpace:
- return ((INT32) I_O);
- case UDI29KCPSpace0:
- return ((INT32) SPECIAL_REG);
- case UDI29KCPSpace1:
- return ((INT32) SPECIAL_REG);
- case UDI29KIROMSpace:
- return ((INT32) I_ROM);
- case UDI29KIRAMSpace:
- return ((INT32) I_MEM);
- case UDI29KLocalRegs:
- return ((INT32) LOCAL_REG);
- case UDI29KGlobalRegs:
- return ((INT32) GLOBAL_REG);
- case UDI29KRealRegs:
- return ((INT32) GLOBAL_REG);
- case UDI29KSpecialRegs:
- return ((INT32) SPECIAL_REG);
- case UDI29KTLBRegs:
- return ((INT32) TLB_REG);
- case UDI29KACCRegs:
- return ((INT32) SPECIAL_REG);
- case UDI29KICacheSpace:
- return ((INT32) I_CACHE);
- case UDI29KAm29027Regs:
- return ((INT32) COPROC_REG);
- case UDI29KPC:
- return ((INT32) PC_SPACE);
- case UDI29KDCacheSpace:
- return ((INT32) D_CACHE);
- case VERSION_SPACE:
- return ((INT32) VERSION_SPACE);
- default:
- return (FAILURE);
- };
-}
-
-static CPUSpace
-SpaceMap_mm2udi(space)
- INT32 space;
-{
- switch (space) {
- case LOCAL_REG:
- return ((CPUSpace) UDI29KLocalRegs);
- case ABSOLUTE_REG:
- return ((CPUSpace) UDI29KGlobalRegs);
- case GLOBAL_REG:
- return ((CPUSpace) UDI29KGlobalRegs);
- case SPECIAL_REG:
- return ((CPUSpace) UDI29KSpecialRegs);
- case TLB_REG:
- return ((CPUSpace) UDI29KTLBRegs);
- case COPROC_REG:
- return ((CPUSpace) UDI29KAm29027Regs);
- case I_MEM:
- return ((CPUSpace) UDI29KIRAMSpace);
- case D_MEM:
- return ((CPUSpace) UDI29KDRAMSpace);
- case I_ROM:
- return ((CPUSpace) UDI29KIROMSpace);
- case D_ROM:
- return ((CPUSpace) UDI29KIROMSpace);
- case I_O:
- return ((CPUSpace) UDI29KIOSpace);
- case I_CACHE:
- return ((CPUSpace) UDI29KICacheSpace);
- case D_CACHE:
- return ((CPUSpace) UDI29KDCacheSpace);
- case PC_SPACE:
- return ((CPUSpace) UDI29KPC);
- case A_SPCL_REG:
- return ((CPUSpace) UDI29KSpecialRegs);
- default:
- return (FAILURE);
- }
-}
-
-/* Miscellaneous UDI support functions */
-
-static int
-Reset_Processor()
-{
- INT32 MsgCode;
- BreakIdType i;
-
- CLEAR_PENDING_STOP
-
- Mini_build_reset_msg();
- if (Mini_msg_send() != SUCCESS)
- return ((-1) * MONErrCantSendMsg);
-
- MsgCode = Wait_For_Ack();
- if (MsgCode == ABORT_FAILURE)
- return (UDIErrorAborted);
- else if (MsgCode == FAILURE)
- return ((-1) * MONErrNoSynch);
-
- RefreshRegs = 1;
- /* Clear all breakpoints */
- BreaksInPlace = 0;
- for (i = 1; i < LastBreakId; i++)
- remove_from_bp_table(i);
-
- return (SUCCESS);
-}
-
-static int
-parse_string(string)
- char *string;
-{
- char *s;
-
- if ((string == NULL) || (strcmp(string,"") == 0))
- return ((-1) * MONErrNullConfigString);
-
- (void) strcpy (&ConnectString[0], string); /* to preserve the original */
-
- s = strtok(ConnectString, " ");
-
- while (s != NULL) {
- if ((s[0] == '-') && (s[1] != '\0') && (s[2] == '\0')) { /* single letter options */
- switch (s[1]) {
- case 'S': /* -Supervisor Mode */
- SupervisorMode = 1; /* always in real mode */
- RealMode = 1;
- ProtectedMode = 0;
- VirtualMode = 0;
- s = strtok(NULL, " "); /* get next string */
- break;
- case 'R': /* -Real Mode */
- RealMode = 1;
- ProtectedMode = 0;
- VirtualMode = 0;
- s = strtok(NULL, " "); /* get next string */
- break;
- case 'P': /* _Protected mode */
- SupervisorMode = 0; /* SM mode not supported */
- RealMode = 0;
- VirtualMode = 0;
- ProtectedMode = 1;
- s = strtok(NULL, " "); /* get next string */
- break;
- case 'V': /* -Virtual mode */
- SupervisorMode = 0; /* SM mode not supported */
- RealMode = 0;
- ProtectedMode = 0;
- VirtualMode = 1;
- s = strtok(NULL, " "); /* get next string */
- break;
- case 'r': /* core file */
- s = strtok(NULL, " ");
- if (s == NULL) { /* error */
- return (UDIErrorInvalidTIPOption); /* UNKNOWN */
- } else {
- if ((CoreFile = (char *) malloc(strlen(s) + 1)) == NULL) {
- return ((-1) * MONErrOutofMemory); /* EMALLOC ? */
- };
- (void) strcpy(CoreFile, s);
- };
- s = strtok(NULL, " "); /* get next string */
- break;
- case 't': /* target type */
- s = strtok(NULL, " ");
- if (s == NULL) { /* error */
- return (UDIErrorInvalidTIPOption); /* UNKNOWN */
- } else {
- if ((TargetType = (char *) malloc(strlen(s) + 1))
- == NULL) {
- return ((-1) * MONErrOutofMemory); /* EMALLOC ? */
- };
- (void) strcpy(TargetType, s);
- };
- s = strtok(NULL, " "); /* get next string */
- break;
- case 'm': /* message log file */
- s = strtok(NULL, " ");
- if (s == NULL) { /* error */
- return (UDIErrorInvalidTIPOption); /* UNKNOWN */
- } else {
- if ((Msg_Logfile = (char *) malloc(strlen(s) + 1)) == NULL) {
- return ((-1) * MONErrOutofMemory); /* EMALLOC ? */
- };
- (void) strcpy(Msg_Logfile, s);
- };
- s = strtok(NULL, " "); /* get next string */
- break;
- default: /* unknown */
- return (UDIErrorInvalidTIPOption); /* UNKNOWN */
- }; /* end switch */
- } else { /* multiple letter options */
- if (strcmp(s, "-com") == 0) {
- s = strtok(NULL, " ");
- if (s == NULL) {
- return (UDIErrorInvalidTIPOption);
- } else {
- (void) strcpy(tip_config.comm_port, s);
- };
- s = strtok(NULL, " "); /* get next string */
- } else if (strcmp(s, "-af") == 0) {
- SendACKFirst = 1;
- s = strtok(NULL, " "); /* get next string */
- } else if (strcmp(s, "-par") == 0) {
- s = strtok(NULL, " ");
- if (s == NULL) {
- return (UDIErrorInvalidTIPOption);
- } else {
- (void) strcpy(tip_config.par_port, s);
- lpt_initialize = 1;
- };
- s = strtok(NULL, " "); /* get next string */
- } else if (strcmp(s, "-le") == 0) { /* little endian target */
- tip_target_config.P29KEndian = LITTLE;
- s = strtok(NULL, " "); /* get next string */
- } else if (strcmp(s, "-re") == 0) {
- s = strtok(NULL, " ");
- if (s == NULL) { /* error */
- return (UDIErrorInvalidTIPOption); /* UNKNOWN */
- } else {
- if (sscanf(s, "%d", &MessageRetries) != 1)
- return (UDIErrorInvalidTIPOption);
- };
- s = strtok(NULL, " "); /* get next string */
- } else if (strcmp(s, "-na") == 0) { /* no need to ack channel1 msg */
- NoChan1Ack = 1;
- s = strtok(NULL, " "); /* get next string */
- } else if (strcmp(s, "-nt") == 0) {
- NoStepReqd = 1;
- s = strtok(NULL, " "); /* get next string */
- } else if (strcmp(s, "-mbuf") == 0) {
- s = strtok(NULL, " ");
- if (s == NULL) { /* error */
- return (UDIErrorInvalidTIPOption); /* UNKNOWN */
- } else {
- if (sscanf(s, "%d", &MaxMsgBufSize) != 1)
- return (UDIErrorInvalidTIPOption);
- };
- s = strtok(NULL, " "); /* get next string */
- } else if (strcmp(s, "-del") == 0) {
- s = strtok(NULL, " ");
- if (s == NULL) { /* error */
- return (UDIErrorInvalidTIPOption); /* UNKNOWN */
- } else {
- if (sscanf(s, "%d", &DelayFactor) != 1)
- return (UDIErrorInvalidTIPOption);
- };
- s = strtok(NULL, " "); /* get next string */
- } else if (strcmp(s, "-bl") == 0) {
- s = strtok(NULL, " ");
- if (s == NULL) { /* error */
- return (UDIErrorInvalidTIPOption); /* UNKNOWN */
- } else {
- if (sscanf(s, "%d", &BlockCount) != 1)
- return (UDIErrorInvalidTIPOption);
- };
- s = strtok(NULL, " "); /* get next string */
- } else if (strcmp(s, "-to") == 0) {
- s = strtok(NULL, " ");
- if (s == NULL) { /* error */
- return (UDIErrorInvalidTIPOption); /* UNKNOWN */
- } else {
- if (sscanf(s, "%ld", &TimeOut) != 1)
- return (UDIErrorInvalidTIPOption);
- };
- s = strtok(NULL, " "); /* get next string */
- } else if (strcmp(s, "-seg") == 0) {
- s = strtok(NULL, " ");
- if (s == NULL) { /* error */
- return (UDIErrorInvalidTIPOption); /* UNKNOWN */
- } else {
- if (sscanf(s, "%lx", &tip_config.PC_mem_seg) != 1)
- return (UDIErrorInvalidTIPOption);
- };
- s = strtok(NULL, " "); /* get next string */
- } else if (strcmp(s, "-nblock") == 0) { /* specify NBLOCK Stdin Mode */
- PgmStdinMode = TIP_NBLOCK;
- s = strtok(NULL, " "); /* get next string */
- } else if (strcmp(s, "-port") == 0) {
- s = strtok(NULL, " ");
- if (s == NULL) { /* error */
- return (UDIErrorInvalidTIPOption); /* UNKNOWN */
- } else {
- if (sscanf(s, "%lx", &tip_config.PC_port_base) != 1)
- return (UDIErrorInvalidTIPOption);
- };
- s = strtok(NULL, " "); /* get next string */
- } else if (strcmp(s, "-baud") == 0) {
- s = strtok(NULL, " ");
- if (s == NULL) { /* error */
- return (UDIErrorInvalidTIPOption); /* UNKNOWN */
- } else {
- (void) strcpy(tip_config.baud_rate, s);
- };
- s = strtok(NULL, " "); /* get next string */
- } else /* unknown option */
- return (UDIErrorInvalidTIPOption); /* UNKNOWN */
- }
- }; /* end while */
- return ((int) 0); /* SUCCESS */
-}
-
-static int
-write_args(argstring, argstart, datahigh)
- char *argstring;
- ADDR32 argstart;
- ADDR32 *datahigh;
-{
- char *argvstring[25];
- int i;
- char *s;
-
- i = 0;
- if (argstring == NULL) {
- s = strtok(argstring, " \t\n\r");
- argvstring[i] = s;
- } else {
- (void) strcpy (&TempArgString[0], argstring);
- s = strtok (&TempArgString[0], " \t\n\r");
- argvstring[i] = s;
- if (s != NULL) {
- while ((s = strtok((char *) 0, " \t\n\r"))) {
- i++;
- argvstring[i] = s;
- (void) strcpy(argvstring[i], s);
- };
- /* add the final NULL */ /* i is the argc count */
- argvstring[++i] = NULL;
- }
- }
- return (write_argv(i, argvstring, argstart, datahigh));
-}
-
-static int
-write_argv(arg_count, arg_ptr, argstart, hi_data)
- int arg_count;
- char *arg_ptr[];
-ADDR32 argstart;
-ADDR32 *hi_data;
-
-{
-
- int i;
-
- UDIError retval;
- UDIResource to;
- UDIBool hostendian;
- UDICount count,
- bytes_ret;
- UDISizeT size;
- UDIUInt32 dataend; /* start address for heap */
- UDIUInt32 tmp_dataend; /* start address for heap */
-
- /*
- * * Write args to target
- */
-
- /* Set init.data_end to start of arg string space */
- /* (saving room for the array of pointers) */
- dataend = argstart + (arg_count + 1) * sizeof(CPUOffset);
-
- for (i = 0; i < arg_count; i = i + 1) {
-
- /* Write arg_ptr[i] pointer (Am29000 address) to target */
- tmp_dataend = dataend;
- /* We might have to change the endian of the address */
- if (tip_target_config.P29KEndian != tip_target_config.TipEndian) {
- tip_convert32((BYTE *) &(tmp_dataend));
- }
- to.Offset = argstart + (i * sizeof(CPUOffset));
- to.Space = UDI29KDRAMSpace;
- count = (UDICount) 1;
- size = (UDISizeT) sizeof(CPUOffset);
- hostendian = FALSE; /* ???? */
- if ((retval = UDIWrite((UDIHostMemPtr) &tmp_dataend,
- to,
- count,
- size,
- &bytes_ret,
- hostendian)) != UDINoError) {
- return (retval);
- };
- /* Continue if SUCCESSful */
- /* Write arg_ptr[i] to target */
- to.Offset = dataend;
- to.Space = UDI29KDRAMSpace;
- count = (UDICount) strlen(arg_ptr[i]) + 1;
- size = (UDISizeT) 1;
- hostendian = FALSE;
- if ((retval = UDIWrite(arg_ptr[i],
- to,
- count,
- size,
- &bytes_ret,
- hostendian)) != UDINoError) {
- return (retval);
- };
-
- dataend = dataend + strlen(arg_ptr[i]) + 1;
-
- } /* end for loop */
-
- /* return dataend */
- *hi_data = dataend;
- /* Write NULL pointer at end of argv array */
- to.Offset = argstart + arg_count * sizeof(CPUOffset);
- to.Space = UDI29KDRAMSpace;
- count = (UDICount) sizeof(CPUOffset);
- size = (UDISizeT) 1;
- hostendian = FALSE;
-
- if ((retval = UDIWrite("\0\0\0",
- to,
- count,
- size,
- &bytes_ret,
- hostendian)) != UDINoError) {
- return (retval);
- };
- return (UDINoError);
-}
-
-void
-set_stdin_needed(hif_lr3, hif_lr4)
- ADDR32 hif_lr3;
- UDICount hif_lr4;
-{
- Lr3_addr = (CPUOffset) hif_lr3;
- Lr4_count = (UDIUInt32) hif_lr4;
- ProcessorState = (UDIUInt32) UDIStdinNeeded;
- PreviousProcessorState = (UDIUInt32) UDIStdinNeeded;
-}
-
-void
-set_stdout_ready(hif_lr3, hif_lr4)
- ADDR32 hif_lr3;
- UDICount hif_lr4;
-{
- Lr3_addr = (CPUOffset) hif_lr3;
- Lr4_count = (UDIUInt32) hif_lr4;
- ProcessorState = (UDIUInt32) UDIStdoutReady;
- PreviousProcessorState = (UDIUInt32) UDIStdoutReady;
-}
-
-void
-set_stderr_ready(hif_lr3, hif_lr4)
- ADDR32 hif_lr3;
- UDICount hif_lr4;
-{
- Lr3_addr = (CPUOffset) hif_lr3;
- Lr4_count = (UDIUInt32) hif_lr4;
- ProcessorState = (UDIUInt32) UDIStderrReady;
- PreviousProcessorState = (UDIUInt32) UDIStderrReady;
-}
-
-static INT32
-Wait_For_Ack( /* retries */ )
-{
- INT32 code;
- UINT32 count;
-
- count=(UINT32) 1;
-
- code = FAILURE;
- while ((code == FAILURE) && (count < TimeOut)) {
- code = Mini_msg_recv(BLOCK);
- count = count + 10;
- /* Check for user interrupt */
- SIGINT_POLL
- if (StopFlag) {
- STOP_SIG_HDLR
- ProcessorState = (UDIUInt32) UDIStopped;
- PreviousProcessorState = (UDIUInt32) UDIStopped;
- return (ABORT_FAILURE);
- };
- };
- return (code);
-}
-
-static INT32
-CheckForMsg(time)
- INT32 time;
-{
- INT32 i;
- INT32 Code;
- int ForEver;
-
-
- ForEver = 0;
- if (time == (UDIInt32) UDIWaitForever)
- ForEver = 1;
- else
- if (RemoteTarget == 1) /* remote targets */
-#ifdef MSDOS
- time = time*100;
-#else
- time = time;
-#endif
-
- i = 0;
- while ((i <= time) || ForEver) {
- /* Check for user interrupt */
- SIGINT_POLL
- if (StopFlag) {
- STOP_SIG_HDLR
- ProcessorState = (UDIUInt32) UDIStopped;
- PreviousProcessorState = (UDIUInt32) UDIStopped;
- return (ABORT_FAILURE);
- };
- if ((Code = Mini_msg_recv(NONBLOCK)) != FAILURE)
- return (Code);
- i = i + 1;
- }
- return (FAILURE);
-}
-
-static void
-process_target_msg(msgcode)
- INT32 msgcode;
-{
- switch (msgcode) {
- case HALT:
- if (BreaksInPlace)
- ResetAllBreakpoints();
- BreaksInPlace = 0;
- process_HALT_msg();
- break;
- case CHANNEL1:
- process_CHAN1_msg();
- break;
- case CHANNEL2:
- process_CHAN2_msg();
- break;
- case CHANNEL0_ACK:
- (void) process_chan0_ack();
- break;
- case HIF_CALL:
- (void) process_HIF_msg();
- break;
- case STDIN_NEEDED_REQ:
- (void) process_stdin_needed_req();
- break;
- case STDIN_MODE_REQ:
- (void) set_stdin_mode();
- break;
- case ERROR:
- if (BreaksInPlace)
- ResetAllBreakpoints();
- BreaksInPlace = 0;
- process_ERR_msg();
- break;
- default:
- if (BreaksInPlace)
- ResetAllBreakpoints();
- BreaksInPlace = 0;
- ProcessorState = (UDIUInt32) UDIHalted;
- PreviousProcessorState = (UDIUInt32) UDIHalted;
- fprintf(stderr, "FATAL: a unknown msg 0x%lx\n", msgcode);
- (void)print_recv_bytes();
- break;
- };
-}
-
-static INT32
-process_chan0_ack()
-{
- char nextchar;
-
- Channel0Busy = 0;
- if (Channel0_count > 0) {
- Channel0_count = Channel0_count - 1;
- nextchar = channel0_buffer[Channel0_count];
- Mini_build_channel0_msg(&nextchar, (INT32) 1);
- if (Mini_msg_send() != SUCCESS) {
- return((-1) * MONErrCantSendMsg);
- }
-#if 0
- Channel0Busy=1; /* never set */
-#endif
- }
- return (UDINoError);
-}
-
-static void
-process_HALT_msg()
-{
- INT32 mspace;
- ADDR32 pc0,
- pc1;
- INT32 trap_number;
- INT32 type;
- ADDR32 Inst;
- BreakIdType break_id;
- INT32 count;
-
-
- Mini_unpack_halt_msg(&mspace, &pc0, &pc1, &trap_number);
- if (trap_number == (INT32) 0) {
- if ((break_id = (BreakIdType) is_breakpt_at(mspace, pc1))
- > (BreakIdType) 0) {
- ProcessorState = (UDIUInt32) UDIBreak;
- PreviousProcessorState = (UDIUInt32) UDIBreak;
- if ((get_from_bp_table(break_id, &mspace, &pc1,
- &count, &type, &Inst) == 0) &&
- (count < (INT32) 0))
- remove_from_bp_table(break_id);
- } else
- ProcessorState = (UDIUInt32) UDITrapped;
- PreviousProcessorState = (UDIUInt32) UDITrapped;
- } else if (trap_number == 15) { /* Trace */
- ProcessorState = (UDIUInt32) UDIStepped;
- PreviousProcessorState = (UDIUInt32) UDIStepped;
- StepCmdGiven = 0; /* step complete */
- } else if (trap_number == 75) {
- ProcessorState = (UDIUInt32) UDIBreak;
- PreviousProcessorState = (UDIUInt32) UDIBreak;
- } else if (trap_number & 0x1000) { /* HIF specific reason */
- if ((trap_number & 0xffff) == 0x1000) { /* HIF exit */
- ProcessorState = (UDIUInt32) (UDIExited |
- ((trap_number & 0xffff0000)>>8));
- PreviousProcessorState = ProcessorState;
- } else { /* HIF error */
- ProcessorState = (UDIUInt32) (UDIHalted | (trap_number & 0xffff0000));
- PreviousProcessorState = ProcessorState;
- }
- } else {
- ProcessorState = (UDIUInt32) (UDITrapped | (trap_number << 8));
- PreviousProcessorState = ProcessorState;
- }
-}
-
-static void
-set_stdin_mode()
-{
- INT32 mode;
-
- Mini_unpack_stdin_mode_msg(&mode);
- Mini_build_stdin_mode_ack_msg(PgmStdinMode);
- PgmStdinMode = mode;
- PreviousProcessorState = ProcessorState; /* save current state */
- ProcessorState = (UDIUInt32) (UDIStdinModeX);
- if (Mini_msg_send() != SUCCESS) {
- ProcessorState = (UDIUInt32) UDIHalted;
- }
- return;
-}
-
-static void
-process_stdin_needed_req()
-{
- Mini_unpack_stdin_needed_msg(&StdinCharsNeeded);
- /* upper 24 bits gives number needed */
- ProcessorState = (UDIUInt32) (UDIStdinNeeded | (StdinCharsNeeded << 8));
- PreviousProcessorState = ProcessorState;
-}
-
-static void
-process_CHAN1_msg()
-{
- INT32 count;
-
- Mini_unpack_channel1_msg((BYTE *) channel1_buffer, &count);
- Channel1_count = (UDISizeT) count;
- /* upper 24 bits gives number to output */
- ProcessorState = (UDIUInt32) (UDIStdoutReady | (Channel1_count << 8));
- PreviousProcessorState = ProcessorState;
-}
-
-static void
-process_CHAN2_msg()
-{
- INT32 count;
-
- Mini_unpack_channel2_msg((BYTE *) channel2_buffer, &count);
- Channel2_count = (UDISizeT) count;
- /* upper 24 bits gives number to output */
- ProcessorState = (UDIUInt32) (UDIStderrReady | (Channel2_count << 8));
- PreviousProcessorState = ProcessorState;
-}
-
-static void
-process_HIF_msg()
-{
- INT32 svc_nm,
- lr2,
- lr3,
- lr4,
- gr96,
- gr97,
- gr121;
- int retval;
- INT32 MsgCode;
-
- Mini_unpack_hif_msg(&svc_nm, &lr2, &lr3, &lr4);
- if ((svc_nm == (INT32) HIF_read) && (lr2 == (INT32) 0)) { /* stdin */
- set_stdin_needed(lr3, lr4);
- return;
- } else if ((svc_nm == (INT32) HIF_write) && (lr2 == (INT32) 2)) { /* stderr */
- set_stderr_ready(lr3, lr4);
- return;
- } else {
- retval = service_HIF(svc_nm, lr2, lr3, lr4, &gr96, &gr97, &gr121);
- if (retval == (INT32) -1) { /* service failed */
- ProcessorState = (UDIUInt32) UDIHalted;
- PreviousProcessorState = ProcessorState;
- return;
- } ;
- if (svc_nm == HIF_exit) {
- if (BreaksInPlace) { /* For EB29K */
- BreaksInPlace = 0;
- ResetAllBreakpoints();
- };
- if ((tip_target_config.os_version & 0xf) > 4) { /* new HIF kernel */
- if ((tip_target_config.os_version & 0xf) > 0x6) { /* send hif rtn */
- Mini_build_hif_rtn_msg(svc_nm, gr121, gr96, gr97);
- if (Mini_msg_send() != SUCCESS) {
- ProcessorState = (UDIUInt32) UDIHalted;
- PreviousProcessorState = ProcessorState;
- return;
- }
- MsgCode = Wait_For_Ack(); /* debug core sends a HALT msg */
- if (MsgCode == ABORT_FAILURE) {
- ProcessorState = (UDIUInt32) UDIHalted;
- PreviousProcessorState = ProcessorState;
- } else if (MsgCode == FAILURE) {
- ProcessorState = (UDIUInt32) UDIHalted;
- PreviousProcessorState = ProcessorState;
- } else {
- ProcessorState = (UDIUInt32) (UDIExited | (lr2 << 8));
- PreviousProcessorState = ProcessorState;
- }
- return;
- } else {
- ProcessorState = (UDIUInt32) (UDIExited | (lr2 << 8));
- PreviousProcessorState = ProcessorState;
- return;
- }
- } else { /* old HIF kernel */
- exitstat = (int) lr2;
- if (Write_Glob_Reg(gr121, (int) 121) != UDINoError) {
- ProcessorState = (UDIUInt32) UDIHalted;
- PreviousProcessorState = ProcessorState;
- return;
- }
- ProcessorState = (UDIUInt32) (UDIExited | (exitstat << 8));
- PreviousProcessorState = ProcessorState;
- return;
- }
- } else { /* not a HIF exit */
- if ((tip_target_config.os_version & 0xf) > 4) { /* new HIF kernel */
- Mini_build_hif_rtn_msg(svc_nm, gr121, gr96, gr97);
- if (Mini_msg_send() != SUCCESS) {
- ProcessorState = (UDIUInt32) UDIHalted;
- PreviousProcessorState = ProcessorState;
- return;
- }
- ProcessorState = (UDIUInt32) UDIRunning;
- PreviousProcessorState = ProcessorState;
- return;
- } else { /* old HIF kernel */
- if (Write_Glob_Reg(gr96, (int) 96) != UDINoError) {
- ProcessorState = (UDIUInt32) UDIHalted;
- PreviousProcessorState = ProcessorState;
- }
- if (svc_nm == (INT32) HIF_gettz) {
- if (Write_Glob_Reg(gr97, (int) 97) != UDINoError) {
- ProcessorState = (UDIUInt32) UDIHalted;
- PreviousProcessorState = ProcessorState;
- }
- }
- if (Write_Glob_Reg(gr121, (int) 121) != UDINoError) {
- ProcessorState = (UDIUInt32) UDIHalted;
- PreviousProcessorState = ProcessorState;
- }
- /* UDIExecute()? */
- if (StepCmdGiven) {
- ProcessorState = UDIStepped;
- PreviousProcessorState = ProcessorState;
- } else {
- if (!BreaksInPlace) {
- PutAllBreakpoints();
- BreaksInPlace = 1;
- }
- UDIExecute();
- }
- };
- return;
- }
- }
-}
-
-static void
-process_ERR_msg()
-{
- ProcessorState = (UDIUInt32) UDIStopped;
- PreviousProcessorState = ProcessorState;
-}
-
-static int
-Write_Glob_Reg(RegVal, RegNum)
- INT32 RegVal;
- int RegNum;
-{
- UDIResource to;
- UDISizeT size;
- UDICount mincount;
- UDIBool hostendian;
- UDICount bytes_ret;
- UDIError retval;
-
- to.Space = (CPUSpace) UDI29KGlobalRegs;
- to.Offset = (CPUOffset) RegNum;
- size = (UDISizeT) 4;
- mincount = (UDICount) 1;
- hostendian = FALSE;
- if (tip_target_config.TipEndian != tip_target_config.P29KEndian) {
- tip_convert32((BYTE *) &RegVal);
- }
- if ((retval = UDIWrite((UDIHostMemPtr) &RegVal,
- to,
- mincount,
- size,
- &bytes_ret,
- hostendian)) != UDINoError) {
- return ((UDIError) retval);
- };
- return (UDINoError);
-}
-
-static int
-PutAllBreakpoints()
-{
- UDIResource addr;
- UDIError UDIretval;
- UDICount count_done;
- BreakIdType break_id;
- ADDR32 offset;
- INT32 space;
- INT32 pcount;
- INT32 type;
- ADDR32 Inst;
- UDIUInt32 IllOp;
-
- if (strcmp (TargetType, "eb29k") == 0) { /* if EB29K */
- for (break_id = 1; break_id < LastBreakId; break_id++) {
- if (get_from_bp_table(break_id, &space, &offset,
- &pcount, &type, &Inst) == 0) {
- addr.Offset = offset;
- addr.Space = SpaceMap_mm2udi(space);
- /* Read Instruction into Breaktable */
- if (!strcmp(TargetType, "eb29k")) {
- if ((UDIretval = UDIRead(addr,
- (UDIHostMemPtr) &Inst,
- (UDICount) 1,
- (UDISizeT) 4,
- (UDICount *) &count_done,
- (UDIBool) FALSE)) != UDINoError) /* 29K endian */
- return (UDIretval);
- };
- (void) update_breakpt_at(space, offset, Inst);
- /* UDIWrite(Illop); write illegal opcode instruction */
- IllOp = (UDIUInt32) 0x00ccbbaa; /* Illegal opcode */
- if ((UDIretval = UDIWrite((UDIHostMemPtr) &IllOp,
- addr,
- (UDICount) 1,
- (UDISizeT) 4,
- &count_done,
- TRUE)) != UDINoError)
- return (UDIretval);
- }
- }
- }
- return (0);
-}
-
-static int
-ResetAllBreakpoints()
-{
- UDIResource addr;
- UDIError UDIretval;
- UDICount count_done;
- BreakIdType break_id;
- ADDR32 offset;
- INT32 space;
- INT32 pcount;
- INT32 type;
- ADDR32 Inst;
-
- if (strcmp (TargetType, "eb29k") == 0) { /* if EB29K */
- for (break_id = 1; break_id < LastBreakId; break_id++) {
- if (get_from_bp_table(break_id, &space, &offset,
- &pcount, &type, &Inst) == 0) {
- /* UDIWrite(); write original instruction */
- addr.Offset = offset;
- addr.Space = SpaceMap_mm2udi(space);
- if ((UDIretval = UDIWrite((UDIHostMemPtr) &Inst,
- addr,
- (UDICount) 1,
- (UDISizeT) 4,
- &count_done,
- FALSE)) != UDINoError)
- return (UDIretval);
- }
- }
- }
- return (0);
-}
-
-void
-TIPPrintUsage(s)
- char *s;
-{
- fprintf(stderr, "Minimon (UDI 1.2) TIP Version: %s Date: %s\n", TIPVERSION, TIPDATE);
- fprintf(stderr, "List of Valid MONTIP options are:\n");
- fprintf(stderr, "-t <target_if_type> - the target interface type MUST be specified\n");
- fprintf(stderr, "[-r <Minimon_OS_linked_object>] - ROM file to be downloaded, if any\n");
- fprintf(stderr, "[-m <msg_log_filename>] - file to log messages between TIP and target\n");
- fprintf(stderr, "[-com <serial_comm_port>] -communication port to use, ex: -com com1:\n");
- fprintf(stderr, "[-par <paralle_port>] -parallel port for download , ex: -par lpt1:\n");
- fprintf(stderr, "[-re <retries_for_a_msg>] - number of retries\n");
- fprintf(stderr, "[-le] - specifies target is little endian\n");
- fprintf(stderr, "[-mbuf <msg_bufsize_to_use>] - maximum message buffer size\n");
- fprintf(stderr, "[-bl <msg_block_loopcount>] - block count while receiving\n");
- fprintf(stderr, "[-to <timeout_loopcount>] - timeout while receiving\n");
- fprintf(stderr, "[-seg <PC_mem_seg_addr_in_hex>] - PC memory segment base address, ex: -seg D800\n");
- fprintf(stderr, "[-port <PC_port_base_addr_in_hex>] - PC i/o port base address, ex: -port 2A0\n");
- fprintf(stderr, "[-baud <baudrate>] - baud rate for serial communications, ex: -baud 38400\n");
- fprintf(stderr, "[-R/P] - physical or protected mode (ONLY with OSBOOT supplied)\n");
- fprintf(stderr, "[-S] - run in supervisor mode (ONLY with OSBOOT supplied)\n");
- exit(1);
-}
-
-static INT32
-SendConfigWait()
-{
- INT32 MsgCode;
- int count;
- unsigned long time;
-
- count = (UINT32) 0;
- MsgCode = (INT32) FAILURE;
- do {
-#ifdef MSDOS
- if (RemoteTarget == 1)
- Mini_reset_comm(); /* reset communications channel */
-#endif
- Mini_build_config_req_msg();
- if (Mini_msg_send() != SUCCESS) {
- return ((-1) * MONErrCantSendMsg);
- }
- count = count + 1;
- time = (unsigned long) 1;
- do {
- time = time + 10;
- MsgCode = Mini_msg_recv(BLOCK);
- SIGINT_POLL
- if (Interrupted) {
- Interrupted = 0;
- return ((INT32) ABORT_FAILURE);
- }
-#ifndef MSDOS
- if ((MsgCode == FAILURE) &&
- (RemoteTarget == 1))
- Mini_reset_comm(); /* reset communications channel */
-#endif
- } while ((MsgCode == FAILURE) && (time < TimeOut));
- } while ((MsgCode == FAILURE) && (count < MessageRetries));
- return (MsgCode);
-}
-
-static char *
-GetTargetType( Target, FromString)
-char *Target;
-char *FromString;
-{
- char *s;
-
- if (FromString == NULL)
- return (NULL);
-
- (void) strcpy (&ConnectString[0], FromString); /* to preserve the original */
- s = strtok(ConnectString, " ");
- while (s != NULL) {
- if ((s[0] == '-') && (s[1] == 't') && (s[2] == '\0')) { /* -t option */
- s = strtok (NULL, " "); /* continue search */
- if (s == NULL)
- return (NULL);
- else {
- Target = s;
- return (s);
- }
- };
- s = strtok (NULL, " "); /* continue search */
- }; /* while */
- return (NULL);
-}
-
-
-static INT32
-Mini_load_coff(filename, mspace, sym, Section, quietmode)
- char *filename;
- int quietmode;
- INT32 sym;
- INT32 Section;
- INT32 mspace;
- {
- unsigned short COFF_sections;
- INT32 flags;
- INT32 memory_space;
- INT32 address;
- INT32 byte_count;
- INT32 write_count;
- INT32 temp_byte_count;
-
- struct filehdr COFF_header;
- struct aouthdr COFF_aout_header;
- struct scnhdr COFF_section_header;
-
- /* Open the COFF input file (if we can) */
- if ((coff_in = FindFile(filename)) == NULL)
- return ((-1) * MONErrCantOpenCoff);
-
- /* Read in COFF header information */
- if (fread((char *)&COFF_header, sizeof(struct filehdr), 1, coff_in) != 1) {
- fclose(coff_in); return ((-1) * MONErrCantLoadROMfile);
- };
-
-
- /* Is it an Am29000 COFF File? */
- if ((COFF_header.f_magic != 0x17a) && (COFF_header.f_magic != 0x7a01) &&
- (COFF_header.f_magic != 0x17b) && (COFF_header.f_magic != 0x7b01)) {
- fclose(coff_in); return ((-1) * MONErrCantLoadROMfile);
- }
-
- /* Get number of COFF sections */
- if ((COFF_header.f_magic != 0x17a) && (COFF_header.f_magic != 0x017b))
- tip_convert16((BYTE *) &COFF_header.f_nscns);
- COFF_sections = (unsigned short) COFF_header.f_nscns;
-
- /* Read in COFF a.out header information (if we can) */
- if (COFF_header.f_opthdr > 0) {
- if (fread((char *)&COFF_aout_header, sizeof(struct aouthdr),
- 1, coff_in) != 1) {
- fclose(coff_in); return ((-1) * MONErrCantLoadROMfile);
- };
- if ((COFF_header.f_magic != 0x17a) && (COFF_header.f_magic != 0x017b)) {
- tip_convert16((BYTE *) &COFF_header.f_opthdr);
- }
- }
-
-
- /*
- ** Process COFF section headers
- */
-
- /* Process all sections */
- while ((int) COFF_sections--) {
-
- fseek (coff_in, (long) (FILHSZ+(int)COFF_header.f_opthdr+
- SCNHSZ*(COFF_header.f_nscns-COFF_sections-1)),
- FROM_BEGINNING);
-
- if (fread(&COFF_section_header, 1, SCNHSZ, coff_in) != SCNHSZ) {
- fclose(coff_in); return ((-1) * MONErrCantLoadROMfile);
- }
-
- if ((COFF_header.f_magic != 0x17a) && (COFF_header.f_magic != 0x017b)) {
- tip_convert32((BYTE *) &(COFF_section_header.s_paddr));
- tip_convert32((BYTE *) &(COFF_section_header.s_scnptr));
- tip_convert32((BYTE *) &(COFF_section_header.s_size));
- tip_convert32((BYTE *) &(COFF_section_header.s_flags));
- }
-
- address = COFF_section_header.s_paddr;
- byte_count = COFF_section_header.s_size;
- flags = COFF_section_header.s_flags;
-
- /* Print downloading messages (if necessary) */
- if ((flags == (INT32) STYP_TEXT) || (flags == (INT32) (STYP_TEXT | STYP_ABS))) {
- memory_space = I_MEM;
- } else if ((flags == (INT32) STYP_DATA) || (flags == (INT32) (STYP_DATA | STYP_ABS)) ||
- (flags == (INT32) STYP_LIT) || (flags == (INT32) (STYP_LIT | STYP_ABS)) ||
- (flags == (INT32) STYP_BSS) || (flags == (INT32) (STYP_BSS | STYP_ABS))) {
- memory_space = D_MEM;
- } else {
- flags = (INT32) 0;
- }
-
- if ((flags == (INT32) STYP_BSS) || (flags == (INT32) (STYP_BSS | STYP_ABS))) {
- /* Clear BSS section */
- if (flags & Section) {
- (void) memset ((char *) buffer, (int) '\0', sizeof(buffer));
- while (byte_count > 0) {
- write_count = (byte_count < (INT32) sizeof(buffer)) ?
- byte_count : (INT32) sizeof (buffer);
- if(Mini_write_memory ((INT32) memory_space,
- (ADDR32) address,
- (INT32) write_count,
- (BYTE *) buffer) != SUCCESS) {
- (void) fclose(coff_in);
- return((-1) * MONErrCantWriteToMem);
- }
- address = address + write_count;
- byte_count = byte_count - write_count;
- }
- }
- } else if (flags & Section) { /* not a BSS or COmment */
- if (flags == (INT32) (flags & Section)) {
- fseek (coff_in, COFF_section_header.s_scnptr, FROM_BEGINNING);
- while (byte_count > 0) {
- temp_byte_count = MIN((INT32) byte_count, (INT32) sizeof(buffer));
- if (fread((char *) buffer, (int) temp_byte_count, 1, coff_in) != 1) {
- fclose(coff_in); return ((-1) * MONErrCantLoadROMfile);
- };
- /* Write to 29K memory*/
- if (Mini_write_memory ((INT32) memory_space,
- (ADDR32) address,
- (INT32) temp_byte_count,
- (BYTE *) buffer) != SUCCESS) {
- (void) fclose(coff_in);
- return((-1) * MONErrCantWriteToMem);
- };
- address = address + temp_byte_count;
- byte_count = byte_count - temp_byte_count;
- };
- };
- }
- } /* end while */
-
- (void) fclose(coff_in);
- return (SUCCESS);
-
- } /* end Mini_loadcoff() */
-
-/*
-** Breakpoint code
-*/
-
-static void
-add_to_bp_table(id, space, offset, count, type, inst)
-BreakIdType *id;
-INT32 space;
-ADDR32 offset;
-INT32 count;
-INT32 type;
-ADDR32 inst;
-{
- static BreakIdType current_break_id=1;
- struct tip_break_table *temp, *temp2;
-
- if (bp_table == NULL) { /* first element */
- bp_table = (struct tip_break_table *) malloc (sizeof(struct tip_break_table));
- bp_table->id = current_break_id;
- bp_table->offset = offset;
- bp_table->space = space;
- bp_table->count = count;
- bp_table->type = type;
- bp_table->BreakInst = inst;
- bp_table->next = NULL;
- } else {
- temp2 = bp_table;
- temp = (struct tip_break_table *) malloc (sizeof(struct tip_break_table));
- temp->id = current_break_id;
- temp->offset = offset;
- temp->space = space;
- temp->count = count;
- temp->type = type;
- temp->BreakInst = inst;
- temp->next = NULL;
- while (temp2->next != NULL)
- temp2 = temp2->next;
- temp2->next = temp;
- };
- *id = current_break_id;
- current_break_id++;
-}
-
-static int
-get_from_bp_table(id, space, offset, count, type, inst)
-BreakIdType id;
-INT32 *space;
-ADDR32 *offset;
-INT32 *count;
-INT32 *type;
-ADDR32 *inst;
-{
- struct tip_break_table *temp;
-
- temp = bp_table;
-
- while (temp != NULL) {
- if (temp->id == id) {
- *offset = temp->offset;
- *space = temp->space;
- *count = temp->count;
- *type = temp->type;
- *inst = temp->BreakInst;
- return(0);
- } else {
- temp = temp->next;
- };
- }
- return(-1);
-}
-
-static int
-remove_from_bp_table(id)
-BreakIdType id;
-{
- struct tip_break_table *temp, *temp2;
-
- if (bp_table == NULL)
- return (-1);
- else {
- temp = bp_table;
- if (temp->id == id) { /* head of list */
- bp_table = bp_table->next;
- (void) free (temp);
- return (0); /* success */
- } else {
- while (temp->next != NULL) {
- if (temp->next->id == id) {
- temp2 = temp->next;
- temp->next = temp->next->next;
- (void) free (temp2);
- return (0); /* success */
- } else {
- temp = temp->next;
- }
- };
- }
- };
- return (-1); /* failed */
-}
-
-static int
-update_breakpt_at(space, offset, Inst)
-INT32 space;
-ADDR32 offset;
-ADDR32 Inst;
-{
- struct tip_break_table *temp;
-
- temp = bp_table;
-
- while (temp != NULL) {
- if ((temp->space == space) && (temp->offset == offset)) {
- temp->BreakInst = Inst;
- return(0);
- } else {
- temp = temp->next;
- };
- }
- return (-1);
-}
-
-static int
-is_breakpt_at(space, offset)
-INT32 space;
-ADDR32 offset;
-{
- struct tip_break_table *temp;
-
- temp = bp_table;
-
- while (temp != NULL) {
- if ((temp->space == space) && (temp->offset == offset)) {
- return((int) temp->id); /* TRUE */
- } else {
- temp = temp->next;
- };
- }
- return(0); /* FALSE */
-}
-
-#ifdef MSDOS
-#define PATH_DELIM ";"
-#define DIR_SEP_CHAR (char) '\\'
-#define APPEND_PATH "\\lib\\"
-#else
-#define PATH_DELIM ":"
-#define DIR_SEP_CHAR (char) '/'
-#define APPEND_PATH "/lib/"
-#endif
-static FILE *
-FindFile(filename)
-char *filename;
-{
- char *path, *pathptr;
- char *trypath, *at;
- char *pathbuf;
- FILE *filep;
-
- /* is the filename given already complete? */
- if ((filep = fopen(filename, FILE_OPEN_FLAG)) != NULL) {
- return(filep);
- };
-
- /* get PATH */
- if ((pathptr = (char *) getenv ("PATH")) == NULL)
- return ((FILE *) NULL);
- if ((path = (char *) malloc ((unsigned int)strlen(pathptr)+1))==NULL)
- return ((FILE *) NULL);
- (void) strcpy(path,pathptr); /* local copy */
- /* alloc buffer */
- if ((pathbuf = (char *) malloc((unsigned int) strlen(path)+
- strlen("../lib/ ")+strlen(filename)+3)) == NULL)
- return ((FILE *) NULL);
-
- /* get first item */
- if ((trypath = strtok(path, PATH_DELIM)) == NULL) { /* one item */
- (void) strcpy(pathbuf,path);
- if ((at = strrchr (pathbuf, DIR_SEP_CHAR)) != NULL) {
- (void) strcpy (at, APPEND_PATH);
- (void) strcat (pathbuf, filename);
- if ((filep = fopen(pathbuf, FILE_OPEN_FLAG)) != NULL)
- return (filep);
- } else { /* just append filename */
- (void) strcat (pathbuf, APPEND_PATH);
- (void) strcat (pathbuf, filename);
- if ((filep = fopen(pathbuf, FILE_OPEN_FLAG)) != NULL)
- return (filep);
- };
- return ((FILE *) NULL);
- };
-
- /* try all items */
- while (trypath != NULL) {
- (void) strcpy (pathbuf, trypath);
- if ((at = strrchr (pathbuf, DIR_SEP_CHAR)) != NULL) {
- (void) strcpy (at, APPEND_PATH);
- (void) strcat (pathbuf, filename);
- if ((filep = fopen(pathbuf, FILE_OPEN_FLAG)) != NULL)
- return (filep);
- } else { /* just append filename */
- (void) strcat (pathbuf, APPEND_PATH);
- (void) strcat (pathbuf, filename);
- if ((filep = fopen(pathbuf, FILE_OPEN_FLAG)) != NULL)
- return (filep);
- };
- trypath = strtok((char *) 0, PATH_DELIM);
- }
-
- /* didn't succeed */
- return ((FILE *) NULL);
-}
-
-void
-IntHandler(num)
-int num;
-{
- Interrupted = 1;
- return;
-}
+++ /dev/null
-#
-# Makefile for utils/amd-udi/udi libraries
-# Copyright (C) 1993 Free Software Foundation
-#
-# This file is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-# $Id$
-#
-# Written by Jeffrey Wheat (cassidy@cygnus.com)
-#
-
-#### Start of system configuration section. ####
-
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-CC = @CC@
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-DEFS = @DEFS@
-LIBS = @LIBS@
-RANLIB = @RANLIB@
-
-AR = ar
-AR_FLAGS = cq
-
-CFLAGS = -g
-
-LD = ld
-LDFLAGS = -g
-
-MV = mv
-RM = rm
-
-prefix = /usr/local
-exec_prefix = $(prefix)
-
-bindir = $(exec_prefix)/bin
-libdir = $(exec_prefix)/lib
-
-mandir = $(prefix)/man
-man1dir = $(mandir)/man1
-man2dir = $(mandir)/man2
-man3dir = $(mandir)/man3
-man4dir = $(mandir)/man4
-man5dir = $(mandir)/man5
-man6dir = $(mandir)/man6
-man7dir = $(mandir)/man7
-man8dir = $(mandir)/man8
-
-SHELL = /bin/sh
-
-INSTALL = install -c
-INSTALL_DATA = $(INSTALL)
-INSTALL_PROGRAM = $(INSTALL)
-
-#### End of system configuration section. ####
-
-INCLUDE = -I$(srcdir)/../udi -I$(srcdir)/../include
-
-LIBDFE_OBJS = udip2soc.o
-LIBTIP_OBJS = soc2udip.o
-SHARED_OBJS = udr.o
-
-all: libtip.a libdfe.a
-
-libdfe.a: $(SHARED_OBJS) $(LIBDFE_OBJS)
- $(AR) $(AR_FLAGS) $@ $(SHARED_OBJS) $(LIBDFE_OBJS)
- $(RANLIB) $@
-
-libtip.a: $(SHARED_OBJS) $(LIBTIP_OBJS)
- @$(RM) -f $@
- @$(AR) $(AR_FLAGS) $@ $(SHARED_OBJS) $(LIBTIP_OBJS)
- $(RANLIB) $@
-
-.c.o:
- $(CC) $(INCLUDE) $(DEFS) $(CFLAGS) -c $<
-
-install: all
-
-mostlyclean clean:
- $(RM) -f *.o libdfe.a libtip.a
-
-distclean maintainer-clean realclean: clean
- $(RM) -f Makefile config.status
-
-.PHONY: check installcheck info install-info clean-info dvi
-
-check installcheck:
-
-info install-info clean-info dvi:
-
-# with the gnu make, this is done automatically.
-
-Makefile: Makefile.in
- $(SHELL) ./config.status
-
-config.status: configure
- $(srcdir)/configure --no-create
-
-configure: configure.in
- autoconf
-
-# Prevent GNU make v3 from overflowing arg limit on SysV.
-.NOEXPORT:
+++ /dev/null
-/******************************************************************************
-* Copyright 1991 Advanced Micro Devices, Inc.
-*
-* This software is the property of Advanced Micro Devices, Inc (AMD) which
-* specifically grants the user the right to modify, use and distribute this
-* software provided this notice is not removed or altered. All other rights
-* are reserved by AMD.
-*
-* AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
-* SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
-* DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
-* USE OF THIS SOFTWARE.
-*
-* So that all may benefit from your experience, please report any problems
-* or suggestions about this software to the 29K Technical Support Center at
-* 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
-* 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
-*
-* Advanced Micro Devices, Inc.
-* 29K Support Products
-* Mail Stop 573
-* 5900 E. Ben White Blvd.
-* Austin, TX 78741
-* 800-292-9263
-*****************************************************************************
-* NAME @(#)dfe_test.c 1.4 91/08/06 Daniel Mann
-*
-* This module is used for testing of DFE services.
-********************************************************************** HISTORY
-*/
-#include <stdio.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <signal.h>
-#include "udiproc.h"
-
-extern char dfe_errmsg[];
-UDISessionId SessionID;
-int test_errno;
-
-sig_handler()
-{
- printf("DFE socket shutdown\n");
- test_errno = UDIDisconnect(SessionID);
- if(test_errno)printf("DFE Error: UDIDisconnect failed\n");
- if(test_errno)printf("DFE errno= %d errmsg = %s\n",
- test_errno, dfe_errmsg);
- exit();
-}
-
-/***************************************************************** MAIN
-*/
-main(argc, argv)
-int argc;
-char* argv[];
-{
- char *session = argv[1];
- char buf[256];
- int iarray[4];
- int cnt;
-
- if(argc < 2)
- { fprintf(stderr, "ERROR, format:\n");
- fprintf(stderr, "%s session_id \n", argv[0]);
- exit();
- }
- signal(SIGINT, sig_handler);
- signal(SIGQUIT, sig_handler);
- signal(SIGTERM, sig_handler);
-
- test_errno = UDIConnect(argv[1], &SessionID);
- if(test_errno)printf("Error: UDIConnect failed errno=%d\n", test_errno);
- if(test_errno)
- { printf("%s\n", dfe_errmsg);
- exit(1);
- }
-
- for(;;)
- {
- printf("\ninput an INT ....");
- scanf("%d", &cnt);
- printf("input a word ....");
- scanf("%s", buf);
- printf("input 4 INTs (for an array)....");
- scanf("%d%d%d%d", &iarray[0],&iarray[1],&iarray[2], &iarray[3]);
- UDITest(cnt, buf, iarray);
- }
-}
+++ /dev/null
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * Comments about this software should be directed to udi@amd.com. If access
- * to electronic mail isn't available, send mail to:
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- * 800-292-9263
- *****************************************************************************
- * DOS386 changes were merged into:
- * $Id$
- * $Id: @(#)dos2udip.c 2.11, AMD
- */
-
- /* TIPIPCId components */
-#define TIPIPCIdCompany 0x0001 /* Company ID from AMD, others should change this */
-#define TIPIPCIdVersion 0x124 /* Version */
-#ifdef DOS386
-#define TIPIPCIdProduct 0x3 /* Product ID for DOS386 IPC */
-#else
-#define TIPIPCIdProduct 0x2 /* Product ID for non-DOS386 IPC */
-#endif
-
-#include <stdio.h>
-#include <dos.h>
-
-#ifdef HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
-
-#ifdef HAVE_STRING_H
-# include <string.h>
-#else
-# include <strings.h>
-#endif
-
-#include <udiproc.h>
-#include <udidos.h>
-static FILE * fpstdout = stdout; /* where we write the information */
-
-#ifndef DOS386
-#pragma check_stack( off )
-#pragma check_pointer( off )
-
- /********************************************************
- * In non-DOS386 mode, a standard C PTR is just a far real ptr
- * so FARCPTR_TO_REALPTR and REALPTR_TO_FARCPTR are pass-thru
- ********************************************************/
-#define FARCPTR_TO_REALPTR(p) p
-#define REALPTR_TO_FARCPTR(p) p
-
-#define IPCFar far /* qualifier for pointer that can reach the real data used by IPC */
-#define REALNULL NULL
-typedef void far * FARCPTR;
-
-#else
-#include "malloc.h"
-#include "alloca.h"
-#include "pharlap.h"
-#include "realcopy.h"
-
-#define IPCFar _far /* qualifier for pointer that can reach the real data used by IPC */
-#define REALNULL (REALPTR) 0
-typedef void _far * FARCPTR;
-
-
- /********************************************************
- * In DOS386 protected mode, we have two types of pointers, near and far
- * near is a 32-bit pointer, ie a 32-bit offset from DS.
- * far is a 48-bit pointer, with an explicit segment register.
- * We want to be able to convert real mode pointers (16-bit seg, 16-bit ofst)
- * into these near and far protected mode pointers and vice versa.
- *
- * It is always possible to convert a real mode pointer to a far prot ptr.
- * (Pharlap provides an explicit segment that maps to the low 1 meg of memory).
- ********************************************************/
-FARCPTR REALPTR_TO_FARCPTR(REALPTR p);
-
- /********************************************************
- * The ability to convert from a real mode pointer to a near protected
- * pointer depends on being able to map converntional memory onto the
- * end of our data segment. This is NOT possible under DPMI 0.90
- * If we're not under DPMI 0.90,
- * REALPTR_TO_NEARCPTR takes a real ptr, and returns its offset
- * in the SS_DATA segment (using the fact that the 1 meg of real
- * memory was mapped to the SS_DATA by dx_map_physical).
- *
- ********************************************************/
-#define REALPTR_TO_NEARCPTR(rp) ((void *)(&conventional_memory[LINEARIZE(rp)]))
-
-
- /**********************************************************
- * LINEARIZE converts a segment:ofst pointer into a linear
- * addr between 0 and 1meg
- *********************************************************/
-#define LINEARIZE(rp) ((RP_SEG(rp)<<4) + RP_OFF(rp))
-
- /********************************************************
- * FARCPTR_TO_REALPTR converts a far protected ptr to a real ptr.
- * Naturally, only certain protected pointers can be converted
- * into real pointers (they must map to something in the
- * first 1 meg of memory). If it can't be converted, it's
- * a fatal error. This is a routine rather than a macro.
- * If we need to convert a near prot ptr to a real ptr,
- * this can be done by simply casting it to a far
- *
- ********************************************************/
-REALPTR FARCPTR_TO_REALPTR(FARPTR p);
-
-extern USHORT GetCS();
-extern USHORT GetDS();
-
-
-#endif /* DOS386 */
-
-/****************** External Prototypes *****************************/
-
-extern void TIPPrintUsage(char *arg);
-
-#ifndef DOS386
-extern UDIError UDIASMDisconnect UDIParams((
- UDISessionId Session, /* In */
- UDIBool Terminate, /* In */
- DOSTerm far *TermStruct /* In - not seen in UDIP */
- ));
-extern UDIError UDIASMConnect UDIParams((
- char *Configuration, /* In */
- UDISessionId *Session, /* Out */
- DOSTerm far *TermStruct /* In - not seen in UDIP */
- ));
-
-#endif
-
-/****************** Internal Prototypes *****************************/
-
-UDIError UDICCapabilities UDIParams((
- UDIUInt32 *TIPId, /* Out */
- UDIUInt32 *TargetId, /* Out */
- UDIUInt32 DFEId, /* In */
- UDIUInt32 DFE, /* In */
- UDIUInt32 *TIP, /* Out */
- UDIUInt32 *DFEIPCId, /* Out */
- UDIUInt32 *TIPIPCId, /* Out */
- char *TIPString /* Out */
- ));
-
-static unsigned short GetPSP( void );
-static void SetPSP( unsigned short PSPSegment );
-static unsigned int ComputeTSRSize(void *topofstack);
-static void SetupEnvironment(void);
-static void TerminateTIP UDIParams((DOSTerm IPCFar *TermStruct));
-
-
-/****************** External and Static Data *****************************/
-static int ConnectCount;
-
-#ifdef DOS386
-
-char *conventional_memory; /* pointer to first byte of conventinal memory */
- /* if 0, then conventional mem not mapped */
-USHORT our_tsr_psp; /* TIP's original PSP */
-USHORT dos_ext_psp; /* Dos extender PSP (TIP's parent) */
-extern REALPTR call_prot; /* These are in the module dostip.asm */
-extern USHORT code_selector;
-extern USHORT data_selector;
-extern USHORT segregblock[4];
-extern int end_real; /* marks end of stuff that must be placed in low mem */
-int * stack_table[3]; /* used when we need to get a new stack frame
- * to establish C context on each UDI call
- * but only if conventional memory didn't map */
-REALPTR real_basep; /* returned by realcopy */
-FARPTR prot_basep; /* returned by realcopy */
-USHORT rmem_adrp; /* returned by realcopy */
-
-extern char TIPName[]; /* in DOS386, defined in rmdata in dosdfe.asm */
-extern struct UDIVecRec TIPVecRec; /* in DOS386, defined in rmdata in dosdfe.asm */
-
-
-
-#else /* non-DOS386 static and external data */
-
-char TIPName[ FILENAME_MAX ]; /* in non-386 version, TIPName defined right here */
-struct UDIVecRec TIPVecRec = { /* in non-386 version, TIPVecRec defined right here */
- UDIDOSTIPRecognizer, /* Initialized in main */
- NULL, /* Pointer to next TIP */
- NULL, /* Pointer to previous TIP */
- TIPName, /* Name of the executable we were loaded as */
- UDIASMConnect,
- UDIASMDisconnect,
- UDISetCurrentConnection,
- UDICCapabilities,
- UDIGetErrorMsg,
- UDIGetTargetConfig,
- UDICreateProcess,
- UDISetCurrentProcess,
- UDIDestroyProcess,
- UDIInitializeProcess,
- UDIRead,
- UDIWrite,
- UDICopy,
- UDIExecute,
- UDIStep,
- UDIStop,
- UDIWait,
- UDISetBreakpoint,
- UDIQueryBreakpoint,
- UDIClearBreakpoint,
- UDIGetStdout,
- UDIGetStderr,
- UDIPutStdin,
- UDIStdinMode,
- UDIPutTrans,
- UDIGetTrans,
- UDITransMode
- };
-#endif
-
-struct UDIVecRec IPCFar * pTIPVecRec; /* pointer to TIPVecRec */
- /* in DOS386, this points to real memory */
-static RealUDIVecRecPtr IPCFar * UDIVecP;
-
-static int loaded_from_exp_file = 0;
-
-
-void do_exit(int errcode)
-{
- /* this routine normally just calls exit but in the special case
- * of DOS386 mode AND we were loaded from a .exp file, then we want
- * to exit in a different way by calling exp_return
- */
-#ifdef DOS386
-extern void _exp_return(int err);
- if (loaded_from_exp_file)
- _exp_return(errcode);
- else
-#endif
- /* normal non-DOS386 and non-exp_file exit */
- exit(errcode);
-}
-
-
-void do_dos_keep(int errcode, int tsrsize)
-{
- /* similar logic to do_exit above, but this time for dos_keep
- */
-#ifdef DOS386
-extern void _exp_return(int err);
- if (loaded_from_exp_file)
- _exp_return(errcode);
- else
-#endif
- /* normal non-DOS386 and non-exp_file dos_keep */
- _dos_keep( 0, tsrsize );
-}
-
-void get_tip_name(int argc, char *argv[])
-{
- /* This routine normally gets the Tipname from argv[1], but
- * in the special case of DOS386 and loaded as an exp file,
- * it gets the name from the stack
- */
-
-#ifdef DOS386
- extern char * _top;
-
- if ((GetCS() & 0xfffc) != SS_CODE) {
- /* a CS that is not SS_CODE indicates that we were
- loaded as a .exp file. In that case, we don't
- want to exit or do a TSR, instead we want to return
- back to the DFE using _exp_return.
- */
- loaded_from_exp_file = TRUE;
- strcpy(TIPName, _top+16);
- return;
- }
-#endif
-
- if ((argc!= 2) || (argv[1][0] == '-')) {
- TIPPrintUsage(argv[1]);
- do_exit( 1 );
- }
-
- strcpy( TIPName, argv[1] );
-}
-
-
-#ifdef DOS386
-REALPTR FARCPTR_TO_REALPTR(FARCPTR p) /* converts a FAR PROT ptr to a REALPTR */
-{
-REALPTR dummyrp;
-int err;
-
- /* returns a real mode pointer given a prot mode pointer p */
- err = _dx_toreal(p, 0, &dummyrp);
- if (err) {
- printf("Fatal Error _dx_toreal(%04x:%08x)\n", FP_SEG(p), FP_OFF(p));
- do_exit(err);
- }
- else
- return(dummyrp);
-
-}
-
-
-FARCPTR REALPTR_TO_FARCPTR(REALPTR rp)
-{
-FARCPTR dummyfp;
- FP_SET(dummyfp, LINEARIZE(rp), SS_DOSMEM);
- return(dummyfp);
-}
-
-/*****************
- * Routine used to create and initialize a stack for C context stack switching
- * (used only when conventional memory can't be mapped
- ****************/
-static void create_stack(int stack_index, int size_in_bytes)
-{
-int *p;
-int index_to_last_int;
-
- /* malloc appropriate size and point stack_table entry to second last word */
- p = (int *)malloc(size_in_bytes);
- if (p == 0) {
- printf("\nTIP: unable to malloc stacks\n");
- do_exit(1);
- }
- index_to_last_int = (size_in_bytes/sizeof(int)) - 1;
- stack_table[stack_index] = &p[index_to_last_int-1];
-
- /* and set last word to 0 (marked as free) */
- /* set second last word to stack size (used for alloca checking) */
- p[index_to_last_int-1] = size_in_bytes-8;
- p[index_to_last_int] = 0;
-}
-#endif
-
-
-
-static void TerminateTIP UDIParams((
- DOSTerm IPCFar *TermStruct /* In - not seen in UDIP */
- ))
-{
- /* Delink ourselves from the linked list of TIPs */
- if (pTIPVecRec->Next != REALNULL)
- ((struct UDIVecRec IPCFar *)REALPTR_TO_FARCPTR(pTIPVecRec->Next))->Prev = pTIPVecRec->Prev;
- if (pTIPVecRec->Prev != REALNULL)
- ((struct UDIVecRec IPCFar *)REALPTR_TO_FARCPTR(pTIPVecRec->Prev))->Next = pTIPVecRec->Next;
- else
- *UDIVecP = pTIPVecRec->Next; /* no previous TIP, set the interrupt vector
- to point to our Next TIP */
-
-#ifdef DOS386
-{
- if (loaded_from_exp_file) /* if we were loaded from an exp file, skip all this PSP stuff */
- return;
-
- /* Under DOSEXT, our PSP is parented by the DOSEXTENDER's PSP */
- /* We want to modify the DOSEXT's PSP to point to the DFE info */
-REALPTR ptr_dos_ext_psp_parent;
-REALPTR ptr_dos_ext_psp_termaddr;
-
- /* Set the dos_ext_psp's Parent PSP to the current PSP (ie, the DFE PSP)*/
- RP_SET(ptr_dos_ext_psp_parent,0x16, dos_ext_psp);
- *((USHORT _far *)(REALPTR_TO_FARCPTR(ptr_dos_ext_psp_parent))) = GetPSP();
-
- /* Set the dos_ext_psp's Terminate address to reasonable address in
- current PSP (DFE)'s program space */
- RP_SET(ptr_dos_ext_psp_termaddr,0xa, dos_ext_psp);
- *((ULONG _far *)(REALPTR_TO_FARCPTR(ptr_dos_ext_psp_termaddr))) = (ULONG) TermStruct->TermFunc;
-}
-#else
- /* Set our TSR's PSP's Parent PSP to the current PSP */
- fflush(fpstdout);
-
- *(unsigned _far *)(((long)_psp << 16) + 0x16) = GetPSP();
-
- /* Set our TSR's PSP's Terminate address to reasonable address in
- current PSP's program space */
- /*(void _far (_far *) (void))(((long)_psp << 16) + 0xa) = ExitAddr;*/
- *(void (_far *(_far *))(void))(((long)_psp << 16) + 0xa) =
- TermStruct->TermFunc;
-#endif
-
- /* Change DOS's notion of what the current PSP is to be our TSR's PSP */
-#ifdef DOS386
- SetPSP(our_tsr_psp);
- /* Under Dosext, termination will chain back from our_psp to DOSEXT PSP */
- /* and then back to the DFE (since we modified the DOSEXT PSP above) */
-#else
- SetPSP(_psp );
-#endif
-
- /* Terminate the program by using DOSTerminate 0x21/0x4c. Execution
- will resume at the Terminate address set above with ALL REGISTERS
- UNKNOWN especially SS:SP, DS, ES, etc */
- bdos( 0x4c, 0, 0 );
- }
-
-UDIError UDICConnect UDIParams((
- char *Configuration, /* In */
- UDISessionId *Session, /* Out */
- DOSTerm IPCFar *TermStruct /* In - not seen in UDIP */
- ))
-{
- UDIError err;
-
- if ((err = UDIConnect( Configuration, Session )) <= UDINoError)
- ConnectCount++;
-
- if (ConnectCount == 0) { /* Terminate the unused TIP */
- /* Save the error status in the TermStruct */
- TermStruct->retval = err;
-
- TerminateTIP( TermStruct ); /* Never returns */
- }
-
- return err;
- }
-
-UDIError UDICDisconnect UDIParams((
- UDISessionId Session, /* In */
- UDIBool Terminate, /* In */
- DOSTerm IPCFar *TermStruct /* In - not seen in UDIP */
- ))
-{
- UDIError err;
-
- /* Disconnect via the real TIP */
- if ((err = UDIDisconnect( Session, Terminate )) == UDINoError)
- ConnectCount--;
-
- if (Terminate != UDIContinueSession && ConnectCount == 0) {
- /* Terminate the unused TIP */
- /* Save the error status in the TermStruct */
- TermStruct->retval = err;
-
- TerminateTIP( TermStruct ); /* Never returns */
- }
-
- return err;
- }
-
-UDIError UDICCapabilities UDIParams((
- UDIUInt32 *TIPId, /* Out */
- UDIUInt32 *TargetId, /* Out */
- UDIUInt32 DFEId, /* In */
- UDIUInt32 DFE, /* In */
- UDIUInt32 *TIP, /* Out */
- UDIUInt32 *DFEIPCId, /* Out */
- UDIUInt32 *TIPIPCId, /* Out */
- char *TIPString /* Out */
- ))
-{
- UDIError err;
-
- err = UDICapabilities( TIPId, TargetId, DFEId, DFE, TIP,
- DFEIPCId, TIPIPCId, TIPString );
-
- *TIPIPCId = (((UDIUInt32)TIPIPCIdCompany) << 16) |
- (TIPIPCIdProduct << 12) | TIPIPCIdVersion;
-
- return err;
- }
-
-
-static RealUDIVecRecPtr IPCFar * AllocateIntVect()
-{
- RealUDIVecRecPtr IPCFar * VecP;
-
- /* Try and find a vector that is unused */
- for (VecP = (RealUDIVecRecPtr IPCFar *)(REALPTR_TO_FARCPTR(0x60*4));
- VecP <= (RealUDIVecRecPtr IPCFar *)(REALPTR_TO_FARCPTR(0x66*4));
- VecP++) {
- if (*VecP == REALNULL)
- return VecP;
- }
-
- return NULL;
- }
-
-static RealUDIVecRecPtr IPCFar * FindIntVect()
-{
- RealUDIVecRecPtr IPCFar * VecP;
- union rec recognizer;
-
- InitRecognizer( &recognizer );
-
- /* Try and find a vector that matches the passed in recognizer */
- for (VecP = (RealUDIVecRecPtr IPCFar *)(REALPTR_TO_FARCPTR(0x60*4));
- VecP <= (RealUDIVecRecPtr IPCFar *)(REALPTR_TO_FARCPTR(0x66*4));
- VecP++) {
- if ((*VecP != REALNULL) && ((struct UDIVecRec IPCFar *) REALPTR_TO_FARCPTR(*VecP))->recognizer.l == recognizer.l)
- return VecP;
- }
-
- return NULL;
-}
-
-static void SetupEnvironment(void)
-{
-#ifndef DOS386
- /* if not DOS386, nothing to do except set up the
- pointer to TIPVecRec
- */
- pTIPVecRec = &TIPVecRec;
-
-#else /* setup code for DOS386 */
-FARPTR dummyfp;
-REALPTR dummyrp;
-ULONG dummyint;
-REALPTR IPCFar *p;
-REALPTR ptr_dos_ext_psp;
-int err;
-int i;
-
- /**************************************************************
- * There are some initialization things that we might as well do before
- * we do the realcopy down below. Here we do some initialization
- * of TIPVecRec and the code_selector and data_selector and call_prot
- * routine address that are then used by the real mode code.
- ****************************************************************/
-
- _dx_rmlink_get(&call_prot, &dummyrp, &dummyint, &dummyfp);
- code_selector = GetCS();
- data_selector = GetDS();
- for (i=0; i<4; i++)
- segregblock[i] = data_selector;
-
- /******************************************************
- * Map first 1 meg of physical memory into our ds: address space
- * This is 256 4K pages starting at physical address 0.
- * The pointer conventional_memory is its mapped offset in our data space
- * If this mapping cannot be done (because we are running under DPMI 0.90)
- * then we will have to access dos memory using far pointers and do some
- * copies of data down in the d386 routines.
- ********************************************************/
- err = _dx_map_phys(data_selector, (ULONG) 0, (ULONG) 256, (ULONG *)&conventional_memory);
- if (err)
- conventional_memory = NULL;
-
-#ifdef DEBUG
- if (err)
- printf("TIP: Unable to map conventional memory %d\n", err);
- else
- printf("TIP: Successfully mapped conventional memory\n");
-#endif
-
- if (!conventional_memory) {
- /* mapping conventional memory did not work */
- /* need to set up stacks to switch to at UDI call time */
- create_stack(0, 64000);
- create_stack(1, 10000);
- stack_table[2] = 0; /* end of list */
- }
-
- /* do a realcopy to copy all the things that must be reachable
- * from real mode into a real mode segment. For simplicity,
- * we just always assume that REALBREAK might not work.
- * This is only used at TIP INIT time and the performance impact is negligent.
- */
- err = realcopy(0, /* real mode stuff was linked first */
- end_real, /* where the real mode stuff ends */
- &real_basep,
- &prot_basep,
- &rmem_adrp);
-
- if (err) {
- printf("\nTIP: realcopy call failed;\n");
- printf( " Probable cause: insufficient free conventional memory.\n");
- do_exit(1);
- }
-
-
- /* The prot_basep that was returned above must now be used
- to access from protected mode the data elements that were
- copied above. In particular, we create a pointer to the
- copied TIPVecRec and use that.
- */
- pTIPVecRec = (struct UDIVecRec IPCFar *) (prot_basep + (ULONG) &TIPVecRec);
-
-
-
- /**************************************************************
- * The real_basep that was returned from realcopy must be used as
- * the code segment pointer of all the real mode routines.
- * and so must be patched into TIPVecRec.
- * real_basep is returned by realcopy such that the offset parts
- * (as assembled in in the module dostip.asm) can remain unchanged.
- * So we just need to patch the real_basep seg into each of those pointers
- ***************************************************************/
- for (p = (REALPTR IPCFar *)&pTIPVecRec->exeName;
- p<= (REALPTR IPCFar *)&pTIPVecRec->UDITransMode; p++) {
- RP_SET(*p, RP_OFF(*p), RP_SEG(real_basep));
- }
-
- /*****************************************************
- Store our PSP (real segment) away for later termination
- and also the dos extender's PSP (our parent). We get this by
- building a real pointer with seg = our_tsr_psp, ofst = 0x16,
- and then derefencing that
- *****************************************************/
- our_tsr_psp = GetPSP();
- RP_SET(ptr_dos_ext_psp, 0x16, our_tsr_psp);
- dos_ext_psp = *((USHORT _far *)(REALPTR_TO_FARCPTR(ptr_dos_ext_psp)));
-
-#endif /* end of DOS386 setup code */
-}
-
-
-static unsigned int ComputeTSRSize(void *topofstack)
-{
-#ifndef DOS386
- /* Real mode program, compute program size */
- /* Huge pointers force compiler to do segment arithmetic for us. */
-static char _huge *tsrstack;
-static char _huge *tsrbottom;
- /* Initialize stack and bottom of program. */
- tsrstack = (char huge *)topofstack;
- FP_SEG( tsrbottom ) = _psp;
- FP_OFF( tsrbottom ) = 0;
-
- /* Program size is:
- * top of stack
- * - bottom of program (converted to paragraphs) (using huge math)
- * + one extra paragraph
- */
- return((unsigned int) (((tsrstack - tsrbottom) >> 4) + 1));
-#else
- /*********************
- In DOS386 mode, the TSR size consists of the real memory that
- is used by the Pharlap DOS extender and the small amount of real memory
- used by UDI. The number 6400 seems to be a good guess for now.
- This might have to be adjusted with newer versions of Dos extender, etc.
- I wonder if there is some way to compute this number accurately.
- **********************/
- return(6400); /* our best guess for now */
-#endif
-}
-
-main(int argc, char *argv[])
-{
- unsigned tsrsize;
-
- get_tip_name(argc, argv); /* get name from argv or whereever */
-
-#ifdef TSRDEBUG
- {
- int i;
- printf( "Invoked with %d arguments\n", argc );
- for (i = 0; i < argc; i++)
- printf( "%s ", argv[i] );
- printf( "\n" );
- }
-#endif
-
- InitRecognizer(&TIPVecRec.recognizer );
-
- SetupEnvironment(); /* do some setup specific to DOS or DOS386 */
-
-
- /* See if the interrupt vector has already been selected for us */
- if ((UDIVecP = FindIntVect()) == NULL) {
- if ((UDIVecP = AllocateIntVect()) == NULL)
- return -1; /* No interrupt vectors available */
- }
- else { /* Interrupt vector already allocated */
- pTIPVecRec->Next = *UDIVecP; /* always store a real ptr there */
- ((struct UDIVecRec IPCFar *) REALPTR_TO_FARCPTR(pTIPVecRec->Next))->Prev = FARCPTR_TO_REALPTR(pTIPVecRec);
- }
-
- *UDIVecP = FARCPTR_TO_REALPTR(pTIPVecRec);
-
- tsrsize = ComputeTSRSize(&argv); /* pass it pointer to argv (top of stack) */
-
- /* We are now ready to support DFEs. If we wish to debug back-ends,
- though, we are probably running CodeView with the TIP right now
- and don't want to really TSR because CV will shut down at that
- point. Instead, let's spawn a new DOS shell from which we can
- start a DFE (after setting a breakpoint in the TIP somewhere).
- */
-#ifdef TSRDEBUG
- system( getenv( "COMSPEC" ) );
-#else
- do_dos_keep(0, tsrsize);
-#endif
-
- return 0;
-}
-
-
-#define GET_PSP_DOS2 0x51
-#define GET_PSP_DOS3 0x62
-#define SET_PSP 0x50
-
-static unsigned short GetPSP( void )
-{
- union REGS regs;
-
- if (_osmajor == 2)
- return 0;
-#ifdef DOS386
- regs.h.ah = GET_PSP_DOS2; /* Phar Lap requires we use this to get real segment */
-#else
- regs.h.ah = GET_PSP_DOS3;
-#endif
- intdos( ®s, ®s );
- return regs.x.bx;
-}
-
-static void SetPSP( unsigned short PSPSegment )
-{
- union REGS regs;
-
- regs.h.ah = SET_PSP;
- regs.x.bx = PSPSegment;
- intdos( ®s, ®s );
-}
-
-
-#ifdef DOS386
-/*============================ DOS386 glue routines ====================================*/
-
-/****************************************************************
- * In DPMI Compatibility mode, when we get to this point, the only
- * thing that is on the stack is the saved far stack pointer (which actually
- * points back to the real mode stack). Remember in pmstub in dostip.asm,
- * we switched stack pointers so that SS = DS for C level requirements.
- *
- * The INCOMING_PARAMS macro defines a packed structure which expresses what the
- * real mode stack really looks like when we get to each dos386 glue routine.
- * The STACK_PAD is all the extra stuff that was on the stack because of the switching
- * from real to protected mode, etc.
- * The packed structure can be used to express where things really are on the stack
- * because the DFE's MSC compiler will push things differently from the hc386 compiler.
- ********************************************************************/
-typedef _packed struct {
- FARPTR ret_to_dosext;
- USHORT zero_word;
- USHORT saved_di;
- USHORT saved_si;
- USHORT saved_bp;
- USHORT saved_ds;
- ULONG ret_to_dfe;
-} STACK_PAD;
-
-/* The following macro defines the packed structure for the incoming parameters
- * including the STACK_PAD stuff noted above. It is used by those few d386_
- * routines that do not need converted pointers to avoid non-use warnings
- */
-#define INCOMING_PARAMS_NO_PTR(params) \
- _packed struct { \
- STACK_PAD padding; \
- params \
- } _far *in = rm_stk_ptr; \
-
-
-/* The following macro defines the packed structure for the incoming parameters
- * (see above) and also defines a local structure for storing the converted local
- * pointers. Most d386_ routines use this macro.
- */
-#define INCOMING_PARAMS(params) \
- INCOMING_PARAMS_NO_PTR(params) \
- struct { \
- params \
- int dummy; /* to avoid warnings and for local count */ \
- } local ; /* local structure for holding converted pointers */ \
- int stackspace = stacksize; \
-
-
-
-/**************************************************************
- * The following macros handle the creation of near C pointers from real pointers
- * so that the real UDI routines can be called with near C pointers.
- * Different macros are called for IN pointers vs. OUT pointers and
- * for PREPROCESSING (before the real UDI call) and POSTPROCESSING (cleanup
- * after returning from the real UDI call).
- *
- * If conventional_memory has been mapped, the following happens
- * PREPROCESS (IN or OUT ptr) sets local.var pointer to the mapped pointer
- * nothing to copy so count is ignored
- * POSTPROCESS nothing to do
- *
- * If conventional_memory has not been mapped, then
- * PREPROCESS (IN ptr) does alloca of count to get local pointer
- * copies data into local allocated area
- * PREPROCESS (OUT ptr) does alloca of count to get local pointer
- * no copy of data yet.
- * POSTPROCESS (OUT ptr) copies data from local allocated area back to real mem
- *
- * Note that a few UDI routines have pointers that are both IN and OUT
- */
-
- /* the following is used in a couple of places in the macros */
-#define ALLOC_LOCAL(var, count) \
- if ((stackspace -= count) <= 500) return(UDIErrorIPCLimitation); \
- local.var = alloca(count);
-
-#define INPTR_PREPROCESS_COUNT(var,count) \
- if (conventional_memory) { \
- local.var = REALPTR_TO_NEARCPTR(in->var); \
- } \
- else { \
- local.dummy = count; /* avoid double evaluation if count is expression */ \
- ALLOC_LOCAL(var, local.dummy); \
- movedata(SS_DOSMEM, LINEARIZE(in->var), data_selector, (unsigned int) local.var, local.dummy); \
- }
-
-
-#define INPTR_PREPROCESS(var) INPTR_PREPROCESS_COUNT(var, sizeof(*(in->var)))
-
-#define OUTPTR_PREPROCESS_COUNT(var,count) \
- if (conventional_memory) \
- local.var = REALPTR_TO_NEARCPTR(in->var); \
- else { \
- ALLOC_LOCAL(var,count); \
- }
-
-#define OUTPTR_PREPROCESS(var) OUTPTR_PREPROCESS_COUNT(var, sizeof(*(in->var)))
-
-#define OUTPTR_POSTPROCESS_COUNT(var,count) \
- if (!conventional_memory) {\
- movedata(data_selector, (unsigned int)local.var, SS_DOSMEM, LINEARIZE(in->var), count); \
- }
-
-#define OUTPTR_POSTPROCESS(var) OUTPTR_POSTPROCESS_COUNT(var, sizeof(*(in->var)))
-
-
-
-/* The following routine computes the length of a string that
- * is pointed to by a real pointer. This is only needed when
- * we cannot map real mode memory at the end of the DS.
- */
-int realptr_strlen(REALPTR rp)
-{
-char _far *farp;
-char _far *start;
-
- farp = (char _far *) REALPTR_TO_FARCPTR(rp); /* need to use a far c ptr */
- start = farp;
- while (*farp++); /* advance until a 0 located */
- return(FP_OFF(farp) - FP_OFF(start));
-}
-
-/*======================== Glue Routines ============================================*/
-
-
-UDIError d386_UDIConnect (void _far * rm_stk_ptr, int stacksize)
-{
-INCOMING_PARAMS(
- char *Configuration; /* In */
- UDISessionId *Session; /* Out */
- DOSTerm *TermStruct; /* In - not seen in UDIP */
-)
-UDIError err;
-
- INPTR_PREPROCESS_COUNT(Configuration, realptr_strlen((REALPTR)(in->Configuration))+1);
- OUTPTR_PREPROCESS(Session);
-
- err = UDICConnect( /* for UDIConnect, special case, call UDICConnect in dos2udip.c */
- local.Configuration,
- local.Session,
- REALPTR_TO_FARCPTR((REALPTR)in->TermStruct)
- );
-
- OUTPTR_POSTPROCESS(Session);
- return(err);
-}
-
-UDIError d386_UDIDisconnect (void _far * rm_stk_ptr, int stacksize)
-{
-INCOMING_PARAMS(
- UDISessionId Session; /* In */
- UDIBool Terminate;
- DOSTerm *TermStruct; /* In - not seen in UDIP */
-)
-UDIError err;
-
- local.dummy = 0; /* avoids warning */
- err = UDICDisconnect( /* need to call UDICDisconnect */
- in->Session,
- in->Terminate,
- REALPTR_TO_FARCPTR((REALPTR)in->TermStruct)
- );
- return(err);
-
-}
-
-
-UDIError d386_UDISetCurrentConnection (void _far * rm_stk_ptr, int stacksize)
-{
-INCOMING_PARAMS_NO_PTR(
- UDISessionId Session; /* In */
-)
- return(UDISetCurrentConnection(in->Session));
-}
-
-
-UDIError d386_UDICapabilities (void _far * rm_stk_ptr, int stacksize)
-{
-INCOMING_PARAMS(
- UDIUInt32 *TIPId; /* Out */
- UDIUInt32 *TargetId; /* Out */
- UDIUInt32 DFEId; /* In */
- UDIUInt32 DFE; /* In */
- UDIUInt32 *TIP; /* Out */
- UDIUInt32 *DFEIPCId; /* Out */
- UDIUInt32 *TIPIPCId; /* Out */
- char *TIPString; /* Out */
-)
-UDIError err;
-
- OUTPTR_PREPROCESS(TIPId);
- OUTPTR_PREPROCESS(TargetId);
- OUTPTR_PREPROCESS(TIP);
- OUTPTR_PREPROCESS(DFEIPCId);
- OUTPTR_PREPROCESS(TIPIPCId);
- OUTPTR_PREPROCESS_COUNT(TIPString, 100); /* max TIP string? */
-
- err = UDICCapabilities( /* another special case call UDICapabilities */
- local.TIPId,
- local.TargetId,
- in->DFEId,
- in->DFE,
- local.TIP,
- local.DFEIPCId,
- local.TIPIPCId,
- local.TIPString
- );
-
- OUTPTR_POSTPROCESS(TIPId);
- OUTPTR_POSTPROCESS(TargetId);
- OUTPTR_POSTPROCESS(TIP);
- OUTPTR_POSTPROCESS(DFEIPCId);
- OUTPTR_POSTPROCESS(TIPIPCId);
- OUTPTR_POSTPROCESS_COUNT(TIPString, strlen(local.TIPString)+1);
-
- return(err);
-}
-
-
-UDIError d386_UDIGetErrorMsg (void _far * rm_stk_ptr, int stacksize)
-{
-INCOMING_PARAMS(
- UDIError ErrorCode; /* In */
- UDISizeT MsgSize; /* In */
- char *Msg; /* Out */
- UDISizeT *CountDone; /* Out */
-)
-UDIError err;
-
- OUTPTR_PREPROCESS_COUNT(Msg, in->MsgSize);
- OUTPTR_PREPROCESS(CountDone);
-
- err = UDIGetErrorMsg(
- in->ErrorCode,
- in->MsgSize,
- local.Msg, /* pointers made local */
- local.CountDone
- );
-
- OUTPTR_POSTPROCESS_COUNT(Msg, *(local.CountDone)+1);
- OUTPTR_POSTPROCESS(CountDone);
- return(err);
-}
-
-
-
-UDIError d386_UDIGetTargetConfig (void _far * rm_stk_ptr, int stacksize)
-{
-INCOMING_PARAMS(
- UDIMemoryRange *KnownMemory; /* Out */
- UDIInt *NumberOfRanges; /* In/Out */
- UDIUInt32 *ChipVersions; /* Out */
- UDIInt *NumberOfChips; /* In/Out */
-)
-UDIError err;
-
- INPTR_PREPROCESS(NumberOfRanges);
- INPTR_PREPROCESS(NumberOfChips);
- OUTPTR_PREPROCESS_COUNT(KnownMemory, *(local.NumberOfRanges) * sizeof(UDIMemoryRange));
- OUTPTR_PREPROCESS_COUNT(ChipVersions, *(local.NumberOfChips) * sizeof(UDIUInt32));
-
- err = UDIGetTargetConfig(
- local.KnownMemory,
- local.NumberOfRanges,
- local.ChipVersions,
- local.NumberOfChips
- );
-
- OUTPTR_POSTPROCESS(NumberOfRanges);
- OUTPTR_POSTPROCESS(NumberOfChips);
- OUTPTR_POSTPROCESS_COUNT(KnownMemory, *(local.NumberOfRanges) * sizeof(UDIMemoryRange));
- OUTPTR_POSTPROCESS_COUNT(ChipVersions, *(local.NumberOfChips) * sizeof(UDIUInt32));
-
- return(err);
-}
-
-UDIError d386_UDICreateProcess (void _far * rm_stk_ptr, int stacksize)
-{
-INCOMING_PARAMS(
- UDIPId *PId; /* Out */
-)
-UDIError err;
-
- OUTPTR_PREPROCESS(PId);
-
- err = UDICreateProcess(
- local.PId
- );
-
- OUTPTR_POSTPROCESS(PId);
- return(err);
-}
-
-UDIError d386_UDISetCurrentProcess (void _far * rm_stk_ptr, int stacksize)
-{
-INCOMING_PARAMS_NO_PTR(
- UDIPId PId; /* In */
- )
-
- return(UDISetCurrentProcess(
- in->PId
- ));
-}
-
-UDIError d386_UDIDestroyProcess (void _far * rm_stk_ptr, int stacksize)
-{
-INCOMING_PARAMS_NO_PTR(
- UDIPId PId; /* In */
- )
-
- return(UDIDestroyProcess(
- in->PId
- ));
-}
-
-
-
-UDIError d386_UDIInitializeProcess (void _far * rm_stk_ptr, int stacksize)
-{
-INCOMING_PARAMS(
- UDIMemoryRange *ProcessMemory; /* In */
- UDIInt NumberOfRanges; /* In */
- UDIResource EntryPoint; /* In */
- CPUSizeT *StackSizes; /* In */
- UDIInt NumberOfStacks; /* In */
- char *ArgString; /* In */
- )
-UDIError err;
-
- INPTR_PREPROCESS_COUNT(ProcessMemory, in->NumberOfRanges * sizeof(UDIMemoryRange));
- INPTR_PREPROCESS_COUNT(StackSizes, in->NumberOfStacks * sizeof(CPUSizeT));
- INPTR_PREPROCESS_COUNT(ArgString, realptr_strlen((REALPTR)(in->ArgString))+1);
-
- err = UDIInitializeProcess(
- local.ProcessMemory,
- in->NumberOfRanges,
- in->EntryPoint,
- local.StackSizes,
- in->NumberOfStacks,
- local.ArgString
- );
-
- return(err);
-}
-
-
-
-UDIError d386_UDIRead (void _far * rm_stk_ptr, int stacksize)
-{
-INCOMING_PARAMS(
- UDIResource From; /* In */
- UDIHostMemPtr To; /* Out */
- UDICount Count; /* In */
- UDISizeT Size; /* In */
- UDICount *CountDone; /* Out */
- UDIBool HostEndian; /* In */
- )
-UDIError err;
-
- OUTPTR_PREPROCESS_COUNT(To, in->Count * in->Size);
- OUTPTR_PREPROCESS(CountDone);
-
- err = UDIRead(
- in->From,
- local.To,
- in->Count,
- in->Size,
- local.CountDone,
- in->HostEndian
- );
-
- OUTPTR_POSTPROCESS_COUNT(To, *(local.CountDone) * in->Size);
- OUTPTR_POSTPROCESS(CountDone);
-
- return(err);
-}
-
-
-
-UDIError d386_UDIWrite (void _far * rm_stk_ptr, int stacksize)
-{
-INCOMING_PARAMS(
- UDIHostMemPtr From; /* In */
- UDIResource To; /* In */
- UDICount Count; /* In */
- UDISizeT Size; /* In */
- UDICount *CountDone; /* Out */
- UDIBool HostEndian; /* In */
- )
-UDIError err;
-
- INPTR_PREPROCESS_COUNT (From, in->Count * in->Size);
- OUTPTR_PREPROCESS(CountDone);
-
- err = UDIWrite(
- local.From,
- in->To,
- in->Count,
- in->Size,
- local.CountDone,
- in->HostEndian
- );
-
- OUTPTR_POSTPROCESS(CountDone);
-
- return(err);
-
-}
-
-
-UDIError d386_UDICopy (void _far * rm_stk_ptr, int stacksize)
-{
-INCOMING_PARAMS(
- UDIResource From; /* In */
- UDIResource To; /* In */
- UDICount Count; /* In */
- UDISizeT Size; /* In */
- UDICount *CountDone; /* Out */
- UDIBool Direction; /* In */
- )
-UDIError err;
-
- OUTPTR_PREPROCESS(CountDone);
-
- err = UDICopy(
- in->From,
- in->To,
- in->Count,
- in->Size,
- local.CountDone,
- in->Direction
- );
-
- OUTPTR_POSTPROCESS(CountDone);
-
- return(err);
-}
-
-
-UDIError d386_UDIExecute (void _far * rm_stk_ptr, int stacksize)
-{
-/* no incoming parameters */
-
- return(UDIExecute());
-}
-
-
-UDIError d386_UDIStep (void _far * rm_stk_ptr, int stacksize)
-{
-INCOMING_PARAMS_NO_PTR(
- UDIUInt32 Steps; /* In */
- UDIStepType StepType; /* In */
- UDIRange Range; /* In */
- )
-UDIError err;
-
- err = UDIStep(
- in->Steps,
- in->StepType,
- in->Range
- );
-
- return(err);
-}
-
-
-
-UDIVoid d386_UDIStop (void _far * rm_stk_ptr, int stacksize)
-{
-/* no incoming parameters, no return value */
- UDIStop();
-}
-
-
-
-
-UDIError d386_UDIWait (void _far * rm_stk_ptr, int stacksize)
-{
-INCOMING_PARAMS(
- UDIInt32 MaxTime; /* In */
- UDIPId *PId; /* Out */
- UDIUInt32 *StopReason; /* Out */
- )
-UDIError err;
-
- OUTPTR_PREPROCESS(PId);
- OUTPTR_PREPROCESS(StopReason);
-
- err = UDIWait(
- in->MaxTime,
- local.PId,
- local.StopReason
- );
-
- OUTPTR_POSTPROCESS(PId);
- OUTPTR_POSTPROCESS(StopReason);
-
- return(err);
-}
-
-
-
-UDIError d386_UDISetBreakpoint (void _far * rm_stk_ptr, int stacksize)
-{
-INCOMING_PARAMS(
- UDIResource Addr; /* In */
- UDIInt32 PassCount; /* In */
- UDIBreakType Type; /* In */
- UDIBreakId *BreakId; /* Out */
- )
-UDIError err;
-
- OUTPTR_PREPROCESS(BreakId);
-
- err = UDISetBreakpoint(
- in->Addr,
- in->PassCount,
- in->Type,
- local.BreakId
- );
-
- OUTPTR_POSTPROCESS(BreakId);
-
- return(err);
-}
-
-
-UDIError d386_UDIQueryBreakpoint (void _far * rm_stk_ptr, int stacksize)
-{
-INCOMING_PARAMS(
- UDIBreakId BreakId; /* In */
- UDIResource *Addr; /* Out */
- UDIInt32 *PassCount; /* Out */
- UDIBreakType *Type; /* Out */
- UDIInt32 *CurrentCount; /* Out */
- )
-UDIError err;
-
- OUTPTR_PREPROCESS(Addr);
- OUTPTR_PREPROCESS(PassCount);
- OUTPTR_PREPROCESS(Type);
- OUTPTR_PREPROCESS(CurrentCount);
-
- err = UDIQueryBreakpoint(
- in->BreakId,
- local.Addr,
- local.PassCount,
- local.Type,
- local.CurrentCount
- );
-
- OUTPTR_POSTPROCESS(Addr);
- OUTPTR_POSTPROCESS(PassCount);
- OUTPTR_POSTPROCESS(Type);
- OUTPTR_POSTPROCESS(CurrentCount);
-
- return(err);
-}
-
-
-
-UDIError d386_UDIClearBreakpoint (void _far * rm_stk_ptr, int stacksize)
-{
-INCOMING_PARAMS_NO_PTR(
- UDIBreakId BreakId; /* In */
- )
- return(UDIClearBreakpoint(
- in->BreakId
- ));
-
-}
-
-UDIError d386_UDIGetStdout (void _far * rm_stk_ptr, int stacksize)
-{
-INCOMING_PARAMS(
- UDIHostMemPtr Buf; /* Out */
- UDISizeT BufSize; /* In */
- UDISizeT *CountDone; /* Out */
- )
-UDIError err;
-
- OUTPTR_PREPROCESS_COUNT(Buf, in->BufSize);
- OUTPTR_PREPROCESS(CountDone);
-
- err = UDIGetStdout(
- local.Buf,
- in->BufSize,
- local.CountDone
- );
-
- OUTPTR_POSTPROCESS_COUNT(Buf, *(local.CountDone));
- OUTPTR_POSTPROCESS(CountDone);
-
- return(err);
-}
-
-
-UDIError d386_UDIGetStderr (void _far * rm_stk_ptr, int stacksize)
-{
-INCOMING_PARAMS(
- UDIHostMemPtr Buf; /* Out */
- UDISizeT BufSize; /* In */
- UDISizeT *CountDone; /* Out */
- )
-UDIError err;
-
- OUTPTR_PREPROCESS_COUNT(Buf, in->BufSize);
- OUTPTR_PREPROCESS(CountDone);
-
- err = UDIGetStderr(
- local.Buf,
- in->BufSize,
- local.CountDone
- );
-
- OUTPTR_POSTPROCESS_COUNT(Buf, *(local.CountDone));
- OUTPTR_POSTPROCESS(CountDone);
-
- return(err);
-}
-
-
-
-UDIError d386_UDIPutStdin (void _far * rm_stk_ptr, int stacksize)
-{
-INCOMING_PARAMS(
- UDIHostMemPtr Buf; /* In */
- UDISizeT Count; /* In */
- UDISizeT *CountDone; /* Out */
- )
-UDIError err;
-
- INPTR_PREPROCESS_COUNT(Buf, in->Count);
- OUTPTR_PREPROCESS(CountDone);
-
- err = UDIPutStdin(
- local.Buf,
- in->Count,
- local.CountDone
- );
-
- OUTPTR_POSTPROCESS(CountDone);
-
- return(err);
-}
-
-
-UDIError d386_UDIStdinMode (void _far * rm_stk_ptr, int stacksize)
-{
-INCOMING_PARAMS(
- UDIMode *Mode; /* Out */
- )
-UDIError err;
-
- OUTPTR_PREPROCESS(Mode);
-
- err = UDIStdinMode(
- local.Mode
- );
-
- OUTPTR_POSTPROCESS(Mode);
-
- return(err);
-}
-
-UDIError d386_UDIPutTrans (void _far * rm_stk_ptr, int stacksize)
-{
-INCOMING_PARAMS(
- UDIHostMemPtr Buf; /* In */
- UDISizeT Count; /* In */
- UDISizeT *CountDone; /* Out */
- )
-UDIError err;
-
- INPTR_PREPROCESS_COUNT(Buf, in->Count);
- OUTPTR_PREPROCESS(CountDone);
-
- err = UDIPutTrans(
- local.Buf,
- in->Count,
- local.CountDone
- );
-
- OUTPTR_POSTPROCESS(CountDone);
-
- return(err);
-}
-
-
-UDIError d386_UDIGetTrans (void _far * rm_stk_ptr, int stacksize)
-{
-INCOMING_PARAMS(
- UDIHostMemPtr Buf; /* Out */
- UDISizeT BufSize; /* In */
- UDISizeT *CountDone; /* Out */
- )
-UDIError err;
-
- OUTPTR_PREPROCESS_COUNT(Buf, in->BufSize);
- OUTPTR_PREPROCESS(CountDone);
-
- err = UDIGetTrans(
- local.Buf,
- in->BufSize,
- local.CountDone
- );
-
- OUTPTR_POSTPROCESS_COUNT(Buf, *(local.CountDone));
- OUTPTR_POSTPROCESS(CountDone);
-
- return(err);
-}
-
-
-UDIError d386_UDITransMode (void _far * rm_stk_ptr, int stacksize)
-{
-INCOMING_PARAMS(
- UDIMode *Mode; /* Out */
- )
-UDIError err;
-
- OUTPTR_PREPROCESS(Mode);
-
- err = UDITransMode(
- local.Mode
- );
-
- OUTPTR_POSTPROCESS(Mode);
-
- return(err);
-}
-
-#endif
-/*==================== End of DOS386 glue routines ====================================*/
-
-
+++ /dev/null
-Obsolete, has been merged into dos2udip.c
+++ /dev/null
-This file is obsolete.
-It has been merged with dostip.asm
+++ /dev/null
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * Comments about this software should be directed to udi@amd.com. If access
- * to electronic mail isn't available, send mail to:
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- *****************************************************************************
- * $Id$
- * $Id: @(#)dos386c.c 1.9, AMD
- */
-
-/* DOS386 specific constructs and functions. These assume the use of
- * the 386|DOS-Extender from Pharlap.
- *
- * This file contains functions which serve as an intermediate between
- * protected mode UDI function calls made by the DFE and the possibly
- * real-mode function called in the TIP. These functions assume that
- * the interface between the TIP and the DFE is real-mode and that the
- * DFE is protected mode, flat model (32 bit linear addresses).
- *
- * Note:
- * This code allocates a section of real-mode memory using
- * a call to _dx_real_alloc. Protected mode far pointers (48-bit)
- * must be used to access this memory area.
- *
- * For every UDI function named UDIx..x, there is a function in this
- * module named UDIPx..x, where the "P" indicates that this is a protected
- * mode interface function. A protected mode DFE needs to call the
- * UDIPx..x equivalent of the call to the TIP UDI function. The call
- * parameters are the same as the UDI call except that the address of the
- * TIP UDI function is always the first parameter to the UDIPx..x
- * function.
- *
- * Each function follows the format outlined below:
- *
- * UDIError UDIPx..x(REALPTR function_address [, UDI function parameters])
- * {
- * Allocate pointers into the conventional memory area used for
- * parameter passing (PPM) for all parameters which are
- * passed-by-reference. Each of these pointers is given
- * the same name as a parameter with "Ptr" appended to it.
- *
- * Create a packed structure for parameter passing if there is more
- * than one parameter to the function. Each member of this
- * structure (always named params) has the same name as the
- * corresponding parameter to the UDIP... call.
- *
- * Set the parameter pointers to the appropriate offsets in the PPM.
- * The protected mode pointer to the first parameter is always
- * rm_address (the real mode equivalent to this pointer is
- * rm_buffer_addr).
- *
- * Copy the data from protected mode (possibly extended) memory to
- * the location indicated by the correct pointer
- *
- * Copy the passed-by-value parameters directly into the params
- * structure. Convert the protected mode version of the
- * pointers into the PPM area to real-mode pointers and
- * assign them to their corresponding params data member.
- *
- * Call the real-mode function, pushing the params structure onto
- * the stack. Generally this involves the use of the macro
- * REALCALL, however functions with no parameters call
- * _dx_call_real explicitly. The size of the params structure
- * is determined by the macro WORDSIZE.
- *
- * Check for an error returned from _dx_call_real. If there is one
- * report it and die (how uncouth!).
- *
- * Copy all "out" parameters into their local (non-conventional
- * memory eqivalents. In functions with "count" parameters,
- * make sure that the count value makes sense and only
- * copy as much as is allowed by the buffer size.
- *
- * The return value of the UDI TIP function is in the ax register of
- * the regs structure, return this as the value of the UDIP
- * function.
- * }
- *
- *
- * UDIPRead, UDIPWrite, UDIPPutStdOut, UDIPGetStdOut,
- * UDIPGetStderr, UDIPPutTrans and UDIPGetTrans differ from the other
- * UDIP functions in that they allow looping within the UDIP layer
- * call to the TIP. This looping is done so that the size of the
- * real mode buffer area does not limit the size of the data transfer
- * since all data passed by reference *must* be copied into the real
- * mode buffer area and the TIP can only return as much information
- * as can fit in this real mode buffer (unlike the situation for a
- * real mode DFE where the DFE and the TIP write to the same memory).
- *
- * The calls all use the same logic, outlined below:
- *
- *
- * Set the CurrentCount equal to the total number of items to
- * be transfered (CurrentCount = *Count).
- *
- * Set the total number of items transfered so far to zero (TotalDone = 0)
- *
- * Set up moving pointers into the From and To transfer areas to keep
- * track of where the current transfer should be read and/or written.
- * (CurrentTo = To; CurrentFrom = From)
- *
- * do
- * Set a pointer to the end of the memory that would be required
- * to do the complete transfer.
- *
- * If the pointer is outside of the buffer area (determined by
- * call the BufferSizeCheck), then we need to adjust the
- * size of the requested transfer.
- *
- * Set the pointer to the last item to the last valid location
- * in the real mode buffer area.
- *
- * Set the value of CurrentCount to the maximum number of data
- * items that can be transfered, based on the Size parameter.
- *
- * Call the TIP function with CurrentCount instead of *Count,
- * CurrentTo instead of To and CurrentFrom instead of From.
- *
- * Set the CurrentDone equal to the CountDone returned by the
- * function call.
- *
- * Update the pointers into the From and To transfer areas to the
- * end of the just completed transfer (CurrentFrom += CurrentDone
- * * Size, CurrentTo += CurrentDone * Size)
- *
- * Increment the TotalDone by the number of items transfered in
- * the last call (TotalDone += CurrentDone)
- *
- * while transfer is not complete (TotalDone < *Count)
- *
- */
-
-
-
-#define _DOS386C_C
-
-#include <dos.h>
-#include <process.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <udiproc.h>
-
-#include <pharlap.h>
-#include <udidos.h>
-#include <stdarg.h>
-
-
-#include <dos386c.h>
-
-
-#define REAL_BUFFER_SIZE 0x1000
-#define PRINT_ON 1
-#define PRINT_OFF 0
-
-#define WORDSIZE(param) ((sizeof(param)/2) + (sizeof(param) %2))
-
-#define REALCALL(x,y) _dx_call_real(x, &real_regs, WORDSIZE(y), y)
-
-#define FUNC_VAL ((UDIError) real_regs.eax)
-
-#define SIZE_ERROR(Done, Size, function_name) printf("Return size (%d) > Buffer size (%d) in function %s\n",Done,Size,function_name)
-
-/*
- * 4/93 MDT
- * The following defines are used to allow UDI 1.2 functions to identify
- * themselves to the compiler and the user when UDI 1.3 is defined. These
- * are needed to differentiate the 1.2 versions of some functions (UDIPConnect)
- * from their 1.3 versions.
- */
-#if defined __STDC__ || defined _MSC_VER
-#define XCAT(a,b) a##b
-#else
-#define XCAT(a,b) a/**/b
-#endif
-
-#ifdef UDI13
-
-#define UDI12FUNCVER _12
-#define UDI12FUNCVERSTR " (1.2)"
-#define CAT(a,b) XCAT(a,b)
-
-#else /* not UDI 1.3 */
-
-#define UDI12FUNCVER dummy /* Have to pass two arguments to CAT */
-#define UDI12FUNCVERSTR ""
-#define CAT(a,b) a /* Don't actually want to concatenate anything */
-
-#endif /* UDI 1.3 */
-
-
-/* Needed by call to _dx_real_call, but no values need to be set
- * since TIP is compiled assuming it doesn't know anything about the
- * values in the registers.
- */
-RMC_BLK real_regs;
-
-
-
-/* Pointers to use for handling conventional memory buffer area. This
- * area is used to pass parameters to and from real-mode procedures.
- */
-REALPTR rm_buffer_addr; /* real-mode pointer to parameter buffer area. */
-ULONG rm_buffer_size; /* size of paramter buffer area. */
-
-USHORT _far *rm_address; /* pointer to paramter buffer area. */
-USHORT _far *rm_end_address; /* the last valid address of the parameter buffer */
-
-
-int buffer_allocated=0; /* used to denote that the status of the buffer */
-
-
-
-
-REALPTR PROT_TO_REAL(FARPTR p) /* converts a PROT ptr to a REALPTR */
-{
-REALPTR dummyrp;
-FARPTR dummyfp;
-int err;
-
- /* returns a real mode pointer given a prot mode pointer p */
-
-// FP_SET(dummyfp,p,data_selector);
- dummyfp = p;
- err = _dx_toreal(dummyfp, 0, &dummyrp);
- if (err) {
- printf("Fatal Error _dx_toreal (0x%lX)\n", (ULONG) p);
- exit(err);
- }
- return(dummyrp);
-
-} /* PROT_TO_REAL */
-
-
-
-FARPTR REAL_TO_PROT(REALPTR rp) /* converts a REALPTR to a FARPTR */
-{
-FARPTR dummyfp;
-
- FP_SET(dummyfp,LINEARIZE(rp),SS_DOSMEM);
- return (dummyfp);
-
-} /* REAL_TO_PROT */
-
-
-
-FARPTR NEARPTR_TO_FARPTR(void *ptr)
-/* Convert a near (32 bit linear) pointer to a far (48 bit) pointer. */
-{
- FARPTR dummyfptr;
-
- FP_SET(dummyfptr, ptr, data_selector);
-
- return(dummyfptr);
-
-} /* NEARPTR_TO_FARPTR() */
-
-
-long BufferSizeCheck(FARPTR ptr, char *function_name, int print_message)
-/* Check passed ptr to make sure that it points to a valid location in
- * the real-mode parameter passing buffer. If not, just report an
- * error for now.
- */
-{
- if ((long)ptr < (long)rm_address) {
- printf("Invalid address for real mode parameters in function: %s\n",function_name);
- exit(1);
- }
- if ((long)ptr > (long)rm_end_address) {
- if (print_message) {
- printf("Parameters too large for passing to real mode in function: %s\n",function_name);
- printf("Value of ptr - rm_end_address:%ld\n",(long)(ptr - (FARPTR)rm_end_address));
- }
- return (long)((long)ptr - (long)rm_end_address);
- }
-
- return 0; /* passed the size check */
-
-} /* BufferSizeCheck() */
-
-
-void CheckRealError(int Err, char *func_name) {
-
- if (Err) {
- printf("DOS386 real mode call error: %s\n",func_name);
- exit(1);
- } /* if */
-
-} /* CheckRealError() */
-
-
-
-
-UDIError CAT(UDIPConnect,UDI12FUNCVER)(
- REALPTR UDIConnectAddr,
- char *Configuration, /* In */
- UDISessionId *Session, /* Out */
- DOSTerm _far *TermStruct) /* In */
-{
- int err;
- UDISessionId _far *SessionPtr;
- UDIError ConnectErr;
- USHORT rm_seg,rm_size;
-
- _Packed struct {
- REALPTR Configuration;
- REALPTR Session;
- REALPTR TermStruct;
- } params;
-
-
- if (!buffer_allocated) {
- /* Need to get address of conventional memory area for passing parameters.
- * This will set it for future use everywhere, not just in this function.
- * rm_address is the protected (32 bit) pointer to the real mode parameter.
- * passing area. rm_buffer_addr is the real mode pointer to the same buffer.
- */
- err = _dx_real_alloc(REAL_BUFFER_SIZE,&rm_seg,&rm_size);
-
- if (err) {
- printf("Unable to allocate real-mode parameter transfer area (_dx_real_alloc)\n");
- exit(0);
- }
- /* rm_seg is the real mode paragraph (segment).
- * Build rm_buffer_addr to be the full real mode pointer (seg:ofst)
- */
- RP_SET(rm_buffer_addr, 0, rm_seg);
- /*
- * rm_address will be the protected pointer to that same buffer
- */
- rm_address = (USHORT _far *)REAL_TO_PROT(rm_buffer_addr);
- rm_end_address = (USHORT _far *) (((char _far *)rm_address) + REAL_BUFFER_SIZE*16);
- buffer_allocated = 1;
- }
-
-
- /* Get pointers to locations where passed by reference parameters
- * will be stored in the parameter passing buffer area. The first
- * parameter is always at rm_buffer (= rm_buffer_addr in real mode).
- */
-
- /* NOTE: see comments under UDIPDisconnect for explanation of why
- * we don't copy TermStruct even though it's an in parameter.
- */
- SessionPtr = (UDISessionId _far *)((char _far *)rm_address + strlen(Configuration)+1);
-
- if (BufferSizeCheck((FARPTR)(SessionPtr + sizeof(UDISessionId)),"UDIPConnect" UDI12FUNCVERSTR,PRINT_ON)) {
- return UDIErrorIPCInternal;
- } /* if */
-
- /* Move input parameters which are passed by reference into paramter buffer area. */
- _fmemmove(rm_address,NEARPTR_TO_FARPTR(Configuration),strlen(Configuration)+1);
- _fmemmove(SessionPtr,NEARPTR_TO_FARPTR(Session),sizeof(UDISessionId));
-
-
- /* Put actual parameters into packed structure for passing to real
- * mode function.
- */
- params.Configuration = rm_buffer_addr;
- params.Session = PROT_TO_REAL((FARPTR) SessionPtr);
- params.TermStruct = PROT_TO_REAL((FARPTR)TermStruct);
-
-
- /* Call the real-mode function with the address of the function,
- * the number of bytes in the packed structure and the address of
- * the structure.
- */
-
- ConnectErr = REALCALL(UDIConnectAddr,params);
-
- CheckRealError(ConnectErr,"UDIConnect" UDI12FUNCVERSTR);
-
- /* Copy output parameters from parameter passing area back to protected space
- */
- _fmemmove(NEARPTR_TO_FARPTR(Session),SessionPtr,sizeof(UDISessionId));
-
-
- return FUNC_VAL;
-
-
-} /* UDIPConnect (UDI 1.2) */
-
-
-#ifdef UDI13
-
-/* 4/93 MDT - This function is needed only for UDI 1.3 and greater
- * implementations. This code should be checked when the
- * final specification for UDI 1.3 becomes available.
- */
-
-UDIError UDIPConnect_13(
- REALPTR UDIConnectAddr,
- char *Configuration, /* In */
- UDISessionId *Session, /* Out */
- DOSTerm *TermStruct, /* In */
- UDIUInt32 DFEIPCId, /* In 1.3 */
- UDIUInt32 *TIPIPCId, /* Out 1.3 */
- struct UDIDFEVecRec *DFEVecRec /* In 1.3 */
- )
-{
- int err;
- UDISessionId _far *SessionPtr;
- UDIUInt32 _far *TIPIPCIdPtr;
- UDIError ConnectErr;
- USHORT rm_seg,rm_size;
-
- _Packed struct {
- REALPTR Configuration;
- REALPTR Session;
- REALPTR TermStruct;
- UDIUInt32 DFEIPCId;
- REALPTR TIPIPCId;
- REALPTR DFEVecRec;
- } params;
-
-
- if (!buffer_allocated) {
- /* Need to get address of conventional memory area for passing parameters.
- * This will set it for future use everywhere, not just in this function.
- * rm_address is the protected (32 bit) pointer to the real mode parameter.
- * passing area. rm_buffer_addr is the real mode pointer to the same buffer.
- */
- err = _dx_real_alloc(REAL_BUFFER_SIZE,&rm_seg,&rm_size);
- if (err) {
- printf("Unable to allocate real-mode parameter transfer area (_dx_real_alloc)\n");
- exit(0);
- }
- /* rm_seg is the real mode paragraph (segment).
- * Build rm_buffer_addr to be the full real mode pointer (seg:ofst)
- */
- RP_SET(rm_buffer_addr, 0, rm_seg);
- /*
- * rm_address will be the protected pointer to that same buffer
- */
- rm_address = REAL_TO_PROT(rm_buffer_addr);
- rm_end_address = (USHORT *) (((char *)rm_address) + REAL_BUFFER_SIZE*16);
- buffer_allocated = 1;
- }
-
-
- /* Get pointers to locations where passed by reference parameters
- * will be stored in the parameter passing buffer area. The first
- * parameter is always at rm_buffer (= rm_buffer_addr in real mode).
- */
-
- /* NOTE: see comments under UDIPDisconnect for explanation of why
- * we don't copy TermStruct even though it's an in parameter.
- */
- SessionPtr = (UDISessionId _far *)((char _far *)rm_address + strlen(Configuration)+1);
- TIPIPCIdPtr = (UDIUInt32 _far *) (SessionPtr + sizeof(UDISessionId));
-
- if (BufferSizeCheck((FARPTR)(TIPIPCIdPtr + sizeof(UDIUInt32)),"UDIPConnect (1.3)")) {
- return UDIErrorIPCInternal;
- }
-
- /* Move input parameters which are passed by reference into paramter buffer area. */
- _fmemmove(rm_address,NEARPTR_TO_FARPTR(Configuration),strlen(Configuration)+1);
-
- /* Put actual parameters into packed structure for passing to real
- * mode function.
- */
- params.Configuration = rm_buffer_addr;
- params.Session = PROT_TO_REAL((FARPTR)SessionPtr);
- params.TermStruct = PROT_TO_REAL((FARPTR)TermStruct);
- params.DFEIPCId = DFEIPCId;
- params.TIPIPCId = PROT_TO_REAL(TIPIPCIdPtr);
- params.DFEVecRec = PROT_TO_REAL((FARPTR)DFEVecRec);
-
-
- /* Call the real-mode function with the address of the function,
- * the number of bytes in the packed structure and the address of
- * the structure.
- */
-
- ConnectErr = REALCALL(UDIConnectAddr,params);
-
- CheckRealError(ConnectErr,"UDIConnect (1.3)");
-
- /* Copy output parameters from parameter passing area back to protected space
- */
- _fmemmove(NEARPTR_TO_FARPTR(Session),SessionPtr,sizeof(UDISessionId));
- _fmemmove(NEARPTR_TO_FARPTR(TIPIPCId),TIPIPCIdPtr,sizeof(UDIUInt32));
-
- return FUNC_VAL;
-
-
-} /* UDIPConnect_13 */
-
-#endif /* UDI13 */
-
-
-#define TIPSTRLEN 80
-
-
-UDIError CAT(UDIPCapabilities,UDI12FUNCVER) (
- REALPTR UDICapabilitiesAddr,
- UDIUInt32 *TIPId, /* Out */
- UDIUInt32 *TargetId, /* Out */
- UDIUInt32 DFEId, /* In */
- UDIUInt32 DFE, /* In */
- UDIUInt32 *TIP, /* Out */
- UDIUInt32 *DFEIPCId, /* Out */
- UDIUInt32 *TIPIPCId, /* Out */
- char *TIPString /* Out */
- )
-{
- UDIUInt32 _far *TargetIdPtr;
- UDIUInt32 _far *TIPPtr;
- UDIUInt32 _far *DFEIPCIdPtr;
- UDIUInt32 _far *TIPIPCIdPtr;
- UDIUInt32 _far *TIPStringPtr;
- UDIUInt32 _far *endPtr;
- UDIError Err;
-
- /* Structure for passing parameters to real mode function in TIP */
- _Packed struct {
- REALPTR TIPId;
- REALPTR TargetId;
- UDIUInt32 DFEId;
- UDIUInt32 DFE;
- REALPTR TIP;
- REALPTR DFEIPCId;
- REALPTR TIPIPCId;
- REALPTR TIPString;
- } params;
-
-
- /* Get pointers to locations where passed by reference parameters
- * will be stored in the parameter passing buffer area. The first
- * parameter is always at rm_address.
- */
-
- TargetIdPtr = (UDIUInt32 _far *)((char _far *)rm_address + sizeof(UDIUInt32));
- TIPPtr = TargetIdPtr + sizeof(UDIUInt32);
- DFEIPCIdPtr = TIPPtr + sizeof(UDIUInt32);
- TIPIPCIdPtr = DFEIPCIdPtr + sizeof(UDIUInt32);
- TIPStringPtr = TIPIPCIdPtr + sizeof(UDIInt32);
- endPtr = TIPStringPtr + TIPSTRLEN;
-
- if (BufferSizeCheck((FARPTR)endPtr,"UDICapabilities" UDI12FUNCVERSTR,PRINT_ON)) {
- return UDIErrorIPCLimitation;
- } /* if */
-
- /* Move parameters into paramter buffer area. */
- _fmemmove(rm_address,NEARPTR_TO_FARPTR(TIPId),sizeof(UDIUInt32));
- _fmemmove(TargetIdPtr,NEARPTR_TO_FARPTR(TargetId),sizeof(UDIUInt32));
- _fmemmove(TIPPtr,NEARPTR_TO_FARPTR(TIP),sizeof(UDIUInt32));
- _fmemmove(DFEIPCIdPtr,NEARPTR_TO_FARPTR(DFEIPCId),sizeof(UDIUInt32));
- _fmemmove(TIPIPCIdPtr,NEARPTR_TO_FARPTR(TIPIPCId),sizeof(UDIInt32));
- _fmemmove(TIPStringPtr,NEARPTR_TO_FARPTR(TIPString),TIPSTRLEN);
-
-
- params.TIPId = rm_buffer_addr;
- params.TargetId = PROT_TO_REAL((FARPTR)TargetIdPtr);
- params.DFEId = DFEId;
- params.DFE = DFE;
- params.TIP = PROT_TO_REAL((FARPTR)TIPPtr);
- params.DFEIPCId = PROT_TO_REAL((FARPTR)DFEIPCIdPtr);
- params.TIPIPCId = PROT_TO_REAL((FARPTR)TIPIPCIdPtr);
- params.TIPString = PROT_TO_REAL((FARPTR)TIPStringPtr);
-
-
- Err = REALCALL(UDICapabilitiesAddr,params);
-
- CheckRealError(Err,"UDICapabilities" UDI12FUNCVERSTR);
-
- _fmemmove(NEARPTR_TO_FARPTR(TargetId),TargetIdPtr,sizeof(UDIUInt32));
- _fmemmove(NEARPTR_TO_FARPTR(TIP),TIPPtr,sizeof(UDIUInt32));
- _fmemmove(NEARPTR_TO_FARPTR(DFEIPCId),DFEIPCIdPtr,sizeof(UDIUInt32));
- _fmemmove(NEARPTR_TO_FARPTR(TIPIPCId),TIPIPCIdPtr,sizeof(UDIInt32));
- _fmemmove(NEARPTR_TO_FARPTR(TIPString),TIPStringPtr,TIPSTRLEN);
- _fmemmove(NEARPTR_TO_FARPTR(TIPId),(UDIUInt32 _far *)rm_address,sizeof(UDIUInt32));
-
- return FUNC_VAL;
-
-} /* UDIPCapabilities() */
-
-
-
-#ifdef UDI13
-
-/* UDI 1.3 version of UDIPCapabilities */
-UDIError UDIPCapabilities_13 (
- REALPTR UDICapabilitiesAddr,
- UDIUInt32 *TIPId, /* Out */
- UDIUInt32 *TargetId, /* Out */
- UDIUInt32 DFEId, /* In */
- UDIUInt32 DFE, /* In */
- UDIUInt32 *TIP, /* Out */
- UDIUInt32 *DFEIPCId, /* Out */
- UDIUInt32 *TIPIPCId, /* Out */
- char *TIPString, /* Out */
- UDISizeT BufSize, /* In 1.3 */
- UDISizeT *CountDone, /* Out 1.3 */
- UDISessionId connection_id
- )
-{
- UDIUInt32 _far *TargetIdPtr;
- UDIUInt32 _far *TIPPtr;
- UDIUInt32 _far *DFEIPCIdPtr;
- UDIUInt32 _far *TIPIPCIdPtr;
- UDIUInt32 _far *TIPStringPtr;
- UDIUInt32 _far *endPtr;
- UDISizeT *CountDonePtr;
- UDIError ConnectErr;
-
- /* Structure for passing parameters to real mode function in TIP */
- _Packed struct {
- REALPTR TIPId;
- REALPTR TargetId;
- UDIUInt32 DFEId;
- UDIUInt32 DFE;
- REALPTR TIP;
- REALPTR DFEIPCId;
- REALPTR TIPIPCId;
- REALPTR TIPString;
- UDISizeT BufSize;
- REALPTR CountDone;
- UDISessionId connection_id;
- } params;
-
-
- /* Get pointers to locations where passed by reference parameters
- * will be stored in the parameter passing buffer area. The first
- * parameter is always at rm_address.
- */
-
- TargetIdPtr = (UDIUInt32 _far *)((char _far *)rm_address + sizeof(UDIUInt32));
- TIPPtr = TargetIdPtr + sizeof(UDIUInt32);
- DFEIPCIdPtr = TIPPtr + sizeof(UDIUInt32);
- TIPIPCIdPtr = DFEIPCIdPtr + sizeof(UDIUInt32);
- TIPStringPtr = TIPIPCIdPtr + sizeof(UDIInt32);
- CountDonePtr = (UDISizeT _far *) (TIPStringPtr + strlen(TIPString) + 1);
- endPtr = (UDIUInt32 _far *) (CountDonePtr + sizeof(UDISizeT));
-
- if (BufferSizeCheck((FARPTR)endPtr,"UDICapabilities (1.3)",PRINT_ON) {
- return UDIErrorIPCLimitation;
- } /* if */
-
-
- /* Move parameters into paramter buffer area. */
- _fmemmove(rm_address,NEARPTR_TO_FARPTR(TIPId),sizeof(UDIUInt32)); /* TIPId */
- _fmemmove(TargetIdPtr, NEARPTR_TO_FARPTR(TargetId),sizeof(UDIUInt32));
- _fmemmove(TIPPtr, NEARPTR_TO_FARPTR(TIP),sizeof(UDIUInt32));
- _fmemmove(DFEIPCIdPtr, NEARPTR_TO_FARPTR(DFEIPCId),sizeof(UDIUInt32));
- _fmemmove(TIPIPCIdPtr, NEARPTR_TO_FARPTR(TIPIPCId),sizeof(UDIInt32));
- _fmemmove(TIPStringPtr, NEARPTR_TO_FARPTR(TIPString),strlen(TIPString)+1);
- _fmemmove(CountDonePtr, NEARPTR_TO_FARPTR(CountDone),sizeof(UDISizeT));
-
-
- params.TIPId = rm_buffer_addr;
- params.TargetId = PROT_TO_REAL((FARPTR)TargetIdPtr);
- params.DFEId = DFEId;
- params.DFE = DFE;
- params.TIP = PROT_TO_REAL((FARPTR)TIPPtr);
- params.DFEIPCId = PROT_TO_REAL((FARPTR)DFEIPCIdPtr);
- params.TIPIPCId = PROT_TO_REAL((FARPTR)TIPIPCIdPtr);
- params.TIPString = PROT_TO_REAL((FARPTR)TIPStringPtr);
- params.BufSize = BufSize;
- params.CountDone = PROT_TO_REAL((FARPTR)CountDonePtr);
- params.connection_id = connection_id;
-
-
- ConnectErr = REALCALL(UDICapabilitiesAddr,params);
-
- CheckRealError(ConnectErr,"UDICapabilities (1.3)");
-
-
- _fmemmove(NEARPTR_TO_FARPTR(TIPId), rm_address, sizeof(UDIUInt32));
- _fmemmove(NEARPTR_TO_FARPTR(TargetId), TargetIdPtr, sizeof(UDIUInt32));
- _fmemmove(NEARPTR_TO_FARPTR(TIP), TIPPtr, sizeof(UDIUInt32));
- _fmemmove(NEARPTR_TO_FARPTR(DFEIPCId), DFEIPCIdPtr, sizeof(UDIUInt32));
- _fmemmove(NEARPTR_TO_FARPTR(TIPIPCId), TIPIPCIdPtr, sizeof(UDIInt32));
- _fmemmove(NEARPTR_TO_FARPTR(TIPString), TIPStringPtr, strlen(TIPString)+1);
- _fmemmove(NEARPTR_TO_FARPTR(CountDone), CountDonePtr, sizeof(CountDone));
-
- if (*CountDone <= BufSize)
- _fmemmove(NEARPTR_TO_FARPTR(TIPString),TIPStringPtr,*CountDone);
- else {
- _fmemmove(NEARPTR_TO_FARPTR(TIPString),TIPStringPtr,BufSize);
- SIZE_ERROR(*CountDone, BufSize, "UDIPCapabilities (1.3)");
- }
-
-
-
- return FUNC_VAL;
-
-} /* UDIPCapabilities_13() */
-
-#endif /* UDI13 */
-
-
-UDIError UDIPGetErrorMsg(
- REALPTR UDIGetErrorMessageAddr,
- UDIError ErrorCode, /* In */
- UDISizeT MsgSize, /* In */
- char *Msg, /* Out */
- UDISizeT *CountDone /* Out */
- )
-{
- UDIError Err;
- UDISizeT _far *CountDonePtr;
- long Buffer_Adjustment;
-
- _Packed struct {
- UDIError ErrorCode;
- UDISizeT MsgSize;
- REALPTR Msg;
- REALPTR CountDone;
- } params;
-
-
- CountDonePtr = (UDISizeT _far *)(rm_address + MsgSize);
-
- if ((Buffer_Adjustment = BufferSizeCheck((FARPTR)(CountDonePtr + sizeof(UDISizeT)),"UDIPGetErrorMsg",PRINT_ON))) {
- if (MsgSize <= Buffer_Adjustment)
- return UDIErrorIPCLimitation;
- MsgSize -= Buffer_Adjustment;
- } /* if */
-
- /* Don't need to copy anything into the real mode parameter
- * buffer area for this call since there are no pointer "in"
- * parameters.
- */
-
- params.ErrorCode = ErrorCode;
- params.MsgSize = MsgSize;
- params.Msg = rm_buffer_addr;
- params.CountDone = PROT_TO_REAL((FARPTR)CountDonePtr);
-
- Err = REALCALL(UDIGetErrorMessageAddr,params);
-
- CheckRealError(Err,"UDIGetErrorMessage");
-
- _fmemmove(NEARPTR_TO_FARPTR(CountDone),CountDonePtr,sizeof(UDISizeT));
- if (*CountDone <= MsgSize)
- _fmemmove(NEARPTR_TO_FARPTR(Msg),rm_address,*CountDone);
- else {
- _fmemmove(NEARPTR_TO_FARPTR(Msg),rm_address,MsgSize);
- SIZE_ERROR(*CountDone, MsgSize, "UDIPGetErrorMessage");
- }
-
- return FUNC_VAL;
-
-} /* UDIPGetErrorMessage */
-
-
-
-UDIError UDIPSetCurrentConnection(
- REALPTR UDISetCurrentConnectionAddr,
- UDISessionId Session /* In */
- )
-{
- UDIError Err;
-
- Err = REALCALL(UDISetCurrentConnectionAddr,Session);
-
- CheckRealError(Err,"UDISetCurrentConnection");
-
- return FUNC_VAL;
-
-} /* UDIPSetCurrentConnection() */
-
-
-
-UDIError UDIPDisconnect(
- REALPTR UDIDisconnectAddr,
- UDISessionId Session, /* In */
- UDIBool Terminate, /* In */
- DOSTerm _far *TermStruct /* In */
- )
-{
- UDIError Err;
- DOSTerm t;
-
- _Packed struct {
- UDISessionId Session;
- UDIBool Terminate;
- REALPTR Term;
- } params;
-
- _fmemmove(NEARPTR_TO_FARPTR(&t),TermStruct,sizeof(TermStruct));
-
- /* The only pointer to be passed is a pointer to TermStruct
- * but since TermStruct is already in real memory, we do
- * not want to copy it (The TIP must store its registers into
- * the original TermStruct, not the copy)
- */
-
- /* For this call just need to pack everything into a structure,
- * then do the call since there are no "out" parameters and no
- * pointers to "in" parameters.
- */
- params.Session = Session;
- params.Terminate = Terminate;
- params.Term = PROT_TO_REAL((FARPTR)TermStruct); /* just convert to real */
-
- Err = REALCALL(UDIDisconnectAddr,params);
-
- CheckRealError(Err,"UDIDisconnect");
-
- return FUNC_VAL;
-
-} /* UDIPDisconnect() */
-
-
-
-UDIError UDIPGetTargetConfig(
- REALPTR UDIGetTargetConfigAddr,
- UDIMemoryRange KnownMemory[], /* Out */
- UDIInt *NumberOfRanges, /* In/Out */
- UDIUInt32 ChipVersions[], /* Out */
- UDIInt *NumberOfChips /* In/Out */
- )
-{
- _Packed struct {
- REALPTR KnownMemory;
- REALPTR NumberOfRanges;
- REALPTR ChipVersions;
- REALPTR NumberOfChips;
- } params;
-
- UDIError Err;
- UDIInt _far *NumberOfRangesPtr;
- UDIUInt32 _far *ChipVersionsPtr;
- UDIInt _far *NumberOfChipsPtr;
-
- /* Get addresses in parameter passing buffer to store parameters
- * which are passed-by-reference.
- */
- NumberOfRangesPtr = (UDIInt _far *) (rm_address + *NumberOfRanges * sizeof(UDIMemoryRange));
- ChipVersionsPtr = (UDIUInt32 _far *) (NumberOfRangesPtr + sizeof(UDIInt));
- NumberOfChipsPtr = (UDIInt _far *) (ChipVersionsPtr + *NumberOfChips * sizeof(UDIUInt32));
-
-
-
- if (BufferSizeCheck((FARPTR)(NumberOfChipsPtr + sizeof(UDIInt)),"UDIPGetTargetConfig",PRINT_ON)) {
- return UDIErrorIPCLimitation;
- } /* if */
-
- /* Copy parameters which are passed-by-reference to parameter
- * passing buffer. Only "In" data needs to be copied.
- */
- _fmemmove(NumberOfRangesPtr,NEARPTR_TO_FARPTR(NumberOfRanges),sizeof(UDIInt));
- _fmemmove(NumberOfChipsPtr,NEARPTR_TO_FARPTR(NumberOfChips),sizeof(UDIInt));
-
- /* Put data into packed structure. */
- params.KnownMemory = rm_buffer_addr;
- params.NumberOfRanges = PROT_TO_REAL((FARPTR)NumberOfRangesPtr);
- params.ChipVersions = PROT_TO_REAL((FARPTR)ChipVersionsPtr);
- params.NumberOfChips = PROT_TO_REAL((FARPTR)NumberOfChipsPtr);
-
- Err = REALCALL(UDIGetTargetConfigAddr,params);
-
- CheckRealError(Err,"UDIGetTargetConfig");
-
- /* Put data back into protected mode program address. */
- _fmemmove(NEARPTR_TO_FARPTR(KnownMemory),rm_address,*NumberOfRanges * sizeof(UDIMemoryRange));
- _fmemmove(NEARPTR_TO_FARPTR(NumberOfRanges),NumberOfRangesPtr, sizeof(UDIInt));
- _fmemmove(NEARPTR_TO_FARPTR(ChipVersions), ChipVersionsPtr, *NumberOfChips * sizeof(UDIUInt32));
- _fmemmove(NEARPTR_TO_FARPTR(NumberOfChips), NumberOfChipsPtr, sizeof(UDIInt));
-
- return FUNC_VAL;
-
-} /* UDIPGetTargetConfig() */
-
-
-
-UDIError UDIPCreateProcess(
- REALPTR UDICreateProcessAddr,
- UDIPId *PId /* Out */
- )
-{
- UDIError Err;
-
-
- if (BufferSizeCheck((FARPTR)(rm_address + sizeof(UDIPId)),"UDIPCreateProcess",PRINT_ON)) {
- return UDIErrorIPCLimitation;
- } /* if */
-
- /* Copy passed-by-reference information to parameter passing buffer. */
- _fmemmove(rm_address,NEARPTR_TO_FARPTR(PId),sizeof(UDIPId));
-
- /* Don't need to create structure since there is only one parameter. */
- Err = REALCALL(UDICreateProcessAddr,rm_buffer_addr);
-
- CheckRealError(Err,"UDICreateProcess");
-
- /* Copy "out" data back to protected mode program address. */
- _fmemmove(NEARPTR_TO_FARPTR(PId),rm_address,sizeof(UDIPId));
-
- return FUNC_VAL;
-
-} /* UDIPCreateProcess() */
-
-
-
-UDIError UDIPSetCurrentProcess(
- REALPTR UDISetCurrentProcessAddr,
- UDIPId PId /* In */
- )
-{
- UDIError Err;
-
-
- Err = REALCALL(UDISetCurrentProcessAddr,PId);
-
- CheckRealError(Err,"UDISetCurrentProcess");
-
- return FUNC_VAL;
-
-} /* UDIPSetCurrentProcess() */
-
-
-
-UDIError UDIPInitializeProcess(
- REALPTR UDIInitializeProcessAddr,
- UDIMemoryRange ProcessMemory[], /* In */
- UDIInt NumberOfRanges, /* In */
- UDIResource EntryPoint, /* In */
- CPUSizeT *StackSizes, /* In */
- UDIInt NumberOfStacks, /* In */
- char *ArgString /* In */
- )
-{
- _Packed struct {
- REALPTR ProcessMemory;
- UDIInt NumberOfRanges;
- UDIResource EntryPoint;
- REALPTR StackSizes;
- UDIInt NumberOfStacks;
- REALPTR ArgString;
- } params;
-
- /* Pointers to variables stored in the parameter passing buffer. */
- CPUSizeT _far *StackSizesPtr;
- char _far *ArgStringPtr;
- UDIError Err;
-
-
- StackSizesPtr = (CPUSizeT _far *) (rm_address + NumberOfRanges*sizeof(UDIMemoryRange));
- ArgStringPtr = (char _far *) (StackSizesPtr + NumberOfStacks * sizeof(CPUSizeT));
-
- if (BufferSizeCheck((FARPTR)(ArgStringPtr + strlen(ArgString) + 1),"UDIPInitializeProcess",PRINT_ON)) {
- return UDIErrorIPCLimitation;
- } /* if */
-
- /* Move things passed by reference into the parameter passing buffer. */
- _fmemmove(rm_address,NEARPTR_TO_FARPTR(ProcessMemory),NumberOfRanges*sizeof(UDIMemoryRange));
- _fmemmove(StackSizesPtr,NEARPTR_TO_FARPTR(StackSizes),NumberOfStacks * sizeof(CPUSizeT));
- _fmemmove(ArgStringPtr, NEARPTR_TO_FARPTR(ArgString), strlen(ArgString)+1);
-
- /* Fill the packed array for passing to the real mode function. */
- params.ProcessMemory = rm_buffer_addr;
- params.NumberOfRanges = NumberOfRanges;
- params.EntryPoint = EntryPoint;
- params.StackSizes = PROT_TO_REAL((FARPTR)StackSizesPtr);
- params.NumberOfStacks = NumberOfStacks;
- params.ArgString = PROT_TO_REAL((FARPTR)ArgStringPtr);
-
- /* Call the real mode function. */
- Err = REALCALL(UDIInitializeProcessAddr,params);
-
- CheckRealError(Err,"UDIInitializeProcess");
-
- /* Don't need to copy anything back since all of the parameters are
- * "in" only.
- */
-
- return FUNC_VAL;
-
-} /* UDIPInitializeProcess() */
-
-
-
-UDIError UDIPDestroyProcess(
- REALPTR UDIDestroyProcessAddr,
- UDIPId PId /* In */
- )
-{
-
- UDIError Err;
-
- Err = REALCALL(UDIDestroyProcessAddr,PId);
-
- CheckRealError(Err,"UDIDestroyProcess");
-
- return FUNC_VAL;
-
-} /* UDIPDestroyProcess() */
-
-
-
-UDIError UDIPRead(
- REALPTR UDIReadAddr,
- UDIResource From, /* In */
- UDIHostMemPtr To, /* Out */
- UDICount Count, /* In */
- UDISizeT Size, /* In */
- UDICount *CountDone, /* Out */
- UDIBool HostEndian /* In */
- )
-{
- _Packed struct {
- UDIResource From;
- REALPTR To;
- UDICount Count;
- UDISizeT Size;
- REALPTR CountDone;
- UDIBool HostEndian;
- } params;
-
- UDIError Err;
- UDICount _far *CountDonePtr;
-
- /* Looping control variables */
- UDICount TotalDone=0; /* Total number of items xfered so far */
- UDICount CurrentCount; /* Number of items to be xfered this pass */
- UDIResource CurrentFrom; /* Current pointer into From area */
- char * CurrentTo; /* Current pointer into To area */
- UDICount BufAdjust; /* size of buffer overflow in bytes */
- UDICount CurrentDone; /* The actual number of items xfered this pass */
-
-
- CurrentTo = (char *) To;
- CurrentFrom = From;
- CurrentCount = Count;
- do {
- CountDonePtr = (UDICount _far *) (rm_address + CurrentCount * Size);
-
- /* Check to see if transfer needs to be broken into smaller pieces */
- BufAdjust = BufferSizeCheck((FARPTR)(CountDonePtr + sizeof(UDICount)),"UDIPRead",PRINT_OFF);
- if (BufAdjust) {
- CurrentCount = (rm_end_address - rm_address - sizeof(UDICount)) / Size ;
- CountDonePtr = (UDICount _far *) (rm_end_address - sizeof(UDICount));
- }
-
- /* Copy parameters into packed structure. */
- params.From = CurrentFrom;
- params.To = rm_buffer_addr;
- params.Count = CurrentCount;
- params.Size = Size;
- params.CountDone = PROT_TO_REAL((FARPTR)CountDonePtr);
- params.HostEndian = HostEndian;
-
- Err = REALCALL(UDIReadAddr,params);
-
- CheckRealError(Err,"UDIRead");
-
- _fmemmove(NEARPTR_TO_FARPTR(&CurrentDone),CountDonePtr,sizeof(UDICount));
-
- /* Increment the TotalDone by the actual number of items xfered as
- * returned from the function.
- */
- TotalDone += CurrentDone;
-
- if ((CurrentDone <= CurrentCount) && (CurrentDone >= 0))
- _fmemmove(NEARPTR_TO_FARPTR(CurrentTo),rm_address,CurrentDone * Size);
- else {
- _fmemmove(NEARPTR_TO_FARPTR(CurrentTo),rm_address, CurrentCount * Size);
- SIZE_ERROR(CurrentDone, CurrentCount, "UDIPRead");
- }
-
- /* Update looping variables for possible next pass */
- CurrentFrom.Offset += CurrentCount * Size;
- CurrentTo += CurrentCount * Size;
- CurrentCount = Count - TotalDone;
-
- } while ((TotalDone < Count) & (FUNC_VAL == UDINoError));
-
- *CountDone = TotalDone;
-
- return FUNC_VAL;
-
-} /* UDIPRead() */
-
-
-UDIError UDIPWrite(
- REALPTR UDIWriteAddr,
- UDIHostMemPtr From, /* In */
- UDIResource To, /* In */
- UDICount Count, /* In */
- UDISizeT Size, /* In */
- UDICount *CountDone, /* Out */
- UDIBool HostEndian /* In */
- )
-{
- _Packed struct {
- REALPTR From;
- UDIResource To;
- UDICount Count;
- UDISizeT Size;
- REALPTR CountDone;
- UDIBool HostEndian;
- } params;
-
- UDIError Err;
- UDICount _far *CountDonePtr;
-
- /* Looping control variables */
- UDICount TotalDone=0; /* Total number of items xfered so far */
- UDICount CurrentCount; /* Number of items to be xfered this pass */
- char * CurrentFrom; /* Current pointer into From area */
- UDIResource CurrentTo; /* Current pointer into To area */
- UDICount BufAdjust; /* size of buffer overflow in bytes */
- UDICount CurrentDone; /* The actual number of items xfered this pass */
-
-
- CurrentTo = To;
- CurrentFrom = (char *) From;
- CurrentCount = Count;
-
- do {
- CountDonePtr = (UDICount _far *) (rm_address + Size * Count);
-
- /* Check to see if transfer needs to be broken into smaller pieces. */
- BufAdjust = BufferSizeCheck((FARPTR)(CountDonePtr + sizeof(UDICount)),"UDIPWrite",PRINT_ON);
- if (BufAdjust) {
- CurrentCount = (rm_end_address - rm_address - sizeof(UDICount)) / Size;
- CountDonePtr = (UDICount _far *) (rm_end_address - sizeof(UDICount));
- } /* if */
-
- /* Move data passed by reference into the parameter passing buffer
- * area in conventional memory.
- */
- _fmemmove(rm_address, NEARPTR_TO_FARPTR(CurrentFrom), Size * CurrentCount);
-
- /* Move data to packed structure for passing to real mode function. */
- params.From = rm_buffer_addr;
- params.To = CurrentTo;
- params.Count = CurrentCount;
- params.Size = Size;
- params.CountDone = PROT_TO_REAL((FARPTR)CountDonePtr);
- params.HostEndian = HostEndian;
-
- Err = REALCALL(UDIWriteAddr,params);
-
- CheckRealError(Err,"UDIWrite");
-
- /* Move "out" data back into protected mode memory area. */
- _fmemmove(NEARPTR_TO_FARPTR(&CurrentDone),CountDonePtr,sizeof(UDICount));
-
- /* Increment the ToralDone by the actual number of items xfered as
- * returned from the function.
- */
- TotalDone += CurrentDone;
-
- /* Update looping variables for possible next pass */
- CurrentFrom += CurrentCount * Size;
- CurrentTo.Offset += CurrentCount * Size;
- CurrentCount = Count - TotalDone;
-
- } while ((TotalDone < Count) & (FUNC_VAL == UDINoError));
-
- /* Return the total number of items xfered */
- *CountDone = TotalDone;
-
- return FUNC_VAL;
-
-} /* UDIPWrite() */
-
-
-UDIError UDIPCopy(
- REALPTR UDICopyAddr,
- UDIResource From, /* In */
- UDIResource To, /* In */
- UDICount Count, /* In */
- UDISizeT Size, /* In */
- UDICount *CountDone, /* Out */
- UDIBool Direction /* In */
- )
-{
- _Packed struct {
- UDIResource From;
- UDIResource To;
- UDICount Count;
- UDISizeT Size;
- REALPTR CountDone;
- UDIBool Direction;
- } params;
-
- UDIError Err;
-
- /* Copy data into packed structure for passing to real mode funciton. */
- params.From = From;
- params.To = To;
- params.Count = Count;
- params.Size = Size;
- params.CountDone= rm_buffer_addr;
- params.Direction= Direction;
-
- Err = REALCALL(UDICopyAddr,params);
-
- CheckRealError(Err,"UDICopy");
-
- _fmemmove(NEARPTR_TO_FARPTR(CountDone), rm_address, sizeof(UDICount));
-
- return FUNC_VAL;
-
-} /* UDIPCopy() */
-
-
-
-UDIError UDIPExecute(
- REALPTR UDIExecuteAddr
- )
-{
- UDIError Err;
-
- Err = _dx_call_real(UDIExecuteAddr, &real_regs, 0);
-
- CheckRealError(Err,"UDIExecute");
-
- return FUNC_VAL;
-
-} /* UDIPExecute() */
-
-
-
-UDIError UDIPStep(
- REALPTR UDIStepAddr,
- UDIUInt32 Steps, /* In */
- UDIStepType StepType, /* In */
- UDIRange Range /* In */
- )
-{
- UDIError Err;
-
- _Packed struct {
- UDIUInt32 Steps;
- UDIStepType StepType;
- UDIRange Range;
- } params;
-
- /* Since nothing is passed by reference, don't need to use
- * buffer transfer area.
- */
-
- /* Copy passed parameters into packed structure */
- params.Steps = Steps;
- params.StepType = StepType;
- params.Range = Range;
-
- Err = REALCALL(UDIStepAddr,params);
-
- CheckRealError(Err,"UDIStep");
-
- return FUNC_VAL;
-
-} /* UDIPStep() */
-
-
-
-UDIError UDIPStop(
- REALPTR UDIStopAddr
- )
-{
- UDIError Err;
-
- Err = _dx_call_real(UDIStopAddr, &real_regs, 0);
-
- CheckRealError(Err,"UDIStop");
-
- return FUNC_VAL;
-
-} /* UDIPStop() */
-
-
-
-UDIError UDIPWait(
- REALPTR UDIWaitAddr,
- UDIInt32 MaxTime, /* In */
- UDIPId *PId, /* Out */
- UDIUInt32 *StopReason /* Out */
- )
-{
- UDIError Err;
- UDIUInt32 _far *StopReasonPtr;
-
- _Packed struct {
- UDIInt32 MaxTime;
- REALPTR PId;
- REALPTR StopReason;
- } params;
-
- /* Since only "out" parameters are passed by reference, don't
- * need to copy anything into the parameter passing buffer before
- * the call. Do need to set up pointer for StopReason though.
- */
- StopReasonPtr = (UDIUInt32 _far *) (rm_address + sizeof(UDIPId));
-
- if (BufferSizeCheck((FARPTR)(StopReasonPtr + sizeof(UDIUInt32)),"UDIPWait",PRINT_ON)) {
- return UDIErrorIPCLimitation;
- } /* if */
-
- params.MaxTime = MaxTime;
- params.PId = rm_buffer_addr;
- params.StopReason = PROT_TO_REAL((FARPTR)StopReasonPtr);
-
- Err = REALCALL(UDIWaitAddr,params);
-
- CheckRealError(Err,"UDIWait");
-
- /* Need to copy "out" parameter data back into protected mode
- * address space.
- */
- _fmemmove(NEARPTR_TO_FARPTR(PId),rm_address,sizeof(UDIPId));
- _fmemmove(NEARPTR_TO_FARPTR(StopReason),StopReasonPtr,sizeof(UDIUInt32));
-
- return FUNC_VAL;
-
-} /* UDIPWait() */
-
-
-
-UDIError UDIPSetBreakpoint(
- REALPTR UDISetBreakpointAddr,
- UDIResource Addr, /* In */
- UDIInt32 PassCount, /* In */
- UDIBreakType Type, /* In */
- UDIBreakId *BreakId /* Out */
- )
-{
- UDIError Err;
-
- _Packed struct {
- UDIResource Addr;
- UDIInt32 PassCount;
- UDIBreakType Type;
- REALPTR BreakId;
- } params;
-
- if (BufferSizeCheck((FARPTR)(rm_address + sizeof(UDIBreakId)),"UDIPSetBreakpoint",PRINT_ON)) {
- return UDIErrorIPCLimitation;
- } /* if */
-
- /* Since only "out" parameters are passed by reference, don't
- * need to copy anything into the parameter passing buffer before
- * the call.
- */
- params.Addr = Addr;
- params.PassCount = PassCount;
- params.Type = Type;
- params.BreakId = rm_buffer_addr;
-
- Err = REALCALL(UDISetBreakpointAddr,params);
-
- CheckRealError(Err,"UDISetBreakpoint");
-
- /* Need to copy "out" parameter data back into protected mode
- * address space.
- */
- _fmemmove(NEARPTR_TO_FARPTR(BreakId),rm_address,sizeof(UDIBreakId));
-
- return FUNC_VAL;
-
-} /* UDIPSetBreakpoint() */
-
-
-
-UDIError UDIPQueryBreakpoint(
- REALPTR UDIQueryBreakpointAddr,
- UDIBreakId BreakId, /* In */
- UDIResource *Addr, /* Out */
- UDIInt32 *PassCount, /* Out */
- UDIBreakType *Type, /* Out */
- UDIInt32 *CurrentCount /* Out */
- )
-{
- UDIError Err;
- UDIInt32 _far *PassCountPtr;
- UDIBreakType _far *TypePtr;
- UDIInt32 _far *CurrentCountPtr;
-
- _Packed struct {
- UDIBreakId BreakId;
- REALPTR Addr;
- REALPTR PassCount;
- REALPTR Type;
- REALPTR CurrentCount;
- } params;
-
- /* Since all passed-by-reference variables are "out", don't need
- * to copy data to parameter passing buffer. Do need to set up
- * pointers for real-mode function to use though.
- */
- PassCountPtr = (UDIInt32 _far *) (rm_address + sizeof(UDIResource));
- TypePtr = (UDIBreakType _far *) (PassCountPtr + sizeof(UDIInt32));
- CurrentCountPtr = (UDIInt32 _far *) (TypePtr + sizeof(UDIBreakType));
-
- if (BufferSizeCheck((FARPTR)(CurrentCountPtr + sizeof(UDIBreakType)),"UDIPQueryBreakpoint",PRINT_ON)) {
- return UDIErrorIPCLimitation;
- } /* if */
-
- params.BreakId = BreakId;
- params.Addr = rm_buffer_addr;
- params.PassCount = PROT_TO_REAL((FARPTR)PassCountPtr);
- params.Type = PROT_TO_REAL((FARPTR)TypePtr);
- params.CurrentCount = PROT_TO_REAL((FARPTR)CurrentCountPtr);
-
- Err = REALCALL(UDIQueryBreakpointAddr,params);
-
- CheckRealError(Err,"UDIQueryBreakpoint");
-
- /* Copy returned values back into protected mode variables. */
- _fmemmove(NEARPTR_TO_FARPTR(Addr),rm_address,sizeof(UDIResource));
- _fmemmove(NEARPTR_TO_FARPTR(PassCount),PassCountPtr,sizeof(UDIInt32));
- _fmemmove(NEARPTR_TO_FARPTR(Type),TypePtr,sizeof(UDIBreakType));
- _fmemmove(NEARPTR_TO_FARPTR(CurrentCount),CurrentCountPtr,sizeof(UDIInt32));
-
- return FUNC_VAL;
-
-} /* UDIPQueryBreakpoint() */
-
-
-
-UDIError UDIPClearBreakpoint(
- REALPTR UDIClearBreakpointAddr,
- UDIBreakId BreakId /* In */
- )
-{
- UDIError Err;
-
- /* Don't need packed structure since only one parameter is passed. */
-
- Err = REALCALL(UDIClearBreakpointAddr,BreakId);
-
- CheckRealError(Err,"UDIClearBreakpoint");
-
- return FUNC_VAL;
-
-} /* UDIPClearBreakpoint() */
-
-
-
-
-UDIError UDIPGetStdout(
- REALPTR UDIGetStdoutAddr,
- UDIHostMemPtr Buf, /* Out */
- UDISizeT BufSize, /* In */
- UDISizeT *CountDone /* Out */
- )
-{
- UDIError Err;
- UDISizeT _far *CountDonePtr;
-
- char * CurrentTo;
- UDISizeT TotalDone = 0;
- UDISizeT CurrentCount;
- UDISizeT CurrentDone = 0;
- long BufAdjust;
-
- _Packed struct {
- REALPTR Buf;
- UDISizeT BufSize;
- REALPTR CountDone;
- } params;
-
- CurrentCount = BufSize;
- CurrentTo = (char *) Buf;
-
- do {
- CountDonePtr = (UDISizeT _far *) (rm_address + CurrentCount);
-
- BufAdjust = BufferSizeCheck((FARPTR)(CountDonePtr + sizeof(UDISizeT)),"UDIPGetStdout",PRINT_ON);
- if (BufAdjust) {
- CurrentCount = (rm_end_address - rm_address - sizeof(UDISizeT));
- CountDonePtr = (UDISizeT _far * ) (rm_end_address - sizeof(UDISizeT));
- } /* if */
-
- params.Buf = rm_buffer_addr;
- params.BufSize = CurrentCount;
- params.CountDone = PROT_TO_REAL((FARPTR)CountDonePtr);
-
- Err = REALCALL(UDIGetStdoutAddr,params);
-
- CheckRealError(Err,"UDIGetStdout");
-
- /* Copy returned values back into protected mode variables. */
- _fmemmove(NEARPTR_TO_FARPTR(&CurrentDone),CountDonePtr,sizeof(UDISizeT));
-
- TotalDone += CurrentDone;
-
- if (CurrentDone <= CurrentCount)
- _fmemmove(NEARPTR_TO_FARPTR(CurrentTo),rm_address,CurrentDone);
- else {
- _fmemmove(NEARPTR_TO_FARPTR(CurrentTo),rm_address,CurrentDone);
- SIZE_ERROR(*CountDone, BufSize, "UDIPGetStdout");
- }
-
- /* Update looping variables for possible next pass */
- CurrentTo += CurrentDone;
-
-
- } while ((TotalDone < BufSize) & (CurrentDone == CurrentCount)
- & (FUNC_VAL == UDINoError));
-
- *CountDone = TotalDone;
-
- return FUNC_VAL;
-
-} /* UDIPGetStdout() */
-
-
-
-UDIError UDIPGetStderr(
- REALPTR UDIGetStderrAddr,
- UDIHostMemPtr Buf, /* Out */
- UDISizeT BufSize, /* In */
- UDISizeT *CountDone /* Out */
- )
-{
- UDIError Err;
- UDISizeT _far *CountDonePtr;
- long Buffer_Adjustment;
-
- _Packed struct {
- REALPTR Buf;
- UDISizeT BufSize;
- REALPTR CountDone;
- } params;
-
- /* Since all passed-by-reference variables are "out", don't need
- * to copy data to parameter passing buffer. Do need to set up
- * pointers for real-mode function to use though.
- */
- CountDonePtr = (UDISizeT _far *) (rm_address + BufSize);
-
- if ((Buffer_Adjustment = BufferSizeCheck((FARPTR)(CountDonePtr + sizeof(UDISizeT)),"UDIPGetStderr",PRINT_ON))) {
- if (BufSize <= Buffer_Adjustment)
- return UDIErrorIPCLimitation;
- BufSize -= Buffer_Adjustment;
- } /* if */
-
- params.Buf = rm_buffer_addr;
- params.BufSize = BufSize;
- params.CountDone = PROT_TO_REAL((FARPTR)CountDonePtr);
-
- Err = REALCALL(UDIGetStderrAddr,params);
-
- CheckRealError(Err,"UDIGetStderr");
-
- /* Copy returned values back into protected mode variables. */
- _fmemmove(NEARPTR_TO_FARPTR(CountDone),CountDonePtr,sizeof(UDISizeT));
- if (*CountDone <= BufSize)
- _fmemmove(NEARPTR_TO_FARPTR(Buf),rm_address,*CountDone);
- else {
- _fmemmove(NEARPTR_TO_FARPTR(Buf),rm_address,BufSize);
- SIZE_ERROR(*CountDone, BufSize, "UDIPGetStderr");
- }
-
- return FUNC_VAL;
-
-} /* UDIPGetStderr() */
-
-
-
-UDIError UDIPPutStdin(
- REALPTR UDIPutStdinAddr,
- UDIHostMemPtr Buf, /* In */
- UDISizeT Count, /* In */
- UDISizeT *CountDone /* Out */
- )
-{
- UDIError Err;
- UDISizeT _far *CountDonePtr;
- long Buffer_Adjustment;
-
- _Packed struct {
- REALPTR Buf;
- UDISizeT Count;
- REALPTR CountDone;
- } params;
-
- /* Get pointers to passed-by-reference variables in parameter
- * passing buffer.
- */
- CountDonePtr = (UDISizeT _far *) (rm_address + Count);
-
- if ((Buffer_Adjustment = BufferSizeCheck((FARPTR)(CountDonePtr + sizeof(UDISizeT)),"UDIPPutStdin",PRINT_ON))) {
- if (Count <= Buffer_Adjustment)
- return UDIErrorIPCLimitation;
- Count -= Buffer_Adjustment;
- } /* if */
-
- /* Copy "in" passed-by-reference variables to parameter passing
- * buffer.
- */
- _fmemmove(rm_address,NEARPTR_TO_FARPTR(Buf),Count);
-
- params.Buf = rm_buffer_addr;
- params.Count = Count;
- params.CountDone = PROT_TO_REAL((FARPTR)CountDonePtr);
-
- Err = REALCALL(UDIPutStdinAddr,params);
-
- CheckRealError(Err,"UDIPutStdin");
-
- /* Copy returned values back into protected mode variables. */
- _fmemmove(NEARPTR_TO_FARPTR(CountDone),CountDonePtr,sizeof(UDISizeT));
-
- return FUNC_VAL;
-
-
-} /* UDIPPutStdin() */
-
-
-
-UDIError UDIPStdinMode(
- REALPTR UDIStdinModeAddr,
- UDIMode *Mode /* Out */
- )
-{
- UDIError Err;
-
- /* Don't need to copy anything in parameter passing area since there
- * are no "in", passed-by-reference parameters.
- * Since there is only a single parameter and that is "out", and
- * passed-by-reference, can just use the address of the parameter
- * passing buffer for this.
- */
- Err = REALCALL(UDIStdinModeAddr,rm_buffer_addr);
-
- CheckRealError(Err,"UDIStdinMode");
-
- _fmemmove(NEARPTR_TO_FARPTR(Mode),rm_address,sizeof(UDIMode));
-
- return FUNC_VAL;
-
-} /* UDIPStdinMode() */
-
-
-
-UDIError UDIPPutTrans(
- REALPTR UDIPutTransAddr,
- UDIHostMemPtr Buf, /* In */
- UDISizeT Count, /* In */
- UDISizeT *CountDone /* Out */
- )
-{
- UDIError Err;
- UDISizeT _far *CountDonePtr;
-
- char * CurrentTo;
- UDISizeT TotalDone=0;
- UDISizeT CurrentCount;
- UDISizeT CurrentDone=0;
- long BufAdjust;
-
- _Packed struct {
- REALPTR Buf;
- UDISizeT Count;
- REALPTR CountDone;
- } params;
-
- CurrentCount = Count;
- CurrentTo = Buf;
-
- do {
- CountDonePtr = (UDISizeT _far *) (rm_address + CurrentCount);
-
- BufAdjust = BufferSizeCheck((FARPTR)(CountDonePtr + sizeof(UDISizeT)),"UDIPPutTrans",PRINT_OFF);
- if (BufAdjust) {
- CurrentCount = (rm_end_address - rm_address - sizeof(UDISizeT));
- CountDonePtr = (UDISizeT _far *) (rm_end_address - sizeof(UDISizeT));
- } /* if */
-
- _fmemmove(rm_address,NEARPTR_TO_FARPTR(Buf),Count);
-
- params.Buf = rm_buffer_addr;
- params.Count = CurrentCount;
- params.CountDone = PROT_TO_REAL((FARPTR)CountDonePtr);
-
- Err = REALCALL(UDIPutTransAddr,params);
-
- CheckRealError(Err,"UDIPutTrans");
-
- /* Copy the contents of the "out" parameters back into their
- * protected mode counterparts.
- */
- _fmemmove(NEARPTR_TO_FARPTR(&CurrentDone),CountDonePtr,sizeof(UDISizeT));
-
- TotalDone += CurrentDone;
-
- } while ((TotalDone < Count) & (FUNC_VAL == UDINoError));
-
- *CountDone = TotalDone;
- return FUNC_VAL;
-
-} /* UDIPPutTrans() */
-
-
-
-UDIError UDIPGetTrans(
- REALPTR UDIGetTransAddr,
- UDIHostMemPtr Buf, /* Out */
- UDISizeT BufSize, /* In */
- UDISizeT *CountDone /* Out */
- )
-{
- UDIError Err;
- UDISizeT _far *CountDonePtr;
- long BufAdjust;
-
- _Packed struct {
- REALPTR Buf;
- UDISizeT BufSize;
- REALPTR CountDone;
- } params;
-
- /* Get pointers to passed-by-reference parameters. */
- CountDonePtr = (UDISizeT _far *) (rm_address + BufSize);
-
- if ((BufAdjust = BufferSizeCheck((FARPTR)(CountDonePtr + sizeof(UDISizeT)),"UDIPGetTrans",PRINT_ON))) {
- if (BufSize <= BufAdjust)
- return UDIErrorIPCLimitation;
- BufSize -= BufAdjust;
- } /* if */
-
- params.Buf = rm_buffer_addr;
- params.BufSize = BufSize;
- params.CountDone = PROT_TO_REAL((FARPTR)CountDonePtr);
-
- Err = REALCALL(UDIGetTransAddr,params);
-
- CheckRealError(Err,"UDIGetTrans");
-
- /* Copy the contents of the "out" parameters back into their
- * protected mode counterparts.
- */
- _fmemmove(NEARPTR_TO_FARPTR(CountDone),CountDonePtr,sizeof(UDISizeT));
- if (*CountDone <= BufSize)
- _fmemmove(NEARPTR_TO_FARPTR(Buf),rm_address,*CountDone);
- else {
- _fmemmove(NEARPTR_TO_FARPTR(Buf),rm_address,BufSize);
- SIZE_ERROR(*CountDone, BufSize, "UDIPGetTrans");
- }
-
- return FUNC_VAL;
-
-
-} /* UDIPGetTrans() */
-
-
-UDIError UDIPTransMode(
- REALPTR UDITransModeAddr,
- UDIMode *Mode /* Out */
- )
-{
- UDIError Err;
-
- /* Don't need to copy anything in parameter passing area since there
- * are no "in", passed-by-reference parameters.
- * Since there is only a single parameter and that is "out", and
- * passed-by-reference, can just use the address of the parameter
- * passing buffer for this.
- */
-
- Err = REALCALL(UDITransModeAddr,rm_buffer_addr);
-
- CheckRealError(Err,"UDITransMode");
-
- _fmemmove(NEARPTR_TO_FARPTR(Mode),rm_address,sizeof(UDIMode));
-
- return FUNC_VAL;
-
-} /* UDIPTransMode() */
-
+++ /dev/null
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * Comments about this software should be directed to udi@amd.com. If access
- * to electronic mail isn't available, send mail to:
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- *****************************************************************************
- * $Id$
- * $Id: @(#)dos386c.h 1.6, AMD
- */
-
-#ifndef _DOS386_H
-#define _DOS386_H
-
-#ifdef WATC
-#define NULL 0
-#endif /* WATC */
-
-
-#ifdef _DOS386C_C
-#define EXTERN
-#define STATIC static
-#else
-#define EXTERN extern
-#define STATIC
-#endif
-
-#define FAR
-
-EXTERN char *conventional_memory; /* pointer to first byte of conventinal memory */
-
-EXTERN USHORT our_tsr_psp;
-EXTERN USHORT dos_ext_psp;
-/* EXTERN STATIC struct UDIVecRec FAR * FAR * UDIVecP; */
-extern REALPTR call_prot;
-extern USHORT code_selector;
-extern USHORT data_selector;
-extern USHORT rmcode_firstbyte;
-
-
-/*
- * Used to copy real mode code and data into conventional memory (udip2dos)
- * and to construct real mode pointers and protected mode far (48 bit)
- * pointers.
- */
-
-EXTERN USHORT rmem_adr;
-EXTERN REALPTR real_base;
-EXTERN FARPTR prot_base;
-
-
-/*=============== Utilities for converting pointers from prot to real and vice versa========*/
-
- /* LINEARIZE converts a segment:ofst pointer into a linear addr between 0 and 1meg */
-#define LINEARIZE(rp) ((RP_SEG(rp)<<4) + RP_OFF(rp))
-
-
-
-FARPTR REAL_TO_PROT(REALPTR rp);
-
-
-/* in DOS386, TIPName, TIPVecRec defined in dos386a.asm in rmdata */
-extern char TIPName[];
-extern struct UDIVecRec TIPVecRec;
-
-
-/* Function Prototypes */
-
-REALPTR PROT_TO_REAL(FARPTR p);
-REALPTR _far * FindIntVect();
-FARPTR NEARPTR_TO_FARPTR(void *ptr);
-
-
-
-/* Prototypes for DOS386 UDI interface functions. */
-
-
-UDIError UDIPConnect(REALPTR UDIConnectAddr,
- char *Configuration,
- UDISessionId *Session,
- DOSTerm _far * TermStruct
- );
-
-
-
-UDIError UDIPCapabilities(
- REALPTR UDICapabilitiesAddr,
- UDIUInt32 *TIPId, /* Out */
- UDIUInt32 *TargetId, /* Out */
- UDIUInt32 DFEId, /* In */
- UDIUInt32 DFE, /* In */
- UDIUInt32 *TIP, /* Out */
- UDIUInt32 *DFEIPCId, /* Out */
- UDIUInt32 *TIPIPCId, /* Out */
- char *TIPString /* Out */
- );
-
-UDIError UDIPGetErrorMsg(
- REALPTR UDIGetErrorMessageAddr,
- UDIError ErrorCode, /* In */
- UDISizeT MsgSize, /* In */
- char *Msg, /* Out */
- UDISizeT *CountDone /* Out */
- );
-
-UDIError UDIPSetCurrentConnection(
- REALPTR UDISetCurrentConnectionAddr,
- UDISessionId Session /* In */
- );
-
-UDIError UDIPDisconnect(
- REALPTR UDIDisconnectAddr,
- UDISessionId Session, /* In */
- UDIBool Terminate, /* In */
- DOSTerm _far * TermStruct /* In */
- );
-
-UDIError UDIPGetTargetConfig(
- REALPTR UDIGetTargetConfigAddr,
- UDIMemoryRange KnownMemory[], /* Out */
- UDIInt *NumberOfRanges, /* In/Out */
- UDIUInt32 ChipVersions[], /* Out */
- UDIInt *NumberofChips /* In/Out */
- );
-
-UDIError UDIPCreateProcess(
- REALPTR UDICreateProcessAddr,
- UDIPId *PId /* Out */
- );
-
-UDIError UDIPSetCurrentProcess(
- REALPTR UDISetCurrentProcessAddr,
- UDIPId PId /* In */
- );
-
-UDIError UDIPInitializeProcess(
- REALPTR UDIInitializeProcessAddr,
- UDIMemoryRange ProcessMemory[], /* In */
- UDIInt NumberOfRanges, /* In */
- UDIResource EntryPoint, /* In */
- CPUSizeT *StackSizes, /* In */
- UDIInt NumberOfStacks, /* In */
- char *ArgString /* In */
- );
-
-UDIError UDIPDestroyProcess(
- REALPTR UDIDestroyProcessAddr,
- UDIPId PId /* In */
- );
-
-UDIError UDIPRead(
- REALPTR UDIReadAddr,
- UDIResource From, /* In */
- UDIHostMemPtr To, /* Out */
- UDICount Count, /* In */
- UDISizeT Size, /* In */
- UDICount *CountDone, /* Out */
- UDIBool HostEndian /* In */
- );
-
-UDIError UDIPWrite(
- REALPTR UDIWriteAddr,
- UDIHostMemPtr From, /* In */
- UDIResource To, /* In */
- UDICount Count, /* In */
- UDISizeT Size, /* In */
- UDICount *CountDone, /* Out */
- UDIBool HostEndian /* In */
- );
-
-UDIError UDIPCopy(
- REALPTR UDICopyAddr,
- UDIResource From, /* In */
- UDIResource To, /* In */
- UDICount Count, /* In */
- UDISizeT Size, /* In */
- UDICount *CountDone, /* Out */
- UDIBool Direction /* In */
- );
-
-UDIError UDIPExecute(
- REALPTR UDIExecuteAddr
- );
-
-UDIError UDIPStep(
- REALPTR UDIStepAddr,
- UDIUInt32 Steps, /* In */
- UDIStepType StepType, /* In */
- UDIRange Range /* In */
- );
-
-UDIError UDIPStop(
- REALPTR UDIStopAddr
- );
-
-UDIError UDIPWait(
- REALPTR UDIWaitAddr,
- UDIInt32 MaxTime, /* In */
- UDIPId *PId, /* Out */
- UDIUInt32 *StopReason /* Out */
- );
-
-UDIError UDIPSetBreakpoint(
- REALPTR UDISetBreakpointAddr,
- UDIResource Addr, /* In */
- UDIInt32 PassCount, /* In */
- UDIBreakType Type, /* In */
- UDIBreakId *BreakId /* Out */
- );
-
-UDIError UDIPQueryBreakpoint(
- REALPTR UDIQueryBreakpointAddr,
- UDIBreakId BreakId, /* In */
- UDIResource *Addr, /* Out */
- UDIInt32 *PassCount, /* Out */
- UDIBreakType *Type, /* Out */
- UDIInt32 *CurrentCount /* Out */
- );
-
-UDIError UDIPClearBreakpoint(
- REALPTR UDIClearBreakpointAddr,
- UDIBreakId BreakId /* In */
- );
-
-
-UDIError UDIPGetStdout(
- REALPTR UDIGetStdoutAddr,
- UDIHostMemPtr Buf, /* Out */
- UDISizeT BufSize, /* In */
- UDISizeT *CountDone /* Out */
- );
-
-UDIError UDIPGetStderr(
- REALPTR UDIGetStderrAddr,
- UDIHostMemPtr Buf, /* Out */
- UDISizeT BufSize, /* In */
- UDISizeT *CountDone /* Out */
- );
-
-UDIError UDIPPutStdin(
- REALPTR UDIPutStdinAddr,
- UDIHostMemPtr Buf, /* In */
- UDISizeT Count, /* In */
- UDISizeT *CountDone /* Out */
- );
-
-UDIError UDIPStdinMode(
- REALPTR UDIStdinModeAddr,
- UDIMode *Mode /* Out */
- );
-
-UDIError UDIPPutTrans(
- REALPTR UDIPutTransAddr,
- UDIHostMemPtr Buf, /* In */
- UDISizeT Count, /* In */
- UDISizeT *CountDone /* Out */
- );
-
-UDIError UDIPGetTrans(
- REALPTR UDIGetTransAddr,
- UDIHostMemPtr Buf, /* Out */
- UDISizeT BufSize, /* In */
- UDISizeT *CountDone /* Out */
- );
-
-UDIError UDIPTransMode(
- REALPTR UDITranModesAddr,
- UDIMode *Mode /* Out */
- );
-
-
-#if __HIGHC__
-/* make _fmemmove work for highc */
-
-static void _fmemmove(void _far *dst, void _far *src, int count)
-{
- /* Metaware hc386 call */
- _movedata(FP_SEL(src), /* from segment:ofs */
- FP_OFF(src),
- FP_SEL(dst), /* to segment:ofst */
- FP_OFF(dst),
- count);
-}
-#endif
-
-
-
-#endif /* _DOS386_H */
-
-
-
+++ /dev/null
-;******************************************************************************
-;* Copyright 1991 Advanced Micro Devices, Inc.
-;*
-;* This software is the property of Advanced Micro Devices, Inc (AMD) which
-;* specifically grants the user the right to modify, use and distribute this
-;* software provided this notice is not removed or altered. All other rights
-;* are reserved by AMD.
-;*
-;* AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
-;* SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
-;* DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
-;* USE OF THIS SOFTWARE.
-;*
-;* Comments about this software should be directed to udi@amd.com. If access
-;* to electronic mail isn't available, send mail to:
-;*
-;* Advanced Micro Devices, Inc.
-;* 29K Support Products
-;* Mail Stop 573
-;* 5900 E. Ben White Blvd.
-;* Austin, TX 78741
-;*****************************************************************************
-;* $Id$
-;* $Id: @(#)dosdfe.asm 2.5, AMD
-;*
-IFNDEF DOS386
- DOSSEG
-ENDIF
- INCLUDE udidos.ah
-IFDEF DOS386
-
-rmcode segment byte public use16
-rmcode ends
-rmdata segment dword public use16
-rmdata ends
-pmdata segment dword public use32
-pmdata ends
-pmcode segment byte public use32
-pmcode ends
-dgroup group rmdata,pmdata
-
-
-
-rmcode segment
-
-;
-; Symbol marking start of real mode code & data,
-; used at link time to specify the real mode
-; code & data size
-;
- public start_real
-start_real label byte
-
-rmcode ends
-
-
-
-;
-; Data that needs to be accessed in both real
-; mode and protected mode
-;
-rmdata segment
-
-
- public code_selector, data_selector, call_prot
- ; these get filled in by protected mode startup code
-
-code_selector DW ?
-data_selector DW ?
-call_prot DD ?
-
-rmdata ends
-
-
-
-
-rmdata segment
-
- public TermStruct ; No auto underscore for Watcom C or HighC386
-TermStruct DOSTerm <> ; Don't initialize, it will get filled at run time.
- public UDITerminate ; need this so we can set up real addr into TermSTruct
-
-rmdata ends
-
-rmcode segment
-
-
-ELSE ; not DOS386
-
- PUBLIC _TermStruct
- .MODEL LARGE
- .DATA
-_TermStruct DOSTerm <UDITerminate>
- .CODE
-
-ENDIF ; DOS386
-
-
-
-
-UDITerminate PROC FAR
-;
-; Retrieve registers from save area
-IFDEF DOS386
- ASSUME CS:rmcode
- mov bx, OFFSET TermStruct ; in 386 mode, the pointer we pass to TIP
- ; has UDITerminate seg = seg(rmcode)
- mov ax, cs
-ELSE ; not DOS386
- mov bx, OFFSET _TermStruct
- mov ax, DGROUP
-ENDIF ; DOS386
- mov es, ax
- mov ss, es:[bx].sss
- mov sp, es:[bx].ssp
- mov ds, es:[bx].sds
- mov si, es:[bx].ssi
- mov di, es:[bx].sdi
- mov bp, es:[bx].sbp
- mov ax, es:[bx].retval
- ret ; far return because of PROC FAR
-
-UDITerminate ENDP
-
-IFDEF DOS386
-
-rmcode ends
-
-
-
-pmcode segment
-
-
- ASSUME CS:pmcode
- ASSUME DS:dgroup
-
- public GetCS
-GetCS PROC NEAR
- mov ax, cs
- ret
-GetCS ENDP
-
- public GetDS
-GetDS PROC NEAR
- mov ax, ds
- ret
-GetDS ENDP
-
-
- public _exp_call_to
-_exp_call_to PROC NEAR
- push ebp
- mov ebp, esp
- push es ; save at least all regs required by hc386
- push gs
- push fs
- push ds
- push ebx
- push esi
- push edi
- mov ebx, [ebp+8]
- mov ax, [ebx+0ah] ; new ss,ds,etc.
- mov ecx, [ebx+6] ; new sp
- sub ecx, 256 ; back up past TIPname space
- mov es, ax
- mov gs, ax
- mov fs, ax
- mov ds, ax
- mov edx, esp
- mov si, ss ; save old ss:sp
- mov ss, ax
- mov esp, ecx
- ; now on new stack, save old stack
- push edx
- push si
- call fword ptr cs:[ebx]
- ; restore old stack
- pop si
- pop edx
- mov ss,si
- mov esp,edx
- ; now we are back on original stack
- pop edi
- pop esi
- pop ebx
- pop ds
- pop fs
- pop gs
- pop es
- pop ebp
- ret ; eax will be the return
-
-_exp_call_to ENDP
-
-
-pmcode ends
-
-
-
-rmdata segment
-;
-; Symbol marking end of real mode code & data,
-; used at link time to specify the real mode
-; code & data size
-;
- public end_real
-end_real label byte
-rmdata ends
-
-ENDIF ; DOS386
-
- END
+++ /dev/null
-;******************************************************************************
-;* Copyright 1991 Advanced Micro Devices, Inc.
-;*
-;* This software is the property of Advanced Micro Devices, Inc (AMD) which
-;* specifically grants the user the right to modify, use and distribute this
-;* software provided this notice is not removed or altered. All other rights
-;* are reserved by AMD.
-;*
-;* AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
-;* SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
-;* DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
-;* USE OF THIS SOFTWARE.
-;*
-;* Comments about this software should be directed to udi@amd.com. If access
-;* to electronic mail isn't available, send mail to:
-;*
-;* Advanced Micro Devices, Inc.
-;* 29K Support Products
-;* Mail Stop 573
-;* 5900 E. Ben White Blvd.
-;* Austin, TX 78741
-;* 800-292-9263
-;*****************************************************************************
-;* $Id$
-;* $Id: @(#)dostip.asm 2.7, AMD
-;******************************************************************************
-;*/
-
-IFNDEF DOS386
- DOSSEG
- .MODEL LARGE
- PUBLIC _UDIASMConnect
- PUBLIC _UDIASMDisconnect
- EXTRN _UDICDisconnect:FAR
- EXTRN _UDICConnect:FAR
- .CODE
-ELSE
-;
-; Segment ordering and attributes for DOS386. We make sure the
-; real mode code and data comes first. The real and
-; prot mode data are together so they can be grouped.
-;
-
-rmcode segment byte public use16
-; We need to mark the first byte in rmcode to figure the real segment value
- public rmcode_firstbyte
-rmcode_firstbyte label byte
-
-rmcode ends
-rmdata segment dword public use16
-rmdata ends
-pmdata segment dword public use32
-pmdata ends
-pmcode segment byte public use32
-pmcode ends
-dgroup group rmdata,pmdata
-
-
-
-rmcode segment ; _UDIASMDisconnect will be in rmcode segment
-
-ENDIF
-
-
- INCLUDE udidos.ah ; TermStruct Definitions from DFE
-
-_UDIASMDisconnect LABEL FAR
-;
-; Save off important stuff in structure whose address
-; is given as third parameter to this function.
- mov bx, sp
- les bx, ss:8[bx]
- mov es:[bx].sss, ss
- mov es:[bx].ssp, sp
- mov es:[bx].ssi, si
- mov es:[bx].sdi, di
- mov es:[bx].sbp, bp
- mov es:[bx].sds, ds
-
-IFNDEF DOS386
- jmp _UDICDisconnect ; real mode, just jump to the C routine
-ELSE
- jmp rm_UDIDisconnect ; DOS386, jump to the real mode stub
-ENDIF
-
-_UDIASMConnect LABEL FAR
-;
-; Save off important stuff in structure whose address
-; is given as third parameter to this function.
- mov bx, sp
- les bx, ss:12[bx]
- mov es:[bx].sss, ss
- mov es:[bx].ssp, sp
- mov es:[bx].ssi, si
- mov es:[bx].sdi, di
- mov es:[bx].sbp, bp
- mov es:[bx].sds, ds
-IFNDEF DOS386
- jmp _UDICConnect ; real mode, just jump to the C routine
-ELSE
- jmp rm_UDIConnect ; DOS386, jump to the real mode stub
-ENDIF
-
-IFDEF DOS386
- ; Note: the rest of this file is just DOS386 support
-
-rmcode ends
-
-;
-; Data that needs to be accessed in both real
-; mode and protected mode
-;
-rmdata segment
-
- public code_selector, data_selector, call_prot
- public segregblock
- ; these get filled in by protected mode startup code
-code_selector DW ?
-data_selector DW ?
-call_prot DD ?
-segregblock DW ? ; ds value ; seg reg block filled in at startup time
- DW ? ; es value
- DW ? ; fs value
- DW ? ; gs value
-
- public TIPName
-TIPName DB 256 DUP(?)
-
- public TIPVecRec
-TIPVecRec DB 0,0,0,0 ; will get filled in by main
- DD 0 ; next ptr
- DD 0 ; prev ptr
- DD TIPName ; exeName
- ; the other entries get added by the udi_table macro below
-TIPVecRecEnd LABEL BYTE
-
-rmdata ends
-
-
-
-
-;
-; Data that is only accessed in prot mode
-;
- extrn conventional_memory:DWORD ; set up by dx_map_physical
- extrn stack_table: DWORD ; set up by C-level code.
-
-pmdata segment
-dos386glue_table LABEL DWORD ; so we can reference it later in the udi_table macro
- ; the entries get added by the udi_table macro below
-pmdata ends
-
-
-
-;; The udi_table macro does three things
-;; 1) generates real mode entry point for each UDI function
-;; This code just sets an index in bl and jumps to rm_common
-;; 2) adds an entry into the TIPVecRec to point to the above real mode entry point
-;; 3) adds an entry into the dos386glue_table table which is used by the prot.mode stub
-;; to call the actual C glue routine.
-
-udi_table MACRO UDIProcName,val
-rmcode segment
- public rm_&UDIProcName
-rm_&UDIProcName LABEL NEAR
- mov bl, val ;; bl will indicate which UDI Proc was called
- jmp short rm_common
-rmcode ends
-
-rmdata segment
- ORG TIPVecRec + 16 + 4*val ;; Entry in TIPVecRec (+16 for first 4 fields)
- IF val EQ 0
- DD _UDIASMConnect ;; special case for Connect
- ELSE
- IF val EQ 1
- DD _UDIASMDisconnect ;; special case for Disconnect
- ELSE
- DD rm_&UDIProcName ;; normal entry is rm_ stub
- ENDIF
- ENDIF
-rmdata ends
-
-pmdata segment
- EXTRN d386_&UDIProcName:NEAR
- ORG dos386glue_table + 4*val ;; this builds the jump table that pmstub uses
- DD d386_&UDIProcName
-pmdata ends
-
- ENDM
-
- udi_table UDIConnect,0
- udi_table UDIDisconnect,1
- udi_table UDISetCurrentConnection,2
- udi_table UDICapabilities,3
- udi_table UDIGetErrorMsg,4
- udi_table UDIGetTargetConfig,5
- udi_table UDICreateProcess,6
- udi_table UDISetCurrentProcess,7
- udi_table UDIDestroyProcess,8
- udi_table UDIInitializeProcess,9
- udi_table UDIRead,10
- udi_table UDIWrite,11
- udi_table UDICopy,12
- udi_table UDIExecute,13
- udi_table UDIStep,14
- udi_table UDIStop,15
- udi_table UDIWait,16
- udi_table UDISetBreakpoint,17
- udi_table UDIQueryBreakpoint,18
- udi_table UDIClearBreakpoint,19
- udi_table UDIGetStdout,20
- udi_table UDIGetStderr,21
- udi_table UDIPutStdin,22
- udi_table UDIStdinMode,23
- udi_table UDIPutTrans,24
- udi_table UDIGetTrans,25
- udi_table UDITransMode,26
-
-
-rmcode segment
- ASSUME nothing, CS:rmcode ; all we know is that CS=rmcode
-
-
- ; Common real mode stub code
- ; bl is an index indicating which UDI function was called
- ; we need to switch to protected mode (ebx will be passed thru unchanged)
-rm_common PROC FAR ; UDI always called as far (real mode)
- push ds ; save ds
- push bp ; and save bp
- push si ; and si, di
- push di
- ; note: if anything else gets pushed here, you must
- ; change the MSCPARAMS macro in dos386c.c
- push cs
- pop ds ; set ds = cs
- ASSUME ds:dgroup
- ; to switch to protected mode, we push a dword ptr to a block which
- ; contains the protected mode segment registers to use
- ; and we push the 48-bit protected address of pmstub
- ; then we call the call_prot routine which was returned by dx_rmlink_get
-
- push cs ; segment of seg reg block
- lea ax, segregblock
- push ax ; offset of seg reg block
- push code_selector
- lea eax, pmstub
- push eax
- call call_prot
- add sp, 10 ; unpop all things we pushed
- ; ax return code from prot mode passed thru
-
- pop di ; unpop di,si saved earlier
- pop si
- pop bp ; unpop the BP we saved earlier
- pop ds ; unpop the DS we saved earlier
- ret ; will do a FAR (real mode) ret to DFE
-
-rm_common ENDP
-
-rmcode ends
-
-
-
-
-pmcode segment
-
-pmstub proc far
- ; at this point ss:sp -> far return (DF) back to dos-extender
- ; sp+6 a word of 0
- ; sp+8 the pushed DS (of rmstub)
- ; sp+10 parameters
- ; we pop the far return and save it away
- ; then we call the real application procedure (the params still on stack)
- ASSUME CS:pmcode, DS:dgroup
- ; first let's switch ss:esp so that ss = ds
- ; (it will still point to the same physical memory location)
- ; (we'll save the old ss:esp on the stack in case they're needed)
- mov dx, ss
- mov ecx, esp
- ; at this point, ecx contains the physical 32-bit address of sp
- ; (selector 60h's offset mapped directly to 1meg physical memory)
-
- mov eax, conventional_memory
- cmp eax, 0 ; if conventional memory not mapped take other path
- je short conv_mem_unmapped
-
- ; This is the code that is not DPMI compatible
- ; we add the ofst of beggining of conventional memory to esp
- ; to make it SS_DATA relative and then use data_selector as the SS
- ; thus no stack switch is necessary, we just remap the old stack
- add eax, ecx ; this adds esp to conventional_memory
- mov ss, data_selector
- mov esp, eax
- jmp short got_ss_sp
- ; now ss:esp points to same place as before but using different segment
-
-
-conv_mem_unmapped:
- ; This code is DPMI compatible
- ; we actually switch to a new stack that is in the TIPs DS
- ; the number and size of these stacks was allocated at startup time.
- lea eax, stack_table
-chk_stack:
- cmp dword ptr [eax], 0
- je short no_stack ; stack pointer of 0 means end of table
- mov esi, dword ptr [eax] ; get stack pointer
- cmp dword ptr [esi+4], 0 ; is it marked free?
- je short take_stack
- add eax, 4 ; to next stack entry in table
- jmp chk_stack
-
-no_stack:
- mov eax, 25 ; IPC Limitation error
- ret
-
-take_stack:
- mov dword ptr [esi+4], 0ffffffffh ; mark stack in use
- mov ss, data_selector
- mov esp, esi ; get stack pointer from table
- ; now we have ss = ds, so we can go to C level.
-
-got_ss_sp:
- ; push the old ss:esp on the stack
- push edx ; old ss (need to push as full 32-bit for C convention)
- push ecx ; old esp
-
- ; bl still contains the UDIProcedure Index (which was set up by the rm stub)
- ; use this to get to the correct dos386glue_table routine
- xor bh, bh
- shl bx,1 ; *4 for indexing into DD array
- shl bx,1
- call dos386glue_table[bx]
- ; on return, we just need to restore the old ss:esp
- pop ecx
- pop edx
-
- cmp conventional_memory, 0 ; if we had switched stacks
- jne short no_stack_clear
- mov dword ptr [esp+4], 0 ; clear the stack in use indicator
-
-no_stack_clear:
- ; this code is identical whether we switched stacks or not
- ; we just restore the old ss:sp and return
- mov ss, dx
- mov esp, ecx
- ; the stack should look as it did when we entered
- ; so we just do a far ret
- ret
-pmstub endp
-
-
- public GetCS
-GetCS PROC NEAR
- mov ax, cs
- ret
-GetCS ENDP
-
- public GetDS
-GetDS PROC NEAR
- mov ax, ds
- ret
-GetDS ENDP
-
-
- public _exp_return
- extrn _top:dword
-
-_exp_return PROC FAR
- ; set the stack pointer back to its initial state as left by dfe
- ; (leave the ss unchanged)
- ; then do a far ret which will get us back to the dfe.
- ; (which will then restore its own stack).
- mov ebp, esp
- mov eax, [ebp+4] ; errcode
- mov ecx, _top
- add ecx, 2
- mov esp, ecx
- ret
-_exp_return ENDP
-
-pmcode ends
-
-
-rmdata segment
-;
-; Symbol marking end of real mode code & data,
-; used at link time to specify the real mode
-; code & data size
-;
- public end_real
-end_real label byte
-rmdata ends
-
-
-
-ENDIF ; end of DOS386 conditional code
-
- END
+++ /dev/null
-.\" t
-.\" The above line must be present to tell man to process through tbl.
-.\" @(#)dosudi.5 2.2, AMD
-.\"Copyright (c) 1989, 1990, 1991 by Advanced Micro Devices, Inc.
-.\"All rights reserved. No part of this publication may be reproduced,
-.\"stored in a retrieval system, or transmitted in any form or by any
-.\"means, electronic, mechanical, photocopying, recording or otherwise,
-.\"without the prior written permission of Advanced Micro Devices, Inc.
-.\"
-.\"You must change the date in these files for a release!
-.\"The commands used to generate output from this input are:
-.\" tbl udi.1 | nroff -man - > filename (Goes to a unix file)
-.\" tbl udi.1 | ptroff -man - (Goes to PostScript printer)
-.\"
-.TH UDI 5 "27 Jan. 1992" "UDI Configuration Files for DOS hosts"
-.UC 4
-.SH NAME
-\fBudi\fP \- UDI Configuration Files for DOS hosts.
-.sp
-.sp
-.SH DESCRIPTION
-A UDI conformant Debugger Front End (DFE) specifies the Target
-Interface Process (TIP) that it wishes to connect to and
-the options that it wishes to pass to that TIP by referencing
-a configuration in the "UDI configuration file".
-This man page explains the format of the UDI Configuration file
-for DOS hosts.
-.sp
-The search rules that the DFE uses to locate the UDI Configuration
-file are:
-.IP
-the complete filename specified by the environment variable, UDICONF.
-.IP
-the file udiconfs.txt in the current directory.
-.IP
-the file udiconfs.txt in each of the directories specified by the PATH environment
-variable.
-.sp
-.LP
-Each line of the udiconfs.txt file consists of the following fields:
-.IP
-tip_config_name tip_executable [tip_options]
-.TP 10
-.I tip_config_name
-An arbitrary name which the DFE will use to refer to this configuration.
-Each line in the udiconfs.txt file must have a different tip_config_name field.
-.TP
-.I tip_executable
-The name of the TIP executable file. The DFE will
-use the tip_executable filename to spawn
-the TIP if the TIP is not already running. If a full pathname is
-not specified, the PATH environment variable
-is used to locate the executable file.
-.sp
-.TP
-.I tip_options
-The rest of the line after the tip_executable name is passed
-to the TIP at connect time.
-.sp
-.SH EXAMPLES OF UDI CONFIGURATION FILE ENTRIES
-.sp
-The following is an exampleare examples of entries in the UDI configuration
-file for DOS hosts.
-.sp
-\fB iss050 isstip.exe -29050 -r osboot \fR
-.sp
-The above entry associates the TIP configuration name "iss050" with the
-\fBisstip.exe\fR executable with the parameters
-"-29050 -r osboot" being passed to isstip.exe
-when it is invoked. If isstip.exe is not already running and
-needs to be spawned, the PATH environment variable will be used to
-locate the file isstip.exe.
-.sp
-.SH TRADEMARKS
-AMD is a registered trademark of Advanced Micro Devices, Inc.
-MiniMON29K, 29K, Am29000, Am29005, Am29030, Am29035, Am29200,
-and Am29050 are trademarks of Advanced Micro Devices, Inc.
+++ /dev/null
-
-
-
-UDI(5) FILE FORMATS UDI(5)
-
-
-
-NAME
- udi - UDI Configuration Files for DOS hosts.
-
-
-
-DESCRIPTION
- A UDI conformant Debugger Front End (DFE) specifies the Tar-
- get Interface Process (TIP) that it wishes to connect to and
- the options that it wishes to pass to that TIP by referenc-
- ing a configuration in the "UDI configuration file". This
- man page explains the format of the UDI Configuration file
- for DOS hosts.
-
- The search rules that the DFE uses to locate the UDI Confi-
- guration file are:
-
- the complete filename specified by the environment
- variable, UDICONF.
-
- the file udiconfs.txt in the current directory.
-
- the file udiconfs.txt in each of the directories speci-
- fied by the PATH environment variable.
-
-
- Each line of the udi_soc file consists of the following
- fields:
-
- tip_config_name tip_executable [tip_options]
-
- tip_config_name
- An arbitrary name which the DFE will use to refer
- to this configuration. Each line in the udi_soc
- file must have a different tip_config_name field.
-
- tip_executable
- The name of the TIP executable file. The DFE will
- use the tip_executable filename to spawn the TIP
- if the TIP is not already running. If a full path-
- name is not specified, the PATH environment vari-
- able is used to locate the executable file.
-
-
- tip_options
- The rest of the line after the tip_executable name
- is passed to the TIP at connect time.
-
-
-EXAMPLES OF UDI CONFIGURATION FILE ENTRIES
- The following is an exampleare examples of entries in the
- UDI configuration file for DOS hosts.
-
-
-
-
-UDI Configuration Files for DOS hosts\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bLast change: 27 Jan. 1992 1
-
-
-
-
-
-
-UDI(5) FILE FORMATS UDI(5)
-
-
-
- iss050 isstip.exe -29050 -r osboot
-
- The above entry associates the TIP configuration name
- "iss050" with the isstip.exe executable with the parameters
- "-29050 -r osboot" being passed to isstip.exe when it is
- invoked. If isstip.exe is not already running and needs to
- be spawned, the PATH environment variable will be used to
- locate the file isstip.exe.
-
-
-TRADEMARKS
- AMD is a registered trademark of Advanced Micro Devices,
- Inc. MiniMON29K, 29K, Am29000, Am29005, Am29030, Am29035,
- Am29200, and Am29050 are trademarks of Advanced Micro Dev-
- ices, Inc.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-UDI Configuration Files for DOS hosts Last change: 27 Jan. 1992 2
-
-
+++ /dev/null
-/************************************************************************/
-/* Copyright (C) 1986-1991 Phar Lap Software, Inc. */
-/* Unpublished - rights reserved under the Copyright Laws of the */
-/* United States. Use, duplication, or disclosure by the */
-/* Government is subject to restrictions as set forth in */
-/* subparagraph (c)(1)(ii) of the Rights in Technical Data and */
-/* Computer Software clause at 252.227-7013. */
-/* Phar Lap Software, Inc., 60 Aberdeen Ave., Cambridge, MA 02138 */
-/************************************************************************/
-/* REALCOPY.C: copy real mode code to conventional memory */
-
-/*
- * The routine in this file allocates conventional memory and copies
- * real mode code to it.
- */
-#include <stdio.h>
-#include <pltypes.h>
-#include <pharlap.h>
-
-realcopy(start_offs, end_offs, real_basep, prot_basep, rmem_adrp)
-ULONG start_offs;
-ULONG end_offs;
-REALPTR *real_basep;
-FARPTR *prot_basep;
-USHORT *rmem_adrp;
-
-/*
-Description:
- This routine allocates conventional memory for the specified block
- of code (which must be within the first 64K of the protected mode
- program segment) and copies the code to it.
-
- The caller should free up the conventional memory block when it
- is done with the conventional memory.
-
- NOTE THIS ROUTINE REQUIRES 386|DOS-EXTENDER 3.0 OR LATER.
-
-Calling arguments:
- start_offs start of real mode code in program segment
- end_offs 1 byte past end of real mode code in program segment
- real_basep returned; real mode ptr to use as a base for the
- real mode code (eg, to get the real mode FAR
- addr of a function foo(), take
- real_basep + (ULONG) foo).
- This pointer is constructed such that
- offsets within the real mode segment are
- the same as the link-time offsets in the
- protected mode program segment
- prot_basep returned; prot mode ptr to use as a base for getting
- to the conventional memory, also constructed
- so that adding the prot mode offset of a
- function or variable to the base gets you a
- ptr to the function or variable in the
- conventional memory block.
- rmem_adrp returned; real mode para addr of allocated
- conventional memory block, to be used to free
- up the conventional memory when done. DO NOT
- USE THIS TO CONSTRUCT A REAL MODE PTR, USE
- REAL_BASEP INSTEAD SO THAT OFFSETS WORK OUT
- CORRECTLY.
-
-Returned values:
- TRUE if error
- FALSE if success
-*/
-{
- ULONG rm_base; /* base real mode para addr for accessing */
- /* allocated conventional memory */
- UCHAR *sp; /* source pointer for copy */
- FARPTR dp; /* destination pointer for copy */
- ULONG len; /* number of bytes to copy */
- ULONG temp;
- USHORT stemp;
-
-/*
- * First check for valid inputs
- */
- if (start_offs >= end_offs || end_offs > 0x10000)
- {
- return TRUE;
- }
-
-/*
- * Round start_offs down to a paragraph (16-byte) boundary so we can set up
- * the real mode pointer easily.
- */
- start_offs &= ~15;
-
-/*
- * Allocate the conventional memory for our real mode code. Remember to
- * round byte count UP to 16-byte paragraph size. We alloc it
- * above the DOS data buffer so both the DOS data buffer and the appl
- * conventional mem block can still be resized.
- *
- * First just try to alloc it; if we can't get it, shrink the appl mem
- * block down to the minimum, try to alloc the memory again, then grow the
- * appl mem block back to the maximum. (Don't try to shrink the DOS data
- * buffer to free conventional memory; it wouldn't be good for this routine
- * to have the possible side effect of making file I/O run slower.)
- */
- len = ((end_offs - start_offs) + 15) >> 4;
- if (_dx_real_above(len, rmem_adrp, &stemp) != _DOSE_NONE)
- {
- if (_dx_cmem_usage(0, FALSE, &temp, &temp) != _DOSE_NONE)
- {
- return TRUE;
- }
- if (_dx_real_above(len, rmem_adrp, &stemp) != _DOSE_NONE)
- *rmem_adrp = 0;
- if (_dx_cmem_usage(0, TRUE, &temp, &temp) != _DOSE_NONE)
- {
- if (*rmem_adrp != 0)
- _dx_real_free(*rmem_adrp);
- return TRUE;
- }
- if (*rmem_adrp == 0)
- {
- return TRUE;
- }
- }
-
-/*
- * Construct real mode & protected mode pointers to access the allocated
- * memory. Note we know start_offs is aligned on a paragraph (16-byte)
- * boundary, because we rounded it down.
- *
- * We make the offsets come out rights by backing off the real mode selector
- * by start_offs.
- */
- rm_base = ((ULONG) *rmem_adrp) - (start_offs >> 4);
- RP_SET(*real_basep, 0, rm_base);
- FP_SET(*prot_basep, rm_base << 4, SS_DOSMEM);
-
-/*
- * Copy the real mode code to the allocated memory
- */
- sp = (UCHAR *) start_offs;
- dp = *prot_basep + start_offs;
- len = end_offs - start_offs;
- while (len-- > 0)
- *dp++ = *sp++;
- return FALSE;
-}
+++ /dev/null
- /* Prototype for Pharlap's realcopy.c example. */
-
-int realcopy(ULONG start_offs,
- ULONG end_offs,
- REALPTR *real_basep,
- FARPTR *prot_basep,
- USHORT *rmem_adrp);
+++ /dev/null
-/******************************************************************************
-* Copyright 1991 Advanced Micro Devices, Inc.
-*
-* This software is the property of Advanced Micro Devices, Inc (AMD) which
-* specifically grants the user the right to modify, use and distribute this
-* software provided this notice is not removed or altered. All other rights
-* are reserved by AMD.
-*
-* AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
-* SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
-* DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
-* USE OF THIS SOFTWARE.
-*
-* So that all may benefit from your experience, please report any problems
-* or suggestions about this software to the 29K Technical Support Center at
-* 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
-* 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
-*
-* Advanced Micro Devices, Inc.
-* 29K Support Products
-* Mail Stop 573
-* 5900 E. Ben White Blvd.
-* Austin, TX 78741
-* 800-292-9263 (US)
-*****************************************************************************
-*/
-static char soc2udip_c[]="@(#)soc2udip.c 2.14 Daniel Mann";
-static char soc2udip_c_AMD[]="@(#)soc2udip.c 3.2, AMD";
-/*
-* This module converts UDI socket messages
-* into UDI Procedural calls.
-* It is used by TIP server processes
-********************************************************************** HISTORY
-*/
-#include <stdio.h>
-#include <stdio.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/file.h>
-#ifdef __hpux
-#else
-/* #include <sys/sockio.h> */
-#endif
-
-#include <sys/fcntl.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <signal.h>
-#include <setjmp.h>
-#include "udiproc.h"
-#include "udisoc.h"
-
-extern int errno;
-
-/* local type decs. and macro defs. not in a .h file ************* MACRO/TYPE
-*/
-#define version_c 0x121 /* TIP-IPC version id */
-#define PORT_NUM 7000
-#define MAX_ERRNO 1
-#define SOC_BUF_SIZE 4* 1024 /* size of socket comms buffer */
-#define SBUF_SIZE 500 /* size of string buffer */
-
-/* global dec/defs. which are not in a .h file ************* EXPORT DEC/DEFS
-*/
-
-/* local dec/defs. which are not in a .h file *************** LOCAL DEC/DEFS
-*/
-LOCAL UDIError tip_errno;
-LOCAL int tip_sd;
-LOCAL int connect_count = 0;
-LOCAL int ns;
-LOCAL int getlength;
-LOCAL struct sockaddr getname;
-LOCAL UDR udr;
-LOCAL UDR* udrs = &udr;
-LOCAL char sbuf[SBUF_SIZE]; /* String handler buffer */
-LOCAL char* tip_errmsg[/*MAX_ERRNO*/] =
-{ "Trying to present non negative error number to TIP "
-};
-
-LOCAL sig_handler(sig, code, scp, addr)
-int sig;
-int code;
-struct sigcontext *scp;
-char *addr;
-{
- if(sig == SIGUSR1)
- {
- UDIStop();
- return;
- }
- if(sig == SIGIO )
- {
- return;
- }
- if(sig == SIGURG)
- {
- UDIStop();
- return;
- }
- if(sig != -1)fprintf(stderr,
- "\nTIP-ipc caught a signal %d, socket shutdown\n",sig);
-#if 0
- else fprintf(stderr,"\nTIP-ipc, socket shutdown\n");
-#endif
- sigblock(sigmask(SIGIO));
- if(shutdown(tip_sd, 2))
- fprintf(stderr, "TIP-ipc WARNING: socket shutdown failed");
- if(udrs->domain == AF_UNIX)
- if(unlink(udrs->soc_name))
- fprintf(stderr,
- "TIP-ipc WARNING: failed to unlink %s\n",udrs->soc_name);
- exit(0);
-}
-/*********************************************************************** MAIN
-*/
-main(argc, argv)
-int argc;
-char* argv[];
-{
- char *domain_string = argv[1];
- char *tip_string = argv[2];
- struct sockaddr_in dfe_sockaddr;
- struct sockaddr_in tip_sockaddr_in;
- struct sockaddr tip_sockaddr;
- struct hostent *tip_info_p;
- int dfe_addrlen;
- int domain;
- int pgrp;
-#define NAME_LEN 20
- char tip_host[NAME_LEN];
-
- pgrp = getpid();
- setpgrp(0, pgrp); /* TIP not in same pgrp as DFE */
- if(argc < 3)
- {
- TIPPrintUsage(argv[0]);
- fprintf(stderr,"TIP UDI-IPC Version %d.%d.%d\n",
- (version_c&0xf00)>>8, (version_c&0x0f0)>>4, (version_c&0x00f));
- exit(1);
- }
-
- signal(SIGINT, sig_handler);
- signal(SIGKILL, sig_handler);
- signal(SIGQUIT, sig_handler);
- signal(SIGTERM, sig_handler);
- signal(SIGSEGV, sig_handler);
- signal(SIGURG, sig_handler);
- signal(SIGIO, sig_handler);
- signal(SIGUSR1, sig_handler);
-
-/*----------------------------------------------------------------- SOCKET */
- if(!strcmp(domain_string, "AF_UNIX"))
- domain = AF_UNIX;
- else if(!strcmp(domain_string, "AF_INET"))
- domain = AF_INET;
- else
- { fprintf(stderr, " TIP-ipc ERROR: address family not known\n");
- exit(1);
- }
- tip_sd = socket(domain, SOCK_STREAM, 0);
- if (tip_sd == -1 )
- { perror(" TIP-ipc ERROR, server socket() call failed");
- sig_handler(-1);
- }
-/*------------------------------------------------------------------- BIND */
- if(domain==AF_UNIX)
- {
- memset( (char*)&tip_sockaddr, 0, sizeof(tip_sockaddr));
- tip_sockaddr.sa_family = domain;
- bcopy(tip_string, tip_sockaddr.sa_data, strlen(tip_string));
- if (bind(tip_sd, &tip_sockaddr, sizeof(tip_sockaddr)) )
- { perror("TIP-ipc WARNING, server bind() failed");
- }
- }
- else if(domain == AF_INET)
- {
- if(gethostname(tip_host, NAME_LEN))
- { fprintf(stderr,"TIP-ipc ERROR, unable to get TIP host name");
- exit(1);
- }
- memset( (char*)&tip_sockaddr_in, 0, sizeof(tip_sockaddr_in));
- tip_sockaddr_in.sin_family = domain;
- tip_sockaddr_in.sin_family = AF_INET;
- tip_sockaddr_in.sin_addr.s_addr = inet_addr(tip_host);
- if( tip_sockaddr_in.sin_addr.s_addr == -1)
- {
- tip_info_p = gethostbyname(tip_host); /* use host name */
- if( tip_info_p == NULL)
- { fprintf(stderr," TIP-ipc ERROR, %s not found in /etc/hosts\n",
- tip_host);
- exit(1);
- }
- bcopy(tip_info_p->h_addr, (char *) &tip_sockaddr_in.sin_addr,
- tip_info_p->h_length);
- }
- tip_sockaddr_in.sin_port = htons(atoi(tip_string));
- if (bind(tip_sd, &tip_sockaddr_in, sizeof(tip_sockaddr_in)))
- { perror(" TIP-ipc WARNING, server bind() failed");
- }
- }
-/*----------------------------------------------------------------- LISTEN */
- if(listen(tip_sd,1))
- { perror(" TIP-ipc ERROR, server listen failed");
- sig_handler(-1);
- }
-/*----------------------------------------------------------------- ACCEPT */
- while(1)
- { while(1)
- { dfe_addrlen = sizeof(dfe_sockaddr);
- ns =accept(tip_sd, &dfe_sockaddr, &dfe_addrlen);
- if(ns == -1)
- { if(errno == EINTR) continue;
- perror(" TIP-ipc ERROR, server accept call");
- sig_handler(-1);
- }
- else break;
- }
- errno = 0;
- if(domain == AF_INET)
- {
-#ifdef __hpux
-#else
- if(fcntl(ns, F_SETOWN, getpid()) == -1)
- { perror(" TIP-ipc, fcntl(..F_SETOWN) call: ");
- sig_handler(-1);
- }
- if(fcntl(ns, F_SETFL, FASYNC) == -1)
- { perror(" TIP-ipc, fcntl(..FASYNC) call: ");
- sig_handler(-1);
- }
-#endif
- }
- udr_create(udrs, ns, SOC_BUF_SIZE);
- udrs->domain = domain;
- udrs->soc_name = tip_string;
- service();
- udr_free(udrs);
- }
-}
-
-/******************************************************************** SERVICE
-* Service each DFE request as they arrive.
-*/
-service()
-{
- UDIInt32 service_id; /* requested DFE service */
-
- for(;;)
- {
- tip_errno = 0;
- udrs->udr_op = UDR_DECODE;
- if(udr_UDIInt32(udrs, &service_id))
- { connect_count--;
- return -1;
- }
- switch(service_id)
- {
- default:
- {
- break;
- }
-/*----------------------------------------------------------------- UDIConnect
-*/
- case UDIConnect_c:
- {
- char* Config; /* in -- identification string */
- UDISessionId Session; /* out -- session ID */
- int tip_pid; /* pid of TIP process */
- UDIUInt32 TIPIPCId;
- UDIUInt32 DFEIPCId;
-
- udr_UDIUInt32(udrs, &DFEIPCId); /* recv all "in" params */
- if ((DFEIPCId & 0xfff) < version_c) {
- fprintf(stderr, "TIP-ipc: Connect from obsolete DFE\n");
- sig_handler(-1);
- }
- udr_string(udrs, sbuf);
-
- udrs->udr_op = UDR_ENCODE; /* send all "out" parameters */
- tip_errno = UDIConnect(sbuf, &Session);
- if( tip_errno <= UDINoError) connect_count++;
- TIPIPCId = (company_c << 16) + (product_c << 12) + version_c;
- udr_UDIUInt32(udrs, &TIPIPCId);
- tip_pid = getpid();
- udr_UDIInt32(udrs, &tip_pid);
- udr_UDISessionId(udrs, &Session);
- udr_UDIError(udrs, &tip_errno); /* send any TIP error */
- udr_sendnow(udrs);
- break;
- }
-/*-------------------------------------------------------------- UDIDisconnect
-*/
- case UDIDisconnect_c:
- {
- UDISessionId Session; /* In */
- UDIBool Terminate; /* In */
-
- udr_UDISessionId(udrs, &Session);
- udr_UDIBool(udrs, &Terminate);
-
- udrs->udr_op = UDR_ENCODE; /* send all "out" parameters */
- tip_errno = UDIDisconnect(Session, Terminate);
- if( tip_errno == UDINoError) connect_count--;
- udr_UDIError(udrs, &tip_errno); /* send any TIP error */
- udr_sendnow(udrs);
- if(Terminate != UDIContinueSession && connect_count == 0)
- {
-#if 0
- fprintf(stderr, "\nTIP-ipc: DFE has disconnected all sessions\n");
-#endif
- sig_handler(-1);
- }
- if(connect_count == 0) return;
- break;
- }
-/*-------------------------------------------------------------------- UDIKill
-*/
- case UDIKill_c:
- {
- UDISessionId Session; /* In */
- UDIInt32 signal; /* In */
-
- udr_UDISessionId(udrs, &Session);
- udr_UDIInt32(udrs, signal);
-
- udrs->udr_op = UDR_ENCODE; /* send all "out" parameters */
- tip_errno = 0;
- udr_UDIError(udrs, &tip_errno); /* send any TIP error */
- udr_sendnow(udrs);
- if(connect_count == 0)
- {
-#if 0
- fprintf(stderr, "\nTIP-ipc: DFE has disconnected all sessions\n");
-#endif
- sig_handler(-1);
- }
- break;
- }
-/*---------------------------------------------------- UDISetCurrentConnection
-*/
- case UDISetCurrentConnection_c:
- {
- UDISessionId Session; /* In */
-
- udr_UDISessionId(udrs, &Session);
-
- udrs->udr_op = UDR_ENCODE; /* send all "out" parameters */
- tip_errno = UDISetCurrentConnection(Session);
- udr_UDIError(udrs, &tip_errno); /* send any TIP error */
- udr_sendnow(udrs);
- break;
- }
-/*------------------------------------------------------------ UDICapabilities
-*/
- case UDICapabilities_c:
- {
- UDIUInt32 TIPId; /* out */
- UDIUInt32 TargetId; /* out */
- UDIUInt32 DFEId; /* in */
- UDIUInt32 DFE; /* in */
- UDIUInt32 TIP; /* out */
- UDIUInt32 DFEIPCId; /* out */
- UDIUInt32 TIPIPCId; /* out */
- char *TIPString = sbuf; /* out */
-
- strcpy(TIPString, "No TIP Capability string");
- udr_UDIUInt32(udrs, &DFEId);
- udr_UDIUInt32(udrs, &DFE);
-
- udrs->udr_op = UDR_ENCODE; /* send all "out" paramters */
- tip_errno = UDICapabilities( &TIPId, &TargetId, DFEId, DFE,
- &TIP, &DFEIPCId, &TIPIPCId, TIPString);
- udr_UDIUInt32(udrs, &TIPId);
- udr_UDIUInt32(udrs, &TargetId);
- udr_UDIUInt32(udrs, &TIP);
- udr_UDIUInt32(udrs, &DFEIPCId);
- TIPIPCId = (company_c << 16) + (product_c << 12) + version_c;
- udr_UDIUInt32(udrs, &TIPIPCId);
- udr_string(udrs, TIPString);
- udr_UDIError(udrs, &tip_errno); /* send any TIP error */
- udr_sendnow(udrs);
- break;
- }
-/*------------------------------------------------------------- UDIGetErrorMsg
-*/
- case UDIGetErrorMsg_c:
- {
- UDIError error_code; /* In */
- UDISizeT msg_len; /* In -- allowed message space */
- char* msg = sbuf; /* Out -- length of message */
- UDISizeT CountDone; /* Out -- number of chars */
-
- strcpy(msg, "No TIP message");
- udr_UDIError(udrs, &error_code); /* recv all "in" parameters */
- udr_UDISizeT(udrs, &msg_len);
-
- udrs->udr_op = UDR_ENCODE; /* send all "out" parameters */
- if(error_code < 0)
- {
- if(SBUF_SIZE < msg_len) msg_len = SBUF_SIZE;
- tip_errno = UDIGetErrorMsg(error_code, msg_len, msg, &CountDone);
- udr_string(udrs, msg);
- }
- else
- {
- udr_string(udrs, tip_errmsg[0]);
- tip_errno = UDIErrorCantHappen;
- CountDone = strlen(tip_errmsg[0]);
- }
- udr_UDISizeT(udrs, &CountDone);
- udr_UDIError(udrs, &tip_errno); /* send any TIP error */
- udr_sendnow(udrs);
- break;
- }
-/*--------------------------------------------------------- UDIGetTargetConfig
-*/
- case UDIGetTargetConfig_c:
- {
- char* KnownMemory_p; /* Out */
- UDIInt NumberOfRanges; /* In and Out */
- char* ChipVersions_p; /* Out */
- UDIInt NumberOfChips; /* In and Out */
- int cnt;
- int MaxOfRanges;
- char* NumberOfRanges_p;
-
- udr_UDIInt(udrs, &NumberOfRanges); /* recieve all "in" params */
- MaxOfRanges = NumberOfRanges;
- udr_UDIInt(udrs, &NumberOfChips);
-
- udrs->udr_op = UDR_ENCODE; /* send all "out" parameters */
- udr_work(udrs, &NumberOfRanges, 0); /* nothing yet */
- KnownMemory_p = udr_getpos(udrs);
- udr_inline(udrs, MaxOfRanges * sizeof(UDIMemoryRange) );
- NumberOfRanges_p = udr_getpos(udrs);
- udr_inline(udrs, sizeof(UDIInt) ); /* space for NumberOfRanges */
- udr_inline(udrs, sizeof(UDIInt) ); /* space for NumberOfChips */
- ChipVersions_p = udr_getpos(udrs);
- tip_errno = UDIGetTargetConfig(KnownMemory_p, &NumberOfRanges,
- ChipVersions_p, &NumberOfChips);
- udr_setpos(udrs, NumberOfRanges_p);
- udr_UDIInt(udrs, &NumberOfRanges);
- udr_UDIInt(udrs, &NumberOfChips);
- udr_inline(udrs, NumberOfChips * sizeof(UDIInt32) );
- udr_UDIError(udrs, &tip_errno);
- udr_sendnow(udrs);
- break;
- }
-/*----------------------------------------------------------- UDICreateProcess
-*/
- case UDICreateProcess_c:
- {
- UDIPId pid; /* out */
-
- udrs->udr_op = UDR_ENCODE; /* send all "out" parameters */
- tip_errno = UDICreateProcess(&pid);
- udr_UDIPId(udrs, &pid);
- udr_UDIError(udrs, &tip_errno); /* send any TIP error */
- udr_sendnow(udrs);
- break;
- }
-/*------------------------------------------------------- UDIInitializeProcess
-*/
- case UDIInitializeProcess_c:
- {
- char* ProcessMemory_p; /* In */
- UDIInt NumberOfRanges; /* In */
- UDIResource EntryPoint; /* In */
- char* StackSizes_p; /* In */
- UDIInt NumberOfStacks; /* In */
- char *ArgString = sbuf; /* In */
- int cnt;
-
- udr_UDIInt(udrs, &NumberOfRanges); /* recv all "in" parameters */
- ProcessMemory_p = udr_getpos(udrs);
- udr_inline(udrs, NumberOfRanges * sizeof(UDIMemoryRange) );
- udr_UDIResource(udrs, &EntryPoint);
- udr_UDIInt(udrs, &NumberOfStacks);
- StackSizes_p = udr_getpos(udrs);
- udr_inline(udrs, NumberOfStacks * sizeof(CPUSizeT) );
- udr_string(udrs, ArgString);
-
- udrs->udr_op = UDR_ENCODE; /* send all "out" parameters */
- tip_errno = UDIInitializeProcess( ProcessMemory_p, NumberOfRanges,
- EntryPoint, StackSizes_p, NumberOfStacks, ArgString);
- udr_UDIError(udrs, &tip_errno); /* send any TIP error */
- udr_sendnow(udrs);
- break;
- }
-/*------------------------------------------------------- UDISetCurrentProcess
-*/
- case UDISetCurrentProcess_c:
- {
- UDIPId pid; /* in */
-
- udr_UDIPId(udrs, &pid); /* recv all "in" parameters */
-
- udrs->udr_op = UDR_ENCODE; /* send all "out" parameters */
- tip_errno = UDISetCurrentProcess(pid);
- udr_UDIError(udrs, &tip_errno); /* send any TIP error */
- udr_sendnow(udrs);
- break;
- }
-/*---------------------------------------------------------- UDIDestroyProcess
-*/
- case UDIDestroyProcess_c:
- {
- UDIPId pid; /* in */
-
- udr_UDIPId(udrs, &pid); /* recv all "in" parameters */
-
- udrs->udr_op = UDR_ENCODE; /* send all "out" parameters */
- tip_errno = UDIDestroyProcess(pid);
- udr_UDIError(udrs, &tip_errno); /* send any TIP error */
- udr_sendnow(udrs);
- break;
- }
-/*-------------------------------------------------------------------- UDIRead
-*/
- case UDIRead_c:
- {
- UDIResource from; /* in - source address on target */
- UDIHostMemPtr to_dfe; /* out - destination adds on dfe host */
- UDICount count; /* in -- count of objects */
- UDISizeT size; /* in -- size of each object */
- UDICount count_done; /* out - count actually transferred */
- UDIBool host_endian; /* in -- flag for endian information */
- char* count_done_p;
- char* to_dfe_p;
-
- udr_UDIResource(udrs, &from); /* recv all "in" parameters */
- udr_UDICount(udrs, &count);
- udr_UDISizeT(udrs, &size);
- udr_UDIBool(udrs, &host_endian);
-
- udrs->udr_op = UDR_ENCODE; /* send all "out" parameters */
- udr_work(udrs, count_done, 0); /* nothing to send yet */
- count_done_p = udr_getpos(udrs);
- udr_inline(udrs, sizeof(UDICount));/* make space for count_done */
- to_dfe_p = udr_getpos(udrs);
- tip_errno = UDIRead (from, to_dfe_p, count, size,
- &count_done, host_endian);
- udr_inline(udrs,count_done*size);/* make space in socket buffer */
- udr_UDIError(udrs, &tip_errno); /* send any TIP error */
- udr_setpos(udrs, count_done_p); /* restore count_done stream position */
- udr_UDICount(udrs, &count_done);
- udr_sendnow(udrs);
- break;
- }
-/*------------------------------------------------------------------- UDIWrite
-*/
- case UDIWrite_c:
- {
- UDIHostMemPtr from_dfe; /* in -- source address on DFE host */
- UDIResource to; /* in -- destination adds on target */
- UDICount count; /* in -- count of objects */
- UDISizeT size; /* in -- size of each object */
- UDICount count_done; /* out - count actually transferred */
- UDIBool host_endian; /* in -- flag for endian information */
- int byte_count;
- char* from_dfe_p;
-
- udr_UDIResource(udrs, &to); /* recv all "in" parameters */
- udr_UDICount(udrs, &count);
- udr_UDISizeT(udrs, &size);
- udr_UDIBool(udrs, &host_endian);
- from_dfe_p = udr_getpos(udrs); /* fake DFE host address */
- byte_count = size * count;
- udr_readnow(udrs, byte_count); /* read all data available from the
- socket into the stream buffer */
-
- udrs->udr_op = UDR_ENCODE; /* send all "out" parameters */
- tip_errno = UDIWrite( from_dfe_p, to, count, size,
- &count_done, host_endian );
- udr_UDICount(udrs, &count_done);
- udr_UDIError(udrs, &tip_errno); /* send any TIP error */
- udr_sendnow(udrs);
- break;
- }
-/*-------------------------------------------------------------------- UDICopy
-*/
- case UDICopy_c:
- {
- UDIResource from; /* in -- dest. address on target */
- UDIResource to; /* in -- source address on target */
- UDICount count; /* in -- count of objects */
- UDISizeT size; /* in -- size of each object */
- UDICount count_done; /* out - count actually transferred */
- UDIBool direction; /* in -- high-to-low or reverse */
-
- udr_UDIResource(udrs, &from); /* recv all "in" parameters */
- udr_UDIResource(udrs, &to);
- udr_UDICount(udrs, &count);
- udr_UDISizeT(udrs, &size);
- udr_UDIBool(udrs, &direction);
-
- udrs->udr_op = UDR_ENCODE; /* send all "out" parameters */
- tip_errno = UDICopy(from, to, count, size, &count_done, direction );
- udr_UDICount(udrs, &count_done);
- udr_UDIError(udrs, &tip_errno); /* send any TIP error */
- udr_sendnow(udrs);
- break;
- }
-/*----------------------------------------------------------------- UDIExecute
-*/
- case UDIExecute_c:
- {
- udrs->udr_op = UDR_ENCODE; /* send all "out" parameters */
- tip_errno = UDIExecute();
- udr_UDIError(udrs, &tip_errno); /* send any TIP error */
- udr_sendnow(udrs);
- break;
- }
-/*-------------------------------------------------------------------- UDIStep
-*/
- case UDIStep_c:
- {
- UDIUInt32 steps; /* in -- number of steps */
- UDIStepType steptype; /* in -- type of stepping to be done */
- UDIRange range; /* in -- range if StepInRange is TRUE */
-
- udr_UDIInt32(udrs, &steps); /* recv all "in" parameters */
- udr_UDIStepType(udrs, &steptype);
- udr_UDIRange(udrs, &range);
-
- udrs->udr_op = UDR_ENCODE; /* send all "out" parameters */
- tip_errno = UDIStep(steps, steptype, range);
- udr_UDIError(udrs, &tip_errno); /* send any TIP error */
- udr_sendnow(udrs);
- break;
- }
-/*-------------------------------------------------------------------- UDIWait
-*/
- case UDIWait_c:
- {
- UDIInt32 maxtime; /* in -- maximum time to wait for completion */
- UDIPId pid; /* out -- pid of process which stopped if any */
- UDIUInt32 stop_reason;/* out -- PC where process stopped */
-
- udr_UDIInt32(udrs, &maxtime);
-
- udrs->udr_op = UDR_ENCODE; /* send all "out" parameters */
- tip_errno = UDIWait(maxtime, &pid, &stop_reason);
- udr_UDIPId(udrs, &pid);
- udr_UDIUInt32(udrs, &stop_reason);
- udr_UDIError(udrs, &tip_errno); /* send any TIP error */
- udr_sendnow(udrs);
- break;
- }
-/*----------------------------------------------------------- UDISetBreakpoint
-*/
- case UDISetBreakpoint_c:
- {
- UDIResource addr; /* in -- where breakpoint gets set */
- UDIInt32 passcount; /* in -- passcount for breakpoint */
- UDIBreakType type; /* in -- breakpoint type */
- UDIBreakId break_id; /* out - assigned break id */
-
- udr_UDIResource(udrs, &addr); /* recv all "in" parameters */
- udr_UDIInt32(udrs, &passcount);
- udr_UDIBreakType(udrs, &type);
-
- udrs->udr_op = UDR_ENCODE; /* send all "out" parameters */
- tip_errno = UDISetBreakpoint (addr, passcount, type, &break_id);
- udr_UDIBreakId(udrs, &break_id);
- udr_UDIError(udrs, &tip_errno); /* send any TIP error */
- udr_sendnow(udrs);
- break;
- }
-/*--------------------------------------------------------- UDIQueryBreakpoint
-*/
- case UDIQueryBreakpoint_c:
- {
- UDIBreakId break_id; /* in -- assigned break id */
- UDIResource addr; /* out - where breakpoint was set */
- UDIInt32 passcount; /* out - trigger passcount */
- UDIBreakType type; /* out - breakpoint type */
- UDIInt32 current_count; /* out - current breakpoint count */
-
- udr_UDIBreakId(udrs, &break_id);/* recv all "in" parameters */
-
- udrs->udr_op = UDR_ENCODE; /* send all "out" parameters */
- tip_errno = UDIQueryBreakpoint (break_id, &addr, &passcount,
- &type, ¤t_count);
- udr_UDIResource(udrs, &addr);
- udr_UDIInt32(udrs, &passcount);
- udr_UDIBreakType(udrs, &type);
- udr_UDIInt32(udrs, ¤t_count);
- udr_UDIError(udrs, &tip_errno); /* send any TIP error */
- udr_sendnow(udrs);
- break;
- }
-/*--------------------------------------------------------- UDIClearBreakpoint
-*/
- case UDIClearBreakpoint_c:
- {
- UDIBreakId break_id; /* in -- assigned break id */
-
- udr_UDIBreakId(udrs, &break_id);/* recv all "in" parameters */
-
- udrs->udr_op = UDR_ENCODE; /* send all "out" parameters */
- tip_errno = UDIClearBreakpoint (break_id);
- udr_UDIError(udrs, &tip_errno); /* send any TIP error */
- udr_sendnow(udrs);
- break;
- }
-/*--------------------------------------------------------------- UDIGetStdout
-*/
- case UDIGetStdout_c:
- {
- UDIHostMemPtr buf_dfe; /* out -- dfe buffer to be filled */
- UDISizeT bufsize; /* in -- buffer size in bytes */
- UDISizeT count_done; /* out -- number of bytes written */
- char* buf_dfe_p;
- char* count_done_p;
-
- udr_UDISizeT(udrs, &bufsize); /* recv all "in" parameters */
-
- udrs->udr_op = UDR_ENCODE; /* send all "out" parameters */
- udr_work(udrs, count_done, 0); /* nothing to send yet */
- count_done_p = udr_getpos(udrs);
- udr_inline(udrs,sizeof(UDISizeT));/* make space for count_done */
- buf_dfe_p = udr_getpos(udrs); /* get start of string buffer */
- tip_errno = UDIGetStdout(buf_dfe_p, bufsize, &count_done);
- udr_inline(udrs, count_done); /* leave space for string */
- udr_UDIError(udrs, &tip_errno); /* send any TIP error */
- udr_setpos(udrs, count_done_p); /* restore count_done stram position */
- udr_UDISizeT(udrs, &count_done);
- udr_sendnow(udrs);
- break;
- }
-/*--------------------------------------------------------------- UDIGetStderr
-*/
- case UDIGetStderr_c:
- {
- UDIHostMemPtr buf_dfe; /* out -- dfe buffer to be filled */
- UDISizeT bufsize; /* in -- buffer size in bytes */
- UDISizeT count_done; /* out -- number of bytes written */
- char* buf_dfe_p;
- char* count_done_p;
-
- udr_UDISizeT(udrs, &bufsize); /* recv all "in" parameters */
-
- udrs->udr_op = UDR_ENCODE; /* send all "out" parameters */
- udr_work(udrs, count_done, 0); /* nothing to send yet */
- count_done_p = udr_getpos(udrs);
- udr_inline(udrs,sizeof(UDISizeT));/* make space for count_done */
- buf_dfe_p = udr_getpos(udrs); /* get start of string buffer */
- tip_errno = UDIGetStderr(buf_dfe_p, bufsize, &count_done);
- udr_inline(udrs, count_done); /* leave space for string */
- udr_UDIError(udrs, &tip_errno); /* send any TIP error */
- udr_setpos(udrs, count_done_p); /* restore count_done stram position */
- udr_UDISizeT(udrs, &count_done);
- udr_sendnow(udrs);
- break;
- }
-/*---------------------------------------------------------------- UDIPutStdin
-*/
- case UDIPutStdin_c:
- {
- UDIHostMemPtr buf_dfe; /* in -- buffer to be filled */
- UDISizeT count; /* in -- buffer size in bytes */
- UDISizeT count_done; /* out - number bytes written to buf */
- char* buf_dfe_p; /* pointer to incoming stream data */
-
- udr_UDISizeT(udrs, &count); /* recv all "in" parameters */
- buf_dfe_p = udr_getpos(udrs); /* get start of stream buffer */
-
- udrs->udr_op = UDR_ENCODE; /* send all "out" parameters */
- tip_errno = UDIPutStdin (buf_dfe_p, count, &count_done);
- udr_UDISizeT(udrs, &count_done);
- udr_UDIError(udrs, &tip_errno); /* send any TIP error */
- udr_sendnow(udrs);
- break;
- }
-/*--------------------------------------------------------------- UDIStdinMode
-*/
- case UDIStdinMode_c:
- {
- UDIMode mode; /* out - */
-
- udrs->udr_op = UDR_ENCODE; /* send all "out" parameters */
- tip_errno = UDIStdinMode (&mode);
- udr_UDIMode(udrs, &mode);
- udr_UDIError(udrs, &tip_errno); /* send any TIP error */
- udr_sendnow(udrs);
- break;
- }
-/*---------------------------------------------------------------- UDIPutTrans
-*/
- case UDIPutTrans_c:
- {
- UDIHostMemPtr buf; /* in -- buffer to be filled */
- UDISizeT count; /* in -- buffer size in bytes */
- UDISizeT count_done; /* out - number bytes written to buf */
-
- udr_UDISizeT(udrs, &count); /* recv all "in" parameters */
- buf = udr_getpos(udrs); /* get start of stream buffer */
-
- udrs->udr_op = UDR_ENCODE; /* send all "out" parameters */
- tip_errno = UDIPutTrans (buf, count, &count_done);
- udr_UDISizeT(udrs, &count_done);
- udr_UDIError(udrs, &tip_errno); /* send any TIP error */
- udr_sendnow(udrs);
- break;
- }
-/*---------------------------------------------------------------- UDIGetTrans
-*/
- case UDIGetTrans_c:
- {
- UDIHostMemPtr buf_dfe; /* out -- dfe buffer to be filled */
- UDISizeT bufsize; /* in -- buffer size in bytes */
- UDISizeT count_done; /* out -- number of bytes written */
- char* buf_dfe_p;
- char* count_done_p;
-
- udr_UDISizeT(udrs, &bufsize); /* recv all "in" parameters */
-
- udrs->udr_op = UDR_ENCODE; /* send all "out" parameters */
- udr_work(udrs, count_done, 0); /* nothing to send yet */
- count_done_p = udr_getpos(udrs);
- udr_inline(udrs,sizeof(UDISizeT));/* make space for count_done */
- buf_dfe_p = udr_getpos(udrs); /* get start of string buffer */
- tip_errno = UDIGetTrans (buf_dfe_p, bufsize, &count_done);
- udr_inline(udrs, count_done); /* leave space for string */
- udr_UDIError(udrs, &tip_errno); /* send any TIP error */
- udr_setpos(udrs, count_done_p); /* restore count_done stram position */
- udr_UDISizeT(udrs, &count_done);
- udr_sendnow(udrs);
- break;
- }
-/*--------------------------------------------------------------- UDITransMode
-*/
- case UDITransMode_c:
- {
- UDIMode mode; /* in -- selected mode */
-
- udr_UDIMode(udrs, &mode); /* recv all "in" parameters */
-
- udrs->udr_op = UDR_ENCODE; /* send all "out" parameters */
- tip_errno = UDITransMode(&mode);
- udr_UDIError(udrs, &tip_errno); /* send any TIP error */
- udr_sendnow(udrs);
- }
-/*-------------------------------------------------------------------- UDITest
-*/
- case UDITest_c:
- {
- UDISizeT cnt;
- UDIHostMemPtr str_p;
- UDIHostMemPtr iarray_dfe;
- UDISizeT r_cnt;
- UDIInt16 scnt;
- UDIInt32 array[4];
-
- udr_UDISizeT(udrs, &cnt);
- udr_UDIInt16(udrs, &scnt);
- udr_bytes(udrs, (char*)array, 4*sizeof(UDIInt32));
- udr_string(udrs, sbuf);
-
- udrs->udr_op = UDR_ENCODE; /* send all "out" parameters */
- r_cnt = cnt;
- cnt = array[3]; array[3] = array[0]; array[0] = cnt;
- cnt = array[2]; array[2] = array[1]; array[1] = cnt;
- tip_errno = 0;
- udr_UDISizeT(udrs, &r_cnt);
- scnt = -1* scnt;
- udr_UDIInt16(udrs, &scnt);
- udr_bytes(udrs, (char*)array, 4*sizeof(UDIInt32));
- for(cnt=0; cnt< strlen(sbuf);cnt++)sbuf[cnt] -= 32;
- udr_string(udrs, sbuf);
- udr_UDIError(udrs, &tip_errno); /* send any TIP error */
- udr_sendnow(udrs);
- if(scnt == 3)
- { fprintf(stderr,"TIP-ipc test sleep(30) seconds\n");
- sleep(30);
- }
- break;
- }
- }
- }
-}
+++ /dev/null
-.\" t
-.\" The above line must be present to tell man to process through tbl.
-.\" @(#)sunudi.5 2.2, AMD
-.\"Copyright (c) 1989, 1990, 1991 by Advanced Micro Devices, Inc.
-.\"All rights reserved. No part of this publication may be reproduced,
-.\"stored in a retrieval system, or transmitted in any form or by any
-.\"means, electronic, mechanical, photocopying, recording or otherwise,
-.\"without the prior written permission of Advanced Micro Devices, Inc.
-.\"
-.\"You must change the date in these files for a release!
-.\"The commands used to generate output from this input are:
-.\" tbl udi.1 | nroff -man - > filename (Goes to a unix file)
-.\" tbl udi.1 | ptroff -man - (Goes to PostScript printer)
-.\"
-.TH UDI 5 "05 Feb 1992" "UDI Files"
-.UC 4
-.SH NAME
-\fBudi\fP \- UDI Configuration Files for SUN hosts.
-.sp
-.sp
-.SH DESCRIPTION
-A UDI conformant Debugger Front End (DFE) specifies the Target
-Interface Process (TIP) that it wishes to connect to and
-the options that it wishes to pass to that TIP by referencing
-a configuration in the "UDI configuration file".
-This man page explains the format of the UDI Configuration file
-for Sun hosts.
-.sp
-The search rules that the DFE uses to locate the UDI Configuration
-file are:
-.IP
-the complete filename specified by the environment variable, UDICONF.
-.IP
-the file udi_soc in the current directory.
-.IP
-the file udi_soc in each of the directories specified by the PATH environment
-variable.
-.sp
-.LP
-A line of the UDI Configuration File can have two different formats
-depending on whether the address family is AF_UNIX or AF_INET.
-The two formats are:
-.IP
-.I tip_config_name AF_UNIX socket_name tip_executable [tip_options]
-.IP
-.I tip_config_name AF_INET host_name port_number [tip_options]
-.TP 10
-.I tip_config_name
-An arbitrary name which the DFE will use to refer to this configuration.
-Each line in the UDI Configuration File must have a different tip_config_name field.
-.TP
-.I AF_UNIX
-This address family should be used
-when the DFE and TIP are running on the same host.
-This is the typical case.
-.TP
-.I AF_INET
-This address family should be used
-when the DFE and TIP are running on different hosts.
-.TP
-.I socket_name
-Used with AF_UNIX configurations only.
-Specifies the socket file name
-which will be used to communicate between
-the DFE and TIP. The special socket_name "*" indicates that a unique
-socket file name should be automatically generated by the IPC layer.
-This is useful if you want to have multiple DFEs connecting
-to the same configuration name.
-If the socket_name is explictly specified, be aware that
-if any two AF_UNIX TIP configurations are being used simultaneously, they
-must have unique socket_names.
-For DFEs who wish to disconnect from a TIP and then reconnect to that
-same TIP at some later time, an explicit socket_name is required.
-.TP
-.I tip_executable
-Used with AF_UNIX configurations only.
-The DFE will use the tip_executable filename
-to spawn the TIP if the TIP is not already running
-and listening at the indicated socket_name.
-If a full pathname is not specified, the PATH environment variable
-is used to locate the executable file.
-Note that when the socket_name is "*", a new TIP executable
-is always spawned.
-.sp
-.TP
-.I host_name
-Used with AF_INET configurations only.
-This specifies the name of the host where the TIP
-is running.
-.TP
-.I port_number
-Used with AF_INET configurations only.
-This specifies the port_number at which the TIP
-on the remote host is listening.
- Note that in an AF_INET configuration
-the TIP cannot be spawned by the DFE and must
-already be running at the time of the connection.
-The TIP on the remote host should be started with
-a command line of
-.br
- tip_executable_name AF_INET port_number
-
-.TP
-.I tip_options
-Valid with both AF_UNIX and AF_INET configurations.
-This optional string of parmeters is passed through to
-the TIP at connect time and is usually interpreted
-by the TIP as a set of startup parameters.
-.sp
-.SH EXAMPLES OF UDI CONFIGURATION FILE ENTRIES
-.sp
-The following are examples of entries in the UDI configuration
-file on SUN hosts.
-.LP
-\fB iss050 AF_UNIX * isstip -29050 -r osboot \fR
-.IP
-The above entry associates the TIP configuration name "iss050" with the
-\fBisstip\fR executable with the parameters
-"-29050 -r osboot" being passed to isstip
-when the connection is made.
-The AF_UNIX address family with an automatically generated
-socket name will be used to communicate between DFE and TIP.
-Because of the automatic socket name generation,
-a new invocation of isstip will always be created when the iss050
-configuration is specified.
-.LP
-\fB iss050x AF_UNIX sock_iss50 isstip -29050 -r osboot \fR
-.IP
-The above entry associates the TIP configuration name "iss050x" with the
-same \fBisstip\fR executable and same startup parameters
-as the previous example.
-The AF_UNIX address family and the explicit socket file name
-sock_iss50 will be used to communicate between DFE and TIP.
-If isstip is not already running and listening on sock_iss50,
-an instance of isstip will be created.
-.LP
-\fB iss50_remote AF_INET fasthost 7000 -29050 -r osboot \fR
-.IP
-The above entry assumes that some TIP is already running on the host
-named fasthost and listening at port 7000. For example,
-isstip could have been started on fasthost with the command line
-.br
- isstip AF_INET 7000
-.br
-The parameters "-29050 -r osboot" will be passed to
-the remote TIP at connect time.
-.sp
-.SH TRADEMARKS
-AMD is a registered trademark of Advanced Micro Devices, Inc.
-MiniMON29K, 29K, Am29000, Am29005, Am29030, Am29035, Am29200,
-and Am29050 are trademarks of Advanced Micro Devices, Inc.
+++ /dev/null
-
-
-
-UDI(5) FILE FORMATS UDI(5)
-
-
-
-NAME
- udi - UDI Configuration Files for SUN hosts.
-
-
-
-DESCRIPTION
- A UDI conformant Debugger Front End (DFE) specifies the Tar-
- get Interface Process (TIP) that it wishes to connect to and
- the options that it wishes to pass to that TIP by referenc-
- ing a configuration in the "UDI configuration file". This
- man page explains the format of the UDI Configuration file
- for Sun hosts.
-
- The search rules that the DFE uses to locate the UDI Confi-
- guration file are:
-
- the complete filename specified by the environment
- variable, UDICONF.
-
- the file udi_soc in the current directory.
-
- the file udi_soc in each of the directories specified
- by the PATH environment variable.
-
-
- A line of the UDI Configuration File can have two different
- formats depending on whether the address family is AF_UNIX
- or AF_INET. The two formats are:
-
- tip_config_name AF_UNIX socket_name tip_executable
- [tip_options]
-
- tip_config_name AF_INET host_name port_number
- [tip_options]
-
- tip_config_name
- An arbitrary name which the DFE will use to refer
- to this configuration. Each line in the UDI Con-
- figuration File must have a different
- tip_config_name field.
-
- AF_UNIX This address family should be used when the DFE
- and TIP are running on the same host. This is the
- typical case.
-
- AF_INET This address family should be used when the DFE
- and TIP are running on different hosts.
-
- socket_name
- Used with AF_UNIX configurations only. Specifies
- the socket file name which will be used to commun-
- icate between the DFE and TIP. The special
-
-
-
-UDI Files Last change: 05 Feb 1992 1
-
-
-
-
-
-
-UDI(5) FILE FORMATS UDI(5)
-
-
-
- socket_name "*" indicates that a unique socket
- file name should be automatically generated by the
- IPC layer. This is useful if you want to have
- multiple DFEs connecting to the same configuration
- name. If the socket_name is explictly specified,
- be aware that if any two AF_UNIX TIP configura-
- tions are being used simultaneously, they must
- have unique socket_names. For DFEs who wish to
- disconnect from a TIP and then reconnect to that
- same TIP at some later time, an explicit
- socket_name is required.
-
- tip_executable
- Used with AF_UNIX configurations only. The DFE
- will use the tip_executable filename to spawn the
- TIP if the TIP is not already running and listen-
- ing at the indicated socket_name. If a full path-
- name is not specified, the PATH environment vari-
- able is used to locate the executable file. Note
- that when the socket_name is "*", a new TIP exe-
- cutable is always spawned.
-
-
- host_name Used with AF_INET configurations only. This
- specifies the name of the host where the TIP is
- running.
-
- port_number
- Used with AF_INET configurations only. This
- specifies the port_number at which the TIP on the
- remote host is listening.
- Note that in an AF_INET configuration the TIP
- cannot be spawned by the DFE and must already be
- running at the time of the connection. The TIP on
- the remote host should be started with a command
- line of
- tip_executable_name AF_INET port_number
-
-
- tip_options
- Valid with both AF_UNIX and AF_INET configura-
- tions. This optional string of parmeters is
- passed through to the TIP at connect time and is
- usually interpreted by the TIP as a set of startup
- parameters.
-
-
-EXAMPLES OF UDI CONFIGURATION FILE ENTRIES
- The following are examples of entries in the UDI configura-
- tion file on SUN hosts.
-
-
-
-
-
-UDI Files Last change: 05 Feb 1992 2
-
-
-
-
-
-
-UDI(5) FILE FORMATS UDI(5)
-
-
-
- iss050 AF_UNIX * isstip -29050 -r osboot
-
- The above entry associates the TIP configuration name
- "iss050" with the isstip executable with the parameters
- "-29050 -r osboot" being passed to isstip when the con-
- nection is made. The AF_UNIX address family with an
- automatically generated socket name will be used to
- communicate between DFE and TIP. Because of the
- automatic socket name generation, a new invocation of
- isstip will always be created when the iss050 confi-
- guration is specified.
-
- iss050x AF_UNIX sock_iss50 isstip -29050 -r osboot
-
- The above entry associates the TIP configuration name
- "iss050x" with the same isstip executable and same
- startup parameters as the previous example. The
- AF_UNIX address family and the explicit socket file
- name sock_iss50 will be used to communicate between DFE
- and TIP. If isstip is not already running and listen-
- ing on sock_iss50, an instance of isstip will be
- created.
-
- iss50_remote AF_INET fasthost 7000 -29050 -r osboot
-
- The above entry assumes that some TIP is already run-
- ning on the host named fasthost and listening at port
- 7000. For example, isstip could have been started on
- fasthost with the command line
- isstip AF_INET 7000 The parameters "-29050 -r
- osboot" will be passed to the remote TIP at connect
- time.
-
-
-TRADEMARKS
- AMD is a registered trademark of Advanced Micro Devices,
- Inc. MiniMON29K, 29K, Am29000, Am29005, Am29030, Am29035,
- Am29200, and Am29050 are trademarks of Advanced Micro Dev-
- ices, Inc.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-UDI Files Last change: 05 Feb 1992 3
-
-
-
+++ /dev/null
-/******************************************************************************
-* Copyright 1991 Advanced Micro Devices, Inc.
-*
-* This software is the property of Advanced Micro Devices, Inc (AMD) which
-* specifically grants the user the right to modify, use and distribute this
-* software provided this notice is not removed or altered. All other rights
-* are reserved by AMD.
-*
-* AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
-* SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
-* DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
-* USE OF THIS SOFTWARE.
-*
-* So that all may benefit from your experience, please report any problems
-* or suggestions about this software to the 29K Technical Support Center at
-* 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
-* 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
-*
-* Advanced Micro Devices, Inc.
-* 29K Support Products
-* Mail Stop 573
-* 5900 E. Ben White Blvd.
-* Austin, TX 78741
-* 800-292-9263
-*****************************************************************************
-* NAME @(#)tip_test.c 1.1 91/07/24 Daniel Mann
-*
-* This module is used for testing of TIP services.
-********************************************************************** HISTORY
-*/
-#include <stdio.h>
-#include "udiproc.h"
-
-UDIError UDIConnect() {return;}
-UDIError UDIDisconnect() {return;}
-UDIError UDISetCurrentConnection() {return;}
-UDIError UDICapabilities() {return;}
-UDIError UDIEnumerateTIPs() {return;}
-UDIError UDIGetErrorMsg() {return;}
-UDIError UDIGetTargetConfig() {return;}
-UDIError UDICreateProcess() {return;}
-UDIError UDISetCurrentProcess() {return;}
-UDIError UDIDestroyProcess() {return;}
-UDIError UDIInitializeProcess() {return;}
-UDIError UDIRead() {return;}
-UDIError UDIWrite() {return;}
-UDIError UDICopy() {return;}
-UDIError UDIExecute() {return;}
-UDIError UDIStep() {return;}
-UDIError UDIStop() {return;}
-UDIError UDIWait() {return;}
-UDIError UDISetBreakpoint() {return;}
-UDIError UDIQueryBreakpoint() {return;}
-UDIError UDIClearBreakpoint() {return;}
-UDIError UDIGetStdout() {return;}
-UDIError UDIGetStderr() {return;}
-UDIError UDIPutStdin() {return;}
-UDIError UDIStdinMode() {return;}
-UDIError UDIPutTrans() {return;}
-UDIError UDIGetTrans() {return;}
-UDIError UDITransMode() {return;}
+++ /dev/null
-;******************************************************************************
-;* Copyright 1991 Advanced Micro Devices, Inc.
-;*
-;* This software is the property of Advanced Micro Devices, Inc (AMD) which
-;* specifically grants the user the right to modify, use and distribute this
-;* software provided this notice is not removed or altered. All other rights
-;* are reserved by AMD.
-;*
-;* AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
-;* SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
-;* DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
-;* USE OF THIS SOFTWARE.
-;*
-;* Comments about this software should be directed to udi@amd.com. If access
-;* to electronic mail isn't available, send mail to:
-;*
-;* Advanced Micro Devices, Inc.
-;* 29K Support Products
-;* Mail Stop 573
-;* 5900 E. Ben White Blvd.
-;* Austin, TX 78741
-;*****************************************************************************
-;* $Id$
-;*/
-;
-; The following structure is filled in by a small assembly
-; language piece of code that runs when UDIDisconnect is
-; called by the DFE. It is used by a small piece of assembly
-; code on the DFE side IF the TIP used DOS Exit to clean it-
-; self up. The DFE side code then "returns" on behalf of the
-; TIP.
-; This structure should track with a C language version of
-; the same structure in udidos.h.
-DOSTerm STRUC
-TermFunc dd ?
-sds dw ?
-sss dw ?
-ssi dw ?
-sdi dw ?
-ssp dw ?
-retval dw ?
-sbp dw ?
-DOSTerm ENDS
+++ /dev/null
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * Comments about this software should be directed to udi@amd.com. If access
- * to electronic mail isn't available, send mail to:
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- *****************************************************************************
- * $Id$
- * $Id: @(#)udidos.h 2.8, AMD
- */
-
-/* Modified: M.Typaldos 11/92 - Added '386 specific code (just changed
- * far to _FAR really).
- */
-
-#ifdef DOS386
-#include <pharlap.h>
-#include <pltypes.h>
-#define _FAR
-typedef REALPTR RealUDIVecRecPtr;
-#else
-#define _FAR far
-typedef struct UDIVecRec far *RealUDIVecRecPtr;
-#endif
-
-/* Structure used to deal with shutting down of TIPs. This
- structure is primarily used by assembly language code.
- */
-typedef UDIStruct DOSTerm {
- void (far *TermFunc)(void);
- UDIUInt16 sds;
- UDIUInt16 sss;
- UDIUInt16 ssi;
- UDIUInt16 sdi;
- UDIUInt16 ssp;
- UDIUInt16 retval;
- UDIUInt16 sbp;
-} DOSTerm;
-
-
-
-union rec {
- unsigned char c[4];
- long l;
- };
-
-
-#define UDIDOSTIPRecognizer "\xcfudi"
-#define InitRecognizer( x ) memcpy( (x), UDIDOSTIPRecognizer, 4 )
-
-struct UDIVecRec {
- union rec recognizer; /* Our "who we are" matching string */
- RealUDIVecRecPtr Next; /* Pointer to next TIP */
- RealUDIVecRecPtr Prev; /* Pointer to previous TIP */
- char _FAR *exeName; /* Name of the executable we were loaded as */
- UDIError (_FAR *UDIConnect) UDIParams((
- char far *Configuration, /* In */
- UDISessionId far *Session, /* Out */
- DOSTerm far *TermStruct /* In - not seen in UDIP */
- ));
- UDIError (_FAR *UDIDisconnect) UDIParams((
- UDISessionId Session, /* In */
- UDIBool Terminate, /* In */
- DOSTerm far *TermStruct /* In - not seen in UDIP */
- ));
- UDIError (_FAR *UDISetCurrentConnection) UDIParams((
- UDISessionId Session /* In */
- ));
- UDIError (_FAR *UDICapabilities) UDIParams((
- UDIUInt32 far *TIPId, /* Out */
- UDIUInt32 far *TargetId, /* Out */
- UDIUInt32 DFEId, /* In */
- UDIUInt32 DFE, /* In */
- UDIUInt32 far *TIP, /* Out */
- UDIUInt32 far *DFEIPCId, /* Out */
- UDIUInt32 far *TIPIPCId, /* Out */
- char far *TIPString /* Out */
- ));
- UDIError (_FAR *UDIGetErrorMsg) UDIParams((
- UDIError ErrorCode, /* In */
- UDISizeT MsgSize, /* In */
- char far *Msg, /* Out */
- UDISizeT far *CountDone /* Out */
- ));
- UDIError (_FAR *UDIGetTargetConfig) UDIParams((
- UDIMemoryRange far KnownMemory[], /* Out */
- UDIInt far *NumberOfRanges, /* In/Out */
- UDIUInt32 far ChipVersions[], /* Out */
- UDIInt far *NumberOfChips /* In/Out */
- ));
- UDIError (_FAR *UDICreateProcess) UDIParams((
- UDIPId far *PId /* Out */
- ));
- UDIError (_FAR *UDISetCurrentProcess) UDIParams((
- UDIPId PId /* In */
- ));
- UDIError (_FAR *UDIDestroyProcess) UDIParams((
- UDIPId PId /* In */
- ));
- UDIError (_FAR *UDIInitializeProcess) UDIParams((
- UDIMemoryRange far ProcessMemory[], /* In */
- UDIInt NumberOfRanges, /* In */
- UDIResource EntryPoint, /* In */
- CPUSizeT far StackSizes[], /* In */
- UDIInt NumberOfStacks, /* In */
- char far *ArgString /* In */
- ));
- UDIError (_FAR *UDIRead) UDIParams((
- UDIResource From, /* In */
- UDIHostMemPtr To, /* Out */
- UDICount Count, /* In */
- UDISizeT Size, /* In */
- UDICount far *CountDone, /* Out */
- UDIBool HostEndian /* In */
- ));
- UDIError (_FAR *UDIWrite) UDIParams((
- UDIHostMemPtr From, /* In */
- UDIResource To, /* In */
- UDICount Count, /* In */
- UDISizeT Size, /* In */
- UDICount far *CountDone, /* Out */
- UDIBool HostEndian /* In */
- ));
- UDIError (_FAR *UDICopy) UDIParams((
- UDIResource From, /* In */
- UDIResource To, /* In */
- UDICount Count, /* In */
- UDISizeT Size, /* In */
- UDICount far *CountDone, /* Out */
- UDIBool Direction /* In */
- ));
- UDIError (_FAR *UDIExecute) UDIParams((
- void
- ));
- UDIError (_FAR *UDIStep) UDIParams((
- UDIUInt32 Steps, /* In */
- UDIStepType StepType, /* In */
- UDIRange Range /* In */
- ));
- UDIVoid (_FAR *UDIStop) UDIParams((
- void
- ));
- UDIError (_FAR *UDIWait) UDIParams((
- UDIInt32 MaxTime, /* In */
- UDIPId far *PId, /* Out */
- UDIUInt32 far *StopReason /* Out */
- ));
- UDIError (_FAR *UDISetBreakpoint) UDIParams((
- UDIResource Addr, /* In */
- UDIInt32 PassCount, /* In */
- UDIBreakType Type, /* In */
- UDIBreakId far *BreakId /* Out */
- ));
- UDIError (_FAR *UDIQueryBreakpoint) UDIParams((
- UDIBreakId BreakId, /* In */
- UDIResource far *Addr, /* Out */
- UDIInt32 far *PassCount, /* Out */
- UDIBreakType far *Type, /* Out */
- UDIInt32 far *CurrentCount /* Out */
- ));
- UDIError (_FAR *UDIClearBreakpoint) UDIParams((
- unsigned int BreakId /* In */
- ));
- UDIError (_FAR *UDIGetStdout) UDIParams((
- UDIHostMemPtr Buf, /* Out */
- UDISizeT BufSize, /* In */
- UDISizeT far *CountDone /* Out */
- ));
- UDIError (_FAR *UDIGetStderr) UDIParams((
- UDIHostMemPtr Buf, /* Out */
- UDISizeT BufSize, /* In */
- UDISizeT far *CountDone /* Out */
- ));
- UDIError (_FAR *UDIPutStdin) UDIParams((
- UDIHostMemPtr Buf, /* In */
- UDISizeT Count, /* In */
- UDISizeT far *CountDone /* Out */
- ));
- UDIError (_FAR *UDIStdinMode) UDIParams((
- UDIMode far *Mode /* Out */
- ));
- UDIError (_FAR *UDIPutTrans) UDIParams((
- UDIHostMemPtr Buf, /* In */
- UDISizeT Count, /* In */
- UDISizeT far *CountDone /* Out */
- ));
- UDIError (_FAR *UDIGetTrans) UDIParams((
- UDIHostMemPtr Buf, /* Out */
- UDISizeT BufSize, /* In */
- UDISizeT far *CountDone /* Out */
- ));
- UDIError (_FAR *UDITransMode) UDIParams((
- UDIMode far *Mode /* Out */
- ));
- };
-
-
+++ /dev/null
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * Comments about this software should be directed to udi@amd.com. If access
- * to electronic mail isn't available, send mail to:
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- *****************************************************************************
- * $Id: @(#)udiids.h 3.2, AMD
- */
-
-/* This file contains the DFE and TIP IDs to be used by AMD products for */
-/* the UDICapabilities call */
-
- /* Company Codes -- AMD assigns these */
-#define UDICompanyCode_AMD 1
-#define UDICompanyCode_Honeywell 2
-#define UDICompanyCode_EPI 3
-
- /* Build a UDIID given a CompanyProdCode and 3 version pieces */
-#define UDIID(CompanyProdCode, v1,v2,v3) ((((CompanyProdCode) & 0xfffff)<<12)+\
- (((v1)&0xf)<<8) + (((v2)&0xf)<<4) + ((v3)&0xf))
-
-
- /* Extract a CompanyProdCode or a Version from a UDIID */
-#define UDIID_CompanyProdCode(id) (((id)>>12) & 0xfffff)
-#define UDIID_Version(id) ((id)&0xfff)
-
-
-#define UDIAMDProduct(ProdCode) ((UDICompanyCode_AMD<<4) + (ProdCode&0xf))
-
- /* AMD DFE Product Codes */
-#define UDIProductCode_Mondfe UDIAMDProduct(0)
-#define UDIProductCode_XRAY UDIAMDProduct(1)
-#define UDIProductCode_TIPTester UDIAMDProduct(2)
-
- /* AMD TIP Product Codes (need not be distinct from DFE Product Codes) */
-#define UDIProductCode_Montip UDIAMDProduct(0)
-#define UDIProductCode_Isstip UDIAMDProduct(1)
-#define UDIProductCode_MON29Ktip UDIAMDProduct(2)
-
-#ifdef UDI13
-#define UDILatestVersion 0x130 /* UDI 1.3.0, can be used in DFE and TIP desired UDI params */
-#else
-#define UDILatestVersion 0x120 /* UDI 1.2.0, can be used in DFE and TIP desired UDI params */
-#endif /* UDI13 */
+++ /dev/null
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * Comments about this software should be directed to udi@amd.com. If access
- * to electronic mail isn't available, send mail to:
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- *****************************************************************************
- * $Id$
- * $Id: @(#)udip2dos.c 2.22, AMD
- */
-
-/* Modified M.Typaldos 11/92 - Added '386 specific code (mainly calls to
- * functions in dos386c.c, UDIPxxx calls).
- */
-
-#define _UDIP2DOS_C
-
-
-#if 1
-#define DFEIPCIdCompany 0x0001 /* Company ID AMD */
-#define DFEIPCIdProduct 0x1 /* Product ID 0 */
-#endif
-#define DFEIPCIdVersion 0x125 /* 1.2.5 */
-
-#include <process.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <udiproc.h>
-#include <udidos.h>
-
-#ifdef DOS386
-#include <pltypes.h>
-#include <pharlap.h>
-#include <dos386c.h>
-#include <realcopy.h>
-
- /*
- * term_addr will be used to store the protected mode address
- * of TermStruct. This is a 48 bit pointer into the area
- * allocated by the call to realcopy. The address is stored
- * in term_addr by UDIConnect.
- *
- */
- ULONG *term_addr_ptr;
- FARPTR term_addr;
-
- /********************************************************
- * In DOS386 mode, a standard C PTR is a protected mode ptr
- * so CPTR_TO_REALPTR invokes PROT_TO_REAL and REALPTR_TO_CPTR
- * just invokes REAL_TO_PROT
- ********************************************************/
-#define CPTR_TO_REALPTR(p) PROT_TO_REAL(p)
-#define REALPTR_TO_CPTR(p) REAL_TO_PROT(p)
-
-
-#else /* not DOS386 */
-
- /********************************************************
- * In non-DOS386 mode, a standard C PTR is just a far real ptr
- * so CPTR_TO_REALPTR and REALPTR_TO_CPTR are noops
- ********************************************************/
-#define CPTR_TO_REALPTR(p) (p)
-#define REALPTR_TO_CPTR(p) (p)
-#define NEARPTR_TO_FARPTR(p) (p)
-
-#define _fstrcmp(a,b) strcmp(a,b)
-
-#define FP_OFF(p) (p)
-#define REALPTR
-
-
-
-#endif /* DOS386 */
-
-
-#ifdef __HIGHC__
-/* hc386 doesn't have fstrcmp */
-/* this specialized version only works for strings less than 256 */
-/* which is good enough for comparing TIP names */
-int _fstrcmp(FARPTR s1, char _far * s2)
-{
-#define MAXFARSTR 256
- char nears1[MAXFARSTR];
- char nears2[MAXFARSTR];
- extern USHORT GetDS();
-
- _movedata(FP_SEL(s1), FP_OFF(s1), GetDS(), (unsigned int)nears1, MAXFARSTR);
- _movedata(FP_SEL(s2), FP_OFF(s2), GetDS(), (unsigned int)nears2, MAXFARSTR);
- return(strcmp(nears1,nears2));
-
-}
-
-#endif
-
-#ifdef DOS386
-#include "io.h"
- /* this routine takes a possibly incomplete executable name */
- /* and uses the PATH environment variable to get the full name */
-void get_full_exe_name(char *TIPName, char *FullName)
-{
-char *path_env = getenv("PATH");
-char drive[10];
-char dir[128];
-char fname[10];
-char ext[10];
-char pathprefix[128];
-char pathdir[128];
-char *tmp;
-
- _splitpath(TIPName, drive, dir, fname, ext);
- if (strlen(ext) == 0)
- strcpy(ext, ".exe"); /* if no ext, force .exe */
- if (dir[0] == '\\') {
- /* absolute pathname, just return it */
- _makepath(FullName, drive,dir,fname,ext);
- return;
- }
- else {
- /* not an absolute pathname, need to use PATH env var */
- tmp = path_env;
- while ( *tmp != '\0')
- {
- sscanf(tmp, "%[^;]", pathprefix);
- sprintf (pathdir, "%s\\%s", pathprefix, dir);
- _makepath(FullName, drive,pathdir,fname,ext);
- if (access (FullName, 0) == 0 ) { /* check for open with read access */
- return; /* found one, return with FullName set */
- }
- else {
- tmp += strlen(pathprefix) + 1;
- }
- } /* while */
- /* if we got this far, we didn't find a match */
- *FullName = 0;
- } /* if */
-
-}
-
-
-int dpmi_exists(void)
-{
- CONFIG_INF config; /* for DPMI config info */
- UCHAR vmmname[256];
-
- _dx_config_inf(&config, vmmname); /* arg2 not really used here */
- return(config.c_dpmif);
-}
-
-
-#endif
-
-/*************************************************************
- * The following macros allow us to use a common macro to make a UDICall
- * for either real mode DFEs or DOS386 mode DFEs
- *************************************************************/
-#if defined __STDC__ || defined _MSC_VER
-#define XCAT(a,b) a##b
-#else
-#define XCAT(a,b) a/**/b
-#endif
-#define CAT(a,b) XCAT(a,b)
-
-#ifndef DOS386
-
- /************************************************
- * in real mode, just call directly thru the connection pointer to the TIP
- * eg, UDICALL3(p,f,a,b,c) becomes p->UDIf(a,b,c)
- ************************************************/
-#define UDICALLPREFIX0(p,f) CAT(p->UDI,f)(
-#define UDICALLPREFIX(p,f) UDICALLPREFIX0(p,f) /* same for 0 or >0 args */
-
-#else /* not DOS386 */
-
-
- /************************************************
- * in DOS386 mode, call an intermediate function UDIPxxx
- * and pass it a pointer to the TIP function, (along with all parameters)
- * eg, UDICALL3(p,f,a,b,c) becomes UDIPf(p->UDIf,a,b,c)
- ************************************************/
-#define UDICALLPREFIX0(p,f) CAT(UDIP,f)(CAT((REALPTR)p->UDI,f)
-#define UDICALLPREFIX(p,f) UDICALLPREFIX0(p,f) , /* need a comma here for >0 args */
-#endif /* else on DOS386 */
-
-#define UDICALL0(p,f) UDICALLPREFIX0(p,f) )
-#define UDICALL1(p,f,a1) UDICALLPREFIX(p,f) a1)
-#define UDICALL2(p,f,a1,a2) UDICALLPREFIX(p,f) a1,a2)
-#define UDICALL3(p,f,a1,a2,a3) UDICALLPREFIX(p,f) a1,a2,a3)
-#define UDICALL4(p,f,a1,a2,a3,a4) UDICALLPREFIX(p,f) a1,a2,a3,a4)
-#define UDICALL5(p,f,a1,a2,a3,a4,a5) UDICALLPREFIX(p,f) a1,a2,a3,a4,a5)
-#define UDICALL6(p,f,a1,a2,a3,a4,a5,a6) UDICALLPREFIX(p,f) a1,a2,a3,a4,a5,a6)
-#define UDICALL7(p,f,a1,a2,a3,a4,a5,a6,a7) UDICALLPREFIX(p,f) a1,a2,a3,a4,a5,a6,a7)
-#define UDICALL8(p,f,a1,a2,a3,a4,a5,a6,a7,a8) UDICALLPREFIX(p,f) a1,a2,a3,a4,a5,a6,a7,a8)
-
-
-
-
-extern DOSTerm TermStruct; /* located in dosdfe.asm */
-extern void UDITerminate();
-
-
-#define FBUFSIZE 2048
-
-struct UDIConnections {
- struct UDIVecRec _far * VecRecP;
- UDISessionId ConnId;
-}; /* struct UDIConnections */
-
-#define NumSessions 10
-
-static struct UDIVecRec _far * CurrentConnection;
-
-#ifdef DOS386
-
-REALPTR _far * UDIVecP;
-#define REALNULL (REALPTR) 0
-
-#else
-
-static struct UDIVecRec _FAR * _FAR * UDIVecP;
-#define REALNULL NULL
-
-#endif
-
-
-static struct UDIConnections Connections[ NumSessions ];
-
-static char *GetConfigFileName( void )
-{
- char *cp;
- static char buf[ _MAX_PATH ];
-
- if ((cp = getenv( "UDICONF" )) != NULL)
- return cp;
-
- _searchenv( "udiconfs.txt", "PATH", buf );
-
- return buf;
- }
-
-#ifdef DOS386
-
-REALPTR _far * FindIntVect()
-
-#else
-
-static struct UDIVecRec _FAR * _FAR * FindIntVect()
-
-#endif
-{
- union rec recognizer;
- int i;
-
- InitRecognizer( &recognizer );
-
-
- /* Try and find a vector that is currently in use for UDI */
- for (i = 0x60; i < 0x66; i++ ) {
-
-#ifdef DOS386
-
- UDIVecP = (REALPTR _far *) (REALPTR_TO_CPTR(i*4));
-
-#else
-
- UDIVecP = (static struct UDIVecRec _FAR * _FAR *)(i * 4);
-
-#endif
-
- if ((*UDIVecP != REALNULL) &&
- ((struct UDIVecRec _far *) REALPTR_TO_CPTR(*UDIVecP))->recognizer.l == recognizer.l)
- return UDIVecP;
- }
-
- return NULL;
-}
-
-
-
-UDIError CheckForConnect(char *TIPName, int SessionNum, UDISessionId *Session, char *TIPParms)
-/* Check the interrupt table for a matching connection.
- * Note that the call to the TIPs UDIConnect is via annother function UDIPConnect
- * for the protected mode version.
- *
- * 7/93 MDT -- Took out 'if' that only set up the connection id if there was
- * no error message returned. This caused the DFE to be unable
- * to report TIP specific (negative) error messages from a
- * call to UDIConnect. Placed a new if which checks if the error
- * is positive and sets the CurrentConnection and VecRecP to null
- * so that any subsequent call to UDIDisconnect will work properly.
- *
- */
-{
- struct UDIVecRec _far * CurConn;
- UDIError err;
- UDISessionId tempId=0;
-
-
- if (UDIVecP) { /* TIPs running somewhere on machine */
- for (CurConn = (struct UDIVecRec _far *)REALPTR_TO_CPTR(*UDIVecP);
- FP_OFF(CurConn);
-#ifdef DOS386
- CurConn = (struct UDIVecRec _far *) REALPTR_TO_CPTR((REALPTR)(CurConn->Next)))
-#else
- CurConn = (struct UDIVecRec _far *) REALPTR_TO_CPTR((CurConn->Next)))
-#endif
-
- {
-#ifdef DOS386
- if (!_fstrcmp(NEARPTR_TO_FARPTR(TIPName),(char _far *)REALPTR_TO_CPTR((REALPTR)(CurConn->exeName)))) {
- err = UDICALL3(CurConn, Connect, TIPParms,
- &tempId,(DOSTerm _far *)term_addr);
-#else
- if (!_fstrcmp(NEARPTR_TO_FARPTR(TIPName),(char _far *)REALPTR_TO_CPTR((CurConn->exeName)))) {
- err = UDICALL3(CurConn, Connect, TIPParms,
- &tempId, &TermStruct);
-#endif
- Connections[SessionNum].ConnId = tempId;
- *Session = SessionNum;
- if (err > 0)
- CurrentConnection = Connections[SessionNum].VecRecP = 0;
- else
- CurrentConnection = Connections[SessionNum].VecRecP = CurConn;
- return err;
- } /* if */
- } /* for */
- } /* if */
-
- return UDIErrorExecutableNotTIP;
-
-
-} /* CheckForConnect */
-
-
-
-UDIError UDIConnect UDIParams((
- char *Configuration, /* In */
- UDISessionId *Session /* Out */
- ))
-{
- int i, n;
- char buf[ FBUFSIZE ];
- char TIPName[ FILENAME_MAX ];
- char *TIPParms;
-
-
- FILE *fp;
-
-#ifdef DOS386
- static int DOS386_Initialized;
- extern USHORT GetCS();
- extern USHORT GetDS();
-
-
- int start_real(), end_real(); /* prototypes to cast locations */
- /* in real-mode code and data */
- REALPTR term_func_addr;
- ULONG *term_func_addr_ptr;
-
-
- if (!DOS386_Initialized) { /* Do this init logic only once */
-
-
- /* Need to copy the real mode code into conventional memory. */
- if (realcopy((ULONG)start_real,(ULONG) end_real,(REALPTR *) &real_base,(FARPTR *) &prot_base,(USHORT *) &rmem_adr)) {
- printf("\nUDIConnect: realcopy call failed;\n");
- printf( " Probable cause: insufficient free conventional memory.\n");
- exit(0);
- }
-
- /*
- * The following code sets up the pointer in TermStruct to
- * contain the correct real mode address of the UDITerminate
- * function. This process can best be illustrated with the
- * following diagram.
- *
- * | ____________________
- * | | |____
- * | | term_func_addr_ptr | |
- * | |____________________| |
- * | |D
- * | ____________________ |
- * | | |/___|
- * | | term_func_addr |\
- * | | |_________
- * | |____________________| |
- * | |
- * | ____________________ |
- * Protected Memory | | |____ |
- * | | term_addr | | |
- * | |____________________| | |
- * | | |
- * | |B |
- * |---------------------------- | |C
- * |___ ____________________ | |
- * |r | |/___| |
- * |e m| |\ |
- * |a e| TermStruct |____ |
- * Real Mode Memory |l m|____________________| | |
- * | o| | |A |
- * |c r| |/___| |
- * |o y| UDITerminate() |\ |
- * |p | |/________|
- * |y |____________________|\
- * |---
- *
- * Note that the point of this is to get TermStruct to contain
- * a real mode pointer to the UDITerminate() function. Therefor,
- * pointer A is a real mode far pointer. To write the function
- * address into TermStruct, we are going to need a protected
- * mode far pointer, pointer B. We also need the real mode
- * function address to copy into TermStruct, this is pointer C.
- * Since we'll need to use _fmemmove, which requires two far
- * pointers (remember that since B is a protected mode far pointer,
- * we must use _fmemmove), we need another protected mode far
- * pointer to point at the address to be copied, this is pointer
- * D.
- *
- * Calls to NEARPTR_TO_FARPTR cannot be used to create pointers
- * into the real-copy allocated area. These need to be constructed
- * using real_base and prot_base, as explained in the "Mixing
- * Real and Protected Mode Code" section of the chapter on
- * "Programming for DPMI Compatablity" in the Phar Lap 386|DOS-
- * Extender Programmer's Guide to DPMI and Windows.
- *
- */
-
- term_func_addr_ptr = &term_func_addr;
- term_func_addr = (REALPTR)(real_base + (ULONG)(&UDITerminate));
- term_addr = (FARPTR)(prot_base + (ULONG)(&TermStruct));
-
-
- /*
- * Used to create pointers into conventional memory other than the
- * the area created by the call to real_copy (for example to access
- * the interrupt table.
- */
- code_selector = GetCS();
- data_selector = GetDS();
-
- _fmemmove(term_addr,NEARPTR_TO_FARPTR(term_func_addr_ptr),sizeof(*term_func_addr_ptr));
-
- DOS386_Initialized = TRUE;
- }
-
-#endif /* DOS386 */
-
- n = strlen( Configuration );
- TIPParms = NULL;
-
- /* Get configuration line that corresponds to requested configuration */
- if ((fp = fopen( GetConfigFileName(), "r" )) == NULL)
- return UDIErrorCantOpenConfigFile;
-
- while (fgets( buf, FBUFSIZE -1, fp ) != NULL) {
- if (isspace( buf[n] ) && (strncmp( buf, Configuration, n ) == 0)) {
- sscanf( buf, "%*s %s%n", TIPName, &n );
- TIPParms = &buf[n];
- while (isspace( *TIPParms ))
- TIPParms++;
- if (*TIPParms)
- TIPParms[ strlen( TIPParms ) -1 ] = '\0';
- break;
- } /* if */
- } /* while */
-
- fclose( fp );
-
- if (!TIPParms)
- return UDIErrorNoSuchConfiguration;
-
- for (i = 0; i < NumSessions; i++)
- if (!Connections[i].VecRecP)
- break;
-
- if (i >= NumSessions)
- return UDIErrorCantConnect;
-
- /* Determine if any TIPs are currently running */
- if (!UDIVecP) /* None for this DFE */
- UDIVecP = FindIntVect(); /* Try other DFEs */
-
-
- n = CheckForConnect(TIPName, i, Session, TIPParms);
-
- if (n != UDIErrorExecutableNotTIP)
- return n;
-
-#ifdef DOS386
- {
- char FullTIPName[256]; /* general name storage */
- UINT errinfo, doserr;
- UINT vmmh;
- LDEXP_BLK parmp;
- typedef UDIStruct { /* a shortened version of the pharlap.h struct */
- /* to make sure this ons is packed (in this modeule, */
- /* all we really need from this structure is ss:esp */
- ULONG eip; /* initial EIP */
- USHORT cs; /* initial CS */
- ULONG esp; /* initial ESP */
- USHORT ss; /* initial SS */
- } PACKED_LDEXP_BLK;
- PACKED_LDEXP_BLK *packed_parmp = (PACKED_LDEXP_BLK *) &parmp;
- int err;
- FARPTR TIPStackPtr;
- extern int _exp_call_to(LDEXP_BLK *p);
-
- /* Under Windows (DPMI 0.9) support we can't load a second DOS extender
- application and switch back and forth to it. So we get around this
- by loading the .exp file instead (using the current Dos extender)
- if DPMI is present, check if the tip program name also exists with a .exp extension
- if it does, do a dx_ld_flat of that and run it under our DFE dos extender
- */
-
- if (dpmi_exists()) {
- get_full_exe_name(TIPName, FullTIPName); /* ld_flat needs full pathname */
-
- /* now try to load the .exe file as if it were an exp file */
- /* (a nice feature of pharlap is that it dx_ld_flat can load */
- /* an .exe file that has an .exp file bound into it */
- err = _dx_ld_flat((UCHAR *) FullTIPName,
- &parmp,
- FALSE, /* read into mem immediately */
- &vmmh, /* vmm handle pointer */
- &errinfo, /* error info */
- &doserr); /* dos error */
-
- if (err) /* if any kind of error at all, give up on exp file */
- goto SpawnTipExe; /* and go back to exe file */
- else {
- /* successful load, now jump to .exp file code, which will
- return back to here. First we will put the original TIPName
- into the top of stack so the TIP can find it (like an argument).
- */
- FP_SET(TIPStackPtr, packed_parmp->esp-256, packed_parmp->ss);
- _fmemmove(TIPStackPtr, NEARPTR_TO_FARPTR(TIPName), strlen(TIPName)+1);
-
- /* now call into loaded exp code (and hopefully return) */
- if (_exp_call_to(&parmp) != 0)
- return UDIErrorCantStartTIP;
- else
- goto TIPLoaded;
- }/*else*/
- } /* if DPMI present */
- } /* block for ifdef DOS386 */
-#endif
-
-
-SpawnTipExe:
- /* To get around DOS 2.x problems as well as problems with filename
- expansion/searching, we pass the executable name as an addtional
- parameter. Also, we expect the TIP to TSR, so the high byte of
- the return value is probably 0x03. But some TIPs might be more
- clever and really return (activating a device driver or other
- TSR first), so we ignore the high byte of the return from spawnlp.
- */
-
- if ((n = spawnlp( P_WAIT, TIPName, TIPName, TIPName, NULL ) & 0xff) != 0)
- return UDIErrorCantStartTIP;
-
-TIPLoaded:
- /* Determine if any TIPs are currently running */
- if (!UDIVecP) /* None for this DFE */
- UDIVecP = FindIntVect(); /* Try other DFEs (or new TIPs) */
-
-
- return CheckForConnect(TIPName, i, Session, TIPParms);
-
-} /* UDIConnect() */
-
-
-
-UDIError UDIDisconnect UDIParams((
- UDISessionId Session, /* In */
- UDIBool Terminate /* In */
- ))
-{
- UDIError err;
-
- if (Session >= NumSessions || !Connections[Session].VecRecP)
- return UDIErrorNoSuchConnection;
-
-#ifdef DOS386
- if (((err = UDICALL3(CurrentConnection,Disconnect,
- Connections[ Session ].ConnId, Terminate, (DOSTerm _far *)term_addr ))
- == UDINoError) &&
- (CurrentConnection == Connections[ Session ].VecRecP))
-#else
- if (((err = UDICALL3(CurrentConnection,Disconnect,
- Connections[ Session ].ConnId, Terminate, &TermStruct))
- == UDINoError) &&
- (CurrentConnection == Connections[ Session ].VecRecP))
-#endif
-
- CurrentConnection = NULL;
-
- return err;
-
-} /* UDIDisconnect() */
-
-
-
-UDIError UDISetCurrentConnection UDIParams((
- UDISessionId Session /* In */
- ))
-{
- UDIError n;
- struct UDIConnections *ConnP;
-
- if (Session >= NumSessions || !Connections[Session].VecRecP)
- return UDIErrorNoSuchConnection;
-
- ConnP = &Connections[Session];
-
- n = UDICALL1(ConnP->VecRecP,SetCurrentConnection,
- ConnP->ConnId);
- if (n == UDINoError)
- CurrentConnection = ConnP->VecRecP;
-
- return n;
-
-} /* UDIDisconnect () */
-
-
-
-
-UDIError UDICapabilities UDIParams((
- UDIUInt32 *TIPId, /* Out */
- UDIUInt32 *TargetId, /* Out */
- UDIUInt32 DFEId, /* In */
- UDIUInt32 DFE, /* In */
- UDIUInt32 *TIP, /* Out */
- UDIUInt32 *DFEIPCId, /* Out */
- UDIUInt32 *TIPIPCId, /* Out */
- char *TIPString /* Out */
- ))
-{
- UDIError err;
-
- if (!CurrentConnection)
- return UDIErrorNoConnection;
-
- err = UDICALL8(CurrentConnection,Capabilities,
- TIPId, TargetId, DFEId, DFE, TIP, DFEIPCId,
- TIPIPCId, TIPString);
-
- *DFEIPCId = (((UDIUInt32)DFEIPCIdCompany) << 16) |
- (DFEIPCIdProduct << 12) | DFEIPCIdVersion;
-
- return err;
-
-} /* UDICapabilities() */
-
-
-
-
-UDIError UDIEnumerateTIPs UDIParams((
- UDIInt (*UDIETCallback) /* In */
- UDIParams(( char *Configuration )) /* In to callback() */
- ))
-{
- FILE *fp;
- char buf[ FBUFSIZE ];
-
- if ((fp = fopen( GetConfigFileName(), "r" )) == NULL)
- return UDIErrorCantOpenConfigFile;
-
- while (fgets( buf, FBUFSIZE, fp ))
- if (UDIETCallback( buf ) == UDITerminateEnumeration)
- break;
-
- fclose( fp );
-
- return UDINoError;
-
-} /* UDIEnumerateTIPs() */
-
-
-
-UDIError UDIGetErrorMsg UDIParams((
- UDIError ErrorCode, /* In */
- UDISizeT MsgSize, /* In */
- char *Msg, /* Out */
- UDISizeT *CountDone /* Out */
- ))
-{
- if (!CurrentConnection)
- return UDIErrorNoConnection;
-
- return UDICALL4(CurrentConnection,GetErrorMsg,
- ErrorCode, MsgSize, Msg, CountDone);
-
-} /* UDIGetErrorMsg() */
-
-
-
-UDIError UDIGetTargetConfig UDIParams((
- UDIMemoryRange KnownMemory[], /* Out */
- UDIInt *NumberOfRanges, /* In/Out */
- UDIUInt32 ChipVersions[], /* Out */
- UDIInt *NumberOfChips /* In/Out */
- ))
-{
- if (!CurrentConnection)
- return UDIErrorNoConnection;
-
- return UDICALL4(CurrentConnection,GetTargetConfig,
- KnownMemory, NumberOfRanges, ChipVersions, NumberOfChips);
-
-} /* UDIGetTargetConfig() */
-
-
-
-UDIError UDICreateProcess UDIParams((
- UDIPId *PId /* Out */
- ))
-{
- if (!CurrentConnection)
- return UDIErrorNoConnection;
-
- return UDICALL1(CurrentConnection,CreateProcess,
- PId);
-
-} /* UDICreateProcess() */
-
-
-
-UDIError UDISetCurrentProcess UDIParams((
- UDIPId PId /* In */
- ))
-{
- if (!CurrentConnection)
- return UDIErrorNoConnection;
-
- return UDICALL1(CurrentConnection,SetCurrentProcess,
- PId);
-
-} /* UDISetCurrentProcess() */
-
-
-
-UDIError UDIDestroyProcess UDIParams((
- UDIPId PId /* In */
- ))
-{
-
- if (!CurrentConnection)
- return UDIErrorNoConnection;
-
- return UDICALL1(CurrentConnection,DestroyProcess,
- PId);
-
-} /* UDIDestroyProcess() */
-
-
-
-UDIError UDIInitializeProcess UDIParams((
- UDIMemoryRange ProcessMemory[], /* In */
- UDIInt NumberOfRanges, /* In */
- UDIResource EntryPoint, /* In */
- CPUSizeT StackSizes[], /* In */
- UDIInt NumberOfStacks, /* In */
- char *ArgString /* In */
- ))
-{
- if (!CurrentConnection)
- return UDIErrorNoConnection;
-
- return UDICALL6(CurrentConnection,InitializeProcess,
- ProcessMemory, NumberOfRanges, EntryPoint, StackSizes,
- NumberOfStacks, ArgString );
-
-} /* UDIInitializeProcess() */
-
-
-
-UDIError UDIRead UDIParams((
- UDIResource From, /* In */
- UDIHostMemPtr To, /* Out */
- UDICount Count, /* In */
- UDISizeT Size, /* In */
- UDICount *CountDone, /* Out */
- UDIBool HostEndian /* In */
- ))
-{
- if (!CurrentConnection)
- return UDIErrorNoConnection;
-
- return UDICALL6(CurrentConnection,Read,
- From, To, Count, Size, CountDone, HostEndian);
-
-} /* UDIRead() */
-
-
-
-UDIError UDIWrite UDIParams((
- UDIHostMemPtr From, /* In */
- UDIResource To, /* In */
- UDICount Count, /* In */
- UDISizeT Size, /* In */
- UDICount *CountDone, /* Out */
- UDIBool HostEndian /* In */
- ))
-{
- if (!CurrentConnection)
- return UDIErrorNoConnection;
-
-
- return UDICALL6(CurrentConnection,Write,
- From, To, Count, Size, CountDone, HostEndian);
-
-} /* UDIWrite() */
-
-
-
-UDIError UDICopy UDIParams((
- UDIResource From, /* In */
- UDIResource To, /* In */
- UDICount Count, /* In */
- UDISizeT Size, /* In */
- UDICount *CountDone, /* Out */
- UDIBool Direction /* In */
- ))
-{
- if (!CurrentConnection)
- return UDIErrorNoConnection;
-
- return UDICALL6(CurrentConnection,Copy,
- From, To, Count, Size, CountDone, Direction);
-
-} /* UDICopy() */
-
-
-
-UDIError UDIExecute UDIParams((
- void
- ))
-{
- if (!CurrentConnection)
- return UDIErrorNoConnection;
-
- return UDICALL0(CurrentConnection,Execute);
-
-} /* UDIExecute() */
-
-
-
-UDIError UDIStep UDIParams((
- UDIUInt32 Steps, /* In */
- UDIStepType StepType, /* In */
- UDIRange Range /* In */
- ))
-{
- if (!CurrentConnection)
- return UDIErrorNoConnection;
-
- return UDICALL3(CurrentConnection,Step,
- Steps,StepType,Range);
-
-} /* UDIStep() */
-
-
-
-
-UDIVoid UDIStop UDIParams((
- void
- ))
-{
- if (!CurrentConnection)
- return;
-
- UDICALL0(CurrentConnection,Stop);
-
-} /* UDIStop() */
-
-
-
-
-UDIError UDIWait UDIParams((
- UDIInt32 MaxTime, /* In */
- UDIPId *PId, /* Out */
- UDIUInt32 *StopReason /* Out */
- ))
-{
- if (!CurrentConnection)
- return UDIErrorNoConnection;
-
- return UDICALL3(CurrentConnection,Wait,
- MaxTime, PId, StopReason);
-
-} /* UDIWait() */
-
-
-
-UDIError UDISetBreakpoint UDIParams((
- UDIResource Addr, /* In */
- UDIInt32 PassCount, /* In */
- UDIBreakType Type, /* In */
- UDIBreakId *BreakId /* Out */
- ))
-{
- if (!CurrentConnection)
- return UDIErrorNoConnection;
-
- return UDICALL4(CurrentConnection,SetBreakpoint,
- Addr, PassCount, Type, BreakId);
-
-} /* UDISetBreakpoint() */
-
-
-
-UDIError UDIQueryBreakpoint UDIParams((
- UDIBreakId BreakId, /* In */
- UDIResource *Addr, /* Out */
- UDIInt32 *PassCount, /* Out */
- UDIBreakType *Type, /* Out */
- UDIInt32 *CurrentCount /* Out */
- ))
-{
- if (!CurrentConnection)
- return UDIErrorNoConnection;
-
- return UDICALL5(CurrentConnection,QueryBreakpoint,
- BreakId, Addr, PassCount, Type, CurrentCount);
-
-} /* UDIQueryBreakpoint() */
-
-
-
-
-UDIError UDIClearBreakpoint UDIParams((
- UDIBreakId BreakId /* In */
- ))
-{
- if (!CurrentConnection)
- return UDIErrorNoConnection;
-
- return UDICALL1(CurrentConnection,ClearBreakpoint,
- BreakId);
-
-} /* UDIClearBreakpoint() */
-
-
-
-UDIError UDIGetStdout UDIParams((
- UDIHostMemPtr Buf, /* Out */
- UDISizeT BufSize, /* In */
- UDISizeT *CountDone /* Out */
- ))
-{
- if (!CurrentConnection)
- return UDIErrorNoConnection;
-
-
- return UDICALL3(CurrentConnection,GetStdout,
- Buf, BufSize, CountDone);
-
-} /* UDIGetStout() */
-
-
-
-UDIError UDIGetStderr UDIParams((
- UDIHostMemPtr Buf, /* Out */
- UDISizeT BufSize, /* In */
- UDISizeT *CountDone /* Out */
- ))
-{
- if (!CurrentConnection)
- return UDIErrorNoConnection;
-
- return UDICALL3(CurrentConnection,GetStderr,
- Buf, BufSize, CountDone);
-
-} /* UDIGetStderr() */
-
-
-
-
-UDIError UDIPutStdin UDIParams((
- UDIHostMemPtr Buf, /* In */
- UDISizeT Count, /* In */
- UDISizeT *CountDone /* Out */
- ))
-{
- if (!CurrentConnection)
- return UDIErrorNoConnection;
-
- return UDICALL3(CurrentConnection,PutStdin,
- Buf, Count, CountDone);
-
-} /* UDIPutStdin() */
-
-
-
-UDIError UDIStdinMode UDIParams((
- UDIMode *Mode /* Out */
- ))
-{
- if (!CurrentConnection)
- return UDIErrorNoConnection;
-
-
- return UDICALL1(CurrentConnection,StdinMode,
- Mode);
-
-} /* UDIStdinMode() */
-
-
-
-
-UDIError UDIPutTrans UDIParams((
- UDIHostMemPtr Buf, /* In */
- UDISizeT Count, /* In */
- UDISizeT *CountDone /* Out */
- ))
-{
- if (!CurrentConnection)
- return UDIErrorNoConnection;
-
-
- return UDICALL3(CurrentConnection,PutTrans,
- Buf, Count, CountDone);
-
-
-} /* UDIPutTrans() */
-
-
-
-
-UDIError UDIGetTrans UDIParams((
- UDIHostMemPtr Buf, /* Out */
- UDISizeT BufSize, /* In */
- UDISizeT *CountDone /* Out */
- ))
-{
- if (!CurrentConnection)
- return UDIErrorNoConnection;
-
-
- return UDICALL3(CurrentConnection,GetTrans,
- Buf, BufSize, CountDone);
-
-} /* UDIGetTrans() */
-
-
-
-
-UDIError UDITransMode UDIParams((
- UDIMode *Mode /* Out */
- ))
-{
- if (!CurrentConnection)
- return UDIErrorNoConnection;
-
-
- return UDICALL1(CurrentConnection,TransMode,
- Mode);
-
-
-} /* UDITransMode() */
-
-
-
-UDIUInt32 UDIGetDFEIPCId()
-{
-
- return((((UDIUInt32)DFEIPCIdCompany) << 16) |(DFEIPCIdProduct << 12) | DFEIPCIdVersion);
-
-} /* UDIGetDFEIPCId() */
+++ /dev/null
-/******************************************************************************
-*
-* The process and all routines contained herein are the
-* property and trade secrets of AMD Inc.
-*
-* Except as provided for by licence agreement, this code
-* shall not be duplicated, used or disclosed for any
-* purpose or reason, in whole or part, without the express
-* written consent of AMD.
-*
-* Copyright AMD Inc. 1991
-*
-*********************************************************************** MODULE
-*
-* $NAME @(#)udip2iss.c 1.2 91/06/14
-* AUTHORS UDI Team Members
-*
-* This module implements the UDI Procedural interface
-* for the ISS simulator.
-********************************************************************** HISTORY
-*
-*
-**************************************************************** INCLUDE FILES
-*/
-#include "stdio.h"
-#include "udiproc.h"
-
-
-/*********************************************************** UDI_GET_ERROR_MSG
- Errors above the value ERRUDI_TIP indicate that the
- TIP was not able to complete the request for some
- target specific reason. The DFE uses
- UDIGetErrorMsg() to get the descriptive text for
- the error message which can then be displayed to
- the user.
-*/
-UDIError UDIGetErrorMsg(error_code, msg)
-UINT32 error_code; /* in */
-UDIHostMemPtr msg; /* out -- text of msg */
-{
-}
-
-/*************************************************************** UDI_TERMINATE
- UDITerminate() is used to tell the TIP that the
- DFE is finished.
-*/
-UDITerminate()
-{
-}
-
-/******************************************************* UDI_GET_TARGET_CONFIG
- UDIGetTargetConfig() gets information about the
- target. I_mem_start/size defines the start address
- and length of instruction RAM memory.
- D_mem_start/size defines the start address and
- length of instruction Data memory.
- IR_mem_start/size defines the start address and
- length of instruction ROM memory. coprocessor de-
- fines the type of coprocessor present in the target
- if any. max_breakpoints defines the maximum number
- of breakpoints which the target can handle.
- max_steps defines the maximum number of stepcount
- that can be used in the UDIStep command.
-*/
-UDIError UDIGetTargetConfig(I_mem_start, I_mem_size, D_mem_start,
- D_mem_size, R_mem_start, R_mem_size, cpu_prl, copro_prl)
-UDIOffset *I_mem_start;/* out */
-UDIOffset *I_mem_size; /* out */
-UDIOffset *D_mem_start;/* out */
-UDIOffset *D_mem_size; /* out */
-UDIOffset *R_mem_start;/* out */
-UDIOffset *R_mem_size; /* out */
-UINT32 *cpu_prl; /* out */
-UINT32 *copro_prl; /* out */
-{
-}
-
-/********************************************************** UDI_CREATE_PRCOESS
- UDICreateProcess() tells the target OS that a
- process is to be created and gets a pID back unless
- there is some error.
-*/
-UDIError UDICreateProcess(pid)
-UDIPID *pid; /* out */
-{
-}
-
-/********************************************************** UDI_SET_DEFALUT_PID
- UDISetDefaultPid uses a pid supplied by
- UDICreateProcess and sets it as the default for all
- udi calls until a new default is set. A user of a
- single-process OS would only have to use this once.
-*/
-UDIError UDISetDefaultPid(pid)
-UDIPID pid; /* in */
-{
-}
-
-/********************************************************* UDI_DESTROY_PROCESS
- UDIDestroyProcess() frees a process resource pre-
- viously created by UDICreateProcess().
-*/
-UDIError UDIDestroyProcess(pid)
-UDIPID pid; /* in */
-{
-}
-
-/****************************************************** UDI_INITIALIZE_PROCESS
- UDIInitializeProcess() is called after the code
- for a process has been loaded. The pid used is the
- one set by UDISetDfaultPid. The parameter
- text_addr defines the lowest and highest text ad-
- dresses used by the process. The parameter
- data_addr defines the lowest and highest data ad-
- dresses used by the process. The paramter
- entry_point defines the entry point of the process.
- The parameters mem_stack_size and reg_stack size
- define the sizes of the memory and register stacks
- required by the process. The special value
- UDI_DEFAULT implies that the default stack sizes
- for the target OS should be used. The parameter
- argstring defines a character string that will get
- parsed into the argv array for the process. The
- target OS will use the supplied information to set
- up the heaps and stacks and the program arguments
- if any. On return; the PC will be set to the entry
- point of the process.
-*/
-UDIError UDIInitializeProcess( text_addr, data_addr, entry_point,
- mem_stack_size, reg_stack_size, argstring)
-UDIRange text_addr; /* in--lowest and highest text addrs */
-UDIRange data_addr; /* in--lowest and highest data addrs */
-UDIResource entry_point; /* in--process entry point */
-CPUSizeT mem_stack_size; /* in--memory stack size */
-CPUSizeT reg_stack_size; /* in--register stack size */
-char* argstring; /* in--argument string used to */
-{
-}
-
-/****************************************************************** UDI_READ
- UDIRead() reads a block of objects from a target
- address+space to host space. The parameter struc-
- ture "from" specifies the address space and offset
- of the source. The parameter "to" specifies the
- destination address in the DFE on the host. The
- parameter count specifies the number of objects to
- be transferred and "size" specifies the size of
- each object.
- The size parameter is used by the TIP to
- perform byte-swapping if the target is not the same
- endian as the host. On completion; the output
- parameter count_done is set to the number of ob-
- jects successfully transferred.
-*/
-
-UDIError UDIRead (from, to, count, size, count_done, host_endian)
-UDIResource from; /* in - source address on target */
-UDIVoidPtr to; /* out - destination address on host */
-UDICount count; /* in -- count of objects to be transferred */
-UDISize size; /* in -- size of each object */
-UDICount *count_done; /* out - count actually transferred */
-UDIBool host_endian; /* in -- flag for endian information */
-{
-}
-
-/****************************************************************** UDI_WRITE
- UDIWrite() writes a block of objects from host
- space to a target address+space The parameter
- "from" specifies the source address in the DFE on
- the host. The parameter structure "to" specifies
- the address space and offset of the destination on
- the target. The parameter count specifies the
- number of objects to be transferred and "size"
- specifies the size of each object. The size parameter
- is used by the TIP to perform byte-swapping if
- the target is not the same endian as the host. On
- completion; the output parameter count_done is set
- to the number of objects successfully transferred.
-*/
-UDIError UDIWrite( from, to, count, size, count_done, HostEndian )
-UDIResource from; /* in -- destination address on host */
-UDIResource to; /* in -- source address on target */
-UDICount count; /* in -- count of objects to be transferred */
-UDISize size; /* in -- size of each object */
-UDICount *count_done; /* out - count actually transferred */
-UDIBool HostEndian; /* in -- flag for endian information */
-{
-}
-
-/******************************************************************** UDI_COPY
- UDICopy() copies a block of objects from one tar-
- get address/space to another target address/space.
- If the source and destination overlap; the copy is
- implemented as if a temporary buffer was used. The
- parameter structure "from" specifies the address
- space and offset of the destination on the target.
- The parameter structure "to" specifies the address
- space and offset of the destination on the target.
- The parameter count specifies the number of objects
- to be transferred and "size" specifies the size of
- each object. On completion; the output parameter
- count_done is set to the number of objects success-
- fully transferred.
-*/
-UDIError UDICopy(from, to, count, size, count_done, direction )
-UDIResource from; /* in -- destination address on target */
-UDIResource to; /* in -- source address on target */
-UDICount count; /* in -- count of objects to be transferred */
-UDISize size; /* in -- size of each object */
-UDICount *count_done; /* out - count actually transferred */
-UDIBool direction; /* in -- high-to-low or reverse */
-{
-}
-
-/***************************************************************** UDI_EXECUTE
- UDIExecute() continues execution of the default
- process from the current PC.
-*/
-UDIError UDIExecute()
-{
-}
-
-/******************************************************************** UDI_STEP
- UDIStep() specifies a number of "instruction"
- steps to make. The step can be further qualified
- to state whether CALLs should or should not be
- stepped over; whether TRAPs should or should not be
- stepped over; and whether stepping should halt when
- the PC gets outside a certain range. The semantics
- of UDIStep imply that progress is made; ie; at
- least one instruction is executed before traps or
- interrupts are handled.
-*/
-UDIError UDIStep(steps, steptype, range)
-UINT32 steps; /* in -- number of steps */
-UDIStepType steptype; /* in -- type of stepping to be done */
-UDIRange range; /* in -- range if StepInRange is TRUE */
-{
-}
-
-/******************************************************************** UDI_STOP
- UDIStop() stops the default process
-*/
-UDIError UDIStop(stop_pc)
-UDIResource *stop_pc; /* out -- value of PC where we stopped */
-{
-}
-
-/******************************************************************** UDI_WAIT
- UDIWait() returns the state of the target proces-
- sor. The TIP is expected to return when the target
- state is no longer RUNNING or when maxtime mil-
- liseconds have elapsed; whichever comes first. The
- special maxtime value UDI_WAIT_FOREVER essentially
- means that the DFE blocks until the target is no
- longer RUNNING. On completion; pid is used to re-
- port which process stopped (necessary for multi-
- process targets). On completion; stop_pc is usual-
- ly set to the PC where execution stopped.
-
- The return status STDIN_NEEDED allows the TIP to
- tell the DFE that the target program is requesting
- input and the TIP's own internal buffer of
- charcters is empty. The DFE can inform the user of
- this situation if it desires.
-
- Possible states are:
- NOT EXECUTING
- RUNNING
- STOPPED (due to UDIStop)
- BREAK (breakpoint hit)
- STEPPED (completed number of steps requested by UDIStep)
- WAITING (wait mode bit set)
- HALTED (at a halt instruction)
- WARNED (not executing because WARN line asserted)
- TRAPPED (invalid trap taken; indicates trap number)
- STDOUT_READY (stopped waiting for stdout to be output)
- STDERR_READY (stopped waiting for stderr to be output)
- STDIN_NEEDED (stopped waiting for stdin to be supplied)
-*/
-UDIError UDIWait(maxtime, pid, stop_reason)
-INT32 maxtime; /* in -- maximum time to wait for completion */
-UDIPID *pid; /* out -- pid of process which stopped if any */
-UINT32 *stop_reason; /* out -- PC where process stopped */
-{
-}
-
-/********************************************************** UDI_SET_BREAKPOINT
- UDISetBreakpoint() sets a breakpoint at an ad-
- dress and uses the passcount to state how many
- times that instruction should be hit before the
- break occurs. The passcount continues to count
- down; even if a different breakpoint is hit and is
- reinitialized only when this breakpoint is hit. A
- passcount value of 0 indicates a non-sticky break-
- point that will be removed whenever execution
- stops.
-*/
-UDIError UDISetBreakpoint (addr, passcount, type)
-UDIResource addr; /* in -- where breakpoint gets set */
-INT32 passcount; /* in -- passcount for breakpoint */
-UDIBreakType type; /* in -- breakpoint type */
-{
-}
-
-/******************************************************** UDI_QUERY_BREAKPOINT
-*/
-UDIError UDIQueryBreakpoint (addr, count)
-UDIResource addr; /* in -- where breakpoint gets set */
-UINT32 *count; /* out - passcount for breakpoint */
-{
-}
-
-/******************************************************** UDI_CLEAR_BREAKPOINT
- UDIClearBreakpoint() is used to clear a break-
- point.
-*/
-UDIError UDIClearBreakpoint (addr)
-UDIResource addr; /* in -- which breakpoint to clear */
-{
-}
-
-/************************************************************** UDI_GET_STDOUT
- UDIGetStdout() is called when a call to
- UDIWait() returns with the status STDOUT_READY.
- The parameter "buf" specifies the DFE's buffer ad-
- dress which is expected to be filled by the TIP.
- The parameter "bufsize" specifies the size of this
- buffer. On return; count_done is set to the number
- of bytes actually written to buf. The DFE should
- keep calling UDIGetStdout() until count_done is
- less than bufsize.
-*/
-UDIError UDIGetStdout(buf, bufsize, count_done)
-UDIHostMemPtr buf; /* out -- buffer to be filled */
-CPUSizeT bufsize; /* in -- buffer size in bytes */
-CPUSizeT *count_done; /* out -- number of bytes written to buf */
-{
-}
-
-/************************************************************** UDI_GET_STDERR
- UDIGetStderr() is called when a call to
- UDIWait() returns with the status STDERR_READY.
- In other respects it is similar to
- UDIGetStdout().
-*/
-UDIError UDIGetStderr(buf, bufsize, count)
-UDIHostMemPtr buf; /* out -- buffer to be filled */
-UINT32 bufsize; /* in -- buffer size in bytes */
-INT32 *count; /* out -- number of bytes written to buf */
-{
-}
-
-/*************************************************************** UDI_PUT_STDIN
- UDIPutStdin() is called whenever the DFE wants to
- deliver an input character to the TIP. This may be
- in response to a status STDIN_NEEDED but need not
- be. (Some target operating systems will never
- block for input). Any buffering and line editing
- of the stdin characters is done under control of
- the TIP.
-*/
-INT32 UDIPutStdin (buf, bufsize, count)
-UDIHostMemPtr buf; /* out - buffer to be filled */
-UINT32 bufsize; /* in -- buffer size in bytes */
-INT32 *count; /* out - number of bytes written to buf */
-{
-}
-
-/*************************************************************** UDI_PUT_TRANS
- UDIPutTrans() is used to feed input to the pass-
- thru mode. The parameter "buf" is points to the
- input data in DFE memory. The parameter "count"
- specifies the number of bytes.
-*/
-INT32 UDIPutTrans (buf, count)
-UDIHostMemPtr buf; /* in -- buffer address containing input data */
-CPUSizeT count; /* in -- number of bytes in buf */
-{
-}
-
-/*************************************************************** UDI_GET_TRANS
- UDIGetTrans() is used to get output lines from the
- pass-thru mode The parameter "buf" specifies to the
- buffer to be filled in DFE space. "bufsize" speci-
- fies the size of the buffer and; on return, "count"
- is set to the number of bytes put in the buffer.
- The DFE should continue to call UDIGetTrans() un-
- til count is less than bufsize. Other possible re-
- turn values are:
- EOF -- leave transparent mode
- UDI_GET_INPUT -- host should get some in-
- put; then call
- UDIPutTrans().
-*/
-INT32 UDIGetTrans (buf, bufsize, count)
-UDIHostMemPtr buf; /* out -- buffer to be filled */
-CPUSizeT bufsize; /* in -- size of buf */
-CPUSizeT *count; /* out -- number of bytes in buf */
-{
-}
+++ /dev/null
-/******************************************************************************
-*
-* The process and all routines contained herein are the
-* property and trade secrets of AMD Inc.
-*
-* Except as provided for by licence agreement, this code
-* shall not be duplicated, used or disclosed for any
-* purpose or reason, in whole or part, without the express
-* written consent of AMD.
-*
-* Copyright AMD Inc. 1991
-*
-*********************************************************************** MODULE
-*
-* $NAME @(#)udip2mm.c 1.2 91/06/12
-* AUTHORS Daniel Mann
-*
-* This module implements the UDI-P interface.
-********************************************************************** HISTORY
-*
-*
-**************************************************************** INCLUDE FILES
-*/
-#include <stdio.h>
-#include "udiproc.h"
-#include "dbg_core.h"
-#include "error.h"
-
-/* local type decs. and macro defs. not in a .h file ************* MACRO/TYPE
-*/
-#define BUFER_SIZE 2048
-typedef struct msgheader_str
-{
- INT32 class;
- INT32 length;
- UINT32 param[BUFER_SIZE];
-} msgheader_t;
-static msgheader_t msg_rbuf;
-static msgheader_t msg_sbuf;
-
-int (*msg_send)();
-int (*msg_recv)();
-
-/* local dec/defs. which are not in a .h file *************** LOCAL DEC/DEFS
-*/
-static INT8 SpaceMap_udi2mm[
-/* DRAMSpace IOSpace CPSpace0 CPSpace1 IROMSpace */
- D_MEM, I_O, -1 ,-1 I_ROM,
-/* IRAMSpace LocalRegs GlobalRegs RealRegs SpecialRegs */
- I_MEM, LOCAL_REG, GLOBAL_REG, GLOBAL_REG, SPECIAL_REG,
-/* TLBRegs ACCRegs ICacheSpace Am29027Regs PC */
- TLB_REG, SPECIAL_REG, I_CACHE, COPROC_REG, SPECIAL_REG
-/* DCacheSpace */
- D_CACHE ];
-
-static INT8 SpaceMap_mm2udi[
-/* LOCAL_REG GLOBAL_REG SPECIAL_REG TLB_REG COPROC_REG */
- LocalRegs, GlobalRegs, SpecialRegs, TLBRegs, Am29029Regs,
-/* I_MEM D_MEM I_ROM D_ROM I_O */
- IRAMSpace, DRAMSpace, IROMSpace, -1, IOSpace,
-/* I_CACHE D_CACHE */
- ICacheSpace, DCacheSpace ];
-
-UDIPID default_pid; /* requested PID */
-
-typedef struct bkpt_entry_str
-{
- UDIResource addr;
- INT32 passcount;
- UDIBreakType type;
-} bkpt_entry_t;
-#define MAX_BKPT 20
-bkpt_entry_t bkpt_table[MAX_BKPT];
-
-
-/****************************************************************** PROCEDURES
-*/
-
-/*********************************************************** UDI_GET_ERROR_MSG
- Errors above the value ERRUDI_TIP indicate that the
- TIP was not able to complete the request for some
- target specific reason. The DFE uses
- UDIGetErrorMsg() to get the descriptive text for
- the error message which can then be displayed to
- the user.
-*/
-UDIError UDIGetErrorMsg(error_code, msg)
-UINT32 error_code; /* in */
-UDIHostMemPtr msg; /* out -- text of msg */
-{
- if(error_code <= 0 || error_code > EMBAUD)
- return EMUSAGE;
- bcopy(error_msg[error_code], (char*) msg,
- strlen(error_msg[error_code]);
- return 0;
-}
-
-/*************************************************************** UDI_TERMINATE
- UDITerminate() is used to tell the TIP that the
- DFE is finished.
-*/
-UDITerminate()
-{
-}
-
-/******************************************************* UDI_GET_TARGET_CONFIG
- UDIGetTargetConfig() gets information about the
- target. I_mem_start/size defines the start address
- and length of instruction RAM memory.
- D_mem_start/size defines the start address and
- length of instruction Data memory.
- IR_mem_start/size defines the start address and
- length of instruction ROM memory. coprocessor de-
- fines the type of coprocessor present in the target
- if any. max_breakpoints defines the maximum number
- of breakpoints which the target can handle.
- max_steps defines the maximum number of stepcount
- that can be used in the UDIStep command.
-*/
-UDIError UDIGetTargetConfig(I_mem_start, I_mem_size, D_mem_start,
- D_mem_size, R_mem_start, R_mem_size, cpu_prl, copro_prl)
-UDIOffset *I_mem_start;/* out */
-UDIOffset *I_mem_size; /* out */
-UDIOffset *D_mem_start;/* out */
-UDIOffset *D_mem_size; /* out */
-UDIOffset *R_mem_start;/* out */
-UDIOffset *R_mem_size; /* out */
-UINT32 *cpu_prl; /* out */
-UINT32 *copro_prl; /* out */
-{
- UDIError errno_mm = 0;
-
- msg_sbuf.class = CODE_CONFIG_REQ;
- msg_sbuf.length = 0;
-
- (*msg_send)(&msg_sbuf); /* send MiniMON message */
- while( (*msg_recv)(&msg_rbuf) ); /* wait for reply */
-
- if(msg_rbuf.class == CONFIG)
- {
- *I_mem_start = msg_rbuf.param[2];
- *I_mem_size = msg_rbuf.param[3];
- *D_mem_start = msg_rbuf.param[4];
- *D_mem_size = msg_rbuf.param[5];
- *R_mem_start = msg_rbuf.param[6];
- *R_mem_size = msg_rbuf.param[7];
- *cpu_prl = msg_rbuf.param[0];
- *copro_prl = msg_rbuf.param[10];
- }
- else
- {
- errno_mm = EMBADMSG;
- if(msg_rbuf.class == ERROR)
- errno_mm = msg_rbuf.param[0];
- }
- return errno_mm;
-}
-
-/********************************************************** UDI_CREATE_PRCOESS
- UDICreateProcess() tells the target OS that a
- process is to be created and gets a PID back unless
- there is some error.
-*/
-UDIError UDICreateProcess(pid)
-UDIPID *pid; /* out */
-{
- UDIError errno_mm = 0;
-
- *pid = 1; /* OSboot sets user PID=1 */
- return errno_mm;
-}
-
-/********************************************************** UDI_SET_DEFALUT_PID
- UDISetDefaultPid uses a pid supplied by
- UDICreateProcess and sets it as the default for all
- udi calls until a new default is set. A user of a
- single-process OS would only have to use this once.
-*/
-UDIError UDISetDefaultPid(pid)
-UDIPID pid; /* in */
-{
- UDIError errno_mm = 0;
-
- default_pid = pid;
- return errno_mm;
-}
-
-/********************************************************* UDI_DESTROY_PROCESS
- UDIDestroyProcess() frees a process resource pre-
- viously created by UDICreateProcess().
-*/
-UDIError UDIDestroyProcess(pid)
-UDIPID pid; /* in */
-{
- UDIError errno_mm = 0;
-
- return errno_mm;
-}
-
-/****************************************************** UDI_INITIALIZE_PROCESS
- UDIInitializeProcess() is called after the code
- for a process has been loaded. The pid used is the
- one set by UDISetDfaultPid. The parameter
- text_addr defines the lowest and highest text ad-
- dresses used by the process. The parameter
- data_addr defines the lowest and highest data ad-
- dresses used by the process. The paramter
- entry_point defines the entry point of the process.
- The parameters mem_stack_size and reg_stack size
- define the sizes of the memory and register stacks
- required by the process. The special value
- UDI_DEFAULT implies that the default stack sizes
- for the target OS should be used. The parameter
- argstring defines a character string that will get
- parsed into the argv array for the process. The
- target OS will use the supplied information to set
- up the heaps and stacks and the program arguments
- if any. On return; the PC will be set to the entry
- point of the process.
-*/
-UDIError UDIInitializeProcess( text_addr, data_addr, entry_point,
- mem_stack_size, reg_stack_size, argstring)
-UDIRange text_addr; /* in--lowest and highest text addrs */
-UDIRange data_addr; /* in--lowest and highest data addrs */
-UDIResource entry_point; /* in--process entry point */
-CPUSizeT mem_stack_size; /* in--memory stack size */
-CPUSizeT reg_stack_size; /* in--register stack size */
-char* argstring; /* in--argument string used to */
-{
- UDIError errno_mm = 0;
-
- msg_sbuf.class = CODE_INIT;
- msg_sbuf.length = 8*4;
-
- msg_sbuf.param[0] = text_addr.low;
- msg_sbuf.param[1] = text_addr.high;
- msg_sbuf.param[2] = data_start.low;
- msg_sbuf.param[3] = data_end.hich;
- msg_sbuf.param[4] = entry_point.Offset;
- msg_sbuf.param[5] = mem_stack_size;
- msg_sbuf.param[6] = reg_stack_size;
- msg_sbuf.param[7] = argstring;
-
- (*msg_send)(&msg_sbuf); /* send MiniMON message */
- while( (*msg_recv)(&msg_rbuf) ); /* wait for reply */
-
- if(msg_rbuf.class == ERROR)
- errno_mm = msg_rbuf.param[0];
- else if(msg_rbuf.class != INIT_ACK)
- errno_mm = EMINIT;
- return errno_mm;
-}
-
-/****************************************************************** UDI_READ
- UDIRead() reads a block of objects from a target
- address+space to host space. The parameter struc-
- ture "from" specifies the address space and offset
- of the source. The parameter "to" specifies the
- destination address in the DFE on the host. The
- parameter count specifies the number of objects to
- be transferred and "size" specifies the size of
- each object.
- The size parameter is used by the TIP to
- perform byte-swapping if the target is not the same
- endian as the host. On completion; the output
- parameter count_done is set to the number of ob-
- jects successfully transferred.
-*/
-
-UDIError UDIRead (from, to, count, size, count_done, host_endian)
-UDIResource from; /* in - source address on target */
-UDIVoidPtr to; /* out - destination address on host */
-UDICount count; /* in -- count of objects to be transferred */
-UDISize size; /* in -- size of each object */
-UDICount *count_done; /* out - count actually transferred */
-UDIBool host_endian; /* in -- flag for endian information */
-{
- UDIError errno_mm = 0;
-
- msg_sbuf.class = CODE_READ_REQ;
- msg_sbuf.length = 3*4;
-
- msg_sbuf.param[0] = MapSpace_udi2mm[from.Space]; /* space */
- msg_sbuf.param[1] = from.Offset; /* address */
- msg_sbuf.param[2] = size*count /* byte_count */
-
- (*msg_send)(&msg_sbuf); /* send MiniMON message */
- while( (*msg_recv)(&msg_rbuf) ); /* wait for reply */
-
- if(msg_rbuf.class == READ_ACK)
- { *count_done = msg_rbuf.param[2]/size;
- bcopy((char*)&(msg_sbuf.param[3])), (char*)to, size*count);
- }
- else
- {
- errno_mm = EMREAD;
- *count_done = 0;
- if(msg_rbuf.class == ERROR)
- errno_mm = msg_rbuf.param[0];
- }
- return errno_mm;
-}
-
-/****************************************************************** UDI_WRITE
- UDIWrite() writes a block of objects from host
- space to a target address+space The parameter
- "from" specifies the source address in the DFE on
- the host. The parameter structure "to" specifies
- the address space and offset of the destination on
- the target. The parameter count specifies the
- number of objects to be transferred and "size"
- specifies the size of each object. The size parameter
- is used by the TIP to perform byte-swapping if
- the target is not the same endian as the host. On
- completion; the output parameter count_done is set
- to the number of objects successfully transferred.
-*/
-UDIError UDIWrite( from, to, count, size, count_done, HostEndian )
-UDIVoidPtr from; /* in -- destination address on host */
-UDIResource to; /* in -- source address on target */
-UDICount count; /* in -- count of objects to be transferred */
-UDISize size; /* in -- size of each object */
-UDICount *count_done; /* out - count actually transferred */
-UDIBool HostEndian; /* in -- flag for endian information */
-{
- UDIError errno_mm = 0;
-
- msg_sbuf.class = CODE_WRITE_REQ;
- msg_sbuf.length = 3*4 + size*count;
-
- msg_sbuf.param[0] = MapSpace_udi2mm[to.Space]; /* space */
- msg_sbuf.param[1] = to.Offset; /* address */
- msg_sbuf.param[2] = size*count /* byte_count */
- bcopy((char*)from, (char*)msg_sbuf.param[3]), size*count);
-
- (*msg_send)(&msg_sbuf); /* send MiniMON message */
- while( (*msg_recv)(&msg_rbuf) ); /* wait for reply */
-
- if(msg_rbuf.class == WRITE_ACK)
- *count_done = msg_rbuf.param[2]/size;
- else
- {
- errno_mm = EMWRITE;
- *count_done = 0;
- if(msg_rbuf.class == ERROR)
- errno_mm = msg_rbuf.param[0];
- }
- return errno_mm;
-}
-
-/******************************************************************** UDI_COPY
- UDICopy() copies a block of objects from one tar-
- get address/space to another target address/space.
- If the source and destination overlap; the copy is
- implemented as if a temporary buffer was used. The
- parameter structure "from" specifies the address
- space and offset of the destination on the target.
- The parameter structure "to" specifies the address
- space and offset of the destination on the target.
- The parameter count specifies the number of objects
- to be transferred and "size" specifies the size of
- each object. On completion; the output parameter
- count_done is set to the number of objects success-
- fully transferred.
-*/
-UDIError UDICopy(from, to, count, size, count_done, direction )
-UDIResource from; /* in -- destination address on target */
-UDIResource to; /* in -- source address on target */
-UDICount count; /* in -- count of objects to be transferred */
-UDISize size; /* in -- size of each object */
-UDICount *count_done; /* out - count actually transferred */
-UDIBool direction; /* in -- high-to-low or reverse */
-{
- UDIError errno_mm = 0;
-
- msg_sbuf.class = CODE_COPY;
- msg_sbuf.length = 5*4
-
- msg_sbuf.param[0] = MapSpace_udi2mm[from.Space]; /* source space */
- msg_sbuf.param[1] = source.Offset; /* address */
- msg_sbuf.param[2] = MapSpace_udi2mm[to.Space]; /* dest space */
- msg_sbuf.param[3] = to.Offset; /* address */
- msg_sbuf.param[4] = size*count /* byte_count */
-
- (*msg_send)(&msg_sbuf); /* send MiniMON message */
- while( (*msg_recv)(&msg_rbuf) ); /* wait for reply */
-
- if(msg_rbuf.class == COPY_ACK))
- *count_done = msg_rbuf.param[4]/size;
- else
- {
- errno_mm = EMCOPY;
- *count_done = 0;
- if(msg_rbuf.class == ERROR)
- errno_mm = msg_rbuf.param[0];
- }
- return errno_mm;
-}
-
-/***************************************************************** UDI_EXECUTE
- UDIExecute() continues execution of the default
- process from the current PC.
-*/
-UDIError UDIExecute()
-{
- UDIError errno_mm = 0;
-
- msg_sbuf.class = CODE_GO;
- msg_sbuf.length = 0;
-
- (*msg_send)(&msg_sbuf); /* send MiniMON message */
- return errno_mm;
-}
-
-/******************************************************************** UDI_STEP
- UDIStep() specifies a number of "instruction"
- steps to make. The step can be further qualified
- to state whether CALLs should or should not be
- stepped over; whether TRAPs should or should not be
- stepped over; and whether stepping should halt when
- the PC gets outside a certain range. The semantics
- of UDIStep imply that progress is made; ie; at
- least one instruction is executed before traps or
- interrupts are handled.
-*/
-UDIError UDIStep(steps, steptype, range)
-UINT32 steps; /* in -- number of steps */
-UDIStepType steptype; /* in -- type of stepping to be done */
-UDIRange range; /* in -- range if StepInRange is TRUE */
-{
- UDIError errno_mm = 0;
-
- msg_sbuf.class = CODE_STEP;
- msg_sbuf.length = 1*4;
-
- msg_sbuf.param[0] = steps; /* number of steps */
-
- (*msg_send)(&msg_sbuf); /* send MiniMON message */
-
- while( (*msg_recv)(&msg_rbuf) ); /* wait for reply */
-
- return errno_mm;
-}
-
-/******************************************************************** UDI_STOP
- UDIStop() stops the default process
-*/
-UDIError UDIStop(stop_pc)
-UDIResource *stop_pc; /* out -- value of PC where we stopped */
-{
- UDIError errno_mm = 0;
-
- msg_sbuf.class = CODE_BREAK;
- msg_sbuf.length = 0;
-
- (*msg_send)(&msg_sbuf); /* send MiniMON message */
- while( (*msg_recv)(&msg_rbuf) ); /* wait for reply */
-
- if(msg_rbuf.class == HALT)
- stop_pc->Offset = msg_rbuf.param[2]; /* PC1 address */
- stop_pc->Space =
- MapSpace_mm2udi[msg_rbuf.param[0]]; /* address space */
- else
- {
- errno_mm = EMBADMSG;
- if(msg_rbuf.class == ERROR)
- errno_mm = msg_rbuf.param[0];
- }
- return errno_mm;
-}
-
-
-/******************************************************************* SIG_TIMER
-*/
-void sig_timer()
-{
-}
-
-/******************************************************************** UDI_WAIT
- UDIWait() returns the state of the target proces-
- sor. The TIP is expected to return when the target
- state is no longer RUNNING or when maxtime mil-
- liseconds have elapsed; whichever comes first. The
- special maxtime value UDI_WAIT_FOREVER essentially
- means that the DFE blocks until the target is no
- longer RUNNING. On completion; pid is used to re-
- port which process stopped (necessary for multi-
- process targets). On completion; stop_pc is usual-
- ly set to the PC where execution stopped.
-
- The return status STDIN_NEEDED allows the TIP to
- tell the DFE that the target program is requesting
- input and the TIP's own internal buffer of
- charcters is empty. The DFE can inform the user of
- this situation if it desires.
-
- Possible states are:
- NOT_EXECUTING
- RUNNING
- STOPPED (due to UDIStop)
- BREAK (breakpoint hit)
- STEPPED (completed number of steps requested by UDIStep)
- WAITING (wait mode bit set)
- HALTED (at a halt instruction)
- WARNED (not executing because WARN line asserted)
- TRAPPED (invalid trap taken; indicates trap number)
- STDOUT_READY (stopped waiting for stdout to be output)
- STDERR_READY (stopped waiting for stderr to be output)
- STDIN_NEEDED (stopped waiting for stdin to be supplied)
-*/
-UDIError UDIWait(maxtime, pid, stop_reason)
-INT32 maxtime; /* in -- maximum time to wait for completion */
-UDIPID *pid; /* out -- pid of process which stopped if any */
-UINT32 *stop_reason; /* out -- PC where process stopped */
-{
- UDIError errno_mm = 0;
-
- if(signal(SIGALRM, sig_timer)) == -1) errno_mm =
-
-
- return errno_mm;
-}
-
-/********************************************************** UDI_SET_BREAKPOINT
- UDISetBreakpoint() sets a breakpoint at an ad-
- dress and uses the passcount to state how many
- times that instruction should be hit before the
- break occurs. The passcount continues to count
- down; even if a different breakpoint is hit and is
- reinitialized only when this breakpoint is hit. A
- passcount value of 0 indicates a Temporary break-
- point that will be removed whenever execution
- stops. A negative passcount indicates a non-sticky
- breakpoint.
-*/
-UDIError UDISetBreakpoint (addr, passcount, type, break_id)
-UDIResource addr; /* in -- where breakpoint gets set */
-INT32 passcount; /* in -- passcount for breakpoint */
-UDIBreakType type; /* in -- breakpoint type */
-INT32 *break_id; /* out-- break number assigned */
-{
- UDIError errno_mm = 0;
- bkpt_entry_t *bkpt_p = &bkpt_table[break_id];
- int cnt = 0;
-
- if(type != UDIBreakFlagExecute)
- { errno_mm = EMBKPTSET;
- return errno_mm;
- }
- while( cnt < MAX_BKPT) /* find BKPT slot in table */
- if( !(bkpt_p->type) ) break;
- else cnt++;
- if(cnt >= MAX_BKPT)
- { errno_mm = EMBKPTNONE;
- return errno_mm;
- }
- bkpt_p->address.Offset = addr.Offset;
- bkpt_p->address.Space = addr.Space;
- bkpt_p->passcount = passcount;
- bkpt_p->type = type;
- *break_id = cnt;
-
- msg_sbuf.class = CODE_SET_BKPT;
- msg_sbuf.length = 4*4;
-
- msg_sbuf.param[0] = MapSpace_udi2mm[addr.Space];
- msg_sbuf.param[1] = addr.Offset;
- msg_sbuf.param[2] = passcount;
- msg_sbuf.param[3] = -1; /* non 050 breakpoint */
-
- (*msg_send)(&msg_sbuf); /* send MiniMON message */
- while( (*msg_recv)(&msg_rbuf) ); /* wait for reply */
-
- if(msg_rbuf.class == ERROR)
- errno_mm = msg_rbuf.param[0];
- else if(msg_rbuf.class != CODE_SET_BKPT_ACK)
- errno_mm = EMBKPTSET;
- return error_mm;
-}
-
-/******************************************************** UDI_QUERY_BREAKPOINT
-*/
-UDIError UDIQueryBreakpoint (break_id, addr, passcount, type, current_count)
-INT32 break_id; /* in -- select brekpoint */
-UDIResource *addr; /* out - where breakpoint gets set */
-INT32 *passcount; /* out - passcount for breakpoint */
-UDIBreakType *type; /* out - breakpoint type */
-INT32 *current_count; /* out - current passcount for breakpoint */
-{
- UDIError errno_mm = 0;
-
- msg_sbuf.class = CODE_BKPT_STAT;
- msg_sbuf.length = 2*4;
-
- msg_sbuf.param[0] = MapSpace_udi2mm[addr.Space];
- msg_sbuf.param[1] = addr.Offset;
-
- (*msg_send)(&msg_sbuf); /* send MiniMON message */
- while( (*msg_recv)(&msg_rbuf) ); /* wait for reply */
-
- if(msg_rbuf.class == CODE_BKPT_STAT_ACK)
- {
- addr->Offset = bkpt_table[break_id].addr.Offset;
- addr->Space = bkpt_table[break_id].addr.Space;
- *passcount = bkpt_table[break_id].passcount;
- *type = bkpt_table[break_id].type;
- *current_count = msg_rbuf.param[2];
- }
- else if(msg_rbuf.class == ERROR)
- errno_mm = msg_rbuf.param[0];
- else errno_mm = EMBKPTSTAT;
- return errno_mm;
-}
-
-/******************************************************** UDI_CLEAR_BREAKPOINT
- UDIClearBreakpoint() is used to clear a break-
- point.
-*/
-UDIError UDIClearBreakpoint (break_id)
-INT32 break_id; /* in -- select brekpoint */
-{
- UDIError errno_mm = 0;
- bkpt_entry_t *bkpt_p = &bkpt_table[break_id];
-
- msg_sbuf.class = CODE_RM_BKPT;
- msg_sbuf.length = 2*4;
-
- msg_sbuf.param[0] = MapSpace_udi2mm[bkpt_p->Space];
- msg_sbuf.param[1] = bkpt->Offset;
-
- (*msg_send)(&msg_sbuf); /* send MiniMON message */
- while( (*msg_recv)(&msg_rbuf) ); /* wait for reply */
-
- if(msg_rbuf.class == CODE_RM_BKPT_ACK)
- {
- bkpt->Space = 0; /* invalidate BKPT entry */
- }
- else if(msg_rbuf.class == ERROR)
- errno_mm = msg_rbuf.param[0];
- else errno_mm = EMBKPTRM;
- return errno_mm;
-}
-
-/************************************************************** UDI_GET_STDOUT
- UDIGetStdout() is called when a call to
- UDIWait() returns with the status STDOUT_READY.
- The parameter "buf" specifies the DFE's buffer ad-
- dress which is expected to be filled by the TIP.
- The parameter "bufsize" specifies the size of this
- buffer. On return; count_done is set to the number
- of bytes actually written to buf. The DFE should
- keep calling UDIGetStdout() until count_done is
- less than bufsize.
-*/
-UDIError UDIGetStdout(buf, bufsize, count_done)
-UDIHostMemPtr buf; /* out -- buffer to be filled */
-CPUSizeT bufsize; /* in -- buffer size in bytes */
-CPUSizeT *count_done; /* out -- number of bytes written to buf */
-{
- UDIError errno_mm = EMBADMSG;
-
- return errno_mm;
-}
-
-/************************************************************** UDI_GET_STDERR
- UDIGetStderr() is called when a call to
- UDIWait() returns with the status STDERR_READY.
- In other respects it is similar to
- UDIGetStdout().
-*/
-UDIError UDIGetStderr(buf, bufsize, count)
-UDIHostMemPtr buf; /* out -- buffer to be filled */
-UINT32 bufsize; /* in -- buffer size in bytes */
-INT32 *count; /* out -- number of bytes written to buf */
-{
- UDIError errno_mm = EMBADMSG;
-
- return errno_mm;
-}
-
-/*************************************************************** UDI_PUT_STDIN
- UDIPutStdin() is called whenever the DFE wants to
- deliver an input character to the TIP. This may be
- in response to a status STDIN_NEEDED but need not
- be. (Some target operating systems will never
- block for input). Any buffering and line editing
- of the stdin characters is done under control of
- the TIP.
-*/
-INT32 UDIPutStdin (buf, bufsize, count)
-UDIHostMemPtr buf; /* out - buffer to be filled */
-UINT32 bufsize; /* in -- buffer size in bytes */
-INT32 *count; /* out - number of bytes written to buf */
-{
- UDIError errno_mm = EMBADMSG;
-
- return errno_mm;
-}
-
-/*************************************************************** UDI_PUT_TRANS
- UDIPutTrans() is used to feed input to the pass-
- thru mode. The parameter "buf" is points to the
- input data in DFE memory. The parameter "count"
- specifies the number of bytes.
-*/
-INT32 UDIPutTrans (buf, count)
-UDIHostMemPtr buf; /* in -- buffer address containing input data */
-CPUSizeT count; /* in -- number of bytes in buf */
-{
- UDIError errno_mm = EMBADMSG;
-
- return errno_mm;
-}
-
-/*************************************************************** UDI_GET_TRANS
- UDIGetTrans() is used to get output lines from the
- pass-thru mode The parameter "buf" specifies to the
- buffer to be filled in DFE space. "bufsize" speci-
- fies the size of the buffer and; on return, "count"
- is set to the number of bytes put in the buffer.
- The DFE should continue to call UDIGetTrans() un-
- til count is less than bufsize. Other possible re-
- turn values are:
- EOF -- leave transparent mode
- UDI_GET_INPUT -- host should get some in-
- put; then call
- UDIPutTrans().
-*/
-INT32 UDIGetTrans (buf, bufsize, count)
-UDIHostMemPtr buf; /* out -- buffer to be filled */
-CPUSizeT bufsize; /* in -- size of buf */
-CPUSizeT *count; /* out -- number of bytes in buf */
-{
- UDIError errno_mm = EMBADMSG;
-
- return errno_mm;
-}
+++ /dev/null
-/*
-* Copyright 1991 Advanced Micro Devices, Inc.
-*
-* This software is the property of Advanced Micro Devices, Inc (AMD) which
-* specifically grants the user the right to modify, use and distribute this
-* software provided this notice is not removed or altered. All other rights
-* are reserved by AMD.
-*
-* AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
-* SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
-* DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
-* USE OF THIS SOFTWARE.
-*
-* So that all may benefit from your experience, please report any problems
-* or suggestions about this software to the 29K Technical Support Center at
-* 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
-* 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
-*
-* Advanced Micro Devices, Inc.
-* 29K Support Products
-* Mail Stop 573
-* 5900 E. Ben White Blvd.
-* Austin, TX 78741
-* 800-292-9263
-*****************************************************************************
-*/
-static char udip2soc_c[]="@(#)udip2soc.c 2.13 Daniel Mann";
-static char udip2soc_c_AMD[]="@(#)udip2soc.c 2.11, AMD";
-/*
-* This module converts UDI Procedural calls into
-* UDI socket messages for UNIX.
-* It is used by DFE client processes
-********************************************************************** HISTORY
-*/
-#include <stdio.h>
-#include <string.h>
-#include <sys/file.h>
-#include <sys/fcntl.h>
-#include <sys/wait.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <signal.h>
-#include <sys/errno.h>
-#include "udiproc.h"
-#include "udisoc.h"
-
-extern int errno;
-extern int sys_nerr;
-extern char* sys_errlist[];
-extern int udr_errno;
-extern char* getenv();
-
-/* local type decs. and macro defs. not in a .h file ************* MACRO/TYPE
-*/
-#define version_c 0x121 /* DFE-IPC version id */
-#define TRUE -1
-#define FALSE 0
-#define PORT_NUM 7000
-#define MAX_SESSIONS 5 /* maximum DFE-TIP connections */
-#define SOC_BUF_SIZE 4* 1024 /* size of socket comms buffer */
-#define SBUF_SIZE 500 /* size of string buffer */
-#define ERRMSG_SIZE 500 /* size of error message buffer */
-
-#define errmsg_m {int ii; for(ii=0; ii<ERRMSG_SIZE; ii++) dfe_errmsg[ii]=0;}
-
-typedef struct connection_str /* record of connect session */
-{
- int in_use;
- char connect_id[20]; /* connection identifier */
- char domain_string[20]; /* dommaing for conection */
- char tip_string[30]; /* TIP host name for AF_INET */
- char tip_exe[80]; /* TIP exe name */
- int dfe_sd; /* associated DFE socket */
- int tip_pid; /* pid of TIP process */
- struct sockaddr_in dfe_sockaddr;
- struct sockaddr_in tip_sockaddr_in;
- struct sockaddr tip_sockaddr;
-} connection_t;
-
-typedef struct session_str
-{
- int in_use;
- connection_t* soc_con_p; /* associated connection */
- UDISessionId tip_id; /* associated TIP session ID */
-} session_t;
-
-/* global dec/defs. which are not in a .h file ************* EXPORT DEC/DEFS
-*/
-UDIError dfe_errno;
-char dfe_errmsg[ERRMSG_SIZE];/* error string */
-
-/* local dec/defs. which are not in a .h file *************** LOCAL DEC/DEFS
-*/
-LOCAL connection_t soc_con[MAX_SESSIONS];
-LOCAL session_t session[MAX_SESSIONS];
-LOCAL UDR udr;
-LOCAL UDR* udrs = &udr; /* UDR for current session */
-LOCAL int current; /* int-id for current session */
-LOCAL char sbuf[SBUF_SIZE]; /* String handler buffer */
-LOCAL char config_file[80]; /* path/name for config file */
-
-/***************************************************************** UDI_CONNECT
-* Establish a new FDE to TIP conection. The file "./udi_soc" or
-* "/etc/udi_soc" may be examined to obtain the conection information
-* if the "Config" parameter is not a completd "line entry".
-*
-* NOTE: the Session string must not start whith white-space characters.
-* Format of string is:
-* <session> <domain> <soc_name|host_name> <tip_exe|port> <pass to UDIconnect>
-* soc2cayman AF_INET cayman 7000 <not supported>
-* soc2tip AF_UNIX astring tip.exe ...
-*/
-UDIConnect(Config, Session)
-char* Config; /* in -- identification string */
-UDISessionId *Session; /* out -- session ID */
-{
- UDIInt32 service_id = UDIConnect_c;
- int domain;
- int cnt=0;
- int rcnt, pos, fd, params_pos=0;
- char *tip_main_string;
- char *env_p;
- struct hostent *tip_info_p;
- FILE *f_p;
- UDIUInt32 TIPIPCId;
- UDIUInt32 DFEIPCId;
-
- sprintf(sbuf, "which udi_soc");
- f_p = popen(sbuf, "r");
- if(f_p)
- { while( (sbuf[cnt++]=getc(f_p)) != EOF);
- sbuf[cnt-2]=0;
- }
- pclose(f_p);
- errmsg_m;
- for (rcnt=0; rcnt < MAX_SESSIONS; rcnt++)
- if(!session[rcnt].in_use) break;
- if(rcnt >= MAX_SESSIONS)
- {
- sprintf(dfe_errmsg, "DFE-ipc ERROR: Too many sessions already open");
- return UDIErrorIPCLimitation;
- }
- /* One connection can be multiplexed between several sessions. */
- for (cnt=0; cnt < MAX_SESSIONS; cnt++)
- if(!soc_con[cnt].in_use) break;
- if(cnt >= MAX_SESSIONS)
- {
- sprintf(dfe_errmsg, "DFE-ipc ERROR: Too many connections already open");
- return UDIErrorIPCLimitation;
- }
- *Session = rcnt;
- session[rcnt].soc_con_p = &soc_con[cnt];
-
- if(strchr(Config, ' ')) /* test if file entry given */
- {
- soc_con[cnt].in_use = TRUE;
- sscanf(Config, "%s %s %s %s %n",
- soc_con[cnt].connect_id,
- soc_con[cnt].domain_string,
- soc_con[cnt].tip_string,
- soc_con[cnt].tip_exe,
- ¶ms_pos);
- tip_main_string = Config + params_pos;
- }
- else /* here if need to read udi_soc file */
- {
- fd = -1;
- env_p = getenv("UDICONF");
- if(env_p)
- { sprintf(config_file, "%s", env_p); /* path includes file name */
- fd = open(config_file, O_RDONLY);
- }
- if(fd == -1)
- { fd = open("udi_soc", O_RDONLY);
- strcpy(config_file, "udi_soc");
- }
- if(fd == -1)
- { fd = open(sbuf, O_RDONLY);
- strcpy(config_file, sbuf);
- }
- if(fd == -1)
- { sprintf(dfe_errmsg, "UDIConnect, can't open udi_soc file:\n%s ",
- sys_errlist[errno]);
- return UDIErrorCantOpenConfigFile;
- }
- while(1)
- { pos = 0;
- while((rcnt = read(fd, &sbuf[pos], 1)) != -1)/* read a line */
- { if (sbuf[pos] == '\n' || rcnt == 0 )
- break;
- pos += 1;
- }
- sbuf[pos] = 0; /* terminate string */
- sscanf(sbuf, "%s %s %s %s %n",
- soc_con[cnt].connect_id,
- soc_con[cnt].domain_string,
- soc_con[cnt].tip_string,
- soc_con[cnt].tip_exe,
- ¶ms_pos);
- if( strcmp(Config, soc_con[cnt].connect_id)
- || rcnt == -1 || rcnt == 0)
- if(rcnt == -1 || rcnt == 0)
- { sprintf(dfe_errmsg,
- "UDIConnect, can't find entry in udi_soc file");
- return UDIErrorNoSuchConfiguration;
- }
- else
- continue;
- soc_con[cnt].in_use = TRUE; /* here if entry found */
- tip_main_string = sbuf + params_pos;
- break;
- }
- close(fd);
- }
-/*-------------------------------------------------------------- '*' SOC_ID */
- if( *soc_con[cnt].tip_string == '*'
- && *soc_con[cnt+1].tip_string == 0)
- {
- rcnt = 0;
- pos = getpid();
- do
- { sprintf(soc_con[cnt].tip_string,"/tmp/udi%.5d", pos++);
- fd = open(soc_con[cnt].tip_string, O_CREAT);
- if(rcnt++ > 20)
- { sprintf(dfe_errmsg,
- "DFE-ipc ERROR, can't create random socket name\n");
- return UDIErrorCantConnect;
- }
- } while(fd == -1);
- close(fd);
- unlink(soc_con[cnt].tip_string);
- }
-/*----------------------------------------------------------- SELECT DOMAIN */
- if(!strcmp(soc_con[cnt].domain_string, "AF_UNIX"))
- domain = AF_UNIX;
- else if(!strcmp(soc_con[cnt].domain_string, "AF_INET"))
- domain = AF_INET;
- else
- { errmsg_m;
- sprintf(dfe_errmsg, "DFE-ipc ERROR: socket address family not known");
- return UDIErrorBadConfigFileEntry;
- }
-
-/*---------------------------------------------------- MULTIPLEXED SOCKET ? */
-/* If the requested session requires communication with
- a TIP which already has a socket connection established,
- then we do not create a new socket but multiplex the
- existing one. A TIP is said to use the same socket if
- socket-name/host-name and the domain are the same.
- */
- for (rcnt=0; rcnt < MAX_SESSIONS; rcnt++)
- { if( soc_con[rcnt].in_use
- && !strcmp(soc_con[cnt].domain_string, soc_con[rcnt].domain_string)
- && !strcmp(soc_con[cnt].tip_string, soc_con[rcnt].tip_string)
- && rcnt != cnt )
- {
- session[*Session].soc_con_p = &soc_con[rcnt];
- soc_con[cnt].in_use = FALSE; /* don't need new connect */
- goto tip_connect;
- }
- }
-/*------------------------------------------------------------------ SOCKET */
- soc_con[cnt].dfe_sd = socket(domain, SOCK_STREAM, 0);
- if (soc_con[cnt].dfe_sd == -1 )
- { errmsg_m;
- sprintf(dfe_errmsg, "DFE-ipc ERROR, socket() call failed %s ",
- sys_errlist[errno]);
- UDIKill(cnt);
- }
-
-/*--------------------------------------------------------- AF_UNIX CONNECT */
- if(domain == AF_UNIX)
- {
- memset( (char*)&soc_con[cnt].tip_sockaddr, 0,
- sizeof(soc_con[cnt].tip_sockaddr));
- soc_con[cnt].tip_sockaddr.sa_family = domain;
- bcopy(soc_con[cnt].tip_string,
- soc_con[cnt].tip_sockaddr.sa_data,
- sizeof(soc_con[cnt].tip_sockaddr.sa_data) );
- if(connect(soc_con[cnt].dfe_sd,
- &soc_con[cnt].tip_sockaddr,
- sizeof(soc_con[cnt].tip_sockaddr)) == -1)
- { /* if connect() fails assume TIP not yet started */
-/*------------------------------------------------------------ AF_UNIX EXEC */
- int pid;
-#ifdef __hpux
- int statusp;
-#else
- union wait statusp;
-#endif
- char* arg0 = strrchr(soc_con[cnt].tip_exe,'/');
-
- if(!arg0) arg0 = soc_con[cnt].tip_exe;
- else arg0++;
-
- if((pid = fork()) == 0)
- { execlp(
- soc_con[cnt].tip_exe,
- arg0,
- soc_con[cnt].domain_string,
- soc_con[cnt].tip_string,
- NULL);
- exit(1);
- }
-#ifdef __hpux
- if(waitpid(pid, &statusp, WNOHANG))
-#else
- if(wait4(pid, &statusp, WNOHANG, NULL))
-#endif
- {
- sprintf(dfe_errmsg, "DFE-ipc ERROR: can't exec the TIP\n");
- return UDIErrorCantStartTIP;
- }
- sleep(2);
- /* not TIP is running, try conect() again */
- if(connect(soc_con[cnt].dfe_sd,
- &soc_con[cnt].tip_sockaddr,
- sizeof(soc_con[cnt].tip_sockaddr)) == -1)
- { sprintf(dfe_errmsg, "DFE-ipc ERROR, connect() call failed: %s",
- sys_errlist[errno]);
- return UDIErrorCantConnect;
- }
- }
- }
-/*--------------------------------------------------------- AF_INET CONNECT */
- if(domain == AF_INET)
- {
- fprintf(stderr,"DFE-ipc WARNING, need to have first started remote TIP\n");
- memset( (char*)&soc_con[cnt].tip_sockaddr_in, 0,
- sizeof(soc_con[cnt].tip_sockaddr_in));
- soc_con[cnt].tip_sockaddr_in.sin_family = domain;
- soc_con[cnt].tip_sockaddr_in.sin_addr.s_addr =
- inet_addr(soc_con[cnt].tip_string);
- if( soc_con[cnt].tip_sockaddr_in.sin_addr.s_addr == -1)
- {
- tip_info_p = gethostbyname(soc_con[cnt].tip_string);
- if( tip_info_p == NULL)
- { errmsg_m;
- sprintf(dfe_errmsg,"DFE-ipc ERROR, %s not found in /etc/hosts",
- soc_con[cnt].tip_string);
- return UDIErrorNoSuchConnection;
- }
- bcopy(tip_info_p->h_addr,
- (char *)&soc_con[cnt].tip_sockaddr_in.sin_addr,
- tip_info_p->h_length);
- }
- soc_con[cnt].tip_sockaddr_in.sin_port=htons(atoi(soc_con[cnt].tip_exe));
- if(connect(soc_con[cnt].dfe_sd,
- &soc_con[cnt].tip_sockaddr_in,
- sizeof(soc_con[cnt].tip_sockaddr_in)) == -1)
- { errmsg_m;
- sprintf(dfe_errmsg, "DFE-ipc ERROR, connect() call failed %s ",
- sys_errlist[errno]);
- return UDIErrorCantConnect;
- }
- }
-/*------------------------------------------------------------- TIP CONNECT */
- if(cnt ==0) udr_create(udrs, soc_con[cnt].dfe_sd, SOC_BUF_SIZE);
-tip_connect:
- current = cnt;
- session[*Session].in_use = TRUE; /* session id is now in use*/
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- DFEIPCId = (company_c << 16) + (product_c << 12) + version_c;
- udr_UDIUInt32(udrs, &DFEIPCId);
- udr_string(udrs, tip_main_string);
- udr_sendnow(udrs);
-
- udrs->udr_op = UDR_DECODE; /* recv all "out" parameters */
- udr_UDIUInt32(udrs, &TIPIPCId);
- if ((TIPIPCId & 0xfff) < version_c)
- { fprintf(stderr, "DFE-ipc: Obsolete TIP Specified\n");
- return(UDIErrorExecutableNotTIP);
- }
- udr_UDIInt32(udrs, &soc_con[cnt].tip_pid);
- udr_UDISessionId(udrs, &session[*Session].tip_id);
- udr_UDIError(udrs, &dfe_errno);
- if(dfe_errno > 0) UDIKill(Session, 0);
- return dfe_errno;
-}
-
-/************************************************************** UDI_Disconnect
-* UDIDisconnect() should be called before exiting the
-* DFE to ensure proper shut down of the TIP.
-*/
-UDIError UDIDisconnect(Session, Terminate)
-UDISessionId Session;
-UDIBool Terminate;
-{
- int cnt;
- UDIInt32 service_id = UDIDisconnect_c;
- if(Session < 0 || Session > MAX_SESSIONS)
- { errmsg_m;
- sprintf(dfe_errmsg," SessionId not valid (%d)", Session);
- return UDIErrorNoSuchConfiguration;
- }
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDISessionId(udrs, &session[Session].tip_id);
- udr_UDIBool(udrs, &Terminate);
- udr_sendnow(udrs);
-
- session[Session].in_use = FALSE; /* session id is now free */
- for (cnt=0; cnt < MAX_SESSIONS; cnt++)
- if(session[cnt].in_use
- && session[cnt].soc_con_p == session[Session].soc_con_p
- ) break;
- if(cnt >= MAX_SESSIONS) /* test if socket not multiplexed */
- if(shutdown(session[Session].soc_con_p->dfe_sd, 2))
- { errmsg_m;
- sprintf(dfe_errmsg, "DFE-ipc WARNING: socket shutdown failed");
- return UDIErrorIPCInternal;
- }
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/******************************************************************** UDI_KILL
-* UDIKill() is used to send a signal to the TIP.
-* This is a private IPC call.
-*/
-UDIError UDIKill(Session, Signal)
-UDISessionId Session;
-UDIInt32 Signal;
-{
- int cnt;
- UDIInt32 service_id = UDIKill_c;
- if(Session < 0 || Session > MAX_SESSIONS)
- { errmsg_m;
- sprintf(dfe_errmsg," SessionId not valid (%d)", Session);
- return UDIErrorNoSuchConfiguration;
- }
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDISessionId(udrs, &session[Session].tip_id);
- udr_UDIInt32(udrs, &Signal);
- udr_sendnow(udrs);
-
- session[Session].in_use = FALSE; /* session id is now free */
- for (cnt=0; cnt < MAX_SESSIONS; cnt++)
- if(session[cnt].in_use
- && session[cnt].soc_con_p == session[Session].soc_con_p
- ) break;
- if(cnt < MAX_SESSIONS) /* test if socket not multiplexed */
- if(shutdown(session[Session].soc_con_p->dfe_sd, 2))
- { errmsg_m;
- sprintf(dfe_errmsg, "DFE-ipc WARNING: socket shutdown failed");
- return UDIErrorIPCInternal;
- }
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/************************************************** UDI_Set_Current_Connection
-* If you are connected to multiple TIPs, you can change
-* TIPs using UDISetCurrentConnection().
-*/
-UDIError UDISetCurrentConnection(Session)
-UDISessionId Session;
-{
- UDIInt32 service_id = UDISetCurrentConnection_c;
-
- if(Session < 0 || Session > MAX_SESSIONS)
- return UDIErrorNoSuchConfiguration;
- if(!session[Session].in_use) /* test if not in use yet */
- return UDIErrorNoSuchConnection;
-
- current = Session;
- /* change socket or multiplex the same socket */
- udrs->sd = session[Session].soc_con_p->dfe_sd;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDISessionId(udrs, &session[Session].tip_id);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/************************************************************ UDI_Capabilities
-* The DFE uses UDICapabilities() to both inform the TIP
-* of what services the DFE offers and to inquire of the
-* TIP what services the TIP offers.
-*/
-UDIError UDICapabilities(TIPId, TargetId, DFEId, DFE, TIP, DFEIPCId,
- TIPIPCId, TIPString)
-UDIUInt32 *TIPId; /* out */
-UDIUInt32 *TargetId; /* out */
-UDIUInt32 DFEId; /* in */
-UDIUInt32 DFE; /* in */
-UDIUInt32 *TIP; /* out */
-UDIUInt32 *DFEIPCId; /* out */
-UDIUInt32 *TIPIPCId; /* out */
-char *TIPString; /* out */
-{
- UDIInt32 service_id = UDICapabilities_c;
- int size;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDIInt32(udrs, &DFEId);
- udr_UDIInt32(udrs, &DFE);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" paramters */
- udr_UDIInt32(udrs, TIPId);
- udr_UDIInt32(udrs, TargetId);
- udr_UDIInt32(udrs, TIP);
- udr_UDIInt32(udrs, DFEIPCId);
- *DFEIPCId = (company_c << 16) + (product_c << 12) + version_c;
- udr_UDIInt32(udrs, TIPIPCId);
- udr_string(udrs, sbuf);
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- size = strlen(sbuf);
- if(size +1 > 80) return -1; /* test if sufficient space */
- strcpy(TIPString, sbuf);
- return dfe_errno;
-}
-
-/********************************************************** UDI_Enumerate_TIPs
-* Used by the DFE to enquire about available TIP
-* connections.
-*/
-UDIError UDIEnumerateTIPs(UDIETCallback)
- int (*UDIETCallback)(); /* In -- function to callback */
-{
- FILE *fp;
-
- fp = fopen(config_file, "r");
- if(fp == NULL)
- return UDIErrorCantOpenConfigFile;
- while(fgets( sbuf, SBUF_SIZE, fp))
- if(UDIETCallback( sbuf) == UDITerminateEnumeration)
- break;
- fclose( fp);
- return UDINoError; /* return success */
-}
-
-/*********************************************************** UDI_GET_ERROR_MSG
-* Some errors are target specific. They are indicated
-* by a negative error return value. The DFE uses
-* UDIGetErrorMsg() to get the descriptive text for
-* the error message which can then be displayed to
-* the user.
-*/
-UDIError UDIGetErrorMsg(error_code, msg_len, msg, CountDone)
-UDIError error_code; /* In */
-UDISizeT msg_len; /* In -- allowed message space */
-char* msg; /* Out -- length of message*/
-UDISizeT *CountDone; /* Out -- number of characters */
-{
- UDIInt32 service_id = UDIGetErrorMsg_c;
- int size;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDIError(udrs, &error_code);
- udr_UDISizeT(udrs, &msg_len);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_string(udrs, sbuf);
- udr_UDISizeT(udrs, CountDone);
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- size = strlen(sbuf);
- if(size +1 > msg_len) return -1; /* test if sufficient space */
- strcpy(msg, sbuf);
- return dfe_errno;
-}
-
-/******************************************************* UDI_GET_TARGET_CONFIG
-* UDIGetTargetConfig() gets information about the target.
-*/
-UDIError UDIGetTargetConfig(KnownMemory, NumberOfRanges, ChipVersions,
- NumberOfChips)
-UDIMemoryRange KnownMemory[]; /* Out */
-UDIInt *NumberOfRanges; /* In and Out */
-UDIUInt32 ChipVersions[]; /* Out */
-UDIInt *NumberOfChips; /* In and Out */
-{
- UDIInt32 service_id = UDIGetTargetConfig_c;
- int cnt;
- int MaxOfRanges = *NumberOfRanges;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDIInt(udrs, NumberOfRanges);
- udr_UDIInt(udrs, NumberOfChips);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" paramters */
- for(cnt=1; cnt <= MaxOfRanges; cnt++)
- udr_UDIMemoryRange(udrs, &KnownMemory[cnt-1]);
- udr_UDIInt(udrs, NumberOfRanges);
- udr_UDIInt(udrs, NumberOfChips);
- for(cnt=1; cnt <= *NumberOfChips; cnt++)
- udr_UDIUInt32(udrs, &ChipVersions[cnt -1]);
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/********************************************************** UDI_CREATE_PRCOESS
-* UDICreateProcess() tells the target OS that a
-* process is to be created and gets a PID back unless
-* there is some error.
-*/
-UDIError UDICreateProcess(pid)
-UDIPId *pid; /* out */
-{
- UDIInt32 service_id = UDICreateProcess_c;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDIPId(udrs, pid);
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/***************************************************** UDI_Set_Current_Process
-* UDISetCurrentProcess uses a pid supplied by
-* UDICreateProcess and sets it as the default for all
-* udi calls until a new one is set. A user of a
-*/
-UDIError UDISetCurrentProcess (pid)
-UDIPId pid; /* In */
-{
- UDIInt32 service_id = UDISetCurrentProcess_c;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDIPId(udrs, &pid);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/****************************************************** UDI_INITIALISE_PROCESS
-* UDIInitializeProcess() prepare process for
-* execution. (Reset processor if process os processor).
-*/
-UDIError UDIInitializeProcess( ProcessMemory, NumberOfRanges, EntryPoint,
- StackSizes, NumberOfStacks, ArgString)
-UDIMemoryRange ProcessMemory[]; /* In */
-UDIInt NumberOfRanges; /* In */
-UDIResource EntryPoint; /* In */
-CPUSizeT *StackSizes; /* In */
-UDIInt NumberOfStacks; /* In */
-char *ArgString; /* In */
-{
- UDIInt32 service_id = UDIInitializeProcess_c;
- int cnt;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDIInt(udrs, &NumberOfRanges);
- for(cnt = 0; cnt < NumberOfRanges; cnt++)
- udr_UDIMemoryRange(udrs, &ProcessMemory[cnt] );
- udr_UDIResource(udrs, &EntryPoint);
- udr_UDIInt(udrs, &NumberOfStacks);
- for(cnt = 0; cnt < NumberOfStacks; cnt++)
- udr_CPUSizeT(udrs, &StackSizes[cnt]);
- udr_string(udrs, ArgString);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/********************************************************* UDI_DESTROY_PROCESS
-* UDIDestroyProcess() frees a process resource
-* previously created by UDICreateProcess().
-*/
-UDIError UDIDestroyProcess(pid)
-UDIPId pid; /* in */
-{
- UDIInt32 service_id = UDIDestroyProcess_c;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDIPId(udrs, &pid);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/****************************************************************** UDI_READ
-* UDIRead() reads a block of objects from a target
-* address space to host space.
-*/
-
-UDIError UDIRead (from, to, count, size, count_done, host_endian)
-UDIResource from; /* in - source address on target */
-UDIHostMemPtr to; /* out - destination address on host */
-UDICount count; /* in -- count of objects to be transferred */
-UDISizeT size; /* in -- size of each object */
-UDICount *count_done; /* out - count actually transferred */
-UDIBool host_endian; /* in -- flag for endian information */
-{
- UDIInt32 service_id = UDIRead_c;
- int byte_count;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDIResource(udrs, &from);
- udr_UDICount(udrs, &count);
- udr_UDISizeT(udrs, &size);
- udr_UDIBool(udrs, &host_endian);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" paramters */
- udr_UDICount(udrs, count_done);
- byte_count = (*count_done) * size;
- if(*count_done > 0 && *count_done <= count)
- udr_bytes(udrs, to, byte_count);
- if(udr_errno) return udr_errno;
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/****************************************************************** UDI_WRITE
-* UDIWrite() writes a block of objects from host
-* space to a target address+space.
-*/
-UDIError UDIWrite( from, to, count, size, count_done, host_endian )
-UDIHostMemPtr from; /* in -- source address on host */
-UDIResource to; /* in -- destination address on target */
-UDICount count; /* in -- count of objects to be transferred */
-UDISizeT size; /* in -- size of each object */
-UDICount *count_done; /* out - count actually transferred */
-UDIBool host_endian; /* in -- flag for endian information */
-{
- UDIInt32 service_id = UDIWrite_c;
- int byte_count = count * size;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDIResource(udrs, &to);
- udr_UDICount(udrs, &count);
- udr_UDISizeT(udrs, &size);
- udr_UDIBool(udrs, &host_endian);
- udr_bytes(udrs, from, byte_count);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" paramters */
- udr_UDICount(udrs, count_done);
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/******************************************************************** UDI_COPY
-* UDICopy() copies a block of objects from one target
-* get address/space to another target address/space.
-*/
-UDIError UDICopy(from, to, count, size, count_done, direction )
-UDIResource from; /* in -- destination address on target */
-UDIResource to; /* in -- source address on target */
-UDICount count; /* in -- count of objects to be transferred */
-UDISizeT size; /* in -- size of each object */
-UDICount *count_done; /* out - count actually transferred */
-UDIBool direction; /* in -- high-to-low or reverse */
-{
- UDIInt32 service_id = UDICopy_c;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDIResource(udrs, &from);
- udr_UDIResource(udrs, &to);
- udr_UDICount(udrs, &count);
- udr_UDISizeT(udrs, &size);
- udr_UDIBool(udrs, &direction);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDICount(udrs, count_done);
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/***************************************************************** UDI_EXECUTE
-* UDIExecute() continues execution of the default
-* process from the current PC.
-*/
-UDIError UDIExecute()
-{
- UDIInt32 service_id = UDIExecute_c;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/******************************************************************** UDI_STEP
-* UDIStep() specifies a number of "instruction"
-* steps to make.
-*/
-UDIError UDIStep(steps, steptype, range)
-UDIUInt32 steps; /* in -- number of steps */
-UDIStepType steptype; /* in -- type of stepping to be done */
-UDIRange range; /* in -- range if StepInRange is TRUE */
-{
- UDIInt32 service_id = UDIStep_c;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDIInt32(udrs, &steps);
- udr_UDIStepType(udrs, &steptype);
- udr_UDIRange(udrs, &range);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/******************************************************************** UDI_STOP
-* UDIStop() stops the default process
-*/
-UDIVoid UDIStop()
-{
- if(!strcmp(session[current].soc_con_p->domain_string, "AF_UNIX"))
- kill(session[current].soc_con_p->tip_pid, SIGUSR1);
- else
- udr_signal(udrs);
- return;
-}
-
-/******************************************************************** UDI_WAIT
-* UDIWait() returns the state of the target procesor.
-*/
-UDIError UDIWait(maxtime, pid, stop_reason)
-UDIInt32 maxtime; /* in -- maximum time to wait for completion */
-UDIPId *pid; /* out -- pid of process which stopped if any */
-UDIUInt32 *stop_reason; /* out -- PC where process stopped */
-{
- UDIInt32 service_id = UDIWait_c;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDIInt32(udrs, &maxtime);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDIPId(udrs, pid);
- udr_UDIUInt32(udrs, stop_reason);
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/********************************************************** UDI_SET_BREAKPOINT
-* UDISetBreakpoint() sets a breakpoint at an adress
-* and uses the passcount to state how many
-* times that instruction should be hit before the
-* break occurs.
-*/
-UDIError UDISetBreakpoint (addr, passcount, type, break_id)
-UDIResource addr; /* in -- where breakpoint gets set */
-UDIInt32 passcount; /* in -- passcount for breakpoint */
-UDIBreakType type; /* in -- breakpoint type */
-UDIBreakId *break_id; /* out - assigned break id */
-{
- UDIInt32 service_id = UDISetBreakpoint_c;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDIResource(udrs, &addr);
- udr_UDIInt32(udrs, &passcount);
- udr_UDIBreakType(udrs, &type);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDIBreakId(udrs, break_id);
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/******************************************************** UDI_QUERY_BREAKPOINT
-*/
-UDIError UDIQueryBreakpoint (break_id, addr, passcount, type, current_count)
-UDIBreakId break_id; /* in -- assigned break id */
-UDIResource *addr; /* out - where breakpoint was set */
-UDIInt32 *passcount; /* out - trigger passcount for breakpoint */
-UDIBreakType *type; /* out - breakpoint type */
-UDIInt32 *current_count; /* out - current count for breakpoint */
-{
- UDIInt32 service_id = UDIQueryBreakpoint_c;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDIBreakId(udrs, &break_id);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDIResource(udrs, addr);
- udr_UDIInt32(udrs, passcount);
- udr_UDIBreakType(udrs, type);
- udr_UDIInt32(udrs, current_count);
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/******************************************************** UDI_CLEAR_BREAKPOINT
-* UDIClearBreakpoint() is used to clear a breakpoint.
-*/
-UDIError UDIClearBreakpoint (break_id)
-UDIBreakId break_id; /* in -- assigned break id */
-{
- UDIInt32 service_id = UDIClearBreakpoint_c;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDIBreakId(udrs, &break_id);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/************************************************************** UDI_GET_STDOUT
-* UDIGetStdout() is called when a call to
-* UDIWait() indicates there is STD output data ready.
-*/
-UDIError UDIGetStdout(buf, bufsize, count_done)
-UDIHostMemPtr buf; /* out -- buffer to be filled */
-UDISizeT bufsize; /* in -- buffer size in bytes */
-UDISizeT *count_done; /* out -- number of bytes written to buf */
-{
- UDIInt32 service_id = UDIGetStdout_c;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDISizeT(udrs, &bufsize);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDISizeT(udrs, count_done);
- udr_bytes(udrs, buf, *count_done);
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/************************************************************** UDI_GET_STDERR
-* UDIGetStderr() is called when a call to
-* UDIWait() indicates there is STDERR output data ready
-*/
-UDIError UDIGetStderr(buf, bufsize, count_done)
-UDIHostMemPtr buf; /* out -- buffer to be filled */
-UDISizeT bufsize; /* in -- buffer size in bytes */
-UDISizeT *count_done; /* out -- number of bytes written to buf */
-{
- UDIInt32 service_id = UDIGetStderr_c;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDISizeT(udrs, &bufsize);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDISizeT(udrs, count_done);
- udr_bytes(udrs, buf, *count_done);
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/*************************************************************** UDI_PUT_STDIN
-* UDIPutStdin() is called whenever the DFE wants to
-* deliver an input character to the TIP.
-*/
-UDIError UDIPutStdin (buf, count, count_done)
-UDIHostMemPtr buf; /* in -- buffer to be filled */
-UDISizeT count; /* in -- buffer size in bytes */
-UDISizeT *count_done; /* out - number of bytes written to buf */
-{
- UDIInt32 service_id = UDIPutStdin_c;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDISizeT(udrs, &count);
- udr_bytes(udrs, buf, count);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDISizeT(udrs, count_done);
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/************************************************************** UDI_STDIN_MODE
-* UDIStdinMode() is used to change the mode that chazcters
-* are fetched from the user.
-*/
-UDIError UDIStdinMode(mode)
-UDIMode *mode; /* out - */
-{
- UDIInt32 service_id = UDIStdinMode_c;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDIMode(udrs, mode);
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/*************************************************************** UDI_PUT_TRANS
-* UDIPutTrans() is used to feed input to the passthru mode.
-*/
-UDIError UDIPutTrans (buf, count, count_done)
-UDIHostMemPtr buf; /* in -- buffer address containing input data */
-UDISizeT count; /* in -- number of bytes in buf */
-UDISizeT *count_done; /* out-- number of bytes transfered */
-{
- UDIInt32 service_id = UDIPutTrans_c;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDISizeT(udrs, &count);
- udr_bytes(udrs, buf, count);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDISizeT(udrs, count_done);
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/*************************************************************** UDI_GET_TRANS
-* UDIGetTrans() is used to get output lines from the
-* passthru mode.
-*/
-UDIError UDIGetTrans (buf, bufsize, count_done)
-UDIHostMemPtr buf; /* out -- buffer to be filled */
-UDISizeT bufsize; /* in -- size of buf */
-UDISizeT *count_done; /* out -- number of bytes in buf */
-{
- UDIInt32 service_id = UDIGetTrans_c;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDISizeT(udrs, &bufsize);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDISizeT(udrs, count_done);
- udr_bytes(udrs, buf, *count_done);
- udr_UDIError(udrs, &dfe_errno); /* get any TIP error */
- return dfe_errno;
-}
-
-/************************************************************** UDI_Trans_Mode
-* UDITransMode() is used to change the mode that the
-* transparent routines operate in.
-*/
-UDIError UDITransMode(mode)
-UDIMode *mode; /* out -- selected mode */
-{
- UDIInt32 service_id = UDITransMode_c;
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
- udr_UDIMode(udrs, mode);
- udr_sendnow(udrs);
- if(udr_errno) return udr_errno;
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- udr_UDIError(udrs, &dfe_errno);
- return dfe_errno;
-}
-
-/******************************************************************** UDI_TEST
-*/
-UDIError UDITest( cnt, str_p, array)
-UDISizeT cnt;
-UDIHostMemPtr str_p;
-UDIInt32 array[];
-{
- UDIInt32 service_id = UDITest_c;
- UDIInt16 scnt = cnt;
- UDISizeT r_cnt;
- char buf[256];
-
- udr_errno = 0;
- udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */
- udr_UDIInt32(udrs, &service_id);
-
- printf("send cnt=%d scnt=%d\n", cnt, scnt);
- udr_UDISizeT(udrs, &cnt);
- udr_UDIInt16(udrs, &scnt);
- printf(" array[0]=0x%x array[1]=0x%x array[2]=0x%x array[3]=0x%x\n",
- array[0], array[1], array[2], array[3]);
- udr_bytes(udrs, (char*)array, 4*sizeof(UDIInt32));
- printf(" string=%s\n", str_p);
- udr_string(udrs, str_p);
- udr_sendnow(udrs);
- if(udr_errno)
- { fprintf(stderr, " DFE-ipc Send ERROR\n");
- return udr_errno;
- }
-
- udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */
- printf("recv ");
- udr_UDISizeT(udrs, &r_cnt);
- udr_UDIInt16(udrs, &scnt);
- printf(" rcnt=%d scnt=%d\n", r_cnt, scnt);
- udr_bytes(udrs, (char*)array, 4*sizeof(UDIInt32));
-
- printf(" array[0]=0x%x array[1]=0x%x array[2]=0x%x array[3]=0x%x\n",
- array[0], array[1], array[2], array[3]);
- udr_string(udrs, str_p);
- printf(" string=%s\n", str_p);
-
- udr_UDIError(udrs, &dfe_errno);
- return dfe_errno;
-}
-
-UDIUInt32 UDIGetDFEIPCId()
-{
- return ((company_c << 16) + (product_c << 12) + version_c);
-}
-
+++ /dev/null
-/* This file just picks the correct udiphxxx.h depending on the host */
-/* The two hosts that are now defined are SUN and MSDOS */
-
-#ifdef __hpux
-#include "udiphsun.h"
-#endif
-
-#ifdef sun
-#include "udiphsun.h"
-#else
-
-#ifdef MSDOS
-#include "udiphdos.h"
-#endif
-#endif
-
+++ /dev/null
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * Comments about this software should be directed to udi@amd.com. If access
- * to electronic mail isn't available, send mail to:
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- *****************************************************************************
- * $Id$
- * $Id: @(#)udiphdos.h 2.7, AMD
- */
-
-
-/* Modified M.Typaldos 11/92 - Added '386 specific code (just changed
- * far to _FAR really).
- */
-
-
-/* This file is to be used to reconfigure the UDI Procedural interface
- for a given host. This file should be placed so that it will be
- included from udiproc.h. Everything in here may need to be changed
- when you change either the host CPU or its compiler. Nothing in
- here should change to support different targets. There are multiple
- versions of this file, one for each of the different host/compiler
- combinations in use.
-*/
-
-#ifdef DOS386
-#ifdef WATC
-#define UDIStruct _Packed struct
-#define _FAR
-#else /* not WATC */
-#define UDIStruct _packed struct
-#define _FAR
-#define far /* far not used in DOS386 (but _far is needed) */
-#endif /* WATC */
-#else
-#define _packed /* _packed only used on DOS386 */
-#define UDIStruct struct
-#define _FAR far
-#endif
-/* First, we need some types */
-/* Types with at least the specified number of bits */
-typedef double UDIReal64; /* 64-bit real value */
-typedef float UDIReal32; /* 32-bit real value */
-
-typedef unsigned long UDIUInt32; /* unsigned integers */
-typedef unsigned short UDIUInt16;
-typedef unsigned char UDIUInt8;
-
-typedef long UDIInt32; /* 32-bit integer */
-typedef short UDIInt16; /* 16-bit integer */
-typedef char UDIInt8; /* unreliable signedness */
-
-/* To aid in supporting environments where the DFE and TIP use
-different compilers or hosts (like DOS 386 on one side, 286 on the
-other, or different Unix machines connected by sockets), we define
-two abstract types - UDIInt and UDISizeT.
-UDIInt should be defined to be int except for host/compiler combinations
-that are intended to talk to existing UDI components that have a different
-sized int. Similarly for UDISizeT.
-*/
-#ifndef DOS386
-typedef int UDIInt;
-typedef unsigned int UDIUInt;
-
-typedef unsigned int UDISizeT;
-#else
- /* DOS386 is one of those host/compiler combinations that require UDIInt
- * not be defined as int
- */
-typedef UDIInt16 UDIInt;
-typedef UDIUInt16 UDIUInt;
-
-typedef UDIUInt16 UDISizeT;
-#endif
-/* Now two void types. The first is for function return types,
-the other for pointers to no particular type. Since these types
-are used solely for documentational clarity, if your host/compiler
-doesn't support either one, replace them with int and char *
-respectively.
-*/
-typedef void UDIVoid; /* void type */
-typedef void * UDIVoidPtr; /* void pointer type */
-typedef void _FAR * UDIHostMemPtr; /* Arbitrary memory pointer */
-
-/* Now we want a type optimized for boolean values. Normally this
- would be int, but on some machines (Z80s, 8051s, etc) it might
- be better to map it onto a char
-*/
-#ifndef DOS386
-typedef int UDIBool;
-#else
-typedef UDIInt16 UDIBool; /* see reasoning above */
-#endif
-
-/* Now indicate whether your compiler support full ANSI style
- prototypes. If so, use #if 1. If not use #if 0.
-*/
-#if 1
-#define UDIParams(x) x
-#else
-#define UDIParams(x) ()
-#endif
+++ /dev/null
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * Comments about this software should be directed to udi@amd.com. If access
- * to electronic mail isn't available, send mail to:
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- *****************************************************************************
- * $Id$
- * $Id: @(#)udiphsun.h 2.3, AMD
- */
-
-/* This file is to be used to reconfigure the UDI Procedural interface
- for a given host. This file should be placed so that it will be
- included from udiproc.h. Everything in here may need to be changed
- when you change either the host CPU or its compiler. Nothing in
- here should change to support different targets. There are multiple
- versions of this file, one for each of the different host/compiler
- combinations in use.
-*/
-
-#define UDIStruct struct /* _packed not needed on Sun */
-/* First, we need some types */
-/* Types with at least the specified number of bits */
-typedef double UDIReal64; /* 64-bit real value */
-typedef float UDIReal32; /* 32-bit real value */
-
-typedef unsigned long UDIUInt32; /* unsigned integers */
-typedef unsigned short UDIUInt16;
-typedef unsigned char UDIUInt8;
-
-typedef long UDIInt32; /* 32-bit integer */
-typedef short UDIInt16; /* 16-bit integer */
-typedef char UDIInt8; /* unreliable signedness */
-
-/* To aid in supporting environments where the DFE and TIP use
-different compilers or hosts (like DOS 386 on one side, 286 on the
-other, or different Unix machines connected by sockets), we define
-two abstract types - UDIInt and UDISizeT.
-UDIInt should be defined to be int except for host/compiler combinations
-that are intended to talk to existing UDI components that have a different
-sized int. Similarly for UDISizeT.
-*/
-typedef int UDIInt;
-typedef unsigned int UDIUInt;
-
-typedef unsigned int UDISizeT;
-
-/* Now two void types. The first is for function return types,
-the other for pointers to no particular type. Since these types
-are used solely for documentational clarity, if your host/compiler
-doesn't support either one, replace them with int and char *
-respectively.
-*/
-typedef void UDIVoid; /* void type */
-typedef void * UDIVoidPtr; /* void pointer type */
-typedef void * UDIHostMemPtr; /* Arbitrary memory pointer */
-
-/* Now we want a type optimized for boolean values. Normally this
- would be int, but on some machines (Z80s, 8051s, etc) it might
- be better to map it onto a char
-*/
-typedef int UDIBool;
-
-/* Now indicate whether your compiler support full ANSI style
- prototypes. If so, use #if 1. If not use #if 0.
-*/
-#if 0
-#define UDIParams(x) x
-#else
-#define UDIParams(x) ()
-#endif
+++ /dev/null
-#ifndef _UDIPROC_H
-#define _UDIPROC_H
-
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * Comments about this software should be directed to udi@amd.com. If access
- * to electronic mail isn't available, send mail to:
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- *
- * For more detailed information about the values, types, and functions
- * defined and declared here, see the corresponding UDI spec available
- * from AMD at the address above.
- *****************************************************************************
- * $Id$
- * $Id: @(#)udiproc.h 2.12, AMD
- */
-
-/* local type decs. and macro defs. not in a .h file ************* MACRO/TYPE
-*/
-#include "udiphcfg.h" /* Get host specific configuration */
-#include "udiptcfg.h" /* Get target specific configuration */
-
-/* Here are all of the CPU Families for which UDI is currently defined */
-#define Am29K 1 /* AMD's Am290xx and Am292xx parts */
-
-typedef UDIInt UDIError;
-typedef UDIInt UDISessionId;
-typedef UDIInt UDIPId;
-typedef UDIInt UDIStepType;
-typedef UDIInt UDIBreakType;
-typedef UDIUInt UDIBreakId;
-typedef UDIUInt UDIMode;
-
-typedef UDIStruct
-{
- CPUSpace Space;
- CPUOffset Offset;
-} UDIResource;
-
-typedef UDIStruct
-{
- CPUOffset Low;
- CPUOffset High;
-} UDIRange;
-
-typedef UDIStruct
-{
- CPUSpace Space;
- CPUOffset Offset;
- CPUSizeT Size;
- } UDIMemoryRange;
-
-/* Values for UDIStepType parameters */
-#define UDIStepNatural 0x0000
-#define UDIStepOverTraps 0x0001
-#define UDIStepOverCalls 0x0002
-#define UDIStepInRange 0x0004
-#define UDIStepNatural 0x0000
-
-/* Values for UDIBreakType parameters */
-#define UDIBreakFlagExecute 0x0001
-#define UDIBreakFlagRead 0x0002
-#define UDIBreakFlagWrite 0x0004
-#define UDIBreakFlagFetch 0x0008
-
-/* Special values for UDIWait MaxTime parameter */
-#define UDIWaitForever (UDIInt32) -1 /* Infinite time delay */
-
-/* Special values for PId */
-#define UDIProcessProcessor -1 /* Raw Hardware, if possible */
-
-/* Values for UDIWait StopReason */
-#define UDIGrossState 0xff
-#define UDITrapped 0 /* Fine state - which trap */
-#define UDINotExecuting 1
-#define UDIRunning 2
-#define UDIStopped 3
-#define UDIWarned 4
-#define UDIStepped 5
-#define UDIWaiting 6
-#define UDIHalted 7
-#define UDIStdoutReady 8 /* fine state - size */
-#define UDIStderrReady 9 /* fine state - size */
-#define UDIStdinNeeded 10 /* fine state - size */
-#define UDIStdinModeX 11 /* fine state - mode */
-#define UDIBreak 12 /* Fine state - Breakpoint Id */
-#define UDIExited 13 /* Fine state - exit code */
-
-/* Enumerate the return values from the callback function
- for UDIEnumerateTIPs.
-*/
-#define UDITerminateEnumeration 0
-#define UDIContinueEnumeration 1
-
-/* Enumerate values for Terminate parameter to UDIDisconnect */
-#define UDITerminateSession 1
-#define UDIContinueSession 0
-
-/* Error codes */
-#define UDINoError 0 /* No error occured */
-#define UDIErrorNoSuchConfiguration 1
-#define UDIErrorCantHappen 2
-#define UDIErrorCantConnect 3
-#define UDIErrorNoSuchConnection 4
-#define UDIErrorNoConnection 5
-#define UDIErrorCantOpenConfigFile 6
-#define UDIErrorCantStartTIP 7
-#define UDIErrorConnectionUnavailable 8
-#define UDIErrorTryAnotherTIP 9
-#define UDIErrorExecutableNotTIP 10
-#define UDIErrorInvalidTIPOption 11
-#define UDIErrorCantDisconnect 12
-#define UDIErrorUnknownError 13
-#define UDIErrorCantCreateProcess 14
-#define UDIErrorNoSuchProcess 15
-#define UDIErrorUnknownResourceSpace 16
-#define UDIErrorInvalidResource 17
-#define UDIErrorUnsupportedStepType 18
-#define UDIErrorCantSetBreakpoint 19
-#define UDIErrorTooManyBreakpoints 20
-#define UDIErrorInvalidBreakId 21
-#define UDIErrorNoMoreBreakIds 22
-#define UDIErrorUnsupportedService 23
-#define UDIErrorTryAgain 24
-#define UDIErrorIPCLimitation 25
-#define UDIErrorIncomplete 26
-#define UDIErrorAborted 27
-#define UDIErrorTransDone 28
-#define UDIErrorCantAccept 29
-#define UDIErrorTransInputNeeded 30
-#define UDIErrorTransModeX 31
-#define UDIErrorInvalidSize 32
-#define UDIErrorBadConfigFileEntry 33
-#define UDIErrorIPCInternal 34
-/* TBD */
-
-/****************************************************************** PROCEDURES
-*/
-
-UDIError UDIConnect UDIParams((
- char *Configuration, /* In */
- UDISessionId *Session /* Out */
- ));
-
-UDIError UDIDisconnect UDIParams((
- UDISessionId Session, /* In */
- UDIBool Terminate /* In */
- ));
-
-UDIError UDISetCurrentConnection UDIParams((
- UDISessionId Session /* In */
- ));
-
-UDIError UDICapabilities UDIParams((
- UDIUInt32 *TIPId, /* Out */
- UDIUInt32 *TargetId, /* Out */
- UDIUInt32 DFEId, /* In */
- UDIUInt32 DFE, /* In */
- UDIUInt32 *TIP, /* Out */
- UDIUInt32 *DFEIPCId, /* Out */
- UDIUInt32 *TIPIPCId, /* Out */
- char *TIPString /* Out */
- ));
-
-UDIError UDIEnumerateTIPs UDIParams((
- UDIInt (*UDIETCallback) /* In */
- UDIParams(( char *Configuration )) /* In to callback() */
- ));
-
-UDIError UDIGetErrorMsg UDIParams((
- UDIError ErrorCode, /* In */
- UDISizeT MsgSize, /* In */
- char *Msg, /* Out */
- UDISizeT *CountDone /* Out */
- ));
-
-UDIError UDIGetTargetConfig UDIParams((
- UDIMemoryRange KnownMemory[], /* Out */
- UDIInt *NumberOfRanges, /* In/Out */
- UDIUInt32 ChipVersions[], /* Out */
- UDIInt *NumberOfChips /* In/Out */
- ));
-
-UDIError UDICreateProcess UDIParams((
- UDIPId *PId /* Out */
- ));
-
-UDIError UDISetCurrentProcess UDIParams((
- UDIPId PId /* In */
- ));
-
-UDIError UDIDestroyProcess UDIParams((
- UDIPId PId /* In */
- ));
-
-UDIError UDIInitializeProcess UDIParams((
- UDIMemoryRange ProcessMemory[], /* In */
- UDIInt NumberOfRanges, /* In */
- UDIResource EntryPoint, /* In */
- CPUSizeT StackSizes[], /* In */
- UDIInt NumberOfStacks, /* In */
- char *ArgString /* In */
- ));
-
-UDIError UDIRead UDIParams((
- UDIResource From, /* In */
- UDIHostMemPtr To, /* Out */
- UDICount Count, /* In */
- UDISizeT Size, /* In */
- UDICount *CountDone, /* Out */
- UDIBool HostEndian /* In */
- ));
-
-UDIError UDIWrite UDIParams((
- UDIHostMemPtr From, /* In */
- UDIResource To, /* In */
- UDICount Count, /* In */
- UDISizeT Size, /* In */
- UDICount *CountDone, /* Out */
- UDIBool HostEndian /* In */
- ));
-
-UDIError UDICopy UDIParams((
- UDIResource From, /* In */
- UDIResource To, /* In */
- UDICount Count, /* In */
- UDISizeT Size, /* In */
- UDICount *CountDone, /* Out */
- UDIBool Direction /* In */
- ));
-
-UDIError UDIExecute UDIParams((
- void
- ));
-
-UDIError UDIStep UDIParams((
- UDIUInt32 Steps, /* In */
- UDIStepType StepType, /* In */
- UDIRange Range /* In */
- ));
-
-UDIVoid UDIStop UDIParams((
- void
- ));
-
-UDIError UDIWait UDIParams((
- UDIInt32 MaxTime, /* In */
- UDIPId *PId, /* Out */
- UDIUInt32 *StopReason /* Out */
- ));
-
-UDIError UDISetBreakpoint UDIParams((
- UDIResource Addr, /* In */
- UDIInt32 PassCount, /* In */
- UDIBreakType Type, /* In */
- UDIBreakId *BreakId /* Out */
- ));
-
-UDIError UDIQueryBreakpoint UDIParams((
- UDIBreakId BreakId, /* In */
- UDIResource *Addr, /* Out */
- UDIInt32 *PassCount, /* Out */
- UDIBreakType *Type, /* Out */
- UDIInt32 *CurrentCount /* Out */
- ));
-
-UDIError UDIClearBreakpoint UDIParams((
- UDIBreakId BreakId /* In */
- ));
-
-UDIError UDIGetStdout UDIParams((
- UDIHostMemPtr Buf, /* Out */
- UDISizeT BufSize, /* In */
- UDISizeT *CountDone /* Out */
- ));
-
-UDIError UDIGetStderr UDIParams((
- UDIHostMemPtr Buf, /* Out */
- UDISizeT BufSize, /* In */
- UDISizeT *CountDone /* Out */
- ));
-
-UDIError UDIPutStdin UDIParams((
- UDIHostMemPtr Buf, /* In */
- UDISizeT Count, /* In */
- UDISizeT *CountDone /* Out */
- ));
-
-UDIError UDIStdinMode UDIParams((
- UDIMode *Mode /* Out */
- ));
-
-UDIError UDIPutTrans UDIParams((
- UDIHostMemPtr Buf, /* In */
- UDISizeT Count, /* In */
- UDISizeT *CountDone /* Out */
- ));
-
-UDIError UDIGetTrans UDIParams((
- UDIHostMemPtr Buf, /* Out */
- UDISizeT BufSize, /* In */
- UDISizeT *CountDone /* Out */
- ));
-
-UDIError UDITransMode UDIParams((
- UDIMode *Mode /* Out */
- ));
-
-#endif /* _UDIPROC_H */
+++ /dev/null
-/******************************************************************************
- * Copyright 1991 Advanced Micro Devices, Inc.
- *
- * This software is the property of Advanced Micro Devices, Inc (AMD) which
- * specifically grants the user the right to modify, use and distribute this
- * software provided this notice is not removed or altered. All other rights
- * are reserved by AMD.
- *
- * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
- * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
- * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
- * USE OF THIS SOFTWARE.
- *
- * Comments about this software should be directed to udi@amd.com. If access
- * to electronic mail isn't available, send mail to:
- *
- * Advanced Micro Devices, Inc.
- * 29K Support Products
- * Mail Stop 573
- * 5900 E. Ben White Blvd.
- * Austin, TX 78741
- *****************************************************************************
- * $Id$
- * $Id: @(#)udipt29k.h 2.5, AMD
- */
-
-/* This file is to be used to reconfigure the UDI Procedural interface
- for a given target. This file should be placed so that it will be
- included from udiproc.h. Everything in here will probably need to
- be changed when you change the target processor. Nothing in here
- should need to change when you change hosts or compilers.
-*/
-
-/* Select a target CPU Family */
-#define TargetCPUFamily Am29K
-
-/* Enumerate the processor specific values for Space in a resource */
-#define UDI29KDRAMSpace 0
-#define UDI29KIOSpace 1
-#define UDI29KCPSpace0 2
-#define UDI29KCPSpace1 3
-#define UDI29KIROMSpace 4
-#define UDI29KIRAMSpace 5
-#define UDI29KLocalRegs 8
-#define UDI29KGlobalRegs 9
-#define UDI29KRealRegs 10
-#define UDI29KSpecialRegs 11
-#define UDI29KTLBRegs 12 /* Not Am29005 */
-#define UDI29KACCRegs 13 /* Am29050 only */
-#define UDI29KICacheSpace 14 /* Am2903x only */
-#define UDI29KAm29027Regs 15 /* When available */
-#define UDI29KPC 16
-#define UDI29KDCacheSpace 17 /* When available */
-
-/* Enumerate the Co-processor registers */
-#define UDI29KCP_F 0
-#define UDI29KCP_Flag 8
-#define UDI29KCP_I 12
-#define UDI29KCP_ITmp 16
-#define UDI29KCP_R 20
-#define UDI29KCP_S 28
-#define UDI29KCP_RTmp 36
-#define UDI29KCP_STmp 44
-#define UDI29KCP_Stat 52
-#define UDI29KCP_Prec 56
-#define UDI29KCP_Reg0 60
-#define UDI29KCP_Reg1 68
-#define UDI29KCP_Reg2 76
-#define UDI29KCP_Reg3 84
-#define UDI29KCP_Reg4 92
-#define UDI29KCP_Reg5 100
-#define UDI29KCP_Reg6 108
-#define UDI29KCP_Reg7 116
-#define UDI29KCP_Mode 124
-
-/* Enumerate the stacks in StackSizes array */
-#define UDI29KMemoryStack 0
-#define UDI29KRegisterStack 1
-
-/* Enumerate the chips for ChipVersions array */
-#define UDI29K29KVersion 0
-#define UDI29K29027Version 1
-
-/* Define special value for elements of ChipVersions array for
- * chips not present */
-#define UDI29KChipNotPresent -1
-
-typedef UDIInt32 UDICount;
-typedef UDIUInt32 UDISize;
-
-typedef UDIInt CPUSpace;
-typedef UDIUInt32 CPUOffset;
-typedef UDIUInt32 CPUSizeT;
+++ /dev/null
-#include "udipt29k.h"
+++ /dev/null
-/******************************************************************************
-* Copyright 1991 Advanced Micro Devices, Inc.
-*
-* This software is the property of Advanced Micro Devices, Inc (AMD) which
-* specifically grants the user the right to modify, use and distribute this
-* software provided this notice is not removed or altered. All other rights
-* are reserved by AMD.
-*
-* AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
-* SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
-* DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
-* USE OF THIS SOFTWARE.
-*
-* So that all may benefit from your experience, please report any problems
-* or suggestions about this software to the 29K Technical Support Center at
-* 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
-* 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
-*
-* Advanced Micro Devices, Inc.
-* 29K Support Products
-* Mail Stop 573
-* 5900 E. Ben White Blvd.
-* Austin, TX 78741
-* 800-292-9263
-*****************************************************************************
-*/
-static char udisoc_h[]="@(#)udisoc.h 2.6 Daniel Mann";
-static char udisoc_h_AMD[]="@(#)udisoc.h 2.4, AMD";
-/*
-* This module defines constants used in the UDI IPC modules
-********************************************************************** HISTORY
-*/
-#define LOCAL static
-#define company_c 1 /* AMD Company id */
-#define product_c 1 /* socket IPC id */
-
-/* Enumerate the UDI procedure services
-*/
-#define UDIConnect_c 0
-#define UDIDisconnect_c 1
-#define UDISetCurrentConnection_c 2
-#define UDICapabilities_c 3
-#define UDIEnumerateTIPs_c 4
-#define UDIGetErrorMsg_c 5
-#define UDIGetTargetConfig_c 6
-#define UDICreateProcess_c 7
-#define UDISetCurrentProcess_c 8
-#define UDIDestroyProcess_c 9
-#define UDIInitializeProcess_c 10
-#define UDIRead_c 11
-#define UDIWrite_c 12
-#define UDICopy_c 13
-#define UDIExecute_c 14
-#define UDIStep_c 15
-#define UDIStop_c 16
-#define UDIWait_c 17
-#define UDISetBreakpoint_c 18
-#define UDIQueryBreakpoint_c 19
-#define UDIClearBreakpoint_c 20
-#define UDIGetStdout_c 21
-#define UDIGetStderr_c 22
-#define UDIPutStdin_c 23
-#define UDIStdinMode_c 24
-#define UDIPutTrans_c 25
-#define UDIGetTrans_c 26
-#define UDITransMode_c 27
-#define UDITest_c 28
-#define UDIKill_c 29
-
-#define udr_UDIInt8(udrs, obj) udr_work(udrs, obj, 1)
-#define udr_UDIInt16(udrs, obj) udr_work(udrs, obj, 2)
-#define udr_UDIInt32(udrs, obj) udr_work(udrs, obj, 4)
-#define udr_UDIInt(udrs, obj) udr_work(udrs, obj, 4)
-
-#define udr_UDIUInt8(udrs, obj) udr_work(udrs, obj, 1)
-#define udr_UDIUInt16(udrs, obj) udr_work(udrs, obj, 2)
-#define udr_UDIUInt32(udrs, obj) udr_work(udrs, obj, 4)
-#define udr_UDIUInt(udrs, obj) udr_work(udrs, obj, 4)
-
-#define udr_UDIBool(udrs, obj) udr_UDIInt32(udrs, obj)
-#define udr_UDICount(udrs, obj) udr_UDIInt32(udrs, obj)
-#define udr_UDISize(udrs, obj) udr_UDIUInt32(udrs, obj)
-#define udr_CPUSpace(udrs, obj) udr_UDIInt32(udrs, obj)
-#define udr_CPUOffset(udrs, obj) udr_UDIUInt32(udrs, obj)
-#define udr_CPUSizeT(udrs, obj) udr_UDIUInt32(udrs, obj)
-#define udr_UDIBreakId(udrs,obj) udr_UDIUInt(udrs, obj)
-#define udr_UDISizeT(udrs, obj) udr_UDIUInt(udrs, obj)
-#define udr_UDIMode(udrs, obj) udr_UDIUInt(udrs, obj)
-
-#define udr_UDIHostMemPtr(udrs, obj) udr_UDIUInt32(udrs, obj)
-#define udr_UDIVoidPtr(udrs, obj) udr_UDIUInt32(udrs, obj)
-#define udr_UDIPId(udrs, obj) udr_UDIUInt(udrs, obj)
-#define udr_UDISessionId(udrs, obj) udr_UDIInt32(udrs, obj)
-#define udr_UDIError(udrs, obj) udr_UDIInt32(udrs, obj)
-#define udr_UDIStepType(udrs, obj) udr_UDIInt32(udrs, obj)
-#define udr_UDIBreakType(udrs, obj) udr_UDIInt32(udrs, obj)
-
-
-#define UDR_ENCODE 1
-#define UDR_DECODE 2
-
-typedef struct UDR_str
-{
- int udr_op; /* UDR operation */
- int previous_op;
- int sd;
- int bufsize;
- char* buff;
- char* getbytes;
- char* putbytes;
- char* putend;
- int domain;
- char* soc_name;
-} UDR;
-
-/******************************************* Declare UDR suport functions */
-int udr_create UDIParams((
- UDR* udrs,
- int sd,
- int size
- ));
-
-int udr_free UDIParams((
- UDR* udrs,
- ));
-
-int udr_signal UDIParams((
- UDR* udrs,
- ));
-
-int udr_sendnow UDIParams((
- UDR* udrs
- ));
-
-int udr_work UDIParams((
- UDR* udrs,
- void* object_p,
- int size
- ));
-
-int udr_UDIResource UDIParams((
- UDR* udrs,
- UDIResource* object_p
- ));
-
-int udr_UDIRange UDIParams((
- UDR* udrs,
- UDIRange* object_p
- ));
-
-int udr_UDIMemoryRange UDIParams((
- UDR* udrs,
- UDIMemoryRange* object_p
- ));
-
-int udr_UDIMemoryRange UDIParams((
- UDR* udrs,
- UDIMemoryRange* object_p
- ));
-
-int udr_int UDIParams((
- UDR* udrs,
- int* int_p
- ));
-
-int udr_bytes UDIParams((
- UDR* udrs,
- char* ptr,
- int len
- ));
-
-char* udr_inline UDIParams((
- UDR* udrs,
- int size
- ));
-
-char* udr_getpos UDIParams((
- UDR* udrs
- ));
-int udr_setpos UDIParams((
- UDR* udrs,
- char* pos
- ));
-
-int udr_readnow UDIParams((
- UDR* udrs,
- int size
- ));
-
-int udr_align UDIParams((
- UDR* udrs,
- int size,
- ));
+++ /dev/null
-/******************************************************************************
-* Copyright 1991 Advanced Micro Devices, Inc.
-*
-* This software is the property of Advanced Micro Devices, Inc (AMD) which
-* specifically grants the user the right to modify, use and distribute this
-* software provided this notice is not removed or altered. All other rights
-* are reserved by AMD.
-*
-* AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
-* SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
-* DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
-* USE OF THIS SOFTWARE.
-*
-* So that all may benefit from your experience, please report any problems
-* or suggestions about this software to the 29K Technical Support Center at
-* 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
-* 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
-*
-* Advanced Micro Devices, Inc.
-* 29K Support Products
-* Mail Stop 573
-* 5900 E. Ben White Blvd.
-* Austin, TX 78741
-* 800-292-9263
-*****************************************************************************
-*/
-static char udr_c[] = "@(#)udr.c 2.8 Daniel Mann";
-static char udr_c_AMD[] = "@(#)udr.c 2.3, AMD";
-/*
-* This module supports sending and receiving
-* data objects over a socket conection.
-* All data is serialised into a character stream,
-* and de-serialised back into the approproiate objects.
-********************************************************************** HISTORY
-*/
-#include <stdio.h>
-#include <sys/fcntl.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include "udiproc.h"
-#include "udisoc.h"
-
-extern int errno;
-extern char *malloc ();
-
-/* local type decs. and macro defs. not in a .h file ************* MACRO/TYPE
-*/
-
-/* global dec/defs. which are not in a .h file ************* EXPORT DEC/DEFS
-*/
-int udr_errno; /* error occurs during UDR service */
-
-/* local dec/defs. which are not in a .h file *************** LOCAL DEC/DEFS
-*/
-
-/****************************************************************** UDR_CREATE
-* Build UDR structure for character stream processing.
-*/
-int
-udr_create (udrs, sd, size)
- UDR *udrs;
- int sd;
- int size;
-{
- udrs->sd = sd;
- if (!udrs->buff)
- udrs->buff = malloc (size);
- udrs->getbytes = udrs->buff; /* set the buffer to the start */
- udrs->putbytes = udrs->buff;
- udrs->putend = udrs->buff;
- udrs->udr_op = -1; /* don't know the direction */
- udrs->previous_op = -1; /* don't know the direction */
- udrs->bufsize = size;
- return 0;
-}
-
-/******************************************************************** UDR_FREE
-* Free USR structure and close socket.
-*/
-int
-udr_free (udrs)
- UDR *udrs;
-{
- close (udrs->sd);
- free (udrs->buff);
- return 0;
-}
-
-/****************************************************************** UDR_SIGNAL
-* Send a signal to the process at the other end of the socket,
-* indicating that it should expect to recieve a new message shortly.
-*/
-int
-udr_signal (udrs)
- UDR *udrs;
-{
- if (send (udrs->sd, "I", 1, MSG_OOB) == -1)
- {
- perror ("ERROR, udr_signal(), send(...MSG_OOB)");
- udr_errno = UDIErrorIPCInternal;
- return -1; /* return error code */
- }
- return 0;
-}
-
-/***************************************************************** UDR_SENDNOW
-* used to flush the current character stream buffer to
-* the associated socket. */
-int
-udr_sendnow (udrs)
- UDR *udrs;
-{
- int size = (UDIUInt32) (udrs->putend) - (UDIUInt32) (udrs->buff);
- if (udrs->previous_op == 0)
- {
- udr_errno = UDIErrorIPCInternal;
- return -1;
- }
- udrs->putbytes = udrs->buff;
- udrs->putend = udrs->buff;
- if (write (udrs->sd, udrs->buff, size) == -1)
- {
- perror ("ERROR, udr_sendnow(), write() call: ");
- udr_errno = UDIErrorIPCInternal;
- return -1; /* return error code */
- }
- return 0;
-}
-
-/******************************************************************** UDR_WORK
-* Function to send or recieve data from the buffers supporting
-* socket communication. The buffer contains serialised objects
-* sent/recieved over a socket connection.
-*/
-int
-udr_work (udrs, object_p, size)
- UDR *udrs;
- void *object_p;
- int size;
-{
- int cnt, remain;
-
- if (udrs->udr_op != udrs->previous_op)
- {
- if (udrs->previous_op == 0)
- {
- udr_errno = UDIErrorIPCInternal;
- return -1;
- }
- udrs->previous_op = udrs->udr_op;
- udrs->putbytes = udrs->buff;
- udrs->getbytes = udrs->buff;
- }
-
- if (udrs->udr_op == UDR_ENCODE)
- { /* write data into character stream buffer */
- if ((UDIUInt32) (udrs->putbytes) + size >
- (UDIUInt32) (udrs->buff) + (UDIUInt32) (udrs->bufsize))
- {
- udr_errno = UDIErrorIPCInternal;
- return -1;
- }
- bcopy ((char *) object_p, udrs->putbytes, size);
- udrs->putbytes += size;
- if (udrs->putbytes > udrs->putend)
- udrs->putend = udrs->putbytes;
- }
- else if (udrs->udr_op == UDR_DECODE)
- {
- if ((UDIUInt32) (udrs->putbytes) - (UDIUInt32) (udrs->getbytes) < size)
- { /* need more data in character stream buffer */
- remain = (UDIUInt32) (udrs->bufsize) -
- ((UDIUInt32) (udrs->putbytes) - (UDIUInt32) (udrs->buff));
- if (((UDIUInt32) (udrs->bufsize) + (UDIUInt32) (udrs->buff)
- - (UDIUInt32) (udrs->getbytes)) < size)
- {
- udr_errno = UDIErrorIPCInternal;
- return -1;
- }
- cnt = read (udrs->sd, (char *) udrs->putbytes, remain);
- if (cnt == -1)
- perror ("ERROR udr_work(), read() failure: ");
- udrs->putbytes += cnt;
- if ((UDIUInt32) (udrs->putbytes) - (UDIUInt32) (udrs->getbytes) < size)
- {
- udr_errno = UDIErrorIPCInternal;
- return -1; /* return error code */
- }
- } /* read data from character stream buffer */
- bcopy (udrs->getbytes, (char *) object_p, size);
- udrs->getbytes += size;
- }
- else
- {
- udr_errno = UDIErrorIPCInternal;
- return -1;
- }
- return 0;
-}
-
-/************************************************************* UDR_UDIResource
-*/
-int
-udr_UDIResource (udrs, object_p)
- UDR *udrs;
- UDIResource *object_p;
-{
- int retval;
-
- retval = udr_CPUSpace (udrs, &object_p->Space);
- retval = retval | udr_CPUOffset (udrs, &object_p->Offset);
- return retval;
-}
-
-/**************************************************************** UDR_UDIRange
-*/
-int
-udr_UDIRange (udrs, object_p)
- UDR *udrs;
- UDIRange *object_p;
-{
- int retval;
-
- retval = udr_CPUOffset (udrs, &object_p->Low);
- retval = retval | udr_CPUOffset (udrs, &object_p->High);
- return retval;
-}
-
-/********************************************************** UDR_UDIMemoryRange
-*/
-int
-udr_UDIMemoryRange (udrs, object_p)
- UDR *udrs;
- UDIMemoryRange *object_p;
-{
- int retval;
-
- retval = udr_CPUSpace (udrs, &object_p->Space);
- retval = retval | udr_CPUOffset (udrs, &object_p->Offset);
- retval = retval | udr_CPUSizeT (udrs, &object_p->Size);
- return retval;
-}
-
-/****************************************************************** UDR_string
-*/
-int
-udr_string (udrs, sp)
- UDR *udrs;
- char *sp;
-{
- int len, retval;
-
- if (udrs->udr_op == UDR_ENCODE)
- {
- if (sp)
- {
- len = strlen (sp) + 1;
- retval = udr_UDIInt32 (udrs, &len);
- retval = retval | udr_work (udrs, sp, len);
- }
- else
- /* deal with NULL pointer */
- {
- len = 0;
- retval = udr_UDIInt32 (udrs, &len);
- }
- }
- else if (udrs->udr_op == UDR_DECODE)
- {
- retval = udr_UDIInt32 (udrs, &len);
- if (len)
- retval = retval | udr_work (udrs, sp, len);
- else
- *sp = '\0'; /* terminate string */
- }
- else
- {
- udr_errno = UDIErrorIPCInternal;
- return -1;
- }
- return retval;
-}
-
-/******************************************************************* UDR_BYTES
-*/
-int
-udr_bytes (udrs, ptr, len)
- UDR *udrs;
- char *ptr;
- int len;
-{
- return udr_work (udrs, ptr, len);
-}
-
-/********************************************************************* UDR_INT
-*/
-int
-udr_int (udrs, int_p)
- UDR *udrs;
- int *int_p;
-{
- int ret_val;
- UDIInt32 udr_obj; /* object of know size */
-
- if (udrs->udr_op == UDR_ENCODE)
- {
- udr_obj = *int_p; /* copy into know object size */
- return udr_UDIInt32 (udrs, &udr_obj);
- }
- else if (udrs->udr_op == UDR_DECODE)
- {
- ret_val = udr_UDIInt32 (udrs, &udr_obj); /* get object of known size */
- *int_p = udr_obj;
- return ret_val;
- }
- else
- {
- udr_errno = UDIErrorIPCInternal;
- return -1;
- }
-}
-
-/****************************************************************** UDR_INLINE
-*/
-char *
-udr_inline (udrs, size)
- UDR *udrs;
- int size;
-{
- if (udrs->udr_op != udrs->previous_op)
- {
- if (udrs->previous_op == 0)
- {
- udr_errno = UDIErrorIPCInternal;
- return 0;
- }
- udrs->previous_op = udrs->udr_op;
- udrs->putbytes = udrs->buff;
- udrs->getbytes = udrs->buff;
- }
- if (udrs->udr_op == UDR_ENCODE)
- {
- if (udrs->putbytes + size > udrs->bufsize + udrs->buff)
- return 0;
- udrs->putbytes += size;
- return udrs->putbytes - size;
- }
- else if (udrs->udr_op == UDR_DECODE)
- {
- if (udrs->getbytes + size > udrs->bufsize + udrs->buff)
- return 0;
- udrs->getbytes += size;
- return udrs->getbytes - size;
- }
- else
- {
- udr_errno = UDIErrorIPCInternal;
- return 0;
- }
-}
-
-/****************************************************************** UDR_GETPOS
-*/
-char *
-udr_getpos (udrs)
- UDR *udrs;
-{
- if (udrs->udr_op == UDR_ENCODE)
- {
- return udrs->putbytes;
- }
- else if (udrs->udr_op == UDR_DECODE)
- {
- return udrs->getbytes;
- }
- else
- {
- udr_errno = UDIErrorIPCInternal;
- return 0;
- }
-}
-
-/****************************************************************** UDR_SETPOS
-*/
-int
-udr_setpos (udrs, pos)
- UDR *udrs;
- char *pos;
-{
- if (((UDIUInt32) pos > (UDIUInt32) (udrs->buff) + (UDIUInt32) (udrs->bufsize))
- || ((UDIUInt32) pos < (UDIUInt32) (udrs->buff)))
- {
- udr_errno = UDIErrorIPCInternal;
- return 0;
- }
- if (udrs->udr_op == UDR_ENCODE)
- {
- udrs->putbytes = pos;
- return 1;
- }
- else if (udrs->udr_op == UDR_DECODE)
- {
- udrs->getbytes = pos;
- return 1;
- }
- else
- {
- udr_errno = UDIErrorIPCInternal;
- return 0;
- }
-}
-
-/***************************************************************** UDR_READNOW
-* Try and ensure "size" bytes are available in the
-* receive buffer character stream.
-*/
-int
-udr_readnow (udrs, size)
- UDR *udrs;
- int size;
-{
- int cnt, remain;
-
- if (udrs->udr_op == UDR_ENCODE)
- {
- udr_errno = UDIErrorIPCInternal;
- return -1;
- }
- else if (udrs->udr_op == UDR_DECODE)
- {
- if ((UDIUInt32) (udrs->putbytes) - (UDIUInt32) (udrs->getbytes) < size)
- { /* need more data in character stream buffer */
- remain = (UDIUInt32) (udrs->bufsize) -
- ((UDIUInt32) (udrs->putbytes) - (UDIUInt32) (udrs->buff));
- cnt = read (udrs->sd, (char *) udrs->putbytes, remain);
- if (cnt == -1)
- perror ("ERROR udr_work(), read() failure: ");
- udrs->putbytes += cnt;
- if ((UDIUInt32) (udrs->putbytes) - (UDIUInt32) (udrs->getbytes) < size)
- {
- fprintf (stderr, "ERROR, udr_readnow() too few bytes in stream\n");
- return -1; /* return error code */
- }
- }
- }
- else
- {
- udr_errno = UDIErrorIPCInternal;
- return -1;
- }
- return 0;
-}
-
-/******************************************************************* UDR_ALIGN
-*/
-int
-udr_align (udrs, size)
- UDR *udrs;
- int size;
-{
- char *align;
- int offset;
-
- align = udr_getpos (udrs);
- offset = size - ((int) align & (size - 1));
- offset = offset & (size - 1);
- if (offset)
- udr_setpos (udrs, align + offset);
-}