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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.1/] [sim/] [common/] [sim-utils.h] - Blame information for rev 252

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

Line No. Rev Author Line
1 227 jeremybenn
/* Miscellaneous simulator utilities.
2
   Copyright (C) 1997, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
3
   Contributed by Cygnus Support.
4
 
5
This file is part of GDB, the GNU debugger.
6
 
7
This program is free software; you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation; either version 3 of the License, or
10
(at your option) any later version.
11
 
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
GNU General Public License for more details.
16
 
17
You should have received a copy of the GNU General Public License
18
along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
19
 
20
#ifndef SIM_UTILS_H
21
#define SIM_UTILS_H
22
 
23
/* Memory management with an allocator that clears memory before use. */
24
 
25
void *zalloc (unsigned long size);
26
 
27
#define ZALLOC(TYPE) (TYPE*)zalloc(sizeof (TYPE))
28
#define NZALLOC(TYPE,N) (TYPE*)zalloc(sizeof (TYPE) * (N))
29
 
30
void zfree(void*);
31
 
32
/* Turn VALUE into a string with commas.  */
33
char *sim_add_commas (char *, int, unsigned long);
34
 
35
/* Utilities for elapsed time reporting.  */
36
 
37
/* Opaque type, known only inside sim_elapsed_time_foo fns. Externally
38
   it is known to never have the value zero. */
39
typedef unsigned long SIM_ELAPSED_TIME;
40
 
41
 
42
/* Get reference point for future call to sim_time_elapsed.  */
43
SIM_ELAPSED_TIME sim_elapsed_time_get (void);
44
 
45
/* Elapsed time in milliseconds since START.  */
46
unsigned long sim_elapsed_time_since (SIM_ELAPSED_TIME start);
47
 
48
/* Utilities for manipulating the load image.  */
49
 
50
SIM_RC sim_analyze_program (SIM_DESC sd, char *prog_name,
51
                            struct bfd *prog_bfd);
52
 
53
/* Load program PROG into the simulator using the function DO_LOAD.
54
   If PROG_BFD is non-NULL, the file has already been opened.
55
   If VERBOSE_P is non-zero statistics are printed of each loaded section
56
   and the transfer rate (for consistency with gdb).
57
   If LMA_P is non-zero the program sections are loaded at the LMA
58
   rather than the VMA
59
   If this fails an error message is printed and NULL is returned.
60
   If it succeeds the bfd is returned.
61
   NOTE: For historical reasons, older hardware simulators incorrectly
62
   write the program sections at LMA interpreted as a virtual address.
63
   This is still accommodated for backward compatibility reasons. */
64
 
65
typedef int sim_write_fn PARAMS ((SIM_DESC sd, SIM_ADDR mem,
66
                                      unsigned char *buf, int length));
67
struct bfd *sim_load_file (SIM_DESC sd, const char *myname,
68
                           host_callback *callback, char *prog,
69
                           struct bfd *prog_bfd, int verbose_p,
70
                           int lma_p, sim_write_fn do_load);
71
 
72
/* Internal version of sim_do_command, include formatting */
73
void sim_do_commandf (SIM_DESC sd, const char *fmt, ...);
74
 
75
 
76
/* These are defined in callback.c as cover functions to the vprintf
77
   callbacks.  */
78
 
79
void sim_cb_printf (host_callback *, const char *, ...);
80
void sim_cb_eprintf (host_callback *, const char *, ...);
81
 
82
 
83
/* sim-basics.h defines a number of enumerations, convert each of them
84
   to a string representation */
85
const char *map_to_str (unsigned map);
86
const char *access_to_str (unsigned access);
87
const char *transfer_to_str (unsigned transfer);
88
 
89
#endif

powered by: WebSVN 2.1.0

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