aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStu Grossman <grossman@cygnus>1992-04-22 20:40:53 +0000
committerStu Grossman <grossman@cygnus>1992-04-22 20:40:53 +0000
commitd7df9c3ca4c75f979fd21c46a8fa018701d7adc7 (patch)
tree8b9bf895ce1ca746b74f212544b1c2b6f4e459fc
parentee0c4cf7d1dbda957222ab27b037ef0be2b74ce2 (diff)
downloadgdb-d7df9c3ca4c75f979fd21c46a8fa018701d7adc7.zip
gdb-d7df9c3ca4c75f979fd21c46a8fa018701d7adc7.tar.gz
gdb-d7df9c3ca4c75f979fd21c46a8fa018701d7adc7.tar.bz2
Add lotsa files for 29k UDI debugger interface support.
-rw-r--r--gdb/29k-share/.Sanitize35
-rw-r--r--gdb/29k-share/udi/.Sanitize41
-rw-r--r--gdb/29k-share/udi/udip2soc.c1189
-rw-r--r--gdb/29k-share/udi/udiphcfg.h11
-rw-r--r--gdb/29k-share/udi/udiphsun.h86
-rw-r--r--gdb/29k-share/udi/udiproc.h320
-rw-r--r--gdb/29k-share/udi/udipt29k.h93
-rw-r--r--gdb/29k-share/udi/udiptcfg.h1
-rw-r--r--gdb/29k-share/udi/udisoc.h193
-rw-r--r--gdb/29k-share/udi/udr.c425
-rw-r--r--gdb/29k-share/udi_soc9
11 files changed, 2403 insertions, 0 deletions
diff --git a/gdb/29k-share/.Sanitize b/gdb/29k-share/.Sanitize
new file mode 100644
index 0000000..5ac8d03
--- /dev/null
+++ b/gdb/29k-share/.Sanitize
@@ -0,0 +1,35 @@
+# .Sanitize for devo/gdb.
+# $Id$
+#
+
+# Each directory to survive it's way into a release will need a file
+# like this one called "./.Sanitize". All keyword lines must exist,
+# and must exist in the order specified by this file. Each directory
+# in the tree will be processed, top down, in the following order.
+
+# Hash started lines like this one are comments and will be deleted
+# before anything else is done. Blank lines will also be squashed
+# out.
+
+# The lines between the "Do-first:" line and the "Things-to-keep:"
+# line are executed as a /bin/sh shell script before anything else is
+# done in this
+
+Do-first:
+
+# All files listed between the "Things-to-keep:" line and the
+# "Files-to-sed:" line will be kept. All other files will be removed.
+# Directories listed in this section will have their own Sanitize
+# called. Directories not listed will be removed in their entirety
+# with rm -rf.
+
+Things-to-keep:
+
+dfe
+include
+udi
+udi_soc
+
+Do-last:
+
+# End of file.
diff --git a/gdb/29k-share/udi/.Sanitize b/gdb/29k-share/udi/.Sanitize
new file mode 100644
index 0000000..bd7b85f
--- /dev/null
+++ b/gdb/29k-share/udi/.Sanitize
@@ -0,0 +1,41 @@
+# .Sanitize for devo/gdb.
+# $Id$
+#
+
+# Each directory to survive it's way into a release will need a file
+# like this one called "./.Sanitize". All keyword lines must exist,
+# and must exist in the order specified by this file. Each directory
+# in the tree will be processed, top down, in the following order.
+
+# Hash started lines like this one are comments and will be deleted
+# before anything else is done. Blank lines will also be squashed
+# out.
+
+# The lines between the "Do-first:" line and the "Things-to-keep:"
+# line are executed as a /bin/sh shell script before anything else is
+# done in this
+
+Do-first:
+
+# All files listed between the "Things-to-keep:" line and the
+# "Files-to-sed:" line will be kept. All other files will be removed.
+# Directories listed in this section will have their own Sanitize
+# called. Directories not listed will be removed in their entirety
+# with rm -rf.
+
+Things-to-keep:
+
+soc2udip.c
+udi2mtip.c
+udip2soc.c
+udiphcfg.h
+udiphsun.h
+udiproc.h
+udipt29k.h
+udiptcfg.h
+udisoc.h
+udr.c
+
+Do-last:
+
+# End of file.
diff --git a/gdb/29k-share/udi/udip2soc.c b/gdb/29k-share/udi/udip2soc.c
new file mode 100644
index 0000000..a9c9991
--- /dev/null
+++ b/gdb/29k-share/udi/udip2soc.c
@@ -0,0 +1,1189 @@
+/*
+* 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.11 Daniel Mann";
+static char udip2soc_c_AMD[]="@(#)udip2soc.c 2.8, 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,
+ &params_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,
+ &params_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/U%d", 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;
+ union wait statusp;
+ 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);
+ }
+ if(wait4(pid, &statusp, WNOHANG, NULL))
+ {
+ 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);
+}
diff --git a/gdb/29k-share/udi/udiphcfg.h b/gdb/29k-share/udi/udiphcfg.h
new file mode 100644
index 0000000..508e041
--- /dev/null
+++ b/gdb/29k-share/udi/udiphcfg.h
@@ -0,0 +1,11 @@
+/* This file just picks the correct udiphxxx.h depending on the host */
+/* The two hosts that are now defined are SUN and MSDOS */
+
+#ifdef sun
+#include "udiphsun.h"
+#endif
+
+#ifdef MSDOS
+#include "udiphdos.h"
+#endif
+
diff --git a/gdb/29k-share/udi/udiphsun.h b/gdb/29k-share/udi/udiphsun.h
new file mode 100644
index 0000000..4c9e58f
--- /dev/null
+++ b/gdb/29k-share/udi/udiphsun.h
@@ -0,0 +1,86 @@
+/******************************************************************************
+ * 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
diff --git a/gdb/29k-share/udi/udiproc.h b/gdb/29k-share/udi/udiproc.h
new file mode 100644
index 0000000..d78e5fb
--- /dev/null
+++ b/gdb/29k-share/udi/udiproc.h
@@ -0,0 +1,320 @@
+/******************************************************************************
+ * 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.11, 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 */
+ ));
diff --git a/gdb/29k-share/udi/udipt29k.h b/gdb/29k-share/udi/udipt29k.h
new file mode 100644
index 0000000..5076a97
--- /dev/null
+++ b/gdb/29k-share/udi/udipt29k.h
@@ -0,0 +1,93 @@
+/******************************************************************************
+ * 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;
diff --git a/gdb/29k-share/udi/udiptcfg.h b/gdb/29k-share/udi/udiptcfg.h
new file mode 100644
index 0000000..a81bd9b
--- /dev/null
+++ b/gdb/29k-share/udi/udiptcfg.h
@@ -0,0 +1 @@
+#include "udipt29k.h"
diff --git a/gdb/29k-share/udi/udisoc.h b/gdb/29k-share/udi/udisoc.h
new file mode 100644
index 0000000..4a55b3c
--- /dev/null
+++ b/gdb/29k-share/udi/udisoc.h
@@ -0,0 +1,193 @@
+/******************************************************************************
+* 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,
+ ));
diff --git a/gdb/29k-share/udi/udr.c b/gdb/29k-share/udi/udr.c
new file mode 100644
index 0000000..b5fbe8c
--- /dev/null
+++ b/gdb/29k-share/udi/udr.c
@@ -0,0 +1,425 @@
+/******************************************************************************
+* 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);
+}
diff --git a/gdb/29k-share/udi_soc b/gdb/29k-share/udi_soc
new file mode 100644
index 0000000..343317f
--- /dev/null
+++ b/gdb/29k-share/udi_soc
@@ -0,0 +1,9 @@
+# @(#)udi_soc 2.1 Daniel Mann
+# NOTE: the Session string must not start whith white-space characters.
+# Format of string is:
+# <session> <domain> <soc_name|host_name> <tip_exe> <pass to UDIconnect>
+soc2cayman AF_INET cayman /bin/udi_tip ...
+soc2tip AF_UNIX astring tip.exe ...
+cuba AF_UNIX soc_name ../bin.68020/udi_tip stuff to pass
+cayman AF_INET cayman this_entry_not_matter stuff to pass
+iss AF_UNIX * sun4/isstip -r osboot