]>
Commit | Line | Data |
---|---|---|
cb7a6892 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 _VM_H_ | |
23 | #define _VM_H_ | |
24 | ||
25 | #ifndef INLINE_VM | |
26 | #define INLINE_VM | |
27 | #endif | |
28 | ||
29 | typedef struct _vm vm; | |
30 | typedef struct _vm_data_map vm_data_map; | |
31 | typedef struct _vm_instruction_map vm_instruction_map; | |
32 | ||
33 | ||
34 | /* each PowerPC requires two virtual memory maps */ | |
35 | ||
36 | INLINE_VM vm *vm_create | |
37 | (core *memory); | |
38 | ||
39 | INLINE_VM vm_data_map *vm_create_data_map | |
40 | (vm *memory); | |
41 | ||
42 | INLINE_VM vm_instruction_map *vm_create_instruction_map | |
43 | (vm *memory); | |
44 | ||
45 | ||
46 | /* address translation, if the translation is invalid | |
47 | these will not return */ | |
48 | ||
49 | INLINE_VM unsigned_word vm_real_data_addr | |
50 | (vm_data_map *data_map, | |
51 | unsigned_word ea, | |
52 | int is_read, | |
53 | cpu *processor, | |
54 | unsigned_word cia); | |
55 | ||
56 | INLINE_VM unsigned_word vm_real_instruction_addr | |
57 | (vm_instruction_map *instruction_map, | |
58 | cpu *processor, | |
59 | unsigned_word cia); | |
60 | ||
61 | ||
62 | /* block transfers */ | |
63 | ||
64 | INLINE_VM int vm_data_map_read_buffer | |
65 | (vm_data_map *data_map, | |
66 | void *target, | |
67 | unsigned_word addr, | |
68 | unsigned len, | |
69 | transfer_mode mode); | |
70 | ||
71 | INLINE_VM int vm_data_map_write_buffer | |
72 | (vm_data_map *data_map, | |
73 | const void *source, | |
74 | unsigned_word addr, | |
75 | unsigned len, | |
76 | transfer_mode mode, | |
77 | int violate_read_only_section); | |
78 | ||
79 | ||
80 | /* fetch the next instruction from memory */ | |
81 | ||
82 | INLINE_VM instruction_word vm_instruction_map_read | |
83 | (vm_instruction_map *instruction_map, | |
84 | cpu *processor, | |
85 | unsigned_word cia); | |
86 | ||
87 | ||
88 | /* read data from memory */ | |
89 | ||
90 | #define DECLARE_VM_DATA_MAP_READ_N(N) \ | |
91 | INLINE_VM unsigned_##N vm_data_map_read_##N \ | |
92 | (vm_data_map *map, \ | |
93 | unsigned_word ea, \ | |
94 | cpu *processor, \ | |
95 | unsigned_word cia); | |
96 | ||
97 | DECLARE_VM_DATA_MAP_READ_N(1) | |
98 | DECLARE_VM_DATA_MAP_READ_N(2) | |
99 | DECLARE_VM_DATA_MAP_READ_N(4) | |
100 | DECLARE_VM_DATA_MAP_READ_N(8) | |
101 | ||
102 | ||
103 | /* write data to memory */ | |
104 | ||
105 | #define DECLARE_VM_DATA_MAP_WRITE_N(N) \ | |
106 | INLINE_VM void vm_data_map_write_##N \ | |
107 | (vm_data_map *map, \ | |
108 | unsigned_word addr, \ | |
109 | unsigned_##N val, \ | |
110 | cpu *processor, \ | |
111 | unsigned_word cia); | |
112 | ||
113 | DECLARE_VM_DATA_MAP_WRITE_N(1) | |
114 | DECLARE_VM_DATA_MAP_WRITE_N(2) | |
115 | DECLARE_VM_DATA_MAP_WRITE_N(4) | |
116 | DECLARE_VM_DATA_MAP_WRITE_N(8) | |
117 | ||
118 | ||
119 | /* update vm data structures due to a synchronization point */ | |
120 | ||
121 | INLINE_VM void vm_synchronize_context | |
122 | (vm *memory, | |
123 | spreg *sprs, | |
124 | sreg *srs, | |
125 | msreg msr); | |
126 | ||
127 | #endif |