1999-04-16 03:35:26 +02:00
|
|
|
/* 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 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|
|
|
|
|
|
|
/***********************************************************/
|
|
|
|
/* 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 */
|
2000-02-05 08:30:26 +01:00
|
|
|
extern int wait_for_osreply (ARMword * reply);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
/* 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];
|
|
|
|
|
2000-02-05 08:30:26 +01:00
|
|
|
void
|
|
|
|
myprint (void *arg, const char *format, va_list ap)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
|
|
|
fprintf (stderr, "Host: myprint\n");
|
|
|
|
#endif
|
|
|
|
vfprintf (stderr, format, ap);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Waits for a keypress on the debuggers' keyboard */
|
2000-02-05 08:30:26 +01:00
|
|
|
void
|
|
|
|
mypause (void *arg)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
|
|
|
fprintf (stderr, "Host: mypause\n");
|
|
|
|
#endif
|
2000-02-05 08:30:26 +01:00
|
|
|
} /* I do love exciting functions */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2000-02-05 08:30:26 +01:00
|
|
|
void
|
|
|
|
mywritec (void *arg, int c)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
2000-02-05 08:30:26 +01:00
|
|
|
fprintf (stderr, "Mywrite : %c\n", c);
|
1999-04-16 03:35:26 +02:00
|
|
|
#endif
|
2000-02-05 08:30:26 +01:00
|
|
|
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);
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
|
2000-02-05 08:30:26 +01:00
|
|
|
int
|
|
|
|
myreadc (void *arg)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
char c;
|
|
|
|
ARMword x;
|
2000-02-05 08:30:26 +01:00
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
#ifdef DEBUG
|
2000-02-05 08:30:26 +01:00
|
|
|
fprintf (stderr, "Host: myreadc\n");
|
1999-04-16 03:35:26 +02:00
|
|
|
#endif
|
2000-02-05 08:30:26 +01:00
|
|
|
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);
|
1999-04-16 03:35:26 +02:00
|
|
|
return (x);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-02-05 08:30:26 +01:00
|
|
|
int
|
|
|
|
mywrite (void *arg, char const *buffer, int len)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
2000-02-05 08:30:26 +01:00
|
|
|
fprintf (stderr, "Host: mywrite\n");
|
1999-04-16 03:35:26 +02:00
|
|
|
#endif
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2000-02-05 08:30:26 +01:00
|
|
|
char *
|
|
|
|
mygets (void *arg, char *buffer, int len)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
2000-02-05 08:30:26 +01:00
|
|
|
fprintf (stderr, "Host: mygets\n");
|
1999-04-16 03:35:26 +02:00
|
|
|
#endif
|
|
|
|
return buffer;
|
|
|
|
}
|