* putenv.c: index -> strchr.
[deliverable/binutils-gdb.git] / gdb / remote-udi.c
CommitLineData
15ee4caa 1/* Remote debugging interface for AMD 29k interfaced via UDI, for GDB.
5140562f
JG
2 Copyright 1990, 1992 Free Software Foundation, Inc.
3 Written by Daniel Mann. Contributed by AMD.
9bddba9a
SG
4
5This file is part of GDB.
6
7This program is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
5140562f
JG
9the Free Software Foundation; either version 2 of the License, or
10(at your option) any later version.
9bddba9a
SG
11
12This program is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
5140562f
JG
18along with this program; if not, write to the Free Software
19Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
9bddba9a 20
15ee4caa
JG
21/* This is like remote.c but uses the Universal Debug Interface (UDI) to
22 talk to the target hardware (or simulator). UDI is a TCP/IP based
23 protocol; for hardware that doesn't run TCP, an interface adapter
24 daemon talks UDI on one side, and talks to the hardware (typically
25 over a serial port) on the other side.
26
27 - Originally written by Daniel Mann at AMD for MiniMON and gdb 3.91.6.
5140562f
JG
28 - David Wood (wood@lab.ultra.nyu.edu) at New York University adapted this
29 file to gdb 3.95. I was unable to get this working on sun3os4
30 with termio, only with sgtty. Because we are only attempting to
31 use this module to debug our kernel, which is already loaded when
32 gdb is started up, I did not code up the file downloading facilities.
33 As a result this module has only the stubs to download files.
34 You should get tagged at compile time if you need to make any
35 changes/additions.
15ee4caa 36 - Daniel Mann at AMD took the 3.95 adaptions above and replaced
5140562f
JG
37 MiniMON interface with UDI-p interface. */
38
9bddba9a
SG
39#include "defs.h"
40#include "inferior.h"
41#include "wait.h"
42#include "value.h"
43#include <ctype.h>
44#include <fcntl.h>
45#include <signal.h>
46#include <errno.h>
47#include <string.h>
48#include "terminal.h"
49#include "target.h"
aa942355 50#include "29k-share/udi/udiproc.h"
9bddba9a
SG
51
52/* access the register store directly, without going through
836e343b 53 the normal handler functions. This avoids an extra data copy. */
9bddba9a 54
9bddba9a
SG
55extern int stop_soon_quietly; /* for wait_for_inferior */
56extern struct value *call_function_by_hand();
57static void udi_resume();
58static void udi_fetch_registers ();
59static void udi_load();
60static int fetch_register ();
61static void udi_store_registers ();
62static int store_register ();
63static int regnum_to_srnum();
64static void udi_close ();
65static CPUSpace udi_memory_space();
66static int udi_write_inferior_memory();
67static int udi_read_inferior_memory();
68char CoffFileName[100] = "";
69/*
70 * Processor types.
71 */
72#define TYPE_UNKNOWN 0
73#define TYPE_A29000 1
74#define TYPE_A29030 2
75#define TYPE_A29050 3
76static char *processor_name[] = { "Unknown", "Am29000", "Am29030", "Am29050" };
77static int processor_type=TYPE_UNKNOWN;
78#define FREEZE_MODE (read_register(CPS_REGNUM) && 0x400)
79#define USE_SHADOW_PC ((processor_type == TYPE_A29050) && FREEZE_MODE)
80
81#define LLOG_FILE "udi.log"
82#if defined (LOG_FILE)
83FILE *log_file;
84#endif
85
86static int timeout = 5;
87extern struct target_ops udi_ops; /* Forward declaration */
88
89/* Special register enumeration.
90*/
91
92/******************************************************************* UDI DATA*/
93#define MAXDATA 2*1024 /* max UDI[read/write] byte size */
94/* Descriptor for I/O to remote machine. Initialize it to -1 so that
95 udi_open knows that we don't have a file open when the program
96 starts. */
97 UDISessionId udi_session_id = -1;
98
99 CPUOffset IMemStart = 0;
100 CPUSizeT IMemSize = 0;
101 CPUOffset DMemStart = 0;
102 CPUSizeT DMemSize = 0;
103 CPUOffset RMemStart = 0;
104 CPUSizeT RMemSize = 0;
105 UDIUInt32 CPUPRL;
106 UDIUInt32 CoProcPRL;
107
108#define SBUF_MAX 1024 /* maximum size of string handling buffer */
109char sbuf[SBUF_MAX];
110
111typedef struct bkpt_entry_str
112{
113 UDIResource Addr;
114 UDIUInt32 PassCount;
115 UDIBreakType Type;
116 unsigned int BreakId;
117} bkpt_entry_t;
54847287
SG
118#define BKPT_TABLE_SIZE 40
119static bkpt_entry_t bkpt_table[BKPT_TABLE_SIZE];
9bddba9a
SG
120extern char dfe_errmsg[]; /* error string */
121
122/*********************************************************** SIGNAL SUPPORT */
123/* Called when SIGALRM signal sent due to alarm() timeout. */
124#ifndef HAVE_TERMIO
125
126#ifndef __STDC__
127# ifndef volatile
128# define volatile /**/
129# endif
130#endif
131volatile int n_alarms;
132
133static void
134udi_timer ()
135{
136#if 0
137 if (kiodebug)
138 printf ("udi_timer called\n");
139#endif
140 n_alarms++;
141}
142#endif /* HAVE_TERMIO */
143
144/* malloc'd name of the program on the remote system. */
145static char *prog_name = NULL;
146
147
148/* Number of SIGTRAPs we need to simulate. That is, the next
149 NEED_ARTIFICIAL_TRAP calls to udi_wait should just return
150 SIGTRAP without actually waiting for anything. */
151
152/******************************************************* UDI_CREATE_INFERIOR */
153/* This is called not only when we first attach, but also when the
154 user types "run" after having attached. */
155static void
156udi_create_inferior (execfile, args, env)
157 char *execfile;
158 char *args;
159 char **env;
160{
9bddba9a
SG
161
162 if (execfile)
163 { if (prog_name != NULL)
164 free (prog_name);
165 prog_name = savestring (execfile, strlen (execfile));
166 }
167
168 if (prog_name == 0 /* || exec_bfd == 0 */ )
169 error ("No exec file specified");
170
171 if (udi_session_id < 0){
172 printf("UDI connection not open yet.\n");
173 return;
174 }
175
d0b04c6a
SG
176 inferior_pid = 40000;
177
9bddba9a
SG
178#if defined(ULTRA3) && defined(KERNEL_DEBUGGING)
179 /* On ultra3 (NYU) we assume the kernel is already running so there is
180 * no file to download
181 */
182#else
183 if(*args == '\0') args = prog_name;
184 udi_load(args, 0);
185#endif /* !ULTRA3 */
186
9bddba9a
SG
187 init_wait_for_inferior ();
188 clear_proceed_status ();
189 proceed(-1,-1,0);
9bddba9a
SG
190}
191/******************************************************* UDI_MOURN_INFERIOR */
192static void
193udi_mourn()
194{
9bddba9a
SG
195 pop_target (); /* Pop back to no-child state */
196 generic_mourn_inferior ();
9bddba9a
SG
197}
198
199/******************************************************************** UDI_OPEN
200** Open a connection to remote TIP.
201 NAME is the socket domain used for communication with the TIP,
202 then a space and the socket name or TIP-host name.
203 '<udi_udi_config_id> [progname]' for example.
204 */
205
d0b04c6a
SG
206/* XXX - need cleanups for udiconnect for various failures!!! */
207
9bddba9a
SG
208static char *udi_config_id;
209static void
210udi_open (name, from_tty)
211 char *name;
212 int from_tty;
213{
214 unsigned int prl;
215 char *p;
216 int cnt;
217 UDIMemoryRange KnownMemory[10];
218 UDIUInt32 ChipVersions[10];
219 UDIInt NumberOfRanges = 10;
220 UDIInt NumberOfChips = 10;
221 UDIPId PId;
222 UDIUInt32 TIPId, TargetId, DFEId, DFE, TIP, DFEIPCId, TIPIPCId;
223
d0b04c6a
SG
224 target_preopen(from_tty);
225
9bddba9a
SG
226 /* Find the first whitespace character, it separates udi_config_id
227 from prog_name. */
228 if(!name) goto erroid;
229 for (p = name;
230 *p != '\0' && !isspace (*p); p++)
231 ;
232 if (*p == '\0')
233erroid:
234 error("Usage: target udi config_id progname, where config_id appears in udi_soc file");
d0b04c6a 235
9bddba9a
SG
236 udi_config_id = (char*)malloc (p - name + 1);
237 strncpy (udi_config_id, name, p - name);
238 udi_config_id[p - name] = '\0';
239
240 /* Skip over the whitespace after udi_config_id */
241 for (; isspace (*p); p++)
242 /*EMPTY*/;
243
244 if (prog_name != NULL)
245 free (prog_name);
246 prog_name = savestring (p, strlen (p));
247
d0b04c6a
SG
248 if (UDIConnect(udi_config_id, &udi_session_id))
249 error("UDIConnect() failed: %s\n", dfe_errmsg);
9bddba9a 250
9bddba9a
SG
251 push_target (&udi_ops);
252
253#ifndef HAVE_TERMIO
254#ifndef NO_SIGINTERRUPT
255 /* Cause SIGALRM's to make reads fail with EINTR instead of resuming
256 the read. */
257 if (siginterrupt (SIGALRM, 1) != 0)
d0b04c6a 258 error ("udi_open: siginterrupt() %s", safe_strerror(errno));
9bddba9a
SG
259#endif
260
261 /* Set up read timeout timer. */
262 if ((void (*)) signal (SIGALRM, udi_timer) == (void (*)) -1)
d0b04c6a 263 error ("udi_open: signal() %s", safe_strerror(errno));
9bddba9a
SG
264#endif
265
266#if defined (LOG_FILE)
267 log_file = fopen (LOG_FILE, "w");
268 if (log_file == NULL)
d0b04c6a 269 error ("udi_open: fopen(%s) %s", LOG_FILE, safe_strerror(errno));
9bddba9a
SG
270#endif
271 /*
272 ** Initialize target configuration structure (global)
273 */
274 if(UDIGetTargetConfig( KnownMemory, &NumberOfRanges,
275 ChipVersions, &NumberOfChips))
276 error ("UDIGetTargetConfig() failed");
277 if(NumberOfChips > 2)
278 fprintf(stderr,"Taret has more than one processor\n");
279 for(cnt=0; cnt<NumberOfRanges; cnt++)
280 { switch(KnownMemory[cnt].Space)
281 {
282 default: fprintf(stderr, "UDIGetTargetConfig() unknown memory space\n");
283 break;
284 case UDI29KCP_S:
285 break;
286 case UDI29KIROMSpace:
287 RMemStart = KnownMemory[cnt].Offset;
288 RMemSize = KnownMemory[cnt].Size;
289 break;
290 case UDI29KIRAMSpace:
291 IMemStart = KnownMemory[cnt].Offset;
292 IMemSize = KnownMemory[cnt].Size;
293 break;
294 case UDI29KDRAMSpace:
295 DMemStart = KnownMemory[cnt].Offset;
296 DMemSize = KnownMemory[cnt].Size;
297 break;
298 }
299 }
300
301 /* Determine the processor revision level */
302 prl = (unsigned int)read_register(CFG_REGNUM) >> 24;
303 if ((prl&0xe0) == 0)
304 { fprintf_filtered(stderr,
305 "Remote debugging Am29000 rev %c\n",'A'+(prl&0x1f));
306 processor_type = TYPE_A29000;
307 } else if ((prl&0xe0) == 0x40) /* 29030 = 0x4* */
308 { fprintf_filtered(stderr,
309 "Remote debugging Am2903* rev %c\n",'A'+(prl&0x1f));
310 processor_type = TYPE_A29030;
311 } else if ((prl&0xe0) == 0x20) /* 29050 = 0x2* */
312 { fprintf_filtered(stderr,
313 "Remote debugging Am29050 rev %c\n",'A'+(prl&0x1f));
314 processor_type = TYPE_A29050;
315 } else {
316 processor_type = TYPE_UNKNOWN;
317 fprintf_filtered(stderr,"WARNING: processor type unknown.\n");
318 }
319 if(UDICreateProcess(&PId))
320 fprintf(stderr, "UDICreateProcess() failed\n");
321
322 /* Print out some stuff, letting the user now what's going on */
323 if(UDICapabilities( &TIPId, &TargetId, DFEId, DFE, &TIP, &DFEIPCId,
324 &TIPIPCId, sbuf))
325 error ("UDICapabilities() failed");
326 if (from_tty) {
327 printf_filtered("Remote debugging an %s connected via UDI socket,\n\
328 DFE-IPC version %x.%x.%x TIP-IPC version %x.%x.%x TIP version %x.%x.%x\n %s\n",
329 processor_name[processor_type],
330 (DFEIPCId>>8)&0xf, (DFEIPCId>>4)&0xf, DFEIPCId&0xf,
331 (TIPIPCId>>8)&0xf, (TIPIPCId>>4)&0xf, TIPIPCId&0xf,
332 (TargetId>>8)&0xf, (TargetId>>4)&0xf, TargetId&0xf,
333 sbuf);
334#ifdef ULTRA3
335 /* FIXME: can this restriction be removed? */
336 printf_filtered("Remote debugging using virtual addresses works only\n");
337 printf_filtered(" when virtual addresses map 1:1 to physical addresses.\n");
338#endif
339 }
340#ifdef ULTRA3
341 if (processor_type != TYPE_A29050) {
342 fprintf_filtered(stderr,
343 "Freeze-mode debugging can only be done on an Am29050,\n");
344 fprintf_filtered(stderr,
345 " unless GDB is being used with a 29K simulator.\n");
346 }
347#endif
348}
349
350/******************************************************************* UDI_CLOSE
351 Close the open connection to the TIP process.
352 Use this when you want to detach and do something else
353 with your gdb. */
354static void
355udi_close (quitting) /*FIXME: how is quitting used */
356 int quitting;
357{
358 int Terminate = -1;
9bddba9a
SG
359
360 if (udi_session_id < 0)
361 error ("Can't close udi connection: not debugging remotely.");
362
363 /* We should never get here if there isn't something valid in
364 udi_session_id.
365
366 if(UDIDisconnect(udi_stream, Terminate);)
367 error ("UDIDisconnect() failed in udi_close");
368
369 /* Do not try to close udi_session_id again, later in the program. */
370 udi_session_id = -1;
d0b04c6a 371 inferior_pid = 0;
9bddba9a
SG
372
373#if defined (LOG_FILE)
374 if (ferror (log_file))
375 printf ("Error writing log file.\n");
376 if (fclose (log_file) != 0)
377 printf ("Error closing log file.\n");
378#endif
379
d0b04c6a 380 printf_filtered (" Ending remote debugging\n");
9bddba9a
SG
381}
382
383/**************************************************************** UDI_ATACH */
384/* Attach to a program that is already loaded and running
385 * Upon exiting the process's execution is stopped.
386 */
387static void
388udi_attach (args, from_tty)
389 char *args;
390 int from_tty;
391{
392 UDIResource From;
393 UDIInt32 PC_adds;
394 UDICount Count = 1;
395 UDISizeT Size = 4;
396 UDICount CountDone;
397 UDIBool HostEndian = 0;
9bddba9a
SG
398
399 if (udi_session_id < 0)
f7fe7196 400 error ("UDI connection not opened yet, use the 'target udi' command.\n");
9bddba9a
SG
401
402 if (from_tty)
403 printf ("Attaching to remote program %s...\n", prog_name);
404
9bddba9a
SG
405 UDIStop();
406 From.Space = 11;
407 From.Offset = UDI29KSpecialRegs;
408 if(UDIRead(From, &PC_adds, Count, Size, &CountDone, HostEndian))
409 error ("UDIRead failed in udi_attach");
410 printf ("Remote process is now halted, pc1 = 0x%x.\n", PC_adds);
9bddba9a
SG
411}
412/************************************************************* UDI_DETACH */
413/* Terminate the open connection to the TIP process.
414 Use this when you want to detach and do something else
415 with your gdb. Leave remote process running (with no breakpoints set). */
416static void
417udi_detach (args,from_tty)
418 char *args;
419 int from_tty;
420{
9bddba9a
SG
421 remove_breakpoints(); /* Just in case there were any left in */
422 if(UDIDisconnect(udi_session_id))
423 error ("UDIDisconnect() failed in udi_detach");
424 pop_target(); /* calls udi_close to do the real work */
425 if (from_tty)
426 printf ("Ending remote debugging\n");
9bddba9a
SG
427}
428
429
430/****************************************************************** UDI_RESUME
431** Tell the remote machine to resume. */
432
433static void
434udi_resume (step, sig)
435 int step, sig;
436{
437 UDIError tip_error;
438 UDIUInt32 Steps = 1;
439 UDIStepType StepType = UDIStepNatural;
440 UDIRange Range;
836e343b 441
9bddba9a
SG
442 if (step) /* step 1 instruction */
443 { tip_error = tip_error = UDIStep(Steps, StepType, Range);
444 if(tip_error)fprintf(stderr, "UDIStep() error = %d\n", tip_error);
445 if(tip_error)error ("failed in udi_resume");
446
447 }
448 else
449 { if(UDIExecute())
450 error ("UDIExecute() failed in udi_resume");
451 }
9bddba9a
SG
452}
453
454/******************************************************************** UDI_WAIT
455** Wait until the remote machine stops, then return,
456 storing status in STATUS just as `wait' would. */
457
458static int
459udi_wait (status)
460 WAITTYPE *status;
461{
462 UDIInt32 MaxTime;
463 UDIPId PId;
464 UDIInt32 StopReason;
465 UDISizeT CountDone;
466 int old_timeout = timeout;
467 int old_immediate_quit = immediate_quit;
468 int i;
469
9bddba9a
SG
470 WSETEXIT ((*status), 0);
471
472/* wait for message to arrive. It should be:
473 If the target stops executing, udi_wait() should return.
474*/
475 timeout = 0; /* Wait indefinetly for a message */
476 immediate_quit = 1; /* Helps ability to QUIT */
477 while(1)
478 {
479 i = 0;
480 MaxTime = UDIWaitForever;
481 UDIWait(MaxTime, &PId, &StopReason);
482 QUIT; /* Let user quit if they want */
483 switch (StopReason & 0xff)
484 {
485 default:
486 goto halted;
487 case UDIStdoutReady:
488 if(UDIGetStdout(sbuf, (UDISizeT)SBUF_MAX, &CountDone))
489 error("UDIGetStdin() failed in udi_wait");
490 while(CountDone--)putc(sbuf[i++], stdout);
491 fflush(stdout);
492 break;
493 case UDIStderrReady:
494 UDIGetStderr(sbuf, (UDISizeT)SBUF_MAX, &CountDone);
495 while(CountDone--)putc(sbuf[i++], stderr);
496 fflush(stderr);
497 fflush(stderr);
498 break;
499 case UDIStdinNeeded:
500 printf("DEBUG: stdin requested ... continue\n");
501/* UDIPutStdin(sbuf, (UDISizeT)i, &CountDone); */
502 break;
503 case UDIStdinModeX:
504 break;
505 }
506 continue;
507 }
508halted:
509 if (StopReason & 0xff == UDITrapped ) /* lower 8-bits == 0 */
510 {
511 if (StopReason >> 24 == 0)
512 { printf("Am290*0 received vector number 0 (break point)\n");
513 WSETSTOP ((*status), SIGTRAP);
514 }
515 else if (StopReason >> 24 == 1)
516 { printf("Am290*0 received vector 1\n");
517 WSETSTOP ((*status), SIGBUS);
518 }
519 else if (StopReason >> 24 == 3
520 || StopReason >> 24 == 4)
521 { printf("Am290*0 received vector number %d\n",
522 StopReason >> 24);
523 WSETSTOP ((*status), SIGFPE);
524 }
525 else if (StopReason >> 24 == 5)
526 { printf("Am290*0 received vector number %d\n",
527 StopReason >> 24);
528 WSETSTOP ((*status), SIGILL);
529 }
530 else if (StopReason >> 24 >= 6
531 && StopReason >> 24 <= 11)
532 { printf("Am290*0 received vector number %d\n",
533 StopReason >> 24);
534 WSETSTOP ((*status), SIGSEGV);
535 }
536 else if (StopReason >> 24 == 12
537 || StopReason >> 24 == 13)
538 { printf("Am290*0 received vector number %d\n",
539 StopReason >> 24);
540 WSETSTOP ((*status), SIGILL);
541 }
542 else if ((StopReason & 0xff) == 14)
543 { printf("Am290*0 received vector number %d\n",
544 StopReason >> 24);
545 WSETSTOP ((*status), SIGALRM);
546 }
547 else if ((StopReason & 0xff) == 15)
548 WSETSTOP ((*status), SIGTRAP);
549 else if ((StopReason >> 24) >= 16
550 && (StopReason >> 24) <= 21)
551 { printf("Am290*0 received vector number %d\n",
552 StopReason >> 24);
553 WSETSTOP ((*status), SIGINT);
554 }
555 else if ((StopReason & 0xff) == 22)
556 { printf("Am290*0 received vector number %d\n",
557 StopReason >> 24);
558 WSETSTOP ((*status), SIGILL);
559 }
560 else if ((StopReason & 0xff) == 77)
561 WSETSTOP ((*status), SIGTRAP);
562 else
563exit:
564 WSETEXIT ((*status), 0);
565 }
566 else if ((StopReason & 0xff) == UDIBreak)
567 WSETSTOP ((*status), SIGTRAP);
568 else if ((StopReason & 0xff) == UDINotExecuting)
569 WSETSTOP ((*status), SIGTERM);
570 else if ((StopReason & 0xff) == UDIRunning)
571 WSETSTOP ((*status), SIGILL);
572 else if ((StopReason & 0xff) == UDIStopped)
573 WSETSTOP ((*status), SIGTSTP);
574 else if ((StopReason & 0xff) == UDIWarned)
575 WSETSTOP ((*status), SIGLOST);
576 else if ((StopReason & 0xff) == UDIStepped)
577 WSETSTOP ((*status), SIGTRAP);
578 else if ((StopReason & 0xff) == UDIWaiting)
579 WSETSTOP ((*status), SIGSTOP);
580 else if ((StopReason & 0xff) == UDIHalted)
581 WSETSTOP ((*status), SIGKILL);
582 else
583 WSETEXIT ((*status), 0);
584
585 timeout = old_timeout; /* Restore original timeout value */
586 immediate_quit = old_immediate_quit;
9bddba9a
SG
587 return 0;
588}
589
590/********************************************************** UDI_FETCH_REGISTERS
591 * Read a remote register 'regno'.
592 * If regno==-1 then read all the registers.
593 */
594static void
595udi_fetch_registers (regno)
596int regno;
597{
598 UDIResource From;
599 UDIUInt32 *To;
600 UDICount Count;
601 UDISizeT Size = 4;
602 UDICount CountDone;
603 UDIBool HostEndian = 0;
604 int i;
605
606 if (regno >= 0) {
d0b04c6a
SG
607 fetch_register(regno);
608 return;
9bddba9a 609 }
9bddba9a
SG
610
611/* Gr1/rsp */
d0b04c6a 612
9bddba9a
SG
613 From.Space = UDI29KGlobalRegs;
614 From.Offset = 1;
d0b04c6a 615 To = (UDIUInt32 *)&registers[4 * GR1_REGNUM];
9bddba9a 616 Count = 1;
d0b04c6a 617 if (UDIRead(From, To, Count, Size, &CountDone, HostEndian))
9bddba9a 618 error("UDIRead() failed in udi_fetch_registers");
d0b04c6a
SG
619
620 register_valid[GR1_REGNUM] = 1;
9bddba9a
SG
621
622#if defined(GR64_REGNUM) /* Read gr64-127 */
d0b04c6a 623
9bddba9a 624/* Global Registers gr64-gr95 */
d0b04c6a 625
9bddba9a
SG
626 From.Space = UDI29KGlobalRegs;
627 From.Offset = 64;
d0b04c6a 628 To = (UDIUInt32 *)&registers[4 * GR64_REGNUM];
9bddba9a 629 Count = 32;
d0b04c6a 630 if (UDIRead(From, To, Count, Size, &CountDone, HostEndian))
9bddba9a 631 error("UDIRead() failed in udi_fetch_registers");
d0b04c6a
SG
632
633 for (i = GR64_REGNUM; i < GR64_REGNUM + 32; i++)
634 register_valid[i] = 1;
635
9bddba9a
SG
636#endif /* GR64_REGNUM */
637
638/* Global Registers gr96-gr127 */
d0b04c6a 639
9bddba9a 640 From.Space = UDI29KGlobalRegs;
d0b04c6a
SG
641 From.Offset = 96;
642 To = (UDIUInt32 *)&registers[4 * GR96_REGNUM];
9bddba9a 643 Count = 32;
d0b04c6a 644 if (UDIRead(From, To, Count, Size, &CountDone, HostEndian))
9bddba9a 645 error("UDIRead() failed in udi_fetch_registers");
9bddba9a 646
d0b04c6a
SG
647 for (i = GR96_REGNUM; i < GR96_REGNUM + 32; i++)
648 register_valid[i] = 1;
649
650/* Local Registers */
651
9bddba9a
SG
652 From.Space = UDI29KLocalRegs;
653 From.Offset = 0;
d0b04c6a 654 To = (UDIUInt32 *)&registers[4 * LR0_REGNUM];
9bddba9a 655 Count = 128;
d0b04c6a 656 if (UDIRead(From, To, Count, Size, &CountDone, HostEndian))
9bddba9a 657 error("UDIRead() failed in udi_fetch_registers");
9bddba9a 658
d0b04c6a
SG
659 for (i = LR0_REGNUM; i < LR0_REGNUM + 128; i++)
660 register_valid[i] = 1;
661
662/* Protected Special Registers */
663
9bddba9a
SG
664 From.Space = UDI29KSpecialRegs;
665 From.Offset = 0;
d0b04c6a 666 To = (UDIUInt32 *)&registers[4 * SR_REGNUM(0)];
9bddba9a 667 Count = 15;
d0b04c6a 668 if (UDIRead(From, To, Count, Size, &CountDone, HostEndian))
9bddba9a 669 error("UDIRead() failed in udi_fetch_registers");
d0b04c6a
SG
670
671 for (i = SR_REGNUM(0); i < SR_REGNUM(0) + 15; i++)
672 register_valid[i] = 1;
9bddba9a
SG
673
674 if (USE_SHADOW_PC) { /* Let regno_to_srnum() handle the register number */
d0b04c6a
SG
675 fetch_register(NPC_REGNUM);
676 fetch_register(PC_REGNUM);
677 fetch_register(PC2_REGNUM);
9bddba9a 678
d0b04c6a
SG
679/* Unprotected Special Registers sr128-sr135 */
680
681 From.Space = UDI29KSpecialRegs;
9bddba9a 682 From.Offset = 128;
d0b04c6a
SG
683 To = (UDIUInt32 *)&registers[4 * SR_REGNUM(128)];
684 Count = 135-128 + 1;
685 if (UDIRead(From, To, Count, Size, &CountDone, HostEndian))
9bddba9a 686 error("UDIRead() failed in udi_fetch_registers");
d0b04c6a
SG
687
688 for (i = SR_REGNUM(128); i < SR_REGNUM(128) + 135-128+1; i++)
689 register_valid[i] = 1;
9bddba9a
SG
690 }
691
692 /* There doesn't seem to be any way to get these. */
693 {
694 int val = -1;
695 supply_register (FPE_REGNUM, (char *) &val);
d0b04c6a 696 supply_register (INTE_REGNUM, (char *) &val);
9bddba9a
SG
697 supply_register (FPS_REGNUM, (char *) &val);
698 supply_register (EXO_REGNUM, (char *) &val);
699 }
9bddba9a
SG
700}
701
702
703/********************************************************* UDI_STORE_REGISTERS
704** Store register regno into the target.
705 * If regno==-1 then store all the registers.
706 */
707
708static void
709udi_store_registers (regno)
710int regno;
711{
712 UDIUInt32 *From;
713 UDIResource To;
714 UDICount Count;
715 UDISizeT Size = 4;
716 UDICount CountDone;
717 UDIBool HostEndian = 0;
718
719 if (regno >= 0)
720 {
721 store_register(regno);
722 return;
723 }
724
9bddba9a 725/* Gr1/rsp */
d0b04c6a
SG
726
727 From = (UDIUInt32 *)&registers[4 * GR1_REGNUM];
9bddba9a
SG
728 To.Space = UDI29KGlobalRegs;
729 To.Offset = 1;
730 Count = 1;
731 if(UDIWrite(From, To, Count, Size, &CountDone, HostEndian))
732 error("UDIWrite() failed in udi_store_regisetrs");
733
734#if defined(GR64_REGNUM)
d0b04c6a 735
9bddba9a 736/* Global registers gr64-gr95 */
d0b04c6a
SG
737
738 From = (UDIUInt32 *)&registers[4 * GR64_REGNUM];
9bddba9a
SG
739 To.Space = UDI29KGlobalRegs;
740 To.Offset = 64;
741 Count = 32;
742 if(UDIWrite(From, To, Count, Size, &CountDone, HostEndian))
743 error("UDIWrite() failed in udi_store_regisetrs");
d0b04c6a 744
9bddba9a
SG
745#endif /* GR64_REGNUM */
746
747/* Global registers gr96-gr127 */
d0b04c6a
SG
748
749 From = (UDIUInt32 *)&registers[4 * GR96_REGNUM];
9bddba9a
SG
750 To.Space = UDI29KGlobalRegs;
751 To.Offset = 96;
752 Count = 32;
753 if(UDIWrite(From, To, Count, Size, &CountDone, HostEndian))
754 error("UDIWrite() failed in udi_store_regisetrs");
755
756/* Local Registers */
d0b04c6a
SG
757
758 From = (UDIUInt32 *)&registers[4 * LR0_REGNUM];
9bddba9a
SG
759 To.Space = UDI29KLocalRegs;
760 To.Offset = 0;
761 Count = 128;
762 if(UDIWrite(From, To, Count, Size, &CountDone, HostEndian))
763 error("UDIWrite() failed in udi_store_regisetrs");
764
765
766/* Protected Special Registers */ /* VAB through TMR */
d0b04c6a
SG
767
768 From = (UDIUInt32 *)&registers[4 * SR_REGNUM(0)];
9bddba9a
SG
769 To.Space = UDI29KSpecialRegs;
770 To.Offset = 0;
771 Count = 10;
772 if(UDIWrite(From, To, Count, Size, &CountDone, HostEndian))
773 error("UDIWrite() failed in udi_store_regisetrs");
774
d0b04c6a
SG
775/* PC0, PC1, PC2 possibly as shadow registers */
776
777 From = (UDIUInt32 *)&registers[4 * SR_REGNUM(10)];
9bddba9a
SG
778 To.Space = UDI29KSpecialRegs;
779 Count = 3;
780 if (USE_SHADOW_PC)
781 To.Offset = 20; /* SPC0 */
782 else
783 To.Offset = 10; /* PC0 */
784 if(UDIWrite(From, To, Count, Size, &CountDone, HostEndian))
785 error("UDIWrite() failed in udi_store_regisetrs");
786
787 /* LRU and MMU */
d0b04c6a
SG
788
789 From = (UDIUInt32 *)&registers[4 * SR_REGNUM(13)];
9bddba9a
SG
790 To.Space = UDI29KSpecialRegs;
791 To.Offset = 13;
792 Count = 2;
793 if(UDIWrite(From, To, Count, Size, &CountDone, HostEndian))
794 error("UDIWrite() failed in udi_store_regisetrs");
795
796/* Unprotected Special Registers */
d0b04c6a
SG
797
798 From = (UDIUInt32 *)&registers[4 * SR_REGNUM(128)];
9bddba9a
SG
799 To.Space = UDI29KSpecialRegs;
800 To.Offset = 128;
801 Count = 135-128 +1;
802 if(UDIWrite(From, To, Count, Size, &CountDone, HostEndian))
803 error("UDIWrite() failed in udi_store_regisetrs");
804
805 registers_changed ();
9bddba9a
SG
806}
807
808/****************************************************** UDI_PREPARE_TO_STORE */
809/* Get ready to modify the registers array. On machines which store
810 individual registers, this doesn't need to do anything. On machines
811 which store all the registers in one fell swoop, this makes sure
812 that registers contains all the registers from the program being
813 debugged. */
814
815static void
816udi_prepare_to_store ()
817{
818 /* Do nothing, since we can store individual regs */
819}
820
821/********************************************************** TRANSLATE_ADDR */
822static CORE_ADDR
823translate_addr(addr)
824CORE_ADDR addr;
825{
826#if defined(ULTRA3) && defined(KERNEL_DEBUGGING)
827 /* Check for a virtual address in the kernel */
828 /* Assume physical address of ublock is in paddr_u register */
829 /* FIXME: doesn't work for user virtual addresses */
830 if (addr >= UVADDR) {
831 /* PADDR_U register holds the physical address of the ublock */
832 CORE_ADDR i = (CORE_ADDR)read_register(PADDR_U_REGNUM);
833 return(i + addr - (CORE_ADDR)UVADDR);
834 } else {
835 return(addr);
836 }
837#else
838 return(addr);
839#endif
840}
841/************************************************* UDI_XFER_INFERIOR_MEMORY */
842/* FIXME! Merge these two. */
843static int
844udi_xfer_inferior_memory (memaddr, myaddr, len, write)
845 CORE_ADDR memaddr;
846 char *myaddr;
847 int len;
848 int write;
849{
850
851 memaddr = translate_addr(memaddr);
852
853 if (write)
854 return udi_write_inferior_memory (memaddr, myaddr, len);
855 else
856 return udi_read_inferior_memory (memaddr, myaddr, len);
857}
858
859/********************************************************** UDI_FILES_INFO */
860static void
861udi_files_info ()
862{
863 printf ("\tAttached to UDI socket to %s and running program %s.\n",
864 udi_config_id, prog_name);
865}
866
867/**************************************************** UDI_INSERT_BREAKPOINT */
868static int
869udi_insert_breakpoint (addr, contents_cache)
870 CORE_ADDR addr;
871 char *contents_cache;
872{
54847287
SG
873 int cnt;
874 UDIError err;
875
876 for (cnt = 0; cnt < BKPT_TABLE_SIZE; cnt++)
877 if (bkpt_table[cnt].Type == 0) /* Find first free slot */
878 break;
879
880 if(cnt >= BKPT_TABLE_SIZE)
881 error("Too many breakpoints set");
9bddba9a 882
9bddba9a
SG
883 bkpt_table[cnt].Addr.Offset = addr;
884 bkpt_table[cnt].Addr.Space = UDI29KIRAMSpace;
885 bkpt_table[cnt].PassCount = 1;
886 bkpt_table[cnt].Type = UDIBreakFlagExecute;
887
54847287
SG
888 err = UDISetBreakpoint(bkpt_table[cnt].Addr,
889 bkpt_table[cnt].PassCount,
890 bkpt_table[cnt].Type,
891 &bkpt_table[cnt].BreakId);
892
893 if (err == 0) return 0; /* Success */
894
895 bkpt_table[cnt].Type = 0;
896 error("UDISetBreakpoint returned error code %d\n", err);
9bddba9a
SG
897}
898
899/**************************************************** UDI_REMOVE_BREAKPOINT */
900static int
901udi_remove_breakpoint (addr, contents_cache)
902 CORE_ADDR addr;
903 char *contents_cache;
904{
54847287
SG
905 int cnt;
906 UDIError err;
907
908 for (cnt = 0; cnt < BKPT_TABLE_SIZE; cnt++)
909 if (bkpt_table[cnt].Addr.Offset == addr) /* Find matching breakpoint */
910 break;
911
912 if(cnt >= BKPT_TABLE_SIZE)
913 error("Can't find breakpoint in table");
914
9bddba9a
SG
915 bkpt_table[cnt].Type = 0;
916
54847287
SG
917 err = UDIClearBreakpoint(bkpt_table[cnt].BreakId);
918 if (err == 0) return 0; /* Success */
9bddba9a 919
54847287
SG
920 error("UDIClearBreakpoint returned error code %d\n", err);
921}
9bddba9a
SG
922
923/***************************************************************** UDI_KILL */
924static void
925udi_kill(arg,from_tty)
926char *arg;
927int from_tty;
928{
929 char buf[4];
930
9bddba9a
SG
931#if defined(ULTRA3) && defined(KERNEL_DEBUGGING)
932 /* We don't ever kill the kernel */
933 if (from_tty) {
d0b04c6a
SG
934 printf_filtered("Kernel not killed, but left in current state.\n");
935 printf_filtered("Use detach to leave kernel running.\n");
9bddba9a
SG
936 }
937#else
938 UDIStop();
d0b04c6a 939 inferior_pid = 0;
9bddba9a
SG
940 if (from_tty) {
941 printf("Target has been stopped.");
942 }
943 pop_target();
944#endif
9bddba9a
SG
945}
946
947
948
949/***************************************************************** UDI_LOAD */
950/*
951 * Load a program into the target.
952 */
953static void
954udi_load(arg_string,from_tty)
955char *arg_string;
956int from_tty;
957{
958#define MAX_TOKENS 25
959#define BUFFER_SIZE 256
960 int token_count;
961 char *token[MAX_TOKENS];
962 char cmd_line[BUFFER_SIZE];
963
964 dont_repeat ();
965
966#if defined(KERNEL_DEBUGGING) && defined(ULTRA3)
967 printf("The kernel had better be loaded already! Loading not done.\n");
968#else
969 if (arg_string == 0)
970 error ("The load command takes a file name");
971 arg_string = tilde_expand (arg_string);
972 sprintf(cmd_line,"y %s %s", prog_name, arg_string);
973
974 token_count = 0;
975 token[0] = cmd_line;
976
977 if (cmd_line[0] != '\0')
978 { token[token_count] = strtok(cmd_line, " \t,;\n\r");
979
980 if (token[token_count] != NULL)
981 { do {
982 token_count = token_count + 1;
983 token[token_count] = strtok((char *) NULL, " \t,;\n\r");
984 } while ((token[token_count] != NULL) &&
985 (token_count < MAX_TOKENS));
986 }
987 else
988 *token[0] = '\0';
989 }
990 make_cleanup (free, arg_string);
991 QUIT;
992 immediate_quit++;
993 if(yank_cmd(token, token_count))
994 error("Failure when tring to load program");
995 immediate_quit--;
996 symbol_file_add (arg_string, from_tty, 0, 0, 0, 0);/*DEBUG need to add text_addr */
997#endif
998
999}
1000
1001/*************************************************** UDI_WRITE_INFERIOR_MEMORY
1002** Copy LEN bytes of data from debugger memory at MYADDR
1003 to inferior's memory at MEMADDR. Returns number of bytes written. */
1004static int
1005udi_write_inferior_memory (memaddr, myaddr, len)
1006 CORE_ADDR memaddr;
1007 char *myaddr;
1008 int len;
1009{
1010 int nwritten = 0;
1011 UDIUInt32 *From;
1012 UDIResource To;
1013 UDICount Count;
1014 UDISizeT Size = 1;
1015 UDICount CountDone = 0;
1016 UDIBool HostEndian = 0;
1017
9bddba9a
SG
1018 To.Space = udi_memory_space(memaddr);
1019 From = (UDIUInt32*)myaddr;
1020
1021 while (nwritten < len)
1022 { Count = len - nwritten;
1023 if (Count > MAXDATA) Count = MAXDATA;
1024 To.Offset = memaddr + nwritten;
1025 if(UDIWrite(From, To, Count, Size, &CountDone, HostEndian))
1026 { error("UDIWrite() failed in udi_write_inferrior_memory");
1027 break;
1028 }
1029 else
1030 { nwritten += CountDone;
1031 From += CountDone;
1032 }
1033 }
9bddba9a
SG
1034 return(nwritten);
1035}
1036
1037/**************************************************** UDI_READ_INFERIOR_MEMORY
1038** Read LEN bytes from inferior memory at MEMADDR. Put the result
1039 at debugger address MYADDR. Returns number of bytes read. */
1040static int
1041udi_read_inferior_memory(memaddr, myaddr, len)
1042 CORE_ADDR memaddr;
1043 char *myaddr;
1044 int len;
1045{
1046 int nread = 0;
1047 UDIResource From;
1048 UDIUInt32 *To;
1049 UDICount Count;
1050 UDISizeT Size = 1;
1051 UDICount CountDone = 0;
1052 UDIBool HostEndian = 0;
1053
9bddba9a
SG
1054 From.Space = udi_memory_space(memaddr);
1055 To = (UDIUInt32*)myaddr;
1056
1057 while (nread < len)
1058 { Count = len - nread;
1059 if (Count > MAXDATA) Count = MAXDATA;
1060 From.Offset = memaddr + nread;
1061 if(UDIRead(From, To, Count, Size, &CountDone, HostEndian))
1062 { error("UDIWrite() failed in udi_read_inferrior_memory");
1063 break;
1064 }
1065 else
1066 { nread += CountDone;
1067 To += CountDone;
1068 }
1069 }
1070 return(nread);
1071}
1072
1073/********************************************************************* WARNING
1074*/
1075udi_warning(num)
1076int num;
1077{
1078 error ("ERROR while loading program into remote TIP: $d\n", num);
1079}
1080
1081
1082/*****************************************************************************/
1083/* Fetch a single register indicatated by 'regno'.
1084 * Returns 0/-1 on success/failure.
1085 */
1086static int
1087fetch_register (regno)
1088 int regno;
1089{
1090 UDIResource From;
1091 UDIUInt32 To;
1092 UDICount Count = 1;
1093 UDISizeT Size = 4;
1094 UDICount CountDone;
1095 UDIBool HostEndian = 0;
1096 int result;
1097
9bddba9a 1098 if (regno == GR1_REGNUM)
d0b04c6a
SG
1099 {
1100 From.Space = UDI29KGlobalRegs;
1101 From.Offset = 1;
1102 }
9bddba9a 1103 else if (regno >= GR96_REGNUM && regno < GR96_REGNUM + 32)
d0b04c6a
SG
1104 {
1105 From.Space = UDI29KGlobalRegs;
1106 From.Offset = (regno - GR96_REGNUM) + 96;;
1107 }
1108
9bddba9a 1109#if defined(GR64_REGNUM)
d0b04c6a 1110
9bddba9a 1111 else if (regno >= GR64_REGNUM && regno < GR64_REGNUM + 32 )
d0b04c6a
SG
1112 {
1113 From.Space = UDI29KGlobalRegs;
1114 From.Offset = (regno - GR64_REGNUM) + 64;
1115 }
1116
9bddba9a 1117#endif /* GR64_REGNUM */
d0b04c6a 1118
9bddba9a 1119 else if (regno >= LR0_REGNUM && regno < LR0_REGNUM + 128)
d0b04c6a
SG
1120 {
1121 From.Space = UDI29KLocalRegs;
1122 From.Offset = (regno - LR0_REGNUM);
1123 }
9bddba9a 1124 else if (regno>=FPE_REGNUM && regno<=EXO_REGNUM)
d0b04c6a
SG
1125 {
1126 int val = -1;
1127 supply_register(160 + (regno - FPE_REGNUM),(char *) &val);
1128 return 0; /* Pretend Success */
1129 }
9bddba9a 1130 else
d0b04c6a
SG
1131 {
1132 From.Space = UDI29KSpecialRegs;
1133 From.Offset = regnum_to_srnum(regno);
1134 }
1135
1136 if (UDIRead(From, &To, Count, Size, &CountDone, HostEndian))
9bddba9a 1137 error("UDIRead() failed in udi_fetch_registers");
d0b04c6a 1138
9bddba9a
SG
1139 supply_register(regno, (char *) &To);
1140 return result;
1141}
1142/*****************************************************************************/
1143/* Store a single register indicated by 'regno'.
1144 * Returns 0/-1 on success/failure.
1145 */
1146static int
1147store_register (regno)
1148 int regno;
1149{
1150 int result;
1151 UDIUInt32 From;
1152 UDIResource To;
1153 UDICount Count = 1;
1154 UDISizeT Size = 4;
1155 UDICount CountDone;
1156 UDIBool HostEndian = 0;
1157
9bddba9a
SG
1158 From = read_register (regno); /* get data value */
1159
1160 if (regno == GR1_REGNUM)
1161 { To.Space = UDI29KGlobalRegs;
1162 To.Offset = 1;
1163 result = UDIWrite(&From, To, Count, Size, &CountDone, HostEndian);
1164 /* Setting GR1 changes the numbers of all the locals, so invalidate the
1165 * register cache. Do this *after* calling read_register, because we want
1166 * read_register to return the value that write_register has just stuffed
1167 * into the registers array, not the value of the register fetched from
1168 * the inferior.
1169 */
1170 registers_changed ();
1171 }
1172#if defined(GR64_REGNUM)
1173 else if (regno >= GR64_REGNUM && regno < GR64_REGNUM + 32 )
1174 { To.Space = UDI29KGlobalRegs;
1175 To.Offset = (regno - GR64_REGNUM) + 64;
1176 result = UDIWrite(&From, To, Count, Size, &CountDone, HostEndian);
1177 }
1178#endif /* GR64_REGNUM */
1179 else if (regno >= GR96_REGNUM && regno < GR96_REGNUM + 32)
1180 { To.Space = UDI29KGlobalRegs;
1181 To.Offset = (regno - GR96_REGNUM) + 96;
1182 result = UDIWrite(&From, To, Count, Size, &CountDone, HostEndian);
1183 }
1184 else if (regno >= LR0_REGNUM && regno < LR0_REGNUM + 128)
1185 { To.Space = UDI29KLocalRegs;
1186 To.Offset = (regno - LR0_REGNUM);
1187 result = UDIWrite(&From, To, Count, Size, &CountDone, HostEndian);
1188 }
1189 else if (regno>=FPE_REGNUM && regno<=EXO_REGNUM)
1190 {
1191 return 0; /* Pretend Success */
1192 }
1193 else /* An unprotected or protected special register */
1194 { To.Space = UDI29KSpecialRegs;
1195 To.Offset = regnum_to_srnum(regno);
1196 result = UDIWrite(&From, To, Count, Size, &CountDone, HostEndian);
1197 }
1198
9bddba9a
SG
1199 if(result)
1200 { result = -1;
1201 error("UDIWrite() failed in store_registers");
1202 }
1203 return result;
1204}
1205/********************************************************** REGNUM_TO_SRNUM */
1206/*
1207 * Convert a gdb special register number to a 29000 special register number.
1208 */
1209static int
1210regnum_to_srnum(regno)
1211int regno;
1212{
1213 switch(regno) {
1214 case VAB_REGNUM: return(0);
1215 case OPS_REGNUM: return(1);
1216 case CPS_REGNUM: return(2);
1217 case CFG_REGNUM: return(3);
1218 case CHA_REGNUM: return(4);
1219 case CHD_REGNUM: return(5);
1220 case CHC_REGNUM: return(6);
1221 case RBP_REGNUM: return(7);
1222 case TMC_REGNUM: return(8);
1223 case TMR_REGNUM: return(9);
1224 case NPC_REGNUM: return(USE_SHADOW_PC ? (20) : (10));
1225 case PC_REGNUM: return(USE_SHADOW_PC ? (21) : (11));
1226 case PC2_REGNUM: return(USE_SHADOW_PC ? (22) : (12));
1227 case MMU_REGNUM: return(13);
1228 case LRU_REGNUM: return(14);
1229 case IPC_REGNUM: return(128);
1230 case IPA_REGNUM: return(129);
1231 case IPB_REGNUM: return(130);
1232 case Q_REGNUM: return(131);
1233 case ALU_REGNUM: return(132);
1234 case BP_REGNUM: return(133);
1235 case FC_REGNUM: return(134);
1236 case CR_REGNUM: return(135);
1237 case FPE_REGNUM: return(160);
d0b04c6a 1238 case INTE_REGNUM: return(161);
9bddba9a
SG
1239 case FPS_REGNUM: return(162);
1240 case EXO_REGNUM:return(164);
1241 default:
1242 return(255); /* Failure ? */
1243 }
1244}
1245/****************************************************************************/
1246/*
1247 * Determine the Target memory space qualifier based on the addr.
1248 * FIXME: Can't distinguis I_ROM/D_ROM.
1249 * FIXME: Doesn't know anything about I_CACHE/D_CACHE.
1250 */
1251static CPUSpace
1252udi_memory_space(addr)
1253CORE_ADDR *addr;
1254{
1255 UDIUInt32 tstart = IMemStart;
1256 UDIUInt32 tend = tstart + IMemSize;
1257 UDIUInt32 dstart = DMemStart;
1258 UDIUInt32 dend = tstart + DMemSize;
1259 UDIUInt32 rstart = RMemStart;
1260 UDIUInt32 rend = tstart + RMemSize;
1261
1262 if (((UDIUInt32)addr >= tstart) && ((UDIUInt32)addr < tend)) {
1263 return UDI29KIRAMSpace;
1264 } else if (((UDIUInt32)addr >= dstart) && ((UDIUInt32)addr < dend)) {
1265 return UDI29KDRAMSpace;
1266 } else if (((UDIUInt32)addr >= rstart) && ((UDIUInt32)addr < rend)) {
1267 /* FIXME: how do we determine between D_ROM and I_ROM */
1268 return UDI29KIROMSpace;
1269 } else /* FIXME: what do me do now? */
1270 return UDI29KDRAMSpace; /* Hmmm! */
1271}
1272/*********************************************************************** STUBS
1273*/
1274
1275void convert16() {;}
1276void convert32() {;}
1277FILE* EchoFile = 0; /* used for debugging */
1278int QuietMode = 0; /* used for debugging */
1279
1280/****************************************************************************/
1281/*
1282 * Define the target subroutine names
1283 */
1284static struct target_ops udi_ops = {
1285 "udi", "Remote UDI connected TIP",
15ee4caa 1286 "Remote debug an AMD 29k using UDI socket connection to TIP process",
9bddba9a
SG
1287 udi_open, udi_close,
1288 udi_attach, udi_detach, udi_resume, udi_wait,
1289 udi_fetch_registers, udi_store_registers,
a03d4f8e 1290 udi_prepare_to_store,
9bddba9a
SG
1291 udi_xfer_inferior_memory,
1292 udi_files_info,
1293 udi_insert_breakpoint, udi_remove_breakpoint, /* Breakpoints */
1294 0, 0, 0, 0, 0, /* Terminal handling */
1295 udi_kill, /* FIXME, kill */
1296 udi_load,
1297 0, /* lookup_symbol */
1298 udi_create_inferior, /* create_inferior */
1299 udi_mourn, /* mourn_inferior FIXME */
5ee4e16c 1300 0, /* can_run */
9bddba9a
SG
1301 process_stratum, 0, /* next */
1302 1, 1, 1, 1, 1, /* all mem, mem, stack, regs, exec */
1303 0, 0, /* Section pointers */
1304 OPS_MAGIC, /* Always the last thing */
1305};
1306
1307void _initialize_remote_udi()
1308{
1309 add_target (&udi_ops);
1310}
1311
1312#ifdef NO_HIF_SUPPORT
1313service_HIF(msg)
1314union msg_t *msg;
1315{
1316 return(0); /* Emulate a failure */
1317}
1318#endif
This page took 0.088579 seconds and 4 git commands to generate.