Commit 6d8aa3bfed71ef1a09290e9bcdf741e37e9f7a06

Authored by balrog
1 parent 2657c663

Remove unaligned accesses in ia64_apply_fixes().

Make sure that the static variables are not optimized away in GOTO_TB. (patch by Andreas Schwab)


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3042 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 2 changed files with 8 additions and 7 deletions
dyngen.h
@@ -392,7 +392,8 @@ static inline void ia64_apply_fixes (uint8_t **gen_code_pp, @@ -392,7 +392,8 @@ static inline void ia64_apply_fixes (uint8_t **gen_code_pp,
392 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, /* nop 0; brl IP */ 392 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, /* nop 0; brl IP */
393 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0 393 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0
394 }; 394 };
395 - uint8_t *gen_code_ptr = *gen_code_pp, *plt_start, *got_start, *vp; 395 + uint8_t *gen_code_ptr = *gen_code_pp, *plt_start, *got_start;
  396 + uint64_t *vp;
396 struct ia64_fixup *fixup; 397 struct ia64_fixup *fixup;
397 unsigned int offset = 0; 398 unsigned int offset = 0;
398 struct fdesc { 399 struct fdesc {
@@ -429,12 +430,12 @@ static inline void ia64_apply_fixes (uint8_t **gen_code_pp, @@ -429,12 +430,12 @@ static inline void ia64_apply_fixes (uint8_t **gen_code_pp,
429 /* First, create the GOT: */ 430 /* First, create the GOT: */
430 for (fixup = ltoff_fixes; fixup; fixup = fixup->next) { 431 for (fixup = ltoff_fixes; fixup; fixup = fixup->next) {
431 /* first check if we already have this value in the GOT: */ 432 /* first check if we already have this value in the GOT: */
432 - for (vp = got_start; vp < gen_code_ptr; ++vp)  
433 - if (*(uint64_t *) vp == fixup->value) 433 + for (vp = (uint64_t *) got_start; vp < (uint64_t *) gen_code_ptr; ++vp)
  434 + if (*vp == fixup->value)
434 break; 435 break;
435 - if (vp == gen_code_ptr) { 436 + if (vp == (uint64_t *) gen_code_ptr) {
436 /* Nope, we need to put the value in the GOT: */ 437 /* Nope, we need to put the value in the GOT: */
437 - *(uint64_t *) vp = fixup->value; 438 + *vp = fixup->value;
438 gen_code_ptr += 8; 439 gen_code_ptr += 8;
439 } 440 }
440 ia64_imm22(fixup->addr, (long) vp - gp); 441 ia64_imm22(fixup->addr, (long) vp - gp);
exec-all.h
@@ -346,8 +346,8 @@ do {\ @@ -346,8 +346,8 @@ do {\
346 cache flushing, but slower because of indirect jump) */ 346 cache flushing, but slower because of indirect jump) */
347 #define GOTO_TB(opname, tbparam, n)\ 347 #define GOTO_TB(opname, tbparam, n)\
348 do {\ 348 do {\
349 - static void __attribute__((unused)) *dummy ## n = &&dummy_label ## n;\  
350 - static void __attribute__((unused)) *__op_label ## n \ 349 + static void __attribute__((used)) *dummy ## n = &&dummy_label ## n;\
  350 + static void __attribute__((used)) *__op_label ## n \
351 __asm__(ASM_OP_LABEL_NAME(n, opname)) = &&label ## n;\ 351 __asm__(ASM_OP_LABEL_NAME(n, opname)) = &&label ## n;\
352 goto *(void *)(((TranslationBlock *)tbparam)->tb_next[n]);\ 352 goto *(void *)(((TranslationBlock *)tbparam)->tb_next[n]);\
353 label ## n: ;\ 353 label ## n: ;\