* [Qemu-devel] [PATCH] target/arm: Fix aa64 ldp register writeback
@ 2017-08-25 22:48 Richard Henderson
2017-09-04 11:08 ` [Qemu-devel] [Qemu-arm] " Peter Maydell
0 siblings, 1 reply; 2+ messages in thread
From: Richard Henderson @ 2017-08-25 22:48 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-arm, qemu-stable
For "ldp x0, x1, [x0]", if the second load is on a second page and
the second page is unmapped, the exception would be raised with x0
already modified. This means the instruction couldn't be restarted.
Cc: qemu-arm@nongnu.org
Cc: qemu-stable@nongnu.org
Reported-by: Andrew <andrew@fubar.geek.nz>
Fixes: https://bugs.launchpad.net/qemu/+bug/1713066
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/translate-a64.c | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
index c596025b04..bfba816a77 100644
--- a/target/arm/translate-a64.c
+++ b/target/arm/translate-a64.c
@@ -2217,29 +2217,33 @@ static void disas_ldst_pair(DisasContext *s, uint32_t insn)
} else {
do_fp_st(s, rt, tcg_addr, size);
}
- } else {
- TCGv_i64 tcg_rt = cpu_reg(s, rt);
- if (is_load) {
- do_gpr_ld(s, tcg_rt, tcg_addr, size, is_signed, false,
- false, 0, false, false);
- } else {
- do_gpr_st(s, tcg_rt, tcg_addr, size,
- false, 0, false, false);
- }
- }
- tcg_gen_addi_i64(tcg_addr, tcg_addr, 1 << size);
- if (is_vector) {
+ tcg_gen_addi_i64(tcg_addr, tcg_addr, 1 << size);
if (is_load) {
do_fp_ld(s, rt2, tcg_addr, size);
} else {
do_fp_st(s, rt2, tcg_addr, size);
}
} else {
+ TCGv_i64 tcg_rt = cpu_reg(s, rt);
TCGv_i64 tcg_rt2 = cpu_reg(s, rt2);
+
if (is_load) {
+ TCGv_i64 tmp = tcg_temp_new_i64();
+
+ /* Do not modify tcg_rt before recognizing any exception
+ from the second load. */
+ do_gpr_ld(s, tmp, tcg_addr, size, is_signed, false,
+ false, 0, false, false);
+ tcg_gen_addi_i64(tcg_addr, tcg_addr, 1 << size);
do_gpr_ld(s, tcg_rt2, tcg_addr, size, is_signed, false,
false, 0, false, false);
+
+ tcg_gen_mov_i64(tcg_rt, tmp);
+ tcg_temp_free_i64(tmp);
} else {
+ do_gpr_st(s, tcg_rt, tcg_addr, size,
+ false, 0, false, false);
+ tcg_gen_addi_i64(tcg_addr, tcg_addr, 1 << size);
do_gpr_st(s, tcg_rt2, tcg_addr, size,
false, 0, false, false);
}
--
2.13.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [Qemu-arm] [PATCH] target/arm: Fix aa64 ldp register writeback
2017-08-25 22:48 [Qemu-devel] [PATCH] target/arm: Fix aa64 ldp register writeback Richard Henderson
@ 2017-09-04 11:08 ` Peter Maydell
0 siblings, 0 replies; 2+ messages in thread
From: Peter Maydell @ 2017-09-04 11:08 UTC (permalink / raw)
To: Richard Henderson; +Cc: QEMU Developers, qemu-arm, qemu-stable
On 25 August 2017 at 23:48, Richard Henderson
<richard.henderson@linaro.org> wrote:
> For "ldp x0, x1, [x0]", if the second load is on a second page and
> the second page is unmapped, the exception would be raised with x0
> already modified. This means the instruction couldn't be restarted.
>
> Cc: qemu-arm@nongnu.org
> Cc: qemu-stable@nongnu.org
> Reported-by: Andrew <andrew@fubar.geek.nz>
> Fixes: https://bugs.launchpad.net/qemu/+bug/1713066
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> target/arm/translate-a64.c | 28 ++++++++++++++++------------
> 1 file changed, 16 insertions(+), 12 deletions(-)
Applied to target-arm.next, thanks.
-- PMM
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-09-04 11:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-25 22:48 [Qemu-devel] [PATCH] target/arm: Fix aa64 ldp register writeback Richard Henderson
2017-09-04 11:08 ` [Qemu-devel] [Qemu-arm] " Peter Maydell
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.