OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [sim/] [arm/] [parent.c] - Diff between revs 24 and 157

Only display areas with differences | Details | Blame | View Log

Rev 24 Rev 157
/*  parent.c -- ARMulator RDP comms code:  ARM6 Instruction Emulator.
/*  parent.c -- ARMulator RDP comms code:  ARM6 Instruction Emulator.
    Copyright (C) 1994 Advanced RISC Machines Ltd.
    Copyright (C) 1994 Advanced RISC Machines Ltd.
 
 
    This program is free software; you can redistribute it and/or modify
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.
    (at your option) any later version.
 
 
    This program is distributed in the hope that it will be useful,
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    GNU General Public License for more details.
 
 
    You should have received a copy of the GNU General Public License
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
 
 
/*****************************************************************/
/*****************************************************************/
/* The Parent process continues here...                          */
/* The Parent process continues here...                          */
/* It waits on the socket and passes on RDP messages down a pipe */
/* It waits on the socket and passes on RDP messages down a pipe */
/* to the ARMulator RDP to RDI interpreter.                      */
/* to the ARMulator RDP to RDI interpreter.                      */
/*****************************************************************/
/*****************************************************************/
 
 
#include <stdio.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/types.h>
#include <signal.h>
#include <signal.h>
#include "time.h"
#include "time.h"
#include "armdefs.h"
#include "armdefs.h"
#include "dbg_rdi.h"
#include "dbg_rdi.h"
#include "communicate.h"
#include "communicate.h"
 
 
/* The socket to the debugger */
/* The socket to the debugger */
extern int debugsock;
extern int debugsock;
 
 
/* The pipes between the two processes */
/* The pipes between the two processes */
extern int mumkid[2];
extern int mumkid[2];
extern int kidmum[2];
extern int kidmum[2];
 
 
/* A pipe for handling SWI return values that goes straight from the */
/* A pipe for handling SWI return values that goes straight from the */
/* parent to the ARMulator host interface, bypassing the child's RDP */
/* parent to the ARMulator host interface, bypassing the child's RDP */
/* to RDI interpreter */
/* to RDI interpreter */
extern int DebuggerARMul[2];
extern int DebuggerARMul[2];
 
 
/* The maximum number of file descriptors */
/* The maximum number of file descriptors */
extern int nfds;
extern int nfds;
 
 
/* The child process id. */
/* The child process id. */
extern pid_t child;
extern pid_t child;
 
 
void
void
parent ()
parent ()
{
{
  int i, j, k;
  int i, j, k;
  unsigned char message, CPnum, exreturn;
  unsigned char message, CPnum, exreturn;
  ARMword mask, nbytes, messagetype;
  ARMword mask, nbytes, messagetype;
  unsigned char c, d;
  unsigned char c, d;
  ARMword x, y;
  ARMword x, y;
  int virgin = 1;
  int virgin = 1;
  struct fd_set readfds;
  struct fd_set readfds;
 
 
#ifdef DEBUG
#ifdef DEBUG
  fprintf (stderr, "parent ()...\n");
  fprintf (stderr, "parent ()...\n");
#endif
#endif
 
 
panic_error:
panic_error:
 
 
  if (!virgin)
  if (!virgin)
    {
    {
#ifdef DEBUG
#ifdef DEBUG
      fprintf (stderr, "Arghh! What is going on?\n");
      fprintf (stderr, "Arghh! What is going on?\n");
#endif
#endif
      kill (child, SIGHUP);
      kill (child, SIGHUP);
      MYwrite_char (debugsock, RDP_Reset);
      MYwrite_char (debugsock, RDP_Reset);
    }
    }
 
 
  virgin = 0;
  virgin = 0;
 
 
  while (1)
  while (1)
    {
    {
 
 
      /* Wait either for the ARMulator or the debugger */
      /* Wait either for the ARMulator or the debugger */
 
 
      FD_ZERO (&readfds);
      FD_ZERO (&readfds);
      FD_SET (kidmum[0], &readfds);      /* Wait for messages from ARMulator */
      FD_SET (kidmum[0], &readfds);      /* Wait for messages from ARMulator */
      FD_SET (debugsock, &readfds);     /* Wait for messages from debugger */
      FD_SET (debugsock, &readfds);     /* Wait for messages from debugger */
 
 
#ifdef DEBUG
#ifdef DEBUG
      fprintf (stderr, "Waiting for ARMulator or debugger... ");
      fprintf (stderr, "Waiting for ARMulator or debugger... ");
#endif
#endif
 
 
      while ((i = select (nfds, &readfds, (fd_set *) 0, (fd_set *) 0, 0)) < 0)
      while ((i = select (nfds, &readfds, (fd_set *) 0, (fd_set *) 0, 0)) < 0)
        {
        {
          perror ("select");
          perror ("select");
        }
        }
 
 
#ifdef DEBUG
#ifdef DEBUG
      fprintf (stderr, "(%d/2)", i);
      fprintf (stderr, "(%d/2)", i);
#endif
#endif
 
 
      if (FD_ISSET (debugsock, &readfds))
      if (FD_ISSET (debugsock, &readfds))
        {
        {
#ifdef DEBUG
#ifdef DEBUG
          fprintf (stderr, "->debugger\n");
          fprintf (stderr, "->debugger\n");
#endif
#endif
 
 
          /* Inside this rather large if statement with simply pass on a complete
          /* Inside this rather large if statement with simply pass on a complete
             message to the ARMulator.  The reason we need to pass messages on one
             message to the ARMulator.  The reason we need to pass messages on one
             at a time is that we have to know whether the message is an OSOpReply
             at a time is that we have to know whether the message is an OSOpReply
             or an info(stop), so that we can take different action in those
             or an info(stop), so that we can take different action in those
             cases. */
             cases. */
 
 
          if (MYread_char (debugsock, &message))
          if (MYread_char (debugsock, &message))
            goto panic_error;
            goto panic_error;
 
 
          switch (message)
          switch (message)
            {
            {
            case RDP_Start:
            case RDP_Start:
              /* Open and/or Initialise */
              /* Open and/or Initialise */
#ifdef DEBUG
#ifdef DEBUG
              fprintf (stderr, "RDP Open\n");
              fprintf (stderr, "RDP Open\n");
#endif
#endif
              if (MYread_char (debugsock, &c))  /* type */
              if (MYread_char (debugsock, &c))  /* type */
                goto panic_error;
                goto panic_error;
 
 
              if (MYread_word (debugsock, &x))  /* memory size */
              if (MYread_word (debugsock, &x))  /* memory size */
                goto panic_error;
                goto panic_error;
 
 
              MYwrite_char (mumkid[1], message);
              MYwrite_char (mumkid[1], message);
              MYwrite_char (mumkid[1], c);
              MYwrite_char (mumkid[1], c);
              MYwrite_word (mumkid[1], x);
              MYwrite_word (mumkid[1], x);
              if (c & 0x2)
              if (c & 0x2)
                {
                {
                  passon (debugsock, mumkid[1], 1);     /* speed */
                  passon (debugsock, mumkid[1], 1);     /* speed */
                }
                }
              break;
              break;
 
 
            case RDP_End:
            case RDP_End:
              /* Close and Finalise */
              /* Close and Finalise */
#ifdef DEBUG
#ifdef DEBUG
              fprintf (stderr, "RDP Close\n");
              fprintf (stderr, "RDP Close\n");
#endif
#endif
              MYwrite_char (mumkid[1], message);
              MYwrite_char (mumkid[1], message);
              break;
              break;
 
 
            case RDP_Read:
            case RDP_Read:
              /* Read Memory Address */
              /* Read Memory Address */
#ifdef DEBUG
#ifdef DEBUG
              fprintf (stderr, "RDP Read Memory\n");
              fprintf (stderr, "RDP Read Memory\n");
#endif
#endif
              MYwrite_char (mumkid[1], message);
              MYwrite_char (mumkid[1], message);
              if (passon (debugsock, mumkid[1], 4))
              if (passon (debugsock, mumkid[1], 4))
                goto panic_error;       /* address */
                goto panic_error;       /* address */
              if (MYread_word (debugsock, &nbytes))
              if (MYread_word (debugsock, &nbytes))
                goto panic_error;       /* nbytes */
                goto panic_error;       /* nbytes */
              MYwrite_word (mumkid[1], nbytes);
              MYwrite_word (mumkid[1], nbytes);
              break;
              break;
 
 
            case RDP_Write:
            case RDP_Write:
              /* Write Memory Address */
              /* Write Memory Address */
#ifdef DEBUG
#ifdef DEBUG
              fprintf (stderr, "RDP Write Memory\n");
              fprintf (stderr, "RDP Write Memory\n");
#endif
#endif
              if (MYread_word (debugsock, &x))
              if (MYread_word (debugsock, &x))
                goto panic_error;       /* address */
                goto panic_error;       /* address */
 
 
              if (MYread_word (debugsock, &y))
              if (MYread_word (debugsock, &y))
                goto panic_error;       /* nbytes */
                goto panic_error;       /* nbytes */
 
 
              MYwrite_char (mumkid[1], message);
              MYwrite_char (mumkid[1], message);
              MYwrite_word (mumkid[1], x);
              MYwrite_word (mumkid[1], x);
              MYwrite_word (mumkid[1], y);
              MYwrite_word (mumkid[1], y);
              passon (debugsock, mumkid[1], y); /* actual data */
              passon (debugsock, mumkid[1], y); /* actual data */
              break;
              break;
 
 
            case RDP_CPUread:
            case RDP_CPUread:
              /* Read CPU State */
              /* Read CPU State */
#ifdef DEBUG
#ifdef DEBUG
              fprintf (stderr, "RDP Read CPU\n");
              fprintf (stderr, "RDP Read CPU\n");
#endif
#endif
              if (MYread_char (debugsock, &c))
              if (MYread_char (debugsock, &c))
                goto panic_error;       /* mode */
                goto panic_error;       /* mode */
 
 
              if (MYread_word (debugsock, &mask))
              if (MYread_word (debugsock, &mask))
                goto panic_error;       /* mask */
                goto panic_error;       /* mask */
 
 
              MYwrite_char (mumkid[1], message);
              MYwrite_char (mumkid[1], message);
              MYwrite_char (mumkid[1], c);
              MYwrite_char (mumkid[1], c);
              MYwrite_word (mumkid[1], mask);
              MYwrite_word (mumkid[1], mask);
              break;
              break;
 
 
            case RDP_CPUwrite:
            case RDP_CPUwrite:
              /* Write CPU State */
              /* Write CPU State */
#ifdef DEBUG
#ifdef DEBUG
              fprintf (stderr, "RDP Write CPU\n");
              fprintf (stderr, "RDP Write CPU\n");
#endif
#endif
              if (MYread_char (debugsock, &c))
              if (MYread_char (debugsock, &c))
                goto panic_error;       /* mode */
                goto panic_error;       /* mode */
 
 
              if (MYread_word (debugsock, &x))
              if (MYread_word (debugsock, &x))
                goto panic_error;       /* mask */
                goto panic_error;       /* mask */
 
 
              MYwrite_char (mumkid[1], message);
              MYwrite_char (mumkid[1], message);
              MYwrite_char (mumkid[1], c);
              MYwrite_char (mumkid[1], c);
              MYwrite_word (mumkid[1], x);
              MYwrite_word (mumkid[1], x);
              for (k = 1, j = 0; k != 0x80000000; k *= 2, j++)
              for (k = 1, j = 0; k != 0x80000000; k *= 2, j++)
                if ((k & x) && passon (debugsock, mumkid[1], 4))
                if ((k & x) && passon (debugsock, mumkid[1], 4))
                  goto panic_error;
                  goto panic_error;
              break;
              break;
 
 
            case RDP_CPread:
            case RDP_CPread:
              /* Read Co-Processor State */
              /* Read Co-Processor State */
#ifdef DEBUG
#ifdef DEBUG
              fprintf (stderr, "RDP Read CP state\n");
              fprintf (stderr, "RDP Read CP state\n");
#endif
#endif
              if (MYread_char (debugsock, &CPnum))
              if (MYread_char (debugsock, &CPnum))
                goto panic_error;
                goto panic_error;
 
 
              if (MYread_word (debugsock, &mask))
              if (MYread_word (debugsock, &mask))
                goto panic_error;
                goto panic_error;
 
 
              MYwrite_char (mumkid[1], message);
              MYwrite_char (mumkid[1], message);
              MYwrite_char (mumkid[1], CPnum);
              MYwrite_char (mumkid[1], CPnum);
              MYwrite_word (mumkid[1], mask);
              MYwrite_word (mumkid[1], mask);
              break;
              break;
 
 
            case RDP_CPwrite:
            case RDP_CPwrite:
              /* Write Co-Processor State */
              /* Write Co-Processor State */
#ifdef DEBUG
#ifdef DEBUG
              fprintf (stderr, "RDP Write CP state\n");
              fprintf (stderr, "RDP Write CP state\n");
#endif
#endif
              if (MYread_char (debugsock, &CPnum))
              if (MYread_char (debugsock, &CPnum))
                goto panic_error;
                goto panic_error;
 
 
              if (MYread_word (debugsock, &mask))
              if (MYread_word (debugsock, &mask))
                goto panic_error;
                goto panic_error;
 
 
              MYwrite_char (mumkid[1], message);
              MYwrite_char (mumkid[1], message);
              MYwrite_char (mumkid[1], c);
              MYwrite_char (mumkid[1], c);
              MYwrite_char (mumkid[1], x);
              MYwrite_char (mumkid[1], x);
              for (k = 1, j = 0; k != 0x80000000; k *= 2, j++)
              for (k = 1, j = 0; k != 0x80000000; k *= 2, j++)
                if (k & x)
                if (k & x)
                  {
                  {
                    if ((c == 1 || c == 2) && k <= 128)
                    if ((c == 1 || c == 2) && k <= 128)
                      {
                      {
                        /* FP register = 12 bytes + 4 bytes format */
                        /* FP register = 12 bytes + 4 bytes format */
                        if (passon (debugsock, mumkid[1], 16))
                        if (passon (debugsock, mumkid[1], 16))
                          goto panic_error;
                          goto panic_error;
                      }
                      }
                    else
                    else
                      {
                      {
                        /* Normal register = 4 bytes */
                        /* Normal register = 4 bytes */
                        if (passon (debugsock, mumkid[1], 4))
                        if (passon (debugsock, mumkid[1], 4))
                          goto panic_error;
                          goto panic_error;
                      }
                      }
                  }
                  }
              break;
              break;
 
 
            case RDP_SetBreak:
            case RDP_SetBreak:
              /* Set Breakpoint */
              /* Set Breakpoint */
#ifdef DEBUG
#ifdef DEBUG
              fprintf (stderr, "RDP Set Breakpoint\n");
              fprintf (stderr, "RDP Set Breakpoint\n");
#endif
#endif
              if (MYread_word (debugsock, &x))
              if (MYread_word (debugsock, &x))
                goto panic_error;       /* address */
                goto panic_error;       /* address */
 
 
              if (MYread_char (debugsock, &c))
              if (MYread_char (debugsock, &c))
                goto panic_error;       /* type */
                goto panic_error;       /* type */
 
 
              MYwrite_char (mumkid[1], message);
              MYwrite_char (mumkid[1], message);
              MYwrite_word (mumkid[1], x);
              MYwrite_word (mumkid[1], x);
              MYwrite_char (mumkid[1], c);
              MYwrite_char (mumkid[1], c);
              if (((c & 0xf) >= 5) && passon (debugsock, mumkid[1], 4))
              if (((c & 0xf) >= 5) && passon (debugsock, mumkid[1], 4))
                goto panic_error;       /* bound */
                goto panic_error;       /* bound */
              break;
              break;
 
 
            case RDP_ClearBreak:
            case RDP_ClearBreak:
              /* Clear Breakpoint */
              /* Clear Breakpoint */
#ifdef DEBUG
#ifdef DEBUG
              fprintf (stderr, "RDP Clear Breakpoint\n");
              fprintf (stderr, "RDP Clear Breakpoint\n");
#endif
#endif
              MYwrite_char (mumkid[1], message);
              MYwrite_char (mumkid[1], message);
              if (passon (debugsock, mumkid[1], 4))
              if (passon (debugsock, mumkid[1], 4))
                goto panic_error;       /* point */
                goto panic_error;       /* point */
              break;
              break;
 
 
            case RDP_SetWatch:
            case RDP_SetWatch:
              /* Set Watchpoint */
              /* Set Watchpoint */
#ifdef DEBUG
#ifdef DEBUG
              fprintf (stderr, "RDP Set Watchpoint\n");
              fprintf (stderr, "RDP Set Watchpoint\n");
#endif
#endif
              if (MYread_word (debugsock, &x))
              if (MYread_word (debugsock, &x))
                goto panic_error;       /* address */
                goto panic_error;       /* address */
 
 
              if (MYread_char (debugsock, &c))
              if (MYread_char (debugsock, &c))
                goto panic_error;       /* type */
                goto panic_error;       /* type */
 
 
              if (MYread_char (debugsock, &d))
              if (MYread_char (debugsock, &d))
                goto panic_error;       /* datatype */
                goto panic_error;       /* datatype */
 
 
              MYwrite_char (mumkid[1], message);
              MYwrite_char (mumkid[1], message);
              MYwrite_word (mumkid[1], x);
              MYwrite_word (mumkid[1], x);
              MYwrite_char (mumkid[1], c);
              MYwrite_char (mumkid[1], c);
              MYwrite_char (mumkid[1], d);
              MYwrite_char (mumkid[1], d);
              if (((c & 0xf) >= 5) && passon (debugsock, mumkid[1], 4))
              if (((c & 0xf) >= 5) && passon (debugsock, mumkid[1], 4))
                goto panic_error;       /* bound */
                goto panic_error;       /* bound */
              break;
              break;
 
 
            case RDP_ClearWatch:
            case RDP_ClearWatch:
              /* Clear Watchpoint */
              /* Clear Watchpoint */
#ifdef DEBUG
#ifdef DEBUG
              fprintf (stderr, "RDP Clear Watchpoint\n");
              fprintf (stderr, "RDP Clear Watchpoint\n");
#endif
#endif
              MYwrite_char (mumkid[1], message);
              MYwrite_char (mumkid[1], message);
              if (passon (debugsock, mumkid[1], 4))
              if (passon (debugsock, mumkid[1], 4))
                goto panic_error;       /* point */
                goto panic_error;       /* point */
              break;
              break;
 
 
            case RDP_Execute:
            case RDP_Execute:
              /* Excecute */
              /* Excecute */
#ifdef DEBUG
#ifdef DEBUG
              fprintf (stderr, "RDP Execute\n");
              fprintf (stderr, "RDP Execute\n");
#endif
#endif
 
 
              /* LEAVE THIS ONE 'TIL LATER... */
              /* LEAVE THIS ONE 'TIL LATER... */
              /* NEED TO WORK THINGS OUT */
              /* NEED TO WORK THINGS OUT */
 
 
              /* NO ASCYNCHROUS RUNNING */
              /* NO ASCYNCHROUS RUNNING */
 
 
              if (MYread_char (debugsock, &c))
              if (MYread_char (debugsock, &c))
                goto panic_error;       /* return */
                goto panic_error;       /* return */
 
 
              /* Remember incase bit 7 is set and we have to send back a word */
              /* Remember incase bit 7 is set and we have to send back a word */
              exreturn = c;
              exreturn = c;
 
 
              MYwrite_char (mumkid[1], message);
              MYwrite_char (mumkid[1], message);
              MYwrite_char (mumkid[1], c);
              MYwrite_char (mumkid[1], c);
              break;
              break;
 
 
            case RDP_Step:
            case RDP_Step:
              /* Step */
              /* Step */
#ifdef DEBUG
#ifdef DEBUG
              fprintf (stderr, "RDP Step\n");
              fprintf (stderr, "RDP Step\n");
#endif
#endif
 
 
              if (MYread_char (debugsock, &c))
              if (MYread_char (debugsock, &c))
                goto panic_error;       /* return */
                goto panic_error;       /* return */
 
 
              if (MYread_word (debugsock, &x))
              if (MYread_word (debugsock, &x))
                goto panic_error;       /* ninstr */
                goto panic_error;       /* ninstr */
 
 
              MYwrite_char (mumkid[1], message);
              MYwrite_char (mumkid[1], message);
              MYwrite_char (mumkid[1], c);
              MYwrite_char (mumkid[1], c);
              MYwrite_word (mumkid[1], x);
              MYwrite_word (mumkid[1], x);
              break;
              break;
 
 
            case RDP_Info:
            case RDP_Info:
              /* Info */
              /* Info */
#ifdef DEBUG
#ifdef DEBUG
              fprintf (stderr, "RDP Info\n");
              fprintf (stderr, "RDP Info\n");
#endif
#endif
              /* INFO TARGET, SET RDI LEVEL */
              /* INFO TARGET, SET RDI LEVEL */
              if (MYread_word (debugsock, &messagetype))
              if (MYread_word (debugsock, &messagetype))
                goto panic_error;       /* info */
                goto panic_error;       /* info */
 
 
              switch (messagetype)
              switch (messagetype)
                {
                {
                case RDIInfo_Target:
                case RDIInfo_Target:
                  MYwrite_char (mumkid[1], message);
                  MYwrite_char (mumkid[1], message);
                  MYwrite_word (mumkid[1], messagetype);
                  MYwrite_word (mumkid[1], messagetype);
                  break;
                  break;
 
 
                case RDISet_RDILevel:
                case RDISet_RDILevel:
                  MYwrite_char (mumkid[1], message);
                  MYwrite_char (mumkid[1], message);
                  MYwrite_word (mumkid[1], messagetype);
                  MYwrite_word (mumkid[1], messagetype);
                  if (passon (debugsock, mumkid[1], 1))
                  if (passon (debugsock, mumkid[1], 1))
                    goto panic_error;   /* argument */
                    goto panic_error;   /* argument */
                  break;
                  break;
 
 
                case RDISet_Cmdline:
                case RDISet_Cmdline:
                  /* Got to pass on a string argument */
                  /* Got to pass on a string argument */
                  MYwrite_char (mumkid[1], message);
                  MYwrite_char (mumkid[1], message);
                  MYwrite_word (mumkid[1], messagetype);
                  MYwrite_word (mumkid[1], messagetype);
                  do
                  do
                    {
                    {
                      if (MYread_char (debugsock, &c))
                      if (MYread_char (debugsock, &c))
                        goto panic_error;
                        goto panic_error;
 
 
                      MYwrite_char (mumkid[1], c);
                      MYwrite_char (mumkid[1], c);
                    }
                    }
                  while (c);
                  while (c);
                  break;
                  break;
 
 
                case RDISignal_Stop:
                case RDISignal_Stop:
                  kill (child, SIGUSR1);
                  kill (child, SIGUSR1);
                  MYwrite_char (debugsock, RDP_Return);
                  MYwrite_char (debugsock, RDP_Return);
                  MYwrite_char (debugsock, RDIError_UserInterrupt);
                  MYwrite_char (debugsock, RDIError_UserInterrupt);
                  break;
                  break;
 
 
                case RDIVector_Catch:
                case RDIVector_Catch:
                  MYread_word (debugsock, &x);
                  MYread_word (debugsock, &x);
                  MYwrite_char (mumkid[1], message);
                  MYwrite_char (mumkid[1], message);
                  MYwrite_word (mumkid[1], messagetype);
                  MYwrite_word (mumkid[1], messagetype);
                  MYwrite_word (mumkid[1], x);
                  MYwrite_word (mumkid[1], x);
                  break;
                  break;
 
 
                case RDIInfo_Step:
                case RDIInfo_Step:
                  MYwrite_char (mumkid[1], message);
                  MYwrite_char (mumkid[1], message);
                  MYwrite_word (mumkid[1], messagetype);
                  MYwrite_word (mumkid[1], messagetype);
                  break;
                  break;
 
 
                case RDIInfo_Points:
                case RDIInfo_Points:
                  MYwrite_char (mumkid[1], message);
                  MYwrite_char (mumkid[1], message);
                  MYwrite_word (mumkid[1], messagetype);
                  MYwrite_word (mumkid[1], messagetype);
                  break;
                  break;
 
 
                default:
                default:
                  fprintf (stderr, "Unrecognized RDIInfo request %d\n",
                  fprintf (stderr, "Unrecognized RDIInfo request %d\n",
                           messagetype);
                           messagetype);
                  goto panic_error;
                  goto panic_error;
                }
                }
              break;
              break;
 
 
            case RDP_OSOpReply:
            case RDP_OSOpReply:
              /* OS Operation Reply */
              /* OS Operation Reply */
#ifdef DEBUG
#ifdef DEBUG
              fprintf (stderr, "RDP OS Reply\n");
              fprintf (stderr, "RDP OS Reply\n");
#endif
#endif
              MYwrite_char (mumkid[1], message);
              MYwrite_char (mumkid[1], message);
              if (MYread_char (debugsock, &message))
              if (MYread_char (debugsock, &message))
                goto panic_error;
                goto panic_error;
              MYwrite_char (mumkid[1], message);
              MYwrite_char (mumkid[1], message);
              switch (message)
              switch (message)
                {
                {
                case 0:  /* return value i.e. nothing else. */
                case 0:  /* return value i.e. nothing else. */
                  break;
                  break;
 
 
                case 1: /* returns a byte... */
                case 1: /* returns a byte... */
                  if (MYread_char (debugsock, &c))
                  if (MYread_char (debugsock, &c))
                    goto panic_error;
                    goto panic_error;
 
 
                  MYwrite_char (mumkid[1], c);
                  MYwrite_char (mumkid[1], c);
                  break;
                  break;
 
 
                case 2: /* returns a word... */
                case 2: /* returns a word... */
                  if (MYread_word (debugsock, &x))
                  if (MYread_word (debugsock, &x))
                    goto panic_error;
                    goto panic_error;
 
 
                  MYwrite_word (mumkid[1], x);
                  MYwrite_word (mumkid[1], x);
                  break;
                  break;
                }
                }
              break;
              break;
 
 
            case RDP_Reset:
            case RDP_Reset:
              /* Reset */
              /* Reset */
#ifdef DEBUG
#ifdef DEBUG
              fprintf (stderr, "RDP Reset\n");
              fprintf (stderr, "RDP Reset\n");
#endif
#endif
              MYwrite_char (mumkid[1], message);
              MYwrite_char (mumkid[1], message);
              break;
              break;
 
 
            default:
            default:
              /* Hmm.. bad RDP operation */
              /* Hmm.. bad RDP operation */
              fprintf (stderr, "RDP Bad RDP request (%d)\n", message);
              fprintf (stderr, "RDP Bad RDP request (%d)\n", message);
              MYwrite_char (debugsock, RDP_Return);
              MYwrite_char (debugsock, RDP_Return);
              MYwrite_char (debugsock, RDIError_UnimplementedMessage);
              MYwrite_char (debugsock, RDIError_UnimplementedMessage);
              break;
              break;
            }
            }
        }
        }
 
 
      if (FD_ISSET (kidmum[0], &readfds))
      if (FD_ISSET (kidmum[0], &readfds))
        {
        {
#ifdef DEBUG
#ifdef DEBUG
          fprintf (stderr, "->ARMulator\n");
          fprintf (stderr, "->ARMulator\n");
#endif
#endif
          /* Anything we get from the ARMulator has to go to the debugger... */
          /* Anything we get from the ARMulator has to go to the debugger... */
          /* It is that simple! */
          /* It is that simple! */
 
 
          passon (kidmum[0], debugsock, 1);
          passon (kidmum[0], debugsock, 1);
        }
        }
    }
    }
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.