* [Qemu-devel] [PATCH] arm: fix ldrexd/strexd
@ 2010-11-04 17:47 Peter Maydell
2010-12-07 15:33 ` [Qemu-devel] " Nathan Froyd
0 siblings, 1 reply; 2+ messages in thread
From: Peter Maydell @ 2010-11-04 17:47 UTC (permalink / raw)
To: qemu-devel
Correct ldrexd and strexd code to always read and write the
high word of the 64-bit value from addr+4.
Also make ldrexd and strexd agree that for a 64 bit value the
address in env->exclusive_addr is that of the low word.
This fixes the issues reported in
https://bugs.launchpad.net/qemu/+bug/670883
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
linux-user/main.c | 2 +-
target-arm/translate.c | 8 +++++---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/linux-user/main.c b/linux-user/main.c
index dbba8be..274019f 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -589,7 +589,7 @@ static int do_strex(CPUARMState *env)
}
if (size == 3) {
val = env->regs[(env->exclusive_info >> 12) & 0xf];
- segv = put_user_u32(val, addr);
+ segv = put_user_u32(val, addr + 4);
if (segv) {
env->cp15.c6_data = addr + 4;
goto done;
diff --git a/target-arm/translate.c b/target-arm/translate.c
index 6fcdd7e..0acdab5 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -5926,8 +5926,10 @@ static void gen_load_exclusive(DisasContext *s, int rt, int rt2,
tcg_gen_mov_i32(cpu_exclusive_val, tmp);
store_reg(s, rt, tmp);
if (size == 3) {
- tcg_gen_addi_i32(addr, addr, 4);
- tmp = gen_ld32(addr, IS_USER(s));
+ TCGv tmp2 = new_tmp();
+ tcg_gen_addi_i32(tmp2, addr, 4);
+ tmp = gen_ld32(tmp2, IS_USER(s));
+ dead_tmp(tmp2);
tcg_gen_mov_i32(cpu_exclusive_high, tmp);
store_reg(s, rt2, tmp);
}
@@ -5987,7 +5989,7 @@ static void gen_store_exclusive(DisasContext *s, int rd, int rt, int rt2,
if (size == 3) {
TCGv tmp2 = new_tmp();
tcg_gen_addi_i32(tmp2, addr, 4);
- tmp = gen_ld32(addr, IS_USER(s));
+ tmp = gen_ld32(tmp2, IS_USER(s));
dead_tmp(tmp2);
tcg_gen_brcond_i32(TCG_COND_NE, tmp, cpu_exclusive_high, fail_label);
dead_tmp(tmp);
--
1.6.3.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Qemu-devel] Re: arm: fix ldrexd/strexd
2010-11-04 17:47 [Qemu-devel] [PATCH] arm: fix ldrexd/strexd Peter Maydell
@ 2010-12-07 15:33 ` Nathan Froyd
0 siblings, 0 replies; 2+ messages in thread
From: Nathan Froyd @ 2010-12-07 15:33 UTC (permalink / raw)
To: Peter Maydell; +Cc: qemu-devel
On Thu, Nov 04, 2010 at 07:47:45AM -0000, Peter Maydell wrote:
> Correct ldrexd and strexd code to always read and write the
> high word of the 64-bit value from addr+4.
> Also make ldrexd and strexd agree that for a 64 bit value the
> address in env->exclusive_addr is that of the low word.
>
> This fixes the issues reported in
> https://bugs.launchpad.net/qemu/+bug/670883
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Nathan Froyd <froydnj@codesourcery.com>
-Nathan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-12-07 15:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-04 17:47 [Qemu-devel] [PATCH] arm: fix ldrexd/strexd Peter Maydell
2010-12-07 15:33 ` [Qemu-devel] " Nathan Froyd
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).