qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Incorrect handling of PPC64 rldcl insn


From: Alexander Graf
Subject: Re: [Qemu-devel] Incorrect handling of PPC64 rldcl insn
Date: Mon, 06 May 2013 19:47:25 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.3) Gecko/20120306 Thunderbird/10.0.3

On 05/06/2013 07:00 PM, Torbjorn Granlund wrote:
I could finally make Debian GNU/Linux install and run under
qemu-system-ppc64.  I used Debian 7.0.0 and qemu from the main git repo,
updated a few days ago.

While Debian runs well and not too slowly, GMP fails badly under all
ABIs, and in many different ways.  I have isolated the first problem.

Test case:

#include<stdio.h>
int
main ()
{
   unsigned long r;
   asm ("rldcl\t%0, %1, %2, 0" : "=r" (r) : "r" (0xcafebabedeadbeeful), "r" 
(16));
   printf ("%lx\n", r);
   return 0;
}

Expected output:
babedeadbeefcafe

Output under qemu:
0

I have single stepped in gdb to determine that it is indeed rldcl that
misbehaves.

Thanks a lot for the bug report and test case! Please CC qemu-ppc whenever you find issues or have patches for PPC. That makes filtering for important mails a lot easier.

Does the patch below fix the issue for you?


Alex

diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index 0886f4d..a018616 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -1733,8 +1733,6 @@ static inline void gen_rldnm(DisasContext *ctx, uint32_t mb, uint32_t me)
 {
     TCGv t0;

-    mb = MB(ctx->opcode);
-    me = ME(ctx->opcode);
     t0 = tcg_temp_new();
     tcg_gen_andi_tl(t0, cpu_gpr[rB(ctx->opcode)], 0x3f);
     tcg_gen_rotl_tl(t0, cpu_gpr[rS(ctx->opcode)], t0);




reply via email to

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