1 /* OBSOLETE /* Remote debugging interface for Am290*0 running MiniMON monitor, for GDB. */
2 /* OBSOLETE Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, */
3 /* OBSOLETE 2001 Free Software Foundation, Inc. */
4 /* OBSOLETE Originally written by Daniel Mann at AMD. */
6 /* OBSOLETE This file is part of GDB. */
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. */
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. */
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. */ */
23 /* OBSOLETE /* This is like remote.c but ecpects MiniMON to be running on the Am29000 */
24 /* OBSOLETE target hardware. */
25 /* OBSOLETE - David Wood (wood@lab.ultra.nyu.edu) at New York University adapted this */
26 /* OBSOLETE file to gdb 3.95. I was unable to get this working on sun3os4 */
27 /* OBSOLETE with termio, only with sgtty. Because we are only attempting to */
28 /* OBSOLETE use this module to debug our kernel, which is already loaded when */
29 /* OBSOLETE gdb is started up, I did not code up the file downloading facilities. */
30 /* OBSOLETE As a result this module has only the stubs to download files. */
31 /* OBSOLETE You should get tagged at compile time if you need to make any */
32 /* OBSOLETE changes/additions. */ */
34 /* OBSOLETE #include "defs.h" */
35 /* OBSOLETE #include "inferior.h" */
36 /* OBSOLETE #include "value.h" */
37 /* OBSOLETE #include <ctype.h> */
38 /* OBSOLETE #include <fcntl.h> */
39 /* OBSOLETE #include <signal.h> */
40 /* OBSOLETE #include <errno.h> */
41 /* OBSOLETE #include "gdb_string.h" */
42 /* OBSOLETE #include "terminal.h" */
43 /* OBSOLETE #include "minimon.h" */
44 /* OBSOLETE #include "target.h" */
45 /* OBSOLETE #include "regcache.h" */
47 /* OBSOLETE /* Offset of member MEMBER in a struct of type TYPE. */ */
48 /* OBSOLETE #define offsetof(TYPE, MEMBER) ((int) &((TYPE *)0)->MEMBER) */
50 /* OBSOLETE #define DRAIN_INPUT() (msg_recv_serial((union msg_t*)0)) */
52 /* OBSOLETE extern int stop_soon_quietly; /* for wait_for_inferior */ */
54 /* OBSOLETE static void mm_resume (ptid_t ptid, int step, enum target_signal sig) */
55 /* OBSOLETE static void mm_fetch_registers (); */
56 /* OBSOLETE static int fetch_register (); */
57 /* OBSOLETE static void mm_store_registers (); */
58 /* OBSOLETE static int store_register (); */
59 /* OBSOLETE static int regnum_to_srnum (); */
60 /* OBSOLETE static void mm_close (); */
61 /* OBSOLETE static char *msg_str (); */
62 /* OBSOLETE static char *error_msg_str (); */
63 /* OBSOLETE static int expect_msg (); */
64 /* OBSOLETE static void init_target_mm (); */
65 /* OBSOLETE static int mm_memory_space (); */
67 /* OBSOLETE #define FREEZE_MODE (read_register(CPS_REGNUM) && 0x400) */
68 /* OBSOLETE #define USE_SHADOW_PC ((processor_type == a29k_freeze_mode) && FREEZE_MODE) */
70 /* OBSOLETE /* FIXME: Replace with `set remotedebug'. */ */
71 /* OBSOLETE #define LLOG_FILE "minimon.log" */
72 /* OBSOLETE #if defined (LOG_FILE) */
73 /* OBSOLETE FILE *log_file; */
77 /* OBSOLETE * Size of message buffers. I couldn't get memory reads to work when */
78 /* OBSOLETE * the byte_count was larger than 512 (it may be a baud rate problem). */
80 /* OBSOLETE #define BUFER_SIZE 512 */
82 /* OBSOLETE * Size of data area in message buffer on the TARGET (remote system). */
84 /* OBSOLETE #define MAXDATA_T (target_config.max_msg_size - \ */
85 /* OBSOLETE offsetof(struct write_r_msg_t,data[0])) */
87 /* OBSOLETE * Size of data area in message buffer on the HOST (gdb). */
89 /* OBSOLETE #define MAXDATA_H (BUFER_SIZE - offsetof(struct write_r_msg_t,data[0])) */
91 /* OBSOLETE * Defined as the minimum size of data areas of the two message buffers */
93 /* OBSOLETE #define MAXDATA (MAXDATA_H < MAXDATA_T ? MAXDATA_H : MAXDATA_T) */
95 /* OBSOLETE static char out_buf[BUFER_SIZE]; */
96 /* OBSOLETE static char in_buf[BUFER_SIZE]; */
98 /* OBSOLETE int msg_recv_serial (); */
99 /* OBSOLETE int msg_send_serial (); */
101 /* OBSOLETE #define MAX_RETRIES 5000 */
102 /* OBSOLETE extern struct target_ops mm_ops; /* Forward declaration */ */
103 /* OBSOLETE struct config_msg_t target_config; /* HIF needs this */ */
104 /* OBSOLETE union msg_t *out_msg_buf = (union msg_t *) out_buf; */
105 /* OBSOLETE union msg_t *in_msg_buf = (union msg_t *) in_buf; */
107 /* OBSOLETE static int timeout = 5; */
109 /* OBSOLETE /* Descriptor for I/O to remote machine. Initialize it to -1 so that */
110 /* OBSOLETE mm_open knows that we don't have a file open when the program */
111 /* OBSOLETE starts. */ */
112 /* OBSOLETE int mm_desc = -1; */
114 /* OBSOLETE /* stream which is fdopen'd from mm_desc. Only valid when */
115 /* OBSOLETE mm_desc != -1. */ */
116 /* OBSOLETE FILE *mm_stream; */
118 /* OBSOLETE /* Called when SIGALRM signal sent due to alarm() timeout. */ */
119 /* OBSOLETE #ifndef HAVE_TERMIO */
121 /* OBSOLETE volatile int n_alarms; */
123 /* OBSOLETE static void */
124 /* OBSOLETE mm_timer (void) */
127 /* OBSOLETE if (kiodebug) */
128 /* OBSOLETE printf ("mm_timer called\n"); */
129 /* OBSOLETE #endif */
130 /* OBSOLETE n_alarms++; */
132 /* OBSOLETE #endif /* HAVE_TERMIO */ */
134 /* OBSOLETE /* malloc'd name of the program on the remote system. */ */
135 /* OBSOLETE static char *prog_name = NULL; */
138 /* OBSOLETE /* Number of SIGTRAPs we need to simulate. That is, the next */
139 /* OBSOLETE NEED_ARTIFICIAL_TRAP calls to mm_wait should just return */
140 /* OBSOLETE SIGTRAP without actually waiting for anything. */ */
142 /* OBSOLETE /**************************************************** REMOTE_CREATE_INFERIOR */ */
143 /* OBSOLETE /* This is called not only when we first attach, but also when the */
144 /* OBSOLETE user types "run" after having attached. */ */
145 /* OBSOLETE static void */
146 /* OBSOLETE mm_create_inferior (char *execfile, char *args, char **env) */
148 /* OBSOLETE #define MAX_TOKENS 25 */
149 /* OBSOLETE #define BUFFER_SIZE 256 */
150 /* OBSOLETE int token_count; */
151 /* OBSOLETE int result; */
152 /* OBSOLETE char *token[MAX_TOKENS]; */
153 /* OBSOLETE char cmd_line[BUFFER_SIZE]; */
155 /* OBSOLETE if (args && *args) */
156 /* OBSOLETE error ("Can't pass arguments to remote mm process (yet)."); */
158 /* OBSOLETE if (execfile == 0 /* || exec_bfd == 0 */ ) */
159 /* OBSOLETE error ("No executable file specified"); */
161 /* OBSOLETE if (!mm_stream) */
163 /* OBSOLETE printf ("Minimon not open yet.\n"); */
164 /* OBSOLETE return; */
167 /* OBSOLETE /* On ultra3 (NYU) we assume the kernel is already running so there is */
168 /* OBSOLETE no file to download. */
169 /* OBSOLETE FIXME: Fixed required here -> load your program, possibly with mm_load(). */
171 /* OBSOLETE printf_filtered ("\n\ */
172 /* OBSOLETE Assuming you are at NYU debuging a kernel, i.e., no need to download.\n\n"); */
174 /* OBSOLETE /* We will get a task spawn event immediately. */ */
175 /* OBSOLETE init_wait_for_inferior (); */
176 /* OBSOLETE clear_proceed_status (); */
177 /* OBSOLETE stop_soon_quietly = 1; */
178 /* OBSOLETE proceed (-1, TARGET_SIGNAL_DEFAULT, 0); */
179 /* OBSOLETE normal_stop (); */
181 /* OBSOLETE /**************************************************** REMOTE_MOURN_INFERIOR */ */
182 /* OBSOLETE static void */
183 /* OBSOLETE mm_mourn (void) */
185 /* OBSOLETE pop_target (); /* Pop back to no-child state */ */
186 /* OBSOLETE generic_mourn_inferior (); */
189 /* OBSOLETE /********************************************************************** damn_b */
191 /* OBSOLETE /* Translate baud rates from integers to damn B_codes. Unix should */
192 /* OBSOLETE have outgrown this crap years ago, but even POSIX wouldn't buck it. */ */
194 /* OBSOLETE #ifndef B19200 */
195 /* OBSOLETE #define B19200 EXTA */
196 /* OBSOLETE #endif */
197 /* OBSOLETE #ifndef B38400 */
198 /* OBSOLETE #define B38400 EXTB */
199 /* OBSOLETE #endif */
201 /* OBSOLETE static struct */
203 /* OBSOLETE int rate, damn_b; */
205 /* OBSOLETE baudtab[] = */
212 /* OBSOLETE 50, B50 */
216 /* OBSOLETE 75, B75 */
220 /* OBSOLETE 110, B110 */
224 /* OBSOLETE 134, B134 */
228 /* OBSOLETE 150, B150 */
232 /* OBSOLETE 200, B200 */
236 /* OBSOLETE 300, B300 */
240 /* OBSOLETE 600, B600 */
244 /* OBSOLETE 1200, B1200 */
248 /* OBSOLETE 1800, B1800 */
252 /* OBSOLETE 2400, B2400 */
256 /* OBSOLETE 4800, B4800 */
260 /* OBSOLETE 9600, B9600 */
264 /* OBSOLETE 19200, B19200 */
268 /* OBSOLETE 38400, B38400 */
272 /* OBSOLETE -1, -1 */
277 /* OBSOLETE static int */
278 /* OBSOLETE damn_b (int rate) */
280 /* OBSOLETE int i; */
282 /* OBSOLETE for (i = 0; baudtab[i].rate != -1; i++) */
283 /* OBSOLETE if (rate == baudtab[i].rate) */
284 /* OBSOLETE return baudtab[i].damn_b; */
285 /* OBSOLETE return B38400; /* Random */ */
289 /* OBSOLETE /***************************************************************** REMOTE_OPEN */
290 /* OBSOLETE ** Open a connection to remote minimon. */
291 /* OBSOLETE NAME is the filename used for communication, then a space, */
292 /* OBSOLETE then the baud rate. */
293 /* OBSOLETE 'target adapt /dev/ttya 9600 [prognam]' for example. */
296 /* OBSOLETE static char *dev_name; */
297 /* OBSOLETE int baudrate = 9600; */
298 /* OBSOLETE static void */
299 /* OBSOLETE mm_open (char *name, int from_tty) */
301 /* OBSOLETE TERMINAL sg; */
302 /* OBSOLETE unsigned int prl; */
303 /* OBSOLETE char *p; */
305 /* OBSOLETE /* Find the first whitespace character, it separates dev_name from */
306 /* OBSOLETE prog_name. */ */
307 /* OBSOLETE for (p = name; */
308 /* OBSOLETE p && *p && !isspace (*p); p++) */
310 /* OBSOLETE if (p == 0 || *p == '\0') */
311 /* OBSOLETE erroid: */
312 /* OBSOLETE error ("Usage : <command> <serial-device> <baud-rate> [progname]"); */
313 /* OBSOLETE dev_name = (char *) xmalloc (p - name + 1); */
314 /* OBSOLETE strncpy (dev_name, name, p - name); */
315 /* OBSOLETE dev_name[p - name] = '\0'; */
317 /* OBSOLETE /* Skip over the whitespace after dev_name */ */
318 /* OBSOLETE for (; isspace (*p); p++) */
319 /* OBSOLETE /*EMPTY */ ; */
321 /* OBSOLETE if (1 != sscanf (p, "%d ", &baudrate)) */
322 /* OBSOLETE goto erroid; */
324 /* OBSOLETE /* Skip the number and then the spaces */ */
325 /* OBSOLETE for (; isdigit (*p); p++) */
326 /* OBSOLETE /*EMPTY */ ; */
327 /* OBSOLETE for (; isspace (*p); p++) */
328 /* OBSOLETE /*EMPTY */ ; */
330 /* OBSOLETE if (prog_name != NULL) */
331 /* OBSOLETE xfree (prog_name); */
332 /* OBSOLETE prog_name = savestring (p, strlen (p)); */
335 /* OBSOLETE if (mm_desc >= 0) */
336 /* OBSOLETE close (mm_desc); */
338 /* OBSOLETE mm_desc = open (dev_name, O_RDWR); */
339 /* OBSOLETE if (mm_desc < 0) */
340 /* OBSOLETE perror_with_name (dev_name); */
341 /* OBSOLETE ioctl (mm_desc, TIOCGETP, &sg); */
342 /* OBSOLETE #ifdef HAVE_TERMIO */
343 /* OBSOLETE sg.c_cc[VMIN] = 0; /* read with timeout. */ */
344 /* OBSOLETE sg.c_cc[VTIME] = timeout * 10; */
345 /* OBSOLETE sg.c_lflag &= ~(ICANON | ECHO); */
346 /* OBSOLETE sg.c_cflag = (sg.c_cflag & ~CBAUD) | damn_b (baudrate); */
348 /* OBSOLETE sg.sg_ispeed = damn_b (baudrate); */
349 /* OBSOLETE sg.sg_ospeed = damn_b (baudrate); */
350 /* OBSOLETE sg.sg_flags |= RAW; */
351 /* OBSOLETE sg.sg_flags |= ANYP; */
352 /* OBSOLETE sg.sg_flags &= ~ECHO; */
353 /* OBSOLETE #endif */
356 /* OBSOLETE ioctl (mm_desc, TIOCSETP, &sg); */
357 /* OBSOLETE mm_stream = fdopen (mm_desc, "r+"); */
359 /* OBSOLETE push_target (&mm_ops); */
361 /* OBSOLETE #ifndef HAVE_TERMIO */
362 /* OBSOLETE #ifndef NO_SIGINTERRUPT */
363 /* OBSOLETE /* Cause SIGALRM's to make reads fail with EINTR instead of resuming */
364 /* OBSOLETE the read. */ */
365 /* OBSOLETE if (siginterrupt (SIGALRM, 1) != 0) */
366 /* OBSOLETE perror ("mm_open: error in siginterrupt"); */
367 /* OBSOLETE #endif */
369 /* OBSOLETE /* Set up read timeout timer. */ */
370 /* OBSOLETE if ((void (*)) signal (SIGALRM, mm_timer) == (void (*)) -1) */
371 /* OBSOLETE perror ("mm_open: error in signal"); */
372 /* OBSOLETE #endif */
374 /* OBSOLETE #if defined (LOG_FILE) */
375 /* OBSOLETE log_file = fopen (LOG_FILE, "w"); */
376 /* OBSOLETE if (log_file == NULL) */
377 /* OBSOLETE perror_with_name (LOG_FILE); */
378 /* OBSOLETE #endif */
380 /* OBSOLETE ** Initialize target configuration structure (global) */
382 /* OBSOLETE DRAIN_INPUT (); */
383 /* OBSOLETE out_msg_buf->config_req_msg.code = CONFIG_REQ; */
384 /* OBSOLETE out_msg_buf->config_req_msg.length = 4 * 0; */
385 /* OBSOLETE msg_send_serial (out_msg_buf); /* send config request message */ */
387 /* OBSOLETE expect_msg (CONFIG, in_msg_buf, 1); */
389 /* OBSOLETE a29k_get_processor_type (); */
391 /* OBSOLETE /* Print out some stuff, letting the user now what's going on */ */
392 /* OBSOLETE printf_filtered ("Connected to MiniMon via %s.\n", dev_name); */
393 /* OBSOLETE /* FIXME: can this restriction be removed? */ */
394 /* OBSOLETE printf_filtered ("Remote debugging using virtual addresses works only\n"); */
395 /* OBSOLETE printf_filtered ("\twhen virtual addresses map 1:1 to physical addresses.\n") */
397 /* OBSOLETE if (processor_type != a29k_freeze_mode) */
399 /* OBSOLETE fprintf_filtered (gdb_stderr, */
400 /* OBSOLETE "Freeze-mode debugging not available, and can only be done on an A29050.\n"); */
403 /* OBSOLETE target_config.code = CONFIG; */
404 /* OBSOLETE target_config.length = 0; */
405 /* OBSOLETE target_config.processor_id = in_msg_buf->config_msg.processor_id; */
406 /* OBSOLETE target_config.version = in_msg_buf->config_msg.version; */
407 /* OBSOLETE target_config.I_mem_start = in_msg_buf->config_msg.I_mem_start; */
408 /* OBSOLETE target_config.I_mem_size = in_msg_buf->config_msg.I_mem_size; */
409 /* OBSOLETE target_config.D_mem_start = in_msg_buf->config_msg.D_mem_start; */
410 /* OBSOLETE target_config.D_mem_size = in_msg_buf->config_msg.D_mem_size; */
411 /* OBSOLETE target_config.ROM_start = in_msg_buf->config_msg.ROM_start; */
412 /* OBSOLETE target_config.ROM_size = in_msg_buf->config_msg.ROM_size; */
413 /* OBSOLETE target_config.max_msg_size = in_msg_buf->config_msg.max_msg_size; */
414 /* OBSOLETE target_config.max_bkpts = in_msg_buf->config_msg.max_bkpts; */
415 /* OBSOLETE target_config.coprocessor = in_msg_buf->config_msg.coprocessor; */
416 /* OBSOLETE target_config.reserved = in_msg_buf->config_msg.reserved; */
417 /* OBSOLETE if (from_tty) */
419 /* OBSOLETE printf ("Connected to MiniMON :\n"); */
420 /* OBSOLETE printf (" Debugcore version %d.%d\n", */
421 /* OBSOLETE 0x0f & (target_config.version >> 4), */
422 /* OBSOLETE 0x0f & (target_config.version)); */
423 /* OBSOLETE printf (" Configuration version %d.%d\n", */
424 /* OBSOLETE 0x0f & (target_config.version >> 12), */
425 /* OBSOLETE 0x0f & (target_config.version >> 8)); */
426 /* OBSOLETE printf (" Message system version %d.%d\n", */
427 /* OBSOLETE 0x0f & (target_config.version >> 20), */
428 /* OBSOLETE 0x0f & (target_config.version >> 16)); */
429 /* OBSOLETE printf (" Communication driver version %d.%d\n", */
430 /* OBSOLETE 0x0f & (target_config.version >> 28), */
431 /* OBSOLETE 0x0f & (target_config.version >> 24)); */
434 /* OBSOLETE /* Leave the target running... */
435 /* OBSOLETE * The above message stopped the target in the dbg core (MiniMon), */
436 /* OBSOLETE * so restart the target out of MiniMon, */
438 /* OBSOLETE out_msg_buf->go_msg.code = GO; */
439 /* OBSOLETE out_msg_buf->go_msg.length = 0; */
440 /* OBSOLETE msg_send_serial (out_msg_buf); */
441 /* OBSOLETE /* No message to expect after a GO */ */
444 /* OBSOLETE /**************************************************************** REMOTE_CLOSE */
445 /* OBSOLETE ** Close the open connection to the minimon debugger. */
446 /* OBSOLETE Use this when you want to detach and do something else */
447 /* OBSOLETE with your gdb. */ */
448 /* OBSOLETE static void */
449 /* OBSOLETE mm_close ( /*FIXME: how is quitting used */ */
450 /* OBSOLETE int quitting) */
452 /* OBSOLETE if (mm_desc < 0) */
453 /* OBSOLETE error ("Can't close remote connection: not debugging remotely."); */
455 /* OBSOLETE /* We should never get here if there isn't something valid in */
456 /* OBSOLETE mm_desc and mm_stream. */
458 /* OBSOLETE Due to a bug in Unix, fclose closes not only the stdio stream, */
459 /* OBSOLETE but also the file descriptor. So we don't actually close */
460 /* OBSOLETE mm_desc. */ */
461 /* OBSOLETE DRAIN_INPUT (); */
462 /* OBSOLETE fclose (mm_stream); */
463 /* OBSOLETE /* close (mm_desc); */ */
465 /* OBSOLETE /* Do not try to close mm_desc again, later in the program. */ */
466 /* OBSOLETE mm_stream = NULL; */
467 /* OBSOLETE mm_desc = -1; */
469 /* OBSOLETE #if defined (LOG_FILE) */
470 /* OBSOLETE if (ferror (log_file)) */
471 /* OBSOLETE printf ("Error writing log file.\n"); */
472 /* OBSOLETE if (fclose (log_file) != 0) */
473 /* OBSOLETE printf ("Error closing log file.\n"); */
474 /* OBSOLETE #endif */
476 /* OBSOLETE printf ("Ending remote debugging\n"); */
479 /* OBSOLETE /************************************************************* REMOTE_ATACH */ */
480 /* OBSOLETE /* Attach to a program that is already loaded and running */
481 /* OBSOLETE * Upon exiting the process's execution is stopped. */
483 /* OBSOLETE static void */
484 /* OBSOLETE mm_attach (char *args, int from_tty) */
487 /* OBSOLETE if (!mm_stream) */
488 /* OBSOLETE error ("MiniMon not opened yet, use the 'target minimon' command.\n"); */
490 /* OBSOLETE if (from_tty) */
491 /* OBSOLETE printf ("Attaching to remote program %s...\n", prog_name); */
493 /* OBSOLETE /* Make sure the target is currently running, it is supposed to be. */ */
494 /* OBSOLETE /* FIXME: is it ok to send MiniMon a BREAK if it is already stopped in */
495 /* OBSOLETE * the dbg core. If so, we don't need to send this GO. */
497 /* OBSOLETE out_msg_buf->go_msg.code = GO; */
498 /* OBSOLETE out_msg_buf->go_msg.length = 0; */
499 /* OBSOLETE msg_send_serial (out_msg_buf); */
500 /* OBSOLETE sleep (2); /* At the worst it will stop, receive a message, continue */ */
502 /* OBSOLETE /* Send the mm a break. */ */
503 /* OBSOLETE out_msg_buf->break_msg.code = BREAK; */
504 /* OBSOLETE out_msg_buf->break_msg.length = 0; */
505 /* OBSOLETE msg_send_serial (out_msg_buf); */
507 /* OBSOLETE /********************************************************** REMOTE_DETACH */ */
508 /* OBSOLETE /* Terminate the open connection to the remote debugger. */
509 /* OBSOLETE Use this when you want to detach and do something else */
510 /* OBSOLETE with your gdb. Leave remote process running (with no breakpoints set). */ */
511 /* OBSOLETE static void */
512 /* OBSOLETE mm_detach (char *args, int from_tty) */
514 /* OBSOLETE remove_breakpoints (); /* Just in case there were any left in */ */
515 /* OBSOLETE out_msg_buf->go_msg.code = GO; */
516 /* OBSOLETE out_msg_buf->go_msg.length = 0; */
517 /* OBSOLETE msg_send_serial (out_msg_buf); */
518 /* OBSOLETE pop_target (); /* calls mm_close to do the real work */ */
522 /* OBSOLETE /*************************************************************** REMOTE_RESUME */
523 /* OBSOLETE ** Tell the remote machine to resume. */ */
525 /* OBSOLETE static void */
526 /* OBSOLETE mm_resume (ptid_t ptid, int step, enum target_signal sig) */
528 /* OBSOLETE if (sig != TARGET_SIGNAL_0) */
529 /* OBSOLETE warning ("Can't send signals to a remote MiniMon system."); */
531 /* OBSOLETE if (step) */
533 /* OBSOLETE out_msg_buf->step_msg.code = STEP; */
534 /* OBSOLETE out_msg_buf->step_msg.length = 1 * 4; */
535 /* OBSOLETE out_msg_buf->step_msg.count = 1; /* step 1 instruction */ */
536 /* OBSOLETE msg_send_serial (out_msg_buf); */
540 /* OBSOLETE out_msg_buf->go_msg.code = GO; */
541 /* OBSOLETE out_msg_buf->go_msg.length = 0; */
542 /* OBSOLETE msg_send_serial (out_msg_buf); */
546 /* OBSOLETE /***************************************************************** REMOTE_WAIT */
547 /* OBSOLETE ** Wait until the remote machine stops, then return, */
548 /* OBSOLETE storing status in STATUS just as `wait' would. */ */
550 /* OBSOLETE static ptid_t */
551 /* OBSOLETE mm_wait (ptid_t ptid, struct target_waitstatus *status) */
553 /* OBSOLETE int i, result; */
554 /* OBSOLETE int old_timeout = timeout; */
555 /* OBSOLETE int old_immediate_quit = immediate_quit; */
557 /* OBSOLETE status->kind = TARGET_WAITKIND_EXITED; */
558 /* OBSOLETE status->value.integer = 0; */
560 /* OBSOLETE /* wait for message to arrive. It should be: */
561 /* OBSOLETE - A HIF service request. */
562 /* OBSOLETE - A HIF exit service request. */
563 /* OBSOLETE - A CHANNEL0_ACK. */
564 /* OBSOLETE - A CHANNEL1 request. */
565 /* OBSOLETE - a debugcore HALT message. */
566 /* OBSOLETE HIF services must be responded too, and while-looping continued. */
567 /* OBSOLETE If the target stops executing, mm_wait() should return. */
569 /* OBSOLETE timeout = 0; /* Wait indefinetly for a message */ */
570 /* OBSOLETE immediate_quit = 1; /* Helps ability to QUIT */ */
571 /* OBSOLETE while (1) */
573 /* OBSOLETE while (msg_recv_serial (in_msg_buf)) */
575 /* OBSOLETE QUIT; /* Let user quit if they want */ */
577 /* OBSOLETE switch (in_msg_buf->halt_msg.code) */
579 /* OBSOLETE case HIF_CALL: */
580 /* OBSOLETE i = in_msg_buf->hif_call_rtn_msg.service_number; */
581 /* OBSOLETE result = service_HIF (in_msg_buf); */
582 /* OBSOLETE if (i == 1) /* EXIT */ */
583 /* OBSOLETE goto exit; */
584 /* OBSOLETE if (result) */
585 /* OBSOLETE printf ("Warning: failure during HIF service %d\n", i); */
586 /* OBSOLETE break; */
587 /* OBSOLETE case CHANNEL0_ACK: */
588 /* OBSOLETE service_HIF (in_msg_buf); */
589 /* OBSOLETE break; */
590 /* OBSOLETE case CHANNEL1: */
591 /* OBSOLETE i = in_msg_buf->channel1_msg.length; */
592 /* OBSOLETE in_msg_buf->channel1_msg.data[i] = '\0'; */
593 /* OBSOLETE printf ("%s", in_msg_buf->channel1_msg.data); */
594 /* OBSOLETE gdb_flush (gdb_stdout); */
595 /* OBSOLETE /* Send CHANNEL1_ACK message */ */
596 /* OBSOLETE out_msg_buf->channel1_ack_msg.code = CHANNEL1_ACK; */
597 /* OBSOLETE out_msg_buf->channel1_ack_msg.length = 0; */
598 /* OBSOLETE result = msg_send_serial (out_msg_buf); */
599 /* OBSOLETE break; */
600 /* OBSOLETE case HALT: */
601 /* OBSOLETE goto halted; */
602 /* OBSOLETE default: */
603 /* OBSOLETE goto halted; */
606 /* OBSOLETE halted: */
607 /* OBSOLETE /* FIXME, these printfs should not be here. This is a source level */
608 /* OBSOLETE debugger, guys! */ */
609 /* OBSOLETE if (in_msg_buf->halt_msg.trap_number == 0) */
611 /* OBSOLETE printf ("Am290*0 received vector number %d (break point)\n", */
612 /* OBSOLETE in_msg_buf->halt_msg.trap_number); */
613 /* OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; */
614 /* OBSOLETE status->value.sig = TARGET_SIGNAL_TRAP; */
616 /* OBSOLETE else if (in_msg_buf->halt_msg.trap_number == 1) */
618 /* OBSOLETE printf ("Am290*0 received vector number %d\n", */
619 /* OBSOLETE in_msg_buf->halt_msg.trap_number); */
620 /* OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; */
621 /* OBSOLETE status->value.sig = TARGET_SIGNAL_BUS; */
623 /* OBSOLETE else if (in_msg_buf->halt_msg.trap_number == 3 */
624 /* OBSOLETE || in_msg_buf->halt_msg.trap_number == 4) */
626 /* OBSOLETE printf ("Am290*0 received vector number %d\n", */
627 /* OBSOLETE in_msg_buf->halt_msg.trap_number); */
628 /* OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; */
629 /* OBSOLETE status->value.sig = TARGET_SIGNAL_FPE; */
631 /* OBSOLETE else if (in_msg_buf->halt_msg.trap_number == 5) */
633 /* OBSOLETE printf ("Am290*0 received vector number %d\n", */
634 /* OBSOLETE in_msg_buf->halt_msg.trap_number); */
635 /* OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; */
636 /* OBSOLETE status->value.sig = TARGET_SIGNAL_ILL; */
638 /* OBSOLETE else if (in_msg_buf->halt_msg.trap_number >= 6 */
639 /* OBSOLETE && in_msg_buf->halt_msg.trap_number <= 11) */
641 /* OBSOLETE printf ("Am290*0 received vector number %d\n", */
642 /* OBSOLETE in_msg_buf->halt_msg.trap_number); */
643 /* OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; */
644 /* OBSOLETE status->value.sig = TARGET_SIGNAL_SEGV; */
646 /* OBSOLETE else if (in_msg_buf->halt_msg.trap_number == 12 */
647 /* OBSOLETE || in_msg_buf->halt_msg.trap_number == 13) */
649 /* OBSOLETE printf ("Am290*0 received vector number %d\n", */
650 /* OBSOLETE in_msg_buf->halt_msg.trap_number); */
651 /* OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; */
652 /* OBSOLETE status->value.sig = TARGET_SIGNAL_ILL; */
654 /* OBSOLETE else if (in_msg_buf->halt_msg.trap_number == 14) */
656 /* OBSOLETE printf ("Am290*0 received vector number %d\n", */
657 /* OBSOLETE in_msg_buf->halt_msg.trap_number); */
658 /* OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; */
659 /* OBSOLETE status->value.sig = TARGET_SIGNAL_ALRM; */
661 /* OBSOLETE else if (in_msg_buf->halt_msg.trap_number == 15) */
663 /* OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; */
664 /* OBSOLETE status->value.sig = TARGET_SIGNAL_TRAP; */
666 /* OBSOLETE else if (in_msg_buf->halt_msg.trap_number >= 16 */
667 /* OBSOLETE && in_msg_buf->halt_msg.trap_number <= 21) */
669 /* OBSOLETE printf ("Am290*0 received vector number %d\n", */
670 /* OBSOLETE in_msg_buf->halt_msg.trap_number); */
671 /* OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; */
672 /* OBSOLETE status->value.sig = TARGET_SIGNAL_INT; */
674 /* OBSOLETE else if (in_msg_buf->halt_msg.trap_number == 22) */
676 /* OBSOLETE printf ("Am290*0 received vector number %d\n", */
677 /* OBSOLETE in_msg_buf->halt_msg.trap_number); */
678 /* OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; */
679 /* OBSOLETE status->value.sig = TARGET_SIGNAL_ILL; */
680 /* OBSOLETE } /* BREAK message was sent */ */
681 /* OBSOLETE else if (in_msg_buf->halt_msg.trap_number == 75) */
683 /* OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; */
684 /* OBSOLETE status->value.sig = TARGET_SIGNAL_TRAP; */
689 /* OBSOLETE status->kind = TARGET_WAITKIND_EXITED; */
690 /* OBSOLETE status->value.integer = 0; */
693 /* OBSOLETE timeout = old_timeout; /* Restore original timeout value */ */
694 /* OBSOLETE immediate_quit = old_immediate_quit; */
695 /* OBSOLETE return inferior_ptid; */
698 /* OBSOLETE /******************************************************* REMOTE_FETCH_REGISTERS */
699 /* OBSOLETE * Read a remote register 'regno'. */
700 /* OBSOLETE * If regno==-1 then read all the registers. */
702 /* OBSOLETE static void */
703 /* OBSOLETE mm_fetch_registers (int regno) */
705 /* OBSOLETE INT32 *data_p; */
707 /* OBSOLETE if (regno >= 0) */
709 /* OBSOLETE fetch_register (regno); */
710 /* OBSOLETE return; */
713 /* OBSOLETE /* Gr1/rsp */ */
714 /* OBSOLETE out_msg_buf->read_req_msg.byte_count = 4 * 1; */
715 /* OBSOLETE out_msg_buf->read_req_msg.memory_space = GLOBAL_REG; */
716 /* OBSOLETE out_msg_buf->read_req_msg.address = 1; */
717 /* OBSOLETE msg_send_serial (out_msg_buf); */
718 /* OBSOLETE expect_msg (READ_ACK, in_msg_buf, 1); */
719 /* OBSOLETE data_p = &(in_msg_buf->read_r_ack_msg.data[0]); */
720 /* OBSOLETE supply_register (GR1_REGNUM, data_p); */
722 /* OBSOLETE #if defined(GR64_REGNUM) /* Read gr64-127 */ */
723 /* OBSOLETE /* Global Registers gr64-gr95 */ */
724 /* OBSOLETE out_msg_buf->read_req_msg.code = READ_REQ; */
725 /* OBSOLETE out_msg_buf->read_req_msg.length = 4 * 3; */
726 /* OBSOLETE out_msg_buf->read_req_msg.byte_count = 4 * 32; */
727 /* OBSOLETE out_msg_buf->read_req_msg.memory_space = GLOBAL_REG; */
728 /* OBSOLETE out_msg_buf->read_req_msg.address = 64; */
729 /* OBSOLETE msg_send_serial (out_msg_buf); */
730 /* OBSOLETE expect_msg (READ_ACK, in_msg_buf, 1); */
731 /* OBSOLETE data_p = &(in_msg_buf->read_r_ack_msg.data[0]); */
733 /* OBSOLETE for (regno = GR64_REGNUM; regno < GR64_REGNUM + 32; regno++) */
735 /* OBSOLETE supply_register (regno, data_p++); */
737 /* OBSOLETE #endif /* GR64_REGNUM */ */
739 /* OBSOLETE /* Global Registers gr96-gr127 */ */
740 /* OBSOLETE out_msg_buf->read_req_msg.code = READ_REQ; */
741 /* OBSOLETE out_msg_buf->read_req_msg.length = 4 * 3; */
742 /* OBSOLETE out_msg_buf->read_req_msg.byte_count = 4 * 32; */
743 /* OBSOLETE out_msg_buf->read_req_msg.memory_space = GLOBAL_REG; */
744 /* OBSOLETE out_msg_buf->read_req_msg.address = 96; */
745 /* OBSOLETE msg_send_serial (out_msg_buf); */
746 /* OBSOLETE expect_msg (READ_ACK, in_msg_buf, 1); */
747 /* OBSOLETE data_p = &(in_msg_buf->read_r_ack_msg.data[0]); */
749 /* OBSOLETE for (regno = GR96_REGNUM; regno < GR96_REGNUM + 32; regno++) */
751 /* OBSOLETE supply_register (regno, data_p++); */
754 /* OBSOLETE /* Local Registers */ */
755 /* OBSOLETE out_msg_buf->read_req_msg.byte_count = 4 * (128); */
756 /* OBSOLETE out_msg_buf->read_req_msg.memory_space = LOCAL_REG; */
757 /* OBSOLETE out_msg_buf->read_req_msg.address = 0; */
758 /* OBSOLETE msg_send_serial (out_msg_buf); */
759 /* OBSOLETE expect_msg (READ_ACK, in_msg_buf, 1); */
760 /* OBSOLETE data_p = &(in_msg_buf->read_r_ack_msg.data[0]); */
762 /* OBSOLETE for (regno = LR0_REGNUM; regno < LR0_REGNUM + 128; regno++) */
764 /* OBSOLETE supply_register (regno, data_p++); */
767 /* OBSOLETE /* Protected Special Registers */ */
768 /* OBSOLETE out_msg_buf->read_req_msg.byte_count = 4 * 15; */
769 /* OBSOLETE out_msg_buf->read_req_msg.memory_space = SPECIAL_REG; */
770 /* OBSOLETE out_msg_buf->read_req_msg.address = 0; */
771 /* OBSOLETE msg_send_serial (out_msg_buf); */
772 /* OBSOLETE expect_msg (READ_ACK, in_msg_buf, 1); */
773 /* OBSOLETE data_p = &(in_msg_buf->read_r_ack_msg.data[0]); */
775 /* OBSOLETE for (regno = 0; regno <= 14; regno++) */
777 /* OBSOLETE supply_register (SR_REGNUM (regno), data_p++); */
779 /* OBSOLETE if (USE_SHADOW_PC) */
780 /* OBSOLETE { /* Let regno_to_srnum() handle the register number */ */
781 /* OBSOLETE fetch_register (NPC_REGNUM); */
782 /* OBSOLETE fetch_register (PC_REGNUM); */
783 /* OBSOLETE fetch_register (PC2_REGNUM); */
786 /* OBSOLETE /* Unprotected Special Registers */ */
787 /* OBSOLETE out_msg_buf->read_req_msg.byte_count = 4 * 8; */
788 /* OBSOLETE out_msg_buf->read_req_msg.memory_space = SPECIAL_REG; */
789 /* OBSOLETE out_msg_buf->read_req_msg.address = 128; */
790 /* OBSOLETE msg_send_serial (out_msg_buf); */
791 /* OBSOLETE expect_msg (READ_ACK, in_msg_buf, 1); */
792 /* OBSOLETE data_p = &(in_msg_buf->read_r_ack_msg.data[0]); */
794 /* OBSOLETE for (regno = 128; regno <= 135; regno++) */
796 /* OBSOLETE supply_register (SR_REGNUM (regno), data_p++); */
799 /* OBSOLETE /* There doesn't seem to be any way to get these. */ */
801 /* OBSOLETE int val = -1; */
802 /* OBSOLETE supply_register (FPE_REGNUM, &val); */
803 /* OBSOLETE supply_register (INTE_REGNUM, &val); */
804 /* OBSOLETE supply_register (FPS_REGNUM, &val); */
805 /* OBSOLETE supply_register (EXO_REGNUM, &val); */
810 /* OBSOLETE /****************************************************** REMOTE_STORE_REGISTERS */
811 /* OBSOLETE * Store register regno into the target. */
812 /* OBSOLETE * If regno==-1 then store all the registers. */
813 /* OBSOLETE * Result is 0 for success, -1 for failure. */
816 /* OBSOLETE static void */
817 /* OBSOLETE mm_store_registers (int regno) */
819 /* OBSOLETE int result; */
821 /* OBSOLETE if (regno >= 0) */
823 /* OBSOLETE store_register (regno); */
824 /* OBSOLETE return; */
827 /* OBSOLETE result = 0; */
829 /* OBSOLETE out_msg_buf->write_r_msg.code = WRITE_REQ; */
831 /* OBSOLETE /* Gr1/rsp */ */
832 /* OBSOLETE out_msg_buf->write_r_msg.byte_count = 4 * 1; */
833 /* OBSOLETE out_msg_buf->write_r_msg.length = 3 * 4 + out_msg_buf->write_r_msg.byte_count; */
834 /* OBSOLETE out_msg_buf->write_r_msg.memory_space = GLOBAL_REG; */
835 /* OBSOLETE out_msg_buf->write_r_msg.address = 1; */
836 /* OBSOLETE out_msg_buf->write_r_msg.data[0] = read_register (GR1_REGNUM); */
838 /* OBSOLETE msg_send_serial (out_msg_buf); */
839 /* OBSOLETE if (!expect_msg (WRITE_ACK, in_msg_buf, 1)) */
841 /* OBSOLETE result = -1; */
844 /* OBSOLETE #if defined(GR64_REGNUM) */
845 /* OBSOLETE /* Global registers gr64-gr95 */ */
846 /* OBSOLETE out_msg_buf->write_r_msg.byte_count = 4 * (32); */
847 /* OBSOLETE out_msg_buf->write_r_msg.length = 3 * 4 + out_msg_buf->write_r_msg.byte_count; */
848 /* OBSOLETE out_msg_buf->write_r_msg.address = 64; */
850 /* OBSOLETE for (regno = GR64_REGNUM; regno < GR64_REGNUM + 32; regno++) */
852 /* OBSOLETE out_msg_buf->write_r_msg.data[regno - GR64_REGNUM] = read_register (regno); */
854 /* OBSOLETE msg_send_serial (out_msg_buf); */
855 /* OBSOLETE if (!expect_msg (WRITE_ACK, in_msg_buf, 1)) */
857 /* OBSOLETE result = -1; */
859 /* OBSOLETE #endif /* GR64_REGNUM */ */
861 /* OBSOLETE /* Global registers gr96-gr127 */ */
862 /* OBSOLETE out_msg_buf->write_r_msg.byte_count = 4 * (32); */
863 /* OBSOLETE out_msg_buf->write_r_msg.length = 3 * 4 + out_msg_buf->write_r_msg.byte_count; */
864 /* OBSOLETE out_msg_buf->write_r_msg.address = 96; */
865 /* OBSOLETE for (regno = GR96_REGNUM; regno < GR96_REGNUM + 32; regno++) */
867 /* OBSOLETE out_msg_buf->write_r_msg.data[regno - GR96_REGNUM] = read_register (regno); */
869 /* OBSOLETE msg_send_serial (out_msg_buf); */
870 /* OBSOLETE if (!expect_msg (WRITE_ACK, in_msg_buf, 1)) */
872 /* OBSOLETE result = -1; */
875 /* OBSOLETE /* Local Registers */ */
876 /* OBSOLETE out_msg_buf->write_r_msg.memory_space = LOCAL_REG; */
877 /* OBSOLETE out_msg_buf->write_r_msg.byte_count = 4 * 128; */
878 /* OBSOLETE out_msg_buf->write_r_msg.length = 3 * 4 + out_msg_buf->write_r_msg.byte_count; */
879 /* OBSOLETE out_msg_buf->write_r_msg.address = 0; */
881 /* OBSOLETE for (regno = LR0_REGNUM; regno < LR0_REGNUM + 128; regno++) */
883 /* OBSOLETE out_msg_buf->write_r_msg.data[regno - LR0_REGNUM] = read_register (regno); */
885 /* OBSOLETE msg_send_serial (out_msg_buf); */
886 /* OBSOLETE if (!expect_msg (WRITE_ACK, in_msg_buf, 1)) */
888 /* OBSOLETE result = -1; */
891 /* OBSOLETE /* Protected Special Registers */ */
892 /* OBSOLETE /* VAB through TMR */ */
893 /* OBSOLETE out_msg_buf->write_r_msg.memory_space = SPECIAL_REG; */
894 /* OBSOLETE out_msg_buf->write_r_msg.byte_count = 4 * 10; */
895 /* OBSOLETE out_msg_buf->write_r_msg.length = 3 * 4 + out_msg_buf->write_r_msg.byte_count; */
896 /* OBSOLETE out_msg_buf->write_r_msg.address = 0; */
897 /* OBSOLETE for (regno = 0; regno <= 9; regno++) /* VAB through TMR */ */
898 /* OBSOLETE out_msg_buf->write_r_msg.data[regno] = read_register (SR_REGNUM (regno)); */
899 /* OBSOLETE msg_send_serial (out_msg_buf); */
900 /* OBSOLETE if (!expect_msg (WRITE_ACK, in_msg_buf, 1)) */
902 /* OBSOLETE result = -1; */
905 /* OBSOLETE /* PC0, PC1, PC2 possibly as shadow registers */ */
906 /* OBSOLETE out_msg_buf->write_r_msg.byte_count = 4 * 3; */
907 /* OBSOLETE out_msg_buf->write_r_msg.length = 3 * 4 + out_msg_buf->write_r_msg.byte_count; */
908 /* OBSOLETE for (regno = 10; regno <= 12; regno++) /* LRU and MMU */ */
909 /* OBSOLETE out_msg_buf->write_r_msg.data[regno - 10] = read_register (SR_REGNUM (regno)); */
910 /* OBSOLETE if (USE_SHADOW_PC) */
911 /* OBSOLETE out_msg_buf->write_r_msg.address = 20; /* SPC0 */ */
913 /* OBSOLETE out_msg_buf->write_r_msg.address = 10; /* PC0 */ */
914 /* OBSOLETE msg_send_serial (out_msg_buf); */
915 /* OBSOLETE if (!expect_msg (WRITE_ACK, in_msg_buf, 1)) */
917 /* OBSOLETE result = -1; */
920 /* OBSOLETE /* LRU and MMU */ */
921 /* OBSOLETE out_msg_buf->write_r_msg.byte_count = 4 * 2; */
922 /* OBSOLETE out_msg_buf->write_r_msg.length = 3 * 4 + out_msg_buf->write_r_msg.byte_count; */
923 /* OBSOLETE out_msg_buf->write_r_msg.address = 13; */
924 /* OBSOLETE for (regno = 13; regno <= 14; regno++) /* LRU and MMU */ */
925 /* OBSOLETE out_msg_buf->write_r_msg.data[regno - 13] = read_register (SR_REGNUM (regno)); */
926 /* OBSOLETE msg_send_serial (out_msg_buf); */
927 /* OBSOLETE if (!expect_msg (WRITE_ACK, in_msg_buf, 1)) */
929 /* OBSOLETE result = -1; */
932 /* OBSOLETE /* Unprotected Special Registers */ */
933 /* OBSOLETE out_msg_buf->write_r_msg.byte_count = 4 * 8; */
934 /* OBSOLETE out_msg_buf->write_r_msg.length = 3 * 4 + out_msg_buf->write_r_msg.byte_count; */
935 /* OBSOLETE out_msg_buf->write_r_msg.address = 128; */
936 /* OBSOLETE for (regno = 128; regno <= 135; regno++) */
937 /* OBSOLETE out_msg_buf->write_r_msg.data[regno - 128] = read_register (SR_REGNUM (regno)); */
938 /* OBSOLETE msg_send_serial (out_msg_buf); */
939 /* OBSOLETE if (!expect_msg (WRITE_ACK, in_msg_buf, 1)) */
941 /* OBSOLETE result = -1; */
944 /* OBSOLETE registers_changed (); */
947 /* OBSOLETE /*************************************************** REMOTE_PREPARE_TO_STORE */ */
948 /* OBSOLETE /* Get ready to modify the registers array. On machines which store */
949 /* OBSOLETE individual registers, this doesn't need to do anything. On machines */
950 /* OBSOLETE which store all the registers in one fell swoop, this makes sure */
951 /* OBSOLETE that registers contains all the registers from the program being */
952 /* OBSOLETE debugged. */ */
954 /* OBSOLETE static void */
955 /* OBSOLETE mm_prepare_to_store (void) */
957 /* OBSOLETE /* Do nothing, since we can store individual regs */ */
960 /* OBSOLETE /******************************************************* REMOTE_XFER_MEMORY */ */
961 /* OBSOLETE static CORE_ADDR */
962 /* OBSOLETE translate_addr (CORE_ADDR addr) */
964 /* OBSOLETE #if defined(KERNEL_DEBUGGING) */
965 /* OBSOLETE /* Check for a virtual address in the kernel */ */
966 /* OBSOLETE /* Assume physical address of ublock is in paddr_u register */ */
967 /* OBSOLETE /* FIXME: doesn't work for user virtual addresses */ */
968 /* OBSOLETE if (addr >= UVADDR) */
970 /* OBSOLETE /* PADDR_U register holds the physical address of the ublock */ */
971 /* OBSOLETE CORE_ADDR i = (CORE_ADDR) read_register (PADDR_U_REGNUM); */
972 /* OBSOLETE return (i + addr - (CORE_ADDR) UVADDR); */
976 /* OBSOLETE return (addr); */
979 /* OBSOLETE return (addr); */
980 /* OBSOLETE #endif */
983 /* OBSOLETE /******************************************************* REMOTE_FILES_INFO */ */
984 /* OBSOLETE static void */
985 /* OBSOLETE mm_files_info (void) */
987 /* OBSOLETE printf ("\tAttached to %s at %d baud and running program %s.\n", */
988 /* OBSOLETE dev_name, baudrate, prog_name); */
991 /* OBSOLETE /************************************************* REMOTE_INSERT_BREAKPOINT */ */
992 /* OBSOLETE static int */
993 /* OBSOLETE mm_insert_breakpoint (CORE_ADDR addr, char *contents_cache) */
995 /* OBSOLETE out_msg_buf->bkpt_set_msg.code = BKPT_SET; */
996 /* OBSOLETE out_msg_buf->bkpt_set_msg.length = 4 * 4; */
997 /* OBSOLETE out_msg_buf->bkpt_set_msg.memory_space = I_MEM; */
998 /* OBSOLETE out_msg_buf->bkpt_set_msg.bkpt_addr = (ADDR32) addr; */
999 /* OBSOLETE out_msg_buf->bkpt_set_msg.pass_count = 1; */
1000 /* OBSOLETE out_msg_buf->bkpt_set_msg.bkpt_type = -1; /* use illop for 29000 */ */
1001 /* OBSOLETE msg_send_serial (out_msg_buf); */
1002 /* OBSOLETE if (expect_msg (BKPT_SET_ACK, in_msg_buf, 1)) */
1004 /* OBSOLETE return 0; /* Success */ */
1008 /* OBSOLETE return 1; /* Failure */ */
1012 /* OBSOLETE /************************************************* REMOTE_DELETE_BREAKPOINT */ */
1013 /* OBSOLETE static int */
1014 /* OBSOLETE mm_remove_breakpoint (CORE_ADDR addr, char *contents_cache) */
1016 /* OBSOLETE out_msg_buf->bkpt_rm_msg.code = BKPT_RM; */
1017 /* OBSOLETE out_msg_buf->bkpt_rm_msg.length = 4 * 3; */
1018 /* OBSOLETE out_msg_buf->bkpt_rm_msg.memory_space = I_MEM; */
1019 /* OBSOLETE out_msg_buf->bkpt_rm_msg.bkpt_addr = (ADDR32) addr; */
1020 /* OBSOLETE msg_send_serial (out_msg_buf); */
1021 /* OBSOLETE if (expect_msg (BKPT_RM_ACK, in_msg_buf, 1)) */
1023 /* OBSOLETE return 0; /* Success */ */
1027 /* OBSOLETE return 1; /* Failure */ */
1032 /* OBSOLETE /******************************************************* REMOTE_KILL */ */
1033 /* OBSOLETE static void */
1034 /* OBSOLETE mm_kill (char *arg, int from_tty) */
1036 /* OBSOLETE char buf[4]; */
1038 /* OBSOLETE #if defined(KERNEL_DEBUGGING) */
1039 /* OBSOLETE /* We don't ever kill the kernel */ */
1040 /* OBSOLETE if (from_tty) */
1042 /* OBSOLETE printf ("Kernel not killed, but left in current state.\n"); */
1043 /* OBSOLETE printf ("Use detach to leave kernel running.\n"); */
1045 /* OBSOLETE #else */
1046 /* OBSOLETE out_msg_buf->break_msg.code = BREAK; */
1047 /* OBSOLETE out_msg_buf->bkpt_set_msg.length = 4 * 0; */
1048 /* OBSOLETE expect_msg (HALT, in_msg_buf, from_tty); */
1049 /* OBSOLETE if (from_tty) */
1051 /* OBSOLETE printf ("Target has been stopped."); */
1052 /* OBSOLETE printf ("Would you like to do a hardware reset (y/n) [n] "); */
1053 /* OBSOLETE fgets (buf, 3, stdin); */
1054 /* OBSOLETE if (buf[0] == 'y') */
1056 /* OBSOLETE out_msg_buf->reset_msg.code = RESET; */
1057 /* OBSOLETE out_msg_buf->bkpt_set_msg.length = 4 * 0; */
1058 /* OBSOLETE expect_msg (RESET_ACK, in_msg_buf, from_tty); */
1059 /* OBSOLETE printf ("Target has been reset."); */
1062 /* OBSOLETE pop_target (); */
1063 /* OBSOLETE #endif */
1068 /* OBSOLETE /***************************************************************************/ */
1070 /* OBSOLETE * Load a program into the target. */
1072 /* OBSOLETE static void */
1073 /* OBSOLETE mm_load (char *arg_string, int from_tty) */
1075 /* OBSOLETE dont_repeat (); */
1077 /* OBSOLETE #if defined(KERNEL_DEBUGGING) */
1078 /* OBSOLETE printf ("The kernel had better be loaded already! Loading not done.\n"); */
1079 /* OBSOLETE #else */
1080 /* OBSOLETE if (arg_string == 0) */
1081 /* OBSOLETE error ("The load command takes a file name"); */
1083 /* OBSOLETE arg_string = tilde_expand (arg_string); */
1084 /* OBSOLETE make_cleanup (xfree, arg_string); */
1085 /* OBSOLETE QUIT; */
1086 /* OBSOLETE immediate_quit++; */
1087 /* OBSOLETE error ("File loading is not yet supported for MiniMon."); */
1088 /* OBSOLETE /* FIXME, code to load your file here... */ */
1089 /* OBSOLETE /* You may need to do an init_target_mm() */ */
1090 /* OBSOLETE /* init_target_mm(?,?,?,?,?,?,?,?); */ */
1091 /* OBSOLETE immediate_quit--; */
1092 /* OBSOLETE /* symbol_file_add (arg_string, from_tty, text_addr, 0, 0); */ */
1093 /* OBSOLETE #endif */
1097 /* OBSOLETE /************************************************ REMOTE_WRITE_INFERIOR_MEMORY */
1098 /* OBSOLETE ** Copy LEN bytes of data from debugger memory at MYADDR */
1099 /* OBSOLETE to inferior's memory at MEMADDR. Returns number of bytes written. */ */
1100 /* OBSOLETE static int */
1101 /* OBSOLETE mm_write_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len) */
1103 /* OBSOLETE int i, nwritten; */
1105 /* OBSOLETE out_msg_buf->write_req_msg.code = WRITE_REQ; */
1106 /* OBSOLETE out_msg_buf->write_req_msg.memory_space = mm_memory_space (memaddr); */
1108 /* OBSOLETE nwritten = 0; */
1109 /* OBSOLETE while (nwritten < len) */
1111 /* OBSOLETE int num_to_write = len - nwritten; */
1112 /* OBSOLETE if (num_to_write > MAXDATA) */
1113 /* OBSOLETE num_to_write = MAXDATA; */
1114 /* OBSOLETE for (i = 0; i < num_to_write; i++) */
1115 /* OBSOLETE out_msg_buf->write_req_msg.data[i] = myaddr[i + nwritten]; */
1116 /* OBSOLETE out_msg_buf->write_req_msg.byte_count = num_to_write; */
1117 /* OBSOLETE out_msg_buf->write_req_msg.length = 3 * 4 + num_to_write; */
1118 /* OBSOLETE out_msg_buf->write_req_msg.address = memaddr + nwritten; */
1119 /* OBSOLETE msg_send_serial (out_msg_buf); */
1121 /* OBSOLETE if (expect_msg (WRITE_ACK, in_msg_buf, 1)) */
1123 /* OBSOLETE nwritten += in_msg_buf->write_ack_msg.byte_count; */
1127 /* OBSOLETE break; */
1130 /* OBSOLETE return (nwritten); */
1133 /* OBSOLETE /************************************************* REMOTE_READ_INFERIOR_MEMORY */
1134 /* OBSOLETE ** Read LEN bytes from inferior memory at MEMADDR. Put the result */
1135 /* OBSOLETE at debugger address MYADDR. Returns number of bytes read. */ */
1136 /* OBSOLETE static int */
1137 /* OBSOLETE mm_read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len) */
1139 /* OBSOLETE int i, nread; */
1141 /* OBSOLETE out_msg_buf->read_req_msg.code = READ_REQ; */
1142 /* OBSOLETE out_msg_buf->read_req_msg.memory_space = mm_memory_space (memaddr); */
1144 /* OBSOLETE nread = 0; */
1145 /* OBSOLETE while (nread < len) */
1147 /* OBSOLETE int num_to_read = (len - nread); */
1148 /* OBSOLETE if (num_to_read > MAXDATA) */
1149 /* OBSOLETE num_to_read = MAXDATA; */
1150 /* OBSOLETE out_msg_buf->read_req_msg.byte_count = num_to_read; */
1151 /* OBSOLETE out_msg_buf->read_req_msg.length = 3 * 4 + num_to_read; */
1152 /* OBSOLETE out_msg_buf->read_req_msg.address = memaddr + nread; */
1153 /* OBSOLETE msg_send_serial (out_msg_buf); */
1155 /* OBSOLETE if (expect_msg (READ_ACK, in_msg_buf, 1)) */
1157 /* OBSOLETE for (i = 0; i < in_msg_buf->read_ack_msg.byte_count; i++) */
1158 /* OBSOLETE myaddr[i + nread] = in_msg_buf->read_ack_msg.data[i]; */
1159 /* OBSOLETE nread += in_msg_buf->read_ack_msg.byte_count; */
1163 /* OBSOLETE break; */
1166 /* OBSOLETE return (nread); */
1169 /* OBSOLETE /* FIXME! Merge these two. */ */
1170 /* OBSOLETE static int */
1171 /* OBSOLETE mm_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, */
1172 /* OBSOLETE struct mem_attrib *attrib ATTRIBUTE_UNUSED, */
1173 /* OBSOLETE struct target_ops *target ATTRIBUTE_UNUSED) */
1176 /* OBSOLETE memaddr = translate_addr (memaddr); */
1178 /* OBSOLETE if (write) */
1179 /* OBSOLETE return mm_write_inferior_memory (memaddr, myaddr, len); */
1181 /* OBSOLETE return mm_read_inferior_memory (memaddr, myaddr, len); */
1185 /* OBSOLETE /********************************************************** MSG_SEND_SERIAL */
1186 /* OBSOLETE ** This function is used to send a message over the */
1187 /* OBSOLETE ** serial line. */
1189 /* OBSOLETE ** If the message is successfully sent, a zero is */
1190 /* OBSOLETE ** returned. If the message was not sendable, a -1 */
1191 /* OBSOLETE ** is returned. This function blocks. That is, it */
1192 /* OBSOLETE ** does not return until the message is completely */
1193 /* OBSOLETE ** sent, or until an error is encountered. */
1198 /* OBSOLETE msg_send_serial (union msg_t *msg_ptr) */
1200 /* OBSOLETE INT32 message_size; */
1201 /* OBSOLETE int byte_count; */
1202 /* OBSOLETE int result; */
1203 /* OBSOLETE char c; */
1205 /* OBSOLETE /* Send message header */ */
1206 /* OBSOLETE byte_count = 0; */
1207 /* OBSOLETE message_size = msg_ptr->generic_msg.length + (2 * sizeof (INT32)); */
1210 /* OBSOLETE c = *((char *) msg_ptr + byte_count); */
1211 /* OBSOLETE result = write (mm_desc, &c, 1); */
1212 /* OBSOLETE if (result == 1) */
1214 /* OBSOLETE byte_count = byte_count + 1; */
1217 /* OBSOLETE while ((byte_count < message_size)); */
1219 /* OBSOLETE return (0); */
1220 /* OBSOLETE } /* end msg_send_serial() */ */
1222 /* OBSOLETE /********************************************************** MSG_RECV_SERIAL */
1223 /* OBSOLETE ** This function is used to receive a message over a */
1224 /* OBSOLETE ** serial line. */
1226 /* OBSOLETE ** If the message is waiting in the buffer, a zero is */
1227 /* OBSOLETE ** returned and the buffer pointed to by msg_ptr is filled */
1228 /* OBSOLETE ** in. If no message was available, a -1 is returned. */
1229 /* OBSOLETE ** If timeout==0, wait indefinetly for a character. */
1234 /* OBSOLETE msg_recv_serial (union msg_t *msg_ptr) */
1236 /* OBSOLETE static INT32 length = 0; */
1237 /* OBSOLETE static INT32 byte_count = 0; */
1238 /* OBSOLETE int result; */
1239 /* OBSOLETE char c; */
1240 /* OBSOLETE if (msg_ptr == 0) /* re-sync request */ */
1242 /* OBSOLETE length = 0; */
1243 /* OBSOLETE byte_count = 0; */
1244 /* OBSOLETE #ifdef HAVE_TERMIO */
1245 /* OBSOLETE /* The timeout here is the prevailing timeout set with VTIME */ */
1246 /* OBSOLETE ->"timeout==0 semantics not supported" */
1247 /* OBSOLETE read (mm_desc, in_buf, BUFER_SIZE); */
1248 /* OBSOLETE #else */
1249 /* OBSOLETE alarm (1); */
1250 /* OBSOLETE read (mm_desc, in_buf, BUFER_SIZE); */
1251 /* OBSOLETE alarm (0); */
1252 /* OBSOLETE #endif */
1253 /* OBSOLETE return (0); */
1255 /* OBSOLETE /* Receive message */ */
1256 /* OBSOLETE #ifdef HAVE_TERMIO */
1257 /* OBSOLETE /* Timeout==0, help support the mm_wait() routine */ */
1258 /* OBSOLETE ->"timeout==0 semantics not supported (and its nice if they are)" */
1259 /* OBSOLETE result = read (mm_desc, &c, 1); */
1260 /* OBSOLETE #else */
1261 /* OBSOLETE alarm (timeout); */
1262 /* OBSOLETE result = read (mm_desc, &c, 1); */
1263 /* OBSOLETE alarm (0); */
1264 /* OBSOLETE #endif */
1265 /* OBSOLETE if (result < 0) */
1267 /* OBSOLETE if (errno == EINTR) */
1269 /* OBSOLETE error ("Timeout reading from remote system."); */
1272 /* OBSOLETE perror_with_name ("remote"); */
1274 /* OBSOLETE else if (result == 1) */
1276 /* OBSOLETE *((char *) msg_ptr + byte_count) = c; */
1277 /* OBSOLETE byte_count = byte_count + 1; */
1280 /* OBSOLETE /* Message header received. Save message length. */ */
1281 /* OBSOLETE if (byte_count == (2 * sizeof (INT32))) */
1282 /* OBSOLETE length = msg_ptr->generic_msg.length; */
1284 /* OBSOLETE if (byte_count >= (length + (2 * sizeof (INT32)))) */
1286 /* OBSOLETE /* Message received */ */
1287 /* OBSOLETE byte_count = 0; */
1288 /* OBSOLETE return (0); */
1291 /* OBSOLETE return (-1); */
1293 /* OBSOLETE } /* end msg_recv_serial() */ */
1295 /* OBSOLETE /********************************************************************* KBD_RAW */
1296 /* OBSOLETE ** This function is used to put the keyboard in "raw" */
1297 /* OBSOLETE ** mode for BSD Unix. The original status is saved */
1298 /* OBSOLETE ** so that it may be restored later. */
1300 /* OBSOLETE TERMINAL kbd_tbuf; */
1303 /* OBSOLETE kbd_raw (void) */
1305 /* OBSOLETE int result; */
1306 /* OBSOLETE TERMINAL tbuf; */
1308 /* OBSOLETE /* Get keyboard termio (to save to restore original modes) */ */
1309 /* OBSOLETE #ifdef HAVE_TERMIO */
1310 /* OBSOLETE result = ioctl (0, TCGETA, &kbd_tbuf); */
1311 /* OBSOLETE #else */
1312 /* OBSOLETE result = ioctl (0, TIOCGETP, &kbd_tbuf); */
1313 /* OBSOLETE #endif */
1314 /* OBSOLETE if (result == -1) */
1315 /* OBSOLETE return (errno); */
1317 /* OBSOLETE /* Get keyboard TERMINAL (for modification) */ */
1318 /* OBSOLETE #ifdef HAVE_TERMIO */
1319 /* OBSOLETE result = ioctl (0, TCGETA, &tbuf); */
1320 /* OBSOLETE #else */
1321 /* OBSOLETE result = ioctl (0, TIOCGETP, &tbuf); */
1322 /* OBSOLETE #endif */
1323 /* OBSOLETE if (result == -1) */
1324 /* OBSOLETE return (errno); */
1326 /* OBSOLETE /* Set up new parameters */ */
1327 /* OBSOLETE #ifdef HAVE_TERMIO */
1328 /* OBSOLETE tbuf.c_iflag = tbuf.c_iflag & */
1329 /* OBSOLETE ~(INLCR | ICRNL | IUCLC | ISTRIP | IXON | BRKINT); */
1330 /* OBSOLETE tbuf.c_lflag = tbuf.c_lflag & ~(ICANON | ISIG | ECHO); */
1331 /* OBSOLETE tbuf.c_cc[4] = 0; /* MIN */ */
1332 /* OBSOLETE tbuf.c_cc[5] = 0; /* TIME */ */
1333 /* OBSOLETE #else */
1334 /* OBSOLETE /* FIXME: not sure if this is correct (matches HAVE_TERMIO). */ */
1335 /* OBSOLETE tbuf.sg_flags |= RAW; */
1336 /* OBSOLETE tbuf.sg_flags |= ANYP; */
1337 /* OBSOLETE tbuf.sg_flags &= ~ECHO; */
1338 /* OBSOLETE #endif */
1340 /* OBSOLETE /* Set keyboard termio to new mode (RAW) */ */
1341 /* OBSOLETE #ifdef HAVE_TERMIO */
1342 /* OBSOLETE result = ioctl (0, TCSETAF, &tbuf); */
1343 /* OBSOLETE #else */
1344 /* OBSOLETE result = ioctl (0, TIOCSETP, &tbuf); */
1345 /* OBSOLETE #endif */
1346 /* OBSOLETE if (result == -1) */
1347 /* OBSOLETE return (errno); */
1349 /* OBSOLETE return (0); */
1350 /* OBSOLETE } /* end kbd_raw() */ */
1354 /* OBSOLETE /***************************************************************** KBD_RESTORE */
1355 /* OBSOLETE ** This function is used to put the keyboard back in the */
1356 /* OBSOLETE ** mode it was in before kbk_raw was called. Note that */
1357 /* OBSOLETE ** kbk_raw() must have been called at least once before */
1358 /* OBSOLETE ** kbd_restore() is called. */
1362 /* OBSOLETE kbd_restore (void) */
1364 /* OBSOLETE int result; */
1366 /* OBSOLETE /* Set keyboard termio to original mode */ */
1367 /* OBSOLETE #ifdef HAVE_TERMIO */
1368 /* OBSOLETE result = ioctl (0, TCSETAF, &kbd_tbuf); */
1369 /* OBSOLETE #else */
1370 /* OBSOLETE result = ioctl (0, TIOCGETP, &kbd_tbuf); */
1371 /* OBSOLETE #endif */
1373 /* OBSOLETE if (result == -1) */
1374 /* OBSOLETE return (errno); */
1376 /* OBSOLETE return (0); */
1377 /* OBSOLETE } /* end kbd_cooked() */ */
1380 /* OBSOLETE /*****************************************************************************/ */
1381 /* OBSOLETE /* Fetch a single register indicatated by 'regno'. */
1382 /* OBSOLETE * Returns 0/-1 on success/failure. */
1384 /* OBSOLETE static int */
1385 /* OBSOLETE fetch_register (int regno) */
1387 /* OBSOLETE int result; */
1388 /* OBSOLETE out_msg_buf->read_req_msg.code = READ_REQ; */
1389 /* OBSOLETE out_msg_buf->read_req_msg.length = 4 * 3; */
1390 /* OBSOLETE out_msg_buf->read_req_msg.byte_count = 4; */
1392 /* OBSOLETE if (regno == GR1_REGNUM) */
1394 /* OBSOLETE out_msg_buf->read_req_msg.memory_space = GLOBAL_REG; */
1395 /* OBSOLETE out_msg_buf->read_req_msg.address = 1; */
1397 /* OBSOLETE else if (regno >= GR96_REGNUM && regno < GR96_REGNUM + 32) */
1399 /* OBSOLETE out_msg_buf->read_req_msg.memory_space = GLOBAL_REG; */
1400 /* OBSOLETE out_msg_buf->read_req_msg.address = (regno - GR96_REGNUM) + 96; */
1402 /* OBSOLETE #if defined(GR64_REGNUM) */
1403 /* OBSOLETE else if (regno >= GR64_REGNUM && regno < GR64_REGNUM + 32) */
1405 /* OBSOLETE out_msg_buf->read_req_msg.memory_space = GLOBAL_REG; */
1406 /* OBSOLETE out_msg_buf->read_req_msg.address = (regno - GR64_REGNUM) + 64; */
1408 /* OBSOLETE #endif /* GR64_REGNUM */ */
1409 /* OBSOLETE else if (regno >= LR0_REGNUM && regno < LR0_REGNUM + 128) */
1411 /* OBSOLETE out_msg_buf->read_req_msg.memory_space = LOCAL_REG; */
1412 /* OBSOLETE out_msg_buf->read_req_msg.address = (regno - LR0_REGNUM); */
1414 /* OBSOLETE else if (regno >= FPE_REGNUM && regno <= EXO_REGNUM) */
1416 /* OBSOLETE int val = -1; */
1417 /* OBSOLETE supply_register (160 + (regno - FPE_REGNUM), &val); */
1418 /* OBSOLETE return 0; /* Pretend Success */ */
1422 /* OBSOLETE out_msg_buf->read_req_msg.memory_space = SPECIAL_REG; */
1423 /* OBSOLETE out_msg_buf->read_req_msg.address = regnum_to_srnum (regno); */
1426 /* OBSOLETE msg_send_serial (out_msg_buf); */
1428 /* OBSOLETE if (expect_msg (READ_ACK, in_msg_buf, 1)) */
1430 /* OBSOLETE supply_register (regno, &(in_msg_buf->read_r_ack_msg.data[0])); */
1431 /* OBSOLETE result = 0; */
1435 /* OBSOLETE result = -1; */
1437 /* OBSOLETE return result; */
1439 /* OBSOLETE /*****************************************************************************/ */
1440 /* OBSOLETE /* Store a single register indicated by 'regno'. */
1441 /* OBSOLETE * Returns 0/-1 on success/failure. */
1443 /* OBSOLETE static int */
1444 /* OBSOLETE store_register (int regno) */
1446 /* OBSOLETE int result; */
1448 /* OBSOLETE out_msg_buf->write_req_msg.code = WRITE_REQ; */
1449 /* OBSOLETE out_msg_buf->write_req_msg.length = 4 * 4; */
1450 /* OBSOLETE out_msg_buf->write_req_msg.byte_count = 4; */
1451 /* OBSOLETE out_msg_buf->write_r_msg.data[0] = read_register (regno); */
1453 /* OBSOLETE if (regno == GR1_REGNUM) */
1455 /* OBSOLETE out_msg_buf->write_req_msg.memory_space = GLOBAL_REG; */
1456 /* OBSOLETE out_msg_buf->write_req_msg.address = 1; */
1457 /* OBSOLETE /* Setting GR1 changes the numbers of all the locals, so invalidate the */
1458 /* OBSOLETE * register cache. Do this *after* calling read_register, because we want */
1459 /* OBSOLETE * read_register to return the value that write_register has just stuffed */
1460 /* OBSOLETE * into the registers array, not the value of the register fetched from */
1461 /* OBSOLETE * the inferior. */
1463 /* OBSOLETE registers_changed (); */
1465 /* OBSOLETE #if defined(GR64_REGNUM) */
1466 /* OBSOLETE else if (regno >= GR64_REGNUM && regno < GR64_REGNUM + 32) */
1468 /* OBSOLETE out_msg_buf->write_req_msg.memory_space = GLOBAL_REG; */
1469 /* OBSOLETE out_msg_buf->write_req_msg.address = (regno - GR64_REGNUM) + 64; */
1471 /* OBSOLETE #endif /* GR64_REGNUM */ */
1472 /* OBSOLETE else if (regno >= GR96_REGNUM && regno < GR96_REGNUM + 32) */
1474 /* OBSOLETE out_msg_buf->write_req_msg.memory_space = GLOBAL_REG; */
1475 /* OBSOLETE out_msg_buf->write_req_msg.address = (regno - GR96_REGNUM) + 96; */
1477 /* OBSOLETE else if (regno >= LR0_REGNUM && regno < LR0_REGNUM + 128) */
1479 /* OBSOLETE out_msg_buf->write_req_msg.memory_space = LOCAL_REG; */
1480 /* OBSOLETE out_msg_buf->write_req_msg.address = (regno - LR0_REGNUM); */
1482 /* OBSOLETE else if (regno >= FPE_REGNUM && regno <= EXO_REGNUM) */
1484 /* OBSOLETE return 0; /* Pretend Success */ */
1487 /* OBSOLETE /* An unprotected or protected special register */ */
1489 /* OBSOLETE out_msg_buf->write_req_msg.memory_space = SPECIAL_REG; */
1490 /* OBSOLETE out_msg_buf->write_req_msg.address = regnum_to_srnum (regno); */
1493 /* OBSOLETE msg_send_serial (out_msg_buf); */
1495 /* OBSOLETE if (expect_msg (WRITE_ACK, in_msg_buf, 1)) */
1497 /* OBSOLETE result = 0; */
1501 /* OBSOLETE result = -1; */
1503 /* OBSOLETE return result; */
1505 /* OBSOLETE /****************************************************************************/ */
1507 /* OBSOLETE * Convert a gdb special register number to a 29000 special register number. */
1509 /* OBSOLETE static int */
1510 /* OBSOLETE regnum_to_srnum (int regno) */
1512 /* OBSOLETE switch (regno) */
1514 /* OBSOLETE case VAB_REGNUM: */
1515 /* OBSOLETE return (0); */
1516 /* OBSOLETE case OPS_REGNUM: */
1517 /* OBSOLETE return (1); */
1518 /* OBSOLETE case CPS_REGNUM: */
1519 /* OBSOLETE return (2); */
1520 /* OBSOLETE case CFG_REGNUM: */
1521 /* OBSOLETE return (3); */
1522 /* OBSOLETE case CHA_REGNUM: */
1523 /* OBSOLETE return (4); */
1524 /* OBSOLETE case CHD_REGNUM: */
1525 /* OBSOLETE return (5); */
1526 /* OBSOLETE case CHC_REGNUM: */
1527 /* OBSOLETE return (6); */
1528 /* OBSOLETE case RBP_REGNUM: */
1529 /* OBSOLETE return (7); */
1530 /* OBSOLETE case TMC_REGNUM: */
1531 /* OBSOLETE return (8); */
1532 /* OBSOLETE case TMR_REGNUM: */
1533 /* OBSOLETE return (9); */
1534 /* OBSOLETE case NPC_REGNUM: */
1535 /* OBSOLETE return (USE_SHADOW_PC ? (20) : (10)); */
1536 /* OBSOLETE case PC_REGNUM: */
1537 /* OBSOLETE return (USE_SHADOW_PC ? (21) : (11)); */
1538 /* OBSOLETE case PC2_REGNUM: */
1539 /* OBSOLETE return (USE_SHADOW_PC ? (22) : (12)); */
1540 /* OBSOLETE case MMU_REGNUM: */
1541 /* OBSOLETE return (13); */
1542 /* OBSOLETE case LRU_REGNUM: */
1543 /* OBSOLETE return (14); */
1544 /* OBSOLETE case IPC_REGNUM: */
1545 /* OBSOLETE return (128); */
1546 /* OBSOLETE case IPA_REGNUM: */
1547 /* OBSOLETE return (129); */
1548 /* OBSOLETE case IPB_REGNUM: */
1549 /* OBSOLETE return (130); */
1550 /* OBSOLETE case Q_REGNUM: */
1551 /* OBSOLETE return (131); */
1552 /* OBSOLETE case ALU_REGNUM: */
1553 /* OBSOLETE return (132); */
1554 /* OBSOLETE case BP_REGNUM: */
1555 /* OBSOLETE return (133); */
1556 /* OBSOLETE case FC_REGNUM: */
1557 /* OBSOLETE return (134); */
1558 /* OBSOLETE case CR_REGNUM: */
1559 /* OBSOLETE return (135); */
1560 /* OBSOLETE case FPE_REGNUM: */
1561 /* OBSOLETE return (160); */
1562 /* OBSOLETE case INTE_REGNUM: */
1563 /* OBSOLETE return (161); */
1564 /* OBSOLETE case FPS_REGNUM: */
1565 /* OBSOLETE return (162); */
1566 /* OBSOLETE case EXO_REGNUM: */
1567 /* OBSOLETE return (164); */
1568 /* OBSOLETE default: */
1569 /* OBSOLETE return (255); /* Failure ? */ */
1572 /* OBSOLETE /****************************************************************************/ */
1574 /* OBSOLETE * Initialize the target debugger (minimon only). */
1576 /* OBSOLETE static void */
1577 /* OBSOLETE init_target_mm (ADDR32 tstart, ADDR32 tend, ADDR32 dstart, ADDR32 dend, */
1578 /* OBSOLETE ADDR32 entry, INT32 ms_size, INT32 rs_size, ADDR32 arg_start) */
1580 /* OBSOLETE out_msg_buf->init_msg.code = INIT; */
1581 /* OBSOLETE out_msg_buf->init_msg.length = sizeof (struct init_msg_t) - 2 * sizeof (INT32); */
1582 /* OBSOLETE out_msg_buf->init_msg.text_start = tstart; */
1583 /* OBSOLETE out_msg_buf->init_msg.text_end = tend; */
1584 /* OBSOLETE out_msg_buf->init_msg.data_start = dstart; */
1585 /* OBSOLETE out_msg_buf->init_msg.data_end = dend; */
1586 /* OBSOLETE out_msg_buf->init_msg.entry_point = entry; */
1587 /* OBSOLETE out_msg_buf->init_msg.mem_stack_size = ms_size; */
1588 /* OBSOLETE out_msg_buf->init_msg.reg_stack_size = rs_size; */
1589 /* OBSOLETE out_msg_buf->init_msg.arg_start = arg_start; */
1590 /* OBSOLETE msg_send_serial (out_msg_buf); */
1591 /* OBSOLETE expect_msg (INIT_ACK, in_msg_buf, 1); */
1593 /* OBSOLETE /****************************************************************************/ */
1595 /* OBSOLETE * Return a pointer to a string representing the given message code. */
1596 /* OBSOLETE * Not all messages are represented here, only the ones that we expect */
1597 /* OBSOLETE * to be called with. */
1599 /* OBSOLETE static char * */
1600 /* OBSOLETE msg_str (INT32 code) */
1602 /* OBSOLETE static char cbuf[32]; */
1604 /* OBSOLETE switch (code) */
1606 /* OBSOLETE case BKPT_SET_ACK: */
1607 /* OBSOLETE sprintf (cbuf, "%s (%d)", "BKPT_SET_ACK", code); */
1608 /* OBSOLETE break; */
1609 /* OBSOLETE case BKPT_RM_ACK: */
1610 /* OBSOLETE sprintf (cbuf, "%s (%d)", "BKPT_RM_ACK", code); */
1611 /* OBSOLETE break; */
1612 /* OBSOLETE case INIT_ACK: */
1613 /* OBSOLETE sprintf (cbuf, "%s (%d)", "INIT_ACK", code); */
1614 /* OBSOLETE break; */
1615 /* OBSOLETE case READ_ACK: */
1616 /* OBSOLETE sprintf (cbuf, "%s (%d)", "READ_ACK", code); */
1617 /* OBSOLETE break; */
1618 /* OBSOLETE case WRITE_ACK: */
1619 /* OBSOLETE sprintf (cbuf, "%s (%d)", "WRITE_ACK", code); */
1620 /* OBSOLETE break; */
1621 /* OBSOLETE case ERROR: */
1622 /* OBSOLETE sprintf (cbuf, "%s (%d)", "ERROR", code); */
1623 /* OBSOLETE break; */
1624 /* OBSOLETE case HALT: */
1625 /* OBSOLETE sprintf (cbuf, "%s (%d)", "HALT", code); */
1626 /* OBSOLETE break; */
1627 /* OBSOLETE default: */
1628 /* OBSOLETE sprintf (cbuf, "UNKNOWN (%d)", code); */
1629 /* OBSOLETE break; */
1631 /* OBSOLETE return (cbuf); */
1633 /* OBSOLETE /****************************************************************************/ */
1635 /* OBSOLETE * Selected (not all of them) error codes that we might get. */
1637 /* OBSOLETE static char * */
1638 /* OBSOLETE error_msg_str (INT32 code) */
1640 /* OBSOLETE static char cbuf[50]; */
1642 /* OBSOLETE switch (code) */
1644 /* OBSOLETE case EMFAIL: */
1645 /* OBSOLETE return ("EMFAIL: unrecoverable error"); */
1646 /* OBSOLETE case EMBADADDR: */
1647 /* OBSOLETE return ("EMBADADDR: Illegal address"); */
1648 /* OBSOLETE case EMBADREG: */
1649 /* OBSOLETE return ("EMBADREG: Illegal register "); */
1650 /* OBSOLETE case EMACCESS: */
1651 /* OBSOLETE return ("EMACCESS: Could not access memory"); */
1652 /* OBSOLETE case EMBADMSG: */
1653 /* OBSOLETE return ("EMBADMSG: Unknown message type"); */
1654 /* OBSOLETE case EMMSG2BIG: */
1655 /* OBSOLETE return ("EMMSG2BIG: Message to large"); */
1656 /* OBSOLETE case EMNOSEND: */
1657 /* OBSOLETE return ("EMNOSEND: Could not send message"); */
1658 /* OBSOLETE case EMNORECV: */
1659 /* OBSOLETE return ("EMNORECV: Could not recv message"); */
1660 /* OBSOLETE case EMRESET: */
1661 /* OBSOLETE return ("EMRESET: Could not RESET target"); */
1662 /* OBSOLETE case EMCONFIG: */
1663 /* OBSOLETE return ("EMCONFIG: Could not get target CONFIG"); */
1664 /* OBSOLETE case EMSTATUS: */
1665 /* OBSOLETE return ("EMSTATUS: Could not get target STATUS"); */
1666 /* OBSOLETE case EMREAD: */
1667 /* OBSOLETE return ("EMREAD: Could not READ target memory"); */
1668 /* OBSOLETE case EMWRITE: */
1669 /* OBSOLETE return ("EMWRITE: Could not WRITE target memory"); */
1670 /* OBSOLETE case EMBKPTSET: */
1671 /* OBSOLETE return ("EMBKPTSET: Could not set breakpoint"); */
1672 /* OBSOLETE case EMBKPTRM: */
1673 /* OBSOLETE return ("EMBKPTRM: Could not remove breakpoint"); */
1674 /* OBSOLETE case EMBKPTSTAT: */
1675 /* OBSOLETE return ("EMBKPTSTAT: Could not get breakpoint status"); */
1676 /* OBSOLETE case EMBKPTNONE: */
1677 /* OBSOLETE return ("EMBKPTNONE: All breakpoints in use"); */
1678 /* OBSOLETE case EMBKPTUSED: */
1679 /* OBSOLETE return ("EMBKPTUSED: Breakpoints already in use"); */
1680 /* OBSOLETE case EMINIT: */
1681 /* OBSOLETE return ("EMINIT: Could not init target memory"); */
1682 /* OBSOLETE case EMGO: */
1683 /* OBSOLETE return ("EMGO: Could not start execution"); */
1684 /* OBSOLETE case EMSTEP: */
1685 /* OBSOLETE return ("EMSTEP: Could not single step"); */
1686 /* OBSOLETE case EMBREAK: */
1687 /* OBSOLETE return ("EMBREAK: Could not BREAK"); */
1688 /* OBSOLETE case EMCOMMERR: */
1689 /* OBSOLETE return ("EMCOMMERR: Communication error"); */
1690 /* OBSOLETE default: */
1691 /* OBSOLETE sprintf (cbuf, "error number %d", code); */
1692 /* OBSOLETE break; */
1693 /* OBSOLETE } /* end switch */ */
1695 /* OBSOLETE return (cbuf); */
1697 /* OBSOLETE /****************************************************************************/ */
1699 /* OBSOLETE /* Receive a message, placing it in MSG_BUF, and expect it to be of */
1700 /* OBSOLETE type MSGCODE. If an error occurs, a non-zero FROM_TTY indicates */
1701 /* OBSOLETE that the message should be printed. */
1703 /* OBSOLETE Return 0 for failure, 1 for success. */ */
1705 /* OBSOLETE static int */
1706 /* OBSOLETE expect_msg (INT32 msgcode, union msg_t *msg_buf, int from_tty) */
1708 /* OBSOLETE int retries = 0; */
1709 /* OBSOLETE while (msg_recv_serial (msg_buf) && (retries++ < MAX_RETRIES)); */
1710 /* OBSOLETE if (retries >= MAX_RETRIES) */
1712 /* OBSOLETE printf ("Expected msg %s, ", msg_str (msgcode)); */
1713 /* OBSOLETE printf ("no message received!\n"); */
1714 /* OBSOLETE return (0); /* Failure */ */
1717 /* OBSOLETE if (msg_buf->generic_msg.code != msgcode) */
1719 /* OBSOLETE if (from_tty) */
1721 /* OBSOLETE printf ("Expected msg %s, ", msg_str (msgcode)); */
1722 /* OBSOLETE printf ("got msg %s\n", msg_str (msg_buf->generic_msg.code)); */
1723 /* OBSOLETE if (msg_buf->generic_msg.code == ERROR) */
1724 /* OBSOLETE printf ("%s\n", error_msg_str (msg_buf->error_msg.error_code)); */
1726 /* OBSOLETE return (0); /* Failure */ */
1728 /* OBSOLETE return (1); /* Success */ */
1730 /* OBSOLETE /****************************************************************************/ */
1732 /* OBSOLETE * Determine the MiniMon memory space qualifier based on the addr. */
1733 /* OBSOLETE * FIXME: Can't distinguis I_ROM/D_ROM. */
1734 /* OBSOLETE * FIXME: Doesn't know anything about I_CACHE/D_CACHE. */
1736 /* OBSOLETE static int */
1737 /* OBSOLETE mm_memory_space (CORE_ADDR *addr) */
1739 /* OBSOLETE ADDR32 tstart = target_config.I_mem_start; */
1740 /* OBSOLETE ADDR32 tend = tstart + target_config.I_mem_size; */
1741 /* OBSOLETE ADDR32 dstart = target_config.D_mem_start; */
1742 /* OBSOLETE ADDR32 dend = tstart + target_config.D_mem_size; */
1743 /* OBSOLETE ADDR32 rstart = target_config.ROM_start; */
1744 /* OBSOLETE ADDR32 rend = tstart + target_config.ROM_size; */
1746 /* OBSOLETE if (((ADDR32) addr >= tstart) && ((ADDR32) addr < tend)) */
1748 /* OBSOLETE return I_MEM; */
1750 /* OBSOLETE else if (((ADDR32) addr >= dstart) && ((ADDR32) addr < dend)) */
1752 /* OBSOLETE return D_MEM; */
1754 /* OBSOLETE else if (((ADDR32) addr >= rstart) && ((ADDR32) addr < rend)) */
1756 /* OBSOLETE /* FIXME: how do we determine between D_ROM and I_ROM */ */
1757 /* OBSOLETE return D_ROM; */
1759 /* OBSOLETE else /* FIXME: what do me do now? */ */
1760 /* OBSOLETE return D_MEM; /* Hmmm! */ */
1763 /* OBSOLETE /****************************************************************************/ */
1765 /* OBSOLETE * Define the target subroutine names */
1767 /* OBSOLETE struct target_ops mm_ops; */
1769 /* OBSOLETE static void */
1770 /* OBSOLETE init_mm_ops (void) */
1772 /* OBSOLETE mm_ops.to_shortname = "minimon"; */
1773 /* OBSOLETE mm_ops.to_longname = "Remote AMD/Minimon target"; */
1774 /* OBSOLETE mm_ops.to_doc = "Remote debug an AMD 290*0 using the MiniMon dbg core on the target"; */
1775 /* OBSOLETE mm_ops.to_open = mm_open; */
1776 /* OBSOLETE mm_ops.to_close = mm_close; */
1777 /* OBSOLETE mm_ops.to_attach = mm_attach; */
1778 /* OBSOLETE mm_ops.to_post_attach = NULL; */
1779 /* OBSOLETE mm_ops.to_require_attach = NULL; */
1780 /* OBSOLETE mm_ops.to_detach = mm_detach; */
1781 /* OBSOLETE mm_ops.to_require_detach = NULL; */
1782 /* OBSOLETE mm_ops.to_resume = mm_resume; */
1783 /* OBSOLETE mm_ops.to_wait = mm_wait; */
1784 /* OBSOLETE mm_ops.to_post_wait = NULL; */
1785 /* OBSOLETE mm_ops.to_fetch_registers = mm_fetch_registers; */
1786 /* OBSOLETE mm_ops.to_store_registers = mm_store_registers; */
1787 /* OBSOLETE mm_ops.to_prepare_to_store = mm_prepare_to_store; */
1788 /* OBSOLETE mm_ops.to_xfer_memory = mm_xfer_inferior_memory; */
1789 /* OBSOLETE mm_ops.to_files_info = mm_files_info; */
1790 /* OBSOLETE mm_ops.to_insert_breakpoint = mm_insert_breakpoint; */
1791 /* OBSOLETE mm_ops.to_remove_breakpoint = mm_remove_breakpoint; */
1792 /* OBSOLETE mm_ops.to_terminal_init = 0; */
1793 /* OBSOLETE mm_ops.to_terminal_inferior = 0; */
1794 /* OBSOLETE mm_ops.to_terminal_ours_for_output = 0; */
1795 /* OBSOLETE mm_ops.to_terminal_ours = 0; */
1796 /* OBSOLETE mm_ops.to_terminal_info = 0; */
1797 /* OBSOLETE mm_ops.to_kill = mm_kill; */
1798 /* OBSOLETE mm_ops.to_load = mm_load; */
1799 /* OBSOLETE mm_ops.to_lookup_symbol = 0; */
1800 /* OBSOLETE mm_ops.to_create_inferior = mm_create_inferior; */
1801 /* OBSOLETE mm_ops.to_post_startup_inferior = NULL; */
1802 /* OBSOLETE mm_ops.to_acknowledge_created_inferior = NULL; */
1803 /* OBSOLETE mm_ops.to_clone_and_follow_inferior = NULL; */
1804 /* OBSOLETE mm_ops.to_post_follow_inferior_by_clone = NULL; */
1805 /* OBSOLETE mm_ops.to_insert_fork_catchpoint = NULL; */
1806 /* OBSOLETE mm_ops.to_remove_fork_catchpoint = NULL; */
1807 /* OBSOLETE mm_ops.to_insert_vfork_catchpoint = NULL; */
1808 /* OBSOLETE mm_ops.to_remove_vfork_catchpoint = NULL; */
1809 /* OBSOLETE mm_ops.to_has_forked = NULL; */
1810 /* OBSOLETE mm_ops.to_has_vforked = NULL; */
1811 /* OBSOLETE mm_ops.to_can_follow_vfork_prior_to_exec = NULL; */
1812 /* OBSOLETE mm_ops.to_post_follow_vfork = NULL; */
1813 /* OBSOLETE mm_ops.to_insert_exec_catchpoint = NULL; */
1814 /* OBSOLETE mm_ops.to_remove_exec_catchpoint = NULL; */
1815 /* OBSOLETE mm_ops.to_has_execd = NULL; */
1816 /* OBSOLETE mm_ops.to_reported_exec_events_per_exec_call = NULL; */
1817 /* OBSOLETE mm_ops.to_has_exited = NULL; */
1818 /* OBSOLETE mm_ops.to_mourn_inferior = mm_mourn; */
1819 /* OBSOLETE mm_ops.to_can_run = 0; */
1820 /* OBSOLETE mm_ops.to_notice_signals = 0; */
1821 /* OBSOLETE mm_ops.to_thread_alive = 0; */
1822 /* OBSOLETE mm_ops.to_stop = 0; */
1823 /* OBSOLETE mm_ops.to_pid_to_exec_file = NULL; */
1824 /* OBSOLETE mm_ops.to_stratum = process_stratum; */
1825 /* OBSOLETE mm_ops.DONT_USE = 0; */
1826 /* OBSOLETE mm_ops.to_has_all_memory = 1; */
1827 /* OBSOLETE mm_ops.to_has_memory = 1; */
1828 /* OBSOLETE mm_ops.to_has_stack = 1; */
1829 /* OBSOLETE mm_ops.to_has_registers = 1; */
1830 /* OBSOLETE mm_ops.to_has_execution = 1; */
1831 /* OBSOLETE mm_ops.to_sections = 0; */
1832 /* OBSOLETE mm_ops.to_sections_end = 0; */
1833 /* OBSOLETE mm_ops.to_magic = OPS_MAGIC; */
1837 /* OBSOLETE _initialize_remote_mm (void) */
1839 /* OBSOLETE init_mm_ops (); */
1840 /* OBSOLETE add_target (&mm_ops); */
1843 /* OBSOLETE #ifdef NO_HIF_SUPPORT */
1844 /* OBSOLETE service_HIF (union msg_t *msg) */
1846 /* OBSOLETE return (0); /* Emulate a failure */ */
1848 /* OBSOLETE #endif */
This page took 0.073561 seconds and 4 git commands to generate.