1 /* gdbhost.c -- ARMulator RDP to gdb comms code: ARM6 Instruction Emulator.
2 Copyright (C) 1994 Advanced RISC Machines Ltd.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
18 /***********************************************************/
19 /* Functions that communicate info back to the debugger... */
20 /***********************************************************/
25 #include "communicate.h"
29 #define OS_SendNothing 0x0
30 #define OS_SendChar 0x1
31 #define OS_SendWord 0x2
32 #define OS_SendString 0x3
34 /* Defined in kid.c */
35 extern int wait_for_osreply(ARMword
*reply
);
37 /* A pipe for handling SWI return values that goes straight from the */
38 /* parent to the ARMulator host interface, bypassing the childs RDP */
39 /* to RDI interpreter */
42 /* The pipes between the two processes */
46 void myprint (void *arg
, const char *format
, va_list ap
)
49 fprintf (stderr
, "Host: myprint\n");
51 vfprintf (stderr
, format
, ap
);
55 /* Waits for a keypress on the debuggers' keyboard */
56 void mypause (void *arg
)
59 fprintf (stderr
, "Host: mypause\n");
61 } /* I do love exciting functions */
63 void mywritec(void *arg
, int c
)
66 fprintf(stderr
, "Mywrite : %c\n", c
);
68 MYwrite_char(kidmum
[1], RDP_OSOp
); /* OS Operation Request Message */
69 MYwrite_word(kidmum
[1], SWI_WriteC
); /* Print... */
70 MYwrite_char(kidmum
[1], OS_SendChar
); /* ...a single character */
71 MYwrite_char(kidmum
[1], (unsigned char) c
);
73 wait_for_osreply((ARMword
*) 0);
76 int myreadc(void *arg
)
82 fprintf(stderr
, "Host: myreadc\n");
84 MYwrite_char(kidmum
[1], RDP_OSOp
); /* OS Operation Request Message */
85 MYwrite_word(kidmum
[1], SWI_ReadC
); /* Read... */
86 MYwrite_char(kidmum
[1], OS_SendNothing
);
88 c
= wait_for_osreply(&x
);
93 int mywrite(void *arg
, char const *buffer
, int len
)
96 fprintf(stderr
, "Host: mywrite\n");
101 char *mygets(void *arg
, char *buffer
, int len
)
104 fprintf(stderr
, "Host: mygets\n");