]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/gdb/gdb/remote-udi.c
This file was not part of the GDB 5.2.1 import and should have been
[FreeBSD/FreeBSD.git] / contrib / gdb / gdb / remote-udi.c
1 /* OBSOLETE /* Remote debugging interface for AMD 29k interfaced via UDI, for GDB. */
2 /* OBSOLETE    Copyright 1990, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 */
3 /* OBSOLETE    Free Software Foundation, Inc. */
4 /* OBSOLETE    Written by Daniel Mann.  Contributed by AMD. */
5 /* OBSOLETE  */
6 /* OBSOLETE    This file is part of GDB. */
7 /* OBSOLETE  */
8 /* OBSOLETE    This program is free software; you can redistribute it and/or modify */
9 /* OBSOLETE    it under the terms of the GNU General Public License as published by */
10 /* OBSOLETE    the Free Software Foundation; either version 2 of the License, or */
11 /* OBSOLETE    (at your option) any later version. */
12 /* OBSOLETE  */
13 /* OBSOLETE    This program is distributed in the hope that it will be useful, */
14 /* OBSOLETE    but WITHOUT ANY WARRANTY; without even the implied warranty of */
15 /* OBSOLETE    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the */
16 /* OBSOLETE    GNU General Public License for more details. */
17 /* OBSOLETE  */
18 /* OBSOLETE    You should have received a copy of the GNU General Public License */
19 /* OBSOLETE    along with this program; if not, write to the Free Software */
20 /* OBSOLETE    Foundation, Inc., 59 Temple Place - Suite 330, */
21 /* OBSOLETE    Boston, MA 02111-1307, USA.  */ */
22 /* OBSOLETE  */
23 /* OBSOLETE /* This is like remote.c but uses the Universal Debug Interface (UDI) to  */
24 /* OBSOLETE    talk to the target hardware (or simulator).  UDI is a TCP/IP based */
25 /* OBSOLETE    protocol; for hardware that doesn't run TCP, an interface adapter  */
26 /* OBSOLETE    daemon talks UDI on one side, and talks to the hardware (typically */
27 /* OBSOLETE    over a serial port) on the other side. */
28 /* OBSOLETE  */
29 /* OBSOLETE    - Originally written by Daniel Mann at AMD for MiniMON and gdb 3.91.6. */
30 /* OBSOLETE    - David Wood (wood@lab.ultra.nyu.edu) at New York University adapted this */
31 /* OBSOLETE    file to gdb 3.95.  I was unable to get this working on sun3os4 */
32 /* OBSOLETE    with termio, only with sgtty. */
33 /* OBSOLETE    - Daniel Mann at AMD took the 3.95 adaptions above and replaced */
34 /* OBSOLETE    MiniMON interface with UDI-p interface.        */ */
35 /* OBSOLETE  */
36 /* OBSOLETE #include "defs.h" */
37 /* OBSOLETE #include "frame.h" */
38 /* OBSOLETE #include "inferior.h" */
39 /* OBSOLETE #include "value.h" */
40 /* OBSOLETE #include <ctype.h> */
41 /* OBSOLETE #include <fcntl.h> */
42 /* OBSOLETE #include <errno.h> */
43 /* OBSOLETE #include "gdb_string.h" */
44 /* OBSOLETE #include "terminal.h" */
45 /* OBSOLETE #include "target.h" */
46 /* OBSOLETE #include "29k-share/udi/udiproc.h" */
47 /* OBSOLETE #include "gdbcmd.h" */
48 /* OBSOLETE #include "bfd.h" */
49 /* OBSOLETE #include "gdbcore.h"                /* For download function */ */
50 /* OBSOLETE #include "regcache.h" */
51 /* OBSOLETE  */
52 /* OBSOLETE /* access the register store directly, without going through */
53 /* OBSOLETE    the normal handler functions. This avoids an extra data copy.  */ */
54 /* OBSOLETE  */
55 /* OBSOLETE extern int stop_soon_quietly;       /* for wait_for_inferior */ */
56 /* OBSOLETE extern struct value *call_function_by_hand (); */
57 /* OBSOLETE static void udi_resume (ptid_t ptid, int step, enum target_signal sig); */
58 /* OBSOLETE static void udi_fetch_registers (int regno); */
59 /* OBSOLETE static void udi_load (char *args, int from_tty); */
60 /* OBSOLETE static void fetch_register (int regno); */
61 /* OBSOLETE static void udi_store_registers (int regno); */
62 /* OBSOLETE static int store_register (int regno); */
63 /* OBSOLETE static int regnum_to_srnum (int regno); */
64 /* OBSOLETE static void udi_close (int quitting); */
65 /* OBSOLETE static CPUSpace udi_memory_space (CORE_ADDR addr); */
66 /* OBSOLETE static int udi_write_inferior_memory (CORE_ADDR memaddr, char *myaddr, */
67 /* OBSOLETE                                   int len); */
68 /* OBSOLETE static int udi_read_inferior_memory (CORE_ADDR memaddr, char *myaddr, */
69 /* OBSOLETE                                  int len); */
70 /* OBSOLETE static void download (char *load_arg_string, int from_tty); */
71 /* OBSOLETE char CoffFileName[100] = ""; */
72 /* OBSOLETE  */
73 /* OBSOLETE #define FREEZE_MODE     (read_register(CPS_REGNUM) & 0x400) */
74 /* OBSOLETE #define USE_SHADOW_PC       ((processor_type == a29k_freeze_mode) && FREEZE_MODE) */
75 /* OBSOLETE  */
76 /* OBSOLETE static int timeout = 5; */
77 /* OBSOLETE extern struct target_ops udi_ops;   /* Forward declaration */ */
78 /* OBSOLETE  */
79 /* OBSOLETE /* Special register enumeration. */
80 /* OBSOLETE  */ */
81 /* OBSOLETE  */
82 /* OBSOLETE /******************************************************************* UDI DATA*/ */
83 /* OBSOLETE #define     MAXDATA         2*1024  /* max UDI[read/write] byte size */ */
84 /* OBSOLETE /* Descriptor for I/O to remote machine.  Initialize it to -1 so that */
85 /* OBSOLETE    udi_open knows that we don't have a file open when the program */
86 /* OBSOLETE    starts.  */ */
87 /* OBSOLETE  */
88 /* OBSOLETE UDISessionId udi_session_id = -1; */
89 /* OBSOLETE static char *udi_config_id; */
90 /* OBSOLETE  */
91 /* OBSOLETE CPUOffset IMemStart = 0; */
92 /* OBSOLETE CPUSizeT IMemSize = 0; */
93 /* OBSOLETE CPUOffset DMemStart = 0; */
94 /* OBSOLETE CPUSizeT DMemSize = 0; */
95 /* OBSOLETE CPUOffset RMemStart = 0; */
96 /* OBSOLETE CPUSizeT RMemSize = 0; */
97 /* OBSOLETE UDIUInt32 CPUPRL; */
98 /* OBSOLETE UDIUInt32 CoProcPRL; */
99 /* OBSOLETE  */
100 /* OBSOLETE UDIMemoryRange address_ranges[2];   /* Text and data */ */
101 /* OBSOLETE UDIResource entry = */
102 /* OBSOLETE {0, 0};                             /* Entry point */ */
103 /* OBSOLETE CPUSizeT stack_sizes[2];    /* Regular and memory stacks */ */
104 /* OBSOLETE  */
105 /* OBSOLETE #define     SBUF_MAX        1024    /* maximum size of string handling buffer */ */
106 /* OBSOLETE char sbuf[SBUF_MAX]; */
107 /* OBSOLETE  */
108 /* OBSOLETE typedef struct bkpt_entry_str */
109 /* OBSOLETE   { */
110 /* OBSOLETE     UDIResource Addr; */
111 /* OBSOLETE     UDIUInt32 PassCount; */
112 /* OBSOLETE     UDIBreakType Type; */
113 /* OBSOLETE     unsigned int BreakId; */
114 /* OBSOLETE   } */
115 /* OBSOLETE bkpt_entry_t; */
116 /* OBSOLETE #define             BKPT_TABLE_SIZE 40 */
117 /* OBSOLETE static bkpt_entry_t bkpt_table[BKPT_TABLE_SIZE]; */
118 /* OBSOLETE extern char dfe_errmsg[];   /* error string */ */
119 /* OBSOLETE  */
120 /* OBSOLETE /* malloc'd name of the program on the remote system.  */ */
121 /* OBSOLETE static char *prog_name = NULL; */
122 /* OBSOLETE  */
123 /* OBSOLETE /* This is called not only when we first attach, but also when the */
124 /* OBSOLETE    user types "run" after having attached.  */ */
125 /* OBSOLETE  */
126 /* OBSOLETE static void */
127 /* OBSOLETE udi_create_inferior (char *execfile, char *args, char **env) */
128 /* OBSOLETE { */
129 /* OBSOLETE   char *args1; */
130 /* OBSOLETE  */
131 /* OBSOLETE   if (execfile) */
132 /* OBSOLETE     { */
133 /* OBSOLETE       if (prog_name != NULL) */
134 /* OBSOLETE     xfree (prog_name); */
135 /* OBSOLETE       prog_name = savestring (execfile, strlen (execfile)); */
136 /* OBSOLETE     } */
137 /* OBSOLETE   else if (entry.Offset) */
138 /* OBSOLETE     execfile = ""; */
139 /* OBSOLETE   else */
140 /* OBSOLETE     error ("No image loaded into target."); */
141 /* OBSOLETE  */
142 /* OBSOLETE   if (udi_session_id < 0) */
143 /* OBSOLETE     { */
144 /* OBSOLETE       /* If the TIP is not open, open it.  */ */
145 /* OBSOLETE       if (UDIConnect (udi_config_id, &udi_session_id)) */
146 /* OBSOLETE     error ("UDIConnect() failed: %s\n", dfe_errmsg); */
147 /* OBSOLETE       /* We will need to download the program.  */ */
148 /* OBSOLETE       entry.Offset = 0; */
149 /* OBSOLETE     } */
150 /* OBSOLETE  */
151 /* OBSOLETE   inferior_ptid = pid_to_ptid (40000); */
152 /* OBSOLETE  */
153 /* OBSOLETE   if (!entry.Offset) */
154 /* OBSOLETE     download (execfile, 0); */
155 /* OBSOLETE  */
156 /* OBSOLETE   args1 = alloca (strlen (execfile) + strlen (args) + 2); */
157 /* OBSOLETE  */
158 /* OBSOLETE   if (execfile[0] == '\0') */
159 /* OBSOLETE  */
160 /* OBSOLETE     /* It is empty.  We need to quote it somehow, or else the target */
161 /* OBSOLETE        will think there is no argument being passed here.  According */
162 /* OBSOLETE        to the UDI spec it is quoted "according to TIP OS rules" which */
163 /* OBSOLETE        I guess means quoting it like the Unix shell should work */
164 /* OBSOLETE        (sounds pretty bogus to me...).  In fact it doesn't work (with */
165 /* OBSOLETE        isstip anyway), but passing in two quotes as the argument seems */
166 /* OBSOLETE        like a reasonable enough behavior anyway (I guess).  */ */
167 /* OBSOLETE  */
168 /* OBSOLETE     strcpy (args1, "''"); */
169 /* OBSOLETE   else */
170 /* OBSOLETE     strcpy (args1, execfile); */
171 /* OBSOLETE   strcat (args1, " "); */
172 /* OBSOLETE   strcat (args1, args); */
173 /* OBSOLETE  */
174 /* OBSOLETE   UDIInitializeProcess (address_ranges,             /* ProcessMemory[] */ */
175 /* OBSOLETE                     (UDIInt) 2,     /* NumberOfRanges */ */
176 /* OBSOLETE                     entry,  /* EntryPoint */ */
177 /* OBSOLETE                     stack_sizes,    /* *StackSizes */ */
178 /* OBSOLETE                     (UDIInt) 2,     /* NumberOfStacks */ */
179 /* OBSOLETE                     args1); /* ArgString */ */
180 /* OBSOLETE  */
181 /* OBSOLETE   init_wait_for_inferior (); */
182 /* OBSOLETE   clear_proceed_status (); */
183 /* OBSOLETE   proceed (-1, TARGET_SIGNAL_DEFAULT, 0); */
184 /* OBSOLETE } */
185 /* OBSOLETE  */
186 /* OBSOLETE static void */
187 /* OBSOLETE udi_mourn (void) */
188 /* OBSOLETE { */
189 /* OBSOLETE #if 0 */
190 /* OBSOLETE   /* Requiring "target udi" each time you run is a major pain.  I suspect */
191 /* OBSOLETE      this was just blindy copied from remote.c, in which "target" and */
192 /* OBSOLETE      "run" are combined.  Having a udi target without an inferior seems */
193 /* OBSOLETE      to work between "target udi" and "run", so why not now?  */ */
194 /* OBSOLETE   pop_target ();            /* Pop back to no-child state */ */
195 /* OBSOLETE #endif */
196 /* OBSOLETE   /* But if we're going to want to run it again, we better remove the */
197 /* OBSOLETE      breakpoints...  */ */
198 /* OBSOLETE   remove_breakpoints (); */
199 /* OBSOLETE   generic_mourn_inferior (); */
200 /* OBSOLETE } */
201 /* OBSOLETE  */
202 /* OBSOLETE /******************************************************************** UDI_OPEN */
203 /* OBSOLETE ** Open a connection to remote TIP. */
204 /* OBSOLETE    NAME is the socket domain used for communication with the TIP, */
205 /* OBSOLETE    then a space and the socket name or TIP-host name. */
206 /* OBSOLETE    '<udi_udi_config_id>' for example. */
207 /* OBSOLETE  */ */
208 /* OBSOLETE  */
209 /* OBSOLETE /* XXX - need cleanups for udiconnect for various failures!!! */ */
210 /* OBSOLETE  */
211 /* OBSOLETE static void */
212 /* OBSOLETE udi_open (char *name, int from_tty) */
213 /* OBSOLETE { */
214 /* OBSOLETE   unsigned int prl; */
215 /* OBSOLETE   char *p; */
216 /* OBSOLETE   int cnt; */
217 /* OBSOLETE   UDIMemoryRange KnownMemory[10]; */
218 /* OBSOLETE   UDIUInt32 ChipVersions[10]; */
219 /* OBSOLETE   UDIInt NumberOfRanges = 10; */
220 /* OBSOLETE   UDIInt NumberOfChips = 10; */
221 /* OBSOLETE   UDIPId PId; */
222 /* OBSOLETE   UDIUInt32 TIPId, TargetId, DFEId, DFE, TIP, DFEIPCId, TIPIPCId; */
223 /* OBSOLETE  */
224 /* OBSOLETE   target_preopen (from_tty); */
225 /* OBSOLETE  */
226 /* OBSOLETE   entry.Offset = 0; */
227 /* OBSOLETE  */
228 /* OBSOLETE   for (cnt = 0; cnt < BKPT_TABLE_SIZE; cnt++) */
229 /* OBSOLETE     bkpt_table[cnt].Type = 0; */
230 /* OBSOLETE  */
231 /* OBSOLETE   if (udi_config_id) */
232 /* OBSOLETE     xfree (udi_config_id); */
233 /* OBSOLETE  */
234 /* OBSOLETE   if (!name) */
235 /* OBSOLETE     error ("Usage: target udi config_id, where config_id appears in udi_soc file"); */
236 /* OBSOLETE  */
237 /* OBSOLETE   udi_config_id = xstrdup (strtok (name, " \t")); */
238 /* OBSOLETE  */
239 /* OBSOLETE   if (UDIConnect (udi_config_id, &udi_session_id)) */
240 /* OBSOLETE     /* FIXME: Should set udi_session_id to -1 here.  */ */
241 /* OBSOLETE     error ("UDIConnect() failed: %s\n", dfe_errmsg); */
242 /* OBSOLETE  */
243 /* OBSOLETE   push_target (&udi_ops); */
244 /* OBSOLETE  */
245 /* OBSOLETE   /* */
246 /* OBSOLETE      ** Initialize target configuration structure (global) */
247 /* OBSOLETE    */ */
248 /* OBSOLETE   if (UDIGetTargetConfig (KnownMemory, &NumberOfRanges, */
249 /* OBSOLETE                       ChipVersions, &NumberOfChips)) */
250 /* OBSOLETE     error ("UDIGetTargetConfig() failed"); */
251 /* OBSOLETE   if (NumberOfChips > 2) */
252 /* OBSOLETE     fprintf_unfiltered (gdb_stderr, "Target has more than one processor\n"); */
253 /* OBSOLETE   for (cnt = 0; cnt < NumberOfRanges; cnt++) */
254 /* OBSOLETE     { */
255 /* OBSOLETE       switch (KnownMemory[cnt].Space) */
256 /* OBSOLETE     { */
257 /* OBSOLETE     default: */
258 /* OBSOLETE       fprintf_unfiltered (gdb_stderr, "UDIGetTargetConfig() unknown memory space\n"); */
259 /* OBSOLETE       break; */
260 /* OBSOLETE     case UDI29KCP_S: */
261 /* OBSOLETE       break; */
262 /* OBSOLETE     case UDI29KIROMSpace: */
263 /* OBSOLETE       RMemStart = KnownMemory[cnt].Offset; */
264 /* OBSOLETE       RMemSize = KnownMemory[cnt].Size; */
265 /* OBSOLETE       break; */
266 /* OBSOLETE     case UDI29KIRAMSpace: */
267 /* OBSOLETE       IMemStart = KnownMemory[cnt].Offset; */
268 /* OBSOLETE       IMemSize = KnownMemory[cnt].Size; */
269 /* OBSOLETE       break; */
270 /* OBSOLETE     case UDI29KDRAMSpace: */
271 /* OBSOLETE       DMemStart = KnownMemory[cnt].Offset; */
272 /* OBSOLETE       DMemSize = KnownMemory[cnt].Size; */
273 /* OBSOLETE       break; */
274 /* OBSOLETE     } */
275 /* OBSOLETE     } */
276 /* OBSOLETE  */
277 /* OBSOLETE   a29k_get_processor_type (); */
278 /* OBSOLETE  */
279 /* OBSOLETE   if (UDICreateProcess (&PId)) */
280 /* OBSOLETE     fprintf_unfiltered (gdb_stderr, "UDICreateProcess() failed\n"); */
281 /* OBSOLETE  */
282 /* OBSOLETE   /* Print out some stuff, letting the user now what's going on */ */
283 /* OBSOLETE   if (UDICapabilities (&TIPId, &TargetId, DFEId, DFE, &TIP, &DFEIPCId, */
284 /* OBSOLETE                    &TIPIPCId, sbuf)) */
285 /* OBSOLETE     error ("UDICapabilities() failed"); */
286 /* OBSOLETE   if (from_tty) */
287 /* OBSOLETE     { */
288 /* OBSOLETE       printf_filtered ("Connected via UDI socket,\n\ */
289 /* OBSOLETE  DFE-IPC version %x.%x.%x  TIP-IPC version %x.%x.%x  TIP version %x.%x.%x\n %s\n", */
290 /* OBSOLETE            (DFEIPCId >> 8) & 0xf, (DFEIPCId >> 4) & 0xf, DFEIPCId & 0xf, */
291 /* OBSOLETE            (TIPIPCId >> 8) & 0xf, (TIPIPCId >> 4) & 0xf, TIPIPCId & 0xf, */
292 /* OBSOLETE            (TargetId >> 8) & 0xf, (TargetId >> 4) & 0xf, TargetId & 0xf, */
293 /* OBSOLETE                    sbuf); */
294 /* OBSOLETE     } */
295 /* OBSOLETE } */
296 /* OBSOLETE  */
297 /* OBSOLETE /******************************************************************* UDI_CLOSE */
298 /* OBSOLETE    Close the open connection to the TIP process. */
299 /* OBSOLETE    Use this when you want to detach and do something else */
300 /* OBSOLETE    with your gdb.  */ */
301 /* OBSOLETE static void */
302 /* OBSOLETE udi_close (                 /*FIXME: how is quitting used */ */
303 /* OBSOLETE         int quitting) */
304 /* OBSOLETE { */
305 /* OBSOLETE   if (udi_session_id < 0) */
306 /* OBSOLETE     return; */
307 /* OBSOLETE  */
308 /* OBSOLETE   /* We should never get here if there isn't something valid in */
309 /* OBSOLETE      udi_session_id.  */ */
310 /* OBSOLETE  */
311 /* OBSOLETE   if (UDIDisconnect (udi_session_id, UDITerminateSession)) */
312 /* OBSOLETE     { */
313 /* OBSOLETE       if (quitting) */
314 /* OBSOLETE     warning ("UDIDisconnect() failed in udi_close"); */
315 /* OBSOLETE       else */
316 /* OBSOLETE     error ("UDIDisconnect() failed in udi_close"); */
317 /* OBSOLETE     } */
318 /* OBSOLETE  */
319 /* OBSOLETE   /* Do not try to close udi_session_id again, later in the program.  */ */
320 /* OBSOLETE   udi_session_id = -1; */
321 /* OBSOLETE   inferior_ptid = null_ptid; */
322 /* OBSOLETE  */
323 /* OBSOLETE   printf_filtered ("  Ending remote debugging\n"); */
324 /* OBSOLETE } */
325 /* OBSOLETE  */
326 /* OBSOLETE /**************************************************************** UDI_ATACH */ */
327 /* OBSOLETE /* Attach to a program that is already loaded and running  */
328 /* OBSOLETE  * Upon exiting the process's execution is stopped. */
329 /* OBSOLETE  */ */
330 /* OBSOLETE static void */
331 /* OBSOLETE udi_attach (char *args, int from_tty) */
332 /* OBSOLETE { */
333 /* OBSOLETE   UDIResource From; */
334 /* OBSOLETE   UDIInt32 PC_adds; */
335 /* OBSOLETE   UDICount Count = 1; */
336 /* OBSOLETE   UDISizeT Size = 4; */
337 /* OBSOLETE   UDICount CountDone; */
338 /* OBSOLETE   UDIBool HostEndian = 0; */
339 /* OBSOLETE   UDIError err; */
340 /* OBSOLETE  */
341 /* OBSOLETE   if (args == NULL) */
342 /* OBSOLETE     error_no_arg ("program to attach"); */
343 /* OBSOLETE  */
344 /* OBSOLETE   if (udi_session_id < 0) */
345 /* OBSOLETE     error ("UDI connection not opened yet, use the 'target udi' command.\n"); */
346 /* OBSOLETE  */
347 /* OBSOLETE   if (from_tty) */
348 /* OBSOLETE     printf_unfiltered ("Attaching to remote program %s...\n", prog_name); */
349 /* OBSOLETE  */
350 /* OBSOLETE   UDIStop (); */
351 /* OBSOLETE   From.Space = UDI29KSpecialRegs; */
352 /* OBSOLETE   From.Offset = 11; */
353 /* OBSOLETE   if (err = UDIRead (From, &PC_adds, Count, Size, &CountDone, HostEndian)) */
354 /* OBSOLETE     error ("UDIRead failed in udi_attach"); */
355 /* OBSOLETE   printf_unfiltered ("Remote process is now halted, pc1 = 0x%x.\n", PC_adds); */
356 /* OBSOLETE } */
357 /* OBSOLETE /************************************************************* UDI_DETACH */ */
358 /* OBSOLETE /* Terminate the open connection to the TIP process. */
359 /* OBSOLETE    Use this when you want to detach and do something else */
360 /* OBSOLETE    with your gdb.  Leave remote process running (with no breakpoints set). */ */
361 /* OBSOLETE static void */
362 /* OBSOLETE udi_detach (char *args, int from_tty) */
363 /* OBSOLETE { */
364 /* OBSOLETE  */
365 /* OBSOLETE   remove_breakpoints ();    /* Just in case there were any left in */ */
366 /* OBSOLETE  */
367 /* OBSOLETE   if (UDIDisconnect (udi_session_id, UDIContinueSession)) */
368 /* OBSOLETE     error ("UDIDisconnect() failed in udi_detach"); */
369 /* OBSOLETE  */
370 /* OBSOLETE   /* Don't try to UDIDisconnect it again in udi_close, which is called from */
371 /* OBSOLETE      pop_target.  */ */
372 /* OBSOLETE   udi_session_id = -1; */
373 /* OBSOLETE   inferior_ptid = null_ptid; */
374 /* OBSOLETE  */
375 /* OBSOLETE   pop_target (); */
376 /* OBSOLETE  */
377 /* OBSOLETE   if (from_tty) */
378 /* OBSOLETE     printf_unfiltered ("Detaching from TIP\n"); */
379 /* OBSOLETE } */
380 /* OBSOLETE  */
381 /* OBSOLETE  */
382 /* OBSOLETE /****************************************************************** UDI_RESUME */
383 /* OBSOLETE ** Tell the remote machine to resume.  */ */
384 /* OBSOLETE  */
385 /* OBSOLETE static void */
386 /* OBSOLETE udi_resume (ptid_t ptid, int step, enum target_signal sig) */
387 /* OBSOLETE { */
388 /* OBSOLETE   UDIError tip_error; */
389 /* OBSOLETE   UDIUInt32 Steps = 1; */
390 /* OBSOLETE   UDIStepType StepType = UDIStepNatural; */
391 /* OBSOLETE   UDIRange Range; */
392 /* OBSOLETE  */
393 /* OBSOLETE   if (step)                 /* step 1 instruction */ */
394 /* OBSOLETE     { */
395 /* OBSOLETE       tip_error = UDIStep (Steps, StepType, Range); */
396 /* OBSOLETE       if (!tip_error) */
397 /* OBSOLETE     return; */
398 /* OBSOLETE  */
399 /* OBSOLETE       fprintf_unfiltered (gdb_stderr, "UDIStep() error = %d\n", tip_error); */
400 /* OBSOLETE       error ("failed in udi_resume"); */
401 /* OBSOLETE     } */
402 /* OBSOLETE  */
403 /* OBSOLETE   if (UDIExecute ()) */
404 /* OBSOLETE     error ("UDIExecute() failed in udi_resume"); */
405 /* OBSOLETE } */
406 /* OBSOLETE  */
407 /* OBSOLETE /******************************************************************** UDI_WAIT */
408 /* OBSOLETE ** Wait until the remote machine stops, then return, */
409 /* OBSOLETE    storing status in STATUS just as `wait' would.  */ */
410 /* OBSOLETE  */
411 /* OBSOLETE static ptid_t */
412 /* OBSOLETE udi_wait (ptid_t ptid, struct target_waitstatus *status) */
413 /* OBSOLETE { */
414 /* OBSOLETE   UDIInt32 MaxTime; */
415 /* OBSOLETE   UDIPId PId; */
416 /* OBSOLETE   UDIInt32 StopReason; */
417 /* OBSOLETE   UDISizeT CountDone; */
418 /* OBSOLETE   int old_timeout = timeout; */
419 /* OBSOLETE   int old_immediate_quit = immediate_quit; */
420 /* OBSOLETE   int i; */
421 /* OBSOLETE  */
422 /* OBSOLETE   status->kind = TARGET_WAITKIND_EXITED; */
423 /* OBSOLETE   status->value.integer = 0; */
424 /* OBSOLETE  */
425 /* OBSOLETE /* wait for message to arrive. It should be: */
426 /* OBSOLETE    If the target stops executing, udi_wait() should return. */
427 /* OBSOLETE  */ */
428 /* OBSOLETE   timeout = 0;                      /* Wait indefinetly for a message */ */
429 /* OBSOLETE   immediate_quit = 1;               /* Helps ability to QUIT */ */
430 /* OBSOLETE  */
431 /* OBSOLETE   while (1) */
432 /* OBSOLETE     { */
433 /* OBSOLETE       i = 0; */
434 /* OBSOLETE       MaxTime = UDIWaitForever; */
435 /* OBSOLETE       UDIWait (MaxTime, &PId, &StopReason); */
436 /* OBSOLETE       QUIT;                 /* Let user quit if they want */ */
437 /* OBSOLETE  */
438 /* OBSOLETE       switch (StopReason & UDIGrossState) */
439 /* OBSOLETE     { */
440 /* OBSOLETE     case UDIStdoutReady: */
441 /* OBSOLETE       if (UDIGetStdout (sbuf, (UDISizeT) SBUF_MAX, &CountDone)) */
442 /* OBSOLETE         /* This is said to happen if the program tries to output */
443 /* OBSOLETE            a whole bunch of output (more than SBUF_MAX, I would */
444 /* OBSOLETE            guess).  It doesn't seem to happen with the simulator.  */ */
445 /* OBSOLETE         warning ("UDIGetStdout() failed in udi_wait"); */
446 /* OBSOLETE       fwrite (sbuf, 1, CountDone, stdout); */
447 /* OBSOLETE       gdb_flush (gdb_stdout); */
448 /* OBSOLETE       continue; */
449 /* OBSOLETE  */
450 /* OBSOLETE     case UDIStderrReady: */
451 /* OBSOLETE       UDIGetStderr (sbuf, (UDISizeT) SBUF_MAX, &CountDone); */
452 /* OBSOLETE       fwrite (sbuf, 1, CountDone, stderr); */
453 /* OBSOLETE       gdb_flush (gdb_stderr); */
454 /* OBSOLETE       continue; */
455 /* OBSOLETE  */
456 /* OBSOLETE     case UDIStdinNeeded: */
457 /* OBSOLETE       { */
458 /* OBSOLETE         int ch; */
459 /* OBSOLETE         i = 0; */
460 /* OBSOLETE         do */
461 /* OBSOLETE           { */
462 /* OBSOLETE             ch = getchar (); */
463 /* OBSOLETE             if (ch == EOF) */
464 /* OBSOLETE               break; */
465 /* OBSOLETE             sbuf[i++] = ch; */
466 /* OBSOLETE           } */
467 /* OBSOLETE         while (i < SBUF_MAX && ch != '\n'); */
468 /* OBSOLETE         UDIPutStdin (sbuf, (UDISizeT) i, &CountDone); */
469 /* OBSOLETE         continue; */
470 /* OBSOLETE       } */
471 /* OBSOLETE  */
472 /* OBSOLETE     case UDIRunning: */
473 /* OBSOLETE       /* In spite of the fact that we told UDIWait to wait forever, it will */
474 /* OBSOLETE          return spuriously sometimes.  */ */
475 /* OBSOLETE     case UDIStdinModeX: */
476 /* OBSOLETE       continue; */
477 /* OBSOLETE     default: */
478 /* OBSOLETE       break; */
479 /* OBSOLETE     } */
480 /* OBSOLETE       break; */
481 /* OBSOLETE     } */
482 /* OBSOLETE  */
483 /* OBSOLETE   switch (StopReason & UDIGrossState) */
484 /* OBSOLETE     { */
485 /* OBSOLETE     case UDITrapped: */
486 /* OBSOLETE       printf_unfiltered ("Am290*0 received vector number %d\n", StopReason >> 24); */
487 /* OBSOLETE  */
488 /* OBSOLETE       switch ((StopReason >> 8) & 0xff) */
489 /* OBSOLETE     { */
490 /* OBSOLETE     case 0:         /* Illegal opcode */ */
491 /* OBSOLETE       printf_unfiltered ("  (break point)\n"); */
492 /* OBSOLETE       status->kind = TARGET_WAITKIND_STOPPED; */
493 /* OBSOLETE       status->value.sig = TARGET_SIGNAL_TRAP; */
494 /* OBSOLETE       break; */
495 /* OBSOLETE     case 1:         /* Unaligned Access */ */
496 /* OBSOLETE       status->kind = TARGET_WAITKIND_STOPPED; */
497 /* OBSOLETE       status->value.sig = TARGET_SIGNAL_BUS; */
498 /* OBSOLETE       break; */
499 /* OBSOLETE     case 3: */
500 /* OBSOLETE     case 4: */
501 /* OBSOLETE       status->kind = TARGET_WAITKIND_STOPPED; */
502 /* OBSOLETE       status->value.sig = TARGET_SIGNAL_FPE; */
503 /* OBSOLETE       break; */
504 /* OBSOLETE     case 5:         /* Protection Violation */ */
505 /* OBSOLETE       status->kind = TARGET_WAITKIND_STOPPED; */
506 /* OBSOLETE       /* Why not SEGV?  What is a Protection Violation?  */ */
507 /* OBSOLETE       status->value.sig = TARGET_SIGNAL_ILL; */
508 /* OBSOLETE       break; */
509 /* OBSOLETE     case 6: */
510 /* OBSOLETE     case 7: */
511 /* OBSOLETE     case 8:         /* User Instruction Mapping Miss */ */
512 /* OBSOLETE     case 9:         /* User Data Mapping Miss */ */
513 /* OBSOLETE     case 10:                /* Supervisor Instruction Mapping Miss */ */
514 /* OBSOLETE     case 11:                /* Supervisor Data Mapping Miss */ */
515 /* OBSOLETE       status->kind = TARGET_WAITKIND_STOPPED; */
516 /* OBSOLETE       status->value.sig = TARGET_SIGNAL_SEGV; */
517 /* OBSOLETE       break; */
518 /* OBSOLETE     case 12: */
519 /* OBSOLETE     case 13: */
520 /* OBSOLETE       status->kind = TARGET_WAITKIND_STOPPED; */
521 /* OBSOLETE       status->value.sig = TARGET_SIGNAL_ILL; */
522 /* OBSOLETE       break; */
523 /* OBSOLETE     case 14:                /* Timer */ */
524 /* OBSOLETE       status->kind = TARGET_WAITKIND_STOPPED; */
525 /* OBSOLETE       status->value.sig = TARGET_SIGNAL_ALRM; */
526 /* OBSOLETE       break; */
527 /* OBSOLETE     case 15:                /* Trace */ */
528 /* OBSOLETE       status->kind = TARGET_WAITKIND_STOPPED; */
529 /* OBSOLETE       status->value.sig = TARGET_SIGNAL_TRAP; */
530 /* OBSOLETE       break; */
531 /* OBSOLETE     case 16:                /* INTR0 */ */
532 /* OBSOLETE     case 17:                /* INTR1 */ */
533 /* OBSOLETE     case 18:                /* INTR2 */ */
534 /* OBSOLETE     case 19:                /* INTR3/Internal */ */
535 /* OBSOLETE     case 20:                /* TRAP0 */ */
536 /* OBSOLETE     case 21:                /* TRAP1 */ */
537 /* OBSOLETE       status->kind = TARGET_WAITKIND_STOPPED; */
538 /* OBSOLETE       status->value.sig = TARGET_SIGNAL_INT; */
539 /* OBSOLETE       break; */
540 /* OBSOLETE     case 22:                /* Floating-Point Exception */ */
541 /* OBSOLETE       status->kind = TARGET_WAITKIND_STOPPED; */
542 /* OBSOLETE       /* Why not FPE?  */ */
543 /* OBSOLETE       status->value.sig = TARGET_SIGNAL_ILL; */
544 /* OBSOLETE       break; */
545 /* OBSOLETE     case 77:                /* assert 77 */ */
546 /* OBSOLETE       status->kind = TARGET_WAITKIND_STOPPED; */
547 /* OBSOLETE       status->value.sig = TARGET_SIGNAL_TRAP; */
548 /* OBSOLETE       break; */
549 /* OBSOLETE     default: */
550 /* OBSOLETE       status->kind = TARGET_WAITKIND_EXITED; */
551 /* OBSOLETE       status->value.integer = 0; */
552 /* OBSOLETE     } */
553 /* OBSOLETE       break; */
554 /* OBSOLETE     case UDINotExecuting: */
555 /* OBSOLETE       status->kind = TARGET_WAITKIND_STOPPED; */
556 /* OBSOLETE       status->value.sig = TARGET_SIGNAL_TERM; */
557 /* OBSOLETE       break; */
558 /* OBSOLETE     case UDIStopped: */
559 /* OBSOLETE       status->kind = TARGET_WAITKIND_STOPPED; */
560 /* OBSOLETE       status->value.sig = TARGET_SIGNAL_TSTP; */
561 /* OBSOLETE       break; */
562 /* OBSOLETE     case UDIWarned: */
563 /* OBSOLETE       status->kind = TARGET_WAITKIND_STOPPED; */
564 /* OBSOLETE       status->value.sig = TARGET_SIGNAL_URG; */
565 /* OBSOLETE       break; */
566 /* OBSOLETE     case UDIStepped: */
567 /* OBSOLETE     case UDIBreak: */
568 /* OBSOLETE       status->kind = TARGET_WAITKIND_STOPPED; */
569 /* OBSOLETE       status->value.sig = TARGET_SIGNAL_TRAP; */
570 /* OBSOLETE       break; */
571 /* OBSOLETE     case UDIWaiting: */
572 /* OBSOLETE       status->kind = TARGET_WAITKIND_STOPPED; */
573 /* OBSOLETE       status->value.sig = TARGET_SIGNAL_STOP; */
574 /* OBSOLETE       break; */
575 /* OBSOLETE     case UDIHalted: */
576 /* OBSOLETE       status->kind = TARGET_WAITKIND_STOPPED; */
577 /* OBSOLETE       status->value.sig = TARGET_SIGNAL_KILL; */
578 /* OBSOLETE       break; */
579 /* OBSOLETE     case UDIExited: */
580 /* OBSOLETE     default: */
581 /* OBSOLETE       status->kind = TARGET_WAITKIND_EXITED; */
582 /* OBSOLETE       status->value.integer = 0; */
583 /* OBSOLETE     } */
584 /* OBSOLETE  */
585 /* OBSOLETE   timeout = old_timeout;    /* Restore original timeout value */ */
586 /* OBSOLETE   immediate_quit = old_immediate_quit; */
587 /* OBSOLETE   return inferior_ptid; */
588 /* OBSOLETE } */
589 /* OBSOLETE  */
590 /* OBSOLETE #if 0 */
591 /* OBSOLETE /* Handy for debugging */ */
592 /* OBSOLETE udi_pc (void) */
593 /* OBSOLETE { */
594 /* OBSOLETE   UDIResource From; */
595 /* OBSOLETE   UDIUInt32 *To; */
596 /* OBSOLETE   UDICount Count; */
597 /* OBSOLETE   UDISizeT Size = 4; */
598 /* OBSOLETE   UDICount CountDone; */
599 /* OBSOLETE   UDIBool HostEndian = 0; */
600 /* OBSOLETE   UDIError err; */
601 /* OBSOLETE   int pc[2]; */
602 /* OBSOLETE   unsigned long myregs[256]; */
603 /* OBSOLETE   int i; */
604 /* OBSOLETE  */
605 /* OBSOLETE   From.Space = UDI29KPC; */
606 /* OBSOLETE   From.Offset = 0; */
607 /* OBSOLETE   To = (UDIUInt32 *) pc; */
608 /* OBSOLETE   Count = 2; */
609 /* OBSOLETE  */
610 /* OBSOLETE   err = UDIRead (From, To, Count, Size, &CountDone, HostEndian); */
611 /* OBSOLETE  */
612 /* OBSOLETE   printf_unfiltered ("err = %d, CountDone = %d, pc[0] = 0x%x, pc[1] = 0x%x\n", */
613 /* OBSOLETE                  err, CountDone, pc[0], pc[1]); */
614 /* OBSOLETE  */
615 /* OBSOLETE   udi_fetch_registers (-1); */
616 /* OBSOLETE  */
617 /* OBSOLETE   printf_unfiltered ("other pc1 = 0x%x, pc0 = 0x%x\n", *(int *) &registers[4 * PC_REGNUM], */
618 /* OBSOLETE                  *(int *) &registers[4 * NPC_REGNUM]); */
619 /* OBSOLETE  */
620 /* OBSOLETE   /* Now, read all the registers globally */ */
621 /* OBSOLETE  */
622 /* OBSOLETE   From.Space = UDI29KGlobalRegs; */
623 /* OBSOLETE   From.Offset = 0; */
624 /* OBSOLETE   err = UDIRead (From, myregs, 256, 4, &CountDone, HostEndian); */
625 /* OBSOLETE  */
626 /* OBSOLETE   printf ("err = %d, CountDone = %d\n", err, CountDone); */
627 /* OBSOLETE  */
628 /* OBSOLETE   printf ("\n"); */
629 /* OBSOLETE  */
630 /* OBSOLETE   for (i = 0; i < 256; i += 2) */
631 /* OBSOLETE     printf ("%d:\t%#10x\t%11d\t%#10x\t%11d\n", i, myregs[i], myregs[i], */
632 /* OBSOLETE         myregs[i + 1], myregs[i + 1]); */
633 /* OBSOLETE   printf ("\n"); */
634 /* OBSOLETE  */
635 /* OBSOLETE   return pc[0]; */
636 /* OBSOLETE } */
637 /* OBSOLETE #endif */
638 /* OBSOLETE  */
639 /* OBSOLETE /********************************************************** UDI_FETCH_REGISTERS */
640 /* OBSOLETE  * Read a remote register 'regno'.  */
641 /* OBSOLETE  * If regno==-1 then read all the registers. */
642 /* OBSOLETE  */ */
643 /* OBSOLETE static void */
644 /* OBSOLETE udi_fetch_registers (int regno) */
645 /* OBSOLETE { */
646 /* OBSOLETE   UDIResource From; */
647 /* OBSOLETE   UDIUInt32 *To; */
648 /* OBSOLETE   UDICount Count; */
649 /* OBSOLETE   UDISizeT Size = 4; */
650 /* OBSOLETE   UDICount CountDone; */
651 /* OBSOLETE   UDIBool HostEndian = 0; */
652 /* OBSOLETE   UDIError err; */
653 /* OBSOLETE   int i; */
654 /* OBSOLETE  */
655 /* OBSOLETE   if (regno >= 0) */
656 /* OBSOLETE     { */
657 /* OBSOLETE       fetch_register (regno); */
658 /* OBSOLETE       return; */
659 /* OBSOLETE     } */
660 /* OBSOLETE  */
661 /* OBSOLETE /* Gr1/rsp */ */
662 /* OBSOLETE  */
663 /* OBSOLETE   From.Space = UDI29KGlobalRegs; */
664 /* OBSOLETE   From.Offset = 1; */
665 /* OBSOLETE   To = (UDIUInt32 *) & registers[4 * GR1_REGNUM]; */
666 /* OBSOLETE   Count = 1; */
667 /* OBSOLETE   if (err = UDIRead (From, To, Count, Size, &CountDone, HostEndian)) */
668 /* OBSOLETE     error ("UDIRead() failed in udi_fetch_registers"); */
669 /* OBSOLETE  */
670 /* OBSOLETE   register_valid[GR1_REGNUM] = 1; */
671 /* OBSOLETE  */
672 /* OBSOLETE #if defined(GR64_REGNUM)    /* Read gr64-127 */ */
673 /* OBSOLETE  */
674 /* OBSOLETE /* Global Registers gr64-gr95 */ */
675 /* OBSOLETE  */
676 /* OBSOLETE   From.Space = UDI29KGlobalRegs; */
677 /* OBSOLETE   From.Offset = 64; */
678 /* OBSOLETE   To = (UDIUInt32 *) & registers[4 * GR64_REGNUM]; */
679 /* OBSOLETE   Count = 32; */
680 /* OBSOLETE   if (err = UDIRead (From, To, Count, Size, &CountDone, HostEndian)) */
681 /* OBSOLETE     error ("UDIRead() failed in udi_fetch_registers"); */
682 /* OBSOLETE  */
683 /* OBSOLETE   for (i = GR64_REGNUM; i < GR64_REGNUM + 32; i++) */
684 /* OBSOLETE     register_valid[i] = 1; */
685 /* OBSOLETE  */
686 /* OBSOLETE #endif /*  GR64_REGNUM */ */
687 /* OBSOLETE  */
688 /* OBSOLETE /* Global Registers gr96-gr127 */ */
689 /* OBSOLETE  */
690 /* OBSOLETE   From.Space = UDI29KGlobalRegs; */
691 /* OBSOLETE   From.Offset = 96; */
692 /* OBSOLETE   To = (UDIUInt32 *) & registers[4 * GR96_REGNUM]; */
693 /* OBSOLETE   Count = 32; */
694 /* OBSOLETE   if (err = UDIRead (From, To, Count, Size, &CountDone, HostEndian)) */
695 /* OBSOLETE     error ("UDIRead() failed in udi_fetch_registers"); */
696 /* OBSOLETE  */
697 /* OBSOLETE   for (i = GR96_REGNUM; i < GR96_REGNUM + 32; i++) */
698 /* OBSOLETE     register_valid[i] = 1; */
699 /* OBSOLETE  */
700 /* OBSOLETE /* Local Registers */ */
701 /* OBSOLETE  */
702 /* OBSOLETE   From.Space = UDI29KLocalRegs; */
703 /* OBSOLETE   From.Offset = 0; */
704 /* OBSOLETE   To = (UDIUInt32 *) & registers[4 * LR0_REGNUM]; */
705 /* OBSOLETE   Count = 128; */
706 /* OBSOLETE   if (err = UDIRead (From, To, Count, Size, &CountDone, HostEndian)) */
707 /* OBSOLETE     error ("UDIRead() failed in udi_fetch_registers"); */
708 /* OBSOLETE  */
709 /* OBSOLETE   for (i = LR0_REGNUM; i < LR0_REGNUM + 128; i++) */
710 /* OBSOLETE     register_valid[i] = 1; */
711 /* OBSOLETE  */
712 /* OBSOLETE /* Protected Special Registers */ */
713 /* OBSOLETE  */
714 /* OBSOLETE   From.Space = UDI29KSpecialRegs; */
715 /* OBSOLETE   From.Offset = 0; */
716 /* OBSOLETE   To = (UDIUInt32 *) & registers[4 * SR_REGNUM (0)]; */
717 /* OBSOLETE   Count = 15; */
718 /* OBSOLETE   if (err = UDIRead (From, To, Count, Size, &CountDone, HostEndian)) */
719 /* OBSOLETE     error ("UDIRead() failed in udi_fetch_registers"); */
720 /* OBSOLETE  */
721 /* OBSOLETE   for (i = SR_REGNUM (0); i < SR_REGNUM (0) + 15; i++) */
722 /* OBSOLETE     register_valid[i] = 1; */
723 /* OBSOLETE  */
724 /* OBSOLETE   if (USE_SHADOW_PC) */
725 /* OBSOLETE     {                               /* Let regno_to_srnum() handle the register number */ */
726 /* OBSOLETE       fetch_register (NPC_REGNUM); */
727 /* OBSOLETE       fetch_register (PC_REGNUM); */
728 /* OBSOLETE       fetch_register (PC2_REGNUM); */
729 /* OBSOLETE  */
730 /* OBSOLETE /* Unprotected Special Registers sr128-sr135 */ */
731 /* OBSOLETE  */
732 /* OBSOLETE       From.Space = UDI29KSpecialRegs; */
733 /* OBSOLETE       From.Offset = 128; */
734 /* OBSOLETE       To = (UDIUInt32 *) & registers[4 * SR_REGNUM (128)]; */
735 /* OBSOLETE       Count = 135 - 128 + 1; */
736 /* OBSOLETE       if (err = UDIRead (From, To, Count, Size, &CountDone, HostEndian)) */
737 /* OBSOLETE     error ("UDIRead() failed in udi_fetch_registers"); */
738 /* OBSOLETE  */
739 /* OBSOLETE       for (i = SR_REGNUM (128); i < SR_REGNUM (128) + 135 - 128 + 1; i++) */
740 /* OBSOLETE     register_valid[i] = 1; */
741 /* OBSOLETE     } */
742 /* OBSOLETE  */
743 /* OBSOLETE   if (remote_debug) */
744 /* OBSOLETE     { */
745 /* OBSOLETE       fprintf_unfiltered (gdb_stdlog, "Fetching all registers\n"); */
746 /* OBSOLETE       fprintf_unfiltered (gdb_stdlog, */
747 /* OBSOLETE                       "Fetching PC0 = 0x%x, PC1 = 0x%x, PC2 = 0x%x\n", */
748 /* OBSOLETE                       read_register (NPC_REGNUM), */
749 /* OBSOLETE                       read_register (PC_REGNUM), */
750 /* OBSOLETE                       read_register (PC2_REGNUM)); */
751 /* OBSOLETE     } */
752 /* OBSOLETE  */
753 /* OBSOLETE   /* There doesn't seem to be any way to get these.  */ */
754 /* OBSOLETE   { */
755 /* OBSOLETE     int val = -1; */
756 /* OBSOLETE     supply_register (FPE_REGNUM, (char *) &val); */
757 /* OBSOLETE     supply_register (INTE_REGNUM, (char *) &val); */
758 /* OBSOLETE     supply_register (FPS_REGNUM, (char *) &val); */
759 /* OBSOLETE     supply_register (EXO_REGNUM, (char *) &val); */
760 /* OBSOLETE   } */
761 /* OBSOLETE } */
762 /* OBSOLETE  */
763 /* OBSOLETE  */
764 /* OBSOLETE /********************************************************* UDI_STORE_REGISTERS */
765 /* OBSOLETE ** Store register regno into the target.   */
766 /* OBSOLETE  * If regno==-1 then store all the registers. */
767 /* OBSOLETE  */ */
768 /* OBSOLETE  */
769 /* OBSOLETE static void */
770 /* OBSOLETE udi_store_registers (int regno) */
771 /* OBSOLETE { */
772 /* OBSOLETE   UDIUInt32 *From; */
773 /* OBSOLETE   UDIResource To; */
774 /* OBSOLETE   UDICount Count; */
775 /* OBSOLETE   UDISizeT Size = 4; */
776 /* OBSOLETE   UDICount CountDone; */
777 /* OBSOLETE   UDIBool HostEndian = 0; */
778 /* OBSOLETE  */
779 /* OBSOLETE   if (regno >= 0) */
780 /* OBSOLETE     { */
781 /* OBSOLETE       store_register (regno); */
782 /* OBSOLETE       return; */
783 /* OBSOLETE     } */
784 /* OBSOLETE  */
785 /* OBSOLETE   if (remote_debug) */
786 /* OBSOLETE     { */
787 /* OBSOLETE       fprintf_unfiltered (gdb_stdlog, "Storing all registers\n"); */
788 /* OBSOLETE       fprintf_unfiltered (gdb_stdlog, */
789 /* OBSOLETE                       "PC0 = 0x%x, PC1 = 0x%x, PC2 = 0x%x\n", */
790 /* OBSOLETE                       read_register (NPC_REGNUM), */
791 /* OBSOLETE                       read_register (PC_REGNUM), */
792 /* OBSOLETE                       read_register (PC2_REGNUM)); */
793 /* OBSOLETE     } */
794 /* OBSOLETE  */
795 /* OBSOLETE /* Gr1/rsp */ */
796 /* OBSOLETE  */
797 /* OBSOLETE   From = (UDIUInt32 *) & registers[4 * GR1_REGNUM]; */
798 /* OBSOLETE   To.Space = UDI29KGlobalRegs; */
799 /* OBSOLETE   To.Offset = 1; */
800 /* OBSOLETE   Count = 1; */
801 /* OBSOLETE   if (UDIWrite (From, To, Count, Size, &CountDone, HostEndian)) */
802 /* OBSOLETE     error ("UDIWrite() failed in udi_store_regisetrs"); */
803 /* OBSOLETE  */
804 /* OBSOLETE #if defined(GR64_REGNUM) */
805 /* OBSOLETE  */
806 /* OBSOLETE /* Global registers gr64-gr95 */ */
807 /* OBSOLETE  */
808 /* OBSOLETE   From = (UDIUInt32 *) & registers[4 * GR64_REGNUM]; */
809 /* OBSOLETE   To.Space = UDI29KGlobalRegs; */
810 /* OBSOLETE   To.Offset = 64; */
811 /* OBSOLETE   Count = 32; */
812 /* OBSOLETE   if (UDIWrite (From, To, Count, Size, &CountDone, HostEndian)) */
813 /* OBSOLETE     error ("UDIWrite() failed in udi_store_regisetrs"); */
814 /* OBSOLETE  */
815 /* OBSOLETE #endif /* GR64_REGNUM */ */
816 /* OBSOLETE  */
817 /* OBSOLETE /* Global registers gr96-gr127 */ */
818 /* OBSOLETE  */
819 /* OBSOLETE   From = (UDIUInt32 *) & registers[4 * GR96_REGNUM]; */
820 /* OBSOLETE   To.Space = UDI29KGlobalRegs; */
821 /* OBSOLETE   To.Offset = 96; */
822 /* OBSOLETE   Count = 32; */
823 /* OBSOLETE   if (UDIWrite (From, To, Count, Size, &CountDone, HostEndian)) */
824 /* OBSOLETE     error ("UDIWrite() failed in udi_store_regisetrs"); */
825 /* OBSOLETE  */
826 /* OBSOLETE /* Local Registers */ */
827 /* OBSOLETE  */
828 /* OBSOLETE   From = (UDIUInt32 *) & registers[4 * LR0_REGNUM]; */
829 /* OBSOLETE   To.Space = UDI29KLocalRegs; */
830 /* OBSOLETE   To.Offset = 0; */
831 /* OBSOLETE   Count = 128; */
832 /* OBSOLETE   if (UDIWrite (From, To, Count, Size, &CountDone, HostEndian)) */
833 /* OBSOLETE     error ("UDIWrite() failed in udi_store_regisetrs"); */
834 /* OBSOLETE  */
835 /* OBSOLETE  */
836 /* OBSOLETE   /* Protected Special Registers *//* VAB through TMR */ */
837 /* OBSOLETE  */
838 /* OBSOLETE   From = (UDIUInt32 *) & registers[4 * SR_REGNUM (0)]; */
839 /* OBSOLETE   To.Space = UDI29KSpecialRegs; */
840 /* OBSOLETE   To.Offset = 0; */
841 /* OBSOLETE   Count = 10; */
842 /* OBSOLETE   if (UDIWrite (From, To, Count, Size, &CountDone, HostEndian)) */
843 /* OBSOLETE     error ("UDIWrite() failed in udi_store_regisetrs"); */
844 /* OBSOLETE  */
845 /* OBSOLETE /* PC0, PC1, PC2 possibly as shadow registers */ */
846 /* OBSOLETE  */
847 /* OBSOLETE   From = (UDIUInt32 *) & registers[4 * SR_REGNUM (10)]; */
848 /* OBSOLETE   To.Space = UDI29KSpecialRegs; */
849 /* OBSOLETE   Count = 3; */
850 /* OBSOLETE   if (USE_SHADOW_PC) */
851 /* OBSOLETE     To.Offset = 20;         /* SPC0 */ */
852 /* OBSOLETE   else */
853 /* OBSOLETE     To.Offset = 10;         /* PC0 */ */
854 /* OBSOLETE   if (UDIWrite (From, To, Count, Size, &CountDone, HostEndian)) */
855 /* OBSOLETE     error ("UDIWrite() failed in udi_store_regisetrs"); */
856 /* OBSOLETE  */
857 /* OBSOLETE /* PC1 via UDI29KPC */ */
858 /* OBSOLETE  */
859 /* OBSOLETE   From = (UDIUInt32 *) & registers[4 * PC_REGNUM]; */
860 /* OBSOLETE   To.Space = UDI29KPC; */
861 /* OBSOLETE   To.Offset = 0;            /* PC1 */ */
862 /* OBSOLETE   Count = 1; */
863 /* OBSOLETE   if (UDIWrite (From, To, Count, Size, &CountDone, HostEndian)) */
864 /* OBSOLETE     error ("UDIWrite() failed in udi_store_regisetrs"); */
865 /* OBSOLETE  */
866 /* OBSOLETE   /* LRU and MMU */ */
867 /* OBSOLETE  */
868 /* OBSOLETE   From = (UDIUInt32 *) & registers[4 * SR_REGNUM (13)]; */
869 /* OBSOLETE   To.Space = UDI29KSpecialRegs; */
870 /* OBSOLETE   To.Offset = 13; */
871 /* OBSOLETE   Count = 2; */
872 /* OBSOLETE   if (UDIWrite (From, To, Count, Size, &CountDone, HostEndian)) */
873 /* OBSOLETE     error ("UDIWrite() failed in udi_store_regisetrs"); */
874 /* OBSOLETE  */
875 /* OBSOLETE /* Unprotected Special Registers */ */
876 /* OBSOLETE  */
877 /* OBSOLETE   From = (UDIUInt32 *) & registers[4 * SR_REGNUM (128)]; */
878 /* OBSOLETE   To.Space = UDI29KSpecialRegs; */
879 /* OBSOLETE   To.Offset = 128; */
880 /* OBSOLETE   Count = 135 - 128 + 1; */
881 /* OBSOLETE   if (UDIWrite (From, To, Count, Size, &CountDone, HostEndian)) */
882 /* OBSOLETE     error ("UDIWrite() failed in udi_store_regisetrs"); */
883 /* OBSOLETE  */
884 /* OBSOLETE   registers_changed (); */
885 /* OBSOLETE } */
886 /* OBSOLETE  */
887 /* OBSOLETE /****************************************************** UDI_PREPARE_TO_STORE */ */
888 /* OBSOLETE /* Get ready to modify the registers array.  On machines which store */
889 /* OBSOLETE    individual registers, this doesn't need to do anything.  On machines */
890 /* OBSOLETE    which store all the registers in one fell swoop, this makes sure */
891 /* OBSOLETE    that registers contains all the registers from the program being */
892 /* OBSOLETE    debugged.  */ */
893 /* OBSOLETE  */
894 /* OBSOLETE static void */
895 /* OBSOLETE udi_prepare_to_store (void) */
896 /* OBSOLETE { */
897 /* OBSOLETE   /* Do nothing, since we can store individual regs */ */
898 /* OBSOLETE } */
899 /* OBSOLETE  */
900 /* OBSOLETE /********************************************************** TRANSLATE_ADDR */ */
901 /* OBSOLETE static CORE_ADDR */
902 /* OBSOLETE translate_addr (CORE_ADDR addr) */
903 /* OBSOLETE { */
904 /* OBSOLETE #if defined(ULTRA3) && defined(KERNEL_DEBUGGING) */
905 /* OBSOLETE   /* Check for a virtual address in the kernel */ */
906 /* OBSOLETE   /* Assume physical address of ublock is in  paddr_u register */ */
907 /* OBSOLETE   /* FIXME: doesn't work for user virtual addresses */ */
908 /* OBSOLETE   if (addr >= UVADDR) */
909 /* OBSOLETE     { */
910 /* OBSOLETE       /* PADDR_U register holds the physical address of the ublock */ */
911 /* OBSOLETE       CORE_ADDR i = (CORE_ADDR) read_register (PADDR_U_REGNUM); */
912 /* OBSOLETE       return (i + addr - (CORE_ADDR) UVADDR); */
913 /* OBSOLETE     } */
914 /* OBSOLETE   else */
915 /* OBSOLETE     { */
916 /* OBSOLETE       return (addr); */
917 /* OBSOLETE     } */
918 /* OBSOLETE #else */
919 /* OBSOLETE   return (addr); */
920 /* OBSOLETE #endif */
921 /* OBSOLETE } */
922 /* OBSOLETE /************************************************* UDI_XFER_INFERIOR_MEMORY */ */
923 /* OBSOLETE /* FIXME!  Merge these two.  */ */
924 /* OBSOLETE static int */
925 /* OBSOLETE udi_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, */
926 /* OBSOLETE                       struct mem_attrib *attrib ATTRIBUTE_UNUSED, */
927 /* OBSOLETE                       struct target_ops *target ATTRIBUTE_UNUSED) */
928 /* OBSOLETE { */
929 /* OBSOLETE  */
930 /* OBSOLETE   memaddr = translate_addr (memaddr); */
931 /* OBSOLETE  */
932 /* OBSOLETE   if (write) */
933 /* OBSOLETE     return udi_write_inferior_memory (memaddr, myaddr, len); */
934 /* OBSOLETE   else */
935 /* OBSOLETE     return udi_read_inferior_memory (memaddr, myaddr, len); */
936 /* OBSOLETE } */
937 /* OBSOLETE  */
938 /* OBSOLETE /********************************************************** UDI_FILES_INFO */ */
939 /* OBSOLETE static void */
940 /* OBSOLETE udi_files_info (struct target_ops *target) */
941 /* OBSOLETE { */
942 /* OBSOLETE   printf_unfiltered ("\tAttached to UDI socket to %s", udi_config_id); */
943 /* OBSOLETE   if (prog_name != NULL) */
944 /* OBSOLETE     printf_unfiltered ("and running program %s", prog_name); */
945 /* OBSOLETE   printf_unfiltered (".\n"); */
946 /* OBSOLETE } */
947 /* OBSOLETE  */
948 /* OBSOLETE /**************************************************** UDI_INSERT_BREAKPOINT */ */
949 /* OBSOLETE static int */
950 /* OBSOLETE udi_insert_breakpoint (CORE_ADDR addr, char *contents_cache) */
951 /* OBSOLETE { */
952 /* OBSOLETE   int cnt; */
953 /* OBSOLETE   UDIError err; */
954 /* OBSOLETE  */
955 /* OBSOLETE   for (cnt = 0; cnt < BKPT_TABLE_SIZE; cnt++) */
956 /* OBSOLETE     if (bkpt_table[cnt].Type == 0)  /* Find first free slot */ */
957 /* OBSOLETE       break; */
958 /* OBSOLETE  */
959 /* OBSOLETE   if (cnt >= BKPT_TABLE_SIZE) */
960 /* OBSOLETE     error ("Too many breakpoints set"); */
961 /* OBSOLETE  */
962 /* OBSOLETE   bkpt_table[cnt].Addr.Offset = addr; */
963 /* OBSOLETE   bkpt_table[cnt].Addr.Space = UDI29KIRAMSpace; */
964 /* OBSOLETE   bkpt_table[cnt].PassCount = 1; */
965 /* OBSOLETE   bkpt_table[cnt].Type = UDIBreakFlagExecute; */
966 /* OBSOLETE  */
967 /* OBSOLETE   err = UDISetBreakpoint (bkpt_table[cnt].Addr, */
968 /* OBSOLETE                       bkpt_table[cnt].PassCount, */
969 /* OBSOLETE                       bkpt_table[cnt].Type, */
970 /* OBSOLETE                       &bkpt_table[cnt].BreakId); */
971 /* OBSOLETE  */
972 /* OBSOLETE   if (err == 0) */
973 /* OBSOLETE     return 0;                       /* Success */ */
974 /* OBSOLETE  */
975 /* OBSOLETE   bkpt_table[cnt].Type = 0; */
976 /* OBSOLETE   error ("UDISetBreakpoint returned error code %d\n", err); */
977 /* OBSOLETE } */
978 /* OBSOLETE  */
979 /* OBSOLETE /**************************************************** UDI_REMOVE_BREAKPOINT */ */
980 /* OBSOLETE static int */
981 /* OBSOLETE udi_remove_breakpoint (CORE_ADDR addr, char *contents_cache) */
982 /* OBSOLETE { */
983 /* OBSOLETE   int cnt; */
984 /* OBSOLETE   UDIError err; */
985 /* OBSOLETE  */
986 /* OBSOLETE   for (cnt = 0; cnt < BKPT_TABLE_SIZE; cnt++) */
987 /* OBSOLETE     if (bkpt_table[cnt].Addr.Offset == addr)        /* Find matching breakpoint */ */
988 /* OBSOLETE       break; */
989 /* OBSOLETE  */
990 /* OBSOLETE   if (cnt >= BKPT_TABLE_SIZE) */
991 /* OBSOLETE     error ("Can't find breakpoint in table"); */
992 /* OBSOLETE  */
993 /* OBSOLETE   bkpt_table[cnt].Type = 0; */
994 /* OBSOLETE  */
995 /* OBSOLETE   err = UDIClearBreakpoint (bkpt_table[cnt].BreakId); */
996 /* OBSOLETE   if (err == 0) */
997 /* OBSOLETE     return 0;                       /* Success */ */
998 /* OBSOLETE  */
999 /* OBSOLETE   error ("UDIClearBreakpoint returned error code %d\n", err); */
1000 /* OBSOLETE } */
1001 /* OBSOLETE  */
1002 /* OBSOLETE static void */
1003 /* OBSOLETE udi_kill (void) */
1004 /* OBSOLETE { */
1005 /* OBSOLETE  */
1006 /* OBSOLETE #if 0 */
1007 /* OBSOLETE /* */
1008 /* OBSOLETE    UDIStop does not really work as advertised.  It causes the TIP to close it's */
1009 /* OBSOLETE    connection, which usually results in GDB dying with a SIGPIPE.  For now, we */
1010 /* OBSOLETE    just invoke udi_close, which seems to get things right. */
1011 /* OBSOLETE  */ */
1012 /* OBSOLETE   UDIStop (); */
1013 /* OBSOLETE  */
1014 /* OBSOLETE   udi_session_id = -1; */
1015 /* OBSOLETE   inferior_ptid = null_ptid; */
1016 /* OBSOLETE  */
1017 /* OBSOLETE   if (from_tty) */
1018 /* OBSOLETE     printf_unfiltered ("Target has been stopped."); */
1019 /* OBSOLETE #endif /* 0 */ */
1020 /* OBSOLETE #if 0 */
1021 /* OBSOLETE   udi_close (0); */
1022 /* OBSOLETE   pop_target (); */
1023 /* OBSOLETE #endif /* 0 */ */
1024 /* OBSOLETE  */
1025 /* OBSOLETE   /* Keep the target around, e.g. so "run" can do the right thing when */
1026 /* OBSOLETE      we are already debugging something.  */ */
1027 /* OBSOLETE  */
1028 /* OBSOLETE   if (UDIDisconnect (udi_session_id, UDITerminateSession)) */
1029 /* OBSOLETE     { */
1030 /* OBSOLETE       warning ("UDIDisconnect() failed"); */
1031 /* OBSOLETE     } */
1032 /* OBSOLETE  */
1033 /* OBSOLETE   /* Do not try to close udi_session_id again, later in the program.  */ */
1034 /* OBSOLETE   udi_session_id = -1; */
1035 /* OBSOLETE   inferior_ptid = null_ptid; */
1036 /* OBSOLETE } */
1037 /* OBSOLETE  */
1038 /* OBSOLETE /*  */
1039 /* OBSOLETE    Load a program into the target.  Args are: `program {options}'.  The options */
1040 /* OBSOLETE    are used to control loading of the program, and are NOT passed onto the */
1041 /* OBSOLETE    loaded code as arguments.  (You need to use the `run' command to do that.) */
1042 /* OBSOLETE  */
1043 /* OBSOLETE    The options are: */
1044 /* OBSOLETE    -ms %d       Set mem stack size to %d */
1045 /* OBSOLETE    -rs %d       Set regular stack size to %d */
1046 /* OBSOLETE    -i   send init info (default) */
1047 /* OBSOLETE    -noi don't send init info */
1048 /* OBSOLETE    -[tT]        Load Text section */
1049 /* OBSOLETE    -[dD]        Load Data section */
1050 /* OBSOLETE    -[bB]        Load BSS section */
1051 /* OBSOLETE    -[lL]        Load Lit section */
1052 /* OBSOLETE  */ */
1053 /* OBSOLETE  */
1054 /* OBSOLETE static void */
1055 /* OBSOLETE download (char *load_arg_string, int from_tty) */
1056 /* OBSOLETE { */
1057 /* OBSOLETE #define DEFAULT_MEM_STACK_SIZE              0x6000 */
1058 /* OBSOLETE #define DEFAULT_REG_STACK_SIZE              0x2000 */
1059 /* OBSOLETE  */
1060 /* OBSOLETE   char *token; */
1061 /* OBSOLETE   char *filename; */
1062 /* OBSOLETE   asection *section; */
1063 /* OBSOLETE   bfd *pbfd; */
1064 /* OBSOLETE   UDIError err; */
1065 /* OBSOLETE   int load_text = 1, load_data = 1, load_bss = 1, load_lit = 1; */
1066 /* OBSOLETE  */
1067 /* OBSOLETE   address_ranges[0].Space = UDI29KIRAMSpace; */
1068 /* OBSOLETE   address_ranges[0].Offset = 0xffffffff; */
1069 /* OBSOLETE   address_ranges[0].Size = 0; */
1070 /* OBSOLETE  */
1071 /* OBSOLETE   address_ranges[1].Space = UDI29KDRAMSpace; */
1072 /* OBSOLETE   address_ranges[1].Offset = 0xffffffff; */
1073 /* OBSOLETE   address_ranges[1].Size = 0; */
1074 /* OBSOLETE  */
1075 /* OBSOLETE   stack_sizes[0] = DEFAULT_REG_STACK_SIZE; */
1076 /* OBSOLETE   stack_sizes[1] = DEFAULT_MEM_STACK_SIZE; */
1077 /* OBSOLETE  */
1078 /* OBSOLETE   dont_repeat (); */
1079 /* OBSOLETE  */
1080 /* OBSOLETE   filename = strtok (load_arg_string, " \t"); */
1081 /* OBSOLETE   if (!filename) */
1082 /* OBSOLETE     error ("Must specify at least a file name with the load command"); */
1083 /* OBSOLETE  */
1084 /* OBSOLETE   filename = tilde_expand (filename); */
1085 /* OBSOLETE   make_cleanup (xfree, filename); */
1086 /* OBSOLETE  */
1087 /* OBSOLETE   while (token = strtok (NULL, " \t")) */
1088 /* OBSOLETE     { */
1089 /* OBSOLETE       if (token[0] == '-') */
1090 /* OBSOLETE     { */
1091 /* OBSOLETE       token++; */
1092 /* OBSOLETE  */
1093 /* OBSOLETE       if (STREQ (token, "ms")) */
1094 /* OBSOLETE         stack_sizes[1] = atol (strtok (NULL, " \t")); */
1095 /* OBSOLETE       else if (STREQ (token, "rs")) */
1096 /* OBSOLETE         stack_sizes[0] = atol (strtok (NULL, " \t")); */
1097 /* OBSOLETE       else */
1098 /* OBSOLETE         { */
1099 /* OBSOLETE           load_text = load_data = load_bss = load_lit = 0; */
1100 /* OBSOLETE  */
1101 /* OBSOLETE           while (*token) */
1102 /* OBSOLETE             { */
1103 /* OBSOLETE               switch (*token++) */
1104 /* OBSOLETE                 { */
1105 /* OBSOLETE                 case 't': */
1106 /* OBSOLETE                 case 'T': */
1107 /* OBSOLETE                   load_text = 1; */
1108 /* OBSOLETE                   break; */
1109 /* OBSOLETE                 case 'd': */
1110 /* OBSOLETE                 case 'D': */
1111 /* OBSOLETE                   load_data = 1; */
1112 /* OBSOLETE                   break; */
1113 /* OBSOLETE                 case 'b': */
1114 /* OBSOLETE                 case 'B': */
1115 /* OBSOLETE                   load_bss = 1; */
1116 /* OBSOLETE                   break; */
1117 /* OBSOLETE                 case 'l': */
1118 /* OBSOLETE                 case 'L': */
1119 /* OBSOLETE                   load_lit = 1; */
1120 /* OBSOLETE                   break; */
1121 /* OBSOLETE                 default: */
1122 /* OBSOLETE                   error ("Unknown UDI load option -%s", token - 1); */
1123 /* OBSOLETE                 } */
1124 /* OBSOLETE             } */
1125 /* OBSOLETE         } */
1126 /* OBSOLETE     } */
1127 /* OBSOLETE     } */
1128 /* OBSOLETE  */
1129 /* OBSOLETE   pbfd = bfd_openr (filename, gnutarget); */
1130 /* OBSOLETE  */
1131 /* OBSOLETE   if (!pbfd) */
1132 /* OBSOLETE     /* FIXME: should be using bfd_errmsg, not assuming it was */
1133 /* OBSOLETE        bfd_error_system_call.  */ */
1134 /* OBSOLETE     perror_with_name (filename); */
1135 /* OBSOLETE  */
1136 /* OBSOLETE   /* FIXME: should be checking for errors from bfd_close (for one thing, */
1137 /* OBSOLETE      on error it does not free all the storage associated with the */
1138 /* OBSOLETE      bfd).  */ */
1139 /* OBSOLETE   make_cleanup_bfd_close (pbfd); */
1140 /* OBSOLETE  */
1141 /* OBSOLETE   QUIT; */
1142 /* OBSOLETE   immediate_quit++; */
1143 /* OBSOLETE  */
1144 /* OBSOLETE   if (!bfd_check_format (pbfd, bfd_object)) */
1145 /* OBSOLETE     error ("It doesn't seem to be an object file"); */
1146 /* OBSOLETE  */
1147 /* OBSOLETE   for (section = pbfd->sections; section; section = section->next) */
1148 /* OBSOLETE     { */
1149 /* OBSOLETE       if (bfd_get_section_flags (pbfd, section) & SEC_ALLOC) */
1150 /* OBSOLETE     { */
1151 /* OBSOLETE       UDIResource To; */
1152 /* OBSOLETE       UDICount Count; */
1153 /* OBSOLETE       unsigned long section_size, section_end; */
1154 /* OBSOLETE       const char *section_name; */
1155 /* OBSOLETE  */
1156 /* OBSOLETE       section_name = bfd_get_section_name (pbfd, section); */
1157 /* OBSOLETE       if (STREQ (section_name, ".text") && !load_text) */
1158 /* OBSOLETE         continue; */
1159 /* OBSOLETE       else if (STREQ (section_name, ".data") && !load_data) */
1160 /* OBSOLETE         continue; */
1161 /* OBSOLETE       else if (STREQ (section_name, ".bss") && !load_bss) */
1162 /* OBSOLETE         continue; */
1163 /* OBSOLETE       else if (STREQ (section_name, ".lit") && !load_lit) */
1164 /* OBSOLETE         continue; */
1165 /* OBSOLETE  */
1166 /* OBSOLETE       To.Offset = bfd_get_section_vma (pbfd, section); */
1167 /* OBSOLETE       section_size = bfd_section_size (pbfd, section); */
1168 /* OBSOLETE       section_end = To.Offset + section_size; */
1169 /* OBSOLETE  */
1170 /* OBSOLETE       if (section_size == 0) */
1171 /* OBSOLETE         /* This is needed at least in the BSS case, where the code */
1172 /* OBSOLETE            below starts writing before it even checks the size.  */ */
1173 /* OBSOLETE         continue; */
1174 /* OBSOLETE  */
1175 /* OBSOLETE       printf_unfiltered ("[Loading section %s at %x (%d bytes)]\n", */
1176 /* OBSOLETE                          section_name, */
1177 /* OBSOLETE                          To.Offset, */
1178 /* OBSOLETE                          section_size); */
1179 /* OBSOLETE  */
1180 /* OBSOLETE       if (bfd_get_section_flags (pbfd, section) & SEC_CODE) */
1181 /* OBSOLETE         { */
1182 /* OBSOLETE           To.Space = UDI29KIRAMSpace; */
1183 /* OBSOLETE  */
1184 /* OBSOLETE           address_ranges[0].Offset = min (address_ranges[0].Offset, */
1185 /* OBSOLETE                                           To.Offset); */
1186 /* OBSOLETE           address_ranges[0].Size = max (address_ranges[0].Size, */
1187 /* OBSOLETE                                         section_end */
1188 /* OBSOLETE                                         - address_ranges[0].Offset); */
1189 /* OBSOLETE         } */
1190 /* OBSOLETE       else */
1191 /* OBSOLETE         { */
1192 /* OBSOLETE           To.Space = UDI29KDRAMSpace; */
1193 /* OBSOLETE  */
1194 /* OBSOLETE           address_ranges[1].Offset = min (address_ranges[1].Offset, */
1195 /* OBSOLETE                                           To.Offset); */
1196 /* OBSOLETE           address_ranges[1].Size = max (address_ranges[1].Size, */
1197 /* OBSOLETE                                         section_end */
1198 /* OBSOLETE                                         - address_ranges[1].Offset); */
1199 /* OBSOLETE         } */
1200 /* OBSOLETE  */
1201 /* OBSOLETE       if (bfd_get_section_flags (pbfd, section) & SEC_LOAD)         /* Text, data or lit */ */
1202 /* OBSOLETE         { */
1203 /* OBSOLETE           file_ptr fptr; */
1204 /* OBSOLETE  */
1205 /* OBSOLETE           fptr = 0; */
1206 /* OBSOLETE  */
1207 /* OBSOLETE           while (section_size > 0) */
1208 /* OBSOLETE             { */
1209 /* OBSOLETE               char buffer[1024]; */
1210 /* OBSOLETE  */
1211 /* OBSOLETE               Count = min (section_size, 1024); */
1212 /* OBSOLETE  */
1213 /* OBSOLETE               bfd_get_section_contents (pbfd, section, buffer, fptr, */
1214 /* OBSOLETE                                         Count); */
1215 /* OBSOLETE  */
1216 /* OBSOLETE               err = UDIWrite ((UDIHostMemPtr) buffer,       /* From */ */
1217 /* OBSOLETE                               To,   /* To */ */
1218 /* OBSOLETE                               Count,        /* Count */ */
1219 /* OBSOLETE                               (UDISizeT) 1,         /* Size */ */
1220 /* OBSOLETE                               &Count,       /* CountDone */ */
1221 /* OBSOLETE                               (UDIBool) 0);         /* HostEndian */ */
1222 /* OBSOLETE               if (err) */
1223 /* OBSOLETE                 error ("UDIWrite failed, error = %d", err); */
1224 /* OBSOLETE  */
1225 /* OBSOLETE               To.Offset += Count; */
1226 /* OBSOLETE               fptr += Count; */
1227 /* OBSOLETE               section_size -= Count; */
1228 /* OBSOLETE             } */
1229 /* OBSOLETE         } */
1230 /* OBSOLETE       else */
1231 /* OBSOLETE         /* BSS */ */
1232 /* OBSOLETE         { */
1233 /* OBSOLETE           UDIResource From; */
1234 /* OBSOLETE           unsigned long zero = 0; */
1235 /* OBSOLETE  */
1236 /* OBSOLETE           /* Write a zero byte at the vma */ */
1237 /* OBSOLETE           /* FIXME: Broken for sections of 1-3 bytes (we test for */
1238 /* OBSOLETE              zero above).  */ */
1239 /* OBSOLETE           err = UDIWrite ((UDIHostMemPtr) & zero,   /* From */ */
1240 /* OBSOLETE                           To,       /* To */ */
1241 /* OBSOLETE                           (UDICount) 1,     /* Count */ */
1242 /* OBSOLETE                           (UDISizeT) 4,     /* Size */ */
1243 /* OBSOLETE                           &Count,   /* CountDone */ */
1244 /* OBSOLETE                           (UDIBool) 0);     /* HostEndian */ */
1245 /* OBSOLETE           if (err) */
1246 /* OBSOLETE             error ("UDIWrite failed, error = %d", err); */
1247 /* OBSOLETE  */
1248 /* OBSOLETE           From = To; */
1249 /* OBSOLETE           To.Offset += 4; */
1250 /* OBSOLETE  */
1251 /* OBSOLETE           /* Now, duplicate it for the length of the BSS */ */
1252 /* OBSOLETE           err = UDICopy (From,      /* From */ */
1253 /* OBSOLETE                          To,        /* To */ */
1254 /* OBSOLETE                          (UDICount) (section_size / 4 - 1),         /* Count */ */
1255 /* OBSOLETE                          (UDISizeT) 4,      /* Size */ */
1256 /* OBSOLETE                          &Count,    /* CountDone */ */
1257 /* OBSOLETE                          (UDIBool) 1);      /* Direction */ */
1258 /* OBSOLETE           if (err) */
1259 /* OBSOLETE             { */
1260 /* OBSOLETE               char message[100]; */
1261 /* OBSOLETE               int xerr; */
1262 /* OBSOLETE  */
1263 /* OBSOLETE               xerr = UDIGetErrorMsg (err, 100, message, &Count); */
1264 /* OBSOLETE               if (!xerr) */
1265 /* OBSOLETE                 fprintf_unfiltered (gdb_stderr, "Error is %s\n", message); */
1266 /* OBSOLETE               else */
1267 /* OBSOLETE                 fprintf_unfiltered (gdb_stderr, "xerr is %d\n", xerr); */
1268 /* OBSOLETE               error ("UDICopy failed, error = %d", err); */
1269 /* OBSOLETE             } */
1270 /* OBSOLETE         } */
1271 /* OBSOLETE  */
1272 /* OBSOLETE     } */
1273 /* OBSOLETE     } */
1274 /* OBSOLETE  */
1275 /* OBSOLETE   entry.Space = UDI29KIRAMSpace; */
1276 /* OBSOLETE   entry.Offset = bfd_get_start_address (pbfd); */
1277 /* OBSOLETE  */
1278 /* OBSOLETE   immediate_quit--; */
1279 /* OBSOLETE } */
1280 /* OBSOLETE  */
1281 /* OBSOLETE /* Function to download an image into the remote target.  */ */
1282 /* OBSOLETE  */
1283 /* OBSOLETE static void */
1284 /* OBSOLETE udi_load (char *args, int from_tty) */
1285 /* OBSOLETE { */
1286 /* OBSOLETE   download (args, from_tty); */
1287 /* OBSOLETE  */
1288 /* OBSOLETE   /* As a convenience, pick up any symbol info that is in the program */
1289 /* OBSOLETE      being loaded.  Note that we assume that the program is the``mainline''; */
1290 /* OBSOLETE      if this is not always true, then this code will need to be augmented.  */ */
1291 /* OBSOLETE   symbol_file_add (strtok (args, " \t"), from_tty, NULL, 1, 0); */
1292 /* OBSOLETE  */
1293 /* OBSOLETE   /* Getting new symbols may change our opinion about what is */
1294 /* OBSOLETE      frameless.  */ */
1295 /* OBSOLETE   reinit_frame_cache (); */
1296 /* OBSOLETE } */
1297 /* OBSOLETE  */
1298 /* OBSOLETE /*************************************************** UDI_WRITE_INFERIOR_MEMORY */
1299 /* OBSOLETE ** Copy LEN bytes of data from debugger memory at MYADDR */
1300 /* OBSOLETE    to inferior's memory at MEMADDR.  Returns number of bytes written.  */ */
1301 /* OBSOLETE static int */
1302 /* OBSOLETE udi_write_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len) */
1303 /* OBSOLETE { */
1304 /* OBSOLETE   int nwritten = 0; */
1305 /* OBSOLETE   UDIUInt32 *From; */
1306 /* OBSOLETE   UDIResource To; */
1307 /* OBSOLETE   UDICount Count; */
1308 /* OBSOLETE   UDISizeT Size = 1; */
1309 /* OBSOLETE   UDICount CountDone = 0; */
1310 /* OBSOLETE   UDIBool HostEndian = 0; */
1311 /* OBSOLETE  */
1312 /* OBSOLETE   To.Space = udi_memory_space (memaddr); */
1313 /* OBSOLETE   From = (UDIUInt32 *) myaddr; */
1314 /* OBSOLETE  */
1315 /* OBSOLETE   while (nwritten < len) */
1316 /* OBSOLETE     { */
1317 /* OBSOLETE       Count = len - nwritten; */
1318 /* OBSOLETE       if (Count > MAXDATA) */
1319 /* OBSOLETE     Count = MAXDATA; */
1320 /* OBSOLETE       To.Offset = memaddr + nwritten; */
1321 /* OBSOLETE       if (UDIWrite (From, To, Count, Size, &CountDone, HostEndian)) */
1322 /* OBSOLETE     { */
1323 /* OBSOLETE       error ("UDIWrite() failed in udi_write_inferior_memory"); */
1324 /* OBSOLETE       break; */
1325 /* OBSOLETE     } */
1326 /* OBSOLETE       else */
1327 /* OBSOLETE     { */
1328 /* OBSOLETE       nwritten += CountDone; */
1329 /* OBSOLETE       From += CountDone; */
1330 /* OBSOLETE     } */
1331 /* OBSOLETE     } */
1332 /* OBSOLETE   return (nwritten); */
1333 /* OBSOLETE } */
1334 /* OBSOLETE  */
1335 /* OBSOLETE /**************************************************** UDI_READ_INFERIOR_MEMORY */
1336 /* OBSOLETE ** Read LEN bytes from inferior memory at MEMADDR.  Put the result */
1337 /* OBSOLETE    at debugger address MYADDR.  Returns number of bytes read.  */ */
1338 /* OBSOLETE static int */
1339 /* OBSOLETE udi_read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len) */
1340 /* OBSOLETE { */
1341 /* OBSOLETE   int nread = 0; */
1342 /* OBSOLETE   UDIResource From; */
1343 /* OBSOLETE   UDIUInt32 *To; */
1344 /* OBSOLETE   UDICount Count; */
1345 /* OBSOLETE   UDISizeT Size = 1; */
1346 /* OBSOLETE   UDICount CountDone = 0; */
1347 /* OBSOLETE   UDIBool HostEndian = 0; */
1348 /* OBSOLETE   UDIError err; */
1349 /* OBSOLETE  */
1350 /* OBSOLETE   From.Space = udi_memory_space (memaddr); */
1351 /* OBSOLETE   To = (UDIUInt32 *) myaddr; */
1352 /* OBSOLETE  */
1353 /* OBSOLETE   while (nread < len) */
1354 /* OBSOLETE     { */
1355 /* OBSOLETE       Count = len - nread; */
1356 /* OBSOLETE       if (Count > MAXDATA) */
1357 /* OBSOLETE     Count = MAXDATA; */
1358 /* OBSOLETE       From.Offset = memaddr + nread; */
1359 /* OBSOLETE       if (err = UDIRead (From, To, Count, Size, &CountDone, HostEndian)) */
1360 /* OBSOLETE     { */
1361 /* OBSOLETE       error ("UDIRead() failed in udi_read_inferior_memory"); */
1362 /* OBSOLETE       break; */
1363 /* OBSOLETE     } */
1364 /* OBSOLETE       else */
1365 /* OBSOLETE     { */
1366 /* OBSOLETE       nread += CountDone; */
1367 /* OBSOLETE       To += CountDone; */
1368 /* OBSOLETE     } */
1369 /* OBSOLETE     } */
1370 /* OBSOLETE   return (nread); */
1371 /* OBSOLETE } */
1372 /* OBSOLETE  */
1373 /* OBSOLETE /********************************************************************* WARNING */
1374 /* OBSOLETE */ */
1375 /* OBSOLETE udi_warning (int num) */
1376 /* OBSOLETE { */
1377 /* OBSOLETE   error ("ERROR while loading program into remote TIP: $d\n", num); */
1378 /* OBSOLETE } */
1379 /* OBSOLETE  */
1380 /* OBSOLETE  */
1381 /* OBSOLETE /*****************************************************************************/ */
1382 /* OBSOLETE /* Fetch a single register indicatated by 'regno'.  */
1383 /* OBSOLETE  * Returns 0/-1 on success/failure.   */
1384 /* OBSOLETE  */ */
1385 /* OBSOLETE static void */
1386 /* OBSOLETE fetch_register (int regno) */
1387 /* OBSOLETE { */
1388 /* OBSOLETE   UDIResource From; */
1389 /* OBSOLETE   UDIUInt32 To; */
1390 /* OBSOLETE   UDICount Count = 1; */
1391 /* OBSOLETE   UDISizeT Size = 4; */
1392 /* OBSOLETE   UDICount CountDone; */
1393 /* OBSOLETE   UDIBool HostEndian = 0; */
1394 /* OBSOLETE   UDIError err; */
1395 /* OBSOLETE   int result; */
1396 /* OBSOLETE  */
1397 /* OBSOLETE   if (regno == GR1_REGNUM) */
1398 /* OBSOLETE     { */
1399 /* OBSOLETE       From.Space = UDI29KGlobalRegs; */
1400 /* OBSOLETE       From.Offset = 1; */
1401 /* OBSOLETE     } */
1402 /* OBSOLETE   else if (regno >= GR96_REGNUM && regno < GR96_REGNUM + 32) */
1403 /* OBSOLETE     { */
1404 /* OBSOLETE       From.Space = UDI29KGlobalRegs; */
1405 /* OBSOLETE       From.Offset = (regno - GR96_REGNUM) + 96;; */
1406 /* OBSOLETE     } */
1407 /* OBSOLETE  */
1408 /* OBSOLETE #if defined(GR64_REGNUM) */
1409 /* OBSOLETE  */
1410 /* OBSOLETE   else if (regno >= GR64_REGNUM && regno < GR64_REGNUM + 32) */
1411 /* OBSOLETE     { */
1412 /* OBSOLETE       From.Space = UDI29KGlobalRegs; */
1413 /* OBSOLETE       From.Offset = (regno - GR64_REGNUM) + 64; */
1414 /* OBSOLETE     } */
1415 /* OBSOLETE  */
1416 /* OBSOLETE #endif /* GR64_REGNUM */ */
1417 /* OBSOLETE  */
1418 /* OBSOLETE   else if (regno >= LR0_REGNUM && regno < LR0_REGNUM + 128) */
1419 /* OBSOLETE     { */
1420 /* OBSOLETE       From.Space = UDI29KLocalRegs; */
1421 /* OBSOLETE       From.Offset = (regno - LR0_REGNUM); */
1422 /* OBSOLETE     } */
1423 /* OBSOLETE   else if (regno >= FPE_REGNUM && regno <= EXO_REGNUM) */
1424 /* OBSOLETE     { */
1425 /* OBSOLETE       int val = -1; */
1426 /* OBSOLETE       /*supply_register(160 + (regno - FPE_REGNUM),(char *) &val); */ */
1427 /* OBSOLETE       supply_register (regno, (char *) &val); */
1428 /* OBSOLETE       return;                       /* Pretend Success */ */
1429 /* OBSOLETE     } */
1430 /* OBSOLETE   else */
1431 /* OBSOLETE     { */
1432 /* OBSOLETE       From.Space = UDI29KSpecialRegs; */
1433 /* OBSOLETE       From.Offset = regnum_to_srnum (regno); */
1434 /* OBSOLETE     } */
1435 /* OBSOLETE  */
1436 /* OBSOLETE   if (err = UDIRead (From, &To, Count, Size, &CountDone, HostEndian)) */
1437 /* OBSOLETE     error ("UDIRead() failed in udi_fetch_registers"); */
1438 /* OBSOLETE  */
1439 /* OBSOLETE   supply_register (regno, (char *) &To); */
1440 /* OBSOLETE  */
1441 /* OBSOLETE   if (remote_debug) */
1442 /* OBSOLETE     fprintf_unfiltered (gdb_stdlog, "Fetching register %s = 0x%x\n", */
1443 /* OBSOLETE                     REGISTER_NAME (regno), To); */
1444 /* OBSOLETE } */
1445 /* OBSOLETE /*****************************************************************************/ */
1446 /* OBSOLETE /* Store a single register indicated by 'regno'.  */
1447 /* OBSOLETE  * Returns 0/-1 on success/failure.   */
1448 /* OBSOLETE  */ */
1449 /* OBSOLETE static int */
1450 /* OBSOLETE store_register (int regno) */
1451 /* OBSOLETE { */
1452 /* OBSOLETE   int result; */
1453 /* OBSOLETE   UDIUInt32 From; */
1454 /* OBSOLETE   UDIResource To; */
1455 /* OBSOLETE   UDICount Count = 1; */
1456 /* OBSOLETE   UDISizeT Size = 4; */
1457 /* OBSOLETE   UDICount CountDone; */
1458 /* OBSOLETE   UDIBool HostEndian = 0; */
1459 /* OBSOLETE  */
1460 /* OBSOLETE   From = read_register (regno);     /* get data value */ */
1461 /* OBSOLETE  */
1462 /* OBSOLETE   if (remote_debug) */
1463 /* OBSOLETE     fprintf_unfiltered (gdb_stdlog, "Storing register %s = 0x%x\n", */
1464 /* OBSOLETE                     REGISTER_NAME (regno), From); */
1465 /* OBSOLETE  */
1466 /* OBSOLETE   if (regno == GR1_REGNUM) */
1467 /* OBSOLETE     { */
1468 /* OBSOLETE       To.Space = UDI29KGlobalRegs; */
1469 /* OBSOLETE       To.Offset = 1; */
1470 /* OBSOLETE       result = UDIWrite (&From, To, Count, Size, &CountDone, HostEndian); */
1471 /* OBSOLETE       /* Setting GR1 changes the numbers of all the locals, so invalidate the  */
1472 /* OBSOLETE        * register cache.  Do this *after* calling read_register, because we want  */
1473 /* OBSOLETE        * read_register to return the value that write_register has just stuffed  */
1474 /* OBSOLETE        * into the registers array, not the value of the register fetched from  */
1475 /* OBSOLETE        * the inferior.   */
1476 /* OBSOLETE        */ */
1477 /* OBSOLETE       registers_changed (); */
1478 /* OBSOLETE     } */
1479 /* OBSOLETE #if defined(GR64_REGNUM) */
1480 /* OBSOLETE   else if (regno >= GR64_REGNUM && regno < GR64_REGNUM + 32) */
1481 /* OBSOLETE     { */
1482 /* OBSOLETE       To.Space = UDI29KGlobalRegs; */
1483 /* OBSOLETE       To.Offset = (regno - GR64_REGNUM) + 64; */
1484 /* OBSOLETE       result = UDIWrite (&From, To, Count, Size, &CountDone, HostEndian); */
1485 /* OBSOLETE     } */
1486 /* OBSOLETE #endif /* GR64_REGNUM */ */
1487 /* OBSOLETE   else if (regno >= GR96_REGNUM && regno < GR96_REGNUM + 32) */
1488 /* OBSOLETE     { */
1489 /* OBSOLETE       To.Space = UDI29KGlobalRegs; */
1490 /* OBSOLETE       To.Offset = (regno - GR96_REGNUM) + 96; */
1491 /* OBSOLETE       result = UDIWrite (&From, To, Count, Size, &CountDone, HostEndian); */
1492 /* OBSOLETE     } */
1493 /* OBSOLETE   else if (regno >= LR0_REGNUM && regno < LR0_REGNUM + 128) */
1494 /* OBSOLETE     { */
1495 /* OBSOLETE       To.Space = UDI29KLocalRegs; */
1496 /* OBSOLETE       To.Offset = (regno - LR0_REGNUM); */
1497 /* OBSOLETE       result = UDIWrite (&From, To, Count, Size, &CountDone, HostEndian); */
1498 /* OBSOLETE     } */
1499 /* OBSOLETE   else if (regno >= FPE_REGNUM && regno <= EXO_REGNUM) */
1500 /* OBSOLETE     return 0;                       /* Pretend Success */ */
1501 /* OBSOLETE   else if (regno == PC_REGNUM) */
1502 /* OBSOLETE     { */
1503 /* OBSOLETE       /* PC1 via UDI29KPC */ */
1504 /* OBSOLETE  */
1505 /* OBSOLETE       To.Space = UDI29KPC; */
1506 /* OBSOLETE       To.Offset = 0;                /* PC1 */ */
1507 /* OBSOLETE       result = UDIWrite (&From, To, Count, Size, &CountDone, HostEndian); */
1508 /* OBSOLETE  */
1509 /* OBSOLETE       /* Writing to this loc actually changes the values of pc0 & pc1 */ */
1510 /* OBSOLETE  */
1511 /* OBSOLETE       register_valid[PC_REGNUM] = 0;        /* pc1 */ */
1512 /* OBSOLETE       register_valid[NPC_REGNUM] = 0;       /* pc0 */ */
1513 /* OBSOLETE     } */
1514 /* OBSOLETE   else */
1515 /* OBSOLETE     /* An unprotected or protected special register */ */
1516 /* OBSOLETE     { */
1517 /* OBSOLETE       To.Space = UDI29KSpecialRegs; */
1518 /* OBSOLETE       To.Offset = regnum_to_srnum (regno); */
1519 /* OBSOLETE       result = UDIWrite (&From, To, Count, Size, &CountDone, HostEndian); */
1520 /* OBSOLETE     } */
1521 /* OBSOLETE  */
1522 /* OBSOLETE   if (result != 0) */
1523 /* OBSOLETE     error ("UDIWrite() failed in store_registers"); */
1524 /* OBSOLETE  */
1525 /* OBSOLETE   return 0; */
1526 /* OBSOLETE } */
1527 /* OBSOLETE /********************************************************** REGNUM_TO_SRNUM */ */
1528 /* OBSOLETE /*  */
1529 /* OBSOLETE  * Convert a gdb special register number to a 29000 special register number. */
1530 /* OBSOLETE  */ */
1531 /* OBSOLETE static int */
1532 /* OBSOLETE regnum_to_srnum (int regno) */
1533 /* OBSOLETE { */
1534 /* OBSOLETE   switch (regno) */
1535 /* OBSOLETE     { */
1536 /* OBSOLETE     case VAB_REGNUM: */
1537 /* OBSOLETE       return (0); */
1538 /* OBSOLETE     case OPS_REGNUM: */
1539 /* OBSOLETE       return (1); */
1540 /* OBSOLETE     case CPS_REGNUM: */
1541 /* OBSOLETE       return (2); */
1542 /* OBSOLETE     case CFG_REGNUM: */
1543 /* OBSOLETE       return (3); */
1544 /* OBSOLETE     case CHA_REGNUM: */
1545 /* OBSOLETE       return (4); */
1546 /* OBSOLETE     case CHD_REGNUM: */
1547 /* OBSOLETE       return (5); */
1548 /* OBSOLETE     case CHC_REGNUM: */
1549 /* OBSOLETE       return (6); */
1550 /* OBSOLETE     case RBP_REGNUM: */
1551 /* OBSOLETE       return (7); */
1552 /* OBSOLETE     case TMC_REGNUM: */
1553 /* OBSOLETE       return (8); */
1554 /* OBSOLETE     case TMR_REGNUM: */
1555 /* OBSOLETE       return (9); */
1556 /* OBSOLETE     case NPC_REGNUM: */
1557 /* OBSOLETE       return (USE_SHADOW_PC ? (20) : (10)); */
1558 /* OBSOLETE     case PC_REGNUM: */
1559 /* OBSOLETE       return (USE_SHADOW_PC ? (21) : (11)); */
1560 /* OBSOLETE     case PC2_REGNUM: */
1561 /* OBSOLETE       return (USE_SHADOW_PC ? (22) : (12)); */
1562 /* OBSOLETE     case MMU_REGNUM: */
1563 /* OBSOLETE       return (13); */
1564 /* OBSOLETE     case LRU_REGNUM: */
1565 /* OBSOLETE       return (14); */
1566 /* OBSOLETE     case IPC_REGNUM: */
1567 /* OBSOLETE       return (128); */
1568 /* OBSOLETE     case IPA_REGNUM: */
1569 /* OBSOLETE       return (129); */
1570 /* OBSOLETE     case IPB_REGNUM: */
1571 /* OBSOLETE       return (130); */
1572 /* OBSOLETE     case Q_REGNUM: */
1573 /* OBSOLETE       return (131); */
1574 /* OBSOLETE     case ALU_REGNUM: */
1575 /* OBSOLETE       return (132); */
1576 /* OBSOLETE     case BP_REGNUM: */
1577 /* OBSOLETE       return (133); */
1578 /* OBSOLETE     case FC_REGNUM: */
1579 /* OBSOLETE       return (134); */
1580 /* OBSOLETE     case CR_REGNUM: */
1581 /* OBSOLETE       return (135); */
1582 /* OBSOLETE     case FPE_REGNUM: */
1583 /* OBSOLETE       return (160); */
1584 /* OBSOLETE     case INTE_REGNUM: */
1585 /* OBSOLETE       return (161); */
1586 /* OBSOLETE     case FPS_REGNUM: */
1587 /* OBSOLETE       return (162); */
1588 /* OBSOLETE     case EXO_REGNUM: */
1589 /* OBSOLETE       return (164); */
1590 /* OBSOLETE     default: */
1591 /* OBSOLETE       return (255);         /* Failure ? */ */
1592 /* OBSOLETE     } */
1593 /* OBSOLETE } */
1594 /* OBSOLETE /****************************************************************************/ */
1595 /* OBSOLETE /* */
1596 /* OBSOLETE  * Determine the Target memory space qualifier based on the addr.  */
1597 /* OBSOLETE  * FIXME: Can't distinguis I_ROM/D_ROM.   */
1598 /* OBSOLETE  * FIXME: Doesn't know anything about I_CACHE/D_CACHE. */
1599 /* OBSOLETE  */ */
1600 /* OBSOLETE static CPUSpace */
1601 /* OBSOLETE udi_memory_space (CORE_ADDR addr) */
1602 /* OBSOLETE { */
1603 /* OBSOLETE   UDIUInt32 tstart = IMemStart; */
1604 /* OBSOLETE   UDIUInt32 tend = tstart + IMemSize; */
1605 /* OBSOLETE   UDIUInt32 dstart = DMemStart; */
1606 /* OBSOLETE   UDIUInt32 dend = tstart + DMemSize; */
1607 /* OBSOLETE   UDIUInt32 rstart = RMemStart; */
1608 /* OBSOLETE   UDIUInt32 rend = tstart + RMemSize; */
1609 /* OBSOLETE  */
1610 /* OBSOLETE   if (((UDIUInt32) addr >= tstart) && ((UDIUInt32) addr < tend)) */
1611 /* OBSOLETE     { */
1612 /* OBSOLETE       return UDI29KIRAMSpace; */
1613 /* OBSOLETE     } */
1614 /* OBSOLETE   else if (((UDIUInt32) addr >= dstart) && ((UDIUInt32) addr < dend)) */
1615 /* OBSOLETE     { */
1616 /* OBSOLETE       return UDI29KDRAMSpace; */
1617 /* OBSOLETE     } */
1618 /* OBSOLETE   else if (((UDIUInt32) addr >= rstart) && ((UDIUInt32) addr < rend)) */
1619 /* OBSOLETE     { */
1620 /* OBSOLETE       /* FIXME: how do we determine between D_ROM and I_ROM */ */
1621 /* OBSOLETE       return UDI29KIROMSpace; */
1622 /* OBSOLETE     } */
1623 /* OBSOLETE   else                              /* FIXME: what do me do now? */ */
1624 /* OBSOLETE     return UDI29KDRAMSpace; /* Hmmm! */ */
1625 /* OBSOLETE } */
1626 /* OBSOLETE /*********************************************************************** STUBS */
1627 /* OBSOLETE */ */
1628 /* OBSOLETE  */
1629 /* OBSOLETE void */
1630 /* OBSOLETE convert16 (void) */
1631 /* OBSOLETE {; */
1632 /* OBSOLETE } */
1633 /* OBSOLETE void */
1634 /* OBSOLETE convert32 (void) */
1635 /* OBSOLETE {; */
1636 /* OBSOLETE } */
1637 /* OBSOLETE struct ui_file *EchoFile = 0;       /* used for debugging */ */
1638 /* OBSOLETE int QuietMode = 0;          /* used for debugging */ */
1639 /* OBSOLETE \f */
1640 /* OBSOLETE #ifdef NO_HIF_SUPPORT */
1641 /* OBSOLETE service_HIF (union msg_t *msg) */
1642 /* OBSOLETE { */
1643 /* OBSOLETE   return (0);                       /* Emulate a failure */ */
1644 /* OBSOLETE } */
1645 /* OBSOLETE #endif */
1646 /* OBSOLETE \f */
1647 /* OBSOLETE /* Target_ops vector.  Not static because there does not seem to be */
1648 /* OBSOLETE    any portable way to do a forward declaration of a static variable. */
1649 /* OBSOLETE    The RS/6000 doesn't like "extern" followed by "static"; SunOS */
1650 /* OBSOLETE    /bin/cc doesn't like "static" twice.  */ */
1651 /* OBSOLETE  */
1652 /* OBSOLETE struct target_ops udi_ops; */
1653 /* OBSOLETE  */
1654 /* OBSOLETE static void */
1655 /* OBSOLETE init_udi_ops (void) */
1656 /* OBSOLETE { */
1657 /* OBSOLETE   udi_ops.to_shortname = "udi"; */
1658 /* OBSOLETE   udi_ops.to_longname = "Remote UDI connected TIP"; */
1659 /* OBSOLETE   udi_ops.to_doc = "Remote debug an AMD 29k using UDI socket connection to TIP process.\n\ */
1660 /* OBSOLETE Arguments are\n\ */
1661 /* OBSOLETE `configuration-id AF_INET hostname port-number'\n\ */
1662 /* OBSOLETE To connect via the network, where hostname and port-number specify the\n\ */
1663 /* OBSOLETE host and port where you can connect via UDI.\n\ */
1664 /* OBSOLETE configuration-id is unused.\n\ */
1665 /* OBSOLETE \n\ */
1666 /* OBSOLETE `configuration-id AF_UNIX socket-name tip-program'\n\ */
1667 /* OBSOLETE To connect using a local connection to the \"tip.exe\" program which is\n\ */
1668 /* OBSOLETE     supplied by AMD.  If socket-name specifies an AF_UNIX socket then the\n\ */
1669 /* OBSOLETE     tip program must already be started; connect to it using that socket.\n\ */
1670 /* OBSOLETE     If not, start up tip-program, which should be the name of the tip\n\ */
1671 /* OBSOLETE     program.  If appropriate, the PATH environment variable is searched.\n\ */
1672 /* OBSOLETE     configuration-id is unused.\n\ */
1673 /* OBSOLETE \n\ */
1674 /* OBSOLETE `configuration-id'\n\ */
1675 /* OBSOLETE     Look up the configuration in ./udi_soc or /etc/udi_soc, which\n\ */
1676 /* OBSOLETE     are files containing lines in the above formats.  configuration-id is\n\ */
1677 /* OBSOLETE     used to pick which line of the file to use."; */
1678 /* OBSOLETE   udi_ops.to_open = udi_open; */
1679 /* OBSOLETE   udi_ops.to_close = udi_close; */
1680 /* OBSOLETE   udi_ops.to_attach = udi_attach; */
1681 /* OBSOLETE   udi_ops.to_detach = udi_detach; */
1682 /* OBSOLETE   udi_ops.to_resume = udi_resume; */
1683 /* OBSOLETE   udi_ops.to_wait = udi_wait; */
1684 /* OBSOLETE   udi_ops.to_fetch_registers = udi_fetch_registers; */
1685 /* OBSOLETE   udi_ops.to_store_registers = udi_store_registers; */
1686 /* OBSOLETE   udi_ops.to_prepare_to_store = udi_prepare_to_store; */
1687 /* OBSOLETE   udi_ops.to_xfer_memory = udi_xfer_inferior_memory; */
1688 /* OBSOLETE   udi_ops.to_files_info = udi_files_info; */
1689 /* OBSOLETE   udi_ops.to_insert_breakpoint = udi_insert_breakpoint; */
1690 /* OBSOLETE   udi_ops.to_remove_breakpoint = udi_remove_breakpoint; */
1691 /* OBSOLETE   udi_ops.to_terminal_init = 0; */
1692 /* OBSOLETE   udi_ops.to_terminal_inferior = 0; */
1693 /* OBSOLETE   udi_ops.to_terminal_ours_for_output = 0; */
1694 /* OBSOLETE   udi_ops.to_terminal_ours = 0; */
1695 /* OBSOLETE   udi_ops.to_terminal_info = 0; */
1696 /* OBSOLETE   udi_ops.to_kill = udi_kill; */
1697 /* OBSOLETE   udi_ops.to_load = udi_load; */
1698 /* OBSOLETE   udi_ops.to_lookup_symbol = 0; */
1699 /* OBSOLETE   udi_ops.to_create_inferior = udi_create_inferior; */
1700 /* OBSOLETE   udi_ops.to_mourn_inferior = udi_mourn; */
1701 /* OBSOLETE   udi_ops.to_can_run = 0; */
1702 /* OBSOLETE   udi_ops.to_notice_signals = 0; */
1703 /* OBSOLETE   udi_ops.to_thread_alive = 0; */
1704 /* OBSOLETE   udi_ops.to_stop = 0; */
1705 /* OBSOLETE   udi_ops.to_stratum = process_stratum; */
1706 /* OBSOLETE   udi_ops.DONT_USE = 0; */
1707 /* OBSOLETE   udi_ops.to_has_all_memory = 1; */
1708 /* OBSOLETE   udi_ops.to_has_memory = 1; */
1709 /* OBSOLETE   udi_ops.to_has_stack = 1; */
1710 /* OBSOLETE   udi_ops.to_has_registers = 1; */
1711 /* OBSOLETE   udi_ops.to_has_execution = 1; */
1712 /* OBSOLETE   udi_ops.to_sections = 0; */
1713 /* OBSOLETE   udi_ops.to_sections_end = 0; */
1714 /* OBSOLETE   udi_ops.to_magic = OPS_MAGIC; */
1715 /* OBSOLETE }; */
1716 /* OBSOLETE  */
1717 /* OBSOLETE void */
1718 /* OBSOLETE _initialize_remote_udi (void) */
1719 /* OBSOLETE { */
1720 /* OBSOLETE   init_udi_ops (); */
1721 /* OBSOLETE   add_target (&udi_ops); */
1722 /* OBSOLETE } */