Use ldl_he_p / ldq_he_p functions instead of a plain memory access through pointer.
Signed-off-by: Anatoly Trosinenko <anatoly.trosine...@gmail.com> --- tcg/tci.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tcg/tci.c b/tcg/tci.c index 33edca1903..410817cf6a 100644 --- a/tcg/tci.c +++ b/tcg/tci.c @@ -159,7 +159,13 @@ static uint64_t tci_uint64(uint32_t high, uint32_t low) /* Read constant (native size) from bytecode. */ static tcg_target_ulong tci_read_i(uint8_t **tb_ptr) { - tcg_target_ulong value = *(tcg_target_ulong *)(*tb_ptr); +#if TCG_TARGET_REG_BITS == 32 + tcg_target_ulong value = ldl_he_p(*tb_ptr); +#elif TCG_TARGET_REG_BITS == 64 + tcg_target_ulong value = ldq_he_p(*tb_ptr); +#else +#error unsupported +#endif *tb_ptr += sizeof(value); return value; } @@ -167,7 +173,7 @@ static tcg_target_ulong tci_read_i(uint8_t **tb_ptr) /* Read unsigned constant (32 bit) from bytecode. */ static uint32_t tci_read_i32(uint8_t **tb_ptr) { - uint32_t value = *(uint32_t *)(*tb_ptr); + uint32_t value = ldl_he_p(*tb_ptr); *tb_ptr += sizeof(value); return value; } @@ -175,7 +181,7 @@ static uint32_t tci_read_i32(uint8_t **tb_ptr) /* Read signed constant (32 bit) from bytecode. */ static int32_t tci_read_s32(uint8_t **tb_ptr) { - int32_t value = *(int32_t *)(*tb_ptr); + int32_t value = ldl_he_p(*tb_ptr); *tb_ptr += sizeof(value); return value; } @@ -184,7 +190,7 @@ static int32_t tci_read_s32(uint8_t **tb_ptr) /* Read constant (64 bit) from bytecode. */ static uint64_t tci_read_i64(uint8_t **tb_ptr) { - uint64_t value = *(uint64_t *)(*tb_ptr); + uint64_t value = ldq_he_p(*tb_ptr); *tb_ptr += sizeof(value); return value; } @@ -1094,7 +1100,7 @@ uintptr_t tcg_qemu_tb_exec(CPUArchState *env, uint8_t *tb_ptr) /* QEMU specific operations. */ case INDEX_op_exit_tb: - ret = *(uint64_t *)tb_ptr; + ret = ldq_he_p(tb_ptr); goto exit; break; case INDEX_op_goto_tb: -- 2.14.1