gas: avoid spurious failures in non-ELF targets in the SPARC testsuite.
[deliverable/binutils-gdb.git] / sim / ppc / emul_generic.h
1 /* This file is part of the program psim.
2
3 Copyright (C) 1994-1996, Andrew Cagney <cagney@highland.com.au>
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 3 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, see <http://www.gnu.org/licenses/>.
17
18 */
19
20
21 #ifndef _EMUL_GENERIC_H_
22 #define _EMUL_GENERIC_H_
23
24 #include "cpu.h"
25 #include "idecode.h"
26 #include "os_emul.h"
27
28 #include "tree.h"
29
30 #include "bfd.h"
31
32 #ifndef INLINE_EMUL_GENERIC
33 #define INLINE_EMUL_GENERIC
34 #endif
35
36 /* various PowerPC instructions for writing into memory */
37 enum {
38 emul_call_instruction = 0x1,
39 emul_loop_instruction = 0x48000000, /* branch to . */
40 emul_rfi_instruction = 0x4c000064,
41 emul_blr_instruction = 0x4e800020,
42 };
43
44
45 /* emulation specific data */
46
47 typedef struct _os_emul_data os_emul_data;
48
49 typedef os_emul_data *(os_emul_create_handler)
50 (device *tree,
51 bfd *image,
52 const char *emul_name);
53 typedef void (os_emul_init_handler)
54 (os_emul_data *emul_data,
55 int nr_cpus);
56 typedef void (os_emul_system_call_handler)
57 (cpu *processor,
58 unsigned_word cia,
59 os_emul_data *emul_data);
60 typedef int (os_emul_instruction_call_handler)
61 (cpu *processor,
62 unsigned_word cia,
63 unsigned_word ra,
64 os_emul_data *emul_data);
65
66 struct _os_emul {
67 const char *name;
68 os_emul_create_handler *create;
69 os_emul_init_handler *init;
70 os_emul_system_call_handler *system_call;
71 os_emul_instruction_call_handler *instruction_call;
72 os_emul_data *data;
73 };
74
75
76 /* One class of emulation - system call is pretty general, provide a
77 common template for implementing this */
78
79 typedef struct _emul_syscall emul_syscall;
80 typedef struct _emul_syscall_descriptor emul_syscall_descriptor;
81
82 typedef void (emul_syscall_handler)
83 (os_emul_data *emul_data,
84 unsigned call,
85 const int arg0,
86 cpu *processor,
87 unsigned_word cia);
88
89 struct _emul_syscall_descriptor {
90 emul_syscall_handler *handler;
91 const char *name;
92 };
93
94 struct _emul_syscall {
95 emul_syscall_descriptor *syscall_descriptor;
96 int nr_system_calls;
97 char **error_names;
98 int nr_error_names;
99 char **signal_names;
100 int nr_signal_names;
101 };
102
103
104 INLINE_EMUL_GENERIC void emul_do_system_call
105 (os_emul_data *emul_data,
106 emul_syscall *syscall,
107 unsigned call,
108 const int arg0,
109 cpu *processor,
110 unsigned_word cia);
111
112
113 INLINE_EMUL_GENERIC unsigned64 emul_read_gpr64
114 (cpu *processor,
115 int g);
116
117 INLINE_EMUL_GENERIC void emul_write_gpr64
118 (cpu *processor,
119 int g,
120 unsigned64 val);
121
122 INLINE_EMUL_GENERIC void emul_write_status
123 (cpu *processor,
124 int status,
125 int errno);
126
127 INLINE_EMUL_GENERIC void emul_write2_status
128 (cpu *processor,
129 int status1,
130 int status2,
131 int errno);
132
133 INLINE_EMUL_GENERIC char *emul_read_string
134 (char *dest,
135 unsigned_word addr,
136 unsigned nr_bytes,
137 cpu *processor,
138 unsigned_word cia);
139
140 INLINE_EMUL_GENERIC unsigned_word emul_read_word
141 (unsigned_word addr,
142 cpu *processor,
143 unsigned_word cia);
144
145 INLINE_EMUL_GENERIC void emul_write_word
146 (unsigned_word addr,
147 unsigned_word buf,
148 cpu *processor,
149 unsigned_word cia);
150
151 INLINE_EMUL_GENERIC void emul_read_buffer
152 (void *dest,
153 unsigned_word addr,
154 unsigned nr_bytes,
155 cpu *processor,
156 unsigned_word cia);
157
158 INLINE_EMUL_GENERIC void emul_write_buffer
159 (const void *source,
160 unsigned_word addr,
161 unsigned nr_bytes,
162 cpu *processor,
163 unsigned_word cia);
164
165 /* Simplify the construction of device trees */
166
167 INLINE_EMUL_GENERIC void emul_add_tree_options
168 (device *tree,
169 bfd *image,
170 const char *emul,
171 const char *env,
172 int oea_interrupt_prefix);
173
174 INLINE_EMUL_GENERIC void emul_add_tree_hardware
175 (device *tree);
176
177 #endif /* _EMUL_GENERIC_H_ */
This page took 0.036834 seconds and 4 git commands to generate.