1 |
147 |
jeremybenn |
/* Header for GDB Simulator wrapper for Or1ksim
|
2 |
|
|
|
3 |
|
|
Copyright 1988-2008, Free Software Foundation, Inc.
|
4 |
|
|
Copyright (C) 2010 Embecosm Limited
|
5 |
|
|
|
6 |
|
|
Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
|
7 |
|
|
|
8 |
|
|
This file is part of GDB.
|
9 |
|
|
|
10 |
|
|
This program is free software; you can redistribute it and/or modify it
|
11 |
|
|
under the terms of the GNU General Public License as published by the Free
|
12 |
|
|
Software Foundation; either version 3 of the License, or (at your option)
|
13 |
|
|
any later version.
|
14 |
|
|
|
15 |
|
|
This program is distributed in the hope that it will be useful, but WITHOUT
|
16 |
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
17 |
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
18 |
|
|
more details.
|
19 |
|
|
|
20 |
|
|
You should have received a copy of the GNU General Public License along
|
21 |
|
|
with this program. If not, see <http://www.gnu.org/licenses/>. */
|
22 |
|
|
|
23 |
|
|
/*---------------------------------------------------------------------------*/
|
24 |
|
|
/* This is a wrapper for Or1ksim, suitable for use as a GDB simulator.
|
25 |
|
|
|
26 |
|
|
The code tries to follow the GDB coding style.
|
27 |
|
|
|
28 |
|
|
Commenting is Doxygen compatible. */
|
29 |
|
|
/*---------------------------------------------------------------------------*/
|
30 |
|
|
|
31 |
|
|
/*! GDB signal indiating breakpoint hit */
|
32 |
|
|
#define TARGET_SIGNAL_TRAP 5
|
33 |
|
|
|
34 |
|
|
/*! Number of registers */
|
35 |
|
|
#define OR32_MAX_GPRS 32
|
36 |
|
|
|
37 |
|
|
/* Particular registers */
|
38 |
|
|
#define OR32_FIRST_ARG_REGNUM 3 /*!< First arg reg */
|
39 |
|
|
#define OR32_PPC_REGNUM (OR32_MAX_GPRS + 0) /*!< Previous PC */
|
40 |
|
|
#define OR32_NPC_REGNUM (OR32_MAX_GPRS + 1) /*!< Next PC */
|
41 |
|
|
#define OR32_SR_REGNUM (OR32_MAX_GPRS + 2) /*!< Supervision Reg */
|
42 |
|
|
|
43 |
|
|
|
44 |
|
|
/* ------------------------------------------------------------------------- */
|
45 |
|
|
/*!A structure to hold the state of a simulation instance.
|
46 |
|
|
|
47 |
|
|
This is the typedef SIM_DESC.
|
48 |
|
|
|
49 |
|
|
The entries are
|
50 |
|
|
- the socket descriptor for reading/writing from/to the model process
|
51 |
|
|
- a flag which is true if we are used for debug rather than standalone
|
52 |
|
|
- the callback function supplied to the sim_open () function
|
53 |
|
|
- this simulator's name (argv[0] supplied to sim_open ()
|
54 |
|
|
- the PID of the child process running the model (0 if we are the child) */
|
55 |
|
|
/* ------------------------------------------------------------------------- */
|
56 |
|
|
struct sim_state
|
57 |
|
|
{
|
58 |
|
|
int sockd;
|
59 |
|
|
int is_debug;
|
60 |
|
|
struct host_callback_struct *callback;
|
61 |
|
|
char *myname;
|
62 |
|
|
int pid;
|
63 |
|
|
};
|
64 |
|
|
|
65 |
|
|
|