]>
Commit | Line | Data |
---|---|---|
83d96c6e MM |
1 | /* This file is part of the program psim. |
2 | ||
3 | Copyright (C) 1994-1995, Andrew Cagney <[email protected]> | |
4 | ||
5 | This program is free software; you can redistribute it and/or modify | |
6 | it under the terms of the GNU General Public License as published by | |
7 | the Free Software Foundation; either version 2 of the License, or | |
8 | (at your option) any later version. | |
9 | ||
10 | This program is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | GNU General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU General Public License | |
16 | along with this program; if not, write to the Free Software | |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
18 | ||
19 | */ | |
20 | ||
21 | ||
22 | #ifndef _PSIM_H_ | |
23 | #define _PSIM_H_ | |
24 | ||
25 | #ifndef INLINE_PSIM | |
26 | #define INLINE_PSIM | |
27 | #endif | |
28 | ||
29 | ||
30 | #include "basics.h" | |
31 | ||
32 | /* the system object */ | |
33 | ||
34 | typedef struct _psim psim; | |
35 | ||
36 | ||
37 | /* when the `system' stops, find out why. FIXME - at this point this | |
38 | is really a bit puzzling. After all, how can there be a status | |
39 | when there several processors involved */ | |
40 | ||
41 | typedef struct _psim_status { | |
42 | int cpu_nr; | |
43 | stop_reason reason; | |
44 | int signal; | |
45 | unsigned_word program_counter; | |
46 | } psim_status; | |
47 | ||
48 | ||
49 | /* create a new simulator */ | |
50 | ||
51 | extern psim *psim_create | |
52 | (const char *file_name, | |
53 | int nr_processors); | |
54 | ||
55 | ||
56 | /* Given the created simulator load either its low or high memory */ | |
57 | ||
58 | extern void psim_load | |
59 | (psim *system); | |
60 | ||
61 | extern void psim_stack | |
62 | (psim *system, | |
63 | char **argv, | |
64 | char **envp); | |
65 | ||
66 | ||
67 | /* Run/stop the system */ | |
68 | ||
69 | extern void psim_step | |
70 | (psim *system); | |
71 | ||
72 | extern void psim_run | |
73 | (psim *system); | |
74 | ||
75 | extern void psim_run_until_stop | |
76 | (psim *system, | |
77 | volatile int *stop); | |
78 | ||
79 | extern void psim_restart | |
80 | (psim *system, | |
81 | int cpu_nr); | |
82 | ||
83 | extern void psim_halt | |
84 | (psim *system, | |
85 | int cpu_nr, | |
86 | unsigned_word cia, | |
87 | stop_reason reason, | |
88 | int signal); | |
89 | ||
90 | extern psim_status psim_get_status | |
91 | (psim *system); | |
92 | ||
93 | ||
94 | /* reveal the internals of the simulation, giving access to the cpu's */ | |
95 | ||
96 | extern cpu *psim_cpu | |
97 | (psim *system, | |
98 | int cpu_nr); | |
99 | ||
100 | ||
101 | /* manipulate the state (registers or memory) of a processor within | |
102 | the system. In the case of memory, the read/write is performed | |
103 | using the specified processors address translation tables */ | |
104 | ||
105 | extern void psim_read_register | |
106 | (psim *system, | |
107 | int which_processor, | |
108 | void *host_ordered_buf, | |
109 | const char reg[], | |
110 | transfer_mode mode); | |
111 | ||
112 | extern void psim_write_register | |
113 | (psim *system, | |
114 | int which_processor, | |
115 | const void *host_ordered_buf, | |
116 | const char reg[], | |
117 | transfer_mode mode); | |
118 | ||
119 | extern unsigned psim_read_memory | |
120 | (psim *system, | |
121 | int which_processor, | |
122 | void *buf, | |
123 | unsigned_word vaddr, | |
124 | unsigned len, | |
125 | transfer_mode mode); | |
126 | ||
127 | extern unsigned psim_write_memory | |
128 | (psim *system, | |
129 | int which_processor, | |
130 | const void *buf, | |
131 | unsigned_word vaddr, | |
132 | unsigned len, | |
133 | transfer_mode mode, | |
134 | int violate_read_only_section); | |
135 | ||
136 | extern void psim_print_info | |
137 | (psim *system, | |
138 | int verbose); | |
139 | ||
140 | #endif /* _PSIM_H_ */ |