[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] target-sparc: fix register corruption in ldstub

From: Mark Cave-Ayland
Subject: Re: [Qemu-devel] [PATCH] target-sparc: fix register corruption in ldstub if there is no write permission
Date: Fri, 24 Jun 2016 17:57:11 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.1.0

On 24/06/16 17:01, Artyom Tarasenko wrote:

On Fri, Jun 24, 2016 at 5:51 PM, Mark Cave-Ayland
<address@hidden> wrote:
On 24/06/16 13:34, Artyom Tarasenko wrote:

Signed-off-by: Artyom Tarasenko <address@hidden>
 target-sparc/translate.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/target-sparc/translate.c b/target-sparc/translate.c
index 5111cf0..065326c 100644
--- a/target-sparc/translate.c
+++ b/target-sparc/translate.c
@@ -5187,12 +5187,15 @@ printf("ops, illegal rdhpr\n");
                 case 0xd:       /* ldstub -- XXX: should be atomically */
                         TCGv r_const;
+                        TCGv tmp = tcg_temp_new();

                         gen_address_mask(dc, cpu_addr);
-                        tcg_gen_qemu_ld8u(cpu_val, cpu_addr,
+                        tcg_gen_qemu_ld8u(tmp, cpu_addr, dc->mem_idx);
                         r_const = tcg_const_tl(0xff);
                         tcg_gen_qemu_st8(r_const, cpu_addr, dc->mem_idx);
+                        tcg_gen_mov_tl(cpu_val, tmp);
+                        tcg_temp_free(tmp);
                 case 0x0f:

Looks like you beat me to it - I can confirm that this fixes the issue here
for me. Whilst testing I noticed another regression under qemu-system-sparc,
however bisection reveals that this isn't caused by a SPARC-specific patch
(and can be followed up separately) so:

Tested-by: Mark Cave-Ayland <address@hidden>

Good. Then we can route it via your tree. (With Richard's Reviewed-by)
I'm still worried why it didn't hit us before.

Oops, looks like our mails overlapped. In that case I'll send a pull request ASAP.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]