Commit a64d4718f1afde08fb74910242e7a7b946c3f162

Authored by bellard
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 97 /* slow unaligned access (it spans two pages or IO) */
98 98 do_unaligned_access:
99 99 retaddr = GETPC();
  100 +#ifdef ALIGNED_ONLY
  101 + do_unaligned_access(addr, READ_ACCESS_TYPE, is_user, retaddr);
  102 +#endif
100 103 res = glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(addr,
101 104 is_user, retaddr);
102 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 113 res = glue(glue(ld, USUFFIX), _raw)((uint8_t *)(long)physaddr);
105 114 }
106 115 } else {
107 116 /* the page is not in the TLB : fill it */
108 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 122 tlb_fill(addr, READ_ACCESS_TYPE, is_user, retaddr);
110 123 goto redo;
111 124 }
... ... @@ -213,15 +226,28 @@ void REGPARM(2) glue(glue(__st, SUFFIX), MMUSUFFIX)(target_ulong addr,
213 226 } else if (((addr & ~TARGET_PAGE_MASK) + DATA_SIZE - 1) >= TARGET_PAGE_SIZE) {
214 227 do_unaligned_access:
215 228 retaddr = GETPC();
  229 +#ifdef ALIGNED_ONLY
  230 + do_unaligned_access(addr, 1, is_user, retaddr);
  231 +#endif
216 232 glue(glue(slow_st, SUFFIX), MMUSUFFIX)(addr, val,
217 233 is_user, retaddr);
218 234 } else {
219 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 242 glue(glue(st, SUFFIX), _raw)((uint8_t *)(long)physaddr, val);
221 243 }
222 244 } else {
223 245 /* the page is not in the TLB : fill it */
224 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 251 tlb_fill(addr, 1, is_user, retaddr);
226 252 goto redo;
227 253 }
... ...