Revision 5fafdf24 softmmu_template.h
b/softmmu_template.h | ||
---|---|---|
1 | 1 |
/* |
2 | 2 |
* Software MMU support |
3 |
*
|
|
3 |
* |
|
4 | 4 |
* Copyright (c) 2003 Fabrice Bellard |
5 | 5 |
* |
6 | 6 |
* This library is free software; you can redistribute it and/or |
... | ... | |
47 | 47 |
#define ADDR_READ addr_read |
48 | 48 |
#endif |
49 | 49 |
|
50 |
static DATA_TYPE glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(target_ulong addr,
|
|
50 |
static DATA_TYPE glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(target_ulong addr, |
|
51 | 51 |
int is_user, |
52 | 52 |
void *retaddr); |
53 |
static inline DATA_TYPE glue(io_read, SUFFIX)(target_phys_addr_t physaddr,
|
|
53 |
static inline DATA_TYPE glue(io_read, SUFFIX)(target_phys_addr_t physaddr, |
|
54 | 54 |
target_ulong tlb_addr) |
55 | 55 |
{ |
56 | 56 |
DATA_TYPE res; |
... | ... | |
83 | 83 |
target_ulong tlb_addr; |
84 | 84 |
target_phys_addr_t physaddr; |
85 | 85 |
void *retaddr; |
86 |
|
|
86 |
|
|
87 | 87 |
/* test if there is match for unaligned or IO access */ |
88 | 88 |
/* XXX: could done more in memory macro in a non portable way */ |
89 | 89 |
index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1); |
... | ... | |
103 | 103 |
#ifdef ALIGNED_ONLY |
104 | 104 |
do_unaligned_access(addr, READ_ACCESS_TYPE, is_user, retaddr); |
105 | 105 |
#endif |
106 |
res = glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(addr,
|
|
106 |
res = glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(addr, |
|
107 | 107 |
is_user, retaddr); |
108 | 108 |
} else { |
109 | 109 |
/* unaligned/aligned access in the same page */ |
... | ... | |
129 | 129 |
} |
130 | 130 |
|
131 | 131 |
/* handle all unaligned cases */ |
132 |
static DATA_TYPE glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(target_ulong addr,
|
|
132 |
static DATA_TYPE glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(target_ulong addr, |
|
133 | 133 |
int is_user, |
134 | 134 |
void *retaddr) |
135 | 135 |
{ |
... | ... | |
153 | 153 |
/* slow unaligned access (it spans two pages) */ |
154 | 154 |
addr1 = addr & ~(DATA_SIZE - 1); |
155 | 155 |
addr2 = addr1 + DATA_SIZE; |
156 |
res1 = glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(addr1,
|
|
156 |
res1 = glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(addr1, |
|
157 | 157 |
is_user, retaddr); |
158 |
res2 = glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(addr2,
|
|
158 |
res2 = glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(addr2, |
|
159 | 159 |
is_user, retaddr); |
160 | 160 |
shift = (addr & (DATA_SIZE - 1)) * 8; |
161 | 161 |
#ifdef TARGET_WORDS_BIGENDIAN |
... | ... | |
178 | 178 |
|
179 | 179 |
#ifndef SOFTMMU_CODE_ACCESS |
180 | 180 |
|
181 |
static void glue(glue(slow_st, SUFFIX), MMUSUFFIX)(target_ulong addr,
|
|
182 |
DATA_TYPE val,
|
|
181 |
static void glue(glue(slow_st, SUFFIX), MMUSUFFIX)(target_ulong addr, |
|
182 |
DATA_TYPE val, |
|
183 | 183 |
int is_user, |
184 | 184 |
void *retaddr); |
185 | 185 |
|
186 |
static inline void glue(io_write, SUFFIX)(target_phys_addr_t physaddr,
|
|
186 |
static inline void glue(io_write, SUFFIX)(target_phys_addr_t physaddr, |
|
187 | 187 |
DATA_TYPE val, |
188 | 188 |
target_ulong tlb_addr, |
189 | 189 |
void *retaddr) |
... | ... | |
209 | 209 |
#endif |
210 | 210 |
} |
211 | 211 |
|
212 |
void REGPARM(2) glue(glue(__st, SUFFIX), MMUSUFFIX)(target_ulong addr,
|
|
212 |
void REGPARM(2) glue(glue(__st, SUFFIX), MMUSUFFIX)(target_ulong addr, |
|
213 | 213 |
DATA_TYPE val, |
214 | 214 |
int is_user) |
215 | 215 |
{ |
... | ... | |
217 | 217 |
target_ulong tlb_addr; |
218 | 218 |
void *retaddr; |
219 | 219 |
int index; |
220 |
|
|
220 |
|
|
221 | 221 |
index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1); |
222 | 222 |
redo: |
223 | 223 |
tlb_addr = env->tlb_table[is_user][index].addr_write; |
... | ... | |
235 | 235 |
#ifdef ALIGNED_ONLY |
236 | 236 |
do_unaligned_access(addr, 1, is_user, retaddr); |
237 | 237 |
#endif |
238 |
glue(glue(slow_st, SUFFIX), MMUSUFFIX)(addr, val,
|
|
238 |
glue(glue(slow_st, SUFFIX), MMUSUFFIX)(addr, val, |
|
239 | 239 |
is_user, retaddr); |
240 | 240 |
} else { |
241 | 241 |
/* aligned/unaligned access in the same page */ |
... | ... | |
260 | 260 |
} |
261 | 261 |
|
262 | 262 |
/* handles all unaligned cases */ |
263 |
static void glue(glue(slow_st, SUFFIX), MMUSUFFIX)(target_ulong addr,
|
|
263 |
static void glue(glue(slow_st, SUFFIX), MMUSUFFIX)(target_ulong addr, |
|
264 | 264 |
DATA_TYPE val, |
265 | 265 |
int is_user, |
266 | 266 |
void *retaddr) |
... | ... | |
284 | 284 |
/* XXX: not efficient, but simple */ |
285 | 285 |
for(i = 0;i < DATA_SIZE; i++) { |
286 | 286 |
#ifdef TARGET_WORDS_BIGENDIAN |
287 |
glue(slow_stb, MMUSUFFIX)(addr + i, val >> (((DATA_SIZE - 1) * 8) - (i * 8)),
|
|
287 |
glue(slow_stb, MMUSUFFIX)(addr + i, val >> (((DATA_SIZE - 1) * 8) - (i * 8)), |
|
288 | 288 |
is_user, retaddr); |
289 | 289 |
#else |
290 |
glue(slow_stb, MMUSUFFIX)(addr + i, val >> (i * 8),
|
|
290 |
glue(slow_stb, MMUSUFFIX)(addr + i, val >> (i * 8), |
|
291 | 291 |
is_user, retaddr); |
292 | 292 |
#endif |
293 | 293 |
} |
Also available in: Unified diff