]>
Commit | Line | Data |
---|---|---|
c906108c SS |
1 | /* gdbhost.c -- ARMulator RDP to gdb comms code: ARM6 Instruction Emulator. |
2 | Copyright (C) 1994 Advanced RISC Machines Ltd. | |
3 | ||
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. | |
8 | ||
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. | |
13 | ||
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 | |
380d9419 | 16 | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ |
c906108c SS |
17 | |
18 | /***********************************************************/ | |
19 | /* Functions that communicate info back to the debugger... */ | |
20 | /***********************************************************/ | |
21 | ||
22 | #include <stdio.h> | |
23 | #include <stdarg.h> | |
24 | #include "armdefs.h" | |
25 | #include "communicate.h" | |
26 | #include "dbg_rdi.h" | |
27 | #include "armos.h" | |
28 | ||
29 | #define OS_SendNothing 0x0 | |
30 | #define OS_SendChar 0x1 | |
31 | #define OS_SendWord 0x2 | |
32 | #define OS_SendString 0x3 | |
33 | ||
34 | /* Defined in kid.c */ | |
dfcd3bfb | 35 | extern int wait_for_osreply (ARMword * reply); |
c906108c SS |
36 | |
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 */ | |
40 | int DebuggerARMul[2]; | |
41 | ||
42 | /* The pipes between the two processes */ | |
43 | int mumkid[2]; | |
44 | int kidmum[2]; | |
45 | ||
dfcd3bfb JM |
46 | void |
47 | myprint (void *arg, const char *format, va_list ap) | |
c906108c SS |
48 | { |
49 | #ifdef DEBUG | |
50 | fprintf (stderr, "Host: myprint\n"); | |
51 | #endif | |
52 | vfprintf (stderr, format, ap); | |
53 | } | |
54 | ||
55 | ||
56 | /* Waits for a keypress on the debuggers' keyboard */ | |
dfcd3bfb JM |
57 | void |
58 | mypause (void *arg) | |
c906108c SS |
59 | { |
60 | #ifdef DEBUG | |
61 | fprintf (stderr, "Host: mypause\n"); | |
62 | #endif | |
dfcd3bfb | 63 | } /* I do love exciting functions */ |
c906108c | 64 | |
dfcd3bfb JM |
65 | void |
66 | mywritec (void *arg, int c) | |
c906108c SS |
67 | { |
68 | #ifdef DEBUG | |
dfcd3bfb | 69 | fprintf (stderr, "Mywrite : %c\n", c); |
c906108c | 70 | #endif |
dfcd3bfb JM |
71 | MYwrite_char (kidmum[1], RDP_OSOp); /* OS Operation Request Message */ |
72 | MYwrite_word (kidmum[1], SWI_WriteC); /* Print... */ | |
73 | MYwrite_char (kidmum[1], OS_SendChar); /* ...a single character */ | |
74 | MYwrite_char (kidmum[1], (unsigned char) c); | |
75 | ||
76 | wait_for_osreply ((ARMword *) 0); | |
c906108c SS |
77 | } |
78 | ||
dfcd3bfb JM |
79 | int |
80 | myreadc (void *arg) | |
c906108c SS |
81 | { |
82 | char c; | |
83 | ARMword x; | |
dfcd3bfb | 84 | |
c906108c | 85 | #ifdef DEBUG |
dfcd3bfb | 86 | fprintf (stderr, "Host: myreadc\n"); |
c906108c | 87 | #endif |
dfcd3bfb JM |
88 | MYwrite_char (kidmum[1], RDP_OSOp); /* OS Operation Request Message */ |
89 | MYwrite_word (kidmum[1], SWI_ReadC); /* Read... */ | |
90 | MYwrite_char (kidmum[1], OS_SendNothing); | |
91 | ||
92 | c = wait_for_osreply (&x); | |
c906108c SS |
93 | return (x); |
94 | } | |
95 | ||
96 | ||
dfcd3bfb JM |
97 | int |
98 | mywrite (void *arg, char const *buffer, int len) | |
c906108c SS |
99 | { |
100 | #ifdef DEBUG | |
dfcd3bfb | 101 | fprintf (stderr, "Host: mywrite\n"); |
c906108c SS |
102 | #endif |
103 | return 0; | |
104 | } | |
105 | ||
dfcd3bfb JM |
106 | char * |
107 | mygets (void *arg, char *buffer, int len) | |
c906108c SS |
108 | { |
109 | #ifdef DEBUG | |
dfcd3bfb | 110 | fprintf (stderr, "Host: mygets\n"); |
c906108c SS |
111 | #endif |
112 | return buffer; | |
113 | } |