19f5d78b9a
Fix endianness issues in DictZip block driver (bsc#937572, bsc#945778) OBS-URL: https://build.opensuse.org/request/show/337299 OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=273
84 lines
3.5 KiB
Diff
84 lines
3.5 KiB
Diff
From cf25e5be2ef07247d563a0aec6edc719a1f6a5aa Mon Sep 17 00:00:00 2001
|
|
From: Richard Henderson <rth@twiddle.net>
|
|
Date: Tue, 1 Sep 2015 15:58:02 -0400
|
|
Subject: [PATCH] tcg/aarch64: Fix tcg_out_qemu_{ld, st} for guest_base == 0
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
In ffc6372851d8631a9f9fa56ec613b3244dc635b9, we swapped the guest
|
|
base to the address base register from the address index register.
|
|
Except that 31 in the base slot is SP not XZR, so we need to be
|
|
more intelligent about which reg gets placed in which slot.
|
|
|
|
Cc: qemu-stable@nongnu.org (v2.4.0)
|
|
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Reported-by: Andreas Färber <afaerber@suse.de>
|
|
Signed-off-by: Richard Henderson <rth@twiddle.net>
|
|
(cherry picked from commit 352bcb0a2b816ff9ab9d75d0f2384650d9e9ab19)
|
|
[AF: Backported to GUEST_BASE and CONFIG_USE_GUEST_BASE]
|
|
Signed-off-by: Andreas Färber <afaerber@suse.de>
|
|
---
|
|
tcg/aarch64/tcg-target.c | 27 ++++++++++++++++++++-------
|
|
1 file changed, 20 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/tcg/aarch64/tcg-target.c b/tcg/aarch64/tcg-target.c
|
|
index b7ec4f5..354c89d 100644
|
|
--- a/tcg/aarch64/tcg-target.c
|
|
+++ b/tcg/aarch64/tcg-target.c
|
|
@@ -56,6 +56,11 @@ static const int tcg_target_call_oarg_regs[1] = {
|
|
#define TCG_REG_TMP TCG_REG_X30
|
|
|
|
#ifndef CONFIG_SOFTMMU
|
|
+/* Note that XZR cannot be encoded in the address base register slot,
|
|
+ as that actaully encodes SP. So if we need to zero-extend the guest
|
|
+ address, via the address index register slot, we need to load even
|
|
+ a zero guest base into a register. */
|
|
+# define USE_GUEST_BASE (GUEST_BASE != 0 || TARGET_LONG_BITS == 32)
|
|
# ifdef CONFIG_USE_GUEST_BASE
|
|
# define TCG_REG_GUEST_BASE TCG_REG_X28
|
|
# else
|
|
@@ -1216,9 +1221,13 @@ static void tcg_out_qemu_ld(TCGContext *s, TCGReg data_reg, TCGReg addr_reg,
|
|
add_qemu_ldst_label(s, true, oi, ext, data_reg, addr_reg,
|
|
s->code_ptr, label_ptr);
|
|
#else /* !CONFIG_SOFTMMU */
|
|
- tcg_out_qemu_ld_direct(s, memop, ext, data_reg,
|
|
- GUEST_BASE ? TCG_REG_GUEST_BASE : TCG_REG_XZR,
|
|
- otype, addr_reg);
|
|
+ if (USE_GUEST_BASE) {
|
|
+ tcg_out_qemu_ld_direct(s, memop, ext, data_reg,
|
|
+ TCG_REG_GUEST_BASE, otype, addr_reg);
|
|
+ } else {
|
|
+ tcg_out_qemu_ld_direct(s, memop, ext, data_reg,
|
|
+ addr_reg, TCG_TYPE_I64, TCG_REG_XZR);
|
|
+ }
|
|
#endif /* CONFIG_SOFTMMU */
|
|
}
|
|
|
|
@@ -1238,9 +1247,13 @@ static void tcg_out_qemu_st(TCGContext *s, TCGReg data_reg, TCGReg addr_reg,
|
|
add_qemu_ldst_label(s, false, oi, s_bits == MO_64, data_reg, addr_reg,
|
|
s->code_ptr, label_ptr);
|
|
#else /* !CONFIG_SOFTMMU */
|
|
- tcg_out_qemu_st_direct(s, memop, data_reg,
|
|
- GUEST_BASE ? TCG_REG_GUEST_BASE : TCG_REG_XZR,
|
|
- otype, addr_reg);
|
|
+ if (USE_GUEST_BASE) {
|
|
+ tcg_out_qemu_st_direct(s, memop, data_reg,
|
|
+ TCG_REG_GUEST_BASE, otype, addr_reg);
|
|
+ } else {
|
|
+ tcg_out_qemu_st_direct(s, memop, data_reg,
|
|
+ addr_reg, TCG_TYPE_I64, TCG_REG_XZR);
|
|
+ }
|
|
#endif /* CONFIG_SOFTMMU */
|
|
}
|
|
|
|
@@ -1795,7 +1808,7 @@ static void tcg_target_qemu_prologue(TCGContext *s)
|
|
CPU_TEMP_BUF_NLONGS * sizeof(long));
|
|
|
|
#if defined(CONFIG_USE_GUEST_BASE)
|
|
- if (GUEST_BASE) {
|
|
+ if (USE_GUEST_BASE) {
|
|
tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_GUEST_BASE, GUEST_BASE);
|
|
tcg_regset_set_reg(s->reserved_regs, TCG_REG_GUEST_BASE);
|
|
}
|