Update
[gdb.git] / sim / ppc / vm.h
blobb8c4c8c234bd2be50f0f8856731002d391ad77ff
1 /* This file is part of the program psim.
3 Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
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.
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.
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.
22 #ifndef _VM_H_
23 #define _VM_H_
25 typedef struct _vm vm;
26 typedef struct _vm_data_map vm_data_map;
27 typedef struct _vm_instruction_map vm_instruction_map;
30 /* each PowerPC requires two virtual memory maps */
32 INLINE_VM\
33 (vm *) vm_create
34 (core *memory);
36 INLINE_VM\
37 (vm_data_map *) vm_create_data_map
38 (vm *memory);
40 INLINE_VM\
41 (vm_instruction_map *) vm_create_instruction_map
42 (vm *memory);
45 /* address translation, if the translation is invalid
46 these will not return */
48 INLINE_VM\
49 (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);
56 INLINE_VM\
57 (unsigned_word) vm_real_instruction_addr
58 (vm_instruction_map *instruction_map,
59 cpu *processor,
60 unsigned_word cia);
63 /* generic block transfers. Dependant on the presence of the
64 PROCESSOR arg, either returns the number of bytes transfered or (if
65 PROCESSOR is non NULL) aborts the simulation */
67 INLINE_VM\
68 (int) vm_data_map_read_buffer
69 (vm_data_map *map,
70 void *target,
71 unsigned_word addr,
72 unsigned len,
73 cpu *processor,
74 unsigned_word cia);
76 INLINE_VM\
77 (int) vm_data_map_write_buffer
78 (vm_data_map *map,
79 const void *source,
80 unsigned_word addr,
81 unsigned len,
82 int violate_read_only_section,
83 cpu *processor,
84 unsigned_word cia);
87 /* fetch the next instruction from memory */
89 INLINE_VM\
90 (instruction_word) vm_instruction_map_read
91 (vm_instruction_map *instruction_map,
92 cpu *processor,
93 unsigned_word cia);
96 /* read data from memory */
98 #define DECLARE_VM_DATA_MAP_READ_N(N) \
99 INLINE_VM\
100 (unsigned_##N) vm_data_map_read_##N \
101 (vm_data_map *map, \
102 unsigned_word ea, \
103 cpu *processor, \
104 unsigned_word cia);
106 DECLARE_VM_DATA_MAP_READ_N(1)
107 DECLARE_VM_DATA_MAP_READ_N(2)
108 DECLARE_VM_DATA_MAP_READ_N(4)
109 DECLARE_VM_DATA_MAP_READ_N(8)
110 DECLARE_VM_DATA_MAP_READ_N(word)
113 /* write data to memory */
115 #define DECLARE_VM_DATA_MAP_WRITE_N(N) \
116 INLINE_VM\
117 (void) vm_data_map_write_##N \
118 (vm_data_map *map, \
119 unsigned_word addr, \
120 unsigned_##N val, \
121 cpu *processor, \
122 unsigned_word cia);
124 DECLARE_VM_DATA_MAP_WRITE_N(1)
125 DECLARE_VM_DATA_MAP_WRITE_N(2)
126 DECLARE_VM_DATA_MAP_WRITE_N(4)
127 DECLARE_VM_DATA_MAP_WRITE_N(8)
128 DECLARE_VM_DATA_MAP_WRITE_N(word)
131 /* update vm data structures due to a synchronization point */
133 INLINE_VM\
134 (void) vm_synchronize_context
135 (vm *memory,
136 spreg *sprs,
137 sreg *srs,
138 msreg msr,
139 /**/
140 cpu *processor,
141 unsigned_word cia);
144 /* update vm data structures due to a TLB operation */
146 INLINE_VM\
147 (void) vm_page_tlb_invalidate_entry
148 (vm *memory,
149 unsigned_word ea);
151 INLINE_VM\
152 (void) vm_page_tlb_invalidate_all
153 (vm *memory);
155 #endif