Commit | Line | Data |
---|---|---|
e77fd269 DE |
1 | /* Simulator pseudo baseclass. |
2 | Copyright (C) 1997 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 2, or (at your option) | |
10 | 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 along | |
18 | with this program; if not, write to the Free Software Foundation, Inc., | |
19 | 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | |
20 | ||
21 | /* This file is meant to be included by sim-basics.h. */ | |
22 | ||
23 | #ifndef SIM_BASE_H | |
24 | #define SIM_BASE_H | |
25 | ||
26 | /* Global pointer to current state while sim_resume is running. | |
27 | On a machine with lots of registers, it might be possible to reserve | |
28 | one of them for current_state. However on a machine with few registers | |
29 | current_state can't permanently live in one and indirecting through it | |
30 | will be slower [in which case one can have sim_resume set globals from | |
31 | current_state for faster access]. | |
32 | If CURRENT_STATE_REG is defined, it means current_state is living in | |
33 | a global register. */ | |
34 | ||
35 | #ifdef CURRENT_STATE_REG | |
36 | /* FIXME: wip */ | |
37 | #else | |
38 | extern struct sim_state *current_state; | |
39 | #endif | |
40 | ||
41 | /* Simulator state pseudo base-class. | |
42 | Each simulator is required to have a sim-main.h file that includes | |
43 | sim-basics.h and defines struct sim_state to be: | |
44 | ||
45 | struct sim_state { | |
46 | struct sim_state_base base; | |
47 | ... simulator specific members ... | |
48 | }; | |
49 | */ | |
50 | ||
51 | struct sim_state_base { | |
52 | /* Marker for those wanting to do sanity checks. */ | |
53 | int magic; | |
54 | #define SIM_MAGIC_NUMBER 0x4242 | |
55 | #define STATE_MAGIC(sd) ((sd)->base.magic) | |
56 | ||
57 | /* Simulator's argv[0]. */ | |
58 | const char *my_name; | |
59 | #define STATE_MY_NAME(sd) ((sd)->base.my_name) | |
60 | ||
61 | /* Who opened the simulator. */ | |
62 | SIM_OPEN_KIND open_kind; | |
63 | #define STATE_OPEN_KIND(sd) ((sd)->base.open_kind) | |
64 | ||
65 | /* The host callbacks. */ | |
66 | struct host_callback_struct *callback; | |
67 | #define STATE_CALLBACK(sd) ((sd)->base.callback) | |
68 | ||
69 | #if 0 /* FIXME: Not ready yet. */ | |
70 | /* Stuff defined in sim-config.h. */ | |
71 | struct sim_config config; | |
72 | #define STATE_CONFIG(sd) ((sd)->base.config) | |
73 | #endif | |
74 | }; | |
75 | ||
76 | /* Functions for allocating/freeing a sim_state. */ | |
77 | SIM_DESC sim_state_alloc PARAMS ((void)); | |
78 | void sim_state_free PARAMS ((SIM_DESC)); | |
79 | ||
80 | #endif /* SIM_BASE_H */ |