aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-11-15 19:45:36 -0800
committerMike Frysinger <vapier@gentoo.org>2015-12-25 03:09:01 -0500
commit91d6df784db745df2b0a6827de8306246083bc94 (patch)
tree534b158dbd515d00ba54da07cd4986aed5695c0c
parentf0c1b768b4f42c631547643ec01b020108c0ef8e (diff)
downloadfsf-binutils-gdb-91d6df784db745df2b0a6827de8306246083bc94.zip
fsf-binutils-gdb-91d6df784db745df2b0a6827de8306246083bc94.tar.gz
fsf-binutils-gdb-91d6df784db745df2b0a6827de8306246083bc94.tar.bz2
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.
-rw-r--r--sim/arm/ChangeLog33
-rw-r--r--sim/arm/Makefile.in2
-rw-r--r--sim/arm/armdefs.h24
-rw-r--r--sim/arm/armemu.c1
-rw-r--r--sim/arm/arminit.c4
-rw-r--r--sim/arm/armopts.h22
-rw-r--r--sim/arm/armos.c82
-rw-r--r--sim/arm/armrdi.c1246
-rw-r--r--sim/arm/armvirt.c8
-rw-r--r--sim/arm/bag.c165
-rw-r--r--sim/arm/bag.h42
-rw-r--r--sim/arm/communicate.c254
-rw-r--r--sim/arm/communicate.h35
-rw-r--r--sim/arm/dbg_conf.h48
-rw-r--r--sim/arm/dbg_cp.h69
-rw-r--r--sim/arm/dbg_hif.h43
-rw-r--r--sim/arm/dbg_rdi.h253
-rw-r--r--sim/arm/gdbhost.c112
-rw-r--r--sim/arm/gdbhost.h22
-rw-r--r--sim/arm/kid.c539
-rw-r--r--sim/arm/main.c193
-rw-r--r--sim/arm/parent.c480
-rw-r--r--sim/arm/wrapper.c8
23 files changed, 34 insertions, 3651 deletions
diff --git a/sim/arm/ChangeLog b/sim/arm/ChangeLog
index dec5dc5..d60ac4b 100644
--- a/sim/arm/ChangeLog
+++ b/sim/arm/ChangeLog
@@ -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.
diff --git a/sim/arm/Makefile.in b/sim/arm/Makefile.in
index 1eeec25..d23da0a 100644
--- a/sim/arm/Makefile.in
+++ b/sim/arm/Makefile.in
@@ -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
diff --git a/sim/arm/armdefs.h b/sim/arm/armdefs.h
index 4595e56..2b5ff9b 100644
--- a/sim/arm/armdefs.h
+++ b/sim/arm/armdefs.h
@@ -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);
diff --git a/sim/arm/armemu.c b/sim/arm/armemu.c
index 3826c78..5fde3fd 100644
--- a/sim/arm/armemu.c
+++ b/sim/arm/armemu.c
@@ -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;
diff --git a/sim/arm/arminit.c b/sim/arm/arminit.c
index dd7808a..851d356 100644
--- a/sim/arm/arminit.c
+++ b/sim/arm/arminit.c
@@ -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;
diff --git a/sim/arm/armopts.h b/sim/arm/armopts.h
deleted file mode 100644
index 57dc749..0000000
--- a/sim/arm/armopts.h
+++ /dev/null
@@ -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
diff --git a/sim/arm/armos.c b/sim/arm/armos.c
index 6adfd94..c49036f 100644
--- a/sim/arm/armos.c
+++ b/sim/arm/armos.c
@@ -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 */
diff --git a/sim/arm/armrdi.c b/sim/arm/armrdi.c
deleted file mode 100644
index e9ef77d..0000000
--- a/sim/arm/armrdi.c
+++ /dev/null
@@ -1,1246 +0,0 @@
-/* armrdi.c -- ARMulator 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/>. */
-
-#include <string.h>
-#include <ctype.h>
-#include "armdefs.h"
-#include "armemu.h"
-#include "armos.h"
-#include "dbg_cp.h"
-#include "dbg_conf.h"
-#include "dbg_rdi.h"
-#include "dbg_hif.h"
-#include "communicate.h"
-
-/***************************************************************************\
-* Declarations *
-\***************************************************************************/
-
-#define Watch_AnyRead (RDIWatch_ByteRead+RDIWatch_HalfRead+RDIWatch_WordRead)
-#define Watch_AnyWrite (RDIWatch_ByteWrite+RDIWatch_HalfWrite+RDIWatch_WordWrite)
-
-static unsigned FPRegsAddr; /* last known address of FPE regs */
-#define FPESTART 0x2000L
-#define FPEEND 0x8000L
-
-#define IGNORE(d) (d = d)
-#ifdef RDI_VERBOSE
-#define TracePrint(s) \
- if (rdi_log & 1) ARMul_DebugPrint s
-#else
-#define TracePrint(s)
-#endif
-
-static ARMul_State *state = NULL;
-static unsigned BreaksSet; /* The number of breakpoints set */
-
-static int rdi_log = 0; /* debugging ? */
-
-#define LOWEST_RDI_LEVEL 0
-#define HIGHEST_RDI_LEVEL 1
-static int MYrdi_level = LOWEST_RDI_LEVEL;
-
-typedef struct BreakNode BreakNode;
-typedef struct WatchNode WatchNode;
-
-struct BreakNode
-{ /* A breakpoint list node */
- BreakNode *next;
- ARMword address; /* The address of this breakpoint */
- unsigned type; /* The type of comparison */
- ARMword bound; /* The other address for a range */
- ARMword inst;
-};
-
-struct WatchNode
-{ /* A watchpoint list node */
- WatchNode *next;
- ARMword address; /* The address of this watchpoint */
- unsigned type; /* The type of comparison */
- unsigned datatype; /* The type of access to watch for */
- ARMword bound; /* The other address for a range */
-};
-
-BreakNode *BreakList = NULL;
-WatchNode *WatchList = NULL;
-
-void
-ARMul_DebugPrint_i (const Dbg_HostosInterface * hostif, const char *format,
- ...)
-{
- va_list ap;
- va_start (ap, format);
- hostif->dbgprint (hostif->dbgarg, format, ap);
- va_end (ap);
-}
-
-void
-ARMul_DebugPrint (ARMul_State * state, const char *format, ...)
-{
- va_list ap;
- va_start (ap, format);
- if (!(rdi_log & 8))
- state->hostif->dbgprint (state->hostif->dbgarg, format, ap);
- va_end (ap);
-}
-
-#define CONSOLE_PRINT_MAX_LEN 128
-
-void
-ARMul_ConsolePrint (ARMul_State * state, const char *format, ...)
-{
- va_list ap;
- int ch;
- char *str, buf[CONSOLE_PRINT_MAX_LEN];
- int i, j;
- ARMword junk;
-
- va_start (ap, format);
- vsprintf (buf, format, ap);
-
- for (i = 0; buf[i]; i++); /* The string is i chars long */
-
- str = buf;
- while (i >= 32)
- {
- MYwrite_char (kidmum[1], RDP_OSOp);
- MYwrite_word (kidmum[1], SWI_Write0);
- MYwrite_char (kidmum[1], OS_SendString);
- MYwrite_char (kidmum[1], 32); /* Send string 32bytes at a time */
- for (j = 0; j < 32; j++, str++)
- MYwrite_char (kidmum[1], *str);
- wait_for_osreply (&junk);
- i -= 32;
- }
-
- if (i > 0)
- {
- MYwrite_char (kidmum[1], RDP_OSOp);
- MYwrite_word (kidmum[1], SWI_Write0);
- MYwrite_char (kidmum[1], OS_SendString);
- MYwrite_char (kidmum[1], (unsigned char) i); /* Send remainder of string */
- for (j = 0; j < i; j++, str++)
- MYwrite_char (kidmum[1], *str);
- wait_for_osreply (&junk);
- }
-
- va_end (ap);
- return;
-
-/* str = buf; */
-/* while ((ch=*str++) != 0) */
-/* state->hostif->writec(state->hostif->hostosarg, ch); */
-}
-
-void
-ARMul_DebugPause (ARMul_State * state)
-{
- if (!(rdi_log & 8))
- state->hostif->dbgpause (state->hostif->dbgarg);
-}
-
-/***************************************************************************\
-* RDI_open *
-\***************************************************************************/
-
-static void
-InitFail (int exitcode, char const *which)
-{
- ARMul_ConsolePrint (state, "%s interface failed to initialise. Exiting\n",
- which);
- exit (exitcode);
-}
-
-static void
-RDIInit (unsigned type)
-{
- if (type == 0)
- { /* cold start */
- state->CallDebug = state->MemReadDebug = state->MemWriteDebug = 0;
- BreaksSet = 0;
- }
-}
-
-#define UNKNOWNPROC 0
-
-typedef struct
-{
- char name[16];
- unsigned properties;
-}
-Processor;
-
-Processor const p_arm2 = { "ARM2", ARM_Fix26_Prop };
-Processor const p_arm2as = { "ARM2AS", ARM_Fix26_Prop };
-Processor const p_arm61 = { "ARM61", ARM_Fix26_Prop };
-Processor const p_arm3 = { "ARM3", ARM_Fix26_Prop };
-Processor const p_arm6 = { "ARM6", ARM_Lock_Prop };
-Processor const p_arm60 = { "ARM60", ARM_Lock_Prop };
-Processor const p_arm600 = { "ARM600", ARM_Lock_Prop };
-Processor const p_arm610 = { "ARM610", ARM_Lock_Prop };
-Processor const p_arm620 = { "ARM620", ARM_Lock_Prop };
-Processor const p_unknown = { "", 0 };
-
-Processor const *const processors[] =
-{
- &p_arm6, /* default: must come first */
- &p_arm2,
- &p_arm2as,
- &p_arm61,
- &p_arm3,
- &p_arm60,
- &p_arm600,
- &p_arm610,
- &p_arm620,
- &p_unknown
-};
-
-typedef struct ProcessorConfig ProcessorConfig;
-struct ProcessorConfig
-{
- long id[2];
- ProcessorConfig const *self;
- long count;
- Processor const *const *processors;
-};
-
-ProcessorConfig const processorconfig = {
- {((((((long) 'x' << 8) | ' ') << 8) | 'c') << 8) | 'p',
- ((((((long) 'u' << 8) | 's') << 8) | ' ') << 8) | 'x'},
- &processorconfig,
- 16,
- processors
-};
-
-static int
-RDI_open (unsigned type, const Dbg_ConfigBlock * config,
- const Dbg_HostosInterface * hostif, struct Dbg_MCState *dbg_state)
-/* Initialise everything */
-{
- int virgin = (state == NULL);
- IGNORE (dbg_state);
-
-#ifdef RDI_VERBOSE
- if (rdi_log & 1)
- {
- if (virgin)
- ARMul_DebugPrint_i (hostif, "RDI_open: type = %d\n", type);
- else
- ARMul_DebugPrint (state, "RDI_open: type = %d\n", type);
- }
-#endif
-
- if (type & 1)
- { /* Warm start */
- ARMul_Reset (state);
- RDIInit (1);
- }
- else
- {
- if (virgin)
- {
- ARMul_EmulateInit ();
- state = ARMul_NewState ();
- state->hostif = hostif;
- {
- int req = config->processor;
- unsigned processor = processors[req]->val;
- ARMul_SelectProcessor (state, processor);
- ARMul_Reset (state);
- ARMul_ConsolePrint (state, "ARMulator V1.50, %s",
- processors[req]->name);
- }
- if (ARMul_MemoryInit (state, config->memorysize) == FALSE)
- InitFail (1, "Memory");
- if (config->bytesex != RDISex_DontCare)
- state->bigendSig = config->bytesex;
- if (ARMul_CoProInit (state) == FALSE)
- InitFail (2, "Co-Processor");
- if (ARMul_OSInit (state) == FALSE)
- InitFail (3, "Operating System");
- }
- ARMul_Reset (state);
- RDIInit (0);
- }
- if (type & 2)
- { /* Reset the comms link */
- /* what comms link ? */
- }
- if (virgin && (type & 1) == 0) /* Cold start */
- ARMul_ConsolePrint (state, ", %s endian.\n",
- state->bigendSig ? "Big" : "Little");
-
- if (config->bytesex == RDISex_DontCare)
- return (state->bigendSig ? RDIError_BigEndian : RDIError_LittleEndian);
- else
- return (RDIError_NoError);
-}
-
-/***************************************************************************\
-* RDI_close *
-\***************************************************************************/
-
-static int
-RDI_close (void)
-{
- TracePrint ((state, "RDI_close\n"));
- ARMul_OSExit (state);
- ARMul_CoProExit (state);
- ARMul_MemoryExit (state);
- return (RDIError_NoError);
-}
-
-/***************************************************************************\
-* RDI_read *
-\***************************************************************************/
-
-static int
-RDI_read (ARMword source, void *dest, unsigned *nbytes)
-{
- unsigned i;
- char *memptr = (char *) dest;
-
- TracePrint ((state, "RDI_read: source=%.8lx dest=%p nbytes=%.8x\n",
- source, dest, *nbytes));
-
- for (i = 0; i < *nbytes; i++)
- *memptr++ = (char) ARMul_ReadByte (state, source++);
- if (state->abortSig)
- {
- state->abortSig = LOW;
- return (RDIError_DataAbort);
- }
- return (RDIError_NoError);
-}
-
-/***************************************************************************\
-* RDI_write *
-\***************************************************************************/
-
-static int
-RDI_write (const void *source, ARMword dest, unsigned *nbytes)
-{
- unsigned i;
- char *memptr = (char *) source;
-
- TracePrint ((state, "RDI_write: source=%p dest=%.8lx nbytes=%.8x\n",
- source, dest, *nbytes));
-
- for (i = 0; i < *nbytes; i++)
- ARMul_WriteByte (state, (ARMword) dest++, (ARMword) * memptr++);
-
- if (state->abortSig)
- {
- state->abortSig = LOW;
- return (RDIError_DataAbort);
- }
- return (RDIError_NoError);
-}
-
-/***************************************************************************\
-* RDI_CPUread *
-\***************************************************************************/
-
-static int
-RDI_CPUread (unsigned mode, unsigned long mask, ARMword buffer[])
-{
- unsigned i, upto;
-
- if (mode == RDIMode_Curr)
- mode = (unsigned) (ARMul_GetCPSR (state) & MODEBITS);
-
- for (upto = 0, i = 0; i < 15; i++)
- if (mask & (1L << i))
- {
- buffer[upto++] = ARMul_GetReg (state, mode, i);
- }
-
- if (mask & RDIReg_R15)
- {
- buffer[upto++] = ARMul_GetR15 (state);
- }
-
- if (mask & RDIReg_PC)
- {
- buffer[upto++] = ARMul_GetPC (state);
- }
-
- if (mask & RDIReg_CPSR)
- buffer[upto++] = ARMul_GetCPSR (state);
-
- if (mask & RDIReg_SPSR)
- buffer[upto++] = ARMul_GetSPSR (state, mode);
-
- TracePrint ((state, "RDI_CPUread: mode=%.8x mask=%.8lx", mode, mask));
-#ifdef RDI_VERBOSE
- if (rdi_log & 1)
- {
- for (upto = 0, i = 0; i <= 20; i++)
- if (mask & (1L << i))
- {
- ARMul_DebugPrint (state, "%c%.8lx", upto % 4 == 0 ? '\n' : ' ',
- buffer[upto]);
- upto++;
- }
- ARMul_DebugPrint (state, "\n");
- }
-#endif
-
- return (RDIError_NoError);
-}
-
-/***************************************************************************\
-* RDI_CPUwrite *
-\***************************************************************************/
-
-static int
-RDI_CPUwrite (unsigned mode, unsigned long mask, ARMword const buffer[])
-{
- int i, upto;
-
-
- TracePrint ((state, "RDI_CPUwrite: mode=%.8x mask=%.8lx", mode, mask));
-#ifdef RDI_VERBOSE
- if (rdi_log & 1)
- {
- for (upto = 0, i = 0; i <= 20; i++)
- if (mask & (1L << i))
- {
- ARMul_DebugPrint (state, "%c%.8lx", upto % 4 == 0 ? '\n' : ' ',
- buffer[upto]);
- upto++;
- }
- ARMul_DebugPrint (state, "\n");
- }
-#endif
-
- if (mode == RDIMode_Curr)
- mode = (unsigned) (ARMul_GetCPSR (state) & MODEBITS);
-
- for (upto = 0, i = 0; i < 15; i++)
- if (mask & (1L << i))
- ARMul_SetReg (state, mode, i, buffer[upto++]);
-
- if (mask & RDIReg_R15)
- ARMul_SetR15 (state, buffer[upto++]);
-
- if (mask & RDIReg_PC)
- {
-
- ARMul_SetPC (state, buffer[upto++]);
- }
- if (mask & RDIReg_CPSR)
- ARMul_SetCPSR (state, buffer[upto++]);
-
- if (mask & RDIReg_SPSR)
- ARMul_SetSPSR (state, mode, buffer[upto++]);
-
- return (RDIError_NoError);
-}
-
-/***************************************************************************\
-* RDI_CPread *
-\***************************************************************************/
-
-static int
-RDI_CPread (unsigned CPnum, unsigned long mask, ARMword buffer[])
-{
- ARMword fpregsaddr, word[4];
-
- unsigned r, w;
- unsigned upto;
-
- if (CPnum != 1 && CPnum != 2)
- {
- unsigned char const *rmap = state->CPRegWords[CPnum];
- if (rmap == NULL)
- return (RDIError_UnknownCoPro);
- for (upto = 0, r = 0; r < rmap[-1]; r++)
- if (mask & (1L << r))
- {
- (void) state->CPRead[CPnum] (state, r, &buffer[upto]);
- upto += rmap[r];
- }
- TracePrint ((state, "RDI_CPread: CPnum=%d mask=%.8lx", CPnum, mask));
-#ifdef RDI_VERBOSE
- if (rdi_log & 1)
- {
- w = 0;
- for (upto = 0, r = 0; r < rmap[-1]; r++)
- if (mask & (1L << r))
- {
- int words = rmap[r];
- ARMul_DebugPrint (state, "%c%2d",
- (w >= 4 ? (w = 0, '\n') : ' '), r);
- while (--words >= 0)
- {
- ARMul_DebugPrint (state, " %.8lx", buffer[upto++]);
- w++;
- }
- }
- ARMul_DebugPrint (state, "\n");
- }
-#endif
- return RDIError_NoError;
- }
-
-#ifdef NOFPE
- return RDIError_UnknownCoPro;
-
-#else
- if (FPRegsAddr == 0)
- {
- fpregsaddr = ARMul_ReadWord (state, 4L);
- if ((fpregsaddr & 0xff800000) != 0xea000000) /* Must be a forward branch */
- return RDIError_UnknownCoPro;
- fpregsaddr = ((fpregsaddr & 0xffffff) << 2) + 8; /* address in __fp_decode - 4 */
- if ((fpregsaddr < FPESTART) || (fpregsaddr >= FPEEND))
- return RDIError_UnknownCoPro;
- fpregsaddr = ARMul_ReadWord (state, fpregsaddr); /* pointer to fp registers */
- FPRegsAddr = fpregsaddr;
- }
- else
- fpregsaddr = FPRegsAddr;
-
- if (fpregsaddr == 0)
- return RDIError_UnknownCoPro;
- for (upto = 0, r = 0; r < 8; r++)
- if (mask & (1L << r))
- {
- for (w = 0; w < 4; w++)
- word[w] =
- ARMul_ReadWord (state,
- fpregsaddr + (ARMword) r * 16 + (ARMword) w * 4);
- switch ((int) (word[3] >> 29))
- {
- case 0:
- case 2:
- case 4:
- case 6: /* its unpacked, convert to extended */
- buffer[upto++] = 2; /* mark as extended */
- buffer[upto++] = (word[3] & 0x7fff) | (word[0] & 0x80000000); /* exp and sign */
- buffer[upto++] = word[1]; /* mantissa 1 */
- buffer[upto++] = word[2]; /* mantissa 2 */
- break;
- case 1: /* packed single */
- buffer[upto++] = 0; /* mark as single */
- buffer[upto++] = word[0]; /* sign, exp and mantissa */
- buffer[upto++] = word[1]; /* padding */
- buffer[upto++] = word[2]; /* padding */
- break;
- case 3: /* packed double */
- buffer[upto++] = 1; /* mark as double */
- buffer[upto++] = word[0]; /* sign, exp and mantissa1 */
- buffer[upto++] = word[1]; /* mantissa 2 */
- buffer[upto++] = word[2]; /* padding */
- break;
- case 5: /* packed extended */
- buffer[upto++] = 2; /* mark as extended */
- buffer[upto++] = word[0]; /* sign and exp */
- buffer[upto++] = word[1]; /* mantissa 1 */
- buffer[upto++] = word[2]; /* mantissa 2 */
- break;
- case 7: /* packed decimal */
- buffer[upto++] = 3; /* mark as packed decimal */
- buffer[upto++] = word[0]; /* sign, exp and mantissa1 */
- buffer[upto++] = word[1]; /* mantissa 2 */
- buffer[upto++] = word[2]; /* mantissa 3 */
- break;
- }
- }
- if (mask & (1L << r))
- buffer[upto++] = ARMul_ReadWord (state, fpregsaddr + 128); /* fpsr */
- if (mask & (1L << (r + 1)))
- buffer[upto++] = 0; /* fpcr */
-
- TracePrint ((state, "RDI_CPread: CPnum=%d mask=%.8lx\n", CPnum, mask));
-#ifdef RDI_VERBOSE
- if (rdi_log & 1)
- {
- for (upto = 0, r = 0; r < 9; r++)
- if (mask & (1L << r))
- {
- if (r != 8)
- {
- ARMul_DebugPrint (state, "%08lx ", buffer[upto++]);
- ARMul_DebugPrint (state, "%08lx ", buffer[upto++]);
- ARMul_DebugPrint (state, "%08lx ", buffer[upto++]);
- }
- ARMul_DebugPrint (state, "%08lx\n", buffer[upto++]);
- }
- ARMul_DebugPrint (state, "\n");
- }
-#endif
- return (RDIError_NoError);
-#endif /* NOFPE */
-}
-
-/***************************************************************************\
-* RDI_CPwrite *
-\***************************************************************************/
-
-static int
-RDI_CPwrite (unsigned CPnum, unsigned long mask, ARMword const buffer[])
-{
- unsigned r;
- unsigned upto;
- ARMword fpregsaddr;
-
- if (CPnum != 1 && CPnum != 2)
- {
- unsigned char const *rmap = state->CPRegWords[CPnum];
- if (rmap == NULL)
- return (RDIError_UnknownCoPro);
- TracePrint ((state, "RDI_CPwrite: CPnum=%d mask=%.8lx", CPnum, mask));
-#ifdef RDI_VERBOSE
- if (rdi_log & 1)
- {
- int w = 0;
- for (upto = 0, r = 0; r < rmap[-1]; r++)
- if (mask & (1L << r))
- {
- int words = rmap[r];
- ARMul_DebugPrint (state, "%c%2d",
- (w >= 4 ? (w = 0, '\n') : ' '), r);
- while (--words >= 0)
- {
- ARMul_DebugPrint (state, " %.8lx", buffer[upto++]);
- w++;
- }
- }
- ARMul_DebugPrint (state, "\n");
- }
-#endif
- for (upto = 0, r = 0; r < rmap[-1]; r++)
- if (mask & (1L << r))
- {
- (void) state->CPWrite[CPnum] (state, r, &buffer[upto]);
- upto += rmap[r];
- }
- return RDIError_NoError;
- }
-
-#ifdef NOFPE
- return RDIError_UnknownCoPro;
-
-#else
- TracePrint ((state, "RDI_CPwrite: CPnum=%d mask=%.8lx", CPnum, mask));
-#ifdef RDI_VERBOSE
- if (rdi_log & 1)
- {
- for (upto = 0, r = 0; r < 9; r++)
- if (mask & (1L << r))
- {
- if (r != 8)
- {
- ARMul_DebugPrint (state, "%08lx ", buffer[upto++]);
- ARMul_DebugPrint (state, "%08lx ", buffer[upto++]);
- ARMul_DebugPrint (state, "%08lx ", buffer[upto++]);
- }
- ARMul_DebugPrint (state, "%08lx\n", buffer[upto++]);
- }
- ARMul_DebugPrint (state, "\n");
- }
-#endif
-
- if (FPRegsAddr == 0)
- {
- fpregsaddr = ARMul_ReadWord (state, 4L);
- if ((fpregsaddr & 0xff800000) != 0xea000000) /* Must be a forward branch */
- return RDIError_UnknownCoPro;
- fpregsaddr = ((fpregsaddr & 0xffffff) << 2) + 8; /* address in __fp_decode - 4 */
- if ((fpregsaddr < FPESTART) || (fpregsaddr >= FPEEND))
- return RDIError_UnknownCoPro;
- fpregsaddr = ARMul_ReadWord (state, fpregsaddr); /* pointer to fp registers */
- FPRegsAddr = fpregsaddr;
- }
- else
- fpregsaddr = FPRegsAddr;
-
- if (fpregsaddr == 0)
- return RDIError_UnknownCoPro;
- for (upto = 0, r = 0; r < 8; r++)
- if (mask & (1L << r))
- {
- ARMul_WriteWord (state, fpregsaddr + (ARMword) r * 16,
- buffer[upto + 1]);
- ARMul_WriteWord (state, fpregsaddr + (ARMword) r * 16 + 4,
- buffer[upto + 2]);
- ARMul_WriteWord (state, fpregsaddr + (ARMword) r * 16 + 8,
- buffer[upto + 3]);
- ARMul_WriteWord (state, fpregsaddr + (ARMword) r * 16 + 12,
- (buffer[upto] * 2 + 1) << 29); /* mark type */
- upto += 4;
- }
- if (mask & (1L << r))
- ARMul_WriteWord (state, fpregsaddr + 128, buffer[upto++]); /* fpsr */
- return (RDIError_NoError);
-#endif /* NOFPE */
-}
-
-static void
-deletebreaknode (BreakNode ** prevp)
-{
- BreakNode *p = *prevp;
- *prevp = p->next;
- ARMul_WriteWord (state, p->address, p->inst);
- free ((char *) p);
- BreaksSet--;
- state->CallDebug--;
-}
-
-static int
-removebreak (ARMword address, unsigned type)
-{
- BreakNode *p, **prevp = &BreakList;
- for (; (p = *prevp) != NULL; prevp = &p->next)
- if (p->address == address && p->type == type)
- {
- deletebreaknode (prevp);
- return TRUE;
- }
- return FALSE;
-}
-
-/* This routine installs a breakpoint into the breakpoint table */
-
-static BreakNode *
-installbreak (ARMword address, unsigned type, ARMword bound)
-{
- BreakNode *p = (BreakNode *) malloc (sizeof (BreakNode));
- p->next = BreakList;
- BreakList = p;
- p->address = address;
- p->type = type;
- p->bound = bound;
- p->inst = ARMul_ReadWord (state, address);
- ARMul_WriteWord (state, address, 0xee000000L);
- return p;
-}
-
-/***************************************************************************\
-* RDI_setbreak *
-\***************************************************************************/
-
-static int
-RDI_setbreak (ARMword address, unsigned type, ARMword bound,
- PointHandle * handle)
-{
- BreakNode *p;
- TracePrint ((state, "RDI_setbreak: address=%.8lx type=%d bound=%.8lx\n",
- address, type, bound));
-
- removebreak (address, type);
- p = installbreak (address, type, bound);
- BreaksSet++;
- state->CallDebug++;
- *handle = (PointHandle) p;
- TracePrint ((state, " returns %.8lx\n", *handle));
- return RDIError_NoError;
-}
-
-/***************************************************************************\
-* RDI_clearbreak *
-\***************************************************************************/
-
-static int
-RDI_clearbreak (PointHandle handle)
-{
- TracePrint ((state, "RDI_clearbreak: address=%.8lx\n", handle));
- {
- BreakNode *p, **prevp = &BreakList;
- for (; (p = *prevp) != NULL; prevp = &p->next)
- if (p == (BreakNode *) handle)
- break;
- if (p == NULL)
- return RDIError_NoSuchPoint;
- deletebreaknode (prevp);
- return RDIError_NoError;
- }
-}
-
-/***************************************************************************\
-* Internal functions for breakpoint table manipulation *
-\***************************************************************************/
-
-static void
-deletewatchnode (WatchNode ** prevp)
-{
- WatchNode *p = *prevp;
- if (p->datatype & Watch_AnyRead)
- state->MemReadDebug--;
- if (p->datatype & Watch_AnyWrite)
- state->MemWriteDebug--;
- *prevp = p->next;
- free ((char *) p);
-}
-
-int
-removewatch (ARMword address, unsigned type)
-{
- WatchNode *p, **prevp = &WatchList;
- for (; (p = *prevp) != NULL; prevp = &p->next)
- if (p->address == address && p->type == type)
- { /* found a match */
- deletewatchnode (prevp);
- return TRUE;
- }
- return FALSE; /* never found a match */
-}
-
-static WatchNode *
-installwatch (ARMword address, unsigned type, unsigned datatype,
- ARMword bound)
-{
- WatchNode *p = (WatchNode *) malloc (sizeof (WatchNode));
- p->next = WatchList;
- WatchList = p;
- p->address = address;
- p->type = type;
- p->datatype = datatype;
- p->bound = bound;
- return p;
-}
-
-/***************************************************************************\
-* RDI_setwatch *
-\***************************************************************************/
-
-static int
-RDI_setwatch (ARMword address, unsigned type, unsigned datatype,
- ARMword bound, PointHandle * handle)
-{
- WatchNode *p;
- TracePrint (
- (state,
- "RDI_setwatch: address=%.8lx type=%d datatype=%d bound=%.8lx",
- address, type, datatype, bound));
-
- if (!state->CanWatch)
- return RDIError_UnimplementedMessage;
-
- removewatch (address, type);
- p = installwatch (address, type, datatype, bound);
- if (datatype & Watch_AnyRead)
- state->MemReadDebug++;
- if (datatype & Watch_AnyWrite)
- state->MemWriteDebug++;
- *handle = (PointHandle) p;
- TracePrint ((state, " returns %.8lx\n", *handle));
- return RDIError_NoError;
-}
-
-/***************************************************************************\
-* RDI_clearwatch *
-\***************************************************************************/
-
-static int
-RDI_clearwatch (PointHandle handle)
-{
- TracePrint ((state, "RDI_clearwatch: address=%.8lx\n", handle));
- {
- WatchNode *p, **prevp = &WatchList;
- for (; (p = *prevp) != NULL; prevp = &p->next)
- if (p == (WatchNode *) handle)
- break;
- if (p == NULL)
- return RDIError_NoSuchPoint;
- deletewatchnode (prevp);
- return RDIError_NoError;
- }
-}
-
-/***************************************************************************\
-* RDI_execute *
-\***************************************************************************/
-
-static int
-RDI_execute (PointHandle * handle)
-{
- TracePrint ((state, "RDI_execute\n"));
- if (rdi_log & 4)
- {
- state->CallDebug++;
- state->Debug = TRUE;
- }
- state->EndCondition = RDIError_NoError;
- state->StopHandle = 0;
-
- ARMul_DoProg (state);
-
- *handle = state->StopHandle;
- state->Reg[15] -= 8; /* undo the pipeline */
- if (rdi_log & 4)
- {
- state->CallDebug--;
- state->Debug = FALSE;
- }
- return (state->EndCondition);
-}
-
-/***************************************************************************\
-* RDI_step *
-\***************************************************************************/
-
-static int
-RDI_step (unsigned ninstr, PointHandle * handle)
-{
-
- TracePrint ((state, "RDI_step\n"));
- if (ninstr != 1)
- return RDIError_UnimplementedMessage;
- if (rdi_log & 4)
- {
- state->CallDebug++;
- state->Debug = TRUE;
- }
- state->EndCondition = RDIError_NoError;
- state->StopHandle = 0;
- ARMul_DoInstr (state);
- *handle = state->StopHandle;
- state->Reg[15] -= 8; /* undo the pipeline */
- if (rdi_log & 4)
- {
- state->CallDebug--;
- state->Debug = FALSE;
- }
- return (state->EndCondition);
-}
-
-/***************************************************************************\
-* RDI_info *
-\***************************************************************************/
-
-static int
-RDI_info (unsigned type, ARMword * arg1, ARMword * arg2)
-{
- switch (type)
- {
- case RDIInfo_Target:
- TracePrint ((state, "RDI_Info_Target\n"));
- /* Emulator, speed 10**5 IPS */
- *arg1 = 5 | HIGHEST_RDI_LEVEL << 5 | LOWEST_RDI_LEVEL << 8;
- *arg2 = 1298224434;
- return RDIError_NoError;
-
- case RDIInfo_Points:
- {
- ARMword n = RDIPointCapability_Comparison | RDIPointCapability_Range |
- RDIPointCapability_Mask | RDIPointCapability_Status;
- TracePrint ((state, "RDI_Info_Points\n"));
- if (state->CanWatch)
- n |= (Watch_AnyRead + Watch_AnyWrite) << 2;
- *arg1 = n;
- return RDIError_NoError;
- }
-
- case RDIInfo_Step:
- TracePrint ((state, "RDI_Info_Step\n"));
- *arg1 = RDIStep_Single;
- return RDIError_NoError;
-
- case RDIInfo_MMU:
- TracePrint ((state, "RDI_Info_MMU\n"));
- *arg1 = 1313820229;
- return RDIError_NoError;
-
- case RDISignal_Stop:
- TracePrint ((state, "RDISignal_Stop\n"));
- state->CallDebug++;
- state->EndCondition = RDIError_UserInterrupt;
- return RDIError_NoError;
-
- case RDIVector_Catch:
- TracePrint ((state, "RDIVector_Catch %.8lx\n", *arg1));
- state->VectorCatch = (unsigned) *arg1;
- return RDIError_NoError;
-
- case RDISet_Cmdline:
- TracePrint ((state, "RDI_Set_Cmdline %s\n", (char *) arg1));
- state->CommandLine =
- (char *) malloc ((unsigned) strlen ((char *) arg1) + 1);
- (void) strcpy (state->CommandLine, (char *) arg1);
- return RDIError_NoError;
-
- case RDICycles:
- TracePrint ((state, "RDI_Info_Cycles\n"));
- arg1[0] = 0;
- arg1[1] = state->NumInstrs;
- arg1[2] = 0;
- arg1[3] = state->NumScycles;
- arg1[4] = 0;
- arg1[5] = state->NumNcycles;
- arg1[6] = 0;
- arg1[7] = state->NumIcycles;
- arg1[8] = 0;
- arg1[9] = state->NumCcycles;
- arg1[10] = 0;
- arg1[11] = state->NumFcycles;
- return RDIError_NoError;
-
- case RDIErrorP:
- *arg1 = ARMul_OSLastErrorP (state);
- TracePrint ((state, "RDI_ErrorP returns %ld\n", *arg1));
- return RDIError_NoError;
-
- case RDIInfo_DescribeCoPro:
- {
- int cpnum = *(int *) arg1;
- struct Dbg_CoProDesc *cpd = (struct Dbg_CoProDesc *) arg2;
- int i;
- unsigned char const *map = state->CPRegWords[cpnum];
- if (map == NULL)
- return RDIError_UnknownCoPro;
- for (i = 0; i < cpd->entries; i++)
- {
- unsigned r, w = cpd->regdesc[i].nbytes / sizeof (ARMword);
- for (r = cpd->regdesc[i].rmin; r <= cpd->regdesc[i].rmax; r++)
- if (map[r] != w)
- return RDIError_BadCoProState;
- }
- return RDIError_NoError;
- }
-
- case RDIInfo_RequestCoProDesc:
- {
- int cpnum = *(int *) arg1;
- struct Dbg_CoProDesc *cpd = (struct Dbg_CoProDesc *) arg2;
- int i = -1, lastw = -1, r;
- unsigned char const *map;
- if ((unsigned) cpnum >= 16)
- return RDIError_UnknownCoPro;
- map = state->CPRegWords[cpnum];
- if (map == NULL)
- return RDIError_UnknownCoPro;
- for (r = 0; r < map[-1]; r++)
- {
- int words = map[r];
- if (words == lastw)
- cpd->regdesc[i].rmax = r;
- else
- {
- if (++i >= cpd->entries)
- return RDIError_BufferFull;
- cpd->regdesc[i].rmax = cpd->regdesc[i].rmin = r;
- cpd->regdesc[i].nbytes = words * sizeof (ARMword);
- cpd->regdesc[i].access =
- Dbg_Access_Readable + Dbg_Access_Writable;
- }
- }
- cpd->entries = i + 1;
- return RDIError_NoError;
- }
-
- case RDIInfo_Log:
- *arg1 = (ARMword) rdi_log;
- return RDIError_NoError;
-
- case RDIInfo_SetLog:
- rdi_log = (int) *arg1;
- return RDIError_NoError;
-
- case RDIInfo_CoPro:
- return RDIError_NoError;
-
- case RDIPointStatus_Watch:
- {
- WatchNode *p, *handle = (WatchNode *) * arg1;
- for (p = WatchList; p != NULL; p = p->next)
- if (p == handle)
- {
- *arg1 = -1;
- *arg2 = 1;
- return RDIError_NoError;
- }
- return RDIError_NoSuchPoint;
- }
-
- case RDIPointStatus_Break:
- {
- BreakNode *p, *handle = (BreakNode *) * arg1;
- for (p = BreakList; p != NULL; p = p->next)
- if (p == handle)
- {
- *arg1 = -1;
- *arg2 = 1;
- return RDIError_NoError;
- }
- return RDIError_NoSuchPoint;
- }
-
- case RDISet_RDILevel:
- if (*arg1 < LOWEST_RDI_LEVEL || *arg1 > HIGHEST_RDI_LEVEL)
- return RDIError_IncompatibleRDILevels;
- MYrdi_level = *arg1;
- return RDIError_NoError;
-
- default:
- return RDIError_UnimplementedMessage;
-
- }
-}
-
-/***************************************************************************\
-* The emulator calls this routine at the beginning of every cycle when the *
-* CallDebug flag is set. The second parameter passed is the address of the *
-* currently executing instruction (i.e Program Counter - 8), the third *
-* parameter is the instruction being executed. *
-\***************************************************************************/
-
-ARMword
-ARMul_Debug (ARMul_State * state, ARMword pc, ARMword instr)
-{
-
- if (state->EndCondition == RDIError_UserInterrupt)
- {
- TracePrint ((state, "User interrupt at %.8lx\n", pc));
- state->CallDebug--;
- state->Emulate = STOP;
- }
- else
- {
- BreakNode *p = BreakList;
- for (; p != NULL; p = p->next)
- {
- switch (p->type)
- {
- case RDIPoint_EQ:
- if (pc == p->address)
- break;
- continue;
- case RDIPoint_GT:
- if (pc > p->address)
- break;
- continue;
- case RDIPoint_GE:
- if (pc >= p->address)
- break;
- continue;
- case RDIPoint_LT:
- if (pc < p->address)
- break;
- continue;
- case RDIPoint_LE:
- if (pc <= p->address)
- break;
- continue;
- case RDIPoint_IN:
- if (p->address <= pc && pc < p->address + p->bound)
- break;
- continue;
- case RDIPoint_OUT:
- if (p->address > pc || pc >= p->address + p->bound)
- break;
- continue;
- case RDIPoint_MASK:
- if ((pc & p->bound) == p->address)
- break;
- continue;
- }
- /* found a match */
- TracePrint ((state, "Breakpoint reached at %.8lx\n", pc));
- state->EndCondition = RDIError_BreakpointReached;
- state->Emulate = STOP;
- state->StopHandle = (ARMword) p;
- break;
- }
- }
- return instr;
-}
-
-void
-ARMul_CheckWatch (ARMul_State * state, ARMword addr, int access)
-{
- WatchNode *p;
- for (p = WatchList; p != NULL; p = p->next)
- if (p->datatype & access)
- {
- switch (p->type)
- {
- case RDIPoint_EQ:
- if (addr == p->address)
- break;
- continue;
- case RDIPoint_GT:
- if (addr > p->address)
- break;
- continue;
- case RDIPoint_GE:
- if (addr >= p->address)
- break;
- continue;
- case RDIPoint_LT:
- if (addr < p->address)
- break;
- continue;
- case RDIPoint_LE:
- if (addr <= p->address)
- break;
- continue;
- case RDIPoint_IN:
- if (p->address <= addr && addr < p->address + p->bound)
- break;
- continue;
- case RDIPoint_OUT:
- if (p->address > addr || addr >= p->address + p->bound)
- break;
- continue;
- case RDIPoint_MASK:
- if ((addr & p->bound) == p->address)
- break;
- continue;
- }
- /* found a match */
- TracePrint ((state, "Watchpoint at %.8lx accessed\n", addr));
- state->EndCondition = RDIError_WatchpointAccessed;
- state->Emulate = STOP;
- state->StopHandle = (ARMword) p;
- return;
- }
-}
-
-static RDI_NameList const *
-RDI_cpunames ()
-{
- return (RDI_NameList const *) &processorconfig.count;
-}
-
-const struct RDIProcVec armul_rdi = {
- "ARMUL",
- RDI_open,
- RDI_close,
- RDI_read,
- RDI_write,
- RDI_CPUread,
- RDI_CPUwrite,
- RDI_CPread,
- RDI_CPwrite,
- RDI_setbreak,
- RDI_clearbreak,
- RDI_setwatch,
- RDI_clearwatch,
- RDI_execute,
- RDI_step,
- RDI_info,
-
- 0, /*pointinq */
- 0, /*addconfig */
- 0, /*loadconfigdata */
- 0, /*selectconfig */
- 0, /*drivernames */
-
- RDI_cpunames
-};
diff --git a/sim/arm/armvirt.c b/sim/arm/armvirt.c
index c5af8d6..4f95ed8 100644
--- a/sim/arm/armvirt.c
+++ b/sim/arm/armvirt.c
@@ -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);
}
diff --git a/sim/arm/bag.c b/sim/arm/bag.c
deleted file mode 100644
index f1b6a2c..0000000
--- a/sim/arm/bag.c
+++ /dev/null
@@ -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;
- }
-}
diff --git a/sim/arm/bag.h b/sim/arm/bag.h
deleted file mode 100644
index 6a237c2..0000000
--- a/sim/arm/bag.h
+++ /dev/null
@@ -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);
diff --git a/sim/arm/communicate.c b/sim/arm/communicate.c
deleted file mode 100644
index 4d97647..0000000
--- a/sim/arm/communicate.c
+++ /dev/null
@@ -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;
-}
diff --git a/sim/arm/communicate.h b/sim/arm/communicate.h
deleted file mode 100644
index e234246..0000000
--- a/sim/arm/communicate.h
+++ /dev/null
@@ -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];
diff --git a/sim/arm/dbg_conf.h b/sim/arm/dbg_conf.h
deleted file mode 100644
index 27c486c..0000000
--- a/sim/arm/dbg_conf.h
+++ /dev/null
@@ -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
diff --git a/sim/arm/dbg_cp.h b/sim/arm/dbg_cp.h
deleted file mode 100644
index 640d1f2..0000000
--- a/sim/arm/dbg_cp.h
+++ /dev/null
@@ -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
diff --git a/sim/arm/dbg_hif.h b/sim/arm/dbg_hif.h
deleted file mode 100644
index a4c48c2..0000000
--- a/sim/arm/dbg_hif.h
+++ /dev/null
@@ -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;
-};
diff --git a/sim/arm/dbg_rdi.h b/sim/arm/dbg_rdi.h
index 34e4354..a312c07 100644
--- a/sim/arm/dbg_rdi.h
+++ b/sim/arm/dbg_rdi.h
@@ -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;
diff --git a/sim/arm/gdbhost.c b/sim/arm/gdbhost.c
deleted file mode 100644
index aacaacc..0000000
--- a/sim/arm/gdbhost.c
+++ /dev/null
@@ -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;
-}
diff --git a/sim/arm/gdbhost.h b/sim/arm/gdbhost.h
deleted file mode 100644
index f24fb60..0000000
--- a/sim/arm/gdbhost.h
+++ /dev/null
@@ -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);
diff --git a/sim/arm/kid.c b/sim/arm/kid.c
deleted file mode 100644
index 340b999..0000000
--- a/sim/arm/kid.c
+++ /dev/null
@@ -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);
- }
- }
-}
diff --git a/sim/arm/main.c b/sim/arm/main.c
deleted file mode 100644
index 2ce1af1..0000000
--- a/sim/arm/main.c
+++ /dev/null
@@ -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;
-}
diff --git a/sim/arm/parent.c b/sim/arm/parent.c
deleted file mode 100644
index ef33d3f..0000000
--- a/sim/arm/parent.c
+++ /dev/null
@@ -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);
- }
- }
-}
diff --git a/sim/arm/wrapper.c b/sim/arm/wrapper.c
index 79f0b1d..db96cca 100644
--- a/sim/arm/wrapper.c
+++ b/sim/arm/wrapper.c
@@ -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,