root / softmmu_template.h @ 45664345
History | View | Annotate | Download (12 kB)
1 | b92e5a22 | bellard | /*
|
---|---|---|---|
2 | b92e5a22 | bellard | * Software MMU support
|
3 | 5fafdf24 | ths | *
|
4 | b92e5a22 | bellard | * Copyright (c) 2003 Fabrice Bellard
|
5 | b92e5a22 | bellard | *
|
6 | b92e5a22 | bellard | * This library is free software; you can redistribute it and/or
|
7 | b92e5a22 | bellard | * modify it under the terms of the GNU Lesser General Public
|
8 | b92e5a22 | bellard | * License as published by the Free Software Foundation; either
|
9 | b92e5a22 | bellard | * version 2 of the License, or (at your option) any later version.
|
10 | b92e5a22 | bellard | *
|
11 | b92e5a22 | bellard | * This library is distributed in the hope that it will be useful,
|
12 | b92e5a22 | bellard | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 | b92e5a22 | bellard | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14 | b92e5a22 | bellard | * Lesser General Public License for more details.
|
15 | b92e5a22 | bellard | *
|
16 | b92e5a22 | bellard | * You should have received a copy of the GNU Lesser General Public
|
17 | 8167ee88 | Blue Swirl | * License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
18 | b92e5a22 | bellard | */
|
19 | 29e922b6 | Blue Swirl | #include "qemu-timer.h" |
20 | 29e922b6 | Blue Swirl | |
21 | b92e5a22 | bellard | #define DATA_SIZE (1 << SHIFT) |
22 | b92e5a22 | bellard | |
23 | b92e5a22 | bellard | #if DATA_SIZE == 8 |
24 | b92e5a22 | bellard | #define SUFFIX q
|
25 | 61382a50 | bellard | #define USUFFIX q
|
26 | b92e5a22 | bellard | #define DATA_TYPE uint64_t
|
27 | b92e5a22 | bellard | #elif DATA_SIZE == 4 |
28 | b92e5a22 | bellard | #define SUFFIX l
|
29 | 61382a50 | bellard | #define USUFFIX l
|
30 | b92e5a22 | bellard | #define DATA_TYPE uint32_t
|
31 | b92e5a22 | bellard | #elif DATA_SIZE == 2 |
32 | b92e5a22 | bellard | #define SUFFIX w
|
33 | 61382a50 | bellard | #define USUFFIX uw
|
34 | b92e5a22 | bellard | #define DATA_TYPE uint16_t
|
35 | b92e5a22 | bellard | #elif DATA_SIZE == 1 |
36 | b92e5a22 | bellard | #define SUFFIX b
|
37 | 61382a50 | bellard | #define USUFFIX ub
|
38 | b92e5a22 | bellard | #define DATA_TYPE uint8_t
|
39 | b92e5a22 | bellard | #else
|
40 | b92e5a22 | bellard | #error unsupported data size
|
41 | b92e5a22 | bellard | #endif
|
42 | b92e5a22 | bellard | |
43 | b769d8fe | bellard | #ifdef SOFTMMU_CODE_ACCESS
|
44 | b769d8fe | bellard | #define READ_ACCESS_TYPE 2 |
45 | 84b7b8e7 | bellard | #define ADDR_READ addr_code
|
46 | b769d8fe | bellard | #else
|
47 | b769d8fe | bellard | #define READ_ACCESS_TYPE 0 |
48 | 84b7b8e7 | bellard | #define ADDR_READ addr_read
|
49 | b769d8fe | bellard | #endif
|
50 | b769d8fe | bellard | |
51 | 5fafdf24 | ths | static DATA_TYPE glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(target_ulong addr,
|
52 | 6ebbf390 | j_mayer | int mmu_idx,
|
53 | 61382a50 | bellard | void *retaddr);
|
54 | c227f099 | Anthony Liguori | static inline DATA_TYPE glue(io_read, SUFFIX)(target_phys_addr_t physaddr, |
55 | 2e70f6ef | pbrook | target_ulong addr, |
56 | 2e70f6ef | pbrook | void *retaddr)
|
57 | b92e5a22 | bellard | { |
58 | b92e5a22 | bellard | DATA_TYPE res; |
59 | b92e5a22 | bellard | int index;
|
60 | 0f459d16 | pbrook | index = (physaddr >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
|
61 | 0f459d16 | pbrook | physaddr = (physaddr & TARGET_PAGE_MASK) + addr; |
62 | 2e70f6ef | pbrook | env->mem_io_pc = (unsigned long)retaddr; |
63 | 2e70f6ef | pbrook | if (index > (IO_MEM_NOTDIRTY >> IO_MEM_SHIFT)
|
64 | 2e70f6ef | pbrook | && !can_do_io(env)) { |
65 | 2e70f6ef | pbrook | cpu_io_recompile(env, retaddr); |
66 | 2e70f6ef | pbrook | } |
67 | b92e5a22 | bellard | |
68 | db8886d3 | aliguori | env->mem_io_vaddr = addr; |
69 | b92e5a22 | bellard | #if SHIFT <= 2 |
70 | a4193c8a | bellard | res = io_mem_read[index][SHIFT](io_mem_opaque[index], physaddr); |
71 | b92e5a22 | bellard | #else
|
72 | b92e5a22 | bellard | #ifdef TARGET_WORDS_BIGENDIAN
|
73 | a4193c8a | bellard | res = (uint64_t)io_mem_read[index][2](io_mem_opaque[index], physaddr) << 32; |
74 | a4193c8a | bellard | res |= io_mem_read[index][2](io_mem_opaque[index], physaddr + 4); |
75 | b92e5a22 | bellard | #else
|
76 | a4193c8a | bellard | res = io_mem_read[index][2](io_mem_opaque[index], physaddr);
|
77 | a4193c8a | bellard | res |= (uint64_t)io_mem_read[index][2](io_mem_opaque[index], physaddr + 4) << 32; |
78 | b92e5a22 | bellard | #endif
|
79 | b92e5a22 | bellard | #endif /* SHIFT > 2 */ |
80 | b92e5a22 | bellard | return res;
|
81 | b92e5a22 | bellard | } |
82 | b92e5a22 | bellard | |
83 | b92e5a22 | bellard | /* handle all cases except unaligned access which span two pages */
|
84 | d656469f | bellard | DATA_TYPE REGPARM glue(glue(__ld, SUFFIX), MMUSUFFIX)(target_ulong addr, |
85 | d656469f | bellard | int mmu_idx)
|
86 | b92e5a22 | bellard | { |
87 | b92e5a22 | bellard | DATA_TYPE res; |
88 | 61382a50 | bellard | int index;
|
89 | c27004ec | bellard | target_ulong tlb_addr; |
90 | 355b1943 | Paul Brook | target_phys_addr_t ioaddr; |
91 | 355b1943 | Paul Brook | unsigned long addend; |
92 | b92e5a22 | bellard | void *retaddr;
|
93 | 3b46e624 | ths | |
94 | b92e5a22 | bellard | /* test if there is match for unaligned or IO access */
|
95 | b92e5a22 | bellard | /* XXX: could done more in memory macro in a non portable way */
|
96 | b92e5a22 | bellard | index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);
|
97 | b92e5a22 | bellard | redo:
|
98 | 6ebbf390 | j_mayer | tlb_addr = env->tlb_table[mmu_idx][index].ADDR_READ; |
99 | b92e5a22 | bellard | if ((addr & TARGET_PAGE_MASK) == (tlb_addr & (TARGET_PAGE_MASK | TLB_INVALID_MASK))) {
|
100 | b92e5a22 | bellard | if (tlb_addr & ~TARGET_PAGE_MASK) {
|
101 | b92e5a22 | bellard | /* IO access */
|
102 | b92e5a22 | bellard | if ((addr & (DATA_SIZE - 1)) != 0) |
103 | b92e5a22 | bellard | goto do_unaligned_access;
|
104 | 2e70f6ef | pbrook | retaddr = GETPC(); |
105 | 355b1943 | Paul Brook | ioaddr = env->iotlb[mmu_idx][index]; |
106 | 355b1943 | Paul Brook | res = glue(io_read, SUFFIX)(ioaddr, addr, retaddr); |
107 | 98699967 | bellard | } else if (((addr & ~TARGET_PAGE_MASK) + DATA_SIZE - 1) >= TARGET_PAGE_SIZE) { |
108 | b92e5a22 | bellard | /* slow unaligned access (it spans two pages or IO) */
|
109 | b92e5a22 | bellard | do_unaligned_access:
|
110 | 61382a50 | bellard | retaddr = GETPC(); |
111 | a64d4718 | bellard | #ifdef ALIGNED_ONLY
|
112 | 6ebbf390 | j_mayer | do_unaligned_access(addr, READ_ACCESS_TYPE, mmu_idx, retaddr); |
113 | a64d4718 | bellard | #endif
|
114 | 5fafdf24 | ths | res = glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(addr, |
115 | 6ebbf390 | j_mayer | mmu_idx, retaddr); |
116 | b92e5a22 | bellard | } else {
|
117 | a64d4718 | bellard | /* unaligned/aligned access in the same page */
|
118 | a64d4718 | bellard | #ifdef ALIGNED_ONLY
|
119 | a64d4718 | bellard | if ((addr & (DATA_SIZE - 1)) != 0) { |
120 | a64d4718 | bellard | retaddr = GETPC(); |
121 | 6ebbf390 | j_mayer | do_unaligned_access(addr, READ_ACCESS_TYPE, mmu_idx, retaddr); |
122 | a64d4718 | bellard | } |
123 | a64d4718 | bellard | #endif
|
124 | 0f459d16 | pbrook | addend = env->tlb_table[mmu_idx][index].addend; |
125 | 0f459d16 | pbrook | res = glue(glue(ld, USUFFIX), _raw)((uint8_t *)(long)(addr+addend));
|
126 | b92e5a22 | bellard | } |
127 | b92e5a22 | bellard | } else {
|
128 | b92e5a22 | bellard | /* the page is not in the TLB : fill it */
|
129 | 61382a50 | bellard | retaddr = GETPC(); |
130 | a64d4718 | bellard | #ifdef ALIGNED_ONLY
|
131 | a64d4718 | bellard | if ((addr & (DATA_SIZE - 1)) != 0) |
132 | 6ebbf390 | j_mayer | do_unaligned_access(addr, READ_ACCESS_TYPE, mmu_idx, retaddr); |
133 | a64d4718 | bellard | #endif
|
134 | 6ebbf390 | j_mayer | tlb_fill(addr, READ_ACCESS_TYPE, mmu_idx, retaddr); |
135 | b92e5a22 | bellard | goto redo;
|
136 | b92e5a22 | bellard | } |
137 | b92e5a22 | bellard | return res;
|
138 | b92e5a22 | bellard | } |
139 | b92e5a22 | bellard | |
140 | b92e5a22 | bellard | /* handle all unaligned cases */
|
141 | 5fafdf24 | ths | static DATA_TYPE glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(target_ulong addr,
|
142 | 6ebbf390 | j_mayer | int mmu_idx,
|
143 | 61382a50 | bellard | void *retaddr)
|
144 | b92e5a22 | bellard | { |
145 | b92e5a22 | bellard | DATA_TYPE res, res1, res2; |
146 | 61382a50 | bellard | int index, shift;
|
147 | 355b1943 | Paul Brook | target_phys_addr_t ioaddr; |
148 | 355b1943 | Paul Brook | unsigned long addend; |
149 | c27004ec | bellard | target_ulong tlb_addr, addr1, addr2; |
150 | b92e5a22 | bellard | |
151 | b92e5a22 | bellard | index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);
|
152 | b92e5a22 | bellard | redo:
|
153 | 6ebbf390 | j_mayer | tlb_addr = env->tlb_table[mmu_idx][index].ADDR_READ; |
154 | b92e5a22 | bellard | if ((addr & TARGET_PAGE_MASK) == (tlb_addr & (TARGET_PAGE_MASK | TLB_INVALID_MASK))) {
|
155 | b92e5a22 | bellard | if (tlb_addr & ~TARGET_PAGE_MASK) {
|
156 | b92e5a22 | bellard | /* IO access */
|
157 | b92e5a22 | bellard | if ((addr & (DATA_SIZE - 1)) != 0) |
158 | b92e5a22 | bellard | goto do_unaligned_access;
|
159 | 355b1943 | Paul Brook | ioaddr = env->iotlb[mmu_idx][index]; |
160 | 355b1943 | Paul Brook | res = glue(io_read, SUFFIX)(ioaddr, addr, retaddr); |
161 | 98699967 | bellard | } else if (((addr & ~TARGET_PAGE_MASK) + DATA_SIZE - 1) >= TARGET_PAGE_SIZE) { |
162 | b92e5a22 | bellard | do_unaligned_access:
|
163 | b92e5a22 | bellard | /* slow unaligned access (it spans two pages) */
|
164 | b92e5a22 | bellard | addr1 = addr & ~(DATA_SIZE - 1);
|
165 | b92e5a22 | bellard | addr2 = addr1 + DATA_SIZE; |
166 | 5fafdf24 | ths | res1 = glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(addr1, |
167 | 6ebbf390 | j_mayer | mmu_idx, retaddr); |
168 | 5fafdf24 | ths | res2 = glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(addr2, |
169 | 6ebbf390 | j_mayer | mmu_idx, retaddr); |
170 | b92e5a22 | bellard | shift = (addr & (DATA_SIZE - 1)) * 8; |
171 | b92e5a22 | bellard | #ifdef TARGET_WORDS_BIGENDIAN
|
172 | b92e5a22 | bellard | res = (res1 << shift) | (res2 >> ((DATA_SIZE * 8) - shift));
|
173 | b92e5a22 | bellard | #else
|
174 | b92e5a22 | bellard | res = (res1 >> shift) | (res2 << ((DATA_SIZE * 8) - shift));
|
175 | b92e5a22 | bellard | #endif
|
176 | 6986f88c | bellard | res = (DATA_TYPE)res; |
177 | b92e5a22 | bellard | } else {
|
178 | b92e5a22 | bellard | /* unaligned/aligned access in the same page */
|
179 | 0f459d16 | pbrook | addend = env->tlb_table[mmu_idx][index].addend; |
180 | 0f459d16 | pbrook | res = glue(glue(ld, USUFFIX), _raw)((uint8_t *)(long)(addr+addend));
|
181 | b92e5a22 | bellard | } |
182 | b92e5a22 | bellard | } else {
|
183 | b92e5a22 | bellard | /* the page is not in the TLB : fill it */
|
184 | 6ebbf390 | j_mayer | tlb_fill(addr, READ_ACCESS_TYPE, mmu_idx, retaddr); |
185 | b92e5a22 | bellard | goto redo;
|
186 | b92e5a22 | bellard | } |
187 | b92e5a22 | bellard | return res;
|
188 | b92e5a22 | bellard | } |
189 | b92e5a22 | bellard | |
190 | b769d8fe | bellard | #ifndef SOFTMMU_CODE_ACCESS
|
191 | b769d8fe | bellard | |
192 | 5fafdf24 | ths | static void glue(glue(slow_st, SUFFIX), MMUSUFFIX)(target_ulong addr, |
193 | 5fafdf24 | ths | DATA_TYPE val, |
194 | 6ebbf390 | j_mayer | int mmu_idx,
|
195 | b769d8fe | bellard | void *retaddr);
|
196 | b769d8fe | bellard | |
197 | c227f099 | Anthony Liguori | static inline void glue(io_write, SUFFIX)(target_phys_addr_t physaddr, |
198 | b769d8fe | bellard | DATA_TYPE val, |
199 | 0f459d16 | pbrook | target_ulong addr, |
200 | b769d8fe | bellard | void *retaddr)
|
201 | b769d8fe | bellard | { |
202 | b769d8fe | bellard | int index;
|
203 | 0f459d16 | pbrook | index = (physaddr >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
|
204 | 0f459d16 | pbrook | physaddr = (physaddr & TARGET_PAGE_MASK) + addr; |
205 | 2e70f6ef | pbrook | if (index > (IO_MEM_NOTDIRTY >> IO_MEM_SHIFT)
|
206 | 2e70f6ef | pbrook | && !can_do_io(env)) { |
207 | 2e70f6ef | pbrook | cpu_io_recompile(env, retaddr); |
208 | 2e70f6ef | pbrook | } |
209 | b769d8fe | bellard | |
210 | 2e70f6ef | pbrook | env->mem_io_vaddr = addr; |
211 | 2e70f6ef | pbrook | env->mem_io_pc = (unsigned long)retaddr; |
212 | b769d8fe | bellard | #if SHIFT <= 2 |
213 | b769d8fe | bellard | io_mem_write[index][SHIFT](io_mem_opaque[index], physaddr, val); |
214 | b769d8fe | bellard | #else
|
215 | b769d8fe | bellard | #ifdef TARGET_WORDS_BIGENDIAN
|
216 | b769d8fe | bellard | io_mem_write[index][2](io_mem_opaque[index], physaddr, val >> 32); |
217 | b769d8fe | bellard | io_mem_write[index][2](io_mem_opaque[index], physaddr + 4, val); |
218 | b769d8fe | bellard | #else
|
219 | b769d8fe | bellard | io_mem_write[index][2](io_mem_opaque[index], physaddr, val);
|
220 | b769d8fe | bellard | io_mem_write[index][2](io_mem_opaque[index], physaddr + 4, val >> 32); |
221 | b769d8fe | bellard | #endif
|
222 | b769d8fe | bellard | #endif /* SHIFT > 2 */ |
223 | b769d8fe | bellard | } |
224 | b92e5a22 | bellard | |
225 | d656469f | bellard | void REGPARM glue(glue(__st, SUFFIX), MMUSUFFIX)(target_ulong addr,
|
226 | d656469f | bellard | DATA_TYPE val, |
227 | d656469f | bellard | int mmu_idx)
|
228 | b92e5a22 | bellard | { |
229 | 355b1943 | Paul Brook | target_phys_addr_t ioaddr; |
230 | 355b1943 | Paul Brook | unsigned long addend; |
231 | c27004ec | bellard | target_ulong tlb_addr; |
232 | b92e5a22 | bellard | void *retaddr;
|
233 | 61382a50 | bellard | int index;
|
234 | 3b46e624 | ths | |
235 | b92e5a22 | bellard | index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);
|
236 | b92e5a22 | bellard | redo:
|
237 | 6ebbf390 | j_mayer | tlb_addr = env->tlb_table[mmu_idx][index].addr_write; |
238 | b92e5a22 | bellard | if ((addr & TARGET_PAGE_MASK) == (tlb_addr & (TARGET_PAGE_MASK | TLB_INVALID_MASK))) {
|
239 | b92e5a22 | bellard | if (tlb_addr & ~TARGET_PAGE_MASK) {
|
240 | b92e5a22 | bellard | /* IO access */
|
241 | b92e5a22 | bellard | if ((addr & (DATA_SIZE - 1)) != 0) |
242 | b92e5a22 | bellard | goto do_unaligned_access;
|
243 | d720b93d | bellard | retaddr = GETPC(); |
244 | 355b1943 | Paul Brook | ioaddr = env->iotlb[mmu_idx][index]; |
245 | 355b1943 | Paul Brook | glue(io_write, SUFFIX)(ioaddr, val, addr, retaddr); |
246 | 98699967 | bellard | } else if (((addr & ~TARGET_PAGE_MASK) + DATA_SIZE - 1) >= TARGET_PAGE_SIZE) { |
247 | b92e5a22 | bellard | do_unaligned_access:
|
248 | 61382a50 | bellard | retaddr = GETPC(); |
249 | a64d4718 | bellard | #ifdef ALIGNED_ONLY
|
250 | 6ebbf390 | j_mayer | do_unaligned_access(addr, 1, mmu_idx, retaddr);
|
251 | a64d4718 | bellard | #endif
|
252 | 5fafdf24 | ths | glue(glue(slow_st, SUFFIX), MMUSUFFIX)(addr, val, |
253 | 6ebbf390 | j_mayer | mmu_idx, retaddr); |
254 | b92e5a22 | bellard | } else {
|
255 | b92e5a22 | bellard | /* aligned/unaligned access in the same page */
|
256 | a64d4718 | bellard | #ifdef ALIGNED_ONLY
|
257 | a64d4718 | bellard | if ((addr & (DATA_SIZE - 1)) != 0) { |
258 | a64d4718 | bellard | retaddr = GETPC(); |
259 | 6ebbf390 | j_mayer | do_unaligned_access(addr, 1, mmu_idx, retaddr);
|
260 | a64d4718 | bellard | } |
261 | a64d4718 | bellard | #endif
|
262 | 0f459d16 | pbrook | addend = env->tlb_table[mmu_idx][index].addend; |
263 | 0f459d16 | pbrook | glue(glue(st, SUFFIX), _raw)((uint8_t *)(long)(addr+addend), val);
|
264 | b92e5a22 | bellard | } |
265 | b92e5a22 | bellard | } else {
|
266 | b92e5a22 | bellard | /* the page is not in the TLB : fill it */
|
267 | 61382a50 | bellard | retaddr = GETPC(); |
268 | a64d4718 | bellard | #ifdef ALIGNED_ONLY
|
269 | a64d4718 | bellard | if ((addr & (DATA_SIZE - 1)) != 0) |
270 | 6ebbf390 | j_mayer | do_unaligned_access(addr, 1, mmu_idx, retaddr);
|
271 | a64d4718 | bellard | #endif
|
272 | 6ebbf390 | j_mayer | tlb_fill(addr, 1, mmu_idx, retaddr);
|
273 | b92e5a22 | bellard | goto redo;
|
274 | b92e5a22 | bellard | } |
275 | b92e5a22 | bellard | } |
276 | b92e5a22 | bellard | |
277 | b92e5a22 | bellard | /* handles all unaligned cases */
|
278 | 5fafdf24 | ths | static void glue(glue(slow_st, SUFFIX), MMUSUFFIX)(target_ulong addr, |
279 | 61382a50 | bellard | DATA_TYPE val, |
280 | 6ebbf390 | j_mayer | int mmu_idx,
|
281 | 61382a50 | bellard | void *retaddr)
|
282 | b92e5a22 | bellard | { |
283 | 355b1943 | Paul Brook | target_phys_addr_t ioaddr; |
284 | 355b1943 | Paul Brook | unsigned long addend; |
285 | c27004ec | bellard | target_ulong tlb_addr; |
286 | 61382a50 | bellard | int index, i;
|
287 | b92e5a22 | bellard | |
288 | b92e5a22 | bellard | index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);
|
289 | b92e5a22 | bellard | redo:
|
290 | 6ebbf390 | j_mayer | tlb_addr = env->tlb_table[mmu_idx][index].addr_write; |
291 | b92e5a22 | bellard | if ((addr & TARGET_PAGE_MASK) == (tlb_addr & (TARGET_PAGE_MASK | TLB_INVALID_MASK))) {
|
292 | b92e5a22 | bellard | if (tlb_addr & ~TARGET_PAGE_MASK) {
|
293 | b92e5a22 | bellard | /* IO access */
|
294 | b92e5a22 | bellard | if ((addr & (DATA_SIZE - 1)) != 0) |
295 | b92e5a22 | bellard | goto do_unaligned_access;
|
296 | 355b1943 | Paul Brook | ioaddr = env->iotlb[mmu_idx][index]; |
297 | 355b1943 | Paul Brook | glue(io_write, SUFFIX)(ioaddr, val, addr, retaddr); |
298 | 98699967 | bellard | } else if (((addr & ~TARGET_PAGE_MASK) + DATA_SIZE - 1) >= TARGET_PAGE_SIZE) { |
299 | b92e5a22 | bellard | do_unaligned_access:
|
300 | b92e5a22 | bellard | /* XXX: not efficient, but simple */
|
301 | 6c41b272 | balrog | /* Note: relies on the fact that tlb_fill() does not remove the
|
302 | 6c41b272 | balrog | * previous page from the TLB cache. */
|
303 | 7221fa98 | balrog | for(i = DATA_SIZE - 1; i >= 0; i--) { |
304 | b92e5a22 | bellard | #ifdef TARGET_WORDS_BIGENDIAN
|
305 | 5fafdf24 | ths | glue(slow_stb, MMUSUFFIX)(addr + i, val >> (((DATA_SIZE - 1) * 8) - (i * 8)), |
306 | 6ebbf390 | j_mayer | mmu_idx, retaddr); |
307 | b92e5a22 | bellard | #else
|
308 | 5fafdf24 | ths | glue(slow_stb, MMUSUFFIX)(addr + i, val >> (i * 8),
|
309 | 6ebbf390 | j_mayer | mmu_idx, retaddr); |
310 | b92e5a22 | bellard | #endif
|
311 | b92e5a22 | bellard | } |
312 | b92e5a22 | bellard | } else {
|
313 | b92e5a22 | bellard | /* aligned/unaligned access in the same page */
|
314 | 0f459d16 | pbrook | addend = env->tlb_table[mmu_idx][index].addend; |
315 | 0f459d16 | pbrook | glue(glue(st, SUFFIX), _raw)((uint8_t *)(long)(addr+addend), val);
|
316 | b92e5a22 | bellard | } |
317 | b92e5a22 | bellard | } else {
|
318 | b92e5a22 | bellard | /* the page is not in the TLB : fill it */
|
319 | 6ebbf390 | j_mayer | tlb_fill(addr, 1, mmu_idx, retaddr);
|
320 | b92e5a22 | bellard | goto redo;
|
321 | b92e5a22 | bellard | } |
322 | b92e5a22 | bellard | } |
323 | b92e5a22 | bellard | |
324 | b769d8fe | bellard | #endif /* !defined(SOFTMMU_CODE_ACCESS) */ |
325 | b769d8fe | bellard | |
326 | b769d8fe | bellard | #undef READ_ACCESS_TYPE
|
327 | b92e5a22 | bellard | #undef SHIFT
|
328 | b92e5a22 | bellard | #undef DATA_TYPE
|
329 | b92e5a22 | bellard | #undef SUFFIX
|
330 | 61382a50 | bellard | #undef USUFFIX
|
331 | b92e5a22 | bellard | #undef DATA_SIZE
|
332 | 84b7b8e7 | bellard | #undef ADDR_READ |