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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gdb-7.2/] [sim/] [ppc/] [emul_generic.h] - Blame information for rev 865

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

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

powered by: WebSVN 2.1.0

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