sim: arm: delete unused code

These vestiges of the 20 year old emulator are just getting in the way.
Punt all the dead code we either don't compile or don't use.
This commit is contained in:
Mike Frysinger 2015-11-15 19:45:36 -08:00
parent f0c1b768b4
commit 91d6df784d
23 changed files with 34 additions and 3651 deletions

View File

@ -1,3 +1,36 @@
2015-12-25 Mike Frysinger <vapier@gentoo.org>
* Makefile.in (SIM_OBJS): Delete bag.o.
* armdefs.h (struct ARMul_State): Delete ErrorCode.
(ResetPin, FIQPin, IRQPin, AbortPin, TransPin, BigEndPin, Prog32Pin,
Data32Pin, LateAbortPin, ARMul_OSExit, ARMul_OSLastErrorP,
ARMul_Debug, ARMul_OSException,rdi_log, SpinCursor, HOURGLASS,
HOURGLASS_RATE): Delete.
* armemu.c (ARMul_Emulate26): Delete ARMul_Debug call.
* arminit.c (ARMul_Reset): Do not set state->ErrorCode.
(ARMul_Abort): Delete ARMul_OSException call.
* armopts.h: Delete file.
* armos.c (isatty_, ARMul_OSExit, ARMul_OSException,
ARMul_OSLastErrorP, ARMul_Debug, BUFFERSIZE, UNIQUETEMPS, NOOP,
BINARY, READOP, WRITEOP, FIXCRLF): Delete.
(struct OSblock): Delete Time0, ErrorP, FileTable, FileFlags, and
tempnames.
(ARMul_OSInit): Do not set OSptr->ErrorP, OSptr->FileTable, or
OSptr->tempnames.
* armrdi.c: Delete file.
* armvirt.c: Delete armopts.h include.
(ARMul_LoadInstrS): Delete HOURGLASS logic.
* bag.c, bag.h, communicate.c, communicate.h, dbg_conf.h, dbg_cp.h,
dbg_hif.h: Delete files.
* dbg_rdi.h (RDP_*, RDI*): Delete defines.
(PointHandle, ThreadHandle, Dbg_ConfigBlock, Dbg_HostosInterface,
Dbg_MCState, getbufferproc): Delete.
(rdi_*): Delete Functions.
(RDI_ConfigAspect, RDI_ConfigMatchType, RDI_NameList): Delete
(struct RDIProcVec): Delete.
* gdbhost.c, gdbhost.h, kid.c, main.c, parent.c: Delete files.
* wrapper.c (ARMul_Debug): Delete.
2015-12-15 Dominik Vogt <vogt@linux.vnet.ibm.com>
* thumbemu.c (handle_T2_insn): Fix left shift of negative value.

View File

@ -25,7 +25,7 @@ SIM_OBJS = \
$(SIM_NEW_COMMON_OBJS) \
sim-hload.o \
armemu26.o armemu32.o arminit.o armos.o armsupp.o \
armvirt.o bag.o thumbemu.o \
armvirt.o thumbemu.o \
armcopro.o maverick.o iwmmxt.o
## COMMON_POST_CONFIG_FRAG

View File

@ -72,7 +72,6 @@ struct ARMul_State
{
ARMword Emulate; /* to start and stop emulation */
unsigned EndCondition; /* reason for stopping */
unsigned ErrorCode; /* type of illegal instruction */
ARMword Reg[16]; /* the current register file */
ARMword RegBank[7][16]; /* all the registers */
/* 40 bit accumulator. We always keep this 64 bits wide,
@ -162,16 +161,6 @@ struct ARMul_State
ARMword FPSCR; /* Floating Point Status Register. */
};
#define ResetPin NresetSig
#define FIQPin NfiqSig
#define IRQPin NirqSig
#define AbortPin abortSig
#define TransPin NtransSig
#define BigEndPin bigendSig
#define Prog32Pin prog32Sig
#define Data32Pin data32Sig
#define LateAbortPin lateabtSig
/***************************************************************************\
* Properties of ARM we know about *
\***************************************************************************/
@ -417,25 +406,12 @@ extern int XScale_debug_moe (ARMul_State * state, int moe);
\***************************************************************************/
extern unsigned ARMul_OSInit (ARMul_State * state);
extern void ARMul_OSExit (ARMul_State * state);
extern unsigned ARMul_OSHandleSWI (ARMul_State * state, ARMword number);
extern ARMword ARMul_OSLastErrorP (ARMul_State * state);
extern ARMword ARMul_Debug (ARMul_State * state, ARMword pc, ARMword instr);
extern unsigned ARMul_OSException (ARMul_State * state, ARMword vector,
ARMword pc);
extern int rdi_log;
/***************************************************************************\
* Host-dependent stuff *
\***************************************************************************/
#ifdef macintosh
pascal void SpinCursor (short increment); /* copied from CursorCtl.h */
# define HOURGLASS SpinCursor( 1 )
# define HOURGLASS_RATE 1023 /* 2^n - 1 */
#endif
extern void ARMul_UndefInstr (ARMul_State *, ARMword);
extern void ARMul_FixCPSR (ARMul_State *, ARMword, ARMword);
extern void ARMul_FixSPSR (ARMul_State *, ARMword, ARMword);

View File

@ -1293,7 +1293,6 @@ ARMul_Emulate26 (ARMul_State * state)
if (state->CallDebug > 0)
{
instr = ARMul_Debug (state, pc, instr);
if (state->Emulate < ONCE)
{
state->NextInstr = RESUME;

View File

@ -198,7 +198,6 @@ ARMul_Reset (ARMul_State * state)
FLUSHPIPE;
state->EndCondition = 0;
state->ErrorCode = 0;
state->Exception = FALSE;
state->NresetSig = HIGH;
@ -280,9 +279,6 @@ ARMul_Abort (ARMul_State * state, ARMword vector)
state->Aborted = FALSE;
if (ARMul_OSException (state, vector, ARMul_GetPC (state)))
return;
if (state->prog32Sig)
if (ARMul_MODE26BIT)
temp = R15PC;

View File

@ -1,22 +0,0 @@
/* armopts.h -- ARMulator configuration options: ARM6 Instruction Emulator.
Copyright (C) 1994 Advanced RISC Machines Ltd.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>. */
/* Define one of ARM60 or ARM61. */
#ifndef ARM60
#ifndef ARM61
#define ARM60
#endif
#endif

View File

@ -38,23 +38,6 @@
#include <unistd.h> /* For SEEK_SET etc. */
#endif
#ifdef __riscos
extern int _fisatty (FILE *);
#define isatty_(f) _fisatty(f)
#else
#ifdef __ZTC__
#include <io.h>
#define isatty_(f) isatty((f)->_file)
#else
#ifdef macintosh
#include <ioctl.h>
#define isatty_(f) (~ioctl ((f)->_file, FIOINTERACTIVE, NULL))
#else
#define isatty_(f) isatty (fileno (f))
#endif
#endif
#endif
#include "armdefs.h"
#include "armos.h"
#include "armemu.h"
@ -74,17 +57,11 @@ extern int _fisatty (FILE *);
extern host_callback *sim_callback;
extern unsigned ARMul_OSInit (ARMul_State *);
extern void ARMul_OSExit (ARMul_State *);
extern unsigned ARMul_OSHandleSWI (ARMul_State *, ARMword);
extern unsigned ARMul_OSException (ARMul_State *, ARMword, ARMword);
extern ARMword ARMul_OSLastErrorP (ARMul_State *);
extern ARMword ARMul_Debug (ARMul_State *, ARMword, ARMword);
#define BUFFERSIZE 4096
#ifndef FOPEN_MAX
#define FOPEN_MAX 64
#endif
#define UNIQUETEMPS 256
#ifndef PATH_MAX
#define PATH_MAX 1024
#endif
@ -93,28 +70,9 @@ extern ARMword ARMul_Debug (ARMul_State *, ARMword, ARMword);
struct OSblock
{
ARMword Time0;
ARMword ErrorP;
ARMword ErrorNo;
FILE *FileTable[FOPEN_MAX];
char FileFlags[FOPEN_MAX];
char *tempnames[UNIQUETEMPS];
};
#define NOOP 0
#define BINARY 1
#define READOP 2
#define WRITEOP 4
#ifdef macintosh
#define FIXCRLF(t,c) ((t & BINARY) ? \
c : \
((c == '\n' || c == '\r' ) ? (c ^ 7) : c) \
)
#else
#define FIXCRLF(t,c) c
#endif
/* Bit mask of enabled SWI implementations. */
unsigned int swi_mask = -1;
@ -159,7 +117,6 @@ ARMul_OSInit (ARMul_State * state)
}
OSptr = (struct OSblock *) state->OSptr;
OSptr->ErrorP = 0;
state->Reg[13] = ADDRSUPERSTACK; /* Set up a stack for the current mode... */
ARMul_SetReg (state, SVC32MODE, 13, ADDRSUPERSTACK);/* ...and for supervisor mode... */
ARMul_SetReg (state, ABORT32MODE, 13, ADDRSUPERSTACK);/* ...and for abort 32 mode... */
@ -183,12 +140,6 @@ ARMul_OSInit (ARMul_State * state)
for (i = 0; i < sizeof (softvectorcode); i += 4)
ARMul_WriteWord (state, SOFTVECTORCODE + i, softvectorcode[i / 4]);
for (i = 0; i < FOPEN_MAX; i++)
OSptr->FileTable[i] = NULL;
for (i = 0; i < UNIQUETEMPS; i++)
OSptr->tempnames[i] = NULL;
ARMul_ConsolePrint (state, ", Demon 1.01");
/* #ifndef ASIM */
@ -234,20 +185,6 @@ ARMul_OSInit (ARMul_State * state)
return TRUE;
}
void
ARMul_OSExit (ARMul_State * state)
{
free ((char *) state->OSptr);
}
/* Return the last Operating System Error. */
ARMword ARMul_OSLastErrorP (ARMul_State * state)
{
return ((struct OSblock *) state->OSptr)->ErrorP;
}
static int translate_open_mode[] =
{
TARGET_O_RDONLY, /* "r" */
@ -925,22 +862,3 @@ ARMul_OSHandleSWI (ARMul_State * state, ARMword number)
return TRUE;
}
#ifndef NOOS
#ifndef ASIM
/* The emulator calls this routine when an Exception occurs. The second
parameter is the address of the relevant exception vector. Returning
FALSE from this routine causes the trap to be taken, TRUE causes it to
be ignored (so set state->Emulate to FALSE!). */
unsigned
ARMul_OSException (ARMul_State * state ATTRIBUTE_UNUSED,
ARMword vector ATTRIBUTE_UNUSED,
ARMword pc ATTRIBUTE_UNUSED)
{
return FALSE;
}
#endif
#endif /* NOOS */

File diff suppressed because it is too large Load Diff

View File

@ -22,7 +22,6 @@
freed as they might be needed again. A single area of memory may be
defined to generate aborts. */
#include "armopts.h"
#include "armos.h"
#include "armdefs.h"
#include "ansidecl.h"
@ -217,13 +216,6 @@ ARMword ARMul_LoadInstrS (ARMul_State * state, ARMword address, ARMword isize)
{
state->NumScycles++;
#ifdef HOURGLASS
if ((state->NumScycles & HOURGLASS_RATE) == 0)
{
HOURGLASS;
}
#endif
return ARMul_ReLoadInstr (state, address, isize);
}

View File

@ -1,165 +0,0 @@
/* bag.c -- ARMulator support code: ARM6 Instruction Emulator.
Copyright (C) 1994 Advanced RISC Machines Ltd.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>. */
/********************************************************************/
/* bag.c: */
/* Offers a data structure for storing and getting pairs of number. */
/* The numbers are stored together, put one can be looked up by */
/* quoting the other. If a new pair is entered and one of the */
/* numbers is a repeat of a previous pair, then the previos pair */
/* is deleted. */
/********************************************************************/
#include "bag.h"
#include <stdlib.h>
#define HASH_TABLE_SIZE 256
#define hash(x) (((x)&0xff)^(((x)>>8)&0xff)^(((x)>>16)&0xff)^(((x)>>24)&0xff))
typedef struct hashentry
{
struct hashentry *next;
int first;
int second;
}
Hashentry;
Hashentry *lookupbyfirst[HASH_TABLE_SIZE];
Hashentry *lookupbysecond[HASH_TABLE_SIZE];
static void
addtolist (Hashentry ** add, long first, long second)
{
while (*add)
add = &((*add)->next);
/* Malloc will never fail? :o( */
(*add) = (Hashentry *) malloc (sizeof (Hashentry));
(*add)->next = (Hashentry *) 0;
(*add)->first = first;
(*add)->second = second;
}
static void
killwholelist (Hashentry * p)
{
Hashentry *q;
while (p)
{
q = p;
p = p->next;
free (q);
}
}
static void
removefromlist (Hashentry ** p, long first)
{
Hashentry *q;
while (*p)
{
if ((*p)->first == first)
{
q = (*p)->next;
free (*p);
*p = q;
return;
}
p = &((*p)->next);
}
}
void
BAG_putpair (long first, long second)
{
long junk;
if (BAG_getfirst (&junk, second) != NO_SUCH_PAIR)
BAG_killpair_bysecond (second);
addtolist (&lookupbyfirst[hash (first)], first, second);
addtolist (&lookupbysecond[hash (second)], first, second);
}
Bag_error
BAG_getfirst (long *first, long second)
{
Hashentry *look;
look = lookupbysecond[hash (second)];
while (look)
if (look->second == second)
{
*first = look->first;
return NO_ERROR;
}
return NO_SUCH_PAIR;
}
Bag_error
BAG_getsecond (long first, long *second)
{
Hashentry *look;
look = lookupbyfirst[hash (first)];
while (look)
{
if (look->first == first)
{
*second = look->second;
return NO_ERROR;
}
look = look->next;
}
return NO_SUCH_PAIR;
}
Bag_error
BAG_killpair_byfirst (long first)
{
long second;
if (BAG_getsecond (first, &second) == NO_SUCH_PAIR)
return NO_SUCH_PAIR;
removefromlist (&lookupbyfirst[hash (first)], first);
removefromlist (&lookupbysecond[hash (second)], first);
return NO_ERROR;
}
Bag_error
BAG_killpair_bysecond (long second)
{
long first;
if (BAG_getfirst (&first, second) == NO_SUCH_PAIR)
return NO_SUCH_PAIR;
removefromlist (&lookupbyfirst[hash (first)], first);
removefromlist (&lookupbysecond[hash (second)], first);
return NO_ERROR;
}
void
BAG_newbag (void)
{
int i;
for (i = 0; i < 256; i++)
{
killwholelist (lookupbyfirst[i]);
killwholelist (lookupbysecond[i]);
lookupbyfirst[i] = lookupbysecond[i] = (Hashentry *) 0;
}
}

View File

@ -1,42 +0,0 @@
/* bag.h -- ARMulator support code: ARM6 Instruction Emulator.
Copyright (C) 1994 Advanced RISC Machines Ltd.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>. */
/********************************************************************/
/* bag.h: */
/* Header file for bag.c */
/* Offers a data structure for storing and getting pairs of number. */
/* The numbers are stored together, put one can be looked up by */
/* quoting the other. If a new pair is entered and one of the */
/* numbers is a repeat of a previous pair, then the previos pair */
/* is deleted. */
/********************************************************************/
typedef enum
{
NO_ERROR,
DELETED_OLD_PAIR,
NO_SUCH_PAIR,
}
Bag_error;
void BAG_putpair (long first, long second);
void BAG_newbag (void);
Bag_error BAG_killpair_byfirst (long first);
Bag_error BAG_killpair_bysecond (long second);
Bag_error BAG_getfirst (long *first, long second);
Bag_error BAG_getsecond (long first, long *second);

View File

@ -1,254 +0,0 @@
/* communicate.c -- ARMulator RDP comms code: ARM6 Instruction Emulator.
Copyright (C) 1994 Advanced RISC Machines Ltd.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>. */
/**************************************************************************/
/* Functions to read and write characters or groups of characters */
/* down sockets or pipes. Those that return a value return -1 on failure */
/* and 0 on success. */
/**************************************************************************/
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include "armdefs.h"
/* The socket to the debugger */
int debugsock;
/* The maximum number of file descriptors */
extern int nfds;
/* The socket handle */
extern int sockethandle;
/* Read and Write routines down a pipe or socket */
/****************************************************************/
/* Read an individual character. */
/* All other read functions rely on this one. */
/* It waits 15 seconds until there is a character available: if */
/* no character is available, then it timeouts and returns -1. */
/****************************************************************/
int
MYread_char (int sock, unsigned char *c)
{
int i;
fd_set readfds;
struct timeval timeout = { 15, 0 };
struct sockaddr_in isa;
retry:
FD_ZERO (&readfds);
FD_SET (sock, &readfds);
i = select (nfds, &readfds, (fd_set *) 0, (fd_set *) 0, &timeout);
if (i < 0)
{
perror ("select");
exit (1);
}
if (!i)
{
fprintf (stderr, "read: Timeout\n");
return -1;
}
if ((i = read (sock, c, 1)) < 1)
{
if (!i && sock == debugsock)
{
fprintf (stderr, "Connection with debugger severed.\n");
/* This shouldn't be necessary for a detached armulator, but
the armulator cannot be cold started a second time, so
this is probably preferable to locking up. */
return -1;
fprintf (stderr, "Waiting for connection from debugger...");
debugsock = accept (sockethandle, &isa, &i);
if (debugsock == -1)
{ /* Now we are in serious trouble... */
perror ("accept");
return -1;
}
fprintf (stderr, " done.\nConnection Established.\n");
sock = debugsock;
goto retry;
}
perror ("read");
return -1;
}
#ifdef DEBUG
if (sock == debugsock)
fprintf (stderr, "<%02x ", *c);
#endif
return 0;
}
/****************************************************************/
/* Read an individual character. */
/* It waits until there is a character available. Returns -1 if */
/* an error occurs. */
/****************************************************************/
int
MYread_charwait (int sock, unsigned char *c)
{
int i;
fd_set readfds;
struct sockaddr_in isa;
retry:
FD_ZERO (&readfds);
FD_SET (sock, &readfds);
i = select (nfds, &readfds,
(fd_set *) 0, (fd_set *) 0, (struct timeval *) 0);
if (i < 0)
{
perror ("select");
exit (-1);
}
if ((i = read (sock, c, 1)) < 1)
{
if (!i && sock == debugsock)
{
fprintf (stderr, "Connection with debugger severed.\n");
return -1;
fprintf (stderr, "Waiting for connection from debugger...");
debugsock = accept (sockethandle, &isa, &i);
if (debugsock == -1)
{ /* Now we are in serious trouble... */
perror ("accept");
return -1;
}
fprintf (stderr, " done.\nConnection Established.\n");
sock = debugsock;
goto retry;
}
perror ("read");
return -1;
}
#ifdef DEBUG
if (sock == debugsock)
fprintf (stderr, "<%02x ", *c);
#endif
return 0;
}
void
MYwrite_char (int sock, unsigned char c)
{
if (write (sock, &c, 1) < 1)
perror ("write");
#ifdef DEBUG
if (sock == debugsock)
fprintf (stderr, ">%02x ", c);
#endif
}
int
MYread_word (int sock, ARMword * here)
{
unsigned char a, b, c, d;
if (MYread_char (sock, &a) < 0)
return -1;
if (MYread_char (sock, &b) < 0)
return -1;
if (MYread_char (sock, &c) < 0)
return -1;
if (MYread_char (sock, &d) < 0)
return -1;
*here = a | b << 8 | c << 16 | d << 24;
return 0;
}
void
MYwrite_word (int sock, ARMword i)
{
MYwrite_char (sock, i & 0xff);
MYwrite_char (sock, (i & 0xff00) >> 8);
MYwrite_char (sock, (i & 0xff0000) >> 16);
MYwrite_char (sock, (i & 0xff000000) >> 24);
}
void
MYwrite_string (int sock, char *s)
{
int i;
for (i = 0; MYwrite_char (sock, s[i]), s[i]; i++);
}
int
MYread_FPword (int sock, char *putinhere)
{
int i;
for (i = 0; i < 16; i++)
if (MYread_char (sock, &putinhere[i]) < 0)
return -1;
return 0;
}
void
MYwrite_FPword (int sock, char *fromhere)
{
int i;
for (i = 0; i < 16; i++)
MYwrite_char (sock, fromhere[i]);
}
/* Takes n bytes from source and those n bytes */
/* down to dest */
int
passon (int source, int dest, int n)
{
char *p;
int i;
p = (char *) malloc (n);
if (!p)
{
perror ("Out of memory\n");
exit (1);
}
if (n)
{
for (i = 0; i < n; i++)
if (MYread_char (source, &p[i]) < 0)
return -1;
#ifdef DEBUG
if (dest == debugsock)
for (i = 0; i < n; i++)
fprintf (stderr, ")%02x ", (unsigned char) p[i]);
#endif
write (dest, p, n);
}
free (p);
return 0;
}

View File

@ -1,35 +0,0 @@
/* communicate.h -- ARMulator comms support defns: ARM6 Instruction Emulator.
Copyright (C) 1994 Advanced RISC Machines Ltd.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>. */
int MYread_char (int sock, unsigned char *c);
void MYwrite_char (int sock, unsigned char c);
int MYread_word (int sock, ARMword * here);
void MYwrite_word (int sock, ARMword i);
void MYwrite_string (int sock, char *s);
int MYread_FPword (int sock, char *putinhere);
void MYwrite_FPword (int sock, char *fromhere);
int passon (int source, int dest, int n);
int wait_for_osreply (ARMword * reply); /* from kid.c */
#define OS_SendNothing 0x0
#define OS_SendChar 0x1
#define OS_SendWord 0x2
#define OS_SendString 0x3
/* The pipes between the two processes */
extern int mumkid[2];
extern int kidmum[2];

View File

@ -1,48 +0,0 @@
/* dbg_conf.h -- ARMulator debug interface: ARM6 Instruction Emulator.
Copyright (C) 1994 Advanced RISC Machines Ltd.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef Dbg_Conf__h
#define Dbg_Conf__h
typedef struct Dbg_ConfigBlock
{
int bytesex;
long memorysize;
int serialport; /*) remote connection parameters */
int seriallinespeed; /*) (serial connection) */
int parallelport; /*) ditto */
int parallellinespeed; /*) (parallel connection) */
int processor; /* processor the armulator is to emulate (eg ARM60) */
int rditype; /* armulator / remote processor */
int drivertype; /* parallel / serial / etc */
char const *configtoload;
int flags;
}
Dbg_ConfigBlock;
#define Dbg_ConfigFlag_Reset 1
typedef struct Dbg_HostosInterface Dbg_HostosInterface;
/* This structure allows access by the (host-independent) C-library support
module of armulator or pisd (armos.c) to host-dependent functions for
which there is no host-independent interface. Its contents are unknown
to the debugger toolbox.
The assumption is that, in a windowed system, fputc(stderr) for example
may not achieve the desired effect of the character appearing in some
window.
*/
#endif

View File

@ -1,69 +0,0 @@
/* dbg_cp.h -- ARMulator debug interface: ARM6 Instruction Emulator.
Copyright (C) 1994 Advanced RISC Machines Ltd.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef Dbg_CP__h
#define Dbg_CP__h
#define Dbg_Access_Readable 1
#define Dbg_Access_Writable 2
#define Dbg_Access_CPDT 4 /* else CPRT */
typedef struct
{
unsigned short rmin, rmax;
/* a single description can be used for a range of registers with
the same properties *accessed via CPDT instructions*
*/
unsigned char nbytes; /* size of register */
unsigned char access; /* see above (Access_xxx) */
union
{
struct
{
/* CPDT instructions do not allow the coprocessor much freedom:
only bit 22 ('N') and 12-15 ('CRd') are free for the
coprocessor to use as it sees fit. */
unsigned char nbit;
unsigned char rdbits;
}
cpdt;
struct
{
/* CPRT instructions have much more latitude. The bits fixed
by the ARM are 24..31 (condition mask & opcode)
20 (direction)
8..15 (cpnum, arm register)
4 (CPRT not CPDO)
leaving 14 bits free to the coprocessor (fortunately
falling within two bytes). */
unsigned char read_b0, read_b1, write_b0, write_b1;
}
cprt;
}
accessinst;
}
Dbg_CoProRegDesc;
struct Dbg_CoProDesc
{
int entries;
Dbg_CoProRegDesc regdesc[1 /* really nentries */ ];
};
#define Dbg_CoProDesc_Size(n) (sizeof(struct Dbg_CoProDesc) + (n-1)*sizeof(Dbg_CoProRegDesc))
#endif

View File

@ -1,43 +0,0 @@
/* dbg_hif.h -- ARMulator debug interface: ARM6 Instruction Emulator.
Copyright (C) 1994 Advanced RISC Machines Ltd.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <stdarg.h>
typedef void Hif_DbgPrint (void *arg, const char *format, va_list ap);
typedef void Hif_DbgPause (void *arg);
typedef void Hif_WriteC (void *arg, int c);
typedef int Hif_ReadC (void *arg);
typedef int Hif_Write (void *arg, char const *buffer, int len);
typedef char *Hif_GetS (void *arg, char *buffer, int len);
typedef void Hif_RDIResetProc (void *arg);
struct Dbg_HostosInterface
{
Hif_DbgPrint *dbgprint;
Hif_DbgPause *dbgpause;
void *dbgarg;
Hif_WriteC *writec;
Hif_ReadC *readc;
Hif_Write *write;
Hif_GetS *gets;
void *hostosarg;
Hif_RDIResetProc *reset;
void *resetarg;
};

View File

@ -75,259 +75,6 @@
#define RDIError_UnimplementedMessage 254
#define RDIError_UndefinedMessage 255
/***************************************************************************\
* RDP Message Numbers *
\***************************************************************************/
#define RDP_Start (unsigned char)0x0
#define RDP_End (unsigned char)0x1
#define RDP_Read (unsigned char)0x2
#define RDP_Write (unsigned char)0x3
#define RDP_CPUread (unsigned char)0x4
#define RDP_CPUwrite (unsigned char)0x5
#define RDP_CPread (unsigned char)0x6
#define RDP_CPwrite (unsigned char)0x7
#define RDP_SetBreak (unsigned char)0xa
#define RDP_ClearBreak (unsigned char)0xb
#define RDP_SetWatch (unsigned char)0xc
#define RDP_ClearWatch (unsigned char)0xd
#define RDP_Execute (unsigned char)0x10
#define RDP_Step (unsigned char)0x11
#define RDP_Info (unsigned char)0x12
#define RDP_OSOpReply (unsigned char)0x13
#define RDP_AddConfig (unsigned char)0x14
#define RDP_LoadConfigData (unsigned char)0x15
#define RDP_SelectConfig (unsigned char)0x16
#define RDP_LoadAgent (unsigned char)0x17
#define RDP_Stopped (unsigned char)0x20
#define RDP_OSOp (unsigned char)0x21
#define RDP_Fatal (unsigned char)0x5e
#define RDP_Return (unsigned char)0x5f
#define RDP_Reset (unsigned char)0x7f
/***************************************************************************\
* Other RDI values *
\***************************************************************************/
#define RDISex_Little 0 /* the byte sex of the debuggee */
#define RDISex_Big 1
#define RDISex_DontCare 2
#define RDIPoint_EQ 0 /* the different types of break/watchpoints */
#define RDIPoint_GT 1
#define RDIPoint_GE 2
#define RDIPoint_LT 3
#define RDIPoint_LE 4
#define RDIPoint_IN 5
#define RDIPoint_OUT 6
#define RDIPoint_MASK 7
#define RDIPoint_Inquiry 64 /* ORRed with point type in extended RDP */
#define RDIPoint_Handle 128 /* messages */
#define RDIWatch_ByteRead 1 /* types of data accesses to watch for */
#define RDIWatch_HalfRead 2
#define RDIWatch_WordRead 4
#define RDIWatch_ByteWrite 8
#define RDIWatch_HalfWrite 16
#define RDIWatch_WordWrite 32
#define RDIReg_R15 (1L << 15) /* mask values for CPU */
#define RDIReg_PC (1L << 16)
#define RDIReg_CPSR (1L << 17)
#define RDIReg_SPSR (1L << 18)
#define RDINumCPURegs 19
#define RDINumCPRegs 10 /* current maximum */
#define RDIMode_Curr 255
/* Bits set in return value from RDIInfo_Target */
#define RDITarget_LogSpeed 0x0f
#define RDITarget_HW 0x10 /* else emulator */
#define RDITarget_AgentMaxLevel 0xe0
#define RDITarget_AgentLevelShift 5
#define RDITarget_DebuggerMinLevel 0x700
#define RDITarget_DebuggerLevelShift 8
#define RDITarget_CanReloadAgent 0x800
#define RDITarget_CanInquireLoadSize 0x1000
/* Bits set in return value from RDIInfo_Step */
#define RDIStep_Multiple 1
#define RDIStep_PCChange 2
#define RDIStep_Single 4
/* Bits set in return value from RDIInfo_Points */
#define RDIPointCapability_Comparison 1
#define RDIPointCapability_Range 2
/* 4 to 128 are RDIWatch_xx{Read,Write} left-shifted by two */
#define RDIPointCapability_Mask 256
#define RDIPointCapability_Status 512 /* Point status enquiries available */
/* RDI_Info subcodes */
#define RDIInfo_Target 0
#define RDIInfo_Points 1
#define RDIInfo_Step 2
#define RDIInfo_MMU 3
#define RDIInfo_DownLoad 4 /* Inquires whether configuration download
and selection is available.
*/
#define RDIInfo_SemiHosting 5 /* Inquires whether RDISemiHosting_* RDI_Info
calls are available.
*/
#define RDIInfo_CoPro 6 /* Inquires whether CoPro RDI_Info calls are
available.
*/
#define RDIInfo_Icebreaker 7
/* The next two are only to be used if the value returned by RDIInfo_Points */
/* has RDIPointCapability_Status set. */
#define RDIPointStatus_Watch 0x80
#define RDIPointStatus_Break 0x81
#define RDISignal_Stop 0x100
#define RDIVector_Catch 0x180
/* The next four are only to be used if RDIInfo_Semihosting returned no error */
#define RDISemiHosting_SetState 0x181
#define RDISemiHosting_GetState 0x182
#define RDISemiHosting_SetVector 0x183
#define RDISemiHosting_GetVector 0x184
/* The next two are only to be used if RDIInfo_Icebreaker returned no error */
#define RDIIcebreaker_GetLocks 0x185
#define RDIIcebreaker_SetLocks 0x186
/* Only if RDIInfo_Target returned RDITarget_CanInquireLoadSize */
#define RDIInfo_GetLoadSize 0x187
#define RDICycles 0x200
#define RDICycles_Size 48
#define RDIErrorP 0x201
#define RDISet_Cmdline 0x300
#define RDISet_RDILevel 0x301
#define RDISet_Thread 0x302
/* The next two are only to be used if RDIInfo_CoPro returned no error */
#define RDIInfo_DescribeCoPro 0x400
#define RDIInfo_RequestCoProDesc 0x401
#define RDIInfo_Log 0x800
#define RDIInfo_SetLog 0x801
typedef unsigned long PointHandle;
typedef unsigned long ThreadHandle;
#define RDINoPointHandle ((PointHandle)-1L)
#define RDINoHandle ((ThreadHandle)-1L)
struct Dbg_ConfigBlock;
struct Dbg_HostosInterface;
struct Dbg_MCState;
typedef int rdi_open_proc (unsigned type,
struct Dbg_ConfigBlock const *config,
struct Dbg_HostosInterface const *i,
struct Dbg_MCState *dbg_state);
typedef int rdi_close_proc (void);
typedef int rdi_read_proc (ARMword source, void *dest, unsigned *nbytes);
typedef int rdi_write_proc (const void *source, ARMword dest,
unsigned *nbytes);
typedef int rdi_CPUread_proc (unsigned mode, unsigned long mask,
ARMword * state);
typedef int rdi_CPUwrite_proc (unsigned mode, unsigned long mask,
ARMword const *state);
typedef int rdi_CPread_proc (unsigned CPnum, unsigned long mask,
ARMword * state);
typedef int rdi_CPwrite_proc (unsigned CPnum, unsigned long mask,
ARMword const *state);
typedef int rdi_setbreak_proc (ARMword address, unsigned type, ARMword bound,
PointHandle * handle);
typedef int rdi_clearbreak_proc (PointHandle handle);
typedef int rdi_setwatch_proc (ARMword address, unsigned type,
unsigned datatype, ARMword bound,
PointHandle * handle);
typedef int rdi_clearwatch_proc (PointHandle handle);
typedef int rdi_execute_proc (PointHandle * handle);
typedef int rdi_step_proc (unsigned ninstr, PointHandle * handle);
typedef int rdi_info_proc (unsigned type, ARMword * arg1, ARMword * arg2);
typedef int rdi_pointinq_proc (ARMword * address, unsigned type,
unsigned datatype, ARMword * bound);
typedef enum
{
RDI_ConfigCPU,
RDI_ConfigSystem
}
RDI_ConfigAspect;
typedef enum
{
RDI_MatchAny,
RDI_MatchExactly,
RDI_MatchNoEarlier
}
RDI_ConfigMatchType;
typedef int rdi_addconfig_proc (unsigned long nbytes);
typedef int rdi_loadconfigdata_proc (unsigned long nbytes, char const *data);
typedef int rdi_selectconfig_proc (RDI_ConfigAspect aspect, char const *name,
RDI_ConfigMatchType matchtype,
unsigned versionreq, unsigned *versionp);
typedef char *getbufferproc (void *getbarg, unsigned long *sizep);
typedef int rdi_loadagentproc (ARMword dest, unsigned long size,
getbufferproc * getb, void *getbarg);
typedef struct
{
int itemmax;
char const *const *names;
}
RDI_NameList;
typedef RDI_NameList const *rdi_namelistproc (void);
typedef int rdi_errmessproc (char *buf, int buflen, int errno);
struct RDIProcVec
{
char rditypename[12];
rdi_open_proc *open;
rdi_close_proc *close;
rdi_read_proc *read;
rdi_write_proc *write;
rdi_CPUread_proc *CPUread;
rdi_CPUwrite_proc *CPUwrite;
rdi_CPread_proc *CPread;
rdi_CPwrite_proc *CPwrite;
rdi_setbreak_proc *setbreak;
rdi_clearbreak_proc *clearbreak;
rdi_setwatch_proc *setwatch;
rdi_clearwatch_proc *clearwatch;
rdi_execute_proc *execute;
rdi_step_proc *step;
rdi_info_proc *info;
/* V2 RDI */
rdi_pointinq_proc *pointinquiry;
/* These three useable only if RDIInfo_DownLoad returns no error */
rdi_addconfig_proc *addconfig;
rdi_loadconfigdata_proc *loadconfigdata;
rdi_selectconfig_proc *selectconfig;
rdi_namelistproc *drivernames;
rdi_namelistproc *cpunames;
rdi_errmessproc *errmess;
/* Only if RDIInfo_Target returns a value with RDITarget_LoadAgent set */
rdi_loadagentproc *loadagent;
};
#endif
extern unsigned int swi_mask;

View File

@ -1,112 +0,0 @@
/* gdbhost.c -- ARMulator RDP to gdb comms code: ARM6 Instruction Emulator.
Copyright (C) 1994 Advanced RISC Machines Ltd.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>. */
/***********************************************************/
/* Functions that communicate info back to the debugger... */
/***********************************************************/
#include <stdio.h>
#include <stdarg.h>
#include "armdefs.h"
#include "communicate.h"
#include "dbg_rdi.h"
#include "armos.h"
#define OS_SendNothing 0x0
#define OS_SendChar 0x1
#define OS_SendWord 0x2
#define OS_SendString 0x3
/* Defined in kid.c */
extern int wait_for_osreply (ARMword * reply);
/* A pipe for handling SWI return values that goes straight from the */
/* parent to the ARMulator host interface, bypassing the childs RDP */
/* to RDI interpreter */
int DebuggerARMul[2];
/* The pipes between the two processes */
int mumkid[2];
int kidmum[2];
void
myprint (void *arg, const char *format, va_list ap)
{
#ifdef DEBUG
fprintf (stderr, "Host: myprint\n");
#endif
vfprintf (stderr, format, ap);
}
/* Waits for a keypress on the debuggers' keyboard */
void
mypause (void *arg)
{
#ifdef DEBUG
fprintf (stderr, "Host: mypause\n");
#endif
} /* I do love exciting functions */
void
mywritec (void *arg, int c)
{
#ifdef DEBUG
fprintf (stderr, "Mywrite : %c\n", c);
#endif
MYwrite_char (kidmum[1], RDP_OSOp); /* OS Operation Request Message */
MYwrite_word (kidmum[1], SWI_WriteC); /* Print... */
MYwrite_char (kidmum[1], OS_SendChar); /* ...a single character */
MYwrite_char (kidmum[1], (unsigned char) c);
wait_for_osreply ((ARMword *) 0);
}
int
myreadc (void *arg)
{
char c;
ARMword x;
#ifdef DEBUG
fprintf (stderr, "Host: myreadc\n");
#endif
MYwrite_char (kidmum[1], RDP_OSOp); /* OS Operation Request Message */
MYwrite_word (kidmum[1], SWI_ReadC); /* Read... */
MYwrite_char (kidmum[1], OS_SendNothing);
c = wait_for_osreply (&x);
return (x);
}
int
mywrite (void *arg, char const *buffer, int len)
{
#ifdef DEBUG
fprintf (stderr, "Host: mywrite\n");
#endif
return 0;
}
char *
mygets (void *arg, char *buffer, int len)
{
#ifdef DEBUG
fprintf (stderr, "Host: mygets\n");
#endif
return buffer;
}

View File

@ -1,22 +0,0 @@
/* gdbhost.h -- ARMulator to gdb interface: ARM6 Instruction Emulator.
Copyright (C) 1994 Advanced RISC Machines Ltd.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>. */
void myprint (void *arg, const char *format, va_list ap);
void mypause (void *arg);
void mywritec (void *arg, int c);
int myreadc (void *arg);
int mywrite (void *arg, char const *buffer, int len);
char *mygets (void *arg, char *buffer, int len);

View File

@ -1,539 +0,0 @@
/* kid.c -- ARMulator RDP/RDI interface: ARM6 Instruction Emulator.
Copyright (C) 1994 Advanced RISC Machines Ltd.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>. */
/*****************************************************************/
/* The child process continues here... */
/* It waits on a pipe from the parent and translates the RDP */
/* messages into RDI calls to the ARMulator passing RDP replies */
/* back up a pipe to the parent. */
/*****************************************************************/
#include <sys/types.h>
#include <signal.h>
#include "armdefs.h"
#include "dbg_conf.h"
#include "dbg_hif.h"
#include "dbg_rdi.h"
#include "gdbhost.h"
#include "communicate.h"
/* The pipes between the two processes */
extern int mumkid[2];
extern int kidmum[2];
/* The maximum number of file descriptors */
extern int nfds;
/* The machine name */
#define MAXHOSTNAMELENGTH 64
extern char localhost[MAXHOSTNAMELENGTH + 1];
/* The socket number */
extern unsigned int socketnumber;
/* RDI interface */
extern const struct RDIProcVec armul_rdi;
static int MYrdp_level = 0;
static int rdi_state = 0;
/**************************************************************/
/* Signal handler that terminates excecution in the ARMulator */
/**************************************************************/
void
kid_handlesignal (int sig)
{
#ifdef DEBUG
fprintf (stderr, "Terminate ARMulator excecution\n");
#endif
if (sig != SIGUSR1)
{
fprintf (stderr, "Unsupported signal.\n");
return;
}
armul_rdi.info (RDISignal_Stop, (unsigned long *) 0, (unsigned long *) 0);
}
/********************************************************************/
/* Waits on a pipe from the socket demon for RDP and */
/* acts as an RDP to RDI interpreter on the front of the ARMulator. */
/********************************************************************/
void
kid ()
{
char *p, *q;
int i, j, k;
long outofthebag;
unsigned char c, d, message;
ARMword x, y, z;
struct sigaction action;
PointHandle point;
Dbg_ConfigBlock config;
Dbg_HostosInterface hostif;
struct Dbg_MCState *MCState;
char command_line[256];
struct fd_set readfds;
/* Setup a signal handler for SIGUSR1 */
action.sa_handler = kid_handlesignal;
action.sa_mask = 0;
action.sa_flags = 0;
sigaction (SIGUSR1, &action, (struct sigaction *) 0);
while (1)
{
/* Wait for ever */
FD_ZERO (&readfds);
FD_SET (mumkid[0], &readfds);
i = select (nfds, &readfds,
(fd_set *) 0, (fd_set *) 0, (struct timeval *) 0);
if (i < 0)
{
perror ("select");
}
if (read (mumkid[0], &message, 1) < 1)
{
perror ("read");
}
switch (message)
{
case RDP_Start:
/* Open and/or Initialise */
BAG_newbag ();
MYread_char (mumkid[0], &c); /* type */
MYread_word (mumkid[0], &x); /* memorysize */
if (c & 0x2)
MYread_char (mumkid[0], &d); /* speed */
config.processor = 0;
config.memorysize = x;
config.bytesex = (c & 0x4) ? RDISex_Big : RDISex_Little;
if (c & 0x8)
config.bytesex = RDISex_DontCare;
hostif.dbgprint = myprint;
hostif.dbgpause = mypause;
hostif.dbgarg = stdout;
hostif.writec = mywritec;
hostif.readc = myreadc;
hostif.write = mywrite;
hostif.gets = mygets;
hostif.reset = mypause; /* do nothing */
hostif.resetarg = "Do I love resetting or what!\n";
if (rdi_state)
{
/* we have restarted, so kill off the existing run. */
/* armul_rdi.close(); */
}
i = armul_rdi.open (c & 0x3, &config, &hostif, MCState);
rdi_state = 1;
MYwrite_char (kidmum[1], RDP_Return);
MYwrite_char (kidmum[1], (unsigned char) i);
x = ~0x4;
armul_rdi.info (RDIVector_Catch, &x, 0);
break;
case RDP_End:
/* Close and Finalise */
i = armul_rdi.close ();
rdi_state = 0;
MYwrite_char (kidmum[1], RDP_Return);
MYwrite_char (kidmum[1], (unsigned char) i);
break;
case RDP_Read:
/* Read Memory Address */
MYread_word (mumkid[0], &x); /* address */
MYread_word (mumkid[0], &y); /* nbytes */
p = (char *) malloc (y);
i = armul_rdi.read (x, p, (unsigned *) &y);
MYwrite_char (kidmum[1], RDP_Return);
for (k = 0; k < y; k++)
MYwrite_char (kidmum[1], p[k]);
free (p);
MYwrite_char (kidmum[1], (unsigned char) i);
if (i)
MYwrite_word (kidmum[1], y); /* number of bytes sent without error */
break;
case RDP_Write:
/* Write Memory Address */
MYread_word (mumkid[0], &x); /* address */
MYread_word (mumkid[0], &y); /* nbytes */
p = (char *) malloc (y);
for (k = 0; k < y; k++)
MYread_char (mumkid[0], &p[k]);
i = armul_rdi.write (p, x, (unsigned *) &y);
free (p);
MYwrite_char (kidmum[1], RDP_Return);
MYwrite_char (kidmum[1], (unsigned char) i);
if (i)
MYwrite_word (kidmum[1], y); /* number of bytes sent without error */
break;
case RDP_CPUread:
/* Read CPU State */
MYread_char (mumkid[0], &c); /* mode */
MYread_word (mumkid[0], &x); /* mask */
p = (char *) malloc (4 * RDINumCPURegs);
i = armul_rdi.CPUread (c, x, (ARMword *) p);
MYwrite_char (kidmum[1], RDP_Return);
for (k = 1, j = 0; k != 0x80000000; k *= 2)
if (k & x)
MYwrite_word (kidmum[1], ((ARMword *) p)[j++]);
free (p);
if (i)
MYwrite_char (kidmum[1], (unsigned char) j);
MYwrite_char (kidmum[1], (unsigned char) i);
break;
case RDP_CPUwrite:
/* Write CPU State */
MYread_char (mumkid[0], &c); /* mode */
MYread_word (mumkid[0], &x); /* mask */
p = (char *) malloc (4 * RDINumCPURegs);
for (k = 1, j = 0; k != 0x80000000; k *= 2)
if (k & x)
MYread_word (mumkid[0], &(((ARMword *) p)[j++]));
i = armul_rdi.CPUwrite (c, x, (ARMword *) p);
MYwrite_char (kidmum[1], RDP_Return);
MYwrite_char (kidmum[1], (unsigned char) i);
free (p);
break;
case RDP_CPread:
/* Read Co-Processor State */
MYread_char (mumkid[0], &c); /* CPnum */
MYread_word (mumkid[0], &x); /* mask */
p = q = (char *) malloc (16 * RDINumCPRegs);
i = armul_rdi.CPread (c, x, (ARMword *) p);
MYwrite_char (kidmum[1], RDP_Return);
for (k = 1, j = 0; k != 0x80000000; k *= 2, j++)
if (k & x)
{
if ((c == 1 || c == 2) && k <= 128)
{
MYwrite_FPword (kidmum[1], q);
q += 16;
}
else
{
MYwrite_word (kidmum[1], *q);
q += 4;
}
}
free (p);
if (i)
MYwrite_char (kidmum[1], (unsigned char) j);
MYwrite_char (kidmum[1], (unsigned char) i);
break;
case RDP_CPwrite:
/* Write Co-Processor State */
MYread_char (mumkid[0], &c); /* CPnum */
MYread_word (mumkid[0], &x); /* mask */
p = q = (char *) malloc (16 * RDINumCPURegs);
for (k = 1, j = 0; k != 0x80000000; k *= 2, j++)
if (k & x)
{
if ((c == 1 || c == 2) && k <= 128)
{
MYread_FPword (kidmum[1], q);
q += 16;
}
else
{
MYread_word (mumkid[0], (ARMword *) q);
q += 4;
}
}
i = armul_rdi.CPwrite (c, x, (ARMword *) p);
MYwrite_char (kidmum[1], RDP_Return);
MYwrite_char (kidmum[1], (unsigned char) i);
free (p);
break;
case RDP_SetBreak:
/* Set Breakpoint */
MYread_word (mumkid[0], &x); /* address */
MYread_char (mumkid[0], &c); /* type */
if ((c & 0xf) >= 5)
MYread_word (mumkid[0], &y); /* bound */
i = armul_rdi.setbreak (x, c, y, &point);
if (!MYrdp_level)
BAG_putpair ((long) x, (long) point);
MYwrite_char (kidmum[1], RDP_Return);
if (MYrdp_level)
MYwrite_word (kidmum[1], point);
MYwrite_char (kidmum[1], (unsigned char) i);
break;
case RDP_ClearBreak:
/* Clear Breakpoint */
MYread_word (mumkid[0], &point); /* PointHandle */
if (!MYrdp_level)
{
BAG_getsecond ((long) point, &outofthebag); /* swap pointhandle for address */
BAG_killpair_byfirst (outofthebag);
point = outofthebag;
}
i = armul_rdi.clearbreak (point);
MYwrite_char (kidmum[1], RDP_Return);
MYwrite_char (kidmum[1], (unsigned char) i);
break;
case RDP_SetWatch:
/* Set Watchpoint */
MYread_word (mumkid[0], &x); /* address */
MYread_char (mumkid[0], &c); /* type */
MYread_char (mumkid[0], &d); /* datatype */
if ((c & 0xf) >= 5)
MYread_word (mumkid[0], &y); /* bound */
i = armul_rdi.setwatch (x, c, d, y, &point);
MYwrite_char (kidmum[1], RDP_Return);
MYwrite_word (kidmum[1], point);
MYwrite_char (kidmum[1], (unsigned char) i);
break;
case RDP_ClearWatch:
/* Clear Watchpoint */
MYread_word (mumkid[0], &point); /* PointHandle */
i = armul_rdi.clearwatch (point);
MYwrite_char (kidmum[1], RDP_Return);
MYwrite_char (kidmum[1], (unsigned char) i);
break;
case RDP_Execute:
/* Excecute */
MYread_char (mumkid[0], &c); /* return */
#ifdef DEBUG
fprintf (stderr, "Starting execution\n");
#endif
i = armul_rdi.execute (&point);
#ifdef DEBUG
fprintf (stderr, "Completed execution\n");
#endif
MYwrite_char (kidmum[1], RDP_Return);
if (c & 0x80)
MYwrite_word (kidmum[1], point);
MYwrite_char (kidmum[1], (unsigned char) i);
break;
case RDP_Step:
/* Step */
MYread_char (mumkid[0], &c); /* return */
MYread_word (mumkid[0], &x); /* ninstr */
point = 0x87654321;
i = armul_rdi.step (x, &point);
MYwrite_char (kidmum[1], RDP_Return);
if (c & 0x80)
MYwrite_word (kidmum[1], point);
MYwrite_char (kidmum[1], (unsigned char) i);
break;
case RDP_Info:
/* Info */
MYread_word (mumkid[0], &x);
switch (x)
{
case RDIInfo_Target:
i = armul_rdi.info (RDIInfo_Target, &y, &z);
MYwrite_char (kidmum[1], RDP_Return);
MYwrite_word (kidmum[1], y); /* Loads of info... */
MYwrite_word (kidmum[1], z); /* Model */
MYwrite_char (kidmum[1], (unsigned char) i);
break;
case RDISet_RDILevel:
MYread_word (mumkid[0], &x); /* arg1, debug level */
i = armul_rdi.info (RDISet_RDILevel, &x, 0);
if (i == RDIError_NoError)
MYrdp_level = x;
MYwrite_char (kidmum[1], RDP_Return);
MYwrite_char (kidmum[1], (unsigned char) i);
break;
case RDISet_Cmdline:
for (p = command_line; MYread_char (mumkid[0], p), *p; p++)
; /* String */
i = armul_rdi.info (RDISet_Cmdline,
(unsigned long *) command_line, 0);
MYwrite_char (kidmum[1], RDP_Return);
MYwrite_char (kidmum[1], (unsigned char) i);
break;
case RDIInfo_Step:
i = armul_rdi.info (RDIInfo_Step, &x, 0);
MYwrite_char (kidmum[1], RDP_Return);
MYwrite_word (kidmum[1], x);
MYwrite_char (kidmum[1], (unsigned char) i);
break;
case RDIVector_Catch:
MYread_word (mumkid[0], &x);
i = armul_rdi.info (RDIVector_Catch, &x, 0);
MYwrite_char (kidmum[1], RDP_Return);
MYwrite_char (kidmum[1], i);
break;
case RDIInfo_Points:
i = armul_rdi.info (RDIInfo_Points, &x, 0);
MYwrite_char (kidmum[1], RDP_Return);
MYwrite_word (kidmum[1], x);
MYwrite_char (kidmum[1], (unsigned char) i);
break;
default:
fprintf (stderr, "Unsupported info code %d\n", x);
break;
}
break;
case RDP_OSOpReply:
/* OS Operation Reply */
MYwrite_char (kidmum[1], RDP_Fatal);
break;
case RDP_Reset:
/* Reset */
for (i = 0; i < 50; i++)
MYwrite_char (kidmum[1], RDP_Reset);
p = (char *) malloc (MAXHOSTNAMELENGTH + 5 + 20);
sprintf (p, "Running on %s:%d\n", localhost, socketnumber);
MYwrite_string (kidmum[1], p);
free (p);
break;
default:
fprintf (stderr, "Oh dear: Something is seriously wrong :-(\n");
/* Hmm.. bad RDP operation */
break;
}
}
}
/* Handles memory read operations until an OS Operation Reply Message is */
/* encounterd. It then returns the byte info value (0, 1, or 2) and fills */
/* in 'putinr0' with the data if appropriate. */
int
wait_for_osreply (ARMword * reply)
{
char *p, *q;
int i, j, k;
unsigned char c, d, message;
ARMword x, y, z;
struct sigaction action;
PointHandle point;
Dbg_ConfigBlock config;
Dbg_HostosInterface hostif;
struct Dbg_MCState *MCState;
char command_line[256];
struct fd_set readfds;
#ifdef DEBUG
fprintf (stderr, "wait_for_osreply ().\n");
#endif
/* Setup a signal handler for SIGUSR1 */
action.sa_handler = kid_handlesignal;
action.sa_mask = 0;
action.sa_flags = 0;
sigaction (SIGUSR1, &action, (struct sigaction *) 0);
while (1)
{
/* Wait for ever */
FD_ZERO (&readfds);
FD_SET (mumkid[0], &readfds);
i = select (nfds, &readfds,
(fd_set *) 0, (fd_set *) 0, (struct timeval *) 0);
if (i < 0)
{
perror ("select");
}
if (read (mumkid[0], &message, 1) < 1)
{
perror ("read");
}
switch (message)
{
case RDP_Read:
/* Read Memory Address */
MYread_word (mumkid[0], &x); /* address */
MYread_word (mumkid[0], &y); /* nbytes */
p = (char *) malloc (y);
i = armul_rdi.read (x, p, (unsigned *) &y);
MYwrite_char (kidmum[1], RDP_Return);
for (k = 0; k < y; k++)
MYwrite_char (kidmum[1], p[k]);
free (p);
MYwrite_char (kidmum[1], (unsigned char) i);
if (i)
MYwrite_word (kidmum[1], y); /* number of bytes sent without error */
break;
case RDP_Write:
/* Write Memory Address */
MYread_word (mumkid[0], &x); /* address */
MYread_word (mumkid[0], &y); /* nbytes */
p = (char *) malloc (y);
for (k = 0; k < y; k++)
MYread_char (mumkid[0], &p[k]);
i = armul_rdi.write (p, x, (unsigned *) &y);
free (p);
MYwrite_char (kidmum[1], RDP_Return);
MYwrite_char (kidmum[1], (unsigned char) i);
if (i)
MYwrite_word (kidmum[1], y); /* number of bytes sent without error */
break;
case RDP_OSOpReply:
/* OS Operation Reply */
MYread_char (mumkid[0], &c);
if (c == 1)
MYread_char (mumkid[0], (char *) reply);
if (c == 2)
MYread_word (mumkid[0], reply);
return c;
break;
default:
fprintf (stderr,
"HELP! Unaccounted-for message during OS request. \n");
MYwrite_char (kidmum[1], RDP_Fatal);
}
}
}

View File

@ -1,193 +0,0 @@
/* main.c -- top level of ARMulator: ARM6 Instruction Emulator.
Copyright (C) 1994 Advanced RISC Machines Ltd.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>. */
/**********************************************************************/
/* Forks the ARMulator and hangs on a socket passing on RDP messages */
/* down a pipe to the ARMulator which translates them into RDI calls. */
/**********************************************************************/
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <signal.h>
#include <netdb.h>
#include <unistd.h>
#include "armdefs.h"
#include "dbg_rdi.h"
#include "dbg_conf.h"
#define MAXHOSTNAMELENGTH 64
/* Read and write routines down sockets and pipes */
void MYread_chars (int sock, void *p, int n);
unsigned char MYread_char (int sock);
ARMword MYread_word (int sock);
void MYread_FPword (int sock, char *putinhere);
void MYwrite_word (int sock, ARMword i);
void MYwrite_string (int sock, char *s);
void MYwrite_FPword (int sock, char *fromhere);
void MYwrite_char (int sock, unsigned char c);
void passon (int source, int dest, int n);
/* Mother and child processes */
void parent (void);
void kid (void);
/* The child process id. */
pid_t child;
/* The socket to the debugger */
int debugsock;
/* The pipes between the two processes */
int mumkid[2];
int kidmum[2];
/* A pipe for handling SWI return values that goes straight from the */
/* parent to the ARMulator host interface, bypassing the childs RDP */
/* to RDI interpreter */
int DebuggerARMul[2];
/* The maximum number of file descriptors */
int nfds;
/* The socket handle */
int sockethandle;
/* The machine name */
char localhost[MAXHOSTNAMELENGTH + 1];
/* The socket number */
unsigned int socketnumber;
/**************************************************************/
/* Takes one argument: the socket number. */
/* Opens a socket to the debugger, and once opened spawns the */
/* ARMulator and sets up a couple of pipes. */
/**************************************************************/
int
main (int argc, char *argv[])
{
int i;
struct sockaddr_in devil, isa;
struct hostent *hp;
if (argc == 1)
{
fprintf (stderr, "No socket number\n");
return 1;
}
sscanf (argv[1], "%d", &socketnumber);
if (!socketnumber || socketnumber > 0xffff)
{
fprintf (stderr, "Invalid socket number: %d\n", socketnumber);
return 1;
}
gethostname (localhost, MAXHOSTNAMELENGTH);
hp = gethostbyname (localhost);
if (!hp)
{
fprintf (stderr, "Cannot get local host info\n");
return 1;
}
/* Open a socket */
sockethandle = socket (hp->h_addrtype, SOCK_STREAM, 0);
if (sockethandle == -1)
{
perror ("socket");
return 1;
}
devil.sin_family = hp->h_addrtype;
devil.sin_port = htons (socketnumber);
devil.sin_addr.s_addr = 0;
for (i = 0; i < sizeof (devil.sin_zero); i++)
devil.sin_zero[i] = '\000';
memcpy (&devil.sin_addr, hp->h_addr_list[0], hp->h_length);
if (bind (sockethandle, &devil, sizeof (devil)) < 0)
{
perror ("bind");
return 1;
}
/* May only accept one debugger at once */
if (listen (sockethandle, 0))
{
perror ("listen");
return 1;
}
fprintf (stderr, "Waiting for connection from debugger...");
debugsock = accept (sockethandle, &isa, &i);
if (debugsock == -1)
{
perror ("accept");
return 1;
}
fprintf (stderr, " done.\nConnection Established.\n");
nfds = getdtablesize ();
if (pipe (mumkid))
{
perror ("pipe");
return 1;
}
if (pipe (kidmum))
{
perror ("pipe");
return 1;
}
if (pipe (DebuggerARMul))
{
perror ("pipe");
return 1;
}
#ifdef DEBUG
fprintf (stderr, "Created pipes ok\n");
#endif
child = fork ();
#ifdef DEBUG
fprintf (stderr, "fork() ok\n");
#endif
if (child == 0)
kid ();
if (child != -1)
parent ();
perror ("fork");
return 1;
}

View File

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

View File

@ -163,14 +163,6 @@ ARMul_ConsolePrint (ARMul_State * state,
}
}
ARMword
ARMul_Debug (ARMul_State * state ATTRIBUTE_UNUSED,
ARMword pc ATTRIBUTE_UNUSED,
ARMword instr ATTRIBUTE_UNUSED)
{
return 0;
}
int
sim_write (SIM_DESC sd ATTRIBUTE_UNUSED,
SIM_ADDR addr,