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
This commit is contained in:
balrog 2007-07-02 14:06:26 +00:00
parent 2657c66332
commit 6d8aa3bfed
2 changed files with 8 additions and 7 deletions

View File

@ -392,7 +392,8 @@ static inline void ia64_apply_fixes (uint8_t **gen_code_pp,
0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, /* nop 0; brl IP */ 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, /* nop 0; brl IP */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0
}; };
uint8_t *gen_code_ptr = *gen_code_pp, *plt_start, *got_start, *vp; uint8_t *gen_code_ptr = *gen_code_pp, *plt_start, *got_start;
uint64_t *vp;
struct ia64_fixup *fixup; struct ia64_fixup *fixup;
unsigned int offset = 0; unsigned int offset = 0;
struct fdesc { struct fdesc {
@ -429,12 +430,12 @@ static inline void ia64_apply_fixes (uint8_t **gen_code_pp,
/* First, create the GOT: */ /* First, create the GOT: */
for (fixup = ltoff_fixes; fixup; fixup = fixup->next) { for (fixup = ltoff_fixes; fixup; fixup = fixup->next) {
/* first check if we already have this value in the GOT: */ /* first check if we already have this value in the GOT: */
for (vp = got_start; vp < gen_code_ptr; ++vp) for (vp = (uint64_t *) got_start; vp < (uint64_t *) gen_code_ptr; ++vp)
if (*(uint64_t *) vp == fixup->value) if (*vp == fixup->value)
break; break;
if (vp == gen_code_ptr) { if (vp == (uint64_t *) gen_code_ptr) {
/* Nope, we need to put the value in the GOT: */ /* Nope, we need to put the value in the GOT: */
*(uint64_t *) vp = fixup->value; *vp = fixup->value;
gen_code_ptr += 8; gen_code_ptr += 8;
} }
ia64_imm22(fixup->addr, (long) vp - gp); ia64_imm22(fixup->addr, (long) vp - gp);

View File

@ -346,8 +346,8 @@ do {\
cache flushing, but slower because of indirect jump) */ cache flushing, but slower because of indirect jump) */
#define GOTO_TB(opname, tbparam, n)\ #define GOTO_TB(opname, tbparam, n)\
do {\ do {\
static void __attribute__((unused)) *dummy ## n = &&dummy_label ## n;\ static void __attribute__((used)) *dummy ## n = &&dummy_label ## n;\
static void __attribute__((unused)) *__op_label ## n \ static void __attribute__((used)) *__op_label ## n \
__asm__(ASM_OP_LABEL_NAME(n, opname)) = &&label ## n;\ __asm__(ASM_OP_LABEL_NAME(n, opname)) = &&label ## n;\
goto *(void *)(((TranslationBlock *)tbparam)->tb_next[n]);\ goto *(void *)(((TranslationBlock *)tbparam)->tb_next[n]);\
label ## n: ;\ label ## n: ;\