Commit a64d4718f1afde08fb74910242e7a7b946c3f162
1 parent
2d7272a5
MIPS unaligned accesses exceptions (Daniel Jacobowitz)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1688 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
27 additions
and
1 deletions
softmmu_template.h
@@ -97,15 +97,28 @@ DATA_TYPE REGPARM(1) glue(glue(__ld, SUFFIX), MMUSUFFIX)(target_ulong addr, | @@ -97,15 +97,28 @@ DATA_TYPE REGPARM(1) glue(glue(__ld, SUFFIX), MMUSUFFIX)(target_ulong addr, | ||
97 | /* slow unaligned access (it spans two pages or IO) */ | 97 | /* slow unaligned access (it spans two pages or IO) */ |
98 | do_unaligned_access: | 98 | do_unaligned_access: |
99 | retaddr = GETPC(); | 99 | retaddr = GETPC(); |
100 | +#ifdef ALIGNED_ONLY | ||
101 | + do_unaligned_access(addr, READ_ACCESS_TYPE, is_user, retaddr); | ||
102 | +#endif | ||
100 | res = glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(addr, | 103 | res = glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(addr, |
101 | is_user, retaddr); | 104 | is_user, retaddr); |
102 | } else { | 105 | } else { |
103 | - /* unaligned access in the same page */ | 106 | + /* unaligned/aligned access in the same page */ |
107 | +#ifdef ALIGNED_ONLY | ||
108 | + if ((addr & (DATA_SIZE - 1)) != 0) { | ||
109 | + retaddr = GETPC(); | ||
110 | + do_unaligned_access(addr, READ_ACCESS_TYPE, is_user, retaddr); | ||
111 | + } | ||
112 | +#endif | ||
104 | res = glue(glue(ld, USUFFIX), _raw)((uint8_t *)(long)physaddr); | 113 | res = glue(glue(ld, USUFFIX), _raw)((uint8_t *)(long)physaddr); |
105 | } | 114 | } |
106 | } else { | 115 | } else { |
107 | /* the page is not in the TLB : fill it */ | 116 | /* the page is not in the TLB : fill it */ |
108 | retaddr = GETPC(); | 117 | retaddr = GETPC(); |
118 | +#ifdef ALIGNED_ONLY | ||
119 | + if ((addr & (DATA_SIZE - 1)) != 0) | ||
120 | + do_unaligned_access(addr, READ_ACCESS_TYPE, is_user, retaddr); | ||
121 | +#endif | ||
109 | tlb_fill(addr, READ_ACCESS_TYPE, is_user, retaddr); | 122 | tlb_fill(addr, READ_ACCESS_TYPE, is_user, retaddr); |
110 | goto redo; | 123 | goto redo; |
111 | } | 124 | } |
@@ -213,15 +226,28 @@ void REGPARM(2) glue(glue(__st, SUFFIX), MMUSUFFIX)(target_ulong addr, | @@ -213,15 +226,28 @@ void REGPARM(2) glue(glue(__st, SUFFIX), MMUSUFFIX)(target_ulong addr, | ||
213 | } else if (((addr & ~TARGET_PAGE_MASK) + DATA_SIZE - 1) >= TARGET_PAGE_SIZE) { | 226 | } else if (((addr & ~TARGET_PAGE_MASK) + DATA_SIZE - 1) >= TARGET_PAGE_SIZE) { |
214 | do_unaligned_access: | 227 | do_unaligned_access: |
215 | retaddr = GETPC(); | 228 | retaddr = GETPC(); |
229 | +#ifdef ALIGNED_ONLY | ||
230 | + do_unaligned_access(addr, 1, is_user, retaddr); | ||
231 | +#endif | ||
216 | glue(glue(slow_st, SUFFIX), MMUSUFFIX)(addr, val, | 232 | glue(glue(slow_st, SUFFIX), MMUSUFFIX)(addr, val, |
217 | is_user, retaddr); | 233 | is_user, retaddr); |
218 | } else { | 234 | } else { |
219 | /* aligned/unaligned access in the same page */ | 235 | /* aligned/unaligned access in the same page */ |
236 | +#ifdef ALIGNED_ONLY | ||
237 | + if ((addr & (DATA_SIZE - 1)) != 0) { | ||
238 | + retaddr = GETPC(); | ||
239 | + do_unaligned_access(addr, 1, is_user, retaddr); | ||
240 | + } | ||
241 | +#endif | ||
220 | glue(glue(st, SUFFIX), _raw)((uint8_t *)(long)physaddr, val); | 242 | glue(glue(st, SUFFIX), _raw)((uint8_t *)(long)physaddr, val); |
221 | } | 243 | } |
222 | } else { | 244 | } else { |
223 | /* the page is not in the TLB : fill it */ | 245 | /* the page is not in the TLB : fill it */ |
224 | retaddr = GETPC(); | 246 | retaddr = GETPC(); |
247 | +#ifdef ALIGNED_ONLY | ||
248 | + if ((addr & (DATA_SIZE - 1)) != 0) | ||
249 | + do_unaligned_access(addr, 1, is_user, retaddr); | ||
250 | +#endif | ||
225 | tlb_fill(addr, 1, is_user, retaddr); | 251 | tlb_fill(addr, 1, is_user, retaddr); |
226 | goto redo; | 252 | goto redo; |
227 | } | 253 | } |