OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [remote-or1k.c] - Blame information for rev 375

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 106 markom
/* Remote debugging interface for various or1k debugging protocols.
2 118 markom
   Currently supported or1k targets are: simulator, jtag, dummy.
3
 
4 106 markom
   Copyright 1993-1995, 2000 Free Software Foundation, Inc.
5
   Contributed by Cygnus Support.  Written by Marko Mlinar
6
   <markom@opencores.org>
7
 
8
   This file is part of GDB.
9
 
10
   This program is free software; you can redistribute it and/or modify
11
   it under the terms of the GNU General Public License as published by
12
   the Free Software Foundation; either version 2 of the License, or
13
   (at your option) any later version.
14
 
15
   This program is distributed in the hope that it will be useful,
16
   but WITHOUT ANY WARRANTY; without even the implied warranty of
17
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
   GNU General Public License for more details.
19
 
20
   You should have received a copy of the GNU General Public License
21
   along with this program; if not, write to the Free Software
22
   Foundation, Inc., 59 Temple Place - Suite 330,
23
   Boston, MA 02111-1307, USA.  */
24
 
25
#include "defs.h"
26
#include "inferior.h"
27
#include "bfd.h"
28
#include "symfile.h"
29
#include "gdb_wait.h"
30
#include "gdbcmd.h"
31
#include "gdbcore.h"
32
#include "target.h"
33
#include "remote-utils.h"
34
#include "gdb_string.h"
35
#include "tm.h"
36
 
37
#include <signal.h>
38
#include <sys/types.h>
39
#include <sys/stat.h>
40
#include <sys/ioctl.h>
41
#include <fcntl.h>
42
 
43 362 markom
#define debug if (remote_debug) printf_unfiltered
44
 
45 125 chris
/* The following prototype is necessary or the compiler will not
46
   correctly promote the data argument to ULONGEST */
47
static void or1k_write_reg (unsigned int, ULONGEST);
48 372 markom
static int insn_has_delay_slot (unsigned int);
49 125 chris
 
50 118 markom
/* JTAG or1k target ops.  */
51 106 markom
extern void jtag_init PARAMS ((char * args));
52 122 markom
extern ULONGEST jtag_read_reg PARAMS ((unsigned int regno));
53
extern void jtag_write_reg PARAMS ((unsigned int regno, ULONGEST data));
54 106 markom
extern void jtag_done PARAMS ((void));
55 143 chris
extern int jtag_read_block PARAMS ((unsigned int regno, void* block, int nRegisters));
56
extern int jtag_write_block PARAMS ((unsigned int regno, void* block, int nRegisters));
57 113 markom
extern void jtag_set_chain PARAMS ((int chain));
58 106 markom
struct target_ops or1k_jtag_ops;
59
static struct or1k_target_ops or1k_target_jtag =
60
  {
61
    "jtag",
62
    jtag_init,
63
    jtag_done,
64
    jtag_read_reg,
65
    jtag_write_reg,
66 143 chris
    jtag_read_block,
67
    jtag_write_block,
68 113 markom
    jtag_set_chain,
69 106 markom
    NULL,
70
    &or1k_jtag_ops,
71
    OPS_MAGIC
72
  };
73
 
74 118 markom
/* simulator or1k target ops.  */
75 106 markom
struct target_ops or1k_sim_ops;
76
static struct or1k_target_ops or1k_target_sim =
77
  {
78
    "simulator",
79
    NULL,
80
    NULL,
81
    NULL,
82
    NULL,
83
    NULL,
84
    NULL,
85 143 chris
    NULL,
86
    NULL,
87 106 markom
    &or1k_sim_ops,
88
    OPS_MAGIC
89
  };
90
 
91 118 markom
/* dummy or1k target ops.  */
92 106 markom
struct target_ops or1k_dummy_ops;
93
static struct or1k_target_ops or1k_target_dummy =
94
  {
95
    "dummy",
96
    NULL,
97
    NULL,
98
    NULL,
99
    NULL,
100
    NULL,
101
    NULL,
102 143 chris
    NULL,
103
    NULL,
104 106 markom
    &or1k_dummy_ops,
105
    OPS_MAGIC
106
  };
107
 
108
const char *str_err[] =
109
  {
110
    "None", "CRC error"
111
  };
112
 
113
const char *status_name[] =
114
  {
115
    "UNDEFINED", "CONNECTING", "DISCONNECTING", "RUNNING", "STOPPED"
116
  };
117
 
118 113 markom
/* Names for matchpoint related stuff.  */
119
static char *ct_names[] =
120
  {
121
    "DIS", "IFEA", "LEA", "SEA", "AEA", "LDATA", "SDATA", "ADATA"
122
  };
123
 
124
static char *cc_names[] =
125
  {
126
    "&", "==", "<", "<=", ">", ">=", "!=", "ERR"
127
  };
128
 
129
static char *ch_names[] =
130
  {
131
    "ERR", "&", "|", "ERR"
132
  };
133
 
134 106 markom
/* Implementation specific information.  Set by or1k_initialize.  */
135
struct struct_or1k_implementation or1k_implementation;
136
 
137
/* Current target status.  */
138
static enum target_status or1k_status = TARGET_UNDEFINED;
139
 
140
/* The target vector.  */
141
struct target_ops or1k_dummy_ops, or1k_jtag_ops, or1k_sim_ops;
142
 
143
/* Currently active target description (if or1k_is_open == 1) */
144
static struct target_ops *current_ops;
145
 
146
/* Currently active or1k target operations.  */
147
static struct or1k_target_ops *current_or1k_target = NULL;
148
 
149
/* Set to 1 if the target is open.  */
150
static int or1k_is_open = 0;
151
 
152
/* Error last occured, zero = ok.  */
153 118 markom
int err = 0;
154 106 markom
 
155 362 markom
/* Nonzero, if we changed something (except DMR1 which is updated on every run anyway).  */
156 118 markom
int debug_regs_changed;
157
 
158 106 markom
/* Number of interrupts while waiting for process.  */
159
static int interrupt_count = 0;
160
 
161 113 markom
/* Reason of last stop.  */
162
static int hit_watchpoint = 0;
163 374 simons
static int hit_breakpoint = 0;
164 375 simons
static int new_pc_set = 0;
165 113 markom
 
166 106 markom
/* Current register values.  */
167 118 markom
unsigned int dmr1 = 0;
168
unsigned int dmr2 = 0;
169
unsigned int dsr = 0;
170
unsigned int drr = 0;
171 106 markom
 
172 118 markom
/* Current matchpoints.  */
173
unsigned int dvr[MAX_MATCHPOINTS];
174
struct dcr_struct dcr[MAX_MATCHPOINTS];
175 106 markom
 
176 362 markom
/* Number of matchpoint users */
177 118 markom
int matchpoint_user_count[MAX_MATCHPOINTS] = {0};
178
 
179 362 markom
/* Old SIGINT handler.  */
180
static void (*ofunc) PARAMS ((int));
181
 
182
 
183 106 markom
/* Handle low-level error that we can't recover from.  Note that just
184
   error()ing out from target_wait or some such low-level place will cause
185
   all hell to break loose--the rest of GDB will tend to get left in an
186
   inconsistent state.  */
187
 
188
static NORETURN void
189
or1k_error (char *string,...)
190
{
191
  va_list args;
192
 
193
  va_start (args, string);
194
 
195
  target_terminal_ours ();
196
  wrap_here ("");               /* Force out any buffered output */
197
  gdb_flush (gdb_stdout);
198
  if (error_pre_print)
199
    fprintf_filtered (gdb_stderr, error_pre_print);
200
  vfprintf_filtered (gdb_stderr, string, args);
201
  fprintf_filtered (gdb_stderr, "\n");
202
  va_end (args);
203
  gdb_flush (gdb_stderr);
204
 
205
  /* Clean up in such a way that or1k_close won't try to talk to the
206
     board (it almost surely won't work since we weren't able to talk to
207
     it).  */
208
  or1k_is_open = 0;
209
 
210
  printf_unfiltered ("Ending remote or1k debugging.\n");
211
  target_mourn_inferior ();
212
 
213
  return_to_top_level (RETURN_ERROR);
214
}
215
 
216
const char *
217
or1k_err_name (e)
218
     int e;
219
{
220
  return str_err[e];
221
}
222
 
223
/* putc_readable - print a character, displaying non-printable chars in
224
   ^x notation or in hex.  */
225
 
226
static void
227
fputc_readable (ch, file)
228
     int ch;
229
     struct ui_file *file;
230
{
231
  if (ch == '\n')
232
    fputc_unfiltered ('\n', file);
233
  else if (ch == '\r')
234
    fprintf_unfiltered (file, "\\r");
235
  else if (ch < 0x20)           /* ASCII control character */
236
    fprintf_unfiltered (file, "^%c", ch + '@');
237
  else if (ch >= 0x7f)          /* non-ASCII characters (rubout or greater) */
238
    fprintf_unfiltered (file, "[%02x]", ch & 0xff);
239
  else
240
    fputc_unfiltered (ch, file);
241
}
242
 
243
 
244
/* puts_readable - print a string, displaying non-printable chars in
245
   ^x notation or in hex.  */
246
 
247
static void
248
fputs_readable (string, file)
249
     char *string;
250
     struct ui_file *file;
251
{
252
  int c;
253
 
254
  while ((c = *string++) != '\0')
255
    fputc_readable (c, file);
256
}
257
 
258 113 markom
/* Sets scan chain.  */
259
 
260
static void
261
or1k_set_chain (chain)
262
     int chain;
263
{
264
  if (current_or1k_target != NULL && current_or1k_target->to_set_chain != NULL)
265
    current_or1k_target->to_set_chain (chain);
266
}
267
 
268 106 markom
/* Sets register/memory regno to data.  */
269
 
270 113 markom
static void
271 106 markom
or1k_write_reg (regno, data)
272
     unsigned int regno;
273 122 markom
     ULONGEST data;
274 106 markom
{
275 113 markom
  if (current_or1k_target != NULL && current_or1k_target->to_write_reg != NULL)
276
    current_or1k_target->to_write_reg (regno, data);
277 106 markom
}
278
 
279
/* Reads register/memory from regno.  */
280
 
281 122 markom
static ULONGEST
282 106 markom
or1k_read_reg (regno)
283
     unsigned int regno;
284
{
285 113 markom
  if (current_or1k_target != NULL && current_or1k_target->to_read_reg != NULL)
286
    return current_or1k_target->to_read_reg (regno);
287 106 markom
  else
288
    return 0x1234;
289
}
290
 
291 113 markom
/* Sets SPR register regno to data.  */
292
 
293
void
294
or1k_write_spr_reg (regno, data)
295
     unsigned int regno;
296
     unsigned int data;
297
{
298
  or1k_set_chain (SC_RISC_DEBUG);
299 362 markom
  or1k_write_reg (regno, (ULONGEST)data);
300 374 simons
  if (regno == PC_SPRNUM) {
301
    hit_breakpoint = 0;
302 375 simons
    new_pc_set = 1;
303 374 simons
  }
304 113 markom
}
305
 
306
/* Reads register SPR from regno.  */
307
 
308
unsigned int
309
or1k_read_spr_reg (regno)
310
     unsigned int regno;
311
{
312
  or1k_set_chain (SC_RISC_DEBUG);
313 362 markom
  return or1k_read_reg (regno);
314 113 markom
}
315
 
316 362 markom
/* Sets mem to data.  */
317
 
318
void
319
or1k_write_mem (addr, data)
320
     unsigned int addr;
321
     unsigned int data;
322
{
323
  or1k_set_chain (SC_WISHBONE);
324
  or1k_write_reg (addr, (ULONGEST)data);
325
}
326
 
327
/* Reads register SPR from regno.  */
328
 
329
unsigned int
330
or1k_read_mem (addr)
331
     unsigned int addr;
332
{
333
  or1k_set_chain (SC_WISHBONE);
334
  return or1k_read_reg (addr);
335
}
336
 
337 106 markom
/* Stalls the CPU.  */
338
 
339
static void
340
or1k_stall ()
341
{
342 113 markom
  int val;
343
  or1k_set_chain (SC_REGISTER);
344
  val = or1k_read_reg (JTAG_RISCOP);
345
  or1k_write_reg (JTAG_RISCOP, val | 1);
346 362 markom
  or1k_read_reg (JTAG_RISCOP);
347 118 markom
 
348
  /* Be cautious - disable trace.  */
349
  val = or1k_read_reg (JTAG_MODER);
350
  or1k_write_reg (JTAG_MODER, val & ~2);
351 106 markom
}
352
 
353
/* Unstalls the CPU.  */
354
 
355
static void
356
or1k_unstall ()
357
{
358 113 markom
  unsigned int val;
359 143 chris
 
360 207 chris
 
361 113 markom
  or1k_set_chain (SC_REGISTER);
362
  val = or1k_read_reg (JTAG_RISCOP);
363
  or1k_write_reg (JTAG_RISCOP, val & ~1);
364 362 markom
  or1k_read_reg (JTAG_RISCOP);
365 106 markom
}
366
 
367 113 markom
/* Resets the CPU and stalls it.  */
368 118 markom
 
369 106 markom
static void
370 113 markom
or1k_reset ()
371
{
372
  unsigned int val;
373 362 markom
  int i;
374
  debug ("%08x\n", or1k_read_reg (JTAG_RISCOP));
375 113 markom
  or1k_set_chain (SC_REGISTER);
376 118 markom
 
377
  /* Be cautious - disable trace.  */
378
  val = or1k_read_reg (JTAG_MODER);
379
  or1k_write_reg (JTAG_MODER, val & ~2);
380
 
381 113 markom
  val = or1k_read_reg (JTAG_RISCOP);
382
  val &= ~3;
383 118 markom
  /* Assert reset signal.  */
384
  or1k_write_reg (JTAG_RISCOP, val | 3);
385
 
386 362 markom
  /* Just do something */
387
  for (i = 0; i < 100; i++)
388
    or1k_read_reg (JTAG_RISCOP);
389
 
390 118 markom
  /* give it some time */
391
  usleep (1000);
392 125 chris
 
393 362 markom
  or1k_set_chain (SC_REGISTER);
394 118 markom
  /* Release reset signal, but keep in stall state.  */
395
  or1k_write_reg (JTAG_RISCOP, val | 1);
396 362 markom
  or1k_read_reg (JTAG_RISCOP);
397 113 markom
}
398
 
399 118 markom
/* Synchronizes debug registers in memory with those on target,
400
   if there is any change.  */
401
 
402 113 markom
static void
403 118 markom
or1k_commit_debug_registers ()
404
{
405
  int i;
406
  unsigned int u;
407
  if (!debug_regs_changed)
408
    return;
409
 
410
  /* Matchpoints (breakpoints, watchpoints).  */
411
  for (i = 0; i < NUM_MATCHPOINTS; i++)
412
    {
413
      unsigned int u;
414
      or1k_write_spr_reg (DVR0_SPRNUM + i, dvr[i]);
415
      memcpy (&u, &dcr[i], sizeof(dcr[i]));
416
      or1k_write_spr_reg (DCR0_SPRNUM + i, u);
417
    }
418
  or1k_write_spr_reg (DMR1_SPRNUM, dmr1);
419
  or1k_write_spr_reg (DMR2_SPRNUM, dmr2);
420
 
421
  /* Trace dependent.  */
422
  or1k_set_chain (SC_REGISTER);
423
  memcpy (&u, &or1k_htrace.trig, sizeof(or1k_htrace.trig));
424
  or1k_write_reg (JTAG_TSEL, u);
425
  memcpy (&u, &or1k_htrace.qual, sizeof(or1k_htrace.qual));
426
  or1k_write_reg (JTAG_QSEL, u);
427
  memcpy (&u, &or1k_htrace.stop, sizeof(or1k_htrace.stop));
428
  or1k_write_reg (JTAG_SSEL, u);
429
  debug_regs_changed = 0;
430
  for (i = 0; i < NUM_RECORDS; i++)
431
    {
432
      memcpy (&u, &or1k_htrace.recwp[i], sizeof(or1k_htrace.recwp[i]));
433
      or1k_write_reg (JTAG_RECWP0 + i, u);
434
    }
435
  memcpy (&u, &or1k_htrace.recbp, sizeof(or1k_htrace.recbp));
436
  or1k_write_reg (JTAG_RECBP0, u);
437
  memcpy (&u, &or1k_htrace.moder, sizeof(or1k_htrace.moder));
438
  or1k_write_reg (JTAG_MODER, u);
439
}
440
 
441
static void
442 106 markom
or1k_set_undefined_cleanups (arg)
443
     PTR arg;
444
{
445
  or1k_status = TARGET_UNDEFINED;
446
}
447
 
448
/* Initialize a new connection to the or1k board, and make sure we are
449
   really connected.  */
450
 
451
static void
452
or1k_init (args)
453
     char *args;
454
{
455
  struct cleanup *old_cleanups = make_cleanup (or1k_set_undefined_cleanups, NULL);
456
  int i;
457 115 markom
  unsigned int tmp;
458 118 markom
  FILE *f;
459 106 markom
 
460
  /* What is this code doing here?  I don't see any way it can happen, and
461
     it might mean or1k_initializing didn't get cleared properly.
462
     So I'll make it a warning.  */
463
 
464
  if (or1k_status == TARGET_CONNECTING)
465
    {
466
      warning ("internal error: or1k_initialize called twice");
467
      return;
468
    }
469
 
470
  or1k_status = TARGET_CONNECTING;
471
  if (current_or1k_target != NULL && current_or1k_target->to_init != NULL)
472
    current_or1k_target->to_init (args);
473 122 markom
 
474 362 markom
  debug("%08x\n", read_pc ());
475
  or1k_stall ();
476
  debug("%08x\n", read_pc ());
477
  usleep (1000);
478
 
479 106 markom
  /* Determine implementation configuration.  */
480 113 markom
  or1k_implementation.VR = or1k_read_spr_reg (VR_SPRNUM);
481
  or1k_implementation.UPR = or1k_read_spr_reg (UPR_SPRNUM);
482 118 markom
 
483 115 markom
  /* Determine number of gpr_regs.  */
484
  tmp = or1k_read_spr_reg (CPUCFGR_SPRNUM);
485
  or1k_implementation.num_gpr_regs = ((tmp >> 4) & 1)?(16):(32);
486 118 markom
 
487 115 markom
  /* Is any vector or floating point support present? */
488
  or1k_implementation.vf_present = ((tmp >> 7) & 7) != 0;
489
  or1k_implementation.num_vfpr_regs = (or1k_implementation.vf_present)?(32):(0);
490 106 markom
 
491 115 markom
  /* Determine max number of supported matchpoints.  */
492
  tmp = or1k_read_spr_reg (DCFGR_SPRNUM);
493
  or1k_implementation.num_matchpoints = tmp & 7;
494 113 markom
  or1k_implementation.num_used_matchpoints = 0;
495 115 markom
  or1k_implementation.has_counters = tmp & 4 == 1;
496 106 markom
 
497
  /* Is implementation supported? */
498
 
499
  /* First we should have system and debug groups implemented. */
500
  if (or1k_implementation.VR & (1 << SPR_SYSTEM_GROUP) == 0)
501
    error ("System group should be available in the or1k implementation.");
502
  if (or1k_implementation.VR & (1 << SPR_DEBUG_GROUP) == 0)
503
    error ("Debug group should be available in the or1k implementation.");
504 115 markom
  if (or1k_implementation.has_counters)
505
    warning ("Counters not supported.");
506 106 markom
 
507
  /* Delete break, watch, catch points.  */
508
  for(i = 0; i < NUM_MATCHPOINTS; i++)
509 118 markom
    {
510
      memset (&dcr[i], 0, sizeof (dcr[i]));
511
      matchpoint_user_count[i] = 0;
512
    }
513 106 markom
 
514
  dmr1 = 0;
515
  dmr2 = 0;
516 118 markom
  memset (&or1k_htrace, 0, sizeof (or1k_htrace));
517
 
518
  /* RECSELDEPEND = 0 does not match our trace scheme. */
519
  or1k_htrace.moder.rec_sel_dep = 1;
520
 
521
  debug_regs_changed = 1;
522
  or1k_commit_debug_registers ();
523
 
524 106 markom
  if (err != 0)
525
    error ("Cannot connect.");
526
 
527 362 markom
  /* Enable exceptions */
528
  or1k_write_spr_reg (SR_SPRNUM, or1k_read_spr_reg(SR_SPRNUM) | 0x2);
529
 
530 106 markom
  /* Stop when breakpoint occurs.  */
531 372 markom
  or1k_write_spr_reg (DSR_SPRNUM, dsr = 0x2000);
532 106 markom
 
533
  do_cleanups (old_cleanups);
534
 
535
  /* This should cause an error if not connected.  */
536
  or1k_fetch_registers (-1);
537
 
538
  set_current_frame (create_new_frame (read_fp (), read_pc ()));
539
  select_frame (get_current_frame (), 0);
540 118 markom
 
541
  /* Just empty it.  */
542
  if ((f = fopen (TRACE_FILENAME, "wb+")) == NULL)
543
    error ("Cannot open trace file.");
544
  fclose (f);
545
  trace_size = 0;
546 363 markom
  or1k_status = TARGET_STOPPED;
547 106 markom
}
548
 
549
/* Kill the process running on the board.  */
550
 
551
void
552
or1k_kill ()
553
{
554
  if (or1k_status != TARGET_RUNNING)
555
    return;
556
  or1k_status = TARGET_UNDEFINED;
557 113 markom
  or1k_reset();
558
  or1k_status = TARGET_STOPPED;
559 106 markom
 
560
  inferior_pid = 0;
561
}
562
 
563
/* Open a connection to the remote board.  */
564
 
565
static void
566
or1k_open (name, from_tty)
567
     char *name;
568
     int from_tty;
569
{
570
  or1k_init (name);
571
 
572
  /* Switch to using remote target now.  */
573
  current_ops = current_or1k_target->gdb_ops;
574
  or1k_is_open = 1;
575
  push_target (current_ops);
576
 
577
  /* FIXME: Should we call start_remote here?  */
578
 
579
/* This is really the job of start_remote however, that makes an assumption
580
   that the target is about to print out a status message of some sort.  That
581
   doesn't happen here (in fact, it may not be possible to get the monitor to
582
   send the appropriate packet).  */
583
 
584
  flush_cached_frames ();
585
  registers_changed ();
586
  stop_pc = read_pc ();
587
  set_current_frame (create_new_frame (read_fp (), stop_pc));
588
  select_frame (get_current_frame (), 0);
589
  print_stack_frame (selected_frame, -1, 1);
590
}
591
 
592 362 markom
/* This is the generic stop called via the target vector. When a target
593
   interrupt is requested, either by the command line or the GUI, we
594
   will eventually end up here. */
595
static void
596
or1k_stop ()
597
{
598
  /* Send a break or a ^C, depending on user preference.  */
599
  debug ("remote_stop called\n");
600
 
601
  /* We should not stop the target immediately, since it can be in an
602
     unfinished state.  So we do a single step.  This should not affect
603
     on anything.  */
604
  or1k_stall ();
605
  /* HW STEP.  Set DMR1_ST.  */
606
  dmr1 |= DMR1_ST;
607
  or1k_write_spr_reg (DMR1_SPRNUM, dmr1);
608
  dmr1 &= ~DMR1_ST;
609
  or1k_unstall ();
610
}
611
 
612 106 markom
/* Close a connection to the remote board.  */
613
 
614
static void
615
or1k_close (quitting)
616
     int quitting;
617
{
618
  if (or1k_is_open)
619
    {
620
      or1k_kill ();
621
      if (current_or1k_target != NULL && current_or1k_target->to_done != NULL)
622
        current_or1k_target->to_done ();
623
      current_or1k_target = NULL;
624
    }
625
  generic_mourn_inferior ();
626
}
627
 
628
/* Detach from the remote board.  */
629
 
630
static void
631
or1k_detach (args, from_tty)
632
     char *args;
633
     int from_tty;
634
{
635
  if (args)
636
    error ("Argument given to \"detach\" when remotely debugging.");
637
 
638
  pop_target ();
639
 
640
  or1k_close (1);
641
 
642
  if (from_tty)
643
    printf_unfiltered ("Ending remote or1k debugging.\n");
644
}
645
 
646 118 markom
/* Appends trace data to the trace file.  */
647
 
648
static void
649
or1k_read_trace ()
650
{
651
  struct htrace_data_struct data;
652 122 markom
  ULONGEST tmp;
653 118 markom
  int first = 1;
654
  FILE *fd;
655
  if ((fd = fopen (TRACE_FILENAME, "ab")) == NULL)
656
    {
657
      warning ("Cannot append to trace file.");
658
      return;
659
    }
660
 
661
  or1k_set_chain (SC_TRACE);
662
  while (1)
663
    {
664
      tmp = or1k_read_reg (0);
665
      memcpy (&data, &tmp, sizeof (data));
666
 
667
      /* Last record reached. */
668
      if (!data.valid)
669
        break;
670
      data.valid = first;
671
      first = 0;
672
      if (!fwrite (&data, sizeof (data), 1, fd))
673
        {
674
          warning ("Cannot write trace data");
675
          break;
676
        }
677
    }
678
  fclose (fd);
679
}
680
 
681 362 markom
/* ^C Interrupt handling */
682
 
683
/* Ask the user what to do when an interrupt is received.  */
684
static void
685
interrupt_query ()
686
{
687
  target_terminal_ours ();
688
 
689
  if (query ("Interrupted while waiting for the program.\n\
690
Give up (and stop debugging it)? "))
691
    {
692
      target_mourn_inferior ();
693
      return_to_top_level (RETURN_QUIT);
694
    }
695
 
696
  target_terminal_inferior ();
697
}
698
 
699
static void or1k_interrupt_twice (int signo);
700
 
701
 
702
/* The command line interface's stop routine. This function is installed
703
   as a signal handler for SIGINT. The first time a user requests a
704
   stop, we call remote_stop to send a break or ^C. If there is no
705
   response from the target (it didn't stop when the user requested it),
706
   we ask the user if he'd like to detach from the target. */
707
static void
708
or1k_interrupt (signo)
709
     int signo;
710
{
711
        debug ("interrupt");
712
  /* If this doesn't work, try more severe steps. */
713
  signal (signo, or1k_interrupt_twice);
714
 
715
  debug ("remote_interrupt called\n");
716
 
717
  interrupt_count++;
718
}
719
 
720
/* The user typed ^C twice.  */
721
 
722
static void
723
or1k_interrupt_twice (signo)
724
     int signo;
725
{
726
        debug ("interrupt2");
727
  signal (signo, ofunc);
728
  interrupt_query ();
729
  signal (signo, or1k_interrupt);
730
}
731
 
732 106 markom
/* Resume execution of the target process.  STEP says whether to single-step
733
   or to run free; SIGGNAL is the signal value (e.g. SIGINT) to be given
734
   to the target, or zero for no signal.  */
735
 
736
static void
737
or1k_resume (pid, step, siggnal)
738
     int pid, step;
739
     enum target_signal siggnal;
740 362 markom
{
741 372 markom
  unsigned int pc;
742
  unsigned int ppc;
743
  unsigned int npc;
744
  unsigned int val;
745 375 simons
  unsigned int ppc_insn;
746 372 markom
 
747
  pc = read_pc();
748
  npc = or1k_read_spr_reg (PC_SPRNUM);
749
  ppc = or1k_read_spr_reg (PPC_SPRNUM);
750
  debug ("pc = %08x BP = %x npc = %08x ppc = %08x\n", pc, breakpoint_here_p (pc), npc, ppc);
751 362 markom
  debug ("resume %i, %i, %i\n",step, siggnal, or1k_status);
752 106 markom
  if (or1k_status != TARGET_STOPPED)
753
    if (or1k_status == TARGET_RUNNING)
754
      error ("Program is already running.");
755
    else
756
      error ("The program is not being run.");
757
 
758 150 chris
 
759 106 markom
  /* Clear reason register for later.  */
760 113 markom
  or1k_write_spr_reg (DRR_SPRNUM, 0);
761 106 markom
 
762 362 markom
  or1k_commit_debug_registers ();
763
 
764 375 simons
  ppc_insn = or1k_fetch_instruction(ppc);
765
 
766 374 simons
  /* Else clause added by CZ 26/06/01 */
767
  if (step)
768
    {
769 106 markom
      /* HW STEP.  Set DMR1_ST.  */
770
      dmr1 |= DMR1_ST;
771 113 markom
      or1k_write_spr_reg (DMR1_SPRNUM, dmr1);
772 106 markom
      dmr1 &= ~DMR1_ST;
773 372 markom
 
774 375 simons
      if (new_pc_set)
775
        {
776
          or1k_write_spr_reg (PC_SPRNUM, pc);
777
          new_pc_set = 0;
778
        }
779
      else if (insn_has_delay_slot (ppc_insn) && (ppc != pc))
780
        {
781
          /* Steping across delay slot insn - we have to reexcute branch insn */
782 374 simons
 
783 375 simons
          if(breakpoint_here_p (ppc))
784
              or1k_write_mem(ppc, ppc_insn);
785
 
786
          or1k_write_spr_reg (PC_SPRNUM, ppc);
787
 
788
          or1k_unstall ();
789
 
790
          or1k_set_chain (SC_REGISTER);
791
          val = or1k_read_reg (JTAG_RISCOP);
792
          do {
793
            val = or1k_read_reg (JTAG_RISCOP);
794
          } while ((val & 1) == 0);
795
        }
796
      else if (hit_breakpoint && ((ppc + 4) != npc))
797 374 simons
       {
798
          /* Trapped on delay slot instruction. */
799
          /* Set PC to branch insn preceding delay slot. */
800
          or1k_write_spr_reg (PC_SPRNUM, ppc - 4);
801
 
802 372 markom
          or1k_unstall ();
803
 
804
          or1k_set_chain (SC_REGISTER);
805
          val = or1k_read_reg (JTAG_RISCOP);
806 374 simons
          do {
807 372 markom
            val = or1k_read_reg (JTAG_RISCOP);
808 374 simons
          } while ((val & 1) == 0);
809 372 markom
        }
810 375 simons
      else
811
        or1k_write_spr_reg (PC_SPRNUM, pc);
812
 
813
    }
814
  else
815
    {
816
      dmr1 &= ~DMR1_ST;
817
      or1k_write_spr_reg (DMR1_SPRNUM, dmr1);
818
 
819
      if (new_pc_set)
820 374 simons
        {
821 375 simons
          or1k_write_spr_reg (PC_SPRNUM, pc);
822
          new_pc_set = 0;
823
        }
824
      else if (insn_has_delay_slot (ppc_insn) && !breakpoint_here_p (ppc))
825 374 simons
          or1k_write_spr_reg (PC_SPRNUM, ppc);
826 375 simons
      else if (insn_has_delay_slot (ppc_insn) && breakpoint_here_p (ppc))
827
        {
828
          or1k_write_mem(ppc, ppc_insn);
829
 
830
          dmr1 |= DMR1_ST;
831
          or1k_write_spr_reg (DMR1_SPRNUM, dmr1);
832
          dmr1 &= ~DMR1_ST;
833
 
834
          or1k_write_spr_reg (PC_SPRNUM, ppc);
835 374 simons
 
836
          or1k_unstall ();
837 375 simons
 
838 374 simons
          or1k_set_chain (SC_REGISTER);
839
          val = or1k_read_reg (JTAG_RISCOP);
840
          do {
841
            val = or1k_read_reg (JTAG_RISCOP);
842
          } while ((val & 1) == 0);
843 375 simons
 
844
          or1k_write_mem(ppc, 0x21000001);
845
 
846
          or1k_write_spr_reg (DMR1_SPRNUM, dmr1);
847 374 simons
        }
848 375 simons
      else
849 374 simons
        or1k_write_spr_reg (PC_SPRNUM, pc);
850 106 markom
    }
851
 
852 207 chris
  /* We can now continue normally, independent of step */
853 106 markom
  or1k_unstall ();
854
  or1k_status = TARGET_RUNNING;
855 362 markom
  debug ("-resume %i, %i, %i\n",step, siggnal, or1k_status);
856 106 markom
}
857
 
858
/* Wait until the remote stops, and return a wait status.  */
859
 
860
static int
861
or1k_wait (pid, status)
862
     int pid;
863
     struct target_waitstatus *status;
864
{
865 362 markom
  unsigned long val;
866
  unsigned long pc;
867 372 markom
  unsigned long ppc;
868 362 markom
  char buf[MAX_REGISTER_RAW_SIZE];
869 106 markom
  interrupt_count = 0;
870
 
871 362 markom
  debug ("wait %i %i\n", pid, or1k_status);
872 106 markom
  /* If we have not sent a single step or continue command, then the
873
     board is waiting for us to do something.  Return a status
874
     indicating that it is stopped.  */
875
  if (or1k_status != TARGET_RUNNING)
876
    {
877
      if (or1k_status != TARGET_STOPPED)
878
        error("Target in invalid state.");
879
      status->kind = TARGET_WAITKIND_STOPPED;
880
      status->value.sig = TARGET_SIGNAL_TRAP;
881
      return 0;
882
    }
883
 
884
  if (err)
885
    or1k_error ("Remote failure: %s", or1k_err_name (err));
886
 
887 362 markom
  /* Set new signal handler */
888
  ofunc = signal (SIGINT, or1k_interrupt);
889 106 markom
 
890 362 markom
  /* Wait for risc to stop.  */
891
  do {
892
    or1k_set_chain (SC_REGISTER);
893
    val = or1k_read_reg (JTAG_RISCOP);
894 372 markom
 
895 362 markom
    /* When we press Ctrl-C, interrupt count is set, but we must wait
896
         for or1k_read_reg to finish, otherwise we would interrupt transaction.  */
897
    if (interrupt_count)
898 372 markom
      or1k_stop ();
899 106 markom
 
900 362 markom
    usleep (10);
901
    debug ("%i", val);
902 372 markom
  } while ((val & 1) == 0);
903
 
904 362 markom
  drr = or1k_read_spr_reg (DRR_SPRNUM);
905 372 markom
 
906 362 markom
  /* Restore old INT signal handler */
907
  signal (SIGINT, ofunc);
908
 
909 372 markom
  /* Single step does not set trap exception, so we set it manually to simplify our code */
910
  dmr1 = or1k_read_spr_reg (DMR1_SPRNUM);
911
  if (dmr1 & DMR1_ST)
912
    drr |= DRR_TE;
913 362 markom
 
914
  status->kind = TARGET_WAITKIND_STOPPED;
915
 
916
  debug ("epcr0 = %08x\n", or1k_read_spr_reg (EPCR0_SPRNUM));
917
  debug ("drr = %08x\n", drr);
918
 
919 363 markom
  registers_changed ();
920 362 markom
  pc = read_pc ();
921 372 markom
  ppc = or1k_read_spr_reg (PPC_SPRNUM);
922 375 simons
  debug ("ppc = %08x\n", ppc);
923 362 markom
 
924 372 markom
  if (drr & DRR_TE)
925
    {
926
      /* If single step is not set, we should correct the pc.  */
927
      if (!(dmr1 & DMR1_ST))
928
        /* PC has already stepped over the l.trap instruction.  */
929
        pc = ppc;
930
      status->value.sig = TARGET_SIGNAL_TRAP;
931
      drr &= ~DRR_TE;
932
    }
933
  else if (drr & DRR_RSTE)
934
    {
935
      status->value.sig = TARGET_SIGNAL_REALTIME_33;
936
      drr &= ~DRR_RSTE;
937
    }
938 106 markom
  else if (drr & DRR_BUSEE)
939 372 markom
    {
940
      status->value.sig = TARGET_SIGNAL_BUS;
941
      drr &= ~DRR_BUSEE;
942
    }
943 106 markom
  else if (drr & DRR_AE)
944 372 markom
    {
945
      status->value.sig = TARGET_SIGNAL_REALTIME_36;
946
      drr &= ~DRR_AE;
947
    }
948 106 markom
  else if (drr & DRR_IIE)
949 372 markom
    {
950
      status->value.sig = TARGET_SIGNAL_ILL;
951
      drr &= ~DRR_IIE;
952
    }
953
  else if (drr & DRR_RE)
954
    {
955
      status->value.sig = TARGET_SIGNAL_REALTIME_39;
956
      drr &= ~DRR_RE;
957
    }
958
  else if (drr & DRR_IME)
959
    {
960
      status->value.sig = TARGET_SIGNAL_REALTIME_38;
961
      drr &= ~DRR_IME;
962
    }
963 106 markom
  else if (drr & DRR_DME)
964 372 markom
    {
965
      status->value.sig = TARGET_SIGNAL_REALTIME_37;
966
      drr &= ~DRR_DME;
967
    }
968
  else if (drr & DRR_DPFE)
969
    {
970
      status->value.sig = TARGET_SIGNAL_REALTIME_34;
971
      drr &= ~DRR_DPFE;
972
    }
973
  else if (drr & DRR_IPFE)
974
    {
975
      status->value.sig = TARGET_SIGNAL_REALTIME_35;
976
      drr &= ~DRR_DPFE;
977
    }
978 106 markom
  else if (drr & DRR_SCE)
979
    {
980 372 markom
      status->value.sig = TARGET_SIGNAL_REALTIME_40;
981
      drr &= ~DRR_SCE;
982
    }
983
  else if (drr & DRR_HPINTE)
984
    {
985
      status->value.sig = TARGET_SIGNAL_INT;
986
      drr &= ~DRR_HPINTE;
987
    }
988
  else if (drr & DRR_LPINTE)
989
    {
990
      status->value.sig = TARGET_SIGNAL_INT;
991
      drr &= ~DRR_LPINTE;
992
    }
993
  else
994
    {
995 106 markom
      status->value.sig = TARGET_SIGNAL_UNKNOWN;
996
      warning ("Invalid exception occured.");
997 372 markom
    }
998 106 markom
 
999 372 markom
  /* Update drr register */
1000
  or1k_write_spr_reg (DRR_SPRNUM, drr);
1001
 
1002 362 markom
  /* Write into PC flushes the pipeline! */
1003
  /* We got the number the register holds, but gdb expects to see a
1004
     value in the target byte ordering.  */
1005 372 markom
/*  write_pc (pc);
1006
*/
1007
  store_unsigned_integer (buf, REGISTER_RAW_SIZE (PC_REGNUM), pc);
1008
  supply_register (PC_REGNUM, buf);
1009 374 simons
 
1010
  hit_breakpoint = breakpoint_here_p (pc);
1011 372 markom
 
1012 363 markom
  /*or1k_write_spr_reg (PC_SPRNUM, pc);
1013 362 markom
  store_unsigned_integer (buf, REGISTER_RAW_SIZE (PC_REGNUM), pc);
1014 363 markom
  supply_register (PC_REGNUM, buf);*/
1015 362 markom
 
1016 113 markom
  /* Log remote stop.  */
1017 106 markom
  or1k_status = TARGET_STOPPED;
1018 113 markom
 
1019
  /* Determine what caused trap - breakpoint or watchpoint.  */
1020
  if (status->value.sig == TARGET_SIGNAL_TRAP)
1021
    {
1022
      /* Search all active breakpoints for a match.  */
1023
      CORE_ADDR pc = read_pc ();
1024
      int breakpoint = 0;
1025
      int i;
1026 150 chris
      unsigned char break_bytes[4] = BRK_INSTR_STRUCT;
1027
      unsigned long b_insn = ntohl(*((unsigned long*)break_bytes));
1028 151 chris
      unsigned long value = pc;
1029 143 chris
 
1030 113 markom
      for (i = 0; i < or1k_implementation.num_used_matchpoints; i++)
1031 118 markom
        if (dvr[i] == pc && dcr[i].dp && dcr[i].cc == CC_EQUAL
1032
            && !dcr[i].sc && dcr[i].ct == CT_FETCH)
1033 113 markom
          {
1034
            breakpoint = 1;
1035
            break;
1036
          }
1037
      hit_watchpoint = !breakpoint;
1038 143 chris
 
1039
      /* Cause the trap/breakpoint exception to be ignored. This is
1040
         the behavior of the simulator when the PC value is changed
1041
         by a write command. All pending exceptions are cleared and
1042 150 chris
         the simulator continues at the PC value specified. We need
1043
         to do this if the instruction at the current PC has the
1044
         value BRK_INSTR_STRUCT */
1045
 
1046 362 markom
      if(b_insn == or1k_read_mem((pc & 3)))
1047 150 chris
        {
1048
          or1k_write_spr_reg(PC_SPRNUM,value);
1049
        }
1050 113 markom
    }
1051
  else
1052
    hit_watchpoint = 0;
1053 106 markom
 
1054
  /* If the stop PC is in the _exit function, assume
1055
     we hit the 'break 0x3ff' instruction in _exit, so this
1056
     is not a normal breakpoint.  */
1057
  {
1058
    char *func_name;
1059
    CORE_ADDR func_start;
1060
    CORE_ADDR pc = read_pc ();
1061
 
1062
    find_pc_partial_function (pc, &func_name, &func_start, NULL);
1063
    if (func_name != NULL && strcmp (func_name, "_exit") == 0
1064
        && func_start == pc)
1065
      status->kind = TARGET_WAITKIND_EXITED;
1066
  }
1067 118 markom
 
1068
  or1k_read_trace ();
1069 362 markom
  debug ("-wait %i %i\n", pid, or1k_status);
1070 106 markom
  return 0;
1071
}
1072
 
1073 113 markom
/* Fetch a word from the target board.  All memory accesses to the
1074
   remote board are word aligned.  */
1075 106 markom
 
1076 118 markom
unsigned int
1077 106 markom
or1k_fetch_word (addr)
1078
     CORE_ADDR addr;
1079
{
1080 113 markom
  if (addr & 3)
1081
    {
1082
      int subaddr = addr & 3;
1083
      unsigned char buf[8];
1084
      unsigned int low, high;
1085
      addr >>= 2;
1086 362 markom
      low = or1k_read_mem (addr << 2);
1087
      high = or1k_read_reg ((addr + 1) << 2);
1088 113 markom
      memcpy (&buf[0], &low, 4);
1089
      memcpy (&buf[4], &high, 4);
1090
      memcpy (&low, &buf[subaddr], 4);
1091
      return low;
1092
    }
1093
  else
1094
    {
1095 362 markom
      return or1k_read_mem (addr);
1096 113 markom
    }
1097 106 markom
}
1098
 
1099
/* Store a word to the target board.  Returns errno code or zero for
1100 113 markom
   success.  All memory accesses to the remote board are word aligned.  */
1101 118 markom
 
1102 106 markom
static int
1103
or1k_store_word (addr, val)
1104
     CORE_ADDR addr;
1105
     unsigned int val;
1106
{
1107 113 markom
  if (addr & 3)
1108
    {
1109
      int subaddr = addr & 3;
1110
      unsigned char buf[8];
1111
      unsigned int low, high;
1112
      addr >>= 2;
1113 362 markom
      low = or1k_read_mem (addr << 2);
1114
      high = or1k_read_mem ((addr + 1) << 2);
1115 113 markom
      memcpy (&buf[0], &low, 4);
1116
      memcpy (&buf[4], &high, 4);
1117
      memcpy (&buf[subaddr], &val, 4);
1118
      memcpy (&low, &buf[0], 4);
1119
      memcpy (&high, &buf[4], 4);
1120 362 markom
      or1k_write_mem (addr << 2, low);
1121
      or1k_write_mem ((addr + 1) << 2, high);
1122 113 markom
    }
1123
  else
1124 362 markom
    {
1125
      or1k_write_mem (addr, val);
1126 113 markom
    }
1127 106 markom
  return err;
1128
}
1129
 
1130
/* Fetch the remote registers.  */
1131
 
1132
void
1133
or1k_fetch_registers (regno)
1134
     int regno;
1135
{
1136
  unsigned int val;
1137
 
1138
  if (regno == -1)
1139
    {
1140
      for (regno = 0; regno < NUM_REGS; regno++)
1141
        or1k_fetch_registers (regno);
1142
      return;
1143
    }
1144
 
1145
  if (regno >= NUM_REGS)
1146
    error("Invalid register number!");
1147
 
1148
  /* Convert to SPRNUM and read.  */
1149 113 markom
  val = or1k_read_spr_reg (REGNUM_TO_SPRNUM(regno));
1150 106 markom
 
1151
  {
1152
    char buf[MAX_REGISTER_RAW_SIZE];
1153
 
1154
    /* We got the number the register holds, but gdb expects to see a
1155
       value in the target byte ordering.  */
1156
    store_unsigned_integer (buf, REGISTER_RAW_SIZE (regno), val);
1157
    supply_register (regno, buf);
1158
  }
1159
  if (err)
1160 118 markom
    or1k_error ("Can't read register %d(%i): %s", regno,
1161 362 markom
                REGNUM_TO_SPRNUM(regno), or1k_err_name (err));
1162 106 markom
}
1163
 
1164
/* Fetch and return instruction from the specified location.  */
1165
 
1166
unsigned int
1167
or1k_fetch_instruction (addr)
1168
     CORE_ADDR addr;
1169
{
1170
  char buf[OR1K_INSTLEN];
1171
  int status;
1172
 
1173
  status = read_memory_nobpt (addr, buf, OR1K_INSTLEN);
1174
  if (status)
1175
    memory_error (status, addr);
1176
  return extract_unsigned_integer (buf, OR1K_INSTLEN);
1177
}
1178
 
1179 113 markom
/* Currently not needed.  */
1180
 
1181 106 markom
static void
1182
or1k_prepare_to_store ()
1183
{
1184
}
1185
 
1186
/* Store remote register(s).  */
1187
 
1188
static void
1189
or1k_store_registers (regno)
1190
     int regno;
1191
{
1192
  if (regno == -1)
1193
    {
1194
      for (regno = 0; regno < NUM_REGS; regno++)
1195
        or1k_store_registers (regno);
1196
      return;
1197
    }
1198
 
1199
  if (regno >= NUM_REGS)
1200
    error("Invalid register number!");
1201
 
1202 362 markom
  or1k_write_spr_reg (REGNUM_TO_SPRNUM(regno), read_register (regno));
1203 106 markom
  if (err)
1204 113 markom
    or1k_error ("Can't write register %d(%i): %s", regno, REGNUM_TO_SPRNUM(regno), or1k_err_name (err));
1205 106 markom
}
1206
 
1207
/* Read or write LEN bytes from inferior memory at MEMADDR,
1208
   transferring to or from debugger address MYADDR.  Write to inferior
1209
   if SHOULD_WRITE is nonzero.  Returns length of data written or
1210
   read; 0 for error.  Note that protocol gives us the correct value
1211
   for a longword, since it transfers values in ASCII.  We want the
1212
   byte values, so we have to swap the longword values.  */
1213
 
1214
static int
1215
or1k_xfer_memory (memaddr, myaddr, len, write, ignore)
1216
     CORE_ADDR memaddr;
1217
     char *myaddr;
1218
     int len;
1219
     int write;
1220
     struct target_ops *ignore;
1221
{
1222
  register int i;
1223
  /* Round starting address down to longword boundary.  */
1224
  register CORE_ADDR addr = memaddr & ~3;
1225
  /* Round ending address up; get number of longwords that makes.  */
1226
  register int count = (((memaddr + len) - addr) + 3) / 4;
1227
  /* Allocate buffer of that many longwords.  */
1228
  register char *buffer = alloca (count * 4);
1229
  int status;
1230
 
1231 143 chris
  int block_xfer_size = 256; /* CZ 21/06/01 ... number of 32 bit words */
1232
  int nBlocks = (count + block_xfer_size -1)/block_xfer_size;
1233
  int terminate = 0;  /* Terminate the printing of '*'s... */
1234
 
1235 362 markom
#ifdef DEBUG_JTAG
1236
  debug ("xfer_memory %s addr=%x, len=%i, \n", write?"write":"read", memaddr, len);
1237
  fflush(stdout);
1238
#endif
1239
 
1240
#if 0
1241 106 markom
  if (memaddr >= MEM_SPACE)
1242
    error("Invalid address");
1243 362 markom
#endif
1244 106 markom
 
1245 135 chris
  /* (CZ 21/06/01 -- because upper layers which know nothing about
1246
     Or1k or JTAG call this function directly, it is always necessary
1247
     to set the chain to point to the Debug Unit. Otherwise, it may
1248 143 chris
     be pointing to the Development Interface chain, in which case
1249 135 chris
     we're going to get bupkiss... */
1250
 
1251 106 markom
  if (write)
1252
    {
1253
      /* Fill start and end extra bytes of buffer with existing data.  */
1254
      if (addr != memaddr || len < 4)
1255
        {
1256
          /* Need part of initial word -- fetch it.  */
1257
          store_unsigned_integer (&buffer[0], 4, or1k_fetch_word (addr));
1258
        }
1259
 
1260
      if (count > 1)
1261
        {
1262
          /* Need part of last word -- fetch it.  FIXME: we do this even
1263
             if we don't need it.  */
1264
          store_unsigned_integer (&buffer[(count - 1) * 4], 4,
1265
                                  or1k_fetch_word (addr + (count - 1) * 4));
1266
        }
1267
 
1268
      /* Copy data to be written over corresponding part of buffer */
1269
      memcpy ((char *) buffer + (memaddr & 3), myaddr, len);
1270
 
1271 143 chris
      /* CZ: rewrote the block transfer routines to make the code
1272
         a little more efficient for implementations that can handle
1273
         variable sized scan chains. Might be useful in the future.
1274
         Certainly makes downloads to the simulator more efficient. */
1275
      for(i=0;i<nBlocks;i++,count-=block_xfer_size,addr += block_xfer_size*4)
1276 106 markom
        {
1277 143 chris
          int j;
1278
          int n = count < block_xfer_size ? count : block_xfer_size;
1279
          unsigned long *__buf;
1280
 
1281
          if(!(__buf = (unsigned long*)malloc(n*sizeof(unsigned long))))
1282 106 markom
            {
1283 143 chris
              errno = ERR_MEM;
1284
              return 0;
1285
            }
1286
 
1287
          for(j=0;j<n;j++)
1288
            __buf[j] = (unsigned long)extract_unsigned_integer(&buffer[(i * block_xfer_size +j)*4], 4);
1289 362 markom
          or1k_set_chain (SC_WISHBONE);
1290 143 chris
          status = or1k_store_block(addr,__buf,n);
1291
          free(__buf);
1292
          if(n == block_xfer_size)
1293
            {
1294 362 markom
              debug ("*");
1295 106 markom
              gdb_flush (gdb_stdout);
1296
            }
1297
          if (status)
1298
            {
1299
              errno = status;
1300
              return 0;
1301
            }
1302
          /* FIXME: Do we want a QUIT here?  */
1303
        }
1304 143 chris
      if (terminate)
1305 362 markom
        debug ("\n");
1306 106 markom
    }
1307
  else
1308
    {
1309 143 chris
      for(i=0;i<nBlocks;i++,count-=block_xfer_size,addr += block_xfer_size*4)
1310 106 markom
        {
1311 143 chris
          int j;
1312
          int n = count < block_xfer_size ? count : block_xfer_size;
1313
          unsigned long *__buf;
1314
 
1315 362 markom
    or1k_set_chain (SC_WISHBONE);
1316 143 chris
          __buf = (unsigned long*)malloc(n*sizeof(unsigned long));
1317
          status = or1k_load_block(addr,__buf,n);
1318
          if (!status)
1319
            for(j=0;j<n;j++)
1320
              store_unsigned_integer (&buffer[(i * block_xfer_size +j)*4], 4, __buf[j]);
1321
          else
1322
            errno = status;
1323
          free(__buf);
1324
 
1325
          if(status)
1326
            return 0;
1327 106 markom
        }
1328
      /* Copy appropriate bytes out of the buffer.  */
1329
      memcpy (myaddr, buffer + (memaddr & 3), len);
1330
    }
1331
  return len;
1332
}
1333
 
1334 143 chris
int or1k_load_block(CORE_ADDR addr,void* buffer,int nRegisters)
1335
{
1336
  int i=0;
1337 362 markom
  unsigned int regno = addr;
1338 143 chris
 
1339
  if (current_or1k_target != NULL && current_or1k_target->to_read_block != NULL)
1340
    return current_or1k_target->to_read_block (regno,buffer,nRegisters);
1341
  else
1342
    for(i=0;i<nRegisters;i++)
1343
      ((unsigned long*)buffer)[i] = 0x1234;
1344
  return 0;
1345
}
1346
 
1347
int or1k_store_block(CORE_ADDR addr,void* buffer,int nRegisters)
1348
{
1349 362 markom
  unsigned int regno = addr;
1350
 
1351 143 chris
  if (current_or1k_target != NULL && current_or1k_target->to_write_block != NULL)
1352
    return current_or1k_target->to_write_block (regno,buffer,nRegisters);
1353
  return 0;
1354
}
1355
 
1356 106 markom
/* Print info on this target.  */
1357
 
1358
static void
1359
or1k_files_info (ignore)
1360
     struct target_ops *ignore;
1361
{
1362
  char *file = "nothing";
1363
 
1364
  if (exec_bfd)
1365
    file = bfd_get_filename (exec_bfd);
1366
 
1367
  printf_filtered ("or1k_files_info: file \"%s\"\n", file);
1368
 
1369
  if (exec_bfd)
1370
    {
1371
      printf_filtered ("\tAttached to %s running program %s\n",
1372
                       target_shortname, file);
1373
    }
1374
  /* Print target info. */
1375
  printf_filtered ("Status: %s\n", status_name[or1k_status]);
1376
}
1377
 
1378
/* Tell whether we can support a hardware breakpoint.  */
1379 118 markom
 
1380 106 markom
static int
1381
or1k_can_use_hardware_breakpoint ()
1382
{
1383
  int i;
1384 118 markom
 
1385 106 markom
  /* Search for unused breakpoint.  */
1386 113 markom
  return or1k_implementation.num_used_matchpoints < or1k_implementation.num_matchpoints;
1387 106 markom
}
1388
 
1389
/* Insert a breakpoint.  On targets that don't have built-in breakpoint
1390
   support, we read the contents of the target location and stash it,
1391
   then overwrite it with a breakpoint instruction.  ADDR is the target
1392
   location in the target machine.  CONTENTS_CACHE is a pointer to
1393
   memory allocated for saving the target contents.  It is guaranteed
1394
   by the caller to be long enough to save sizeof BREAKPOINT bytes (this
1395
   is accomplished via BREAKPOINT_MAX).  */
1396
 
1397 113 markom
int
1398 106 markom
or1k_insert_breakpoint (addr, contents_cache)
1399
     CORE_ADDR addr;
1400
     char *contents_cache;
1401
{
1402
  if (or1k_can_use_hardware_breakpoint())
1403
    return set_breakpoint (addr);
1404
  else
1405
    return memory_insert_breakpoint (addr, contents_cache);
1406
}
1407
 
1408 113 markom
int
1409 106 markom
or1k_remove_breakpoint (addr, contents_cache)
1410
     CORE_ADDR addr;
1411
     char *contents_cache;
1412
{
1413
  /* First try to remove HW breakpoint at address */
1414
  if (clear_breakpoint (addr))
1415
    return memory_remove_breakpoint (addr, contents_cache);
1416
  else
1417
    return 0;
1418
}
1419
 
1420 113 markom
/* Tell whether this target can support a hardware breakpoint.  CNT
1421
   is the number of hardware breakpoints already installed.  This
1422
   implements the TARGET_CAN_USE_HARDWARE_WATCHPOINT macro.
1423
   Lower bound is estimated. !!! Can we estimate better? */
1424
 
1425
int
1426
or1k_can_use_hardware_watchpoint (bp_type, cnt)
1427
     enum bptype bp_type;
1428
     int cnt;
1429
{
1430
  /* Are there at least two matchpoints left for watch? - estimate lower bound  */
1431
  return cnt + ((bp_type == bp_hardware_watchpoint)?(1):(0))
1432
    <= or1k_implementation.num_matchpoints;
1433
}
1434
 
1435 118 markom
/* Moves matchpoint.  This is very tricky - we have to update
1436
   all references to matchpoint indexes.  We assume here that
1437
   matchpoint with index to is unused! */
1438
 
1439
static void
1440
move_matchpoint (int from, int to)
1441
{
1442
  int i, j, tmp, chaining;
1443
  if (matchpoint_user_count[to] != 0)
1444
    error ("Internal: Destination matchpoint still has users");
1445
  matchpoint_user_count[to] = matchpoint_user_count[from];
1446
  matchpoint_user_count[from] = 0;
1447
  debug_regs_changed = 1;
1448
 
1449
  dvr[to] = dvr[from];
1450
  dcr[to] = dcr[from];
1451
  dcr[from].dp = 0;
1452
 
1453
  /* Copy chaining bits.  */
1454
  chaining = dmr1 & (3 << (2 * from));
1455
  dmr1 &= ~(3 << (2 * to));
1456
  dmr1 |= chaining << (2 * to);
1457
  dmr1 &= ~(3 << (2 * from));
1458
 
1459
  /* Copy watchpoint bits */
1460
  tmp = dmr2 & (1 << from);
1461
  dmr2 &= 1 << to;
1462
  dmr2 |= tmp << to;
1463
  dmr2 &= 1 << from;
1464
 
1465
  /* Update hwatch table.  Here we assume that matchpoint
1466
     group is connected (it cannot be implemented in HW
1467
     otherwise), so if we move first, we will have to move
1468
     others later.  */
1469
  for (i = 0; i < num_hw_watches; i++)
1470
    if (or1k_hwatch[i].matchpoint_start == from)
1471
      or1k_hwatch[i].matchpoint_start = to;
1472
 
1473
  /* Update htrace struct.  */
1474
  tmp = or1k_htrace.trig.wp_trig & (1 << from);
1475
  or1k_htrace.trig.wp_trig &= 1 << to;
1476
  or1k_htrace.trig.wp_trig |= tmp << to;
1477
  or1k_htrace.trig.wp_trig &= 1 << from;
1478
 
1479
  tmp = or1k_htrace.qual.wp_trig & (1 << from);
1480
  or1k_htrace.qual.wp_trig &= 1 << to;
1481
  or1k_htrace.qual.wp_trig |= tmp << to;
1482
  or1k_htrace.qual.wp_trig &= 1 << from;
1483
 
1484
  tmp = or1k_htrace.stop.wp_trig & (1 << from);
1485
  or1k_htrace.stop.wp_trig &= 1 << to;
1486
  or1k_htrace.stop.wp_trig |= tmp << to;
1487
  or1k_htrace.stop.wp_trig &= 1 << from;
1488
 
1489
  for (i = 0; i < MAX_MATCHPOINTS; i++)
1490
    {
1491
      tmp = or1k_htrace.wp_record_uses[i] & (1 << from);
1492
      or1k_htrace.wp_record_uses[i] &= 1 << to;
1493
      or1k_htrace.wp_record_uses[i] |= tmp << to;
1494
      or1k_htrace.wp_record_uses[i] &= 1 << from;
1495
    }
1496
 
1497
  /* Do we need to move other references also? */
1498
}
1499
 
1500 113 markom
/* Sifts unused matchpoints to higher indexses.  */
1501
 
1502 118 markom
void
1503 113 markom
sift_matchpoints ()
1504
{
1505
  int i, first_free = 0;
1506
  for (i = 0; i < or1k_implementation.num_matchpoints; i++)
1507
    if (dcr[i].dp)
1508
      {
1509 118 markom
        /* Move references.  */
1510
        move_matchpoint (i, first_free);
1511
 
1512 113 markom
        first_free++;
1513
      }
1514 118 markom
 
1515
  /* Unused matchpoints should be disabled by move_matchpoint,
1516
     so we are done here.  */
1517 113 markom
}
1518
 
1519
/* Translates gdb watchpoint type into one in DCR register.  */
1520
 
1521
static int
1522
translate_type (gdb_type)
1523
     int gdb_type;
1524
{
1525
  switch (gdb_type)
1526
    {
1527
    case 0:
1528
      return CT_SDATA;
1529
    case 1:
1530
      return CT_LDATA;
1531
    case 2:
1532
      return CT_ADATA;
1533
    default:
1534
      error ("Invalid type.");
1535
    }
1536
}
1537
 
1538
/* Set a data watchpoint.  ADDR and LEN should be obvious.  TYPE is 0
1539
   for a write watchpoint, 1 for a read watchpoint, or 2 for a read/write
1540
   watchpoint. */
1541
 
1542
int
1543
or1k_insert_watchpoint (addr, len, type)
1544
     CORE_ADDR addr;
1545
     int len;
1546
     int type;
1547
{
1548
  int i;
1549 118 markom
 
1550 113 markom
  if (len < 1)
1551
    return -1;
1552
 
1553
  type = translate_type (type);
1554
 
1555
  /* Moves unused watchpoints to the top.  */
1556
  sift_matchpoints ();
1557 118 markom
 
1558 113 markom
  /* Place at first free matchpoint.  */
1559
  i = or1k_implementation.num_used_matchpoints;
1560
  dvr[i] = addr;
1561
  dcr[i].dp = 1;
1562
  dcr[i].cc = CC_GREATE;
1563
  dcr[i].sc = 0;
1564
  dcr[i].ct = type;
1565 118 markom
 
1566 113 markom
  /* Set && chaining here.  */
1567
  dmr1 &= ~(3 << (2 * i));
1568 118 markom
  dmr1 |= CHAINING_AND << (2 * i);
1569
 
1570 113 markom
  /* Set upper watchpoint bound.  */
1571
  i++;
1572
  dvr[i] = addr + len - 1;
1573
  dcr[i].dp = 1;
1574
  dcr[i].cc = CC_LESSE;
1575
  dcr[i].sc = 0;
1576
  dcr[i].ct = type;
1577 118 markom
 
1578 113 markom
  /* Matchpoints will cause breakpoints */
1579 118 markom
  dmr2 |= (1 << i);
1580 113 markom
  or1k_implementation.num_used_matchpoints += 2;
1581 118 markom
  debug_regs_changed = 1;
1582 113 markom
  return 0;
1583
}
1584
 
1585
/* Removes a data watchpoint.  ADDR and LEN should be obvious.  TYPE is 0
1586
   for a write watchpoint, 1 for a read watchpoint, or 2 for a read/write
1587
   watchpoint. */
1588 118 markom
 
1589 113 markom
int
1590
or1k_remove_watchpoint (addr, len, type)
1591
     CORE_ADDR addr;
1592
     int len;
1593
     int type;
1594
{
1595
  int i, found = -1;
1596 118 markom
 
1597 113 markom
  if (len < 1)
1598
    return -1;
1599
 
1600
  type = translate_type (type);
1601
 
1602
  /* Find the right one.  */
1603
  for (i = 0; i < or1k_implementation.num_used_matchpoints; i++)
1604
    if (dvr[i] == addr && dcr[i].dp && dcr[i].cc == CC_GREATE && !dcr[i].sc && dcr[i].ct == type
1605
        && dvr[i + 1] == addr + len - 1 && dcr[i + 1].dp && dcr[i + 1].cc == CC_LESSE
1606
        && !dcr[i + 1].sc && dcr[i + 1].ct == type)
1607
      {
1608
        found = i;
1609
        break;
1610
      }
1611
 
1612
  if (found < 0)
1613
    return -1;
1614
 
1615
  dcr[found].dp = 0;
1616
  dcr[found + 1].dp = 0;
1617
 
1618
  /* Matchpoints will not cause breakpoints anymore. */
1619 118 markom
  dmr2 &= ~(1 << i);
1620 113 markom
  or1k_implementation.num_used_matchpoints -= 2;
1621 118 markom
  debug_regs_changed = 1;
1622 113 markom
  return 0;
1623
}
1624
 
1625
int
1626
or1k_stopped_by_watchpoint (void)
1627
{
1628 143 chris
  /* For now, no watchpoints */
1629
  return 0;
1630
 
1631
  /* return hit_watchpoint; */
1632 113 markom
}
1633
 
1634 106 markom
/* Insert a breakpoint.  */
1635
 
1636
int
1637
set_breakpoint (addr)
1638
     CORE_ADDR addr;
1639
{
1640
  int i;
1641 118 markom
 
1642 106 markom
  /* Search for unused breakpoint.  */
1643
  for (i = 0; i < NUM_MATCHPOINTS; i++)
1644
    if (dcr[i].dp == 0) break;
1645
  if (i >= NUM_MATCHPOINTS) return 1;
1646
  dvr[i] = addr;
1647
  dcr[i].dp = 1;
1648
  dcr[i].cc = CC_EQUAL;
1649
  dcr[i].sc = 0;
1650
  dcr[i].ct = CT_FETCH;
1651 113 markom
  or1k_implementation.num_used_matchpoints++;
1652
 
1653
  /* No chaining here.  */
1654
  dmr1 &= ~(3 << (2*i));
1655 118 markom
 
1656 113 markom
  /* Matchpoints will cause breakpoints */
1657 118 markom
  dmr2 |= (1 << i);
1658
  debug_regs_changed = 1;
1659 106 markom
  return 0;
1660
}
1661
 
1662
/* Clear a breakpoint.  */
1663
 
1664
int
1665
clear_breakpoint (addr)
1666
     CORE_ADDR addr;
1667
{
1668
  int i;
1669 118 markom
 
1670 106 markom
  /* Search for matching breakpoint.  */
1671
  for (i = 0; i < NUM_MATCHPOINTS; i++)
1672
    if ((dcr[i].dp == 1) && (dvr[i] == addr) && (dcr[i].cc == CC_EQUAL)
1673
        && (dcr[i].sc == 0) && (dcr[i].ct == CT_FETCH)) break;
1674
 
1675
  if (i >= NUM_MATCHPOINTS) return 1;
1676
  dcr[i].dp = 0;
1677 118 markom
 
1678 113 markom
  /* Matchpoints will cause breakpoints */
1679 118 markom
  dmr2 &= ~(1 << i);
1680 113 markom
  or1k_implementation.num_used_matchpoints--;
1681 118 markom
  debug_regs_changed = 1;
1682 106 markom
  return 0;
1683
}
1684
 
1685
/* Start running on the target board.  */
1686
 
1687
static void
1688
or1k_create_inferior (execfile, args, env)
1689
     char *execfile;
1690
     char *args;
1691
     char **env;
1692
{
1693
  CORE_ADDR entry_pt;
1694
 
1695
  if (args && *args)
1696
    {
1697 118 markom
      warning ("Can't pass arguments to remote OR1K board; arguments ignored.");
1698
 
1699 106 markom
      /* And don't try to use them on the next "run" command.  */
1700
      execute_command ("set args", 0);
1701
    }
1702
 
1703
  if (execfile == 0 || exec_bfd == 0)
1704
    error ("No executable file specified");
1705
 
1706
  or1k_kill ();
1707
  remove_breakpoints ();
1708
 
1709
  entry_pt = (CORE_ADDR) bfd_get_start_address (exec_bfd);
1710
  init_wait_for_inferior ();
1711
 
1712
  /* FIXME: Should we set inferior_pid here?  */
1713 113 markom
 
1714 118 markom
  /* Needed to get correct instruction in cache */
1715
  insert_breakpoints ();
1716 106 markom
  clear_proceed_status ();
1717
  or1k_status = TARGET_STOPPED;
1718
  proceed (entry_pt, TARGET_SIGNAL_DEFAULT, 0);
1719
}
1720
 
1721
/* Clean up after a process.  Actually nothing to do.  */
1722
 
1723
static void
1724
or1k_mourn_inferior ()
1725
{
1726
  generic_mourn_inferior ();
1727
}
1728
 
1729
static void
1730
or1k_dummy_open (name, from_tty)
1731
     char *name;
1732
     int from_tty;
1733
{
1734
  target_preopen (from_tty);
1735
  if (or1k_is_open)
1736
    unpush_target (current_ops);
1737
  current_or1k_target = &or1k_target_dummy;
1738
  or1k_open (name, from_tty);
1739
}
1740
 
1741
static void
1742
or1k_jtag_open (name, from_tty)
1743
     char *name;
1744
     int from_tty;
1745
{
1746
  target_preopen (from_tty);
1747
  if (or1k_is_open)
1748
    unpush_target (current_ops);
1749
  current_or1k_target = &or1k_target_jtag;
1750
  or1k_open (name, from_tty);
1751
}
1752
 
1753
static void
1754
or1k_sim_open (name, from_tty)
1755
     char *name;
1756
     int from_tty;
1757
{
1758
  /* target_preopen (from_tty); - do we need this ? */
1759
  if (or1k_is_open)
1760
    unpush_target (current_ops);
1761
  current_or1k_target = &or1k_target_sim;
1762
  or1k_open (name, from_tty);
1763
}
1764
 
1765
/* Executes command on the target.  */
1766
 
1767
void
1768
or1k_sim_cmd (char *args, int from_tty)
1769
{
1770
  if (current_or1k_target != NULL && current_or1k_target->to_exec_command != NULL)
1771
    current_or1k_target->to_exec_command (args, from_tty);
1772
  else
1773
    error ("Command not supported on this target. ");
1774
}
1775
 
1776 113 markom
/* Displays matchpoints usage.  */
1777
 
1778 106 markom
void
1779 113 markom
info_matchpoints_command (char *args, int from_tty)
1780
{
1781
  int i;
1782
  for (i = 0; i < or1k_implementation.num_matchpoints; i++)
1783
    {
1784
      printf_filtered ("WP%i ", i);
1785
      if (dcr[i].dp)
1786
        {
1787
          int chaining = (dmr1 << 2*i) & 3;
1788
          printf_filtered ("= %s ", ct_names[dcr[i].ct]);
1789
          if (dcr[i]. sc)
1790
            printf_filtered ("s%s %i", cc_names[dcr[i].cc], (int)dvr[i]);
1791
          else
1792
            printf_filtered ("%s %u", cc_names[dcr[i].cc], (unsigned int)dvr[i]);
1793
          if (chaining)
1794
            printf_filtered ("%s WP%i", ch_names[chaining], i - 1);
1795
        }
1796
      else
1797
        printf_filtered ("NOT USED");
1798
      if ((dmr2 >> i) & 1)
1799
        printf_filtered (", causes breakpoint");
1800
      if ((dmr2 >> (i + 11)) & 1)
1801
        printf_filtered (", increments counter");
1802
      printf_filtered ("\n");
1803
    }
1804
}
1805 372 markom
static int
1806
insn_has_delay_slot (insn)
1807
     unsigned int insn;
1808
{
1809
  if (((insn >> 26) <= 4) || ((insn >> 26) == 17) || ((insn >> 26) == 18))
1810
    return 1;
1811
  else
1812
    return 0;
1813
}
1814 113 markom
 
1815
void
1816 106 markom
_initialize_remote_or1k ()
1817
{
1818
  /* Initialize the fields in or1k_ops that are common to all targets.  */
1819
  or1k_dummy_ops.to_close = or1k_close;
1820
  or1k_dummy_ops.to_detach = or1k_detach;
1821
  or1k_dummy_ops.to_resume = or1k_resume;
1822 362 markom
  or1k_dummy_ops.to_wait = or1k_wait;
1823 106 markom
  or1k_dummy_ops.to_fetch_registers = or1k_fetch_registers;
1824
  or1k_dummy_ops.to_store_registers = or1k_store_registers;
1825
  or1k_dummy_ops.to_prepare_to_store = or1k_prepare_to_store;
1826
  or1k_dummy_ops.to_xfer_memory = or1k_xfer_memory;
1827
  or1k_dummy_ops.to_files_info = or1k_files_info;
1828
  or1k_dummy_ops.to_insert_breakpoint = or1k_insert_breakpoint;
1829
  or1k_dummy_ops.to_remove_breakpoint = or1k_remove_breakpoint;
1830
  or1k_dummy_ops.to_kill = or1k_kill;
1831
  or1k_dummy_ops.to_load = generic_load;
1832
  or1k_dummy_ops.to_create_inferior = or1k_create_inferior;
1833
  or1k_dummy_ops.to_mourn_inferior = or1k_mourn_inferior;
1834
  or1k_dummy_ops.to_stratum = process_stratum;
1835 362 markom
  or1k_dummy_ops.to_stop = or1k_stop;
1836 118 markom
 
1837
  /* We can access memory while program is running.  */
1838
  or1k_dummy_ops.to_has_all_memory = 0;
1839
 
1840 106 markom
  or1k_dummy_ops.to_has_memory = 1;
1841
  or1k_dummy_ops.to_has_stack = 1;
1842
  or1k_dummy_ops.to_has_registers = 1;
1843
  or1k_dummy_ops.to_has_execution = 1;
1844
  or1k_dummy_ops.to_magic = OPS_MAGIC;
1845
 
1846
  /* Copy the common fields to all target vectors.  */
1847
  or1k_jtag_ops = or1k_sim_ops = or1k_dummy_ops;
1848 362 markom
 
1849
  /* Initialize target-specific fields in the target vectors adn add targets.  */
1850 106 markom
  or1k_jtag_ops.to_shortname = "jtag";
1851
  or1k_jtag_ops.to_longname = "Remote or1k debugging over JTAG port";
1852 125 chris
  or1k_jtag_ops.to_doc = "Debug a board using the OR1K remote debugging protocol"
1853
    " over a parallel line.\nThe argument is the parallel port it is connected "
1854
    "to, or, if it is formatted\nas a URL of the form jtag://<hostname>:<port>,"
1855
    " then the argument refers to\na remote JTAG proxy server.\n";
1856 362 markom
  or1k_jtag_ops.to_open = or1k_jtag_open;
1857 106 markom
  add_target (&or1k_jtag_ops);
1858
 
1859
  or1k_dummy_ops.to_shortname = "dummy";
1860
  or1k_dummy_ops.to_longname = "Dummy target";
1861
  or1k_dummy_ops.to_doc = "Actually no real target attached - more like /dev/null.\n";
1862
  or1k_dummy_ops.to_open = or1k_dummy_open;
1863
  add_target (&or1k_dummy_ops);
1864
 
1865
  or1k_sim_ops.to_shortname = "sim";
1866
  or1k_sim_ops.to_longname = "Remote or1k debugging using architecture simulator";
1867
  or1k_sim_ops.to_doc = "Debug using an architecture simulator.\n";
1868
  or1k_sim_ops.to_open = or1k_sim_open;
1869
  add_target (&or1k_sim_ops);
1870 113 markom
  add_info ("matchpoints", info_matchpoints_command, "Show current matchpoints allocation status.");
1871 106 markom
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.